/* Splatlet. Taglet's room (warm inks, Patina accent, Bricolage + Hanken + JetBrains Mono, glass only on the floating
   control layer) with Any Day Now's app shape (floating dock, sheets that grow from their button, the pass header,
   the lamp-amber "working" colour). Semantic tokens only below the :root block. */
@font-face { font-family: "Bricolage"; src: url("/fonts/bricolage.woff2") format("woff2-variations"); font-weight: 200 800; font-display: swap; } /* ds-allow-hardcode: @font-face names the family */
@font-face { font-family: "Hanken"; src: url("/fonts/hanken.woff2") format("woff2-variations"); font-weight: 100 900; font-display: swap; } /* ds-allow-hardcode: @font-face names the family */
@font-face { font-family: "JB Mono"; src: url("/fonts/jbmono.woff2") format("woff2"); font-weight: 500; font-display: swap; } /* ds-allow-hardcode: @font-face names the family */

:root {
  color-scheme: dark;
  --ink-0: #0b0a09; --ink-1: #141210; --ink-2: #1c1916; --ink-3: #27231f;
  --line: rgba(243, 236, 226, .09); --line-strong: rgba(243, 236, 226, .16);
  --paper: #f3ece2; --paper-2: #bdb4a7; --paper-3: #8e867b;
  --accent: #46c2b0; --accent-ink: #04201b; --accent-soft: rgba(70, 194, 176, .14);
  --lamp: #f5a524; --lamp-ink: #2a1a00; --lamp-soft: rgba(245, 165, 36, .14);   /* Any Day Now's amber: work in progress */
  --signal: #ff7558; --signal-soft: rgba(255, 117, 88, .14);                     /* problems and destructive actions only */

  --font-display: "Bricolage", "Hanken", ui-sans-serif, system-ui, sans-serif;
  --font-text: "Hanken", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: "JB Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --t-xs: 12px; --t-sm: 14px; --t-md: 16px; --t-lg: 20px; --t-xl: 26px; --t-2xl: 34px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --r-art: 5px; --r-field: 9px; --r-row: 10px; --r-card: 22px; --r-sheet: 26px; --r-full: 999px;
  --ease-out: cubic-bezier(.23, 1, .32, 1); --dur-fast: 150ms; --dur: 200ms;
  --control: 44px; --hair: 1.5px; --dur-pulse: 1.4s;
  /* Sizes used by components */
  --s0: 2px; --s1h: 6px; --s3h: 14px; --r-mark: 7px; --icon: 22px; --icon-sm: 18px; --step-h: 40px;
  --thumb: 52px; --thumb-lg: 64px; --control-lg: 54px; --bar-h: 56px; --row-h: 72px; --film-min: 80px;
  --aura-blur: 60px; --toast-top: 76px; --dock-clear: 120px; --dock-w: 420px; --sheet-w: 520px; --page-w: 640px;

  --glass-fill: linear-gradient(180deg, rgba(48, 43, 38, .62), rgba(26, 23, 20, .58));
  --glass-blur: blur(22px) saturate(1.7) brightness(1.05);
  --glass-edge: inset 0 1px 0 rgba(255, 250, 240, .16), inset 0 -1px 0 rgba(0, 0, 0, .35), inset 0 0 0 .5px rgba(255, 250, 240, .12);
  --glass-drop: 0 10px 30px -8px rgba(0, 0, 0, .55), 0 2px 6px rgba(0, 0, 0, .3);
  --scrim: rgba(0, 0, 0, .55);
  --safe-t: env(safe-area-inset-top); --safe-b: env(safe-area-inset-bottom);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--ink-0); }
