/* ==========================================================================
   Aves Paulistanas — site público
   Direção: caderno de campo de naturalista. Papel, tinta verde-musgo,
   urucum (o laranja do peito do sabiá) como destaque, curvas de nível.
   O admin NÃO usa este arquivo (ele segue em style.css + Bulma).
   ========================================================================== */

:root,
[data-theme="light"] {
    --paper: #f4efe3;
    --paper-deep: #ebe3cf;
    --card: #fbf8f0;
    --ink: #1c2a20;
    --ink-soft: #435246;
    --muted: #6d786c;
    --line: #d9cfb8;
    --line-soft: #e6dfcc;
    --moss: #2f5a3a;
    --moss-bright: #3d7a4e;
    --forest: #132a1c;
    --forest-ink: #f2ecdc;
    --urucum: #c24e2c;
    --urucum-deep: #a13d1f;
    --urucum-soft: rgba(194, 78, 44, 0.12);
    --ochre: #d39b2f;
    --contour: rgba(47, 90, 58, 0.11);
    --shadow: 0 1px 2px rgba(40, 32, 12, 0.06), 0 6px 18px -8px rgba(40, 32, 12, 0.18);
    --shadow-lift: 0 2px 4px rgba(40, 32, 12, 0.08), 0 18px 36px -14px rgba(40, 32, 12, 0.32);
    --swatch-ring: rgba(28, 42, 32, 0.28);

    --font-display: "Young Serif", "Iowan Old Style", Georgia, serif;
    --font-sci: "Instrument Serif", "Iowan Old Style", Georgia, serif;
    --font-body: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;

    --radius: 16px;
    --radius-sm: 10px;
    --pill: 999px;
    --wrap: 1180px;
    --gutter: clamp(16px, 4vw, 40px);
}

[data-theme="dark"] {
    --paper: #0f1812;
    --paper-deep: #152119;
    --card: #18251c;
    --ink: #ece6d4;
    --ink-soft: #c5c0ad;
    --muted: #949a89;
    --line: #2b3a2f;
    --line-soft: #223027;
    --moss: #8fc59c;
    --moss-bright: #a9d8b4;
    --forest: #08100b;
    --forest-ink: #ece6d4;
    --urucum: #ee8058;
    --urucum-deep: #f59a78;
    --urucum-soft: rgba(238, 128, 88, 0.16);
    --ochre: #e2b357;
    --contour: rgba(143, 197, 156, 0.08);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 22px -10px rgba(0, 0, 0, 0.6);
    --shadow-lift: 0 2px 6px rgba(0, 0, 0, 0.4), 0 22px 40px -16px rgba(0, 0, 0, 0.75);
    --swatch-ring: rgba(236, 230, 212, 0.35);
}

/* --- Base ---------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html {
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 1.6;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: 88px;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--paper);
    /* grão de papel, bem sutil */
    background-image: radial-gradient(rgba(120, 100, 60, 0.05) 0.6px, transparent 0.7px);
    background-size: 5px 5px;
    overflow-x: hidden;
}

[data-theme="dark"] body {
    background-image: radial-gradient(rgba(255, 255, 255, 0.025) 0.6px, transparent 0.7px);
}

main { flex: 1; }

img { max-width: 100%; display: block; }

a { color: var(--moss); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--urucum); }

h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: 400;
    line-height: 1.1;
    letter-spacing: -0.01em;
    margin: 0;
    color: var(--ink);
}

p { margin: 0; }

mark {
    background: var(--urucum-soft);
    color: inherit;
    padding: 0 0.25em;
    border-radius: 4px;
}

:focus-visible {
    outline: 3px solid var(--urucum);
    outline-offset: 3px;
    border-radius: 6px;
}

.wrap {
    width: 100%;
    max-width: var(--wrap);
    margin: 0 auto;
    padding: 0 var(--gutter);
}

.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.skip-link {
    position: absolute;
    left: 12px; top: -60px;
    background: var(--ink);
    color: var(--paper);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    z-index: 100;
    transition: top 0.2s;
}
.skip-link:focus { top: 12px; }

.sci {
    font-family: var(--font-sci);
    font-style: italic;
    font-size: 1.08em;
    letter-spacing: 0.005em;
    color: var(--muted);
}

.eyebrow {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--urucum);
    display: inline-flex;
    align-items: center;
    gap: 10px;
}
.eyebrow::before {
    content: "";
    width: 26px; height: 2px;
    background: currentColor;
    border-radius: 2px;
}

/* --- Botões e links utilitários ------------------------------------------- */

