/* Layout and components. Tokens live in tokens.css. Cardless: sections are separated by space and one hairline (design 4A). */

@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("/fonts/AtkinsonHyperlegibleNext.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}
@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/fonts/BricolageGrotesque.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; width: 100%; max-width: 640px; margin: 0 auto; padding: var(--space-4) var(--space-4) 96px; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; margin: 0 0 var(--space-2); }
h1 { font-size: var(--text-species-name); font-weight: 700; }
h2 { font-size: 20px; font-weight: 600; margin-top: var(--space-6); }
p { margin: 0 0 var(--space-3); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
[hidden] { display: none !important; }

/* Header + nav (Home, Journal, About) */
.site-header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--hairline); max-width: 640px; width: 100%; margin: 0 auto; }
.brand { font-family: var(--font-display); font-weight: 700; font-size: 18px; color: var(--text); text-decoration: none; }
.site-header nav { display: flex; gap: var(--space-4); }
.site-header nav a { color: var(--muted); text-decoration: none; min-height: var(--tap-min); display: inline-flex; align-items: center; }
.site-header nav a[aria-current="page"] { color: var(--text); font-weight: 700; }

.site-footer { border-top: 1px solid var(--hairline); color: var(--muted); font-size: 14px; padding: var(--space-4); max-width: 640px; width: 100%; margin: 0 auto 72px; }
.site-footer a { color: var(--muted); }

section + section { border-top: 1px solid var(--hairline); padding-top: var(--space-4); margin-top: var(--space-5); }

/* Home */
.search { width: 100%; font: inherit; font-size: 18px; padding: var(--space-3); min-height: 48px; border-radius: var(--radius); border: 1px solid var(--hairline); background: var(--surface); color: var(--text); }
label.field-label { display: block; font-weight: 700; margin: var(--space-4) 0 var(--space-2); }
select { font: inherit; min-height: var(--tap-min); padding: 0 var(--space-3); border-radius: var(--radius); border: 1px solid var(--hairline); background: var(--surface); color: var(--text); max-width: 100%; }
.progress { font-family: var(--font-display); font-size: 22px; font-weight: 700; margin: var(--space-4) 0 var(--space-2); }
.skeleton { color: transparent; background: var(--surface); border-radius: var(--radius); width: 8ch; }

.bird-list { list-style: none; padding: 0; margin: 0; }
.bird-row a { display: flex; gap: var(--space-3); align-items: center; padding: var(--space-2) 0; color: var(--text); text-decoration: none; min-height: 72px; }
.bird-row img, .silhouette { width: 64px; height: 64px; border-radius: var(--radius); object-fit: cover; flex: none; background: var(--surface); }
.silhouette { display: inline-block; mask: url("/img/silhouette.svg") center / 70% no-repeat; -webkit-mask: url("/img/silhouette.svg") center / 70% no-repeat; background: var(--muted); }
.bird-text { display: flex; flex-direction: column; }
.bird-name { font-weight: 700; }
.bird-hint { color: var(--muted); font-size: 15px; }
.bird-row.found { opacity: 0.6; }
.no-match { color: var(--muted); padding: var(--space-3) 0; }
details summary { cursor: pointer; min-height: var(--tap-min); display: flex; align-items: center; gap: var(--space-2); list-style: none; }
details summary::-webkit-details-marker { display: none; }
details summary::before { content: "▸"; color: var(--accent); }
details[open] summary::before { content: "▾"; }

/* Species page */
/* Whole photo, never cropped (heads got cut off on square/portrait photos); letterboxed on the surface color. */
.species-photo { width: 100%; height: auto; max-height: 44vh; aspect-ratio: 16 / 10; object-fit: contain; border-radius: var(--radius); background: var(--surface); display: block; }
.credit { font-size: 13px; color: var(--muted); margin-top: var(--space-1); }
.credit a { color: var(--muted); }
.subname { color: var(--muted); margin-top: calc(-1 * var(--space-1)); }
.badge { display: inline-block; font-size: 13px; padding: 2px 8px; border-radius: var(--radius); border: 1px solid var(--hairline); color: var(--muted); margin-right: var(--space-2); }
.logged { color: var(--muted); margin: var(--space-3) 0; }
.logged.has { color: var(--found); font-weight: 700; }
.id-tip { font-size: var(--text-id-tip); line-height: 1.45; }
.verdict-rating { font-weight: 700; }
.verdict-rating.accurate { color: var(--found); }
.verdict-rating.partly { color: var(--accent); }
.verdict-rating.odd { color: var(--error); }
.range-map { width: 100%; height: auto; display: block; background: color-mix(in srgb, var(--surface) 60%, var(--bg)); border-radius: var(--radius); }
.zones { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-2); }
.zones li { border: 1px solid var(--hairline); border-radius: var(--radius); padding: var(--space-1) var(--space-3); }
audio { width: 100%; margin: var(--space-2) 0; }
.entries { list-style: none; padding: 0; }
.entry { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-3) 0; border-bottom: 1px solid var(--hairline); }
.entry > div { flex: 1; }
.entry p { margin: 0; }
.entry-note { color: var(--muted); }
.entry-shot { border-radius: var(--radius); object-fit: cover; }

