@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&display=swap');

/* ============================================================
   Design tokens — the same ink-on-paper chassis as the app.
   One fixed base palette; the accent is the only thing that
   changes when a visitor picks a theme swatch.
   ============================================================ */
:root {
  --paper: #f3ede0;
  --paper-surface: #eae1cb;
  --paper-elevated: #e2d8bf;
  --ink: #211d16;
  --ink-muted: #6f6552;
  --ink-faint: #a89d84;
  --hairline: #cbbf9f;
  --card-border: #b9ac89;

  --accent: #bf3a26;      /* Ember, default */
  --accent-ink: #ffffff;  /* text color that sits on the accent fill */

  --font-main: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --radius-card: 5px;
  --radius-sm: 3px;
  --radius-pill: 999px;

  --shadow-soft: 0 1px 2px rgba(33, 29, 22, 0.06), 0 8px 24px -12px rgba(33, 29, 22, 0.18);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Theme swatches — swap the single accent, everything else holds still */
[data-theme='ember']  { --accent: #bf3a26; }
[data-theme='cobalt']  { --accent: #2e4a8f; }
[data-theme='moss']    { --accent: #4f6b3a; }
[data-theme='ochre']   { --accent: #b8862b; --accent-ink: #211d16; }
[data-theme='plum']    { --accent: #6e3a5c; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-main);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  transition: background-color 0.4s var(--ease);
}

img, svg { max-width: 100%; display: block; }
a { color: inherit; }

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

section { position: relative; }

/* ---------- Type ---------- */
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: clamp(2.4rem, 5vw, 4rem); line-height: 1.04; letter-spacing: -0.02em; }
h2 { font-size: clamp(1.7rem, 3vw, 2.4rem); line-height: 1.1; }
h3 { font-size: 1.15rem; }
p { margin: 0; color: var(--ink-muted); }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  text-transform: none;
}
.eyebrow::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  transition: background-color 0.4s var(--ease);
}
.lede { font-size: 1.1rem; max-width: 46ch; }

/* ---------- Buttons ---------- */
.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-main);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 13px 22px;
  border-radius: var(--radius-pill);
  transition: transform 0.2s var(--ease), background-color 0.3s var(--ease), border-color 0.3s var(--ease), color 0.3s var(--ease);
  text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--ink);
  color: var(--paper);
}
.btn-primary:hover { background: var(--accent); }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--hairline);
}
.btn-ghost:hover { border-color: var(--ink); }
.btn-disabled {
  background: var(--paper-surface);
  color: var(--ink-faint);
  border: 1px dashed var(--card-border);
  cursor: default;
}
.btn-disabled:hover { background: var(--paper-surface); }
.btn-sm { padding: 8px 16px; font-size: 0.82rem; }

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(243, 237, 224, 0.86);
  backdrop-filter: blur(10px) saturate(1.1);
  -webkit-backdrop-filter: blur(10px) saturate(1.1);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease);
}
.nav.is-scrolled { border-color: var(--hairline); }
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  max-width: 1120px;
  margin: 0 auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
  font-size: 1.05rem;
}
.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  flex-shrink: 0;
  display: block;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-links a {
  display: inline-block;
  text-decoration: none;
  color: var(--ink-muted);
  font-size: 0.92rem;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  position: relative;
  transition: color 0.2s var(--ease), background-color 0.2s var(--ease);
}
.nav-links a:hover { color: var(--ink); background: var(--paper-surface); }
.nav-links a.active { color: var(--ink); font-weight: 600; }
.nav-links a.active::after {
  content: '';
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 2px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}
.nav-cta { display: flex; align-items: center; gap: 10px; }
.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  width: 40px;
  height: 40px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
.nav-toggle-icon { position: relative; width: 18px; height: 12px; }
.nav-toggle-icon span,
.nav-toggle-icon::before,
.nav-toggle-icon::after {
  content: '';
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--ink);
  border-radius: 1px;
  transition: transform 0.25s var(--ease), opacity 0.25s var(--ease);
}
.nav-toggle-icon::before { top: 0; }
.nav-toggle-icon span { top: 5px; }
.nav-toggle-icon::after { top: 10px; }
.nav.is-open .nav-toggle-icon::before { transform: translateY(5px) rotate(45deg); }
.nav.is-open .nav-toggle-icon::after { transform: translateY(-5px) rotate(-45deg); }
.nav.is-open .nav-toggle-icon span { opacity: 0; }

