/* base.css — the component layer.
 *
 * Every color, type size, spacing step, radius, shadow and layout measure comes from
 * assets/tokens.css (generated from design/tokens.yaml). The only raw values allowed
 * here are rendering mechanics: border widths, marker/chevron geometry, grid column
 * minima, breakpoints and opacity. If you need a new color or size, add it to tokens.yaml.
 *
 * Structure: reset → band (the section shell) → components → footer → responsive.
 * Which class belongs in which section file: design/DESIGN.md.
 */

/* --- reset / base ------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: var(--layout-header-offset); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--surface-page);
  color: var(--text-body);
  font: var(--size-0) / var(--leading-body) var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  margin: 0;
  color: var(--text-heading);
  font-family: var(--font-display);
  font-weight: 600;
  line-height: var(--leading-heading);
  letter-spacing: -.015em;
  text-wrap: pretty;
}
h1 { font-size: clamp(2rem, 1.2rem + 2.6vw, 3.4rem); line-height: var(--leading-tight); letter-spacing: -.02em; }
h2 { font-size: clamp(1.7rem, 1.15rem + 1.8vw, 2.75rem); }
h3 { font-size: var(--size-2); }
h4 { font-size: var(--size-1); }

p { margin: 0; text-wrap: pretty; }
img { max-width: 100%; height: auto; display: block; }
strong { font-weight: 600; color: var(--color-deep); }

a {
  color: var(--text-link);
  text-decoration: none;
  border-bottom: 1px solid var(--border-subtle);
  transition: color 150ms ease, border-color 150ms ease;
}
a:hover { color: var(--text-link-hover); border-bottom-color: var(--color-deep); }
a:focus-visible,
summary:focus-visible,
.btn:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 3px; border-radius: 2px; }

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

/* --- band: the section shell -------------------------------------------
   A three-column grid gives every band a centred content column plus a
   full-bleed escape hatch (.bleed) with no extra wrapper div in markdown. */
.band {
  display: grid;
  grid-template-columns:
    minmax(var(--space-6), 1fr)
    minmax(0, var(--layout-page-max))
    minmax(var(--space-6), 1fr);
  row-gap: var(--space-5);
  padding-block: var(--space-10);
  background: var(--surface-page);
}
.band > * { grid-column: 2; }
.band > .bleed { grid-column: 1 / -1; }

.band--foam { background: var(--surface-alt); }
.band--deep { background: var(--surface-deep); color: var(--color-foam); }
.band--deep h1, .band--deep h2, .band--deep h3 { color: var(--color-paper); }
.band--deep a {
  color: var(--color-paper);
  border-bottom-color: color-mix(in oklch, var(--color-foam) 50%, transparent);
}
.band--tight { padding-block: var(--space-9); }
.band--rule { border-top: 1px solid var(--border-subtle); }

/* Prose measure: headings and lead paragraphs stay narrow even though the
   grid track is wide. Graphical blocks below use the full column. */
.band > h2,
.band > p,
.band > .lead,
.band > .fine,
.band > .eyebrow { max-width: var(--layout-prose-max); }

.lead { font-size: var(--size-1); line-height: var(--leading-body); }
.band--deep .lead { color: var(--color-foam); }
.fine { font-size: var(--size--1); opacity: .72; }

.eyebrow {
  font-size: var(--size-label);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--color-water);
  margin: 0;
}
.band--deep .eyebrow { color: var(--color-foam); opacity: .8; }

.spaced { margin-top: var(--space-6); }

/* --- buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: var(--layout-control-h);
  padding: 0 var(--space-5);
  border: none;
  border-radius: var(--radius-control);
  font: 600 var(--size-0) / 1 var(--font-body);
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease;
}
.btn--primary { background: var(--cta-bg); color: var(--cta-text); }
.btn--primary:hover,
.btn--primary:active { background: var(--cta-bg-hover); color: var(--cta-text); border-bottom-color: transparent; }
.btn--lg { height: var(--layout-control-h-lg); padding: 0 var(--space-6); font-size: var(--size-1); }
.btn--block { width: 100%; }
a.btn { border-bottom: none; }

/* --- header ------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in oklch, var(--surface-page) 92%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border-subtle);
}
.site-header__inner {
  max-width: var(--layout-page-max);
  margin-inline: auto;
  padding: var(--space-4) var(--space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
}
.brand {
  font: 600 var(--size-1) / 1 var(--font-display);
  color: var(--color-deep);
  border-bottom: none;
  letter-spacing: -.01em;
  white-space: nowrap;
}
.nav { display: flex; align-items: center; gap: var(--space-5); }
.nav a { font-size: var(--size--1); border-bottom: none; white-space: nowrap; }
@media (max-width: 56rem) { .nav .nav__link { display: none; } }

/* Only rendered once a second locale exists — see site.yaml / DESIGN.md § Locales. */
.lang-nav { display: flex; gap: var(--space-3); font-size: var(--size-label); }
.lang-nav a { color: var(--color-water); border-bottom: none; white-space: nowrap; }
.lang-nav a[aria-current="true"] { color: var(--color-ink); font-weight: 600; }
@media (max-width: 40rem) { .lang-nav { display: none; } }

