/* ==========================================================================
   Patchwork Instruments — patchworkinstruments.com
   Built on brand tokens (tokens.css). Dark theme is the identity surface.
   Oxide discipline: 1-in-91. It appears on CTAs and nowhere else.
   ========================================================================== */

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--pi-bg);
  color: var(--pi-fg);
  font-family: var(--pi-font-body);
  font-size: var(--pi-text-md);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

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

/* ---------- type helpers ---------- */

.eyebrow {
  font-family: var(--pi-font-display);
  font-size: var(--pi-text-xs);
  font-weight: 500;
  letter-spacing: var(--pi-track-eyebrow);
  text-transform: uppercase;
  color: var(--pi-fg-subtle);
  margin-bottom: var(--pi-space-5);
}

h1, h2 {
  font-family: var(--pi-font-display);
  font-weight: 500;
  letter-spacing: var(--pi-track-tight);
  text-transform: lowercase;
  line-height: 1.08;
}

h1 { font-size: clamp(38px, 5.6vw, 74px); white-space: nowrap; }
@media (max-width: 500px) { h1 { white-space: normal; } }
h2 { font-size: clamp(28px, 4vw, 48px); }
h3 {
  font-family: var(--pi-font-display);
  font-weight: 500;
  font-size: var(--pi-text-lg);
  text-transform: lowercase;
  letter-spacing: var(--pi-track-tight);
}

.tagline {
  font-family: var(--pi-font-tag);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(20px, 2.6vw, 30px);
  color: var(--pi-fg-muted);
  margin: var(--pi-space-5) 0;
}

.mono-hint {
  font-family: var(--pi-font-display);
  font-size: var(--pi-text-xs);
  letter-spacing: 0.08em;
  color: var(--pi-fg-subtle);
}

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

.btn {
  display: inline-block;
  font-family: var(--pi-font-display);
  font-size: var(--pi-text-sm);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-decoration: none;
  padding: 13px 26px;
  border-radius: var(--pi-radius-md);
  border: 1px solid transparent;
  transition: transform .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease;
  cursor: pointer;
}
.btn:active { transform: translateY(1px); }

.btn-oxide {
  background: var(--pi-oxide);
  color: var(--pi-bone);
}
.btn-oxide:hover {
  background: #c8471f;
  box-shadow: 0 6px 30px rgba(179, 58, 26, 0.35);
}

/* Kickstarter CTAs wear Kickstarter's own green — instantly recognisable. */
.btn-ks {
  background: #05ce78;
  color: #0E0E10;
}
.btn-ks:hover {
  background: #04e483;
  box-shadow: 0 6px 30px rgba(5, 206, 120, 0.35);
}

.btn-ghost {
  background: transparent;
  color: var(--pi-fg);
  border-color: var(--pi-border-strong);
}
.btn-ghost:hover { border-color: var(--pi-bone); background: rgba(242, 239, 233, 0.04); }

.btn-lg { padding: 17px 36px; font-size: var(--pi-text-base); }

/* ---------- nav ---------- */

.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: var(--pi-space-8);
  padding: 14px clamp(20px, 4vw, 48px);
  background: rgba(14, 14, 16, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--pi-border);
}

.nav-brand img { height: 42px; width: auto; }

.nav-links {
  display: flex;
  gap: var(--pi-space-6);
  margin-left: auto;
}
.nav-links a {
  font-family: var(--pi-font-display);
  font-size: var(--pi-text-xs);
  font-weight: 500;
  letter-spacing: var(--pi-track-eyebrow);
  text-transform: uppercase;
  text-decoration: none;
  color: var(--pi-fg-subtle);
  transition: color .18s ease;
}
.nav-links a:hover { color: var(--pi-fg); }

.nav-cta { padding: 9px 18px; font-size: var(--pi-text-xs); }

@media (max-width: 760px) {
  .nav-links { display: none; }
  .nav-cta { margin-left: auto; }
}

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

.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding-top: 96px; /* clear the fixed nav */
}

#hero-sim {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.hero-scrim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to right, rgba(14,14,16,0.88) 0%, rgba(14,14,16,0.45) 42%, rgba(14,14,16,0) 68%),
    linear-gradient(to top, rgba(14,14,16,0.92) 0%, rgba(14,14,16,0) 36%);
}

.hero-copy {
  position: relative;
  z-index: 2;
  max-width: 720px;
  padding: 0 clamp(20px, 4vw, 48px);
  margin-bottom: var(--pi-space-10);
  pointer-events: none;
}
.hero-copy .btn, .hero-copy a { pointer-events: auto; }

.hero-sub {
  max-width: 540px;
  color: var(--pi-fg-muted);
  margin-bottom: var(--pi-space-6);
}

.hero-ctas { display: flex; flex-wrap: wrap; gap: var(--pi-space-3); }
.hero-note { margin-top: var(--pi-space-4); }

.hero-foot {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(20px, 4vw, 48px) var(--pi-space-5);
}