.button {
    appearance: none;
    border: 0;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    color: #fff;
    background: var(--urucum);
    padding: 0.72em 1.35em;
    border-radius: var(--pill);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 6px 16px -8px var(--urucum);
}
.button:hover { background: var(--urucum-deep); color: #fff; transform: translateY(-1px); }
.button:active { transform: translateY(1px) scale(0.98); }
[data-theme="dark"] .button { color: #1a0e08; }
[data-theme="dark"] .button:hover { color: #1a0e08; }

.button--quiet {
    background: transparent;
    color: var(--moss);
    box-shadow: inset 0 0 0 1.5px currentColor;
}
.button--quiet:hover { background: var(--moss); color: var(--paper); }
[data-theme="dark"] .button--quiet { color: var(--moss); }
[data-theme="dark"] .button--quiet:hover { color: var(--paper); }

.link-reset {
    font-weight: 700;
    color: var(--urucum);
    white-space: nowrap;
}

/* --- Cabeçalho ------------------------------------------------------------ */

.site-header {
    position: sticky;
    top: 0;
    z-index: 30;
    background: color-mix(in srgb, var(--paper) 88%, transparent);
    backdrop-filter: blur(10px) saturate(1.2);
    -webkit-backdrop-filter: blur(10px) saturate(1.2);
    border-bottom: 1px solid var(--line-soft);
}

.site-header__inner {
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 68px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    text-decoration: none;
    margin-right: auto;
}
.brand:hover { color: var(--ink); }
.brand:hover .logo { transform: rotate(-6deg) translateY(-1px); }

.brand__name {
    font-family: var(--font-display);
    font-size: 1.28rem;
    letter-spacing: -0.01em;
    white-space: nowrap;
}
.brand__name em {
    font-family: var(--font-sci);
    font-size: 1.12em;
    color: var(--moss);
}

.logo { width: 38px; height: 38px; flex: none; transition: transform 0.35s cubic-bezier(.3,1.6,.5,1); }
.logo__branch { fill: none; stroke: var(--ink-soft); stroke-width: 2.2; stroke-linecap: round; }
.logo__leaf { fill: var(--moss-bright); }
.logo__body { fill: var(--ink); }
.logo__breast { fill: var(--urucum); }
.logo__eye { fill: var(--paper); }

.theme-toggle {
    appearance: none;
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--ink-soft);
    width: 42px; height: 42px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    cursor: pointer;
    flex: none;
    transition: transform 0.2s, color 0.2s, border-color 0.2s;
}
.theme-toggle:hover { color: var(--urucum); border-color: var(--urucum); transform: rotate(-12deg); }
.theme-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.theme-toggle .icon-moon { fill: currentColor; stroke: none; }
[data-theme="dark"] .theme-toggle .icon-moon,
[data-theme="light"] .theme-toggle .icon-sun { display: none; }

.header-search {
    position: relative;
    flex: 1 1 320px;
    max-width: 380px;
}
.header-search input {
    width: 100%;
    font: inherit;
    font-size: 0.95rem;
    padding: 0.55em 1em 0.55em 2.6em;
    border-radius: var(--pill);
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--ink);
}
.header-search input:focus { outline: none; border-color: var(--moss); box-shadow: 0 0 0 3px color-mix(in srgb, var(--moss) 22%, transparent); }
.header-search .search__icon { left: 0.9em; width: 18px; height: 18px; }

/* --- Avisos --------------------------------------------------------------- */

.notice {
    margin: 18px 0 0;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--urucum);
    background: var(--urucum-soft);
    font-weight: 700;
}

/* --- Hero / busca --------------------------------------------------------- */

.hero {
    position: relative;
    padding: clamp(40px, 7vw, 88px) 0 clamp(32px, 5vw, 56px);
    isolation: isolate;
}

.hero::before {
    /* curvas de nível, na cor do tema */
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: var(--contour);
    -webkit-mask: url("../img/contours.svg") center / cover no-repeat;
    mask: url("../img/contours.svg") center / cover no-repeat;
    opacity: 1;
}
.hero::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 120px;
    z-index: -1;
    background: linear-gradient(to bottom, transparent, var(--paper));
}

.hero__grid {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
    gap: clamp(28px, 5vw, 64px);
    align-items: center;
}

.hero__title {
    font-size: clamp(2.6rem, 7vw, 5.2rem);
    line-height: 0.98;
    margin: 18px 0 18px;
    letter-spacing: -0.025em;
}
.hero__title em {
    font-family: var(--font-sci);
    font-style: italic;
    color: var(--urucum);
    font-size: 1.12em;
    letter-spacing: 0;
}

.hero__lead {
    font-size: clamp(1.05rem, 1.6vw, 1.2rem);
    color: var(--ink-soft);
    max-width: 34em;
    margin-bottom: 28px;
}

