/* Fonts (Source Serif 4, Manrope, Courier Prime, Caveat) are loaded once,
   non-blocking, in cast-templates/layout.php — do not re-@import here (it
   double-fetches Manrope + Courier Prime and serializes behind this sheet). */

/* Thanks template — the post-form confirmation page: the contact study's
   design language replayed as a receipt. Same palette, type, and torn-paper
   edges; the dark band lists what happens next as a numbered step list.
   Everything is scoped under .thanks-study so partials and utilities stay
   untouched. */

.thanks-study {
  --paper: #f5f5f1;
  --paper-2: #ffffff;
  --ink: #282825;
  --ink-soft: #55565e;
  --gray: #8f8f89;
  --line: #d6d6cf;
  --dark: #292a2e;
  --darker: #1d1e20;
  --brand-red-soft: #980f0f;
  --teal: #0c7a5c;
  --mint: #73e2bd;
  --acid: #d8ff59;
  --brand-red: #980f0f;

  --display: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Manrope", ui-sans-serif, system-ui, sans-serif;
  --mono: "Courier Prime", "Courier New", monospace;
  --hand: "Caveat", "Segoe Script", cursive;
  --copy-size: 1.3125rem;
  --eyebrow-size: .875rem;

  --nav-h: 4.5rem;
  --pad-x: max(6vw, calc((100vw - 1180px) / 2));

  /* Scoped utility-token bridge (AI_GUIDE.md “Scoped token bridges”): the
     semantic utility tokens are re-pointed at this section's palette so
     bg-/text- utilities inside .thanks-study speak the study's design instead
     of the global one. Declared here, never on :root; --color-primary-text is
     the verified pairing for bg-primary against this section's --brand-red.
     Note: root-derived tokens (e.g. --color-accent-soft) are NOT recomputed
     by these overrides — see the guide before relying on a derived token. */
  --color-bg: var(--paper);
  --color-surface: var(--paper);
  --color-surface-2: var(--paper-2);
  --color-text: var(--ink);
  --color-muted: var(--ink-soft);
  --color-primary: var(--brand-red);
  --color-primary-text: #fff;
  --color-border: var(--line);
}

.thanks-study * { box-sizing: border-box; }
/* Background and ink arrive as the bg-background/text-text utilities in
   template.php; they resolve through the --color-bg/--color-text bridge above. */
