/* ---------------------------------------------------------------------------
   Marigold — tokens
--------------------------------------------------------------------------- */
:root {
  --paper: #eef1eb;
  --paper-deep: #dfe6dc;
  --ink: #13261c;
  --ink-soft: #3f5449;
  --pine: #1f4e3a;
  --gold: #e5a33a;
  --line: #c4cfc5;

  /* workbook spines */
  --c-gold: #e5a33a;   --c-gold-dark: #b97f22;   --c-gold-ink: #13261c;
  --c-rose: #d48a85;   --c-rose-dark: #a85e59;   --c-rose-ink: #13261c;
  --c-pine: #1f4e3a;   --c-pine-dark: #123125;   --c-pine-ink: #eef1eb;
  --c-moss: #7c9c86;   --c-moss-dark: #587463;   --c-moss-ink: #13261c;
  --c-plum: #6b3f6b;   --c-plum-dark: #452745;   --c-plum-ink: #eef1eb;

  --display: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
  --body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;

  --measure: 34rem;
  --wrap: 72rem;
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --row: 2rem; /* ledger rule spacing */
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.025em;
  margin: 0;
  font-variation-settings: "opsz" 96;
}
h1 { font-size: clamp(2.6rem, 7vw, 5.25rem); }
h2 { font-size: clamp(1.9rem, 4vw, 2.75rem); }
h3 { font-size: 1.35rem; letter-spacing: -0.015em; }

p { margin: 0; max-width: var(--measure); }
p + p { margin-top: 1em; }

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--pine); }

:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; border-radius: 2px; }

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

.wrap { width: min(var(--wrap), 100% - 2 * var(--gutter)); margin-inline: auto; }

.muted { color: var(--ink-soft); }

/* ---------------------------------------------------------------------------
   Buttons
--------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .9rem 1.4rem;
  background: var(--ink); color: var(--paper);
  font: 600 1rem/1 var(--body);
  border: 0; border-radius: 6px;
  text-decoration: none; cursor: pointer;
  transition: background .15s ease, transform .15s ease;
}
.btn:hover { background: var(--pine); color: var(--paper); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: wait; }
.btn.secondary { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.btn.secondary:hover { background: var(--paper-deep); }
.btn.large { padding: 1.1rem 1.7rem; font-size: 1.1rem; }

/* ---------------------------------------------------------------------------
   Header / footer
--------------------------------------------------------------------------- */
.site-head {
  display: flex; align-items: center; justify-content: space-between;
  padding-block: 1.4rem;
}
.wordmark {
  font-family: var(--display); font-weight: 800; font-size: 1.5rem;
  letter-spacing: -0.03em; text-decoration: none; display: inline-flex; align-items: center; gap: .45rem;
}
.wordmark::before {
  content: ""; width: .7em; height: .7em; border-radius: 50%; background: var(--gold);
}
.head-right { display: flex; align-items: center; gap: 1.6rem; }
.head-highlights {
  display: flex; align-items: center; gap: 1rem;
  list-style: none; margin: 0; padding: 0;
}
.head-highlights .hh-label {
  font-family: var(--display); font-weight: 700; font-size: .68rem;
  text-transform: uppercase; letter-spacing: .1em; color: var(--ink-soft);
}
.head-highlights li + li::before {
  content: "·"; color: var(--line); margin-right: 1rem;
}
.head-highlights a {
  text-decoration: none; font-weight: 600; font-size: .9rem;
  text-decoration: underline; text-decoration-color: var(--gold);
  text-decoration-thickness: 2px; text-underline-offset: 3px;
}
.head-highlights .hh-label + li::before { content: none; }
@media (max-width: 820px) { .head-highlights { display: none; } }

.site-nav { display: flex; gap: 1.6rem; font-weight: 500; }
.site-nav a { text-decoration: none; }
.site-nav a[aria-current="page"] { text-decoration: underline; text-decoration-color: var(--gold); text-decoration-thickness: 2px; }

.site-foot {
  border-top: 1.5px solid var(--ink);
  margin-top: clamp(4rem, 10vw, 7rem);
  padding-block: 2rem 3rem;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem 2rem;
  color: var(--ink-soft); font-size: .95rem;
}
.site-foot p { max-width: none; }

