/* FILM — follows Projects/design-system-preview.html
   Onest (text/headings/numbers) · Geist Mono (12px micro tier only)
   Light neutral palette · Tab + Toggle components · dark-on-light for "selected". */

@import url('https://fonts.googleapis.com/css2?family=Onest:wght@400;500;600;700&family=Geist+Mono:wght@400;500&display=swap');

:root {
  /* palette — from the Figma "system" variables */
  --bg1: #F4F3F1;   /* page */
  --bg2: #E6E5E3;   /* recessed / default-tab fill */
  --card: #FFFFFF;  /* raised surfaces */
  --ink: #242425;   /* Text 1 — primary */
  --ink-mid: #6A6A64; /* readable secondary (pragmatic mid tone) */
  --muted: #BBB8B3; /* Text 2 — muted / disabled / placeholder */
  --faint: #D9D8D6; /* Text 3 — empty states, faint marks */
  --label: #B0B0AA; /* micro section labels */
  --line: #E6E6E3;
  --line-2: #EDEDEA;
  --line-strong: #DDDCDA;
  --good: #4A7A4A; --good-bg: #F0F6EF; --good-line: #D3E6D0;
  --danger: #9A4A4A;

  --sans: 'Onest', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg1);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 500;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* micro tier — the ONE place Geist Mono is used */
.mono, .eyebrow, .badge, .stage-pill, .film-meta .when, .stage-when,
.privacy-note, .section-count {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

/* ---- Top bar ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 22px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
  background: rgba(244,243,241,.86); backdrop-filter: blur(10px);
}
.brand {
  font-family: var(--mono); font-weight: 600; font-size: 15px;
  letter-spacing: .22em; color: var(--ink); cursor: pointer; user-select: none;
}
.brand .dot { color: var(--muted); }

/* nav = the Tab component, grouped like a segmented control */
.tabs { display: inline-flex; gap: 4px; background: var(--bg2); padding: 4px; border-radius: 10px; }
.tab {
  display: inline-flex; align-items: center; gap: 8px;
  background: transparent; border: 0; cursor: pointer;
  font-family: var(--sans); font-weight: 500; font-size: 15px; line-height: 1;
  color: var(--muted); padding: 9px 12px; border-radius: var(--radius-sm);
  transition: background .15s, color .15s;
}
.tab svg { width: 16px; height: 16px; display: block; flex: 0 0 auto; }
.tab:hover { color: var(--ink-mid); }
.tab.active {
  background: var(--bg1); color: var(--ink);
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.tab.icon { padding: 9px 10px; }
.tab .lbl { white-space: nowrap; }

/* ---- Layout ---- */
main { max-width: 900px; margin: 0 auto; padding: 34px 22px 96px; }
.section-title { font-family: var(--sans); font-weight: 600; font-size: 32px; letter-spacing: -.01em; margin: 0 0 6px; }
.section-sub { color: var(--ink-mid); margin: 0 0 26px; font-size: 16px; font-weight: 500; }
.eyebrow {
  text-transform: uppercase; letter-spacing: .12em; font-size: 11px; font-weight: 600;
  color: var(--label); margin: 32px 0 14px;
}
.eyebrow .section-count { color: var(--muted); }
.empty {
  text-align: center; color: var(--muted); padding: 56px 20px;
  border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--card);
}
.empty .big { font-size: 18px; color: var(--ink-mid); margin-bottom: 6px; font-weight: 600; }
.empty a, a.link { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.empty a:hover, a.link:hover { color: var(--ink-mid); }

/* ---- Cards / queue ---- */
.cards { display: grid; gap: 12px; }
.card {
  display: flex; gap: 16px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; transition: border-color .15s, box-shadow .15s;
}
.card.clickable { cursor: pointer; }
.card.clickable:hover { border-color: var(--line-strong); box-shadow: 0 2px 10px rgba(0,0,0,.04); }
.poster {
  width: 66px; height: 99px; flex: 0 0 auto; border-radius: var(--radius-sm);
  object-fit: cover; background: var(--bg2);
}
.poster.placeholder {
  display: flex; align-items: center; justify-content: center;
  color: var(--faint); border: 1px solid var(--line);
}
.poster.placeholder svg { width: 26px; height: 26px; }
.card-body { flex: 1 1 auto; min-width: 0; }
.film-title { font-family: var(--sans); font-weight: 600; font-size: 20px; letter-spacing: -.005em; margin: 1px 0 3px; color: var(--ink); }
.film-title .year { color: var(--muted); font-weight: 500; font-size: 15px; }
.film-meta { color: var(--ink-mid); font-size: 14px; font-weight: 500; margin-bottom: 11px; }
.film-meta .when { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; }
.badge {
  display: inline-block; font-size: 10px; text-transform: uppercase; letter-spacing: .1em;
  padding: 3px 7px; border-radius: var(--radius-xs); border: 1px solid var(--line-strong);
  color: var(--ink-mid); margin-left: 8px; vertical-align: middle; font-weight: 500;
}

/* stage pills */
.stage-row { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.stage-pill {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 500;
  padding: 5px 10px; border-radius: var(--radius-xs);
  border: 1px solid var(--line); color: var(--muted); background: var(--bg1);
}
.stage-pill.done { color: var(--good); border-color: var(--good-line); background: var(--good-bg); }
.stage-pill.due {
  color: var(--bg1); background: var(--ink); border-color: var(--ink);
  cursor: pointer;
}
.stage-pill.due:hover { background: #3a3a38; }
.stage-pill.locked { opacity: .7; }
.stage-pill.skipped { display: none; }
.stage-pill .when { text-transform: uppercase; letter-spacing: .04em; opacity: .85; }

/* ---- Buttons ---- */
.btn {
  font-family: var(--sans); font-weight: 500; font-size: 15px;
  border-radius: var(--radius-sm); padding: 11px 16px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--card); color: var(--ink);
  transition: border-color .15s, background .15s, color .15s;
}
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--ink); color: var(--bg1); border-color: var(--ink); }
.btn.primary:hover { background: #3a3a38; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-mid); }
.btn.ghost:hover { color: var(--ink); background: var(--bg2); }
.btn.danger { color: var(--danger); border-color: var(--line-strong); background: transparent; }
.btn.danger:hover { border-color: var(--danger); }
.btn:disabled { opacity: .5; cursor: default; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }

/* ---- Forms / write view ---- */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; }
label.field { display: block; margin-bottom: 22px; }
label.field .q {
  display: block; font-family: var(--sans); font-weight: 600; font-size: 18px;
  margin-bottom: 10px; color: var(--ink); letter-spacing: -.005em;
}
input[type=text], input[type=date], textarea, select {
  width: 100%; background: var(--card); border: 1px solid var(--line-strong);
  color: var(--ink); border-radius: var(--radius-sm); padding: 11px 13px;
  font-family: var(--sans); font-weight: 500; font-size: 16px; resize: vertical;
  transition: border-color .15s;
}
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, textarea:focus, select:focus { outline: 0; border-color: var(--ink); }
textarea { min-height: 62px; line-height: 1.55; }
textarea.long { min-height: 122px; }
textarea.freewrite { min-height: 240px; font-size: 17px; line-height: 1.6; padding: 16px; }
.q-opt {
  font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); font-weight: 500; margin-left: 8px;
}