.sound-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--pi-font-display);
  font-size: var(--pi-text-sm);
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--pi-fg-muted);
  background: rgba(21, 21, 26, 0.85);
  border: 1px solid var(--pi-border-strong);
  border-radius: 999px;
  padding: 12px 22px;
  cursor: pointer;
  transition: color .18s ease, border-color .18s ease;
  white-space: nowrap;
}
.sound-pill[aria-pressed="true"] {
  border-color: var(--pi-amber);
}
.sound-pill:hover { color: var(--pi-fg); border-color: var(--pi-border-strong); }
.sound-pill .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--pi-muted);
  transition: background .18s ease, box-shadow .18s ease;
}
.sound-pill[aria-pressed="true"] .dot {
  background: var(--pi-amber);
  box-shadow: 0 0 8px var(--pi-amber);
}
.sound-pill[aria-pressed="true"] { color: var(--pi-fg); }

/* ---------- sections ---------- */

.section {
  max-width: 1160px;
  margin: 0 auto;
  padding: clamp(72px, 10vw, 140px) clamp(20px, 4vw, 48px);
  border-top: 1px solid var(--pi-ink-3);
}

.section-head { margin-bottom: clamp(40px, 6vw, 72px); }
.section-head h2 { max-width: 720px; }

.center { text-align: center; margin-top: var(--pi-space-8); }

/* ---------- cards (01) ---------- */

.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--pi-space-4);
}
@media (max-width: 860px) { .cards { grid-template-columns: 1fr; } }

.card {
  background: var(--pi-surface);
  border: 1px solid var(--pi-border);
  border-radius: var(--pi-radius-lg);
  padding: var(--pi-space-6);
}
.card-glyph {
  width: 48px; height: 48px;
  color: var(--pi-amber);
  margin-bottom: var(--pi-space-5);
  opacity: 0.9;
}
.card h3 { margin-bottom: var(--pi-space-3); }
.card p { color: var(--pi-fg-muted); font-size: var(--pi-text-base); }

/* ---------- instrument (02) ---------- */

.split {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: clamp(24px, 4vw, 64px);
  align-items: center;
  margin-bottom: clamp(48px, 7vw, 96px);
}
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }

.photo-frame {
  border-radius: var(--pi-radius-lg);
  overflow: hidden;
  border: 1px solid var(--pi-border);
  background: var(--pi-surface);
}
.photo-frame img { width: 100%; height: auto; }

.specs { display: flex; flex-direction: column; }
.spec-row {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: var(--pi-space-4);
  padding: 14px 0;
  border-bottom: 1px solid var(--pi-ink-3);
  font-size: var(--pi-text-base);
}
.spec-row:first-child { border-top: 1px solid var(--pi-ink-3); }
.spec-k {
  font-family: var(--pi-font-display);
  font-size: var(--pi-text-xs);
  font-weight: 500;
  letter-spacing: var(--pi-track-eyebrow);
  text-transform: uppercase;
  color: var(--pi-fg-subtle);
  padding-top: 3px;
}
.spec-v { color: var(--pi-fg-muted); }

.wide-photo {
  border-radius: var(--pi-radius-lg);
  overflow: hidden;
  border: 1px solid var(--pi-border);
}
.wide-photo img { width: 100%; height: auto; }
.wide-photo figcaption {
  padding: 12px 16px;
  background: var(--pi-surface);
  border-top: 1px solid var(--pi-border);
}

/* ---------- anatomy (03) — pinned, scroll-scrubbed exploded CAD ---------- */

.anatomy {
  position: relative;
  height: 320vh;                 /* scroll runway; the inner block pins */
  border-top: 1px solid var(--pi-ink-3);
}

.anatomy-sticky {
  position: sticky;
  top: 0;
  height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 96px clamp(20px, 4vw, 48px) 24px;
  overflow: hidden;
}

.anatomy-head { text-align: center; margin-bottom: var(--pi-space-4); }
.anatomy-head h2 { max-width: none; }

.anatomy-stage {
  position: relative;
  flex: 1;
  width: min(920px, 100%);
  min-height: 0;
}
#anatomy-canvas { width: 100%; height: 100%; display: block; }

.anatomy-label {
  position: absolute;
  font-family: var(--pi-font-display);
  font-size: var(--pi-text-sm);
  color: var(--pi-fg-subtle);
  letter-spacing: 0.04em;
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity .5s ease, transform .5s ease;
  pointer-events: none;
  max-width: 300px;
}
.anatomy-label span { color: var(--pi-amber); }
.anatomy-label.on { opacity: 1; transform: none; }
.lbl-top { top: 8%;  right: 4%; }
.lbl-mid { top: 46%; left: 2%; }
.lbl-bot { bottom: 10%; right: 6%; }

.anatomy-hint { padding-bottom: var(--pi-space-3); }

.anatomy.no-webgl { height: auto; }
.anatomy.no-webgl .anatomy-sticky { position: static; height: auto; }
.anatomy.no-webgl .anatomy-stage { display: none; }