/* ---------------------------------------------------------------------------
   Ledger hero
--------------------------------------------------------------------------- */
.ledger {
  /* ruled paper: one hairline every --row */
  background-image: repeating-linear-gradient(
    to bottom, transparent 0, transparent calc(var(--row) - 1px), var(--line) calc(var(--row) - 1px), var(--line) var(--row)
  );
  border-top: 1.5px solid var(--ink);
  border-bottom: 1.5px solid var(--ink);
}
.hero {
  display: grid; grid-template-columns: 1.15fr .85fr; gap: 3rem;
  align-items: center;
  padding-block: clamp(3rem, 8vw, 6rem);
}
.hero h1 { margin-bottom: 1.4rem; text-wrap: balance; }
.hero .lede { font-size: 1.2rem; line-height: 1.5; margin-bottom: 2rem; }
.hero .actions { display: flex; flex-wrap: wrap; gap: .8rem 1rem; align-items: center; }

/* fanned stack of featured covers */
.stack {
  position: relative; aspect-ratio: 1 / 1; width: 100%; max-width: 30rem; margin-inline: auto;
}
.stack .cover {
  position: absolute; width: 58%; left: 21%; top: 12%;
  transform-origin: 50% 110%;
  transition: transform .5s cubic-bezier(.2,.8,.2,1);
}
.stack .cover:nth-child(1) { z-index: 1; }
.stack .cover:nth-child(2) { z-index: 2; }
.stack .cover:nth-child(3) { z-index: 3; }
/* starts as a neat pile; JS adds .fanned one frame later for a single settle */
.stack.fanned .cover:nth-child(1) { transform: rotate(-9deg) translateX(-14%); }
.stack.fanned .cover:nth-child(3) { transform: rotate(9deg) translateX(14%); }
@media (prefers-reduced-motion: reduce) {
  .stack .cover:nth-child(1) { transform: rotate(-9deg) translateX(-14%); }
  .stack .cover:nth-child(3) { transform: rotate(9deg) translateX(14%); }
}

/* ---------------------------------------------------------------------------
   Workbook cover
--------------------------------------------------------------------------- */
.cover {
  --bg: var(--c-gold); --spine: var(--c-gold-dark); --fg: var(--c-gold-ink);
  aspect-ratio: 3 / 4;
  background: linear-gradient(to right, var(--spine) 0 4.5%, var(--bg) 4.5%);
  color: var(--fg);
  border-radius: 2px 6px 6px 2px;
  box-shadow: 3px 3px 0 var(--paper-deep), 6px 6px 0 rgba(19,38,28,.18);
  padding: 8% 8% 8% 12%;
  display: flex; flex-direction: column; justify-content: space-between;
  text-decoration: none; overflow: hidden;
  container-type: inline-size;
}
.cover[data-accent="rose"] { --bg: var(--c-rose); --spine: var(--c-rose-dark); --fg: var(--c-rose-ink); }
.cover[data-accent="pine"] { --bg: var(--c-pine); --spine: var(--c-pine-dark); --fg: var(--c-pine-ink); }
.cover[data-accent="moss"] { --bg: var(--c-moss); --spine: var(--c-moss-dark); --fg: var(--c-moss-ink); }
.cover[data-accent="plum"] { --bg: var(--c-plum); --spine: var(--c-plum-dark); --fg: var(--c-plum-ink); }

.cover .cover-brand { display: block; font: 600 5cqi/1 var(--body); opacity: .8; }
.cover .cover-title {
  display: block;
  font-family: var(--display); font-weight: 700; letter-spacing: -0.03em; line-height: .98;
  font-size: 11.5cqi; text-wrap: balance;
}
.cover .cover-meta { display: block; font: 500 5cqi/1.2 var(--body); opacity: .85; margin-top: 4cqi; }

a.cover:hover { color: var(--fg); }

/* Photo cover: the product preview sitting on an accent mat. */
.cover.cover--photo {
  background: var(--bg);
  padding: 0;
  display: block;
}
.cover--photo .cover-img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: top center;
  display: block;
}
/* On the product page, show the whole page as paper on an accent mat. Let the
   image set the height (no fixed aspect-ratio) so nothing collapses or crops. */
.product .cover--photo {
  aspect-ratio: auto;
  padding: 6%;
  display: flex; align-items: center; justify-content: center;
}
.product .cover--photo .cover-img {
  width: 100%; height: auto;
  object-fit: contain;
  background: #fff; border-radius: 2px;
  box-shadow: 0 8px 22px rgba(19, 38, 28, .20);
  transition: transform .18s ease;
}
/* Hover-to-zoom (pointer devices only; JS adds these classes). */
.pmedia .cover--photo.zoomable { cursor: zoom-in; }
.pmedia .cover--photo.is-zooming { cursor: crosshair; }
.pmedia .cover--photo.is-zooming .cover-img { transition: none; will-change: transform; }
@media (prefers-reduced-motion: reduce) {
  .product .cover--photo .cover-img { transition: none; }
}

