:root {
    color-scheme: light dark;

    --background: #f5f5f7;
    --background-secondary: #ffffff;
    --surface: rgba(255, 255, 255, 0.82);
    --surface-hover: #ffffff;
    --text: #1d1d1f;
    --text-secondary: #6e6e73;
    --border: rgba(0, 0, 0, 0.08);
    --shadow: 0 16px 45px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 22px 55px rgba(0, 0, 0, 0.13);

    --blue: #0071e3;
    --green: #1fa855;
    --purple: #8e44ff;
    --orange: #f07818;
    --red: #e5484d;
    --pink: #d94092;
    --yellow: #bf8700;
    --cyan: #008da8;

    --radius-medium: 22px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --background: #000000;
        --background-secondary: #111113;
        --surface: rgba(28, 28, 30, 0.86);
        --surface-hover: #242426;
        --text: #f5f5f7;
        --text-secondary: #a1a1a6;
        --border: rgba(255, 255, 255, 0.11);
        --shadow: 0 18px 55px rgba(0, 0, 0, 0.45);
        --shadow-hover: 0 24px 65px rgba(0, 0, 0, 0.6);
    }
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(
            circle at 10% 0%,
            rgba(0, 113, 227, 0.11),
            transparent 32rem
        ),
        radial-gradient(
            circle at 95% 12%,
            rgba(142, 68, 255, 0.09),
            transparent 28rem
        ),
        var(--background);
    color: var(--text);
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Helvetica,
        Arial,
        sans-serif;
}

a {
    color: inherit;
}

button,
input {
    font: inherit;
}

.page {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
}

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 84px;
    padding: 16px 0;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
    text-decoration: none;
}

.brand-mark {
    display: block;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    border-radius: 14px;
    object-fit: cover;
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.brand-text strong {
    font-size: 17px;
    letter-spacing: -0.02em;
}

.brand-text span {
    color: var(--text-secondary);
    font-size: 12px;
}

.header-links {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 8px;
}

.header-link {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    padding: 0 17px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 650;
    transition:
        transform 160ms ease,
        background 160ms ease,
        border-color 160ms ease;
}

.header-link:hover {
    transform: translateY(-2px);
    background: var(--surface-hover);
    border-color: rgba(0, 113, 227, 0.35);
}

.header-link:focus-visible,
.card:focus-visible,
.search:focus-visible,
.clear-search:focus-visible,
.brand:focus-visible {
    outline: 3px solid rgba(0, 113, 227, 0.28);
    outline-offset: 3px;
}

/* O conteudo aparece logo abaixo do cabecalho, sem textos promocionais. */
.content {
    padding: 32px 0 72px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Pesquisa no topo, imediatamente a esquerda do Instagram. */
.search-area {
    position: relative;
    flex: 0 1 320px;
    width: 320px;
    min-width: 190px;
    margin-left: auto;
}

.search-area svg {
    position: absolute;
    top: 50%;
    left: 16px;
    width: 18px;
    height: 18px;
    transform: translateY(-50%);
    fill: var(--text-secondary);
    pointer-events: none;
}

.search {
    width: 100%;
    height: 42px;
    padding: 0 43px;
    border: 1px solid var(--border);
    border-radius: 999px;
    outline: none;
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.04);
    font-size: 14px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transition:
        border-color 160ms ease,
        box-shadow 160ms ease;
}

.search:focus {
    border-color: rgba(0, 113, 227, 0.55);
    box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.12);
}

.search::placeholder {
    color: var(--text-secondary);
}

.clear-search {
    position: absolute;
    top: 50%;
    right: 7px;
    display: none;
    width: 28px;
    height: 28px;
    padding: 0;
    transform: translateY(-50%);
    border: 0;
    border-radius: 50%;
    background: rgba(127, 127, 127, 0.14);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 18px;
}

.clear-search.visible {
    display: block;
}

.filters {
    display: flex;
    gap: 9px;
    flex-wrap: wrap;
    margin: 0 0 20px;
}

.filter {
    min-height: 38px;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 650;
    cursor: pointer;
    transition: background 150ms ease, color 150ms ease, transform 150ms ease;
}

.filter:hover {
    transform: translateY(-1px);
    color: var(--text);
}

.filter.active {
    background: var(--text);
    border-color: var(--text);
    color: var(--background);
}

