/* Chopmatic — the house neubrutalist system (hard borders, offset shadows,
   IBM Plex) wearing the app's own panel from lib/ui/theme.dart. Colour names
   match Tone.* in the app so the two stay in step; --ground is the icon's
   blue, which the app itself does not use. */
:root {
  --ground: #c5dbee;      /* the icon's ground */
  --panel: #c6ccc8;       /* Tone.panel — the faceplate */
  --plate: #d8dcd7;       /* Tone.plate — a raised sub-plate */
  --well: #17110f;        /* Tone.well — the one dark area */
  --ink: #12100f;         /* Tone.ink */
  --ink-soft: #5c615e;    /* Tone.inkSoft */
  --cream: #f0ebdc;       /* Tone.cream — writing on the well */
  --well-text: rgba(240, 235, 220, 0.6); /* Tone.wellText */
  --lamp-off: #3a3f3c;    /* Tone.lampOff — an unlit lamp */
  --phosphor: #ff3b30;    /* Tone.phosphor — the playhead */

  /* The zone palette. Colour is structural: each one means a part of the app. */
  --orange: #ef7b24;      /* CHOP — and the site's accent */
  --teal: #17a0ae;        /* SEQUENCE */
  --green: #2f9e5c;       /* SONG */
  --purple: #7b4cbe;      /* STEMS */
  --yellow: #f2c230;      /* MIDI */
  --red: #e0342b;         /* OUTPUT */
  --blue: #2a5fc4;        /* the major tabs */

  --border-thick: 3px solid var(--ink);
  --shadow-hard: 6px 6px 0px var(--ink);
  --shadow-hard-hover: 2px 2px 0px var(--ink);
  --radius: 4px;          /* the app's controls are hard-edged; keep corners small */
  --radius-lg: 8px;

  --font-mono: 'IBM Plex Mono', Menlo, monospace;
  --font-sans: 'IBM Plex Sans', sans-serif;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--ground);
  color: var(--ink);
  line-height: 1.6;
  overflow-x: hidden;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* Typography */
h1, h2, h3 { font-family: var(--font-sans); font-weight: 800; line-height: 1.1; }
h1 { font-size: clamp(2.5rem, 5vw, 4rem); margin-bottom: 24px; }
h2 { font-size: clamp(2rem, 4vw, 3rem); margin-bottom: 20px; }
h3 { font-size: 1.5rem; margin-bottom: 12px; }
p { font-size: 1.125rem; margin-bottom: 24px; opacity: 0.9; }

/* The app's engraved labels — chop modes, tabs, switches. */
.mono {
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* Components */
.neu-card {
  background: var(--plate);
  border: var(--border-thick);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hard);
  padding: 32px;
}

.neu-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: var(--orange);
  color: var(--ink);
  font-family: var(--font-sans);
  font-weight: 700;
  text-decoration: none;
  border: var(--border-thick);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hard);
  padding: 12px 24px;
  transition: all 0.1s ease;
  cursor: pointer;
}
.neu-btn:hover { transform: translate(4px, 4px); box-shadow: var(--shadow-hard-hover); }

/* Header — the well: cream lettering, orange links. */
.header {
  padding: 20px 0;
  border-bottom: 3px solid var(--orange);
  background: var(--well);
}
.header-inner { display: flex; justify-content: space-between; align-items: center; gap: 16px; }

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: 1px;
  color: var(--cream);
}
.logo-box { width: 32px; height: 32px; border-radius: 6px; }

.nav { display: flex; align-items: center; gap: 24px; }
.nav a, .nav button {
  color: var(--orange);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
  background: none;
  border: 0;
  cursor: pointer;
}
.nav a:hover, .nav button:hover { text-decoration: underline; }

@media (max-width: 640px) {
  .header-inner { flex-direction: column; align-items: flex-start; }
  .nav { gap: 16px; flex-wrap: wrap; }
}

/* Hero */
.hero { display: flex; flex-direction: column; gap: 48px; padding: 72px 24px; }
@media (min-width: 900px) {
  .hero { flex-direction: row; align-items: center; padding: 88px 24px 96px; }
}
.hero-content { flex: 1; }
.hero-title { font-size: clamp(2.5rem, 4.4vw, 3.5rem); max-width: 640px; }
.hero-subtitle { font-size: 1.25rem; max-width: 540px; }