/* Sticky Log bar (thumb zone) */
.log-bar { position: fixed; left: 0; right: 0; bottom: 0; padding: var(--space-3) var(--space-4) calc(var(--space-3) + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--bg) 92%, transparent); border-top: 1px solid var(--hairline); display: flex; justify-content: center; backdrop-filter: blur(6px); }
.log-bar .btn-primary { width: 100%; max-width: 640px; }

/* Buttons */
.btn-primary { font: inherit; font-weight: 700; min-height: 48px; padding: 0 var(--space-5); border-radius: var(--radius); border: none; background: var(--accent); color: var(--on-accent); cursor: pointer; }
.btn-primary:disabled { opacity: 0.6; }
.btn-secondary { font: inherit; min-height: var(--tap-min); padding: 0 var(--space-4); border-radius: var(--radius); border: 1px solid var(--hairline); background: transparent; color: var(--text); cursor: pointer; display: inline-flex; align-items: center; }
.btn-link { font: inherit; background: none; border: none; color: var(--accent); cursor: pointer; min-height: var(--tap-min); padding: 0 var(--space-2); }

/* Log sheet: bottom sheet on phones, side panel on desktop (6A, 6C) */
dialog.sheet { margin: auto 0 0; width: 100%; max-width: 100%; max-height: 92vh; border: none; border-radius: 12px 12px 0 0; padding: var(--space-4) var(--space-4) calc(var(--space-4) + env(safe-area-inset-bottom)); background: var(--surface); color: var(--text); overflow: auto; }
dialog.sheet::backdrop { background: rgb(0 0 0 / 0.55); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.sheet-head h2 { margin: 0; }
.sheet-bird { font-size: 18px; margin: var(--space-3) 0 0; }
.sheet-results { list-style: none; padding: 0; margin: var(--space-2) 0; }
.sheet-results button { font: inherit; width: 100%; text-align: left; min-height: var(--tap-min); background: none; border: none; border-bottom: 1px solid var(--hairline); color: var(--text); cursor: pointer; }
.sheet input[type="search"], .sheet textarea { width: 100%; font: inherit; padding: var(--space-3); border-radius: var(--radius); border: 1px solid var(--hairline); background: var(--bg); color: var(--text); margin-top: var(--space-3); }
fieldset.chips { border: none; padding: 0; margin: var(--space-4) 0 0; display: flex; flex-wrap: wrap; gap: var(--space-2); }
fieldset.chips legend { font-weight: 700; margin-bottom: var(--space-2); padding: 0; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-flex; align-items: center; min-height: var(--tap-min); padding: 0 var(--space-3); border-radius: var(--radius); border: 1px solid var(--hairline); cursor: pointer; }
.chip input:checked + span { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 700; }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.sheet select { margin-top: var(--space-3); }
.sheet-more { margin-top: var(--space-4); }
.sheet-more summary { gap: var(--space-2); }
.sheet-actions { position: sticky; bottom: 0; padding-top: var(--space-3); background: var(--surface); }
.sheet-actions .btn-primary { width: 100%; }
.form-error { color: var(--error); margin: var(--space-3) 0 0; min-height: 1em; }

@media (min-width: 900px) {
  dialog.sheet { margin: 0 0 0 auto; height: 100vh; max-height: 100vh; width: 420px; border-radius: 0; }
}

/* Toast, banners, offline */
.toast { position: fixed; left: 50%; bottom: 88px; transform: translate(-50%, 20px); opacity: 0; transition: opacity 0.2s ease-out, transform 0.2s ease-out; background: var(--text); color: var(--bg); padding: var(--space-3) var(--space-4); border-radius: var(--radius); max-width: calc(100% - 32px); z-index: 10; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.banner { grid-column: 1 / -1; align-self: start; display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); padding: var(--space-3); margin-bottom: var(--space-4); border: 1px solid var(--hairline); border-radius: var(--radius); }
.offline { background: var(--surface); color: var(--muted); text-align: center; padding: var(--space-2); font-size: 14px; }

/* Forms (feedback, journal tools) */
.form-row { margin: var(--space-3) 0; }
.form-row textarea, .form-row input[type="text"] { width: 100%; font: inherit; padding: var(--space-3); border-radius: var(--radius); border: 1px solid var(--hairline); background: var(--surface); color: var(--text); }
.tools { display: flex; flex-wrap: wrap; gap: var(--space-3); margin: var(--space-3) 0; }
.file-btn input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.credits-list { padding-left: var(--space-4); }
.credits-list li { margin-bottom: var(--space-2); }

/* Tablet / desktop (design 6C) */
@media (min-width: 600px) {
  .bird-list.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-3); }
}
@media (min-width: 900px) {
  main.species-main { max-width: 1040px; display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-6); }
  main.species-main > .col { min-width: 0; }
  .log-bar { position: static; background: none; border: none; padding: 0; justify-content: flex-start; margin: var(--space-4) 0; backdrop-filter: none; }
  .site-footer { margin-bottom: 0; }
}