@media (max-width: 780px) {
  .nav-toggle { display: flex; }
  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--hairline);
    padding: 8px 16px 16px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s var(--ease);
  }
  .nav.is-open .nav-links { max-height: 400px; }
  .nav-links a { padding: 12px 10px; }
  .nav-links a.active::after { display: none; }
  .nav-cta .btn-ghost { display: none; }
  .nav-cta { margin-right: 12px; }
}

/* ---------- Reveal-on-scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.reveal.is-visible { opacity: 1; transform: translateY(0); }
.reveal-stagger.is-visible > * { transition-delay: calc(var(--i, 0) * 70ms); }

/* ---------- Hero ---------- */
.hero {
  padding: 64px 0 40px;
  overflow: hidden;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 56px;
  align-items: center;
}
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: 40px; }
}
.hero-copy h1 { margin: 14px 0 18px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.hero-stats { display: flex; gap: 28px; margin-top: 40px; flex-wrap: wrap; }
.hero-stat strong { display: block; font-size: 1.5rem; font-weight: 700; }
.hero-stat span { font-size: 0.82rem; color: var(--ink-muted); }

/* Phone chassis for the demo */
.phone {
  background: var(--paper-surface);
  border: 1px solid var(--card-border);
  border-radius: 28px;
  padding: 18px;
  box-shadow: var(--shadow-soft);
  max-width: 380px;
  margin: 0 auto;
}
.phone-screen {
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: 18px;
  padding: 16px;
}
.phone-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.phone-title { font-weight: 700; font-size: 0.95rem; }
.phone-title small { display: block; font-weight: 500; color: var(--ink-muted); font-size: 0.68rem; letter-spacing: 0.03em; }
.bpm-pill {
  display: flex;
  align-items: baseline;
  gap: 4px;
  background: var(--paper-surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-pill);
  padding: 6px 12px;
}
.bpm-pill strong { font-size: 1rem; }
.bpm-pill span { font-size: 0.62rem; color: var(--ink-muted); }

.track-rows { display: flex; flex-direction: column; gap: 7px; margin: 12px 0; }
.track-row { display: grid; grid-template-columns: 52px 1fr; align-items: center; gap: 8px; }
.track-label { font-size: 0.66rem; font-weight: 600; color: var(--ink-muted); letter-spacing: 0.02em; }
.step-lane { display: grid; grid-template-columns: repeat(16, 1fr); gap: 4px; }
.step {
  aspect-ratio: 1;
  border-radius: 3px;
  background: var(--paper-elevated);
  border: 1px solid var(--hairline);
  cursor: pointer;
  padding: 0;
  transition: background-color 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}
.step:hover { border-color: var(--ink-faint); }
.step.is-on { background: var(--ink); border-color: var(--ink); }
.step.is-current { transform: scale(1.18); }
.step.is-current.is-on { background: var(--accent); border-color: var(--accent); }
.step.is-current:not(.is-on) { border-color: var(--accent); }
.step:nth-child(4n+1) { box-shadow: inset 0 0 0 1px rgba(33,29,22,0.05); }

.transport {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--hairline);
}
.transport-play {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.4s var(--ease), transform 0.15s ease;
}
.transport-play:active { transform: scale(0.92); }
.transport-icon-play, .transport-icon-pause { display: none; }
.is-playing .transport-icon-play { display: none; }
.is-playing .transport-icon-pause { display: block; }
.transport:not(.is-playing) .transport-icon-play { display: block; }
.transport small {
  flex-shrink: 0;
  font-size: 0.66rem;
  color: var(--ink-muted);
  width: 56px;
}
.range {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: var(--hairline);
  outline: none;
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--ink);
  cursor: pointer;
  transition: background-color 0.4s var(--ease);
}
.range::-moz-range-thumb {
  width: 15px; height: 15px; border-radius: 50%; border: none;
  background: var(--ink); cursor: pointer;
}
.demo-actions { display: flex; gap: 8px; margin-top: 12px; }
.demo-hint { font-size: 0.72rem; color: var(--ink-faint); margin-top: 10px; text-align: center; }

/* ---------- Section headers ---------- */
.section {
  padding: 88px 0;
  border-top: 1px solid var(--hairline);
}
.section-head {
  max-width: 640px;
  margin: 0 auto 48px;
  text-align: center;
}
.section-head h2 { margin: 12px 0 14px; }
.section-head.left { margin-left: 0; text-align: left; }

