/* Thorn shorthand: the colours come from the app. */
:root {
  --bed: #171412;
  --strip: #221e1a;
  --line: #3a342b;
  --cream: #f5f0e6;
  --muted: #bfb5a3;
  --amber: #edb347;
  --amber-deep: #c98a22;
  --cap: #f5f0e6;
  --cap-voiced: #e6dbc7;
  --ink: #1f1b17;
  --hint: #73b3cc;
  --serif: ui-serif, "New York", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bed);
  color: var(--cream);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
}

img { max-width: 100%; height: auto; }

a { color: var(--amber); text-underline-offset: 0.2em; }
a:hover { color: #ffd07a; }
:focus-visible { outline: 3px solid var(--hint); outline-offset: 3px; border-radius: 4px; }

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 20;
  background: var(--amber); color: var(--ink); padding: 8px 14px; border-radius: 8px; font-weight: 600;
}
.skip:focus { top: 10px; }

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

.wrap { width: min(100% - 40px, 1040px); margin-inline: auto; }
.narrow { max-width: 680px; }
.wrap.narrow { width: min(100% - 40px, 680px); }

h1, h2, h3 { font-family: var(--serif); line-height: 1.2; margin: 0 0 0.5em; font-weight: 600; }
h1 { font-size: clamp(2.4rem, 7vw, 4rem); letter-spacing: -0.01em; }
h2 { font-size: clamp(1.6rem, 4vw, 2.1rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
em { font-style: italic; }

.eyebrow {
  font-size: 0.85rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--amber); margin-bottom: 0.8em; font-weight: 600;
}
.lead { font-size: clamp(1.15rem, 2.6vw, 1.4rem); color: var(--cream); line-height: 1.5; max-width: 34em; }
.section-lead { color: var(--muted); max-width: 40em; }

/* Header and footer */
.site-header { border-bottom: 1px solid var(--line); }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--cream); text-decoration: none; font-family: var(--serif); font-size: 1.2rem; font-weight: 600; }
.brand img { border-radius: 8px; }
.site-header nav ul { display: flex; gap: 22px; list-style: none; margin: 0; padding: 0; }
.site-header nav a { color: var(--muted); text-decoration: none; padding: 6px 0; border-bottom: 2px solid transparent; }
.site-header nav a:hover { color: var(--cream); }
.site-header nav a[aria-current="page"] { color: var(--cream); border-bottom-color: var(--amber); }

.site-footer { border-top: 1px solid var(--line); margin-top: 72px; padding: 28px 0 40px; color: var(--muted); font-size: 0.95rem; }
.footer-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px; }
.footer-row p { margin: 0; }
.footer-row ul { display: flex; flex-wrap: wrap; gap: 8px 20px; list-style: none; margin: 0; padding: 0; }
.footer-row a { color: var(--muted); }
.footer-row a:hover { color: var(--cream); }

/* Buttons */
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 1.6em; }
.actions.center { justify-content: center; }
.btn {
  display: inline-block; padding: 13px 22px; border-radius: 12px;
  font-weight: 600; text-decoration: none; font-size: 1rem; line-height: 1.2;
}
.btn-primary { background: var(--amber); color: var(--ink); }
.btn-primary:hover { background: #ffd07a; color: var(--ink); }
.btn-primary.is-soon { background: transparent; color: var(--amber); border: 2px solid var(--amber); cursor: default; padding: 11px 20px; }
.btn-quiet { color: var(--cream); border: 2px solid var(--line); padding: 11px 20px; }
.btn-quiet:hover { border-color: var(--muted); color: var(--cream); }

/* Hero */
.hero { padding: clamp(40px, 8vw, 96px) 0 clamp(40px, 7vw, 80px); }
.hero-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 40px; align-items: center; }
.hero-art { display: flex; justify-content: center; }
.hero-art img { width: min(100%, 320px); border-radius: 22%; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.05); }

