/* The Nest: shared by nest.html, nest-submit.html and nest-admin.html.
   Same light palette and three-font system as open-field.html, so the Nest
   reads as Peregrine. Sparkline colour is --spark (via currentColor). */
:root {
  --bg: #f6f5f1;
  --nest-bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #efede6;
  --ink: #1c1b22;
  --ink-soft: #4a4855;
  --ink-muted: #6b6876;
  --line: #e4e1d8;
  --accent: #6552e8;
  --accent-ink: #4f3ccf;
  --accent-pale: #ebe8ff;
  --spark: #6552e8;
  --up: #1f6f4a;
  --down: #9a3b2e;
  --shadow: 0 1px 2px rgba(28,27,34,0.06), 0 6px 18px rgba(28,27,34,0.06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111117;
    --nest-bg: #1b1b23;
    --surface: #1b1b23;
    --surface-2: #23232d;
    --ink: #f1f0f5;
    --ink-soft: #c9c7d3;
    --ink-muted: #9a98a6;
    --line: #2e2e3a;
    --accent: #a599ff;
    --accent-ink: #bdb4ff;
    --accent-pale: #2a2645;
    /* Validated for the dark chart surface (dataviz lightness band + 3:1
       contrast on #1b1b23); #a599ff was too light for a data mark. */
    --spark: #8f80f2;
    --up: #6fcf9d;
    --down: #f08c7c;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
/* Components set display (flex/grid), which would beat the hidden attribute. */
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 Inter, system-ui, sans-serif; }
a { color: var(--accent-ink); }
.wrap { max-width: 860px; margin: 0 auto; padding: 32px 16px 64px; }
header h1 { font-family: Fraunces, Georgia, serif; font-size: 2.1rem; margin: 0; letter-spacing: -0.01em; }
header p { margin: 4px 0 0; color: var(--ink-soft); }
.demo-note { margin-top: 16px; padding: 8px 12px; border-radius: 8px; background: var(--accent-pale); color: var(--accent-ink); font-size: 0.85rem; }
.tabs { display: flex; gap: 4px; margin: 24px 0 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tab { border: 0; background: none; padding: 10px 14px; font: 600 0.92rem Inter, sans-serif; color: var(--ink-muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.sub { color: var(--ink-muted); font-size: 0.85rem; margin: 0 0 12px; }
.list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.row { display: grid; grid-template-columns: 28px 44px 1fr auto auto; gap: 14px; align-items: center; padding: 14px 16px; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.rank { font: 600 0.85rem "IBM Plex Mono", monospace; color: var(--ink-muted); text-align: right; }
.logo { width: 44px; height: 44px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; font: 700 1.1rem Fraunces, serif; color: var(--ink-soft); overflow: hidden; }
.logo img { width: 100%; height: 100%; object-fit: cover; }
.name { font-weight: 600; text-decoration: none; color: var(--ink); }
.name:hover { text-decoration: underline; }
.tagline { color: var(--ink-soft); font-size: 0.9rem; }
.cat { font-size: 0.75rem; color: var(--ink-muted); }
.cat::first-letter { text-transform: uppercase; }
.trend { display: flex; align-items: center; gap: 10px; color: var(--spark); }
.delta { font: 600 0.8rem "IBM Plex Mono", monospace; min-width: 52px; text-align: right; }
.delta.up { color: var(--up); } .delta.down { color: var(--down); } .delta.new { color: var(--ink-muted); }
.vote { display: flex; flex-direction: column; align-items: center; min-width: 56px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); cursor: pointer; font: 600 0.9rem Inter, sans-serif; }
.vote[aria-pressed="true"] { background: var(--accent-pale); border-color: var(--accent); color: var(--accent-ink); }
.vote:disabled { cursor: default; opacity: 0.7; }
.vote .arrow { font-size: 0.7rem; line-height: 1; }
.momentum { font: 600 0.85rem "IBM Plex Mono", monospace; color: var(--ink-soft); min-width: 48px; text-align: right; }
.empty, .error { padding: 32px 16px; text-align: center; color: var(--ink-muted); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; font-size: 0.8rem; color: var(--ink-muted); }
.legend svg { vertical-align: middle; color: var(--spark); }
footer { margin-top: 32px; font-size: 0.8rem; color: var(--ink-muted); }
@media (max-width: 640px) {
  .row { grid-template-columns: 22px 36px 1fr auto; gap: 10px; }
  .logo { width: 36px; height: 36px; }
  .trend .nest-spark { width: 72px; }
  .row .trend { grid-column: 3 / 4; }
  .row > :last-child { grid-row: 1 / span 2; grid-column: 4; }
}

/* Header nav (all Nest pages) */
.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.topbar nav { display: flex; gap: 8px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 600 0.9rem Inter, sans-serif; text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) { .btn.primary { color: #15131f; } }
.btn:disabled { opacity: 0.6; cursor: default; }
.btn.danger { color: var(--down); }

/* Forms (nest-submit.html) */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 20px; margin-top: 24px; }
.card h2 { font: 700 1.2rem Fraunces, Georgia, serif; margin: 0 0 4px; }
.card > p { margin: 0 0 16px; color: var(--ink-soft); font-size: 0.9rem; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-weight: 600; font-size: 0.9rem; }
.field .hint { font-size: 0.8rem; color: var(--ink-muted); }
.field input, .field select, .field textarea { font: 400 0.95rem Inter, sans-serif; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; width: 100%; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.field textarea { min-height: 110px; resize: vertical; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .two { grid-template-columns: 1fr; } }
.notice { padding: 10px 12px; border-radius: 8px; font-size: 0.9rem; margin-bottom: 16px; }
.notice.ok { background: var(--accent-pale); color: var(--accent-ink); }
.notice.bad { background: color-mix(in srgb, var(--down) 12%, transparent); color: var(--down); }
.status { display: inline-block; padding: 2px 8px; border-radius: 999px; font: 600 0.75rem Inter, sans-serif; background: var(--surface-2); color: var(--ink-soft); }
.status.scheduled, .status.live { background: var(--accent-pale); color: var(--accent-ink); }
.status.rejected { color: var(--down); }
.simple-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.simple-row:first-child { border-top: 0; }
.meta { font-size: 0.8rem; color: var(--ink-muted); }

/* Admin (nest-admin.html) */
.section-title { font: 700 1.1rem Fraunces, Georgia, serif; margin: 32px 0 8px; }
.review { padding: 14px 16px; border-top: 1px solid var(--line); }
.review:first-child { border-top: 0; }
.review-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.review .desc { margin: 8px 0 0; color: var(--ink-soft); font-size: 0.9rem; white-space: pre-line; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.actions input[type=date] { font: 0.9rem Inter, sans-serif; padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); }
.stats { display: flex; gap: 14px; flex-wrap: wrap; font: 600 0.8rem "IBM Plex Mono", monospace; color: var(--ink-soft); }
.stats .warn { color: var(--down); }
.votes-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 0.82rem; }
.votes-table th, .votes-table td { text-align: left; padding: 6px 8px; border-top: 1px solid var(--line); }
.votes-table th { color: var(--ink-muted); font-weight: 600; }
.votes-table code { font-family: "IBM Plex Mono", monospace; }
.table-scroll { overflow-x: auto; }

/* images/stones/nest.png — the user's own Nest tile (real art), kept in its
   original gold, with a "Peregrine Slate" glow (the blue-grey of the
   peregrine's back, photo median ~rgb(80,92,114), brightened so it reads as
   a glow). The glow is its own layer strictly BEHIND the stone: .nest-tile
   is a wrapper whose ::before is a blurred slate block the size of the
   opaque stone (the PNG's stone sits 9.15% in from every edge, measured
   from its alpha), stacked under the image. The image itself has no filter
   and no blend mode — drop-shadow on the img let the glow tint the PNG's
   semi-transparent edge, and mix-blend-mode: screen washed the stone out,
   which read as the glow sitting on top of the tile. */
.nest-tile { position: relative; display: inline-block; isolation: isolate; width: 72px; height: 72px; flex-shrink: 0; }
.nest-tile img { display: block; width: 100%; height: 100%; object-fit: contain; }
.nest-tile::before { content: ""; position: absolute; inset: 9.15%; z-index: -1; border-radius: 14%; background: rgba(92,122,176,0.75); filter: blur(12px); }
@media (prefers-color-scheme: dark) {
  .nest-tile::before { background: rgba(128,156,206,0.8); filter: blur(14px); }
}
.brand { display: flex; align-items: center; gap: 16px; }
@media (max-width: 640px) { .nest-tile { width: 56px; height: 56px; } .nest-tile::before { filter: blur(9px); } }

/* "Boosted" label: a paid boost is shown on every board row and product
   page it affects (lib/nest.js BOOST). Deliberately visible: paid
   placement must never read as organic rank. */
.boosted { display: inline-block; vertical-align: middle; margin-left: 6px; padding: 1px 8px; border-radius: 999px; font: 600 0.7rem Inter, sans-serif; letter-spacing: 0.02em; color: var(--accent-ink); background: var(--accent-pale); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.btn.small { padding: 5px 12px; font-size: 0.82rem; }
.row-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.subbar { margin: 0 0 12px; display: flex; justify-content: space-between; align-items: center; gap: 8px 16px; flex-wrap: wrap; }
.subbar .sub { margin: 0; }
.scope { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 2px; background: var(--surface); }
.scope button { border: 0; background: none; padding: 5px 12px; border-radius: 999px; font: 600 0.8rem Inter, sans-serif; color: var(--ink-muted); cursor: pointer; }
.scope button[aria-pressed="true"] { background: var(--accent-pale); color: var(--accent-ink); }
.actions input:not([type=date]) { font: 0.88rem Inter, sans-serif; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); }