.search {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--card);
    border: 1.5px solid var(--line);
    border-radius: var(--pill);
    padding: 6px 6px 6px 0;
    box-shadow: var(--shadow);
    max-width: 640px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.search:focus-within {
    border-color: var(--moss);
    box-shadow: var(--shadow), 0 0 0 4px color-mix(in srgb, var(--moss) 18%, transparent);
}
.search__icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px; height: 22px;
    fill: none;
    stroke: var(--muted);
    stroke-width: 2;
    stroke-linecap: round;
    pointer-events: none;
}
.search input {
    flex: 1;
    min-width: 0;
    border: 0;
    background: transparent;
    font: inherit;
    font-size: 1.08rem;
    color: var(--ink);
    padding: 0.7em 0.6em 0.7em 56px;
}
.search input:focus { outline: none; }
.search input::placeholder, .header-search input::placeholder { color: var(--muted); opacity: 0.85; }
.search .button { flex: none; }

.hero__examples {
    margin-top: 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
    font-size: 0.92rem;
    color: var(--muted);
}
.hero__examples a {
    color: var(--ink-soft);
    text-decoration: none;
    border-bottom: 1px dashed var(--line);
    padding: 0 2px;
}
.hero__examples a:hover { color: var(--urucum); border-color: var(--urucum); }

/* Ave do dia: uma "polaroid" presa no caderno */
.featured {
    display: block;
    justify-self: center;
    width: min(100%, 380px);
    text-decoration: none;
    color: var(--ink);
    transform: rotate(2.2deg);
    transition: transform 0.4s cubic-bezier(.3,1.4,.5,1);
    animation: drop-in 0.8s cubic-bezier(.2,1.2,.4,1) both 0.15s;
}
.featured:hover { transform: rotate(0deg) translateY(-4px); color: var(--ink); }
.featured figure {
    margin: 0;
    background: var(--card);
    padding: 12px 12px 18px;
    border-radius: 6px;
    box-shadow: var(--shadow-lift);
    position: relative;
}
.featured figure::before {
    /* fita adesiva */
    content: "";
    position: absolute;
    top: -14px; left: 50%;
    width: 96px; height: 28px;
    transform: translateX(-50%) rotate(-3deg);
    background: color-mix(in srgb, var(--ochre) 45%, transparent);
    border-radius: 2px;
    mix-blend-mode: multiply;
}
[data-theme="dark"] .featured figure::before { mix-blend-mode: normal; opacity: 0.6; }
.featured img {
    width: 100%;
    aspect-ratio: 4 / 5;
    object-fit: cover;
    border-radius: 3px;
}
.featured figcaption { display: grid; gap: 2px; padding: 14px 6px 0; }
.featured__label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--urucum);
}
.featured__name { font-family: var(--font-display); font-size: 1.45rem; line-height: 1.15; }

@keyframes drop-in {
    from { opacity: 0; transform: rotate(8deg) translateY(-24px); }
    to { opacity: 1; transform: rotate(2.2deg); }
}

/* --- Painel "O que você viu?" -------------------------------------------- */

.identify { position: relative; z-index: 1; }

.identify__panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.identify__panel > summary {
    list-style: none;
    cursor: pointer;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: baseline;
    gap: 4px 16px;
    padding: 20px 24px;
}
.identify__panel > summary::-webkit-details-marker { display: none; }
.identify__title { font-family: var(--font-display); font-size: 1.5rem; }
.identify__subtitle { color: var(--muted); font-size: 0.95rem; }
.identify__chevron {
    width: 24px; height: 24px;
    align-self: center;
    fill: none; stroke: var(--ink-soft); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
    transition: transform 0.25s;
}
.identify__panel[open] .identify__chevron { transform: rotate(180deg); }

.identify__groups {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 22px 28px;
    padding: 4px 24px 8px;
    border-top: 1px dashed var(--line);
    padding-top: 22px;
}
.facet { border: 0; margin: 0; padding: 0; min-width: 0; }
.facet--cor { grid-column: span 7; }
.facet--porte { grid-column: span 5; }
.facet--onde { grid-column: span 5; }
.facet--come { grid-column: span 7; }
.facet--quando { grid-column: span 12; }

.facet legend {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-soft);
    margin-bottom: 10px;
    padding: 0;
}
.facet legend small {
    text-transform: none;
    letter-spacing: 0;
    font-weight: 400;
    color: var(--muted);
    font-size: 0.86rem;
    margin-left: 6px;
}
.facet__options { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px 7px 12px;
    border: 1.5px solid var(--line);
    border-radius: var(--pill);
    background: var(--paper);
    cursor: pointer;
    font-size: 0.95rem;
    line-height: 1.2;
    user-select: none;
    transition: border-color 0.15s, background 0.15s, transform 0.12s, color 0.15s;
}
.chip input {
    position: absolute;
    opacity: 0;
    width: 1px; height: 1px;
    pointer-events: none;
}
.chip:hover { border-color: var(--moss); transform: translateY(-1px); }
.chip:has(input:focus-visible) { outline: 3px solid var(--urucum); outline-offset: 2px; }
.chip.is-on, .chip:has(input:checked) {
    background: var(--moss);
    border-color: var(--moss);
    color: var(--paper);
}
.chip.is-on .chip__hint, .chip:has(input:checked) .chip__hint,
.chip.is-on .chip__count, .chip:has(input:checked) .chip__count { color: inherit; opacity: 0.85; }
.chip.is-on .swatch, .chip:has(input:checked) .swatch { box-shadow: 0 0 0 2px var(--paper); }
.chip.is-empty { opacity: 0.42; cursor: not-allowed; }
.chip.is-empty:hover { transform: none; border-color: var(--line); }