.page-title { padding: clamp(36px, 6vw, 72px) 0 8px; }
.page-title h1 { font-size: clamp(2rem, 6vw, 3.1rem); }
.status { border-left: 4px solid var(--amber); padding: 6px 0 6px 16px; color: var(--cream); }

.toc { margin-top: 2em; }
.toc ul { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.toc a { display: inline-block; padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); text-decoration: none; font-size: 0.95rem; }
.toc a:hover { color: var(--cream); border-color: var(--muted); }

/* Sections */
.section { padding-top: clamp(40px, 6vw, 72px); }
.section-more { margin-top: 1.4em; }
.band { background: var(--strip); border-block: 1px solid var(--line); padding: clamp(40px, 6vw, 72px) 0; margin-top: clamp(40px, 6vw, 72px); }
.band h2 { margin-bottom: 0.7em; }
.closing { text-align: center; padding: clamp(56px, 9vw, 110px) 0 0; }
.closing h2 { font-size: clamp(1.8rem, 5vw, 2.6rem); }

.prose p, .prose li { max-width: 40em; }
.prose h2 { margin-top: 0; }

.steps { list-style: none; margin: 2em 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.steps li { position: relative; }
.step-no {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  background: var(--amber); color: var(--ink); font-weight: 700; margin-bottom: 12px;
}
.steps p { color: var(--muted); }

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 2em; }
.card { background: var(--bed); border: 1px solid var(--line); border-radius: 16px; padding: 24px; }
.card p { color: var(--muted); margin: 0; }

.features { list-style: none; margin: 1.6em 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px 32px; }
.features h3 { font-size: 1.1rem; color: var(--amber); font-family: var(--sans); font-weight: 600; margin-bottom: 0.3em; }
.features p { color: var(--muted); margin: 0; }

.plain { padding-left: 1.2em; }
.plain li { margin-bottom: 0.7em; }
.plain li::marker { color: var(--amber); }

.note { color: var(--muted); font-size: 0.95rem; }

.book-teaser p { color: var(--muted); max-width: 40em; }

/* Tables */
.pairs { border-collapse: collapse; margin: 1.2em 0 1.6em; width: 100%; font-size: 1rem; }
.pairs th, .pairs td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--line); }
.pairs th { color: var(--muted); font-weight: 600; font-size: 0.9rem; }
.pairs td:first-child { font-weight: 600; white-space: nowrap; }

/* The book */
.chapters { list-style: none; counter-reset: ch; margin: 0; padding: 0; }
.chapters li { counter-increment: ch; display: grid; grid-template-columns: 2.2em 1fr; gap: 2px 10px; padding: 14px 0; border-bottom: 1px solid var(--line); }
ol.chapters li::before { content: counter(ch); color: var(--amber); font-family: var(--serif); font-size: 1.3rem; grid-row: span 2; }
ul.chapters li::before { content: "•"; color: var(--amber); grid-row: span 2; text-align: center; }
.chapters span { color: var(--muted); grid-column: 2; }
.appendix-head { margin-top: 2em; color: var(--muted); font-family: var(--sans); font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.08em; }

/* The board demo */
.board-demo { margin-top: 2em; background: var(--strip); border: 1px solid var(--line); border-radius: 20px; padding: clamp(16px, 3vw, 28px); }
.board-label { margin: 0 0 12px; color: var(--muted); font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.08em; }