/* "feeling stuck?" nudge */
.stuck { margin-top: 14px; }
.stuck-btn {
  font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--ink-mid); background: transparent; border: 0; cursor: pointer; padding: 4px 0;
}
.stuck-btn:hover { color: var(--ink); }
.stuck-card { background: var(--bg1); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px 18px; }
.stuck-q { font-family: var(--sans); font-weight: 500; font-size: 17px; line-height: 1.45; color: var(--ink); }
.stuck-actions { display: flex; gap: 16px; margin-top: 12px; }
.stuck-link {
  font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); background: transparent; border: 0; cursor: pointer; padding: 0;
}
.stuck-link:hover { color: var(--ink); }
.aa.blank { color: var(--muted); font-style: normal; }

/* Free-form notes on a film's log detail */
.notes-list { display: flex; flex-direction: column; gap: 12px; }
.note-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px;
  transition: border-color .15s;
}
.note-card.clickable { cursor: pointer; }
.note-card:hover { border-color: var(--line-strong); }
.note-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 6px; }
.note-title { font-weight: 600; color: var(--ink); }
.note-title.untitled { color: var(--muted); font-weight: 500; }
.note-when { font-family: var(--mono); font-size: 11px; color: var(--muted); white-space: nowrap; }
.aa.note-body { white-space: pre-wrap; line-height: 1.55; }

.write-head { display: flex; gap: 18px; align-items: flex-start; margin-bottom: 10px; }
.write-head .poster { width: 60px; height: 90px; }
.stage-name { text-transform: uppercase; letter-spacing: .12em; font-size: 11px; font-weight: 600; color: var(--ink); font-family: var(--mono); }
.stage-blurb {
  font-family: var(--sans); font-weight: 500; color: var(--ink-mid);
  border-left: 2px solid var(--ink); padding-left: 14px; margin: 8px 0 26px;
  font-size: 16px; line-height: 1.55; max-width: 60ch;
}
.privacy-note {
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin-top: 20px; text-align: center;
}