.chip__label { font-weight: 700; }
.chip__hint { color: var(--muted); font-size: 0.85rem; }
.chip__count {
    font-size: 0.8rem;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    min-width: 1.6em;
    text-align: right;
}

.swatch {
    width: 16px; height: 16px;
    border-radius: 50%;
    background: var(--c);
    box-shadow: inset 0 0 0 1px var(--swatch-ring);
    flex: none;
    display: inline-block;
}

.identify__actions {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 14px 24px 22px;
}
.js [data-js-hide] { display: none; }

/* --- Resultados ----------------------------------------------------------- */

.results { padding: clamp(36px, 5vw, 60px) 0 72px; }

.results__head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px 32px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}
.results__head h2 { font-size: clamp(1.7rem, 3.2vw, 2.4rem); }
.results__understood { color: var(--ink-soft); margin-top: 8px; max-width: 60ch; }

.alphabet {
    position: sticky;
    top: 68px;
    z-index: 20;
    display: flex;
    gap: 2px;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 10px 0;
    margin: 0 calc(var(--gutter) * -1) 8px;
    padding-left: var(--gutter);
    padding-right: var(--gutter);
    background: color-mix(in srgb, var(--paper) 92%, transparent);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line-soft);
}
.alphabet::-webkit-scrollbar { display: none; }
.alphabet a {
    flex: none;
    min-width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    font-family: var(--font-display);
    font-size: 1.05rem;
    color: var(--ink-soft);
    text-decoration: none;
    border-radius: 8px;
    transition: background 0.15s, color 0.15s;
}
.alphabet a:hover { background: var(--moss); color: var(--paper); }

.letter-group { padding-top: 28px; }
.letter-group__letter {
    font-size: 3.4rem;
    color: var(--moss);
    line-height: 1;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 18px;
}
.letter-group__letter::after {
    content: "";
    flex: 1;
    height: 1px;
    background: repeating-linear-gradient(90deg, var(--line) 0 6px, transparent 6px 11px);
}

.bird-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: clamp(14px, 2vw, 22px);
}
.bird-grid--compact { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }

.bird-card {
    display: flex;
    flex-direction: column;
    background: var(--card);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    overflow: hidden;
    color: var(--ink);
    text-decoration: none;
    box-shadow: var(--shadow);
    transition: transform 0.22s cubic-bezier(.3,1.3,.5,1), box-shadow 0.22s, border-color 0.22s;
    animation: rise 0.5s ease both;
    animation-delay: calc(min(var(--i, 0), 12) * 35ms);
}
.bird-card:hover {
    color: var(--ink);
    transform: translateY(-4px) rotate(-0.4deg);
    box-shadow: var(--shadow-lift);
    border-color: var(--line);
}
.bird-card__photo {
    display: block;
    aspect-ratio: 1;
    background: var(--paper-deep);
    overflow: hidden;
}
.bird-card__photo img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}
.bird-card:hover .bird-card__photo img { transform: scale(1.05); }
.bird-card__placeholder { display: grid; place-items: center; height: 100%; opacity: 0.35; }
.bird-card__placeholder .logo { width: 64px; height: 64px; }

.bird-card__body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 14px 14px;
    flex: 1;
}
.bird-card__name {
    font-family: var(--font-display);
    font-size: 1.12rem;
    line-height: 1.2;
}
.bird-card .sci { font-size: 1rem; }
.bird-card__meta {
    margin-top: auto;
    padding-top: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.bird-card__size { font-family: var(--font-display); font-size: 0.82rem; color: var(--muted); }

/* A Atkinson corta o zero (Ø); números de destaque vão na fonte dos títulos. */
.num, .chip__count { font-family: var(--font-display); }

.swatches { display: inline-flex; }
.swatches .swatch { width: 14px; height: 14px; margin-right: -3px; box-shadow: 0 0 0 2px var(--card), inset 0 0 0 1px var(--swatch-ring); }

@keyframes rise {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: none; }
}

.empty {
    text-align: center;
    padding: 56px 24px;
    border: 2px dashed var(--line);
    border-radius: var(--radius);
    display: grid;
    justify-items: center;
    gap: 14px;
    color: var(--ink-soft);
}
.empty__title { font-family: var(--font-display); font-size: 1.6rem; color: var(--ink); }

/* --- Ficha da ave --------------------------------------------------------- */

.species { padding: 20px 0 72px; }

