/* Kinetik Collage material system | graphite studio + recessed OLED wells + tear-off spec chips
   Evolved from the Chameleon springboard (pantone-chip-atelier edition). Every surface reads var(--cx-*). */
@font-face { font-family: "Geist"; src: url("./fonts/geist-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Playfair Display"; src: url("./fonts/playfair-display-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Playfair Display"; src: url("./fonts/playfair-display-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Caveat"; src: url("./fonts/caveat-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("./fonts/geist-mono-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }

:root {
  color-scheme: dark;
  --cx-edition-id: "pantone-chip-atelier";
  /* OKLCH neutral ramp (hue 250), one accent, semantic colours at equal lightness */
  --cx-canvas: oklch(0.16 0.005 250);
  --cx-surface-1: oklch(0.19 0.006 250);
  --cx-surface-2: oklch(0.235 0.008 250);
  --cx-surface-3: oklch(0.30 0.01 250);
  --cx-well: oklch(0.12 0.004 250);
  --cx-well-ink: oklch(0.94 0.004 250);
  --cx-well-muted: oklch(0.68 0.01 250);
  --cx-input-bg: oklch(0.13 0.004 250);
  --cx-glass: oklch(0.21 0.007 250 / 0.82);
  --cx-ink-1: oklch(0.95 0.004 250);
  --cx-ink-2: oklch(0.72 0.012 250);
  --cx-ink-3: oklch(0.58 0.012 250);
  --cx-accent: oklch(0.78 0.14 230);
  --cx-accent-soft: oklch(0.78 0.14 230 / 0.16);
  --cx-accent-ink: oklch(0.18 0.03 240);
  --cx-ok: oklch(0.78 0.14 155);
  --cx-warn: oklch(0.78 0.14 75);
  --cx-crit: oklch(0.78 0.14 25);
  --cx-tint-1: oklch(1 0 0 / 0.05);
  --cx-tint-2: oklch(1 0 0 / 0.09);
  --cx-menu-bg: oklch(0.21 0.007 250 / 0.96);
  --cx-toast-bg: oklch(0.24 0.008 250 / 0.97);
  --cx-backdrop: oklch(0.08 0.004 250 / 0.6);
  --cx-hairline: oklch(1 0 0 / 0.06);
  --cx-hairline-strong: oklch(1 0 0 / 0.1);
  --cx-catch: inset 0 1px 0 oklch(1 0 0 / 0.07);
  --cx-bevel-top: var(--cx-catch);
  --cx-shadow-plate: 0 1px 2px oklch(0 0 0 / 0.4);
  --cx-shadow-float: 0 24px 60px oklch(0 0 0 / 0.55), 0 2px 6px oklch(0 0 0 / 0.4);
  --cx-well-shadow: inset 0 2px 6px oklch(0 0 0 / 0.55), inset 0 0 0 1px oklch(0 0 0 / 0.35), 0 1px 0 oklch(1 0 0 / 0.04);
  --cx-radius-shell: 14px;
  --cx-radius-card: 10px;
  --cx-radius-ctl: 8px;
  --cx-radius-pill: 999px;
  --cx-font-display: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --cx-font-ui: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --cx-font-editorial: "Playfair Display", "Iowan Old Style", Georgia, serif;
  --cx-font-script: "Caveat", "Segoe Script", "Bradley Hand", cursive;
  --cx-font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --cx-track-display: -0.02em;
  --cx-spring-snap: cubic-bezier(0.22, 1, 0.36, 1);
  /* Critically-damped-ish spring (stiffness 170, damping 22) sampled for linear(); drawers and sheets ride it */
  --cx-spring-drawer: linear(0, 0.063, 0.218, 0.411, 0.594, 0.743, 0.853, 0.927, 0.971, 0.995, 1.006, 1.009, 1.008, 1.005, 1.002, 1);
  --cx-dur-drawer: 520ms;
  /* Memory warmth: the one warm accent, reserved for sharing with people */
  --cx-memory: oklch(0.8 0.12 65);
  --cx-memory-ink: oklch(0.22 0.04 60);
  --cx-memory-soft: oklch(0.8 0.12 65 / 0.14);
  /* OLED glass: near-black, deep blur, 1px specular top edge */
  --cx-glass-oled: oklch(0.1 0.004 250 / 0.72);
  --cx-specular: linear-gradient(90deg, transparent, oklch(1 0 0 / 0.22) 30%, oklch(1 0 0 / 0.22) 70%, transparent);
  --cx-spring-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --cx-dur-fast: 180ms;
  --cx-dur: 280ms;
  --cx-dur-slow: 420ms;
  /* Stage (canvas reads these; hex keeps every canvas engine happy) */
  --cx-stage-bg: #0b0d11;
  --cx-stage-grid: #151a21;
  --cx-stage-trace-1: #5cbcf2;
  --cx-stage-trace-2: #6fd8a6;
  --cx-stage-glow: oklch(0.78 0.14 230 / 0.3);
  /* Tear-off spec chip band */
  --cx-spec-band: #fbfbf9;
  --cx-spec-ink: #1d2128;
  --cx-spec-muted: #6a717c;
  /* Cursor light (set by JS on the hovered surface) */
  --mx: 50%;
  --my: 0%;
}

/* Paper edition: warm ceramic daylight. The stage and waveform stay a recessed dark well (a light table
   for photos), so they re-declare the graphite ink locally. */
:root[data-theme="paper"] {
  color-scheme: light;
  --cx-canvas: oklch(0.955 0.007 85);
  --cx-surface-1: oklch(0.99 0.003 85);
  --cx-surface-2: oklch(0.945 0.006 85);
  --cx-surface-3: oklch(0.905 0.008 85);
  --cx-input-bg: oklch(0.965 0.005 85);
  --cx-glass: oklch(0.99 0.003 85 / 0.86);
  --cx-ink-1: oklch(0.22 0.012 250);
  --cx-ink-2: oklch(0.44 0.012 250);
  --cx-ink-3: oklch(0.56 0.012 250);
  --cx-accent: oklch(0.52 0.15 245);
  --cx-accent-soft: oklch(0.52 0.15 245 / 0.11);
  --cx-accent-ink: oklch(0.99 0.005 245);
  --cx-ok: oklch(0.52 0.13 155);
  --cx-warn: oklch(0.52 0.12 70);
  --cx-crit: oklch(0.52 0.16 25);
  --cx-tint-1: oklch(0.25 0.02 250 / 0.05);
  --cx-tint-2: oklch(0.25 0.02 250 / 0.09);
  --cx-menu-bg: oklch(0.995 0.002 85 / 0.96);
  --cx-toast-bg: oklch(0.99 0.003 85 / 0.98);
  --cx-backdrop: oklch(0.3 0.01 85 / 0.32);
  --cx-hairline: oklch(0.2 0.01 250 / 0.07);
  --cx-hairline-strong: oklch(0.2 0.01 250 / 0.12);
  --cx-catch: inset 0 1px 0 oklch(1 0 0 / 0.95);
  --cx-shadow-plate: 0 1px 2px oklch(0.35 0.02 70 / 0.08), 0 6px 20px oklch(0.35 0.02 70 / 0.06);
  --cx-shadow-float: 0 28px 70px oklch(0.3 0.02 70 / 0.2), 0 2px 8px oklch(0.3 0.02 70 / 0.1);
  --cx-memory: oklch(0.62 0.14 55);
  --cx-memory-ink: oklch(0.99 0.01 60);
  --cx-memory-soft: oklch(0.62 0.14 55 / 0.12);
}
:root[data-theme="paper"] .stage, :root[data-theme="paper"] .wave-wrap {
  color-scheme: dark;
  --cx-ink-1: oklch(0.95 0.004 250);
  --cx-ink-2: oklch(0.74 0.012 250);
  --cx-ink-3: oklch(0.6 0.012 250);
  --cx-surface-2: oklch(0.235 0.008 250);
  --cx-surface-3: oklch(0.30 0.01 250);
  --cx-accent: oklch(0.78 0.14 230);
  --cx-accent-soft: oklch(0.78 0.14 230 / 0.16);
  --cx-accent-ink: oklch(0.18 0.03 240);
  --cx-tint-1: oklch(1 0 0 / 0.05);
  --cx-tint-2: oklch(1 0 0 / 0.09);
  --cx-catch: inset 0 1px 0 oklch(1 0 0 / 0.07);
  --cx-shadow-plate: 0 1px 2px oklch(0 0 0 / 0.4);
  color: var(--cx-ink-1);
}
:root[data-theme="paper"] .btn.primary { box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.3), 0 4px 14px oklch(0.52 0.15 245 / 0.28); }
:root[data-theme="paper"] .btn.primary:hover { background: oklch(0.47 0.15 245); }

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; overflow-x: clip; background: var(--cx-canvas); color: var(--cx-ink-1); font: 400 14px/1.5 var(--cx-font-ui); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
h1, h2, h3, h4 { font-family: var(--cx-font-display); font-style: normal; font-weight: 500; letter-spacing: var(--cx-track-display); overflow-wrap: anywhere; min-width: 0; margin: 0 0 0.4em; }
strong { font-weight: 500; }
.mono, output, kbd, input[type="number"], [data-numeric] { font-family: var(--cx-font-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--cx-ink-2); }
.small { font-size: 12px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
button, input, select, textarea { font: inherit; color: inherit; }
svg.ico { flex: none; display: block; }
:focus-visible { outline: 2px solid var(--cx-accent); outline-offset: 2px; }
[hidden] { display: none !important; }
::selection { background: var(--cx-accent-soft); }

/* Controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 14px; border-radius: var(--cx-radius-ctl); border: 0; background: var(--cx-surface-2); color: var(--cx-ink-1); font-weight: 500; font-size: 13px; cursor: pointer; white-space: nowrap; box-shadow: var(--cx-catch), var(--cx-shadow-plate); transition: transform var(--cx-dur-fast) var(--cx-spring-snap), background-color var(--cx-dur-fast) ease, color var(--cx-dur-fast) ease, box-shadow var(--cx-dur-fast) ease; }
.btn:hover { background: var(--cx-surface-3); }
.btn:active { transform: translateY(1px) scale(0.98); }
.btn.primary { background: var(--cx-accent); color: var(--cx-accent-ink); box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.35), 0 4px 14px oklch(0.78 0.14 230 / 0.25); }
.btn.primary:hover { background: oklch(0.83 0.12 230); }
.btn.ghost { background: transparent; box-shadow: none; color: var(--cx-ink-2); }
.btn.ghost:hover { background: var(--cx-tint-1); color: var(--cx-ink-1); }
.btn.ghost[aria-pressed="true"] { color: var(--cx-accent); }
.btn.small { min-height: 32px; padding: 0 10px; font-size: 12px; gap: 6px; }
.btn.icon-only { width: 40px; padding: 0; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
input:not([type="range"]):not([type="checkbox"]), select, textarea { min-height: 36px; padding: 6px 10px; border-radius: var(--cx-radius-ctl); border: 0; background: var(--cx-input-bg); color: var(--cx-ink-1); box-shadow: var(--cx-well-shadow); }
input[type="range"] { accent-color: var(--cx-accent); cursor: pointer; }
kbd { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 5px; background: var(--cx-surface-2); color: var(--cx-ink-2); font-size: 11px; box-shadow: var(--cx-catch); }

/* Pills (filters, presets, modes) */
.pills { display: flex; gap: 6px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.pills::-webkit-scrollbar { display: none; }
.pill { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 11px; border-radius: var(--cx-radius-pill); border: 0; background: var(--cx-tint-1); color: var(--cx-ink-2); font-size: 12px; font-weight: 500; cursor: pointer; white-space: nowrap; transition: background-color var(--cx-dur-fast) ease, color var(--cx-dur-fast) ease; }
.pill:hover { background: var(--cx-tint-2); color: var(--cx-ink-1); }
.pill[aria-checked="true"], .pill[aria-pressed="true"] { background: var(--cx-accent-soft); color: var(--cx-accent); box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--cx-accent) 40%, transparent); }
.pill .n { font-family: var(--cx-font-mono); font-variant-numeric: tabular-nums; color: var(--cx-ink-3); font-size: 11px; }
.pill[aria-pressed="true"] .n, .pill[aria-checked="true"] .n { color: inherit; opacity: 0.8; }

/* Warm call to action for sharing with people */
.btn.share-cta { background: var(--cx-memory); color: var(--cx-memory-ink); box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.35), 0 4px 16px color-mix(in oklch, var(--cx-memory) 32%, transparent); }
.btn.share-cta:hover { background: color-mix(in oklch, var(--cx-memory) 88%, white); }

/* OLED glass: floating chrome over photos (HUD, moment bar). The 1px specular line sits on the top edge. */
.glass { position: relative; background: var(--cx-glass-oled); backdrop-filter: blur(18px) saturate(1.3); -webkit-backdrop-filter: blur(18px) saturate(1.3); box-shadow: inset 0 0 0 1px oklch(1 0 0 / 0.06), var(--cx-shadow-float); }
.glass::after { content: ""; position: absolute; left: 10%; right: 10%; top: 0; height: 1px; background: var(--cx-specular); pointer-events: none; }

/* Spring drawer: sheets and dialogs rise on a sampled spring, never a flat fade */
@keyframes cx-drawer { from { opacity: 0; transform: translateY(18px) scale(0.985); } }
.drawer[open], .drawer:not(dialog) { animation: cx-drawer var(--cx-dur-drawer) var(--cx-spring-drawer); }

/* Material: plate with cursor light + catch-light; recessed OLED well */
.plate { position: relative; background: var(--cx-surface-1); border-radius: var(--cx-radius-shell); box-shadow: var(--cx-catch), var(--cx-shadow-plate); isolation: isolate; }
.plate::before { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: -1; background: radial-gradient(420px circle at var(--mx) var(--my), oklch(1 0 0 / 0.045), transparent 60%); opacity: 0; transition: opacity var(--cx-dur) ease; }
.plate:hover::before { opacity: 1; }
.well { background: var(--cx-well); color: var(--cx-well-ink); border-radius: var(--cx-radius-card); box-shadow: var(--cx-well-shadow); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