@media (max-width: 700px) {
  .anatomy { height: 260vh; }
  .anatomy-label { font-size: var(--pi-text-xs); max-width: 200px; }
}

@media (prefers-reduced-motion: reduce) {
  .anatomy { height: auto; }
  .anatomy-sticky { position: static; height: 90svh; }
}

/* ---------- control panel (04) ---------- */

.browser-frame {
  border: 1px solid var(--pi-border-strong);
  border-radius: var(--pi-radius-lg);
  overflow: hidden;
  background: var(--pi-surface);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  margin-bottom: clamp(32px, 5vw, 64px);
}
.browser-chrome {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 11px 16px;
  background: var(--pi-ink-3);
  border-bottom: 1px solid var(--pi-border);
}
.bdot { width: 10px; height: 10px; border-radius: 50%; background: var(--pi-muted); opacity: .45; }
.burl {
  font-family: var(--pi-font-display);
  font-size: var(--pi-text-xs);
  letter-spacing: 0.05em;
  color: var(--pi-fg-subtle);
  margin-left: var(--pi-space-4);
}
.browser-frame > img { width: 100%; height: auto; }

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--pi-ink-3);
  border: 1px solid var(--pi-ink-3);
  border-radius: var(--pi-radius-lg);
  overflow: hidden;
}
@media (max-width: 860px) { .feature-grid { grid-template-columns: 1fr; } }

.feature {
  background: var(--pi-bg);
  padding: var(--pi-space-5) var(--pi-space-5);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.f-k {
  font-family: var(--pi-font-display);
  font-weight: 500;
  font-size: var(--pi-text-sm);
  letter-spacing: 0.06em;
  color: var(--pi-fg);
}
.f-v { font-size: var(--pi-text-sm); color: var(--pi-fg-subtle); }

/* ---------- story (04) ---------- */

.story-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: clamp(24px, 4vw, 64px);
  align-items: start;
  margin-bottom: clamp(48px, 7vw, 96px);
}
@media (max-width: 860px) { .story-grid { grid-template-columns: 1fr; } }

.story-copy h2 { margin-bottom: var(--pi-space-6); }
.story-copy p { color: var(--pi-fg-muted); margin-bottom: var(--pi-space-5); max-width: 560px; }
.story-copy em { color: var(--pi-fg); font-style: italic; }

.signature {
  font-family: var(--pi-font-display);
  font-size: var(--pi-text-sm);
  letter-spacing: 0.06em;
  color: var(--pi-fg-subtle);
}

.story-photo {
  border-radius: var(--pi-radius-lg);
  overflow: hidden;
  border: 1px solid var(--pi-border);
}
.story-photo figcaption {
  padding: 12px 16px;
  background: var(--pi-surface);
  border-top: 1px solid var(--pi-border);
}

/* ---------- kickstarter (05) ---------- */

.ks {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.ks-mark { margin-bottom: var(--pi-space-6); }
.ks h2 { margin-bottom: var(--pi-space-5); }
.ks-sub {
  max-width: 560px;
  color: var(--pi-fg-muted);
  margin-bottom: var(--pi-space-6);
}
.ks .mono-hint { margin-top: var(--pi-space-5); }

/* ---------- faq ---------- */

.faq-list { max-width: 760px; }
.faq-list details {
  border-bottom: 1px solid var(--pi-ink-3);
}
.faq-list details:first-child { border-top: 1px solid var(--pi-ink-3); }
.faq-list summary {
  font-family: var(--pi-font-display);
  font-weight: 500;
  font-size: var(--pi-text-base);
  padding: var(--pi-space-5) 0;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--pi-space-4);
  color: var(--pi-fg-muted);
  transition: color .18s ease;
}
.faq-list summary:hover { color: var(--pi-fg); }
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after {
  content: "+";
  font-family: var(--pi-font-display);
  color: var(--pi-fg-subtle);
  transition: transform .2s ease;
}
.faq-list details[open] summary { color: var(--pi-fg); }
.faq-list details[open] summary::after { transform: rotate(45deg); }
.faq-list details p {
  color: var(--pi-fg-muted);
  font-size: var(--pi-text-base);
  padding: 0 0 var(--pi-space-5);
  max-width: 640px;
}

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

.footer {
  border-top: 1px solid var(--pi-ink-3);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--pi-space-6);
  padding: clamp(56px, 8vw, 96px) clamp(20px, 4vw, 48px);
  text-align: center;
}
.footer-links { display: flex; flex-wrap: wrap; gap: var(--pi-space-6); justify-content: center; }
.footer-links a {
  font-family: var(--pi-font-display);
  font-size: var(--pi-text-xs);
  font-weight: 500;
  letter-spacing: var(--pi-track-eyebrow);
  text-transform: uppercase;
  text-decoration: none;
  color: var(--pi-fg-subtle);
  transition: color .18s ease;
}
.footer-links a:hover { color: var(--pi-fg); }

/* ---------- reveal on scroll ---------- */

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .7s cubic-bezier(.2,.6,.2,1), transform .7s cubic-bezier(.2,.6,.2,1);
}
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
}