.thanks-study {
  margin: 0;
  font: 400 1rem/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
  overflow-x: clip;
}
.thanks-study a { color: inherit; text-decoration: none; }
.thanks-study ::selection { background: var(--brand-red); color: #fff; }
.thanks-study :focus-visible { outline: 2px solid var(--brand-red); outline-offset: 3px; }
.thanks-study b, .thanks-study i, .thanks-study em, .thanks-study u, .thanks-study span { margin: 0; }
.thanks-study h1, .thanks-study h2 { font-optical-sizing: auto; }

/* Shared shapes (mirroring the contact study's component vocabulary). */
.thanks-study .eyebrow {
  margin: 0 0 .5rem;
  font: 700 var(--eyebrow-size)/1.5 var(--mono);
  letter-spacing: .22em; text-transform: uppercase;
}
.thanks-study .eyebrow.ink { color: var(--teal); }
.thanks-study .mono-label { margin: 0; font: 700 var(--eyebrow-size)/1.5 var(--mono); letter-spacing: .2em; text-transform: uppercase; }
.thanks-study .edge { height: 120px; }
.thanks-study .wave-top { top: 1px; transform: translateY(-99%); height: 96px; }
.thanks-study .wave-top path { fill: var(--paper); }

.thanks-study .button {
  border: 1.5px solid currentColor;
  padding: .95rem 1.6rem;
  font: 700 .85rem var(--sans);
  transition: transform .25s ease, background .25s ease, color .25s ease;
}
.thanks-study .button:hover { transform: translateY(-2px); }
.thanks-study .button.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.thanks-study .button.primary:hover { background: var(--brand-red); border-color: var(--brand-red); }

/* Hero — the paper confirmation. Set like the contact hero: title + accent,
   roomy copy, handwritten aside, doodle at the side. */
.thanks-study .thanks-hero {
  padding: clamp(5rem, 8vw, 8rem) var(--pad-x) clamp(4rem, 7vw, 6.5rem);
  background: var(--paper);
}
.thanks-study .hero-inner {
  max-width: 1180px;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(240px, 400px);
  gap: var(--space-12);
  align-items: center;
}
.thanks-study .thanks-hero h1 {
  margin: var(--space-6) 0 var(--space-8);
  font: 340 clamp(2.8rem, 4.7vw, 4.6rem)/1.06 var(--display);
  letter-spacing: -.03em;
  text-wrap: balance;
}
.thanks-study .hero-accent { font-style: italic; color: var(--brand-red); }
.thanks-study .hero-copy {
  max-width: 52ch;
  /* Muted ink arrives as the text-muted utility in template.php, resolving
     through the bridge to --ink-soft. */
  font: 400 var(--copy-size)/1.55 var(--sans);
}
.thanks-study .hero-copy p { margin: 0 0 var(--space-6); }
.thanks-study .hero-copy p:last-child { margin-bottom: 0; }
.thanks-study .hero-copy em { font-style: italic; color: var(--brand-red); }
.thanks-study .hero-copy strong {
  color: var(--ink);
  font-weight: 600;
  background: linear-gradient(transparent 65%, color-mix(in srgb, var(--brand-red-soft) 25%, transparent) 65% 92%, transparent 92%);
}
/* Handwritten aside — rotation uses the `rotate` property so the reveal
   transform never flattens it. */
.thanks-study .hand-note {
  margin: var(--space-12) 0 0;
  font: 600 1.45rem/1.25 var(--hand);
  color: color-mix(in srgb, var(--ink) 62%, var(--paper));
  rotate: -1.75deg;
  transform-origin: left center;
}
/* Hero doodle — hand-drawn spot illustration. An empty hero_image slot keeps
   the built-in doodle (steaming mug, checked stamp); uploading an
   illustration replaces it. Slightly rotated like a scrapbook find. */
.thanks-study .hero-doodle {
  position: relative;
  justify-self: center;
  width: min(100%, 380px);
  rotate: -2deg;
}
.thanks-study .hero-doodle .doodle-art { display: block; width: 100%; height: auto; }
/* Single-weight, round-capped hand strokes — the doodle's whole vocabulary. */
.thanks-study .hero-doodle svg path {
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.thanks-study .hero-doodle .d-ink  { stroke: var(--ink); }
.thanks-study .hero-doodle .d-soft { stroke: color-mix(in srgb, var(--ink) 55%, var(--paper)); }
.thanks-study .hero-doodle .d-red  { stroke: var(--brand-red-soft); }

/* Next — the dark band: what happens after the note lands. Headline on the
   left, an automatically numbered step list on the right; same layering as
   the contact desk band. */
.thanks-study .thanks-next {
  padding: clamp(5rem, 8vw, 8rem) var(--pad-x) clamp(7rem, 11vw, 10rem);
  background: var(--dark);
  color: var(--paper);
  box-shadow: 0 -24px 42px rgba(40, 40, 35, .12);
}
.thanks-study .next-layout {
  max-width: 1100px;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  gap: var(--space-8) clamp(3rem, 7vw, 7rem);
}
.thanks-study .next-direct .mono-label { color: var(--brand-red-soft); }
.thanks-study .next-headline {
  margin: var(--space-4) 0 0;
  font: italic 300 clamp(2rem, 3.6vw, 3.2rem)/1.08 var(--display);
  letter-spacing: -.02em;
  color: var(--paper);
  text-wrap: balance;
}
/* Numbered steps — numbers come from the CSS counter, so editors just add,
   remove, and reorder items in the canvas. */
.thanks-study .steps { list-style: none; counter-reset: step; display: grid; }
.thanks-study .step {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: var(--space-6);
  padding: var(--space-6) 0;
  border-top: 1px solid rgba(255, 255, 255, .14);
  counter-increment: step;
}
.thanks-study .step::before {
  content: counter(step, decimal-leading-zero);
  grid-row: 1 / span 2;
  margin-top: .35rem;
  font: 700 var(--eyebrow-size)/1.5 var(--mono);
  letter-spacing: .1em;
  color: var(--mint);
}
.thanks-study .step:last-child { border-bottom: 1px solid rgba(255, 255, 255, .14); }
.thanks-study .step-title {
  margin: 0 0 .5rem;
  font: 400 clamp(1.35rem, 2.2vw, 1.75rem)/1.15 var(--display);
  letter-spacing: -.02em;
  color: var(--paper);
}
.thanks-study .step-desc {
  max-width: 56ch;
  font: 400 1rem/1.65 var(--sans);
  color: color-mix(in srgb, var(--paper) 68%, var(--dark));
}
.thanks-study .step-desc p { margin: 0 0 .6em; }
.thanks-study .step-desc p:last-child { margin-bottom: 0; }

/* Close — paper section swept in over the dark band by the torn-paper wave,
   pointing the visitor back into the site. */
.thanks-study .thanks-close {
  padding: clamp(7rem, 11vw, 10rem) var(--pad-x) clamp(7rem, 10vw, 9rem);
  background: var(--paper);
}
.thanks-study .close-inner { max-width: 1180px; }
.thanks-study .thanks-close h2 {
  margin: var(--space-6) 0 var(--space-8);
  font: 400 clamp(2.8rem, 4.7vw, 4.6rem)/1.06 var(--display);
  letter-spacing: -.03em;
  text-wrap: balance;
}
.thanks-study .close-copy {
  max-width: 52ch;
  /* Same text-muted bridge as .hero-copy. */
  font: 400 var(--copy-size)/1.55 var(--sans);
}
.thanks-study .close-copy p { margin: 0 0 var(--space-6); }
.thanks-study .close-copy p:last-child { margin-bottom: 0; }
.thanks-study .close-copy em { font-style: italic; color: var(--brand-red); }

/* Reveal-on-scroll — motion.js adds .thanks-js and the observer; without
   it (canvas, no-JS, reduced motion) everything stays visible. */
.thanks-js .thanks-study .reveal { opacity: 0; transform: translateY(30px); transition: opacity .8s cubic-bezier(.2, .6, .2, 1), transform .8s cubic-bezier(.2, .6, .2, 1); transition-delay: var(--d, 0s); }
.thanks-js .thanks-study .reveal.is-visible { opacity: 1; transform: none; }

@media (max-width: 900px) {
  .thanks-study .next-layout { grid-template-columns: minmax(0, 1fr); gap: var(--space-12); }
  .thanks-study .hero-inner { grid-template-columns: minmax(0, 1fr); gap: var(--space-8); }
  .thanks-study .hero-doodle { justify-self: start; width: min(78%, 300px); }
}
@media (max-width: 760px) {
  .thanks-study { --nav-h: 58px; }
  .thanks-study .edge { height: 70px; }
  .thanks-study .hero-doodle { width: min(84%, 270px); }
}

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