/* SpokenKey product scenes: the app's own UI (from artifacts/design/mockups 01–03), the films and the hero scene.
   App tokens follow the in-app design, not the website palette. */

[data-app] {
  --a-window: #f4f2ec;
  --a-side: #f7f6f1;
  --a-surface: #ffffff;
  --a-field: #fbfaf6;
  --a-ink: #1c2621;
  --a-ink-2: #5c6961;
  --a-line: #dbded6;
  --a-green: #1f5c45;
  --a-green-soft: #e6efe9;
  --a-green-tint: #f1f6f2;
  --a-red: #c0392b;
  --a-red-soft: #fbe4e1;
  --a-amber: #8a5a00;
  --a-amber-soft: #fbf3e4;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  color: var(--a-ink);
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
}
[data-app] * { box-sizing: border-box; }
[data-app] p { margin: 0; }

/* ---------- Fixed design canvases, scaled to their frame ---------- */
.canvas-frame { position: relative; width: 100%; height: calc(var(--ch) * var(--s, 1) * 1px); }
.canvas { position: absolute; top: 0; left: 0; width: calc(var(--cw) * 1px); height: calc(var(--ch) * 1px); transform: scale(var(--s, 1)); transform-origin: 0 0; }

/* ---------- The app window ---------- */
.win { position: absolute; background: var(--a-surface); border-radius: 14px; overflow: hidden; box-shadow: 0 0 0 1px rgba(28, 38, 33, 0.1), 0 30px 60px -20px rgba(16, 24, 20, 0.35), 0 12px 24px -12px rgba(16, 24, 20, 0.2); display: grid; grid-template-rows: 38px 1fr; }
.win__bar { background: var(--a-window); border-bottom: 1px solid var(--a-line); display: flex; align-items: center; gap: 8px; padding-inline: 14px; font-size: 13px; color: var(--a-ink-2); }
.win__bar i { width: 12px; height: 12px; border-radius: 50%; background: #e2544b; }
.win__bar i:nth-child(2) { background: #e9b23c; }
.win__bar i:nth-child(3) { background: #4fb25a; margin-right: 10px; }
.win__body { display: grid; grid-template-columns: 200px 1fr; min-height: 0; }
.side { background: var(--a-side); border-right: 1px solid var(--a-line); padding: 18px 12px; display: grid; grid-template-rows: auto 1fr auto; gap: 18px; }
.logo { display: flex; align-items: center; gap: 8px; font: 700 19px/1 inherit; font-family: inherit; color: var(--a-ink); padding-left: 8px; }
.logo svg { width: 22px; height: 22px; }
.navl { display: grid; gap: 4px; align-content: start; }
.navl span { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; font-size: 14px; color: var(--a-ink); transition: background-color 200ms ease; }
.navl span::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #8b958f; }
.navl span.on { background: var(--a-green-soft); color: var(--a-green); font-weight: 600; }
.navl span.on::before { background: var(--a-green); }
.side__foot { font-size: 12px; color: var(--a-ink-2); padding-left: 8px; }
.side__foot b { display: flex; align-items: center; gap: 6px; color: var(--a-ink); font-size: 12.5px; margin-bottom: 2px; }
.side__foot b::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--a-green); }
.pane { position: relative; overflow: hidden; }
.view { position: absolute; inset: 0; padding: 26px 30px; display: grid; align-content: start; gap: 14px; }
.kick { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--a-green); }
.vt { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.vs { font-size: 14px; color: var(--a-ink-2); }
.abtn { display: inline-flex; align-items: center; justify-content: center; height: 38px; padding: 0 16px; border-radius: 8px; font-size: 13px; font-weight: 600; background: var(--a-green); color: #fff; }
.abtn.o { background: #fff; color: var(--a-ink); box-shadow: inset 0 0 0 1px var(--a-line); }
.acts { display: flex; gap: 10px; flex-wrap: wrap; }
.status { display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 12px; border-radius: 99px; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; background: var(--a-green-soft); color: var(--a-green); }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status.rec { background: var(--a-red-soft); color: var(--a-red); }
.metarow { display: flex; align-items: center; gap: 18px; font-size: 13px; color: var(--a-ink-2); padding-bottom: 14px; border-bottom: 1px solid var(--a-line); }
.elapsed { margin-left: auto; text-align: right; font-size: 22px; font-weight: 700; color: var(--a-ink); font-variant-numeric: tabular-nums; line-height: 1; }
.elapsed small { display: block; font-size: 9px; letter-spacing: 0.08em; color: var(--a-ink-2); margin-top: 3px; }

/* Capture home cards */
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 6px; }
.ccard { border: 1px solid var(--a-line); border-radius: 12px; padding: 18px; display: grid; gap: 10px; align-content: start; background: #fff; }
.ccard .kick { margin-bottom: 4px; }
.fnglyph { width: 64px; height: 50px; border-radius: 9px; border: 1.5px solid #b9bfb8; background: linear-gradient(#fdfdfb, #eeefea); display: grid; place-items: center; font: 700 20px/1 inherit; font-family: inherit; color: var(--a-ink); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.06); }
.micglyph { width: 50px; height: 50px; border-radius: 50%; background: var(--a-green-soft); display: grid; place-items: center; }
.micglyph svg { width: 22px; height: 22px; }
.ct { font-size: 15px; font-weight: 700; }
.cd { font-size: 12.5px; color: var(--a-ink-2); line-height: 1.5; }

/* Source choice */
.src { border: 1px solid var(--a-line); border-radius: 10px; padding: 14px 18px; display: grid; gap: 3px; background: #fff; transition: border-color 200ms ease, background-color 200ms ease; }
.src b { font-size: 14.5px; }
.src span { font-size: 12.5px; color: var(--a-ink-2); }
.src.on { border-color: var(--a-green); background: var(--a-green-tint); box-shadow: inset 0 0 0 1px var(--a-green); }
.notice { background: #efeee9; border-radius: 8px; padding: 12px 14px; font-size: 13px; font-weight: 600; }

/* Recording: mic and amplitude ribbon */
.ribbonwrap { display: flex; align-items: center; justify-content: center; gap: 18px; height: 150px; margin-top: 4px; }
.rib { display: flex; align-items: center; gap: 7px; height: 100%; }
.rib i { width: 7px; height: var(--h); border-radius: 4px; background: #5f8d79; transform-origin: 50% 50%; }
.rib i:nth-child(3n) { background: var(--a-green); }
.mic { width: 118px; height: 118px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle, #dcebe2 0 46px, #eef4f0 47px 58px, transparent 59px); box-shadow: 0 0 0 1px #cfe0d6; }
.mic svg { width: 44px; height: 44px; }
.ribcap { text-align: center; font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--a-green); }
.ribcap span { display: block; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--a-ink-2); font-size: 11px; margin-top: 2px; }

/* Transcript editor */
.editor-a { border: 1px solid var(--a-line); border-radius: 10px; background: var(--a-field); padding: 16px 18px; font-size: 15px; line-height: 1.75; min-height: 150px; }
.editor-a .ln { display: block; }
.savedbar { background: var(--a-green-soft); color: var(--a-green); border-radius: 99px; padding: 6px 12px; font-size: 12px; font-weight: 600; }

/* History */
.search { border: 1px solid var(--a-line); border-radius: 8px; background: var(--a-field); padding: 10px 14px; font-size: 13.5px; color: #8b958f; }
.hgroup { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--a-ink-2); margin-top: 6px; }
.hrow-a { display: grid; gap: 3px; padding-bottom: 12px; border-bottom: 1px solid var(--a-line); }
.hrow-a b { font-size: 15px; }
.hrow-a span { font-size: 12.5px; color: var(--a-ink-2); }
.hrow-a.new { background: var(--a-green-tint); border-radius: 10px; padding: 10px 12px; border: 1px solid #cfe0d6; }
.retain { display: flex; justify-content: space-between; align-items: center; border: 1px solid #cfe0d6; background: var(--a-green-tint); border-radius: 10px; padding: 12px 14px; font-size: 13.5px; font-weight: 600; }
.retain span { color: var(--a-green); }

/* Recovery */
.warnbox { background: var(--a-amber-soft); border: 1px solid #efdcb6; border-radius: 10px; padding: 12px 16px; display: grid; gap: 2px; }
.warnbox b { color: var(--a-amber); font-size: 14.5px; }
.warnbox span { font-size: 12.5px; color: var(--a-ink-2); }
.keep { border: 1px solid var(--a-line); border-radius: 10px; background: var(--a-field); padding: 16px 18px; font-size: 15px; min-height: 84px; }

/* ---------- Mac menu bar strip + SpokenKey cue ---------- */
.menubar { position: absolute; inset: 0 0 auto 0; height: 34px; display: flex; align-items: center; gap: 22px; padding-inline: 20px; background: rgba(255, 255, 255, 0.78); border-bottom: 1px solid rgba(28, 38, 33, 0.08); font-size: 13px; color: var(--a-ink); }
.menubar .m1 { font-weight: 700; }
.cue { margin-left: auto; position: relative; height: 24px; display: flex; align-items: center; gap: 7px; padding: 0 10px; border-radius: 7px; font-size: 12.5px; font-weight: 600; color: var(--a-ink); white-space: nowrap; }
.cue .glyph { display: flex; align-items: center; gap: 2px; height: 14px; }
.cue .glyph i { width: 2px; height: var(--g, 8px); border-radius: 1px; background: currentColor; transform-origin: 50% 50%; }
.cue .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.cue .lbl { overflow: hidden; display: inline-grid; }
.cue .lbl > span { grid-area: 1 / 1; }
.cue-bg { position: absolute; inset: 0; border-radius: 7px; background: var(--a-green-soft); z-index: -1; }
.cuemenu { position: absolute; top: 40px; right: 14px; width: 240px; background: rgba(255, 255, 255, 0.96); border-radius: 10px; box-shadow: 0 0 0 1px rgba(28, 38, 33, 0.12), 0 18px 40px -12px rgba(16, 24, 20, 0.35); padding: 6px; font-size: 13px; transform-origin: top right; }
.cuemenu p { padding: 7px 10px; border-radius: 6px; }
.cuemenu .hd { font-weight: 700; color: var(--a-green); display: flex; align-items: center; gap: 7px; }
.cuemenu .hd::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: currentColor; }
.cuemenu .sub { font-size: 12px; color: var(--a-ink-2); padding-top: 0; }
.cuemenu .it.hl { background: var(--a-green); color: #fff; }
.cuemenu hr { border: 0; border-top: 1px solid var(--a-line); margin: 4px 6px; }

/* ---------- "Your app": the destination ---------- */
.dest { position: absolute; background: #fff; border-radius: 14px; overflow: hidden; box-shadow: 0 0 0 1px rgba(28, 38, 33, 0.1), 0 30px 60px -24px rgba(16, 24, 20, 0.35); display: grid; grid-template-rows: 38px 1fr; }
.dest__bar { background: #f3f3f1; border-bottom: 1px solid #e4e4df; display: flex; align-items: center; gap: 8px; padding-inline: 14px; font-size: 13px; color: #6b6f6c; }
.dest__bar i { width: 12px; height: 12px; border-radius: 50%; background: #d9d9d4; }
.dest__bar i:nth-child(3) { margin-right: 10px; }
.dest__body { padding: 28px 34px; display: grid; align-content: start; gap: 12px; }
.dest__label { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #5f6461; }
.doc { font-size: 19px; line-height: 1.7; color: #1d2320; }
.doc .muted { color: #5f6461; }
.doc .ins { background: #dff0e6; border-radius: 3px; padding: 0 2px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.doc .caretx { display: inline-block; width: 2px; height: 1.2em; background: var(--a-green); vertical-align: -0.22em; margin-left: 1px; }
.ghost { font-size: 13px; color: var(--a-ink-2); background: #f4f5f2; border-radius: 8px; padding: 9px 12px; justify-self: start; }

/* ---------- Keyboard slice ---------- */
.kbd { position: absolute; border-radius: 22px; background: linear-gradient(#d9dbdf, #c9ccd2); padding: 16px; display: flex; gap: 12px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 24px 40px -24px rgba(16, 24, 20, 0.45); }
[data-app] .k { position: relative; flex: none; width: 96px; height: 96px; border-radius: 12px; background: linear-gradient(#ffffff, #f2f3f5); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset, 0 4px 0 #b3b7be, 0 6px 10px rgba(0, 0, 0, 0.14); display: grid; align-content: space-between; padding: 12px 13px; font-size: 14px; color: #3b3f45; }
[data-app] .k small { font-size: 12px; color: #6b7078; }
[data-app] .k.wide { width: 128px; }
[data-app] .k.space { flex: 1 1 auto; width: auto; }
[data-app] .k.fn { color: #111; }
[data-app] .k.fn .glo { width: 18px; height: 18px; }
[data-app] .k.fn .lab { font-size: 17px; font-weight: 600; }
[data-app] .k.fn::after { content: ""; position: absolute; inset: -4px; border-radius: 15px; box-shadow: 0 0 0 3px var(--a-green); opacity: var(--ring, 0); }

/* ---------- Film layout (website side) ---------- */
.film { position: relative; background: var(--paper-2); }
.film__pin { height: 100vh; height: 100svh; display: grid; align-items: center; }
.film__grid { display: grid; grid-template-columns: minmax(0, 0.72fr) minmax(0, 1.28fr); gap: clamp(28px, 4vw, 64px); align-items: center; width: 100%; }
.film__head { display: grid; gap: 14px; margin-bottom: 26px; }
.film__head h2 { font-size: calc(clamp(2.25rem, 1.3rem + 2.8vw, 3.75rem) * var(--head-scale)); }
.chapters { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.chapters button { all: unset; box-sizing: border-box; display: grid; grid-template-columns: 34px 1fr; gap: 2px 12px; width: 100%; padding: 12px 14px; border-radius: 14px; cursor: pointer; transition: background-color 250ms ease, opacity 250ms ease; }
.js .chapters button { opacity: 0.5; }
.chapters button:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.chapters button .n { grid-row: span 2; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font: 600 0.8125rem/1 var(--sans); border: 1.5px solid var(--ink); box-shadow: 0 2px 0 var(--ink); background: var(--surface); transition: background-color 250ms ease; }
.chapters button b { font: var(--head-w) 1.5rem/1.15 var(--serif); letter-spacing: -0.01em; }
.chapters button span:last-child { color: var(--ink-2); font-size: 0.9375rem; line-height: 1.45; }
.chapters button[aria-current="step"] { opacity: 1; background: var(--surface); box-shadow: 0 1px 0 rgba(12, 15, 20, 0.04), 0 16px 32px -20px rgba(12, 15, 20, 0.25); }
.chapters button[aria-current="step"] .n { background: var(--signal); }
@media (hover: hover) and (pointer: fine) { .chapters button:hover { opacity: 1; } }
.film__stage { position: relative; }
.filmcanvas { overflow: hidden; border-radius: 28px; }
.cam { position: absolute; inset: 0; transform-origin: 0 0; will-change: transform; }
.stagebg { position: absolute; inset: 0; border-radius: 28px; background: radial-gradient(120% 90% at 70% 10%, #f7f8fa 0%, #e3e6ec 60%, #d6dae2 100%); box-shadow: inset 0 0 0 1px rgba(12, 15, 20, 0.06); overflow: hidden; }
.film__note { margin-top: 12px; }
.film__bar { height: 3px; border-radius: 3px; background: rgba(12, 15, 20, 0.08); margin-top: 18px; overflow: hidden; }
.film__bar i { display: block; height: 100%; background: var(--signal); transform-origin: 0 50%; transform: scaleX(var(--fp, 0)); }

/* ---------- Hero scene ---------- */
.hscene { position: relative; perspective: 1400px; }
.hscene .canvas { transform-style: preserve-3d; }
.hlayer { position: absolute; transition: transform 500ms var(--ease-out); will-change: transform; }
.hint { position: absolute; font: 500 13px/1.3 var(--sans); color: var(--ink-2); }

@media (prefers-reduced-motion: no-preference) {
  .js .hscene { animation: stage-in 1200ms var(--ease-expo) 250ms both; }
  .js .hscene .hlayer:nth-child(1) { animation: fade-up 900ms var(--ease-expo) 350ms both; }
  .js .hscene .hlayer:nth-child(2) { animation: fade-up 900ms var(--ease-expo) 480ms both; }
  .js .hscene .hlayer:nth-child(3) { animation: fade-up 900ms var(--ease-expo) 640ms both; }
  .js .hscene .hlayer:nth-child(4) { animation: fade-up 900ms var(--ease-expo) 760ms both; }
}
.hscene .k.fn { -webkit-touch-callout: none; cursor: pointer; transition: transform 90ms ease-out, box-shadow 90ms ease-out; touch-action: none; user-select: none; -webkit-user-select: none; font: inherit; border: 0; }
.hscene .k.fn:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }

/* ---------- Responsive ---------- */
@media (max-width: 1023px) {
  .film__grid { grid-template-columns: minmax(0, 1fr); gap: 16px; align-content: center; }
  .film__head { margin-bottom: 6px; }
  .film__head .lede { display: none; }
  .film__head h2 { font-size: calc(clamp(1.75rem, 1.2rem + 2.4vw, 2.5rem) * var(--head-scale)); }
  .chapters button { display: none; grid-template-columns: 30px 1fr; padding: 10px 12px; }
  .chapters button[aria-current="step"] { display: grid; }
  .film__stage { order: -1; }
  .film__pin { align-items: center; }
  .chapter-dots { display: flex; }
}
.chapter-dots { display: none; gap: 6px; justify-content: center; margin-top: 8px; }
.chapter-dots i { width: 22px; height: 3px; border-radius: 2px; background: rgba(12, 15, 20, 0.16); }
.chapter-dots i.on { background: var(--signal); }

/* Without the film engine (no script, reduced motion): no pin, every chapter visible. */
.film.is-static .film__pin { height: auto; padding-block: clamp(72px, 10vw, 140px); }
.film.is-static .chapters button { display: grid; opacity: 1; }
.film.is-static .chapters button[aria-current="step"] { background: var(--surface); }
.film.is-static .chapter-dots { display: none; }

/* Skip past a pinned film (keyboard and screen-reader users) */
.skip-film { position: absolute; top: 12px; left: 12px; z-index: 30; padding: 10px 16px; border-radius: 10px; background: var(--ink); color: #fff; font: 600 0.9375rem/1.2 var(--sans); text-decoration: none; clip-path: inset(50%); }
.skip-film:focus { clip-path: none; }
.film.is-static .skip-film { display: none; }

/* Single-tap alternative to holding the hero key */
.tryit { font: inherit; font-weight: 600; color: var(--ink); background: none; border: 0; padding: 4px 2px; min-height: 24px; text-decoration: underline; text-underline-offset: 0.2em; cursor: pointer; }
.tryit:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