.crumbs a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 700;
    text-decoration: none;
    color: var(--ink-soft);
    padding: 6px 10px 6px 4px;
    border-radius: var(--pill);
}
.crumbs a:hover { color: var(--urucum); background: var(--urucum-soft); }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; }
.crumbs__sep { color: var(--line); margin: 0 2px; }
.species__taxon a { color: inherit; }
.crumbs svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.species__head { margin: 12px 0 24px; max-width: 900px; }
.species__name {
    font-size: clamp(2.1rem, 4.4vw, 3.4rem);
    text-wrap: balance;
    margin: 10px 0 4px;
    letter-spacing: -0.025em;
}
.species__sci { font-size: clamp(1.3rem, 2.4vw, 1.75rem); }
.species__aka { margin-top: 8px; color: var(--ink-soft); }
.species__taxon {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    margin-left: 12px;
    vertical-align: middle;
    white-space: nowrap;
}
.species__aka span { color: var(--muted); }

.species__grid {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(280px, 1fr);
    gap: clamp(22px, 3vw, 40px);
    align-items: start;
}

.gallery__main { margin: 0; }
.gallery__main > a {
    display: grid;
    place-items: center;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-lift);
    background: var(--paper-deep);
    aspect-ratio: 4 / 3;
}
.gallery__main img {
    /* foto inteira, sem cortar a cabeça da ave */
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: opacity 0.25s;
}
.gallery__main img.is-loading { opacity: 0.4; }
.gallery__main figcaption {
    display: grid;
    gap: 2px;
    margin-top: 10px;
    font-size: 0.92rem;
    color: var(--ink-soft);
    min-height: 1.5em;
}
.credits { font-size: 0.82rem; color: var(--muted); }
.credits a { color: inherit; }

.gallery__thumbs {
    list-style: none;
    margin: 14px 0 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));  /* até 10 fotos: 2 fileiras de 5 */
    gap: 8px;
}
.thumb {
    appearance: none;
    border: 0;
    padding: 0;
    width: 100%;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    background: var(--paper-deep);
    box-shadow: 0 0 0 1px var(--line-soft);
    opacity: 0.72;
    transition: opacity 0.15s, box-shadow 0.15s, transform 0.15s;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb:hover { opacity: 1; transform: translateY(-2px); }
.thumb.is-current { opacity: 1; box-shadow: 0 0 0 3px var(--urucum); }

.gallery__empty {
    aspect-ratio: 4 / 3;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 10px;
    border: 2px dashed var(--line);
    border-radius: var(--radius);
    color: var(--muted);
}
.gallery__empty .logo { width: 72px; height: 72px; opacity: 0.4; }

/* Ficha de campo: cartão pautado, como uma página de caderno */
.fieldcard {
    position: sticky;
    top: 88px;
    background:
        repeating-linear-gradient(to bottom, transparent 0 31px, var(--line-soft) 31px 32px),
        var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 24px 24px 18px 30px;
    box-shadow: var(--shadow);
    overflow: hidden;
}
.fieldcard::before {
    /* margem vermelha do caderno */
    content: "";
    position: absolute;
    top: 0; bottom: 0; left: 16px;
    width: 1.5px;
    background: color-mix(in srgb, var(--urucum) 55%, transparent);
}
.fieldcard__title { font-size: 1.45rem; margin-bottom: 14px; }
.fieldcard dl { margin: 0; display: grid; gap: 14px; }
.fieldcard dt {
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 6px;
}
.fieldcard dd { margin: 0; }
.fieldcard__big {
    font-family: var(--font-display);
    font-size: 1.9rem;
    line-height: 1;
    margin-right: 10px;
    vertical-align: middle;
}
.fieldcard__hint { font-size: 0.82rem; color: var(--muted); margin-top: 18px; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 12px;
    border-radius: var(--pill);
    border: 1px solid var(--line);
    background: var(--paper);
    color: var(--ink);
    font-size: 0.92rem;
    font-weight: 700;
    text-decoration: none;
    transition: border-color 0.15s, color 0.15s, transform 0.12s;
    vertical-align: middle;
}
.tag:hover { border-color: var(--urucum); color: var(--urucum); transform: translateY(-1px); }
.tag .swatch { width: 14px; height: 14px; }

.species__texts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: clamp(22px, 3vw, 40px);
    margin-top: clamp(36px, 5vw, 56px);
}
.note h2 {
    font-size: 1.35rem;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--moss);
    display: inline-block;
}
.note p { color: var(--ink-soft); max-width: 62ch; }

.section-title {
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    margin-bottom: 6px;
}
.section-lead { color: var(--muted); margin-bottom: 20px; }

