/* theme.css: the cinematic "film set" palette (see DESIGN.md). Loaded last.
   Dark is the default whatever the OS says; the header toggle switches to the light "contact sheet" theme. */
:root, :root:not([data-theme="light"]) {
  --bg: #0A0A0B; --surface: #121214; --surface2: #1A1A1D; --ink: #EEEAE3; --muted: #A29D94; --line: #252428;
  --accent: #F2A541; --accent-ink: #160E02; --accent-soft: #2E2110; --rim: #7FB3C6;
  --lcd: #050506; --lcd2: #0E0E10; --lcd-ink: #EEEAE3; --lcd-dim: #8E8A82; --lcd-accent: #F2A541;
  --ok: #4CC7A0; --warn: #F2B85B; --bad: #FF7A6E; --info: #7FB3C6; --rec: #E5484D;
  --ok-soft: #10291F; --warn-soft: #2E220E; --bad-soft: #321613; --info-soft: #12242C;
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 18px 40px -18px rgba(0,0,0,.7);
  --stage: radial-gradient(90% 70% at 62% 18%, rgba(242,165,65,.20) 0%, rgba(242,165,65,0) 55%),
           radial-gradient(70% 60% at 8% 92%, rgba(127,179,198,.16) 0%, rgba(127,179,198,0) 60%),
           linear-gradient(180deg, #1B1A1C 0%, #0F0F11 70%, #0A0A0B 100%);
  --scroll-thumb: #2C2B30; --scroll-thumb-hover: #F2A541;
  --grain-o: .035;
  --r: 12px; --r-sm: 8px;
  --ease: cubic-bezier(.16, 1, .3, 1); --ease-out: cubic-bezier(.16, 1, .3, 1);
  --dur-1: 140ms; --dur-2: 220ms; --dur-3: 520ms; --dur-4: 800ms;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #E9E9E6; --surface: #F6F6F4; --surface2: #DEDED9; --ink: #121214; --muted: #57554F; --line: #CBCAC4;
  --accent: #9C5408; --accent-ink: #FFFFFF; --accent-soft: #F1E2CC; --rim: #2E6A80;
  --ok: #157A58; --warn: #94600F; --bad: #B8352B; --info: #2E6A80; --rec: #C9373C;
  --ok-soft: #DCEFE6; --warn-soft: #F3E7CF; --bad-soft: #F5DEDA; --info-soft: #DCE9EE;
  --shadow: 0 1px 2px rgba(18,18,20,.06), 0 14px 32px -16px rgba(18,18,20,.22);
  --stage: radial-gradient(90% 70% at 62% 18%, rgba(255,214,160,.55) 0%, rgba(255,214,160,0) 55%),
           radial-gradient(70% 60% at 8% 92%, rgba(127,179,198,.30) 0%, rgba(127,179,198,0) 60%),
           linear-gradient(180deg, #F3F2EF 0%, #D9D8D3 100%);
  --scroll-thumb: #B9B8B1; --scroll-thumb-hover: #9C5408;
  --grain-o: .05;
  color-scheme: light;
}

/* ---- surfaces ---- */
html { scroll-behavior: auto; background: var(--bg); }
body { background: var(--bg); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
::selection { background: var(--accent); color: var(--accent-ink); }
.card { border-color: var(--line); }
.top { background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2); }
/* film grain over everything (static, cheap, never blocks input) */
body::after { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 90; opacity: var(--grain-o);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
:root[data-theme="light"] body::after { mix-blend-mode: multiply; filter: invert(1); }

/* ---- 3D stage: tungsten key from upper right, daylight rim from lower left, vignette ---- */
.c3d-stage, :root[data-theme="dark"] .c3d-stage, :root:not([data-theme="light"]) .c3d-stage { background: var(--stage); border-color: var(--line); }
.c3d-stage::after { content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  box-shadow: inset 0 0 120px 10px rgba(0,0,0,.55); }
:root[data-theme="light"] .c3d-stage::after { box-shadow: inset 0 0 120px 10px rgba(0,0,0,.10); }
.c3d-loading { color: var(--muted); }

/* ---- scrollbars: thin graphite on stage black, tungsten on hover ---- */
html, .c3d-right, .deck .pane, .tablewrap, .film, .wall, .rv { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 999px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--scroll-thumb-hover); }
::-webkit-scrollbar-corner { background: transparent; }
/* Lenis */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }

/* ---- controls: one hover language ("pull focus": lift + light) ---- */
.btn { transition: background var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease), color var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease), transform var(--dur-1) var(--ease); }
.btn:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent), 0 8px 20px -12px color-mix(in srgb, var(--accent) 60%, transparent); }
.btn.primary { box-shadow: 0 10px 28px -14px var(--accent); }
.btn.primary:hover { filter: none; background: color-mix(in srgb, var(--accent) 88%, #fff); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.97); }
.tog[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.nav a { position: relative; }
.nav a[aria-current="page"] { background: transparent; box-shadow: none; color: var(--ink); }
.nav a::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 2px; height: 2px; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform var(--dur-3) var(--ease); }
.nav a:hover { background: transparent; color: var(--ink); }
.nav a:hover::after, .nav a[aria-current="page"]::after { transform: scaleX(1); }
.nav a:not([aria-current="page"]):hover::after { opacity: .5; }
input[type="range"] { accent-color: var(--accent); }

/* ---- motion: views pull into focus, titles rise out of a mask ---- */
.view.on { animation: view-focus var(--dur-3) var(--ease) both; }
@keyframes view-focus { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.view.on .page-head h1 { animation: title-rise var(--dur-4) var(--ease) both; animation-delay: 60ms; }
.view.on .page-head .lead { animation: view-focus var(--dur-3) var(--ease) both; animation-delay: 160ms; }
@keyframes title-rise { from { clip-path: inset(0 0 100% 0); transform: translateY(.35em); } to { clip-path: inset(0 0 -10% 0); transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .view.on, .view.on .page-head h1, .view.on .page-head .lead { animation: none; }
  .nav a::after, .btn { transition: none; }
}

/* brand mark: the lens logo */
.brand-mark { width: 28px; height: 28px; display: block; filter: drop-shadow(0 2px 6px rgba(0,0,0,.5)); transition: rotate var(--dur-3) var(--ease); }
.brand:hover .brand-mark { rotate: 30deg; }
@media (prefers-reduced-motion: reduce) { .brand-mark { transition: none; } }

/* ---- About FirstFrame (plain HTML in index.html, kept below the landing) ---- */
.seo-hero { padding: 40px 0 10px; } .seo-hero h1 { max-width: 16ch; } .seo-hero p { max-width: 62ch; font-size: 1.12rem; color: var(--muted); }
.seo-about { margin: 72px 0 24px; padding-top: 40px; border-top: 1px solid var(--line); }
.seo-about > h2 { margin-bottom: 28px; }
.seo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 18px 40px; }
.seo-grid section { padding: 4px 0 18px; border-bottom: 1px solid var(--line); }
.seo-grid h3 { margin: 0 0 10px; font-size: 1.32rem; text-transform: uppercase; letter-spacing: .02em; }
.seo-grid p, .seo-grid li { color: var(--muted); font-size: 1rem; line-height: 1.6; max-width: 62ch; }
.seo-grid ul, .seo-grid ol { margin: 0; padding-left: 1.2em; } .seo-grid li { margin: 4px 0; }
.seo-grid li::marker { color: var(--accent); }
.seo-grid a { color: var(--ink); text-decoration-color: var(--accent); text-underline-offset: 3px; }
.seo-grid a:hover { color: var(--accent); }