/* --- hero --------------------------------------------------------------- */
.hero { position: relative; overflow: hidden; padding-bottom: var(--space-10); }
.hero__grid {
  position: relative;   /* paint above .waves, which is absolutely positioned */
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
  gap: var(--space-9);
  align-items: center;
}
.hero__copy { display: flex; flex-direction: column; gap: var(--space-6); }
.hero__copy h1 { max-width: 16em; }
.hero__copy .lead { max-width: var(--layout-prose-max); }
.hero__cta { display: flex; flex-direction: column; gap: var(--space-4); align-items: flex-start; }
.hero__cover { display: flex; justify-content: center; }
.hero__cover img {
  width: 100%;
  max-width: 22rem;
  height: auto;
  border-radius: 4px;
  box-shadow: var(--shadow-cover);
}

/* flat wave bands — the design system's illustration language.
   The markup is generated by build.py from the palette ({{waves}}). */
.waves {
  position: absolute;
  inset: auto 0 0 0;
  height: 340px;
  pointer-events: none;
  opacity: .55;
}
.waves svg { width: 100%; height: 100%; display: block; }

/* --- stats strip -------------------------------------------------------- */
.band--stats { padding-block: 0; border-bottom: 1px solid var(--border-subtle); }
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1px;
  background: var(--border-subtle);
}
.stat {
  background: var(--surface-page);
  padding: var(--space-6) var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.stat > :first-child {
  font: 600 var(--size-3) / var(--leading-tight) var(--font-display);
  color: var(--color-deep);
}
.stat > :last-child { font-size: var(--size--1); opacity: .7; }

/* --- cards -------------------------------------------------------------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-5);
}
.card {
  background: var(--surface-alt);
  border-radius: var(--radius-card);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.card--raised { background: var(--surface-page); box-shadow: var(--shadow-card); }
.card--outlined { background: transparent; border: 1px solid var(--border-subtle); }
.card > h3 { font-size: var(--size-1); }
.card > p { font-size: var(--size--1); }
/* step chips come from the data attribute, so the markdown stays prose */
.card[data-step]::before {
  content: attr(data-step);
  width: var(--space-7); height: var(--space-7);
  flex: none;
  border-radius: var(--radius-pill);
  background: var(--color-water);
  color: var(--color-paper);
  font: 700 var(--size--1) / var(--space-7) var(--font-body);
  text-align: center;
}

/* --- two-tone contrast panel -------------------------------------------- */
.split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  overflow: hidden;
}
.split > * {
  padding: var(--space-7);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.split > * > p { font-size: var(--size-1); line-height: var(--leading-body); }
.split__deep { background: var(--surface-deep); }
.split__deep p { color: var(--color-paper); }
.split__deep .eyebrow { color: var(--color-foam); opacity: .8; }

/* --- author ------------------------------------------------------------- */
.author {
  display: grid;
  grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr);
  gap: var(--space-9);
  align-items: start;
}
.author__aside {
  display: flex; flex-direction: column; gap: var(--space-5);
  position: sticky; top: calc(var(--layout-header-offset) + var(--space-5));
}
/* photo + caption, used in the author aside and the s04 side rail */
.photo { display: flex; flex-direction: column; gap: var(--space-3); }
.photo img { border-radius: var(--radius-card); width: 100%; box-shadow: var(--shadow-card); }
.author__main { display: flex; flex-direction: column; gap: var(--space-5); }
.author__main > p,
.author__main > .lead { max-width: var(--layout-prose-max); }

blockquote {
  margin: var(--space-2) 0;
  padding: var(--space-5) var(--space-6);
  background: var(--surface-page);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}
blockquote p {
  font: italic 600 var(--size-1) / var(--leading-heading) var(--font-display);
  color: var(--color-deep);
}
blockquote p + p {
  margin-top: var(--space-3);
  font: var(--size--1) / var(--leading-body) var(--font-body);
  color: var(--color-ink);
  opacity: .7;
}