/* Product-page media column + thumbnails. */
.pmedia { position: sticky; top: 2rem; width: min(100%, 26rem); display: grid; gap: .9rem; }
.pmedia .cover { width: 100%; }
.thumbs { display: flex; gap: .7rem; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.thumb {
  width: 4.4rem; aspect-ratio: 3 / 4; padding: 0; overflow: hidden; cursor: pointer;
  border: 1.5px solid var(--line); border-radius: 4px; background: var(--paper-deep);
  transition: border-color .15s ease, transform .15s ease;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block; }
.thumb:hover { transform: translateY(-2px); }
.thumb.is-active { border-color: var(--gold); border-width: 2px; }

/* ---------------------------------------------------------------------------
   Sections
--------------------------------------------------------------------------- */
.section { padding-top: clamp(3.5rem, 8vw, 6rem); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 2rem; }
.section-head p { margin-top: .5rem; }

/* product grid */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2.5rem 2rem; list-style: none; padding: 0; margin: 0; }
.grid.two { grid-template-columns: repeat(2, 1fr); }
.card { display: grid; gap: .9rem; }
.card .cover { width: 100%; transition: transform .2s ease; }
.card:hover .cover { transform: translate(-2px, -2px); }
.card h3 a { text-decoration: none; }
.card h3 a:hover { text-decoration: underline; text-decoration-color: var(--gold); text-decoration-thickness: 2px; }
.card .price { font-weight: 600; }
.card .tagline { color: var(--ink-soft); font-size: 1rem; }

/* how it works: a real sequence, so numbers are earned */
.steps { list-style: none; counter-reset: step; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; }
.steps li { counter-increment: step; border-top: 1.5px solid var(--ink); padding-top: 1rem; }
.steps li::before { content: counter(step); font-family: var(--display); font-weight: 800; font-size: 2rem; display: block; margin-bottom: .4rem; }
.steps h3 { margin-bottom: .4rem; }

/* ---------------------------------------------------------------------------
   Product page
--------------------------------------------------------------------------- */
.product { display: grid; grid-template-columns: .9fr 1.1fr; gap: clamp(2rem, 6vw, 5rem); align-items: start; padding-top: 1rem; }
.product .cover { width: min(100%, 26rem); }
.product h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); margin-bottom: .8rem; }
.product .tagline { font-size: 1.25rem; margin-bottom: 1.8rem; }
.buy { display: flex; align-items: center; gap: 1rem 1.5rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.buy .format { color: var(--ink-soft); }
.prose { border-top: 1.5px solid var(--ink); padding-top: 1.5rem; margin-top: 1.5rem; }
.reassure { margin-top: 2rem; padding: 1.1rem 1.2rem; background: var(--paper-deep); border-radius: 6px; font-size: .95rem; }
.reassure ul { margin: .4rem 0 0; padding-left: 1.1rem; }
.reassure li + li { margin-top: .2rem; }
.form-error { color: #8f2b27; font-weight: 500; margin-top: .6rem; }
.crumb { font-size: .95rem; margin-bottom: 1.5rem; }
.crumb a { text-decoration: none; color: var(--ink-soft); }
.crumb a:hover { color: var(--pine); text-decoration: underline; }

/* ---------------------------------------------------------------------------
   Success / status page
--------------------------------------------------------------------------- */
.status { padding-block: clamp(3rem, 8vw, 6rem); max-width: 40rem; }
.status h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); margin-bottom: 1rem; }
.status .lede { font-size: 1.2rem; margin-bottom: 2rem; }
.status .actions { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; }
.spinner {
  width: 1rem; height: 1rem; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--ink);
  animation: spin .8s linear infinite; display: inline-block; vertical-align: -2px; margin-right: .5rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------------------
   Responsive
--------------------------------------------------------------------------- */
@media (max-width: 56rem) {
  .hero { grid-template-columns: 1fr; gap: 2.5rem; }
  .stack { max-width: 22rem; }
  .grid, .grid.two, .steps { grid-template-columns: 1fr 1fr; }
  .product { grid-template-columns: 1fr; }
  .pmedia { position: static; width: min(100%, 20rem); }
}
@media (max-width: 36rem) {
  .grid, .grid.two, .steps { grid-template-columns: 1fr; }
  .grid { gap: 2rem; }
  .site-head { padding-block: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation-duration: .001s !important; }
}