.hero-image { flex: 1; display: flex; justify-content: center; width: 100%; }

/* The device: the app's faceplate, drawn in CSS — a dark well with the
   waveform and its cuts, over a plate of pads. */
.device {
  background: var(--panel);
  border: var(--border-thick);
  border-radius: var(--radius-lg);
  box-shadow: 16px 16px 0px rgba(18, 16, 15, 0.14);
  padding: 20px;
  width: 100%;
  max-width: 440px;
}
.device-label {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  background: var(--orange);
  color: var(--ink);
  padding: 2px 8px;
  margin-bottom: 10px;
}
.well {
  background: var(--well);
  border: 2px solid #080607;   /* Tone.wellEdge */
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 16px;
}
.well-readout {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 1px;
  color: var(--cream);
  text-transform: uppercase;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.well-readout span:last-child { color: var(--well-text); }

/* A waveform cut into slices: the bars, and an orange line at each cut. */
.waveform {
  position: relative;
  display: flex;
  align-items: center;
  gap: 3px;
  height: 72px;
}
.waveform i {
  flex: 1;
  background: var(--cream);
  opacity: 0.55;
  border-radius: 1px;
  display: block;
}
.waveform i.lit { opacity: 1; }
.waveform i.cut {
  flex: 0 0 2px;
  height: 100% !important;
  background: var(--orange);
  opacity: 1;
}
.waveform i.head {
  flex: 0 0 2px;
  height: 100% !important;
  background: var(--phosphor);
  opacity: 1;
}

.pad-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pad-grid div {
  aspect-ratio: 1;
  border-radius: 3px;
  background: var(--plate);
  border: 2px solid var(--ink);
  position: relative;
}
/* Each pad carries a lamp; unlit lamps stay visible, as in the app. */
.pad-grid div::after {
  content: "";
  position: absolute;
  top: 7px;
  left: 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--lamp-off);
}
.pad-grid div.on { background: var(--orange); }
.pad-grid div.on::after { background: var(--phosphor); }

/* Status strip — the well again: cream on near-black. */
.status-strip {
  background: var(--well);
  padding: 56px 0;
  border-top: 3px solid var(--orange);
}
.status-strip h2 { color: var(--cream); max-width: 760px; }
.status-strip p { color: var(--cream); opacity: 0.78; max-width: 680px; }
.status-strip p:last-child { margin-bottom: 0; }
.status-strip .section-kicker { color: var(--orange); opacity: 1; }

/* Features */
.features { padding: 88px 0; }
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 32px;
}
.feature-card p:last-child { margin-bottom: 0; }
.feature-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--panel);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.feature-icon .material-symbols-outlined { font-size: 26px; color: var(--ink); }
/* Zone colours, matching the app's tabs. */
.feature-icon.z-chop { background: var(--orange); }
.feature-icon.z-sequence { background: var(--teal); }
.feature-icon.z-song { background: var(--green); }
.feature-icon.z-stems { background: var(--purple); }
.feature-icon.z-midi { background: var(--yellow); }
.feature-icon.z-output { background: var(--red); }
.feature-icon.z-tabs { background: var(--blue); }
.feature-icon.z-sequence .material-symbols-outlined,
.feature-icon.z-song .material-symbols-outlined,
.feature-icon.z-stems .material-symbols-outlined,
.feature-icon.z-output .material-symbols-outlined,
.feature-icon.z-tabs .material-symbols-outlined { color: #fdfcf8; } /* Tone.onBlockLight */

/* Section headings */
.section-kicker {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ink);
  opacity: 0.6;
  margin-bottom: 8px;
}

/* Store buttons */
.cta-group { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 8px; }
.store-btn { min-height: 64px; min-width: 214px; }
.store-btn .btn-sub { font-size: 0.75rem; text-transform: uppercase; line-height: 1; }
.store-btn .btn-main { font-size: 1.25rem; line-height: 1; margin-top: 2px; }

/* Placeholder store button: used for a store the app has not shipped to yet,
   so it is a <span>, not a link. Swap it for an <a href> and drop .is-pending
   once that listing goes live. */
.store-btn.is-pending {
  background: var(--plate);
  color: var(--ink);
  cursor: default;
  opacity: 0.9;
}
.store-btn.is-pending:hover { transform: none; box-shadow: var(--shadow-hard); }