.chord-picks { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.pick {
  appearance: none; font: inherit; font-weight: 600; cursor: pointer;
  background: transparent; color: var(--cream); border: 2px solid var(--line);
  padding: 8px 18px; border-radius: 999px; min-height: 44px;
}
.pick:hover { border-color: var(--muted); }
.pick.is-on { background: var(--amber); border-color: var(--amber); color: var(--ink); }

.board { max-width: 760px; margin-inline: auto; }
.board-grid {
  display: grid; grid-template-columns: repeat(11, 1fr); grid-template-rows: repeat(2, auto);
  gap: clamp(4px, 1.2vw, 10px);
}
.cell { display: block; }
.th-cell { display: block; }
.th-cell .key { height: 100%; }

.key {
  display: grid; place-items: center; width: 100%;
  aspect-ratio: 1 / 1.05;
  background: var(--cap); color: var(--ink);
  border-radius: clamp(6px, 1.2vw, 11px);
  font-weight: 700; font-size: clamp(0.8rem, 2.4vw, 1.35rem);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.45);
  transition: background 0.12s, transform 0.12s, box-shadow 0.12s;
  user-select: none;
}
.key.voiced { background: var(--cap-voiced); }
.key-th { aspect-ratio: auto; background: var(--cap-voiced); }
.key.is-down {
  background: linear-gradient(180deg, #f6c35e, var(--amber-deep));
  transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.45);
}

.board-vowels {
  display: grid; grid-template-columns: repeat(6, 1fr);
  gap: clamp(4px, 1.2vw, 10px); margin-top: clamp(8px, 1.8vw, 16px);
}
.board-vowels .key { aspect-ratio: auto; height: clamp(40px, 8vw, 62px); }
.key-hash { background: #d9d0be; color: #6b6355; }
.key-vowel { background: var(--cap-voiced); }
.board-vowels .key-vowel.is-down { background: linear-gradient(180deg, #f6c35e, var(--amber-deep)); }

.board-readout { margin-top: 22px; text-align: center; min-height: 5.5em; }
.readout-sounds { margin: 0 0 6px; font-size: 1.15rem; display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 4px 8px; }
.readout-label { color: var(--muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; margin-right: 4px; }
.readout-pair { white-space: nowrap; }
.readout-sounds strong { font-family: var(--mono); font-weight: 600; margin-right: 6px; }
.readout-sounds .readout-word { font-family: var(--serif); font-size: 1.5em; color: var(--amber); }
.readout-arrow { color: var(--muted); margin: 0 6px; }
.readout-say { margin: 0 auto; max-width: 36em; color: var(--muted); }

/* Email sign-up */
.signup { background: var(--strip); border-top: 1px solid var(--line); margin-top: clamp(48px, 7vw, 88px); padding: clamp(40px, 6vw, 72px) 0; }
.signup h2 { margin-bottom: 0.4em; }
.signup-text { color: var(--muted); max-width: 36em; }
.signup-form { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 1.4em; position: relative; }
.signup-form[hidden] { display: none; }
.signup-form input[type="email"] {
  flex: 1 1 260px; min-width: 0; font: inherit; color: var(--cream);
  background: var(--bed); border: 2px solid var(--line); border-radius: 12px; padding: 12px 16px;
}
.signup-form input[type="email"]::placeholder { color: #8b8274; }
.signup-form input[type="email"]:focus { border-color: var(--amber); }
.signup-form button.btn { border: 0; cursor: pointer; font-family: inherit; }
.signup-form button.btn:disabled { opacity: 0.6; cursor: default; }
/* The honeypot: out of sight and out of reach for people. */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.signup-status { min-height: 1.6em; margin: 0.9em 0 0; }
.signup-status.is-error { color: #e39f80; }
.signup-status.is-done { color: var(--cream); font-size: 1.15rem; border-left: 4px solid var(--amber); padding-left: 14px; }
.signup-small { margin-top: 0.4em; }

/* Narrow screens */
@media (max-width: 760px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-art { order: -1; justify-content: flex-start; }
  .hero-art img { width: 120px; }
  .steps, .cards, .features { grid-template-columns: 1fr; }
  .site-header nav ul { gap: 14px; }
  .brand span { font-size: 1.05rem; }
  .wrap { width: min(100% - 32px, 1040px); }
  .wrap.narrow { width: min(100% - 32px, 680px); }
  .board-demo { padding: 14px; border-radius: 16px; }
  .readout-arrow { display: none; }
  .readout-sounds { flex-direction: column; align-items: center; }
  .signup-form .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .key { transition: none; }
}