body {
  margin: 0; min-height: 100dvh; background: var(--ink-0); color: var(--paper);
  font: 400 var(--t-md)/1.5 var(--font-text); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 650; line-height: 1.08; letter-spacing: -.022em; margin: 0; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
a { color: var(--accent); }
button, input { font: inherit; color: inherit; }
button, a, label { touch-action: manipulation; }
img, svg { display: block; }
svg { width: var(--icon); height: var(--icon); fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus { outline: none; }
:focus-visible { outline: var(--s0) solid var(--accent); outline-offset: var(--s0); border-radius: var(--s1h); }
::selection { background: var(--accent); color: var(--accent-ink); }
.muted { color: var(--paper-2); }
.mono { font-family: var(--font-mono); font-size: .92em; }

/* The room light: the current splat's first frame, blurred behind the glass (Taglet's album-art aura). */
.aura { position: fixed; inset: 0 0 auto; height: 70vh; z-index: -1; pointer-events: none; overflow: hidden; }
.aura::after { content: ""; position: absolute; inset: 0; background: radial-gradient(70% 90% at 50% -10%, var(--accent-soft), transparent 70%), linear-gradient(transparent 40%, var(--ink-0)); }
.aura img { width: 100%; height: 100%; object-fit: cover; filter: blur(var(--aura-blur)) saturate(1.4); opacity: 0; transform: scale(1.3); transition: opacity .6s var(--ease-out); }
.aura img.on { opacity: .45; }

/* ── Glass control layer ── */
.glass { background: var(--glass-fill); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); box-shadow: var(--glass-edge), var(--glass-drop); }
.bar {
  position: sticky; top: calc(var(--safe-t) + var(--s2)); z-index: 20; margin: var(--s2) var(--s3) 0; margin-top: calc(var(--safe-t) + var(--s2));
  display: flex; align-items: center; gap: var(--s2); padding: var(--s1h) var(--s1h) var(--s1h) var(--s3h); border-radius: var(--r-full); min-height: var(--bar-h);
}
.brand { display: flex; align-items: center; gap: var(--s2); color: var(--paper); text-decoration: none; font: 700 var(--t-lg)/1 var(--font-display); letter-spacing: -.03em; margin-right: auto; min-height: var(--control); }
.brand img { border-radius: var(--r-mark); }
body[data-view="splat"] .brand span { display: none; }
.icon-btn { width: var(--control); height: var(--control); display: grid; place-items: center; border: 0; border-radius: var(--r-full); background: transparent; color: var(--paper); cursor: pointer; }
.icon-btn:active { background: var(--line); }
.mac-pill {
  display: flex; align-items: center; gap: var(--s2); min-height: var(--control); padding: 0 var(--s3h); border: 0; border-radius: var(--r-full);
  background: var(--ink-2); color: var(--paper-2); font: 600 var(--t-sm)/1 var(--font-text); cursor: pointer;
}
.dot { width: var(--s2); height: var(--s2); border-radius: 50%; background: var(--paper-3); flex: none; }
[data-mac="on"] .dot { background: var(--accent); box-shadow: 0 0 0 var(--s1) var(--accent-soft); }
[data-mac="busy"] .dot { background: var(--lamp); box-shadow: 0 0 0 var(--s1) var(--lamp-soft); }
[data-mac="off"] .dot { background: var(--paper-3); }

.dock { position: fixed; left: 50%; bottom: calc(var(--safe-b) + var(--s4)); transform: translateX(-50%); z-index: 20; padding: var(--s1h); border-radius: var(--r-full); width: min(var(--dock-w), calc(100% - var(--s6))); }
.dock .btn { width: 100%; }
body[data-view="splat"] .dock { display: none; }

/* ── Buttons and fields ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: var(--control); padding: 0 var(--s5);
  border: 0; border-radius: var(--r-full); background: var(--ink-3); color: var(--paper); font-weight: 600; cursor: pointer; text-decoration: none;
  transition: background var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.btn:active { transform: scale(.97); }
.btn.big { min-height: var(--control-lg); font-size: var(--t-md); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.danger { background: var(--signal-soft); color: var(--signal); }
.btn.ghost { background: transparent; color: var(--paper-2); }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.file-btn:has(input:focus-visible) { outline: var(--s0) solid var(--accent); outline-offset: var(--s0); }
.field { display: grid; gap: var(--s1h); }
.field span { font: 600 var(--t-sm)/1 var(--font-text); color: var(--paper-2); }
.field input { min-height: var(--control); padding: 0 var(--s3h); border-radius: var(--r-field); border: 1px solid var(--line-strong); background: var(--ink-1); font-size: var(--t-md); caret-color: var(--accent); }
.field input:focus-visible { outline: var(--s0) solid var(--accent); outline-offset: 1px; }
.actions { display: grid; gap: var(--s2); }
.actions.row { grid-template-columns: 1fr 1fr; }

/* ── Pages ── */
main { padding: var(--s5) var(--s4) calc(var(--dock-clear) + var(--safe-b)); max-width: var(--page-w); margin: 0 auto; }
.page { display: grid; gap: var(--s5); }
.hero { display: grid; gap: var(--s3); padding-top: var(--s4); }
.hero h1 { font-size: var(--t-2xl); }
.lede { color: var(--paper-2); font-size: var(--t-md); }
body.has-splats .hero h1 { font-size: var(--t-xl); }
body.has-splats .how { display: none; }

.mac-note { display: flex; gap: var(--s3); padding: var(--s4); border-radius: var(--r-card); background: var(--ink-1); border: 1px solid var(--line); }
.mac-note .mac-icon { color: var(--paper-2); margin-top: var(--s0); }
.mac-note h2 { font-size: var(--t-md); font-family: var(--font-text); font-weight: 700; letter-spacing: 0; margin-bottom: var(--s1); }
.mac-note p { color: var(--paper-2); font-size: var(--t-sm); }
[data-mac="on"] .mac-note .mac-icon { color: var(--accent); }
[data-mac="busy"] .mac-note .mac-icon { color: var(--lamp); }

.section-title { font-size: var(--t-lg); }
.rows { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s0); border-radius: var(--r-card); overflow: hidden; }
.row-link { display: flex; align-items: center; gap: var(--s3); padding: var(--s3); min-height: var(--row-h); background: var(--ink-1); color: var(--paper); text-decoration: none; }
.row-link:active { background: var(--ink-2); }
.thumb { width: var(--thumb); height: var(--thumb); border-radius: var(--r-art); background: var(--ink-3); object-fit: cover; flex: none; }
.row-text { min-width: 0; flex: 1; display: grid; gap: var(--s0); }
.row-text strong { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status { font: 500 var(--t-xs)/1.3 var(--font-mono); color: var(--paper-3); display: flex; align-items: center; gap: var(--s1h); }
.status.working { color: var(--lamp); }
.status.ready { color: var(--accent); }
.status.failed { color: var(--signal); }
.status.working::before { content: ""; width: var(--s1h); height: var(--s1h); border-radius: 50%; background: currentColor; animation: pulse var(--dur-pulse) ease-in-out infinite; }
.chev { color: var(--paper-3); width: var(--icon-sm); height: var(--icon-sm); }

.how { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s4); }
.how li { display: flex; gap: var(--s3); align-items: flex-start; }
.how .n { width: var(--s6); height: var(--s6); border-radius: 50%; display: grid; place-items: center; background: var(--ink-2); font: 600 var(--t-sm)/1 var(--font-mono); color: var(--accent); flex: none; }
.how p { color: var(--paper-2); font-size: var(--t-sm); }