/* Policy pages */
.policy { padding: 48px 24px; max-width: 820px; }
.policy-head { margin-bottom: 32px; }
.summary { font-size: 1.15rem; max-width: 640px; }
.meta { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  background: var(--plate);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 4px 12px;
}
.policy article section { margin-bottom: 32px; }
.policy article section:last-child { margin-bottom: 0; }
.policy article h2 { font-size: 1.4rem; margin-bottom: 12px; }
.policy article h3 { font-size: 1.1rem; margin: 20px 0 8px; }
.policy article p { font-size: 1rem; }
.policy article p:last-child { margin-bottom: 0; }
.policy article ul, .policy article ol { margin: 0 0 24px 20px; }
.policy article li { font-size: 1rem; margin-bottom: 8px; opacity: 0.9; }
.policy article code { font-family: var(--font-mono); font-size: 0.92em; }
a { color: inherit; }

/* Language toggle. The English copy is the default; the toggle writes
   .lang-es onto <body>. Only ever hide, never set a display value — then each
   element keeps its own natural layout when shown (the footer's inline spans
   stay inline). Scoped under body on purpose: the toggle also sets
   <html lang="es">, and a bare [lang="es"] matches that too — which hides the
   entire document. */
body:not(.lang-es) [lang="es"] { display: none !important; }
body:not(.lang-de) [lang="de"] { display: none !important; }
body.lang-es [lang="en"],
body.lang-de [lang="en"] { display: none !important; }

/* The three-language switch, on the user guide. The other pages have the
   EN/ES toggle above. */
.lang-switch { display: inline-flex; align-items: center; gap: 6px; }
.lang-switch .sep { color: var(--ink-soft); font-weight: 700; }
.nav .lang-switch button { padding: 0; }
.nav .lang-switch button[aria-pressed="true"] { color: var(--cream); cursor: default; }
.nav .lang-switch button[aria-pressed="true"]:hover { text-decoration: none; }
.guide-legal { font-size: 0.85rem; margin-top: 40px; opacity: 0.75; }
.nav .lang-switch a { padding: 0; }
.nav .lang-switch a[aria-current="page"] { color: var(--cream); cursor: default; }
.nav .lang-switch a[aria-current="page"]:hover { text-decoration: none; }

/* Footer */
.footer {
  background: var(--well);
  color: var(--cream);
  border-top: 3px solid var(--orange);
  padding: 48px 0;
}
.status-strip + .footer { border-top: 3px solid var(--lamp-off); }
.footer-inner { display: flex; flex-direction: column; gap: 24px; justify-content: space-between; }
@media (min-width: 700px) {
  .footer-inner { flex-direction: row; align-items: flex-start; }
}
.footer-logo {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 2px;
  color: var(--orange);
  margin-bottom: 8px;
}
.footer p { font-size: 0.9rem; opacity: 0.7; margin-bottom: 0; }
.footer a { color: inherit; }
.footer-right { display: flex; flex-wrap: wrap; gap: 24px; }
.footer-right a {
  color: var(--cream);
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  opacity: 0.8;
}
.footer-right a:hover { opacity: 1; text-decoration: underline; }

/* The user guide. Tables of a name and what it does, so only the name column
   is mono; figures are app screenshots at full card width. */
