/* Birds page (bird-feeder camera dashboard). Standalone page embedded by Command Center.
   Theme tokens are a copy of the app's (assets/css/styles.css); keep the two in step. */

:root {
  --bg: #060A14; --panel: #0C1322; --panel-2: #111A2C; --panel-3: #16203A;
  --border: rgba(148, 163, 184, 0.12); --border-strong: rgba(148, 163, 184, 0.22);
  --text: #F1F5F9; --text-muted: #9FB0C7; --text-dim: #64748B;
  --accent: #FBBF24; --accent-2: #F59E0B; --accent-soft: rgba(251, 191, 36, 0.12); --accent-ink: #0B1220;
  --ok: #34D399; --ok-soft: rgba(52, 211, 153, 0.12);
  --info: #38BDF8; --info-soft: rgba(56, 189, 248, 0.12);
  --violet: #A78BFA; --violet-soft: rgba(167, 139, 250, 0.12);
  --slate-soft: rgba(148, 163, 184, 0.12);
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --radius: 14px; --radius-sm: 10px;
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.6);

  /* chart roles: one hue for magnitude, a 7-step ramp for the heat grids */
  --series: #3987e5; --series-soft: rgba(57, 135, 229, 0.16);
  --grid: rgba(148, 163, 184, 0.14);
  --q0: #131C30; --q1: #0d366b; --q2: #184f95; --q3: #256abf; --q4: #3987e5; --q5: #6da7ec; --q6: #b7d3f6;
  --quiet: rgba(148, 163, 184, 0.10);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #EDF1F7; --panel: #FFFFFF; --panel-2: #F6F8FC; --panel-3: #EEF2F8;
  --border: rgba(15, 23, 42, 0.10); --border-strong: rgba(15, 23, 42, 0.20);
  --text: #0F172A; --text-muted: #475569; --text-dim: #94A3B8;
  --accent: #B45309; --accent-2: #92400E; --accent-soft: rgba(180, 83, 9, 0.10); --accent-ink: #FFFFFF;
  --ok: #059669; --ok-soft: rgba(5, 150, 105, 0.12);
  --info: #0284C7; --info-soft: rgba(2, 132, 199, 0.10);
  --violet: #7C3AED; --violet-soft: rgba(124, 58, 237, 0.10);
  --slate-soft: rgba(71, 85, 105, 0.10);
  --shadow: 0 12px 28px -14px rgba(15, 23, 42, 0.22);
  --series: #2a78d6; --series-soft: rgba(42, 120, 214, 0.12);
  --grid: rgba(15, 23, 42, 0.08);
  --q0: #F3F4F6; --q1: #c4dcfa; --q2: #9ec5f4; --q3: #6da7ec; --q4: #3987e5; --q5: #1c5cab; --q6: #0d366b;
  --quiet: rgba(71, 85, 105, 0.09);
  color-scheme: light;
}

