/* ============================================================
   Flowphonic — design tokens ported 1:1 from the app's theme.ts
   ============================================================ */

@font-face {
  font-family: 'JetBrains Mono';
  src: url('../assets/fonts/JetBrainsMono-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('../assets/fonts/JetBrainsMono-Medium.ttf') format('truetype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('../assets/fonts/JetBrainsMono-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;

  /* graphite surfaces — swapped live by js/main.js when the theme/tint
     switcher in the header is used, exactly like the app's own toggle. */
  --bg: #141414;
  --surface: #1b1b1b;
  --surface-alt: #202020;
  --border: #3a3a3a;
  --border-bright: #52524f;

  /* ink */
  --ink: #edebe3;
  --text: #edebe3;
  --text-secondary: #a8a69c;
  --text-tertiary: #6e6c64;

  /* the user-selectable accent (cycled via the header swatch) — defaults to
     the app's own default accent, orange. */
  --accent: #ff5a1f;
  --accent-ink: #f5f1e8;
  --accent-glow: rgba(255, 90, 31, 0.35);

  /* fixed functional colors — these do NOT follow the accent or theme,
     exactly like the app's marker-status and VU-meter warning/clip colors. */
  --fixed-orange: #ff5a1f;
  --green: #3ecf6e;
  --yellow: #f2b705;
  --red: #e23b3b;
  --blue: #3b82e2;
  --vu-warn: #ffb020;
  --vu-clip: #ff4136;

  --radius-sm: 3px;
  --radius-md: 5px;
  --radius-lg: 6px;
  --radius-xl: 8px;
  --bw: 1.5px;

  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --container: 1120px;
  --gutter: clamp(20px, 5vw, 56px);
}

/* Themed surfaces cross-fade instead of snapping when the switcher is used. */
body, .panel, .step, .shot, .device, .dial, .nav a, .btn, .contact-card,
.site-header, .nav-toggle {
  transition: background-color 0.35s ease, border-color 0.35s ease, color 0.35s ease;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

a { color: inherit; text-decoration: none; }

::selection { background: var(--accent); color: var(--accent-ink); }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

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

/* ---------- layout shell ---------- */

.wrap {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.rule {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0;
}

section { padding: 64px 0; }
section + section { border-top: 1px solid var(--border); }

@media (max-width: 640px) {
  section { padding: 44px 0; }
}

/* ---------- header ---------- */

.site-header {
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 50;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}

.brand img { width: 22px; height: 22px; border-radius: var(--radius-sm); }

.brand .tag {
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--text-tertiary);
  text-transform: uppercase;
}

.header-right { display: flex; align-items: center; gap: 10px; }

/* theme/tint switcher — same two controls as the app's ScreenHeader: a
   swatch that cycles the accent, and a toggle that cycles the theme variant. */
.theme-controls { display: flex; align-items: center; gap: 8px; }

.theme-swatch {
  width: 26px; height: 26px;
  border-radius: var(--radius-sm);
  border: var(--bw) solid var(--ink);
  background: var(--accent);
  cursor: pointer;
  padding: 0;
  transition: background-color 0.35s ease, border-color 0.35s ease, transform 0.08s ease;
}
.theme-swatch:active { transform: scale(0.92); }

.theme-toggle {
  min-width: 74px;
  border: var(--bw) solid var(--ink);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  padding: 7px 10px;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: transform 0.08s ease, border-color 0.35s ease, color 0.35s ease;
}
.theme-toggle:active { transform: scale(0.96); }

.nav {
  display: flex;
  gap: 8px;
}

.nav a {
  padding: 9px 14px;
  border: var(--bw) solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
  transition: border-color 0.15s ease, color 0.15s ease;
}
.nav a:hover { border-color: var(--border-bright); color: var(--text); }
.nav a.current { border-color: var(--accent); color: var(--text); }

.nav-toggle {
  display: none;
  border: var(--bw) solid var(--border);
  background: none;
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-family: var(--mono);
  font-size: 0.8rem;
}

@media (max-width: 720px) {
  .nav-toggle { display: inline-block; }
  .nav {
    display: none;
    position: absolute;
    top: 72px;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 12px var(--gutter) 20px;
    gap: 8px;
  }
  .nav.open { display: flex; }
  .nav a { text-align: center; }
}

@media (max-width: 560px) {
  .brand .tag { display: none; }
  .header-right { gap: 6px; }
  .theme-toggle { min-width: 0; padding: 7px 8px; font-size: 0.6rem; }
  .theme-swatch { width: 24px; height: 24px; }
  .nav-toggle { padding: 7px 9px; font-size: 0.7rem; }
}

@media (max-width: 400px) {
  .brand { font-size: 0.92rem; gap: 7px; }
  .brand img { width: 19px; height: 19px; }
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 22px;
  border-radius: var(--radius-md);
  border: var(--bw) solid transparent;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 0 0 0 var(--accent-glow);
}
.btn-primary:hover { filter: brightness(1.08); }

.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--border-bright); }

/* ---------- eyebrow / label convention (mirrors real app section labels) ---------- */

.label {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.label-rule {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}
.label-rule .line { flex: 1; height: 1px; background: var(--border); }

/* ---------- panels (the app's bordered-card language, no shadows, near-square) ---------- */

.panel {
  border: var(--bw) solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 24px;
}

.panel-alt { background: var(--surface-alt); }

/* ---------- hero ---------- */

.hero {
  padding-top: 56px;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: var(--gutter);
  align-items: center;
}

/* Grid items default to min-width:auto, which refuses to shrink below the
   content's min-content size — the classic cause of a grid overflowing its
   own container on narrow screens. Overriding it on every grid's direct
   children here, not just the hero's. */
.hero > *,
.sequence > *,
.grid-2 > *,
.dial-section > *,
.shots > * {
  min-width: 0;
}

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
}

.hero-tag {
  color: var(--text-tertiary);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 0 0 18px;
}

.hero h1 {
  font-size: clamp(2.1rem, 4.2vw, 3.1rem);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 22px;
  max-width: min(21ch, 100%);
}

.hero p.lede {
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--text-secondary);
  max-width: min(46ch, 100%);
  margin: 0 0 32px;
}