.guide { max-width: 900px; }
.guide .guide-actions { margin-top: 24px; }
.guide-toc { margin-bottom: 32px; padding: 24px 32px; }
.guide-toc h2 { font-size: 1.4rem; margin-bottom: 12px; }
.guide-toc ol { columns: 2; column-gap: 32px; margin-left: 30px; }
.guide-toc li { margin-bottom: 4px; break-inside: avoid; }
.guide-toc a { font-weight: 700; text-decoration: none; }
.guide-toc a:hover { text-decoration: underline; }
@media (max-width: 560px) { .guide-toc ol { columns: 1; } }
.guide article section { scroll-margin-top: 16px; }
.guide article h3 { font-size: 1.15rem; margin: 20px 0 8px; }
.guide article ol { margin: 0 0 24px 22px; }
.guide article ol li { font-size: 1rem; margin-bottom: 8px; opacity: 0.9; }
.guide figure { margin: 8px 0 24px; }
.guide figure img { display: block; width: 100%; height: auto; border: var(--border-thick); border-radius: var(--radius); }
.guide figure.guide-phone { max-width: 320px; }
.guide figcaption { font-family: var(--font-mono); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.5px; opacity: 0.7; margin-top: 8px; }
.guide-version { font-size: 1rem; max-width: 640px; margin-top: 12px; }
.guide-tip { background: #fbe3cf; border: 2px solid var(--orange); border-left-width: 8px; border-radius: var(--radius); padding: 12px 16px; margin: 0 0 24px; font-size: 1rem; }
.guide code { font-family: var(--font-mono); font-size: 0.9em; }
.guide-table { display: block; overflow-x: auto; border-collapse: collapse; width: 100%; font-size: 0.95rem; margin-bottom: 24px; }
.guide-table th, .guide-table td { text-align: left; padding: 8px 12px 8px 0; border-bottom: 2px solid var(--panel); vertical-align: top; }
.guide-table th { font-size: 0.9rem; }
.guide-table td:first-child { font-family: var(--font-mono); font-weight: 600; font-size: 0.88rem; white-space: nowrap; padding-right: 20px; }
@media (max-width: 560px) { .guide-table td:first-child { white-space: normal; min-width: 96px; } }
.guide-terms { display: grid; grid-template-columns: max-content 1fr; gap: 6px 20px; margin-bottom: 24px; }
.guide-terms dt { font-family: var(--font-mono); font-weight: 700; font-size: 0.9rem; }
.guide-terms dd { font-size: 1rem; opacity: 0.9; }
@media (max-width: 560px) {
  .guide-terms { grid-template-columns: 1fr; gap: 0; }
  .guide-terms dd { margin-bottom: 10px; }
}

/* Printing the guide (and the PDF made from it): no site chrome, no shadows,
   the chapters starting after the contents page. */
@media print {
  @page { size: A4; margin: 16mm 14mm; }
  .guide-page .header, .guide-page .footer, .guide .guide-actions { display: none !important; }
  .guide-page { background: #fff; }
  .guide { padding: 0; max-width: none; }
  .guide .neu-card { box-shadow: none; border: 0; padding: 0; background: none; }
  .guide-toc { margin-bottom: 0; }
  .guide article section#start,
  .guide article section#start-es,
  .guide article section#start-de { break-before: page; }
  .guide figure, .guide-tip, .guide-terms, .guide table tr { break-inside: avoid; }
  .guide h2, .guide h3 { break-after: avoid; }
  .guide h1 { font-size: 2.6rem; }
  .guide h2 { font-size: 1.8rem; }
  .guide figure img { max-height: 115mm; width: auto; max-width: 100%; margin: 0 auto; }
  .guide figure.guide-phone { max-width: none; }
  .guide a { text-decoration: none; }
  .guide-table { display: table; overflow: visible; }
  .guide-toc ol { columns: 1; }
}

/* Crates: the free monthly sample drops (chopmatic/crates/). Pages written by
   .github/scripts/crates_site.py. */
.crate { padding: 48px 24px; max-width: 980px; }
.crate .policy-head h1 { margin-bottom: 12px; }
.crate-note { max-width: 640px; opacity: 0.85; }
.crate .cta-group { margin: 20px 0; }
.crate-grid, .crate-sounds { display: grid; gap: 28px; margin-bottom: 48px; }
.crate-grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.crate-card { display: block; text-decoration: none; }
a.crate-card:hover { box-shadow: var(--shadow-hard-hover); transform: translate(4px, 4px); }
.crate-card h2, .crate-sound h2 { font-size: 1.5rem; margin-bottom: 10px; }
.crate-list { font-size: 0.85rem; opacity: 0.8; margin-bottom: 0; }
.crate-badges { margin-bottom: 10px; }
.crate-sound audio { width: 100%; margin: 4px 0 16px; }
.crate-rights { font-size: 0.95rem; opacity: 0.9; }
.crate-links a, .crate-raw { font-family: var(--font-mono); font-size: 0.85rem; font-weight: 600; }
.crate-downloads { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin: 20px 0 0; }
.crate-btn { padding: 10px 18px; font-size: 0.95rem; }
.crate-get h2 { font-size: 1.6rem; margin-bottom: 4px; }
.crate-get .cta-group { margin: 16px 0 20px; }