/* ---------- Feature cards ---------- */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
@media (max-width: 900px) { .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .grid-3, .grid-2 { grid-template-columns: 1fr; } }

.card {
  background: var(--paper-surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  padding: 26px;
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.card:hover { transform: translateY(-3px); border-color: var(--card-border); box-shadow: var(--shadow-soft); }
.card-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: var(--paper);
  border: 1px solid var(--hairline);
  display: grid;
  place-items: center;
  margin-bottom: 16px;
  color: var(--accent);
  transition: color 0.4s var(--ease);
}
.card h3 { margin-bottom: 8px; }
.card p { font-size: 0.92rem; }

/* ---------- Theme swatch section ---------- */
.swatches {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 32px 0;
}
.swatch {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  position: relative;
  transition: transform 0.2s var(--ease), border-color 0.2s var(--ease);
}
.swatch:hover { transform: translateY(-3px); }
.swatch.is-active { border-color: var(--ink); }
.swatch.is-active::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 0.9rem;
}
.swatch-ember { background: #bf3a26; }
.swatch-cobalt { background: #2e4a8f; }
.swatch-moss { background: #4f6b3a; }
.swatch-ochre { background: #b8862b; }
.swatch-plum { background: #6e3a5c; }
.swatch-label { text-align: center; font-size: 0.82rem; color: var(--ink-muted); margin-top: -18px; }

/* ---------- CTA band ---------- */
.cta-band {
  background: var(--ink);
  color: var(--paper);
  border-radius: 20px;
  padding: 56px;
  text-align: center;
}
.cta-band h2 { color: var(--paper); }
.cta-band p { color: var(--paper-elevated); margin: 12px auto 28px; }
.cta-band .btn-primary { background: var(--accent); color: var(--accent-ink); }
.cta-band .btn-primary:hover { background: var(--paper); color: var(--ink); }
.cta-band .btn-ghost { border-color: rgba(243,237,224,0.35); color: var(--paper); }
.cta-band .btn-ghost:hover { border-color: var(--paper); }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--hairline); padding: 48px 0 32px; }
.footer-grid { display: flex; justify-content: space-between; gap: 32px; flex-wrap: wrap; }
.footer-cols { display: flex; gap: 56px; flex-wrap: wrap; }
.footer-col h4 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-faint); margin-bottom: 14px; }
.footer-col a {
  display: block;
  text-decoration: none;
  color: var(--ink-muted);
  font-size: 0.92rem;
  margin-bottom: 10px;
  transition: color 0.2s ease;
}
.footer-col a:hover { color: var(--ink); }
.footer-bottom {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--hairline);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--ink-faint);
}
@media (max-width: 620px) { .footer-grid { flex-direction: column; } }

/* ---------- Back to top ---------- */
.to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  border: none;
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease), background-color 0.4s var(--ease);
  z-index: 40;
}
.to-top.is-visible { opacity: 1; pointer-events: auto; transform: translateY(0); }
.to-top:hover { background: var(--accent); }