.filter:focus-visible {
    outline: 3px solid rgba(0, 113, 227, 0.28);
    outline-offset: 3px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.card {
    position: relative;
    display: flex;
    min-height: 204px;
    flex-direction: column;
    padding: 18px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 19px;
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
    box-shadow: var(--shadow);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transition:
        transform 180ms ease,
        box-shadow 180ms ease,
        border-color 180ms ease,
        background 180ms ease;
}

.card::after {
    position: absolute;
    top: -42px;
    right: -42px;
    width: 112px;
    height: 112px;
    border-radius: 50%;
    background: var(--accent-soft);
    content: "";
    transition: transform 220ms ease;
}

.card:hover {
    transform: translateY(-6px);
    border-color: var(--accent-border);
    background: var(--surface-hover);
    box-shadow: var(--shadow-hover);
}

.card:hover::after {
    transform: scale(1.2);
}

.card.hidden {
    display: none;
}

.card-icon {
    position: relative;
    z-index: 1;
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    margin-bottom: 12px;
    border-radius: 12px;
    background: var(--accent-soft);
    font-size: 20px;
}

.card h3 {
    position: relative;
    z-index: 1;
    margin: 0;
    font-size: 18px;
    letter-spacing: -0.035em;
}

.card p {
    position: relative;
    z-index: 1;
    margin: 8px 0 14px;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.45;
}

.card-footer {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: auto;
    color: var(--accent);
    font-size: 12.5px;
    font-weight: 700;
}

.card-arrow {
    display: grid;
    width: 27px;
    height: 27px;
    flex: 0 0 27px;
    place-items: center;
    border-radius: 50%;
    background: var(--accent-soft);
    font-size: 18px;
    transition: transform 180ms ease;
}

.card:hover .card-arrow {
    transform: translateX(3px);
}

.accent-blue {
    --accent: var(--blue);
    --accent-soft: rgba(0, 113, 227, 0.12);
    --accent-border: rgba(0, 113, 227, 0.3);
}

.accent-green {
    --accent: var(--green);
    --accent-soft: rgba(31, 168, 85, 0.13);
    --accent-border: rgba(31, 168, 85, 0.3);
}

.accent-purple {
    --accent: var(--purple);
    --accent-soft: rgba(142, 68, 255, 0.13);
    --accent-border: rgba(142, 68, 255, 0.3);
}

.accent-orange {
    --accent: var(--orange);
    --accent-soft: rgba(240, 120, 24, 0.14);
    --accent-border: rgba(240, 120, 24, 0.3);
}

.accent-red {
    --accent: var(--red);
    --accent-soft: rgba(229, 72, 77, 0.13);
    --accent-border: rgba(229, 72, 77, 0.3);
}

.accent-pink {
    --accent: var(--pink);
    --accent-soft: rgba(217, 64, 146, 0.13);
    --accent-border: rgba(217, 64, 146, 0.3);
}

.accent-yellow {
    --accent: var(--yellow);
    --accent-soft: rgba(191, 135, 0, 0.14);
    --accent-border: rgba(191, 135, 0, 0.3);
}

.accent-cyan {
    --accent: var(--cyan);
    --accent-soft: rgba(0, 141, 168, 0.14);
    --accent-border: rgba(0, 141, 168, 0.3);
}

.empty-state {
    display: none;
    padding: 55px 25px;
    border: 1px dashed var(--border);
    border-radius: var(--radius-medium);
    color: var(--text-secondary);
    text-align: center;
}

.empty-state.visible {
    display: block;
}

.empty-state strong {
    display: block;
    margin-bottom: 7px;
    color: var(--text);
    font-size: 18px;
}

.footer {
    padding: 28px 0 38px;
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
    text-align: center;
    font-size: 13px;
    line-height: 1.7;
}

.footer p {
    margin: 0;
}

@media (max-width: 1100px) {
    .grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .header {
        gap: 10px;
    }

    .search-area {
        flex-basis: 260px;
    }

    .header-link {
        padding-inline: 12px;
    }
}

@media (max-width: 820px) {
    .header {
        flex-wrap: wrap;
    }

    .search-area {
        order: 3;
        flex: 1 0 100%;
        width: 100%;
        margin-left: 0;
    }

    .content {
        padding-top: 18px;
    }

    .grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 540px) {
    .page {
        width: min(100% - 24px, 1180px);
    }

    .header {
        min-height: 72px;
    }

    .brand-text span {
        display: none;
    }

    .header-link.youtube,
    .header-link.github {
        display: none;
    }

    .header-link {
        min-height: 38px;
        padding-inline: 11px;
        font-size: 12px;
    }

    .content {
        padding-top: 18px;
        padding-bottom: 44px;
    }

    .filters {
        gap: 6px;
        margin-bottom: 14px;
    }

    .filter {
        padding: 7px 12px;
        font-size: 12px;
    }

    .grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
    }

    .card {
        min-height: 166px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition: none !important;
        animation: none !important;
    }
}