/* --- badge timeline ----------------------------------------------------- */
.timeline-card__head { display: flex; flex-direction: column; gap: var(--space-3); }
.timeline-card {
  background: var(--surface-page);
  border-radius: var(--radius-card);
  padding: var(--space-6);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}
.timeline {
  position: relative;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--space-4);
}
.timeline::before {
  content: '';
  position: absolute;
  top: 11px;
  left: 11px;
  right: 11px;
  height: 2px;
  background: var(--border-subtle);
}
.node { position: relative; display: flex; flex-direction: column; gap: var(--space-3); }
.node::before {
  content: '';
  width: var(--space-5); height: var(--space-5);
  border-radius: var(--radius-pill);
  background: var(--surface-page);
  border: 2px solid var(--color-water);
}
.node--filled::before { background: var(--color-water); }
.node--final::before { background: var(--color-deep); border-color: var(--color-deep); }
.node__when {
  font-size: var(--size-label);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--color-water);
}
.node__name { font-weight: 600; color: var(--color-deep); }
.node__detail { font-size: var(--size--1); opacity: .75; }
.timeline-card__kicker {
  padding-top: var(--space-5);
  border-top: 1px solid var(--border-subtle);
  color: var(--color-deep);
  font-weight: 600;
}

/* --- chapter ladder ----------------------------------------------------- */
.inside {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--space-6);
  align-items: start;
}
.ladder { counter-reset: rung; }
.rung {
  display: grid;
  grid-template-columns: var(--layout-control-h-lg) minmax(0, 1fr);
  gap: var(--space-5);
}
.rung__rail { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); }
.rung__rail::before {
  counter-increment: rung;
  content: counter(rung);
  width: var(--layout-control-h-lg); height: var(--layout-control-h-lg);
  flex: none;
  border-radius: var(--radius-pill);
  background: var(--surface-deep);
  color: var(--color-paper);
  font: 600 var(--size-1) / var(--layout-control-h-lg) var(--font-display);
  text-align: center;
}
.rung__rail::after { content: ''; width: 2px; flex: 1; background: var(--border-subtle); }
.rung:last-child .rung__rail::after { display: none; }
.rung:last-child .rung__rail::before { background: var(--cta-bg); }
.rung__body {
  padding-bottom: var(--space-7);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  align-items: flex-start;
}
.rung:last-child .rung__body { padding-bottom: 0; }
.rung__body h3 { font-size: var(--size-1); }

.chip {
  display: inline-block;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-pill);
  background: var(--surface-alt);
  color: var(--color-deep);
  font: 600 var(--size--1) / 1.4 var(--font-body);
}
.pills { display: flex; flex-wrap: wrap; gap: var(--space-2); }

/* --- rhythm / checklist side rail --------------------------------------- */
.aside-stack {
  display: flex; flex-direction: column; gap: var(--space-5);
  position: sticky; top: calc(var(--layout-header-offset) + var(--space-5));
}
.rhythm { display: flex; flex-direction: column; gap: var(--space-3); }
.rhythm > div { display: flex; gap: var(--space-3); align-items: baseline; font-size: var(--size--1); }
.rhythm strong { min-width: 4rem; color: var(--color-water); font-weight: 700; }

.checks ul {
  display: flex; flex-direction: column; gap: var(--space-3);
  margin: 0; padding: 0; list-style: none;
}
.checks li { display: flex; gap: var(--space-3); font-size: var(--size--1); }
.checks li::before { content: '✓'; color: var(--color-ok); font-weight: 700; }
.checks--no li::before { content: '✕'; color: var(--color-water); }

/* --- callout ------------------------------------------------------------ */
.callout {
  background: var(--surface-alt);
  border-radius: var(--radius-card);
  padding: var(--space-6);
  display: grid;
  grid-template-columns: var(--layout-control-h) minmax(0, 1fr);
  gap: var(--space-5);
  align-items: center;
}
.callout::before {
  content: '!';
  width: var(--layout-control-h); height: var(--layout-control-h);
  border-radius: var(--radius-pill);
  background: var(--color-water);
  color: var(--color-paper);
  font: 600 var(--size-1) / var(--layout-control-h) var(--font-display);
  text-align: center;
}
.callout p { color: var(--color-deep); }