.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 28px; }

.hero-meta {
  color: var(--text-tertiary);
  font-size: 0.78rem;
}

/* --- hero device panel: recreates the record screen's LCD readout --- */

.device {
  border: var(--bw) solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface);
  padding: 22px;
}

.device .device-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.rec-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent-glow);
  animation: pulse-dot 1.6s ease-in-out infinite;
  display: inline-block;
  margin-right: 8px;
  vertical-align: middle;
}

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow); }
  50% { box-shadow: 0 0 0 6px transparent; }
}

.device-status { font-size: 0.72rem; letter-spacing: 0.1em; color: var(--text-secondary); text-transform: uppercase; }

.timecode {
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(2.1rem, 5vw, 2.7rem);
  letter-spacing: 0.02em;
  color: var(--ink);
  margin: 4px 0 18px;
}

.timecode .ms { color: var(--text-tertiary); font-size: 0.6em; }

/* Segmented VU meter, ported from StereoVUMeter.tsx: SEGMENT_COUNT fixed-height
   blocks, each either off or lit in one of three fixed zones (accent for the
   safe ~65%, amber for the next ~20%, red for the top ~15%) — never a
   per-segment random height/brightness, that's not how the real meter looks. */
.meter-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.meter-row .ch {
  font-weight: 700;
  font-size: 0.6rem;
  color: var(--text-tertiary);
  width: 10px;
}
.meter {
  flex: 1;
  display: flex;
  gap: 3px;
  height: 12px;
}
.meter .seg {
  flex: 1;
  border-radius: 1px;
  background: var(--border);
  transition: background-color 0.08s linear;
}

.meter-label {
  font-size: 0.65rem;
  color: var(--text-tertiary);
  letter-spacing: 0.08em;
  margin: 2px 0 10px;
}

.device .waveform {
  height: 44px;
  border: var(--bw) solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 10px;
  overflow: hidden;
}

.device .waveform span {
  width: 2px;
  background: var(--accent);
  border-radius: 1px;
  flex-shrink: 0;
}

/* ---------- workflow sequence (genuine steps — numbering is earned here) ---------- */

.sequence {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  position: relative;
}

@media (max-width: 900px) {
  .sequence { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .sequence { grid-template-columns: 1fr; }
}

.step {
  border: var(--bw) solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 22px 20px;
  position: relative;
}

.step .num {
  font-weight: 700;
  color: var(--text-tertiary);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  margin-bottom: 14px;
  transition: color 0.4s ease;
}

.step.on .num { color: var(--accent); }

.step h3 {
  font-size: 1rem;
  margin: 0 0 10px;
  letter-spacing: 0.01em;
}

.step p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
}

.step-track {
  position: relative;
  height: 2px;
  background: var(--border);
  margin-bottom: 28px;
  overflow: hidden;
}
.step-track .fill {
  position: absolute;
  inset: 0;
  width: 0%;
  background: var(--accent);
  transition: width 0.5s ease;
}

/* ---------- feature grid (trust / capability panels) ---------- */

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 720px) { .grid-2 { grid-template-columns: 1fr; } }