/* ---------- Legal pages ---------- */
.legal-hero { padding: 56px 0 20px; }
.legal-updated {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--ink-muted);
  background: var(--paper-surface);
  border: 1px solid var(--hairline);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  margin-top: 16px;
}
.legal-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 48px;
  align-items: start;
  padding: 20px 0 100px;
}
.legal-toc {
  position: sticky;
  top: 90px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.legal-toc a {
  text-decoration: none;
  color: var(--ink-muted);
  font-size: 0.86rem;
  padding: 7px 10px;
  border-left: 2px solid var(--hairline);
  transition: color 0.2s ease, border-color 0.2s ease;
}
.legal-toc a:hover { color: var(--ink); }
.legal-toc a.active { color: var(--ink); font-weight: 600; border-color: var(--accent); }
@media (max-width: 860px) { .legal-layout { grid-template-columns: 1fr; } .legal-toc { display: none; } }

.legal-body h2 {
  font-size: 1.3rem;
  margin-top: 44px;
  margin-bottom: 14px;
  scroll-margin-top: 90px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.legal-body h2:first-child { margin-top: 0; }
.legal-body p, .legal-body li { color: var(--ink-muted); font-size: 0.98rem; margin-bottom: 12px; }
.legal-body ul { padding-left: 20px; margin: 0 0 16px; }
.legal-body strong { color: var(--ink); }
.legal-callout {
  background: var(--paper-surface);
  border: 1px solid var(--hairline);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  margin: 18px 0;
  font-size: 0.92rem;
}
.legal-callout p { margin: 0; color: var(--ink); }
.perm-table { width: 100%; border-collapse: collapse; margin: 10px 0 20px; font-size: 0.9rem; }
.perm-table th, .perm-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--hairline); vertical-align: top; }
.perm-table th { color: var(--ink-faint); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.perm-table td { color: var(--ink-muted); }
.perm-table td:first-child { color: var(--ink); font-weight: 600; white-space: nowrap; }

/* ---------- Accordion (FAQ) ---------- */
.accordion { border-top: 1px solid var(--hairline); max-width: 760px; margin: 0 auto; }
.accordion-item { border-bottom: 1px solid var(--hairline); }
.accordion-trigger {
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  font-family: var(--font-main);
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  padding: 20px 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  gap: 16px;
}
.accordion-plus { position: relative; width: 16px; height: 16px; flex-shrink: 0; }
.accordion-plus::before, .accordion-plus::after {
  content: '';
  position: absolute;
  background: var(--ink);
  transition: transform 0.3s var(--ease);
}
.accordion-plus::before { top: 50%; left: 0; width: 100%; height: 2px; transform: translateY(-50%); }
.accordion-plus::after { left: 50%; top: 0; height: 100%; width: 2px; transform: translateX(-50%); }
.accordion-item.is-open .accordion-plus::after { transform: translateX(-50%) rotate(90deg); opacity: 0; }
.accordion-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s var(--ease);
}
.accordion-panel p { padding: 0 4px 20px; font-size: 0.94rem; }

/* ---------- Feature page detail rows ---------- */
.detail-row {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 48px;
  align-items: center;
  padding: 64px 0;
  border-top: 1px solid var(--hairline);
}
.detail-row:first-of-type { border-top: none; }
.detail-row.flip { direction: rtl; }
.detail-row.flip > * { direction: ltr; }
@media (max-width: 860px) { .detail-row, .detail-row.flip { grid-template-columns: 1fr; direction: ltr; } }
.detail-copy .eyebrow { margin-bottom: 10px; }
.detail-copy h2 { margin-bottom: 14px; }
.detail-list { list-style: none; padding: 0; margin: 20px 0 0; display: flex; flex-direction: column; gap: 10px; }
.detail-list li { display: flex; gap: 10px; font-size: 0.94rem; color: var(--ink); align-items: flex-start; }
.detail-list li::before { content: ''; width: 6px; height: 6px; margin-top: 7px; border-radius: 50%; background: var(--accent); flex-shrink: 0; transition: background-color 0.4s var(--ease); }

.visual-panel {
  background: var(--paper-surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  padding: 28px;
  min-height: 220px;
}
.pad-mini-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pad-mini { aspect-ratio: 1; background: var(--paper); border: 1px solid var(--hairline); border-radius: 6px; display: grid; place-items: end; padding: 6px; font-size: 0.62rem; color: var(--ink-muted); font-weight: 600; }
.pad-mini.is-lit { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.scale-keys { display: flex; gap: 4px; align-items: flex-end; height: 120px; }
.scale-key { flex: 1; background: var(--paper); border: 1px solid var(--hairline); border-radius: 4px 4px 2px 2px; }
.scale-key.is-active { background: var(--accent); border-color: var(--accent); }
.dial-visual { width: 130px; height: 130px; border-radius: 50%; border: 1px solid var(--card-border); margin: 0 auto; display: grid; place-items: center; background: var(--paper); position: relative; }
.dial-visual::before { content: ''; position: absolute; inset: 10px; border-radius: 50%; border: 1px dashed var(--hairline); }
.dial-needle { width: 3px; height: 46px; background: var(--accent); border-radius: 2px; transform-origin: bottom center; }

.badge-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.badge {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink-muted);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-pill);
  padding: 5px 12px;
  background: var(--paper);
}

/* ---------- Feature grid mini icons page top ---------- */
.hero-narrow { max-width: 720px; margin: 0 auto; text-align: center; }
.hero-narrow p { margin: 14px auto 0; }