.media, .lookalikes { margin-top: clamp(44px, 6vw, 72px); }
.media .section-title { margin-bottom: 20px; }
.media__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 22px;
}
.video { margin: 0; }
.video__frame {
    aspect-ratio: 16 / 9;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--forest);
    box-shadow: var(--shadow);
}
.video__frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.video__facade {
    appearance: none;
    border: 0;
    padding: 0;
    width: 100%; height: 100%;
    position: relative;
    cursor: pointer;
    background: var(--forest);
}
.video__facade img { width: 100%; height: 100%; object-fit: cover; opacity: 0.88; transition: opacity 0.2s, transform 0.4s; }
.video__facade:hover img { opacity: 1; transform: scale(1.03); }
.video__play {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 68px; height: 68px;
    border-radius: 50%;
    background: var(--urucum);
    display: grid;
    place-items: center;
    box-shadow: 0 10px 30px -6px rgba(0, 0, 0, 0.5);
    transition: transform 0.2s;
}
.video__facade:hover .video__play { transform: scale(1.08); }
.video__play svg { width: 30px; height: 30px; fill: #fff; margin-left: 4px; }
.video figcaption { display: grid; gap: 2px; margin-top: 10px; }
.video figcaption a { color: var(--ink); font-weight: 700; text-decoration: none; }
.video figcaption a:hover { color: var(--urucum); }
.video figcaption span { font-size: 0.85rem; color: var(--muted); }

.references { margin-top: clamp(44px, 6vw, 72px); }
.references .section-title { margin-bottom: 18px; }
.references__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
}
.reference {
    position: relative;
    display: grid;
    gap: 2px;
    height: 100%;
    padding: 14px 44px 14px 16px;
    border: 1px solid var(--line);
    border-left: 4px solid var(--moss);
    border-radius: var(--radius-sm);
    background: var(--card);
    color: var(--ink);
    text-decoration: none;
    transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.reference:hover { color: var(--ink); border-left-color: var(--urucum); transform: translateY(-2px); box-shadow: var(--shadow); }
.reference__name { font-family: var(--font-display); font-size: 1.15rem; }
.reference__hint { font-size: 0.86rem; color: var(--muted); }
.reference svg {
    position: absolute;
    top: 16px; right: 14px;
    width: 18px; height: 18px;
    fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.reference:hover svg { stroke: var(--urucum); }

.pager {
    margin-top: clamp(44px, 6vw, 72px);
    padding-top: 24px;
    border-top: 1px dashed var(--line);
    display: flex;
    justify-content: space-between;
    gap: 16px;
}
.pager a {
    display: grid;
    gap: 2px;
    text-decoration: none;
    color: var(--ink);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    max-width: 48%;
    transition: background 0.15s;
}
.pager a:hover { background: var(--card); color: var(--urucum); }
.pager span { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.pager strong { font-family: var(--font-display); font-weight: 400; font-size: 1.2rem; }
.pager__prev span::before { content: "← "; }
.pager__next { text-align: right; margin-left: auto; }
.pager__next span::after { content: " →"; }

/* --- Rodapé --------------------------------------------------------------- */

.site-footer {
    background: var(--forest);
    color: color-mix(in srgb, var(--forest-ink) 78%, transparent);
    padding: 44px 0 52px;
    font-size: 0.92rem;
    position: relative;
}
.site-footer::before {
    /* borda recortada, como folhagem */
    content: "";
    position: absolute;
    left: 0; right: 0; top: -14px;
    height: 15px;
    background: var(--forest);
    -webkit-mask: radial-gradient(circle at 12px 15px, #000 12px, transparent 12.5px) 0 0 / 24px 15px repeat-x;
    mask: radial-gradient(circle at 12px 15px, #000 12px, transparent 12.5px) 0 0 / 24px 15px repeat-x;
}
.explore {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 28px;
    padding-bottom: 36px;
    margin-bottom: 36px;
    border-bottom: 1px solid color-mix(in srgb, var(--forest-ink) 14%, transparent);
}
.explore__title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    color: var(--forest-ink);
    margin-bottom: 10px;
}
.explore ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.explore a { text-decoration: none; color: color-mix(in srgb, var(--forest-ink) 78%, transparent); }
.explore a:hover { color: var(--ochre); text-decoration: underline; }

.site-footer__inner {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 28px 56px;
}
.site-footer p + p { margin-top: 8px; }
.site-footer a { color: var(--forest-ink); }
.site-footer a:hover { color: var(--ochre); }
.site-footer__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-display);
    font-size: 1.25rem;
    color: var(--forest-ink);
    margin-bottom: 10px;
}
.site-footer .logo__body { fill: var(--forest-ink); }
.site-footer .logo__eye { fill: var(--forest); }
.site-footer .logo__branch { stroke: color-mix(in srgb, var(--forest-ink) 60%, transparent); }
.site-footer strong { color: var(--forest-ink); }

/* --- Responsivo ----------------------------------------------------------- */

@media (max-width: 900px) {
    .hero__grid { grid-template-columns: 1fr; }
    .featured { width: min(100%, 300px); justify-self: start; transform: rotate(-1.5deg); margin-top: 8px; }
    @keyframes drop-in { from { opacity: 0; transform: rotate(-6deg) translateY(-20px); } to { opacity: 1; transform: rotate(-1.5deg); } }
    .featured figure { display: grid; grid-template-columns: 96px 1fr; gap: 14px; align-items: center; padding: 10px; }
    .featured img { aspect-ratio: 1; }
    .featured figcaption { padding: 0; }
    .featured__name { font-size: 1.2rem; }
    .facet--cor, .facet--porte, .facet--onde, .facet--come, .facet--quando { grid-column: span 12; }
    .species__grid { grid-template-columns: 1fr; }
    .fieldcard { position: relative; top: 0; }
    .site-footer__inner { grid-template-columns: 1fr; }
    .explore { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
    html { font-size: 16px; scroll-padding-top: 120px; }
    .site-header__inner { flex-wrap: wrap; gap: 10px; padding-top: 10px; padding-bottom: 10px; min-height: 0; }
    .brand__name { font-size: 1.12rem; }
    .logo { width: 34px; height: 34px; }
    .header-search { order: 3; flex-basis: 100%; max-width: none; }
    .search { flex-wrap: wrap; border-radius: 22px; padding: 6px; }
    .search input { flex-basis: 100%; padding-left: 46px; }
    .search .search__icon { left: 16px; top: 29px; }
    .search .button { width: 100%; justify-content: center; }
    .identify__panel > summary { grid-template-columns: 1fr auto; padding: 16px 18px; }
    .identify__subtitle { grid-column: 1; grid-row: 2; }
    .identify__chevron { grid-row: 1 / span 2; grid-column: 2; }
    .identify__groups { padding-left: 18px; padding-right: 18px; }
    .identify__actions { padding-left: 18px; padding-right: 18px; }
    .chip__hint { display: none; }
    .alphabet { top: 0; position: relative; }
    .bird-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .bird-card__body { padding: 10px 11px 12px; }
    .bird-card__name { font-size: 1rem; }
    .bird-card .sci { font-size: 0.92rem; }
    .letter-group__letter { font-size: 2.6rem; }
    .media__grid { grid-template-columns: 1fr; }
    .pager a { max-width: 50%; }
}

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

/* --- 404 ------------------------------------------------------------------ */

.lost { padding: clamp(56px, 10vw, 120px) 0; }
.lost__title { font-size: clamp(2.2rem, 5vw, 3.6rem); margin: 14px 0 12px; }
.lost__text { color: var(--ink-soft); max-width: 40em; margin-bottom: 26px; }
.lost__search { margin-bottom: 22px; }

/* --- Páginas de assunto (pistas e grupos) --------------------------------- */

.landing {
    position: relative;
    padding: 24px 0 clamp(28px, 4vw, 44px);
    isolation: isolate;
}
.landing::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: var(--contour);
    -webkit-mask: url("../img/contours.svg") center / cover no-repeat;
    mask: url("../img/contours.svg") center / cover no-repeat;
}
.landing .eyebrow { margin-top: 18px; }
.landing__title {
    font-size: clamp(2.1rem, 5vw, 3.6rem);
    margin: 12px 0 14px;
    letter-spacing: -0.02em;
    text-wrap: balance;
    max-width: 18em;
}
.landing__intro { font-size: 1.1rem; color: var(--ink-soft); max-width: 46em; }
.landing__hint { margin-top: 10px; color: var(--muted); font-size: 0.95rem; }

.group-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 18px;
}
.group-card {
    display: grid;
    grid-template-columns: 84px 1fr;
    align-items: center;
    gap: 14px;
    padding: 10px;
    background: var(--card);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    color: var(--ink);
    text-decoration: none;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    animation: rise 0.5s ease both;
    animation-delay: calc(min(var(--i, 0), 12) * 35ms);
}
.group-card:hover { color: var(--ink); transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.group-card__photo { width: 84px; height: 84px; border-radius: var(--radius-sm); overflow: hidden; background: var(--paper-deep); }
.group-card__photo img { width: 100%; height: 100%; object-fit: cover; }
.group-card__body { display: grid; gap: 2px; }
.group-card__name { font-family: var(--font-display); font-size: 1.08rem; line-height: 1.2; }
.group-card__count { font-size: 0.85rem; color: var(--muted); }

/* --- Resumo e perguntas frequentes ---------------------------------------- */

.species__summary {
    margin-top: 16px;
    max-width: 62ch;
    font-size: 1.06rem;
    color: var(--ink);
    padding-left: 14px;
    border-left: 3px solid var(--urucum);
}

.faq { margin-top: clamp(44px, 6vw, 72px); }
.faq .section-title { margin-bottom: 18px; }
.faq__list { display: grid; gap: 10px; max-width: 860px; }
.faq__item {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 0 18px;
}
.faq__item > summary {
    list-style: none;
    cursor: pointer;
    padding: 14px 28px 14px 0;
    position: relative;
}
.faq__item > summary::-webkit-details-marker { display: none; }
.faq__item > summary::after {
    content: "+";
    position: absolute;
    right: 0; top: 50%;
    transform: translateY(-50%);
    font-family: var(--font-display);
    font-size: 1.4rem;
    color: var(--urucum);
    transition: transform 0.2s;
}
.faq__item[open] > summary::after { transform: translateY(-50%) rotate(45deg); }
.faq__item h3 { font-size: 1.08rem; font-family: var(--font-body); font-weight: 700; display: inline; }
.faq__item p { padding: 0 0 16px; color: var(--ink-soft); max-width: 70ch; }

.species__updated { margin-top: 18px; font-size: 0.85rem; color: var(--muted); }

/* --- Texto corrido (sobre) ------------------------------------------------ */

.prose { max-width: 820px; }
.prose h2 { font-size: clamp(1.5rem, 2.6vw, 1.9rem); margin: 36px 0 14px; }
.prose h2:first-child { margin-top: 0; }
.prose p { color: var(--ink-soft); margin-bottom: 14px; }
.sources { margin: 0; display: grid; gap: 14px; }
.sources div { padding: 14px 18px; background: var(--card); border: 1px solid var(--line-soft); border-left: 4px solid var(--moss); border-radius: var(--radius-sm); }
.sources dt { font-weight: 700; margin-bottom: 4px; }
.sources dd { margin: 0; color: var(--ink-soft); }

/* --- Comparações "A ou B?" ------------------------------------------------ */

.versus { padding: 20px 0 72px; }
.versus__head { margin: 12px 0 28px; }
.versus__head .landing__title { margin-top: 10px; }

.versus__pair {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: clamp(14px, 3vw, 32px);
    align-items: start;
}
.versus__bird {
    background: var(--card);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    padding: 12px 12px 20px;
    box-shadow: var(--shadow);
    display: grid;
    gap: 6px;
}
.versus__photo {
    display: block;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--paper-deep);
    margin-bottom: 8px;
}
.versus__photo img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s; }
.versus__photo:hover img { transform: scale(1.04); }
.versus__name { font-size: 1.6rem; padding: 0 6px; }
.versus__name a { color: inherit; text-decoration: none; }
.versus__name a:hover { color: var(--urucum); }
.versus__bird .sci, .versus__bird .swatches, .versus__bird .link-reset { margin: 0 6px; }
.versus__summary { color: var(--ink-soft); font-size: 0.95rem; padding: 6px 6px 4px; }
.versus__or {
    align-self: center;
    width: 64px; height: 64px;
    border-radius: 50%;
    background: var(--urucum);
    color: #fff;
    display: grid;
    place-items: center;
    font-family: var(--font-sci);
    font-style: italic;
    font-size: 1.7rem;
    box-shadow: 0 10px 24px -10px var(--urucum);
}