.feature h3 {
  display: flex; align-items: center; gap: 10px;
  font-size: 1.05rem; margin: 0 0 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: var(--radius-sm);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #14140f;
}
.badge-keep { background: var(--green); }
.badge-cut { background: var(--fixed-orange); }
.badge-fix { background: var(--yellow); }
.badge-alt { background: var(--blue); color: #0b1220; }

.feature p { color: var(--text-secondary); font-size: 0.92rem; line-height: 1.65; margin: 0; }

/* ---------- jog dial ---------- */

.dial-section { display: grid; grid-template-columns: 0.8fr 1.2fr; gap: var(--gutter); align-items: center; }
@media (max-width: 860px) { .dial-section { grid-template-columns: 1fr; } }

.dial-wrap { display: flex; justify-content: center; }

.dial {
  --size: 220px;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  border: var(--bw) solid var(--ink);
  background: var(--surface);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  cursor: grab;
  user-select: none;
}
.dial:active { cursor: grabbing; }

/* the ring waveform (FileWaveform.tsx) — an actual amplitude trace bent into
   a circle, not a clock-style tick pattern. Bars are drawn by main.js. */
.dial .ring { position: absolute; inset: 0; pointer-events: none; }
.dial .ring line { transition: stroke 0.08s linear; }

/* Rotor pivots on the dial's own center (its default transform-origin,
   since it's sized to exactly cover the dial) — same structure as the app's
   Animated.View wrapper around indicatorLine, so the needle rotates around
   the dial's center even though it doesn't visually reach that far down. */
.dial .needle-rotor {
  position: absolute;
  inset: 0;
  transform: rotate(0deg);
}
.dial .needle {
  position: absolute;
  top: 4px;
  left: 50%;
  width: 2px;
  height: calc(50% - 40px);
  background: var(--accent);
  transform: translateX(-50%);
  z-index: 1;
}

.dial .hub {
  width: 76px; height: 76px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: background-color 0.35s ease;
}
.dial .hub svg { display: block; }

.dial-readout {
  margin-top: 18px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.dial-readout b { color: var(--ink); font-weight: 700; }

.dial-copy h2 { margin-top: 0; }

/* linear interactive waveform (LinearWaveform.tsx) — same top/bottom trace
   from a center line, lit up to the playhead, drag anywhere to seek. Shares
   its "progress" with the dial above. */
.linear-wave {
  width: 100%;
  height: 64px;
  margin-top: 20px;
  cursor: pointer;
  touch-action: none;
}
.linear-wave rect.bar { transition: fill 0.08s linear; }

/* ---------- screenshots ---------- */

.shots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
@media (max-width: 760px) { .shots { grid-template-columns: 1fr; max-width: 340px; margin: 0 auto; } }

.shot {
  border: var(--bw) solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: var(--surface);
}
.shot img { width: 100%; display: block; }
.shot figcaption {
  padding: 12px 14px;
  font-size: 0.78rem;
  color: var(--text-tertiary);
  border-top: 1px solid var(--border);
}

/* ---------- spec sheet ---------- */

.spec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.spec-table tr { border-bottom: 1px solid var(--border); }
.spec-table tr:last-child { border-bottom: none; }
.spec-table td { padding: 14px 0; }
.spec-table td:first-child {
  color: var(--text-tertiary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.72rem;
  width: 38%;
  vertical-align: top;
  padding-top: 16px;
}
.spec-table td:last-child { color: var(--text); }

/* ---------- footer ---------- */

.site-footer { padding: 40px 0; }
.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}
.site-footer .legal { color: var(--text-tertiary); font-size: 0.78rem; }
.site-footer .links { display: flex; gap: 18px; }
.site-footer .links a { color: var(--text-secondary); font-size: 0.8rem; }
.site-footer .links a:hover { color: var(--accent); }

/* ---------- legal pages (privacy / terms) ---------- */

.legal-page h1 { font-size: clamp(1.8rem, 4vw, 2.4rem); margin-bottom: 6px; }
.legal-page .updated { color: var(--text-tertiary); font-size: 0.8rem; margin-bottom: 44px; }
.legal-page h2 {
  font-size: 1.05rem;
  margin: 40px 0 14px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.legal-page section h2:first-of-type,
.legal-page > .wrap > h2:first-of-type { border-top: none; padding-top: 0; }
.legal-page p, .legal-page li { color: var(--text-secondary); font-size: 0.95rem; line-height: 1.75; max-width: min(72ch, 100%); }
.legal-page ul { padding-left: 1.2em; }
.legal-page strong { color: var(--text); }
.legal-page .callout {
  border: var(--bw) solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin: 20px 0;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

/* ---------- support page ---------- */

.contact-card {
  border: var(--bw) solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 28px;
  background: var(--surface);
  margin-bottom: 40px;
}
.contact-card .label { margin-bottom: 10px; }
.contact-card a.email {
  display: block;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--ink);
  overflow-wrap: break-word;
  word-break: break-word;
}
@media (max-width: 460px) {
  .contact-card a.email { font-size: 1.05rem; }
}
.contact-card a.email:hover { color: var(--accent); }

.faq-item { border-bottom: 1px solid var(--border); padding: 20px 0; }
.faq-item:last-child { border-bottom: none; }
.faq-item h3 { font-size: 0.98rem; margin: 0 0 8px; }
.faq-item p { margin: 0; color: var(--text-secondary); font-size: 0.9rem; line-height: 1.65; }

/* ---------- simple page hero (privacy/terms/support) ---------- */

.page-hero { padding: 48px 0 8px; }