/* rating stars — monochrome: filled = ink, empty = faint */
.stars { display: inline-flex; gap: 3px; font-size: 26px; cursor: pointer; }
.star { color: var(--faint); position: relative; width: 1em; line-height: 1; }
.star.on { color: var(--ink); }
.star.half { color: var(--ink); clip-path: inset(0 50% 0 0); position: absolute; left: 0; top: 0; }
.star-wrap { position: relative; display: inline-block; }
.rating-clear {
  margin-left: 14px; font-family: var(--mono); font-size: 11px; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); cursor: pointer;
}
.rating-clear:hover { color: var(--ink-mid); }

/* ---- Search results ---- */
.results { display: grid; gap: 8px; margin-top: 16px; }
.result {
  display: flex; gap: 12px; padding: 10px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); cursor: pointer; background: var(--card); transition: border-color .12s;
}
.result:hover { border-color: var(--line-strong); }
.result .poster { width: 44px; height: 66px; }

/* ---- Segmented toggle (Log filter) — from the Toggle component ---- */
.togglebox { display: inline-flex; align-items: center; padding: 4px; border: 1.2px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--card); }
.toggle {
  display: inline-flex; align-items: center; padding: 6px 12px; border-radius: 4px;
  border: 1.2px solid transparent; font-family: var(--sans); font-weight: 500; font-size: 15px;
  line-height: 1; cursor: pointer; color: var(--muted); transition: background .12s, color .12s;
}
.toggle.is-on { background: var(--bg1); color: var(--ink); border-color: var(--faint); }

/* ---- Log detail ---- */
.stage-block { border-top: 1px solid var(--line-2); padding: 18px 0; }
.stage-block:first-of-type { border-top: 0; padding-top: 4px; }
.stage-block .stage-name { color: var(--ink); margin-bottom: 4px; }
.stage-when {
  font-size: 11px; color: var(--muted); margin-bottom: 14px; text-transform: uppercase;
  letter-spacing: .05em; display: flex; align-items: center; gap: 8px;
}
.qa { margin-bottom: 14px; }
.qa .qq { color: var(--ink-mid); font-size: 14px; margin-bottom: 3px; font-weight: 500; }
.qa .aa { white-space: pre-wrap; font-family: var(--sans); font-size: 16px; line-height: 1.6; color: var(--ink); font-weight: 500; }
.qa .aa.empty { color: var(--muted); }
.rating-show { color: var(--ink); font-size: 15px; letter-spacing: 1px; }

.back { color: var(--ink-mid); cursor: pointer; margin-bottom: 20px; display: inline-block; font-size: 14px; font-weight: 500; }
.back:hover { color: var(--ink); }

/* ---- Settings ---- */
.settings-field { margin-bottom: 24px; }
.settings-field label { display: block; margin-bottom: 7px; color: var(--ink); font-weight: 600; font-size: 15px; }
.hint { font-size: 13px; color: var(--ink-mid); margin-top: 7px; line-height: 1.55; font-weight: 500; }
.hint a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }
.hint code, code { font-family: var(--mono); font-size: .92em; background: var(--bg2); padding: 1px 5px; border-radius: 4px; }
.status-line { font-family: var(--mono); font-size: 12px; margin-top: 9px; text-transform: uppercase; letter-spacing: .04em; }
.status-line.ok { color: var(--good); }
.status-line.warn { color: var(--ink-mid); }

/* ---- Toast ---- */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--bg1); padding: 12px 20px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500; box-shadow: 0 8px 24px rgba(0,0,0,.16); opacity: 0;
  pointer-events: none; transition: .25s; z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 620px) {
  .tab .lbl { display: none; }        /* icons-only nav on phones */
  .tab { padding: 9px; }
  main { padding: 24px 14px 84px; }
  .section-title { font-size: 26px; }
  .film-title { font-size: 18px; }
}

/* ---- TV: episode list ---------------------------------------------------- */
.ep-list { display: flex; flex-direction: column; }
.ep { border-top: 1px solid var(--line-2); padding: 14px 0; }
.ep:first-child { border-top: 0; }
.ep-head { display: flex; align-items: center; gap: 12px; }
.ep-num {
  font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--muted);
  min-width: 40px; white-space: nowrap;
}
.ep-title { flex: 1; font-weight: 600; color: var(--ink); font-size: 15px; line-height: 1.35; }
.ep-note { margin: 8px 0 0 52px; }
.btn.tiny { padding: 5px 12px; font-size: 12px; }
.season-panel .stage-when { margin-bottom: 2px; }
.ep-when {
  font-family: var(--mono); font-size: 11px; color: var(--muted);
  margin: 4px 0 0 52px; letter-spacing: .02em;
}