/* ── Splat page: the pass ── */
.pass { position: relative; display: grid; gap: var(--s4); padding: var(--s5); border-radius: var(--r-card); background: var(--ink-1); border: 1px solid var(--line); overflow: hidden; }
.pass-head { display: flex; gap: var(--s4); align-items: center; }
.pass-head .thumb { width: var(--thumb-lg); height: var(--thumb-lg); }
.pass h1 { font-size: var(--t-xl); word-break: break-word; }
.pass .meta { font: 500 var(--t-xs)/1.4 var(--font-mono); color: var(--paper-3); margin-top: var(--s1); }
.eta { font: 650 var(--t-2xl)/1 var(--font-display); letter-spacing: -.03em; }
.eta small { display: block; font: 500 var(--t-sm)/1.4 var(--font-text); color: var(--paper-2); letter-spacing: 0; margin-top: var(--s2); }
.meter { height: var(--s2); border-radius: var(--r-full); background: var(--ink-3); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--lamp); transition: width .6s var(--ease-out); }
.meter.done i { background: var(--accent); }

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.steps li { display: flex; gap: var(--s3); align-items: center; min-height: var(--step-h); color: var(--paper-3); font-size: var(--t-sm); }
.steps .mark { width: var(--icon); height: var(--icon); border-radius: 50%; border: var(--hair) solid var(--ink-3); display: grid; place-items: center; flex: none; }
.steps .mark svg { width: var(--s3h); height: var(--s3h); stroke-width: 2.6; }
.steps li.done { color: var(--paper-2); }
.steps li.done .mark { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.steps li.now { color: var(--paper); font-weight: 600; }
.steps li.now .mark { border-color: var(--lamp); background: var(--lamp-soft); }
.steps li.now .mark::after { content: ""; width: var(--s2); height: var(--s2); border-radius: 50%; background: var(--lamp); animation: pulse var(--dur-pulse) ease-in-out infinite; }
.callout { padding: var(--s3) var(--s4); border-radius: var(--r-row); background: var(--ink-2); color: var(--paper-2); font-size: var(--t-sm); }
.callout.bad { background: var(--signal-soft); color: var(--paper); }
.callout strong { color: var(--paper); }

.stage { position: relative; aspect-ratio: 4 / 5; border-radius: var(--r-card); overflow: hidden; background: var(--ink-1); border: 1px solid var(--line); touch-action: none; }
.stage canvas { width: 100%; height: 100%; display: block; }
.stage .hint { position: absolute; left: 50%; bottom: var(--s3); transform: translateX(-50%); padding: var(--s2) var(--s3h); border-radius: var(--r-full); font-size: var(--t-xs); color: var(--paper-2); white-space: nowrap; pointer-events: none; transition: opacity .4s; }
.stage .loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--paper-2); font-size: var(--t-sm); }
.stage .fs-btn { position: absolute; top: var(--s3); right: var(--s3); }
.stage.full { position: fixed; inset: 0; z-index: 50; aspect-ratio: auto; border-radius: 0; border: 0; background: var(--ink-0); }
.stage.full .fs-btn { top: calc(var(--safe-t) + var(--s3)); }
.tools { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
.tools .wide { grid-column: 1 / -1; }

/* ── Sheets (dialogs) ── */
dialog.sheet {
  width: min(var(--sheet-w), 100%); max-width: 100%; max-height: calc(100dvh - var(--safe-t) - var(--s5)); margin: auto auto 0; padding: var(--s5) var(--s5) calc(var(--s5) + var(--safe-b));
  border: 0; border-radius: var(--r-sheet) var(--r-sheet) 0 0; background: var(--ink-1); color: var(--paper); box-shadow: var(--glass-drop), var(--glass-edge);
  overflow-y: auto; overscroll-behavior: contain;
}
dialog.sheet.small { display: grid; gap: var(--s3); }
dialog.sheet:not([open]) { display: none; }
@media (min-width: 768px) { /* ds-allow-hardcode: media queries cannot read vars */ dialog.sheet { margin: auto; border-radius: var(--r-sheet); } }
dialog::backdrop { background: var(--scrim); -webkit-backdrop-filter: blur(var(--s1h)); backdrop-filter: blur(var(--s1h)); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin: calc(var(--s2) * -1) calc(var(--s2) * -1) var(--s3) 0; }
.sheet-head h2 { font-size: var(--t-xl); }
.sheet-body { display: grid; gap: var(--s5); }
.tips { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s4); }
.tips li { display: flex; gap: var(--s3); }
.tips svg { color: var(--accent); margin-top: 1px; }
.tips p { color: var(--paper-2); font-size: var(--t-sm); }
.fine { color: var(--paper-3); font-size: var(--t-xs); line-height: 1.5; }
.error { color: var(--signal); font-size: var(--t-sm); }

.film { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s1); min-height: var(--film-min); }
.film img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--r-art); background: var(--ink-3); }
.send-label { font: 650 var(--t-lg)/1.2 var(--font-display); }
#send-meter i { background: var(--accent); }

.toast { position: fixed; left: 50%; top: calc(var(--safe-t) + var(--toast-top)); transform: translateX(-50%); z-index: 60; padding: var(--s3) var(--icon-sm); border-radius: var(--r-full); font-weight: 600; font-size: var(--t-sm); max-width: calc(100% - var(--s6)); }

@keyframes pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