/* --- buy ---------------------------------------------------------------- */
.buy {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--space-9);
  align-items: center;
}
.buy__copy { display: flex; flex-direction: column; gap: var(--space-4); }
.price-card {
  background: var(--surface-page);
  color: var(--text-body);
  border-radius: var(--radius-card);
  padding: var(--space-7);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  box-shadow: var(--shadow-lifted);
}
.price { display: flex; align-items: baseline; gap: var(--space-3); }
.price > :first-child {
  font: 400 clamp(2.2rem, 1.6rem + 1.6vw, 3.2rem) / 1 var(--font-display);
  color: var(--color-deep);
}
.price > :last-child { font-size: var(--size--1); opacity: .7; }
.price-card__note { font-size: var(--size--1); opacity: .7; text-align: center; }
.price-card__support {
  padding-top: var(--space-5);
  border-top: 1px solid var(--border-subtle);
  font-size: var(--size--1);
  opacity: .8;
}
.price-card a:not(.btn) { color: var(--text-link); border-bottom-color: var(--border-subtle); }

/* --- FAQ (details/summary generated by scripts/faq.lua) ----------------- */
.faq { border-top: 1px solid var(--border-subtle); }
.faq__item { border-bottom: 1px solid var(--border-subtle); }
.faq__item > summary {
  list-style: none;
  cursor: pointer;
  padding: var(--space-5) 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  font: 600 var(--size-1) / var(--leading-heading) var(--font-display);
  color: var(--color-deep);
}
.faq__item > summary::-webkit-details-marker { display: none; }
.faq__item > summary::marker { content: none; }
.chev {
  flex: none;
  width: 14px; height: 14px;
  border-right: 2px solid var(--color-water);
  border-bottom: 2px solid var(--color-water);
  transform: rotate(-45deg);
  transition: transform 150ms ease;
}
.faq__item[open] > summary .chev { transform: rotate(45deg); }
.faq__body {
  padding-bottom: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  max-width: 38rem;
}
.duo {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
}
.duo > * {
  background: var(--surface-alt);
  border-radius: var(--radius-card);
  padding: var(--space-4) var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.duo p { font-size: var(--size--1); }

/* --- closer ------------------------------------------------------------- */
.closer { text-align: center; justify-items: center; row-gap: var(--space-5); }
.closer > * { justify-self: center; }
.closer h2 { max-width: 24em; }

/* --- footer ------------------------------------------------------------- */
.site-footer { border-top: 1px solid var(--border-subtle); }
.site-footer__inner {
  max-width: var(--layout-page-max);
  margin-inline: auto;
  padding: var(--space-8) var(--space-6) var(--space-7);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-8);
  align-items: start;
}
.footer-col { display: flex; flex-direction: column; gap: var(--space-3); }
/* column titles: body face, small — they label, they don't announce */
.site-footer h2 {
  font: 600 var(--size--1) / var(--leading-body) var(--font-body);
  color: var(--color-deep);
  letter-spacing: 0;
}
.site-footer p, .site-footer li { font-size: var(--size--1); opacity: .75; }
.site-footer blockquote {
  margin: 0;
  padding: 0 0 0 var(--space-3);
  background: none;
  box-shadow: none;
  border-radius: 0;
  border-left: 2px solid var(--border-subtle);
}
.site-footer blockquote p {
  font: var(--size--1) / var(--leading-body) var(--font-body);
  color: var(--color-ink);
}
.site-footer__legal {
  max-width: var(--layout-page-max);
  margin-inline: auto;
  padding: var(--space-5) var(--space-6) var(--space-7);
  border-top: 1px solid var(--border-subtle);
  font-size: var(--size-label);
  opacity: .6;
}

/* --- checkout return pages (php/thanks.php) ----------------------------- */
.section { padding-block: var(--space-9); }
.wrap { max-width: 44rem; margin-inline: auto; padding-inline: var(--space-6); }
.wrap > * + * { margin-top: var(--space-5); }
.button {
  display: inline-flex; align-items: center; justify-content: center;
  height: var(--layout-control-h); padding: 0 var(--space-5); margin-right: var(--space-3);
  border-radius: var(--radius-control);
  background: var(--cta-bg); color: var(--cta-text);
  font: 600 var(--size-0) / 1 var(--font-body);
  border-bottom: none;
}
.button:hover { background: var(--cta-bg-hover); color: var(--cta-text); }
.trust { font-size: var(--size--1); opacity: .8; }

/* --- narrow viewports --------------------------------------------------- */
@media (max-width: 56rem) {
  .band { padding-block: var(--space-9); }
  .hero { padding-bottom: var(--space-8); }
  .hero__grid, .author, .inside { grid-template-columns: minmax(0, 1fr); }
  .hero__cover { order: -1; }
  .hero__cover img { max-width: 14rem; }
  .author__aside, .aside-stack { position: static; }
  .site-header__inner { padding-inline: var(--space-4); }
}

/* --- print -------------------------------------------------------------- */
@media print {
  .site-header, .waves, .btn { display: none; }
  .band { padding-block: var(--space-6); }
  .faq__body { display: block !important; }
}