:root[data-theme="light"] .pill.mam,
:root[data-theme="light"] .record button { color: #0369A1; }
:root[data-theme="light"] .pill.r5,
:root[data-theme="light"] .seg button[aria-pressed="true"],
:root[data-theme="light"] .eyebrow { color: var(--accent-2); }

* { box-sizing: border-box; }
html { background: var(--bg); scroll-behavior: smooth; scroll-padding-top: 64px; }
body { margin: 0; font-family: var(--font-body); font-size: 16px; line-height: 1.55; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; overflow-wrap: break-word; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.2; margin: 0; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: var(--info); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.eyebrow { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }
.num { font-variant-numeric: tabular-nums; }

.bd-app { max-width: 1180px; margin: 0 auto; padding: 22px 20px 80px; }
.bd-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.bd-title { font-size: 30px; }
.bd-theme { border: 1px solid var(--border); background: var(--panel); border-radius: 99px; width: 38px; height: 38px; display: grid; place-items: center; cursor: pointer; color: var(--text-muted); }
html.is-framed .bd-head { display: none; }
html.is-framed .bd-app { padding-top: 10px; }
.bd-loading, .bd-empty { padding: 48px 8px; color: var(--text-muted); }

/* ---------- opening: the feeder itself, then the sentence ---------- */
.reel { display: grid; grid-template-columns: 1.55fr 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 6px; border-radius: var(--radius); overflow: hidden; aspect-ratio: 32 / 11.6; background: var(--panel-3); }
.reel .clip:first-child { grid-row: 1 / span 2; }
.reel .clip { border-radius: 0; height: 100%; }
.reel .clip-btn { height: 100%; aspect-ratio: auto; border-radius: 0; }
.reel .clip figcaption { position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 12px 9px; color: #fff; background: linear-gradient(transparent, rgba(4, 8, 16, 0.72)); font-size: 13px; pointer-events: none; }
.reel .clip figcaption b { font-family: var(--font-display); font-weight: 600; font-size: 15px; display: block; color: #fff; }
.reel .clip figcaption span { color: rgba(255,255,255,0.86); }

.reel-bar { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.reel-toggle { border: 1px solid var(--border-strong); background: var(--panel); color: var(--text-muted); border-radius: 99px; padding: 5px 13px; font-size: 13.5px; cursor: pointer; }
.reel-toggle:hover { color: var(--text); }

.lede { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 28px 44px; margin: 26px 0 8px; align-items: start; }
.lede h2 { font-size: clamp(28px, 4.2vw, 46px); font-weight: 600; letter-spacing: -0.025em; line-height: 1.06; text-wrap: balance; }
.lede-sub { margin-top: 14px; color: var(--text-muted); font-size: 17px; max-width: 54ch; }
.facts { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 0; }
.facts li { padding: 11px 0 11px 18px; border-top: 1px solid var(--border); position: relative; color: var(--text-muted); font-size: 15px; }
.facts li:first-child { border-top: 0; padding-top: 2px; }
.facts li::before { content: ""; position: absolute; left: 0; top: 20px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.facts li:first-child::before { top: 11px; }
.facts b { color: var(--text); font-weight: 600; }

.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 22px 0 6px; }
.tile { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; }
.tile-k { font-size: 13px; color: var(--text-muted); }
.tile-v { font-family: var(--font-display); font-size: 30px; font-weight: 600; line-height: 1.15; margin-top: 2px; letter-spacing: -0.02em; }
.tile-s { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ---------- section scaffolding ---------- */
.jump { position: sticky; top: 0; z-index: 20; display: flex; gap: 6px; overflow-x: auto; padding: 10px 0; margin: 18px 0 0; background: linear-gradient(var(--bg) 78%, transparent); scrollbar-width: none; }
.jump::-webkit-scrollbar { display: none; }
.jump a { flex: none; text-decoration: none; color: var(--text-muted); font-size: 14px; font-weight: 500; padding: 6px 13px; border-radius: 99px; border: 1px solid var(--border); background: var(--panel); }
.jump a:hover { color: var(--text); border-color: var(--border-strong); }
.sec { margin-top: 44px; }
.sec-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.sec-head h2 { font-size: 24px; font-weight: 600; }
.sec-head p { color: var(--text-muted); font-size: 15px; margin-top: 4px; max-width: 64ch; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.pad { padding: 18px 20px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 99px; padding: 3px; background: var(--panel); }
.seg button { border: 0; background: none; padding: 5px 13px; border-radius: 99px; font-size: 14px; color: var(--text-muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.pick { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-muted); }
.pick select { font: inherit; font-size: 14px; color: var(--text); background: var(--panel); border: 1px solid var(--border-strong); border-radius: 8px; padding: 6px 10px; max-width: 220px; }

/* ---------- clips ---------- */
.clip { margin: 0; position: relative; border-radius: var(--radius-sm); overflow: hidden; }
.clip-btn { display: block; width: 100%; padding: 0; border: 0; background: var(--panel-3); cursor: pointer; position: relative; aspect-ratio: 16 / 9; overflow: hidden; border-radius: var(--radius-sm); }
.clip-btn img, .clip-btn video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.clip-btn img, .clip-btn video { pointer-events: none; }
.clip-btn video { opacity: 0; }
.clip-btn:focus-visible { outline: none; }
.clip-btn:focus-visible::before { content: ""; position: absolute; inset: 0; z-index: 2; border: 3px solid var(--accent); border-radius: inherit; box-shadow: inset 0 0 0 2px var(--accent-ink); pointer-events: none; }
.clip-btn.playing video { opacity: 1; }
.clip-btn .play { position: absolute; right: 8px; top: 8px; width: 26px; height: 26px; border-radius: 50%; background: rgba(4, 8, 16, 0.55); display: grid; place-items: center; color: #fff; }
.clip-btn.playing .play { display: none; }
.clip-btn.noimg::after { content: "clip unavailable"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-muted); font-size: 12px; }
.clip figcaption { font-size: 14px; color: var(--text-muted); padding: 8px 2px 0; line-height: 1.4; }
.clip figcaption b { color: var(--text); font-weight: 600; }
.clip-when { color: var(--text-muted); font-size: 12.5px; display: block; margin-top: 1px; }
.clips { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px 14px; }

/* ---------- the regulars ---------- */
.board { width: 100%; border-collapse: collapse; }
.board th { text-align: left; font-size: 12.5px; font-weight: 500; color: var(--text-muted); padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.board td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.board tr:last-child td { border-bottom: 0; }
.board tbody tr { cursor: pointer; }
.board tbody tr:hover { background: var(--panel-2); }
.board .rank { color: var(--text-muted); font-size: 13px; width: 28px; text-align: right; padding-right: 2px; }
.board .who { display: flex; align-items: center; gap: 12px; min-width: 200px; }
.board .thumb { flex: none; width: 92px; }
.board .thumb .clip-btn { border-radius: 8px; }
.board .thumb .play { display: none; }
.who-name { font-weight: 600; font-family: var(--font-display); font-size: 16.5px; border: 0; background: none; padding: 0; cursor: pointer; text-align: left; color: var(--text); }
.who-sci { font-size: 13px; color: var(--text-muted); font-style: italic; }
.barcell { min-width: 150px; width: 26%; }
.bar { display: block; height: 10px; border-radius: 0 4px 4px 0; background: var(--series); min-width: 2px; }
.bartrack { flex: 1 1 auto; min-width: 36px; }
.barrow .num { min-width: 86px; }
.barrow { display: flex; align-items: center; gap: 8px; }
.barrow .num { font-size: 14px; font-weight: 600; flex: none; }
.barrow small { color: var(--text-muted); font-size: 12.5px; font-weight: 400; }
.spark { display: block; width: 110px; height: 26px; }
.spark rect { fill: var(--series); }
.spark .base { fill: var(--grid); }
.pill { display: inline-block; font-size: 12.5px; font-weight: 500; padding: 2px 9px; border-radius: 99px; background: var(--slate-soft); color: var(--text-muted); white-space: nowrap; }
.pill.r4 { background: var(--violet-soft); color: var(--violet); }
.pill.r5 { background: var(--accent-soft); color: var(--accent); }
.pill.mam { background: var(--info-soft); color: var(--info); }
.board .muted { color: var(--text-muted); font-size: 14px; white-space: nowrap; }
.board-wrap { overflow-x: auto; }

/* ---------- charts ---------- */
.chart-title { font-family: var(--font-display); font-weight: 600; font-size: 16.5px; }
.chart-sub { color: var(--text-muted); font-size: 14px; margin-top: 2px; }
.cols-wrap { position: relative; margin-top: 16px; padding-left: 46px; }
.cols { position: relative; height: 190px; display: flex; align-items: flex-end; gap: 1px; border-bottom: 1px solid var(--border-strong); }
.cols .col { flex: 1 1 0; min-width: 0; height: 100%; display: flex; align-items: flex-end; position: relative; }
.cols .col i { display: block; width: 100%; background: var(--series); border-radius: 2px 2px 0 0; min-height: 0; }
.cols .col:hover i, .cols .col.on i { filter: brightness(1.25); }
.cols .col:hover::before { content: ""; position: absolute; inset: 0; background: var(--series-soft); }
.yt { position: absolute; left: 0; right: 0; border-top: 1px solid var(--grid); pointer-events: none; }
.yt span { position: absolute; left: -46px; top: -9px; width: 40px; white-space: nowrap; text-align: right; font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.band { position: absolute; top: 0; bottom: 0; background: var(--quiet); pointer-events: none; overflow: hidden; container-type: inline-size; }
@container (max-width: 84px) { .band span { display: none; } }
.band span { position: absolute; top: 4px; left: 6px; font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.xax { position: relative; height: 22px; margin-left: 46px; }
.xax span { position: absolute; top: 4px; font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.xax span::before { content: ""; position: absolute; left: 0; top: -4px; height: 5px; border-left: 1px solid var(--border-strong); }
.xax span { padding-left: 4px; }

.heat { display: grid; gap: 2px; margin-top: 16px; }
.heat .hl { font-size: 12px; color: var(--text-muted); text-align: right; padding-right: 6px; line-height: 1; align-self: center; white-space: nowrap; }
.wl { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: visible; height: 16px; }
.cell { border-radius: 3px; min-height: 15px; background: var(--q0); }
.cell.q1 { background: var(--q1); } .cell.q2 { background: var(--q2); } .cell.q3 { background: var(--q3); }
.cell.q4 { background: var(--q4); } .cell.q5 { background: var(--q5); } .cell.q6 { background: var(--q6); }
.cell.q0 { box-shadow: inset 0 0 0 1px var(--grid); }
.cell:hover { outline: 2px solid var(--text); outline-offset: -1px; }
.scale-note { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; }
.scroll-x { overflow-x: auto; padding-bottom: 4px; }
.scale { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-muted); margin-top: 12px; }
.scale i { width: 20px; height: 10px; border-radius: 2px; display: block; }
.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }

.season { display: grid; gap: 3px 2px; align-items: center; margin-top: 14px; }
.season .sn { font-size: 14px; font-weight: 500; white-space: nowrap; padding-right: 10px; overflow: hidden; text-overflow: ellipsis; }
.season .sn small { color: var(--text-muted); font-weight: 400; }
.season .cell { min-height: 18px; }
.callouts { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-top: 16px; }
.callout { border-left: 3px solid var(--accent); padding: 2px 0 2px 14px; }
.callout h4 { font-size: 15px; font-weight: 600; }
.callout p { color: var(--text-muted); font-size: 14.5px; margin-top: 3px; }

/* ---------- notables ---------- */
.notables { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.notable { overflow: hidden; display: flex; flex-direction: column; }
.notable .clip, .notable .clip-btn { border-radius: 0; }
.notable-body { padding: 14px 16px 16px; }
.notable h3 { font-size: 18px; font-weight: 600; }
.notable .meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 6px 0 8px; font-size: 13.5px; color: var(--text-muted); }
.notable p { font-size: 14.5px; color: var(--text-muted); }
.waiting { margin-top: 18px; }
.waiting h3 { font-size: 16.5px; font-weight: 600; }
.waiting ul { list-style: none; padding: 0; margin: 10px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px 22px; }
.waiting li { font-size: 14.5px; color: var(--text-muted); }
.waiting li b { color: var(--text); font-weight: 600; }

/* ---------- records ---------- */
.records { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.record { padding: 14px 16px; }
.record .k { font-size: 13px; color: var(--text-muted); }
.record .v { font-family: var(--font-display); font-size: 21px; font-weight: 600; margin-top: 2px; letter-spacing: -0.01em; }
.record .s { font-size: 13.5px; color: var(--text-muted); margin-top: 2px; }
.record button { margin-top: 8px; border: 0; background: none; padding: 0; color: var(--info); font-size: 13.5px; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.pairs { list-style: none; margin: 12px 0 0; padding: 0; }
.pairs li { display: grid; grid-template-columns: minmax(0, 1fr) 120px 48px; gap: 12px; align-items: center; padding: 7px 0; border-top: 1px solid var(--border); font-size: 14.5px; }
.pairs li:first-child { border-top: 0; }
.pairs .bar { height: 8px; }
.pairs .num { text-align: right; color: var(--text-muted); font-size: 13.5px; }

.method { margin-top: 44px; color: var(--text-muted); font-size: 14px; max-width: 78ch; }
.method summary { cursor: pointer; color: var(--text); font-weight: 500; }
.method p { margin-top: 8px; }

/* ---------- dialog ---------- */
.bd-dialog { border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--panel); color: var(--text); padding: 0; width: min(920px, calc(100vw - 24px)); max-height: calc(100vh - 32px); box-shadow: 0 30px 80px -20px rgba(0,0,0,0.55); }
.bd-dialog::backdrop { background: rgba(4, 8, 16, 0.62); }
.dlg-x { position: sticky; top: 10px; margin: 10px 10px -44px auto; z-index: 3; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border-strong); background: var(--panel); cursor: pointer; display: grid; place-items: center; }
.dlg-video { width: 100%; aspect-ratio: 16 / 9; background: #000; display: block; }
.dlg-body { padding: 18px 22px 24px; }
.dlg-body h2 { font-size: 26px; font-weight: 600; padding-right: 40px; }
.dlg-sci { font-style: italic; color: var(--text-muted); }
.dlg-meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 14px; align-items: center; font-size: 14px; color: var(--text-muted); }
.dlg-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 22px 28px; margin-top: 6px; }
.dlg-body dl { margin: 0; display: grid; gap: 12px; }
.dlg-body dt { font-size: 13px; color: var(--text-muted); }
.dlg-body dd { margin: 1px 0 0; font-size: 15px; }
.kv { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 20px; }
.kv div { background: var(--panel-2); border-radius: 10px; padding: 9px 12px; }
.kv .k { font-size: 12.5px; color: var(--text-muted); }
.kv .v { font-family: var(--font-display); font-weight: 600; font-size: 18px; }
.hours { display: flex; align-items: flex-end; gap: 2px; height: 84px; margin-top: 10px; border-bottom: 1px solid var(--border-strong); }
.hours i { flex: 1; background: var(--series); border-radius: 2px 2px 0 0; min-height: 0; display: block; }
.hours-x { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.dlg-clips { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 16px; }
.dlg-clips .clip-btn { border-radius: 8px; }
.dlg-cap { padding: 12px 22px 0; font-size: 15px; }
.dlg-cap b { font-family: var(--font-display); font-size: 18px; }

.bd-tip { position: fixed; z-index: 100; pointer-events: none; background: var(--text); color: var(--bg); font-size: 13px; line-height: 1.35; padding: 6px 9px; border-radius: 7px; max-width: 240px; white-space: pre-line; box-shadow: 0 8px 20px -8px rgba(0,0,0,0.5); }
.bd-tip b { font-weight: 600; }

@media (max-width: 860px) {
  .lede { grid-template-columns: 1fr; gap: 18px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two { grid-template-columns: 1fr; }
  .dlg-grid { grid-template-columns: 1fr; }
  .reel { grid-template-columns: 1fr 1fr; grid-template-rows: auto; aspect-ratio: auto; }
  .reel .clip:first-child { grid-row: auto; grid-column: 1 / span 2; }
  .reel .clip-btn { aspect-ratio: 16 / 9; height: auto; }
  .board .hide-s { display: none; }
  .barcell { min-width: 110px; }
}
@media (max-width: 520px) {
  .bd-app { padding-left: 16px; padding-right: 16px; }
  .board .thumb { width: 64px; }
  .board .hide-xs { display: none; }
  .board td, .board th { padding-left: 8px; padding-right: 8px; }
  .barcell { min-width: 0; width: 44%; }
  .barrow .num { min-width: 0; }
  .who-sci { display: none; }
  .board .who { min-width: 0; gap: 9px; }
  .kv { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .heat .hl { font-size: 10.5px; padding-right: 3px; }
  .reel .clip:not(:first-child) figcaption { padding: 14px 8px 6px; font-size: 11.5px; }
  .reel .clip:not(:first-child) figcaption b { font-size: 12.5px; }
  .season .sn { font-size: 12.5px; }
  .hours-x { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