/* ---- Guide-first home (pivot 2026-12-03): lede, region map, 60-bird grid ---- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.lede { color: var(--muted); font-size: 18px; margin-bottom: var(--space-4); }
.map-section { margin-top: var(--space-5); }
.map-section h2 { margin-top: 0; }
.leonida-map { width: 100%; max-width: 420px; max-height: 300px; display: block; margin: 0 auto; }
.leonida-map .region { cursor: pointer; outline: none; }
.leonida-map .region path { fill: color-mix(in srgb, var(--found) 22%, var(--surface)); stroke: var(--bg); stroke-width: 3; stroke-linejoin: round; transition: fill 0.15s ease-out; }
.leonida-map .region:hover path { fill: color-mix(in srgb, var(--found) 38%, var(--surface)); }
.leonida-map .region.selected path { fill: var(--accent); }
.leonida-map .region:focus-visible path { stroke: var(--accent); stroke-width: 4; }
.leonida-map .region.selected:focus-visible path { stroke: var(--text); }
.leonida-map text { pointer-events: none; text-anchor: middle; fill: var(--text); font-family: var(--font-display); }
.leonida-map .region-name { font-size: 12px; font-weight: 700; }
.leonida-map .region-count { font-size: 10.5px; fill: var(--muted); font-family: var(--font-body); }
.leonida-map .region.selected text { fill: var(--on-accent); }
.map-note { text-align: center; font-size: 14px; }
.grid-status { font-weight: 700; margin: var(--space-4) 0 var(--space-2); }
.grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-3); }
.card a { display: flex; flex-direction: column; gap: var(--space-1); color: var(--text); text-decoration: none; position: relative; }
.card img, .card .silhouette { width: 100%; aspect-ratio: 4 / 3; height: auto; object-fit: cover; object-position: 50% 25%; border-radius: var(--radius); background: var(--surface); }
.card .silhouette { display: block; }
.card-name { font-weight: 700; line-height: 1.25; }
.card-tag { font-size: 13px; color: var(--muted); }
.card-tag.odd { color: var(--error); }
.card-seen { position: absolute; top: var(--space-2); left: var(--space-2); font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: var(--radius); background: var(--found); color: #0b1a12; }
.card a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: var(--radius); }
@media (min-width: 600px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) {
  main:has(#grid) { max-width: 1040px; }
  .home-layout { display: grid; grid-template-columns: 320px 1fr; gap: var(--space-6); align-items: start; }
  .home-layout .map-section { position: sticky; top: var(--space-4); margin-top: 0; }
  .home-layout .leonida-map { max-height: 70vh; }
  .grid-status { margin-top: 0; }
  .grid { grid-template-columns: repeat(3, 1fr); }
}

/* Species page: player reports + secondary "Seen it here?" */
.player-reports { color: var(--found); font-size: 15px; }
.contribute { margin-top: var(--space-4); padding-top: var(--space-3); border-top: 1px solid var(--hairline); }

/* Log sheet map (pick a region) */
.sheet-zone .legend { font-weight: 700; margin: var(--space-4) 0 var(--space-2); }
.sheet-zone .leonida-map { max-width: 300px; max-height: 38vh; }
.sheet-zone-label { text-align: center; font-weight: 700; margin-top: var(--space-2); }

/* Bird page: static map with this bird's regions highlighted */
.leonida-map.view { max-height: 240px; margin: var(--space-2) auto var(--space-3); }
.leonida-map.view .region { cursor: default; }
.leonida-map.view .region path { fill: color-mix(in srgb, var(--muted) 18%, var(--surface)); }
.leonida-map.view .region text { fill: var(--muted); }
.leonida-map.view .region.on path { fill: var(--accent); }
.leonida-map.view .region.on text { fill: var(--on-accent); }

/* Bird page: player reports (where / when / weather) */
.player-reports { display: block; }
.report-rows { display: grid; grid-template-columns: auto 1fr; gap: var(--space-1) var(--space-3); margin: var(--space-2) 0 0; }
.report-rows dt { color: var(--muted); }
.report-rows dd { margin: 0; color: var(--text); }

.activity { margin: 0 0 var(--space-3); }

/* Real world: best months in Florida */
.season { margin: var(--space-3) 0 var(--space-1); }
.months-chart { width: 100%; max-width: 360px; display: block; }
.months-chart rect { fill: color-mix(in srgb, var(--muted) 35%, var(--surface)); }
.months-chart rect.good { fill: var(--accent); }
.months-chart text { fill: var(--muted); font-size: 9px; text-anchor: middle; font-family: var(--font-body); }

.map-caption { margin: var(--space-3) 0 var(--space-1); font-size: 15px; }