.versus__section { margin-top: clamp(40px, 5vw, 64px); }
.versus__section .section-title { margin-bottom: 16px; }
.versus__differences { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; max-width: 820px; }
.versus__differences li {
    position: relative;
    padding: 12px 16px 12px 44px;
    background: var(--card);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-sm);
}
.versus__differences li::before {
    content: "";
    position: absolute;
    left: 18px; top: 50%;
    width: 12px; height: 12px;
    border-radius: 50%;
    transform: translateY(-50%);
    background: var(--moss);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--moss) 18%, transparent);
}

.versus__table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); }
.versus__table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.versus__table th, .versus__table td { padding: 11px 16px; text-align: left; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.versus__table thead th { font-family: var(--font-display); font-weight: 400; font-size: 1.1rem; background: var(--paper-deep); }
.versus__table tbody th { font-size: 0.74rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.versus__table tr:last-child th, .versus__table tr:last-child td { border-bottom: 0; }
.versus__table tr.is-different td { background: var(--urucum-soft); }

.versus__columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(20px, 3vw, 40px); }
.versus__columns .note h3 { font-size: 1.3rem; margin-bottom: 8px; }
.versus__columns .note p + p { margin-top: 10px; }
.versus__columns .video { margin-top: 16px; }

.compare-links { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px 24px; }
.compare-links a { color: var(--ink); text-decoration: none; border-bottom: 1px dashed var(--line); padding: 4px 0; display: inline-block; }
.compare-links a:hover { color: var(--urucum); border-color: var(--urucum); }
.compare-links em { font-family: var(--font-sci); color: var(--urucum); font-size: 1.1em; }
.compare-section + .compare-section { margin-top: 36px; }
.compare-section__title { font-size: 1.4rem; margin-bottom: 12px; }
.compare-inline { margin-top: 18px; color: var(--ink-soft); }
.compare-inline a { white-space: nowrap; }

@media (max-width: 760px) {
    .versus__pair { grid-template-columns: 1fr; }
    .versus__or { justify-self: center; margin: -6px 0; position: relative; z-index: 1; }
    .versus__columns { grid-template-columns: 1fr; }
}
