/* ============================================================
   You Are The Product — shared stylesheet
   Design tokens ported from The Product Table design system
   (Claude Design project 4c3af94a / _ds/the-product-table-*)
   ============================================================ */

/* --- Fonts ---------------------------------------------------
   Epilogue = body/headings. Caveat = handwritten accent.

   The design specifies "Kopi Senja Sans" for the accent, but that
   font is desktop-licensed only ("You can not resell, share or
   giveaway the font files" — Orenari, 2020), so it cannot legally
   be self-hosted as a webfont on a public site. Caveat is the
   stand-in. If a webfont license is purchased, drop the .otf into
   assets/fonts/ and swap the two marked lines below.
   ------------------------------------------------------------ */
@import url("https://fonts.googleapis.com/css2?family=Epilogue:wght@400;500;600;700;800&family=Caveat:wght@500;600;700&display=swap");

/* SWAP 1 — uncomment when licensed:
@font-face {
  font-family: "Kopi Senja Sans";
  src: url("assets/fonts/KopiSenjaSans.otf") format("opentype");
  font-weight: 400;
  font-display: swap;
}
*/

:root {
  /* Palette — The Product Table sub-brand */
  --dark-green: #26443a;
  --charcoal: #3a3934;
  --cream: #fbfaf6;
  --chartreuse: #def89e;
  --peach: #ff8861;
  --orange: #ee5320;
  --white: #ffffff;

  /* Semantic */
  --surface-page: var(--cream);
  --surface-raised: var(--white);
  --surface-inverse: var(--dark-green);
  --surface-accent: var(--chartreuse);
  --text-body: var(--charcoal);
  --text-heading: var(--dark-green);
  --text-inverse: var(--cream);

  /* Type */
  --font-core: "Epilogue", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Helvetica, Arial, sans-serif;
  /* SWAP 2 — when licensed: "Kopi Senja Sans", "Caveat", cursive */
  --font-accent: "Caveat", "Bradley Hand", cursive;

  /* Layout */
  --measure: 1120px;
  --gutter: 32px;
  --radius-pill: 40px;
  --field-h: 50px;
}

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

/* Any rule setting `display` outranks the browser's own [hidden] default, so
   an element hidden from JS stays on screen — that's how the "Open your copy"
   button showed up on a failed signup. Enforce it once, for everything. */
[hidden] {
  display: none !important;
}

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

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

a {
  color: var(--dark-green);
  text-decoration: underline;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--orange);
}

/* --- Building blocks ----------------------------------------- */
.wrap {
  max-width: var(--measure);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

.overline {
  font-family: var(--font-accent);
  font-size: 34px;
  line-height: 1;
  color: var(--peach);
}

h1,
h2,
h3 {
  color: var(--text-heading);
  font-weight: 700;
  text-wrap: pretty;
  margin: 0;
}

h1 {
  font-size: clamp(30px, 4.6vw, 42px);
  line-height: 1.06;
  letter-spacing: -0.03em;
}

h2 {
  font-size: clamp(28px, 4vw, 36px);
  line-height: 1.12;
  letter-spacing: -0.025em;
}

h3 {
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

p {
  text-wrap: pretty;
  margin: 0;
}

.lede {
  font-size: 18px;
  line-height: 1.6;
  color: rgba(58, 57, 52, 0.88);
}

.fine {
  font-size: 15px;
  line-height: 1.6;
  color: rgba(58, 57, 52, 0.6);
}

/* --- Forms ---------------------------------------------------- */
.field-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 400px;
}

.field {
  height: var(--field-h);
  padding: 0 24px;
  border: 1.5px solid rgba(38, 68, 58, 0.22);
  border-radius: var(--radius-pill);
  background: var(--white);
  font-family: var(--font-core);
  font-size: 16px;
  color: var(--charcoal);
  width: 100%;
}

.field::placeholder {
  color: rgba(58, 57, 52, 0.35);
}

.field:focus {
  outline: 2px solid var(--peach);
  outline-offset: 2px;
}

.btn {
  height: var(--field-h);
  padding: 0 24px;
  border: none;
  border-radius: var(--radius-pill);
  background: var(--peach);
  color: var(--charcoal);
  font-family: var(--font-core);
  font-weight: 700;
  font-size: 17px;
  line-height: 1;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.btn:hover:not(:disabled) {
  background: var(--orange);
  color: var(--cream);
}

.btn:disabled {
  opacity: 0.65;
  cursor: progress;
}

/* Honeypot (.hp) and visually-hidden labels (.sr-only) — same treatment,
   different jobs: .hp catches bots, .sr-only names inputs that only
   carry a placeholder. */
.hp,
.sr-only {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form-error {
  margin-top: 10px;
  font-size: 16px;
  line-height: 1.5;
  color: var(--orange);
  max-width: 400px;
}

.form-error:empty {
  display: none;
}

.form-ok {
  margin-top: 10px;
  font-size: 17px;
  line-height: 1.5;
  font-weight: 600;
  color: var(--dark-green);
  max-width: 400px;
}

.form-ok:empty {
  display: none;
}

/* Button that is actually a link */
.btn--link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  background: var(--cream);
  align-self: start;
}

.btn--link:hover {
  background: var(--white);
  color: var(--charcoal);
}

/* --- Hero ----------------------------------------------------- */
.hero {
  padding-top: 64px;
}

/* Centred, matching the original newsletter page. Only index.html uses it.
   Sized by width, not height: the wordmark is a very wide, short image, so a
   fixed height blew it out to about half the content width. The original
   sits nearer a quarter. */
.site-logo {
  display: block;
  width: clamp(200px, 26%, 300px);
  height: auto;
  margin: 0 auto 56px;
}

/* No border-radius here on purpose. The white frame and the large rounded
   corner are part of montage.png itself — adding a CSS radius clipped the
   artwork a second time and cut the corners oddly. */
.montage {
  width: 100%;
  height: auto;
}

.hero-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 72px;
  align-items: center;
}

/* The newsletter hero leads with the montage — it's the thing that makes the
   page feel like a magazine rather than a form. An even split undersells it,
   so the media column takes the larger share.
   Scoped: /beta uses .hero-grid too, and there the cover should stay smaller
   than the copy beside it. */
.hero-grid--media {
  /* The original runs roughly 33% copy / 61% montage. Matching that exactly
     squeezes the headline at narrower viewports, so this splits the
     difference and leans the montage's way. */
  grid-template-columns: minmax(280px, 0.85fr) minmax(320px, 1.4fr);
  gap: 56px;
}

/* The newsletter submit hugs its label rather than filling the column, as in
   the original. Scoped to this button — /beta's full-width submit is fine as
   it is, sitting under three stacked fields. */
.btn--inline {
  align-self: flex-start;
  padding: 0 44px;
}

@media (max-width: 720px) {
  .hero-grid--media {
    grid-template-columns: 1fr;
  }
}

/* The cadence line is the actual offer — "what you get, how often". The
   original set it bold so it reads as a promise rather than more body copy. */
.lede--offer {
  font-weight: 700;
  color: var(--text-body);
  margin-top: 18px;
}

.cover-hero {
  width: 100%;
  max-width: 460px;
  height: auto;
  margin-inline: auto;
  box-shadow: 0 34px 72px rgba(38, 68, 58, 0.28);
}

.hero h1 {
  margin-top: 14px;
}

.hero .lede {
  margin-top: 22px;
}

.hero .field-stack {
  margin-top: 32px;
}

.hero .fine {
  margin-top: 16px;
  max-width: 400px;
}

/* --- Steps ---------------------------------------------------- */
.steps {
  padding-top: 96px;
}

.steps .overline {
  font-size: 32px;
}

.steps h2 {
  margin-top: 12px;
}

.step-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-top: 36px;
}

.step {
  background: var(--surface-raised);
  border-radius: 0 0 80px 0;
  padding: 34px 36px;
}

.step-num {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--chartreuse);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 19px;
  color: var(--dark-green);
}

.step h3 {
  margin-top: 20px;
}

.step p {
  margin-top: 10px;
  font-size: 18px;
  line-height: 1.6;
  color: rgba(58, 57, 52, 0.8);
}

.step-qs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  font-size: 18px;
  line-height: 1.5;
  color: rgba(58, 57, 52, 0.85);
}

.step-note {
  margin-top: 14px;
  font-size: 17px;
  line-height: 1.6;
  color: rgba(58, 57, 52, 0.65);
}

.steps-outro {
  margin-top: 28px;
  font-size: 18px;
  line-height: 1.6;
  color: rgba(58, 57, 52, 0.7);
}

/* --- Waitlist band -------------------------------------------- */
.waitlist {
  padding-top: 72px;
}

.waitlist-card {
  background: var(--chartreuse);
  border-radius: 20px 160px 20px 20px;
  padding: 44px 52px;
}

.waitlist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 40px;
  align-items: center;
}

.waitlist .overline {
  font-size: 28px;
  color: var(--dark-green);
}

.waitlist h3 {
  margin-top: 10px;
  font-size: 28px;
  line-height: 1.15;
}

.waitlist p {
  margin-top: 12px;
  font-size: 18px;
  line-height: 1.6;
  color: rgba(38, 68, 58, 0.8);
}

.waitlist .field-stack {
  max-width: none;
}

.waitlist .field,
.waitlist .btn {
  background: var(--cream);
  border: none;
  color: var(--charcoal);
}

.waitlist .btn:hover:not(:disabled) {
  background: var(--white);
  color: var(--charcoal);
}

.waitlist .form-error {
  color: var(--dark-green);
  font-weight: 600;
}

/* --- Footer --------------------------------------------------- */
.site-footer {
  position: relative;
  margin-top: 96px;
  background: var(--surface-inverse);
  overflow: hidden;
}

.site-footer::before {
  content: "";
  position: absolute;
  right: -160px;
  top: -180px;
  width: 520px;
  height: 520px;
  background: rgba(255, 136, 97, 0.12);
  border-radius: 50% 0 50% 50%;
  transform: rotate(-45deg);
}

.footer-inner {
  position: relative;
  padding-top: 72px;
  padding-bottom: 56px;
}

.footer-bio {
  display: grid;
  grid-template-columns: 148px 1fr;
  gap: 40px;
  /* Centred against the avatar. Top-aligned made sense when an overline and a
     name heading sat above the bio; with just the paragraph it left the text
     hanging off the top of the photo. */
  align-items: center;
}

.headshot {
  width: 148px;
  height: 148px;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(251, 250, 246, 0.1);
}

.footer-bio strong {
  font-weight: 700;
  color: var(--text-inverse);
}

.footer-bio p {
  font-size: 18px;
  line-height: 1.65;
  color: rgba(251, 250, 246, 0.85);
  max-width: 46em;
}

.footer-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 20px;
  margin-top: 56px;
  padding-top: 28px;
  border-top: 1px solid rgba(251, 250, 246, 0.16);
  font-size: 16px;
  color: rgba(251, 250, 246, 0.6);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
}

.footer-links a {
  color: rgba(251, 250, 246, 0.85);
}

.footer-links a:hover {
  color: var(--peach);
}

/* --- Confirmation / waitlisted -------------------------------- */
.result {
  max-width: 1080px;
  margin: 0 auto;
  padding: 96px var(--gutter) 88px;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 64px;
  align-items: start;
}

.result-grid--center {
  align-items: center;
}

.result h1 {
  margin-top: 16px;
  font-size: clamp(30px, 4.5vw, 42px);
  line-height: 1.1;
}

.result .lede {
  margin-top: 22px;
  font-size: 19px;
}

.result .lede + .lede {
  margin-top: 20px;
}

.result strong {
  font-weight: 700;
  color: var(--dark-green);
}

.cover-sm {
  width: 100%;
  max-width: 280px;
  height: auto;
  margin-inline: auto;
  box-shadow: 0 24px 52px rgba(38, 68, 58, 0.24);
}

/* Status card — progress while copying, then the link */
.status {
  margin-top: 32px;
  background: var(--chartreuse);
  border-radius: 20px 80px 20px 20px;
  padding: 30px 36px;
}

.status-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.status-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--peach);
  flex: none;
}

.status[data-state="working"] .status-dot {
  animation: pulse 1.1s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.25;
  }
}

.status-label {
  font-size: 19px;
  font-weight: 600;
  color: var(--dark-green);
}

.status-bar {
  margin-top: 20px;
  height: 6px;
  border-radius: 3px;
  background: rgba(38, 68, 58, 0.15);
  overflow: hidden;
}

.status-bar span {
  display: block;
  height: 100%;
  width: 15%;
  background: var(--dark-green);
  border-radius: 3px;
  transition: width 0.4s ease;
}

.status[data-state="working"] .status-bar span {
  animation: crawl 6s ease-out forwards;
}

@keyframes crawl {
  from {
    width: 15%;
  }
  to {
    width: 85%;
  }
}

.status[data-state="done"] .status-bar,
.status[data-state="error"] .status-bar {
  display: none;
}

.status[data-state="done"] .status-dot {
  background: var(--dark-green);
}

.status[data-state="error"] {
  background: #ffe3d8;
}

.status[data-state="error"] .status-dot {
  background: var(--orange);
}

.status[data-state="error"] .status-label {
  font-weight: 500;
  line-height: 1.5;
  color: var(--charcoal);
}

.status-link {
  display: inline-block;
  margin-top: 18px;
  padding: 0 28px;
  height: var(--field-h);
  line-height: var(--field-h);
  border-radius: var(--radius-pill);
  background: var(--dark-green);
  color: var(--cream);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.03em;
  text-decoration: none;
}

.status-link:hover {
  background: var(--charcoal);
  color: var(--cream);
}

.result-notes {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 36px;
  font-size: 18px;
  line-height: 1.6;
  color: rgba(58, 57, 52, 0.85);
}

.result-help {
  margin-top: 36px;
  font-size: 17px;
  line-height: 1.6;
  color: rgba(58, 57, 52, 0.6);
}

.result-back {
  margin-top: 28px;
  font-size: 16px;
}

/* --- Responsive ------------------------------------------------ */
@media (max-width: 720px) {
  :root {
    --gutter: 20px;
  }

  .hero {
    padding-top: 40px;
  }

  .hero-grid {
    gap: 40px;
  }

  /* Copy first, cover second on small screens */
  .hero-cover {
    order: 2;
  }

  .steps {
    padding-top: 64px;
  }

  .step {
    padding: 28px 26px;
    border-radius: 0 0 56px 0;
  }

  .waitlist-card {
    padding: 32px 26px;
    border-radius: 16px 90px 16px 16px;
  }

  .footer-bio {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .site-footer {
    margin-top: 64px;
  }

  .result {
    padding: 56px var(--gutter) 64px;
  }

  .result-grid {
    gap: 40px;
  }

  .status {
    padding: 24px 26px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* --- Book preview: contents + excerpt ---------------------------
   Two different jobs, so two different treatments. The contents is a
   contents page — a reading object with real hierarchy, not a grid of
   cards. The excerpt is prose, which needs a far narrower column than
   the rest of the site.
   ---------------------------------------------------------------- */

.preview {
  padding-top: 96px;
}

/* Two columns, but still bounded — a contents page that spans the full 1120px
   shell stops looking like a book and starts looking like a sitemap.
   Grid rather than CSS columns on purpose: multi-column would happily split a
   part across the gutter, orphaning chapters from their year. */
.toc {
  list-style: none;
  margin: 36px 0 0;
  padding: 0;
  max-width: 920px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 34px 56px;
  align-items: start;
}

/* Introduction has no chapters under it, so it reads as a heading line across
   the top rather than a near-empty first cell. */
.toc-part--front {
  grid-column: 1 / -1;
}

.toc-part-title {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-heading);
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(38, 68, 58, 0.18);
}

.toc-part-num {
  display: block;
  margin-bottom: 5px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(58, 57, 52, 0.45);
}

.toc-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
}

/* The indent step is the whole point of a contents page: it tells you the
   shape of the book at a glance. Lessons sit well inside their chapter
   rather than a token few pixels in. */
.toc-chapter {
  padding: 5px 0 5px 22px;
  font-size: 17px;
  line-height: 1.45;
  color: rgba(58, 57, 52, 0.9);
}

.toc-lesson {
  padding: 3px 0 3px 56px;
  font-size: 15px;
  line-height: 1.45;
  color: rgba(58, 57, 52, 0.6);
}

/* Full-bleed white so the excerpt reads as a different surface — you have
   moved from the landing page onto the page of a book. */
.excerpt {
  margin-top: 96px;
  padding: 80px var(--gutter) 88px;
  background: var(--surface-raised);
}

.excerpt-inner {
  max-width: 640px;
  margin: 0 auto;
}

/* The measure is the whole trick. Body copy this size wants 60-70 characters
   a line; the site's 1120px shell is roughly double that and is what makes
   long text feel like a wall. */
.prose {
  margin-top: 28px;
  font-size: 19px;
  line-height: 1.75;
  color: var(--text-body);
}

.prose p + p {
  margin-top: 1.15em;
}

.prose strong {
  font-weight: 700;
  color: var(--text-heading);
}

/* Drop cap on the first real paragraph — a small signal that the book has
   started and this is no longer marketing copy. */
.prose-open::first-letter {
  float: left;
  font-size: 58px;
  line-height: 0.82;
  font-weight: 800;
  color: var(--text-heading);
  padding: 6px 10px 0 0;
}

/* Pull quotes carry the passages the manuscript already sets in bold. Kept
   quiet deliberately: no rule, no accent colour, and lighter than the body
   around them, so they read as a change of pace rather than a shout. */
/* Set at the same size and leading as the paragraphs around it — the weight
   and the rule do the distinguishing, not scale. */
.pull {
  margin: 34px 0;
  padding: 2px 0 2px 24px;
  border-left: 2px solid rgba(58, 57, 52, 0.25);
  font-size: inherit;
  line-height: inherit;
  font-weight: 700;
  color: var(--text-heading);
}

.signature {
  width: 110px;
  height: auto;
  margin: 26px 0 0;
}

.excerpt-signup {
  margin-top: 44px;
  padding-top: 30px;
  border-top: 1.5px solid rgba(38, 68, 58, 0.14);
}

.excerpt-signup-label {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-heading);
}

/* The hero's form stacks; this one runs as a single line under the excerpt,
   where a tall stack would push the ask too far down the page. */
.field-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.field-row .field {
  flex: 1 1 140px;
  width: auto;
  min-width: 0;
  padding: 0 18px;
}

.field-row .btn {
  flex: 0 0 auto;
  padding: 0 26px;
}

@media (max-width: 720px) {
  .preview {
    padding-top: 64px;
  }

  .toc-chapter {
    padding-left: 16px;
  }

  .toc-lesson {
    padding-left: 40px;
  }

  .excerpt {
    margin-top: 64px;
    padding: 56px var(--gutter) 64px;
  }

  .prose {
    font-size: 18px;
  }

  .pull {
    margin: 26px 0;
  }

  /* One line becomes four on a phone — a 140px minimum would squeeze three
     fields and a button into unusable slivers.
     flex-basis has to be reset with it: basis applies to the MAIN axis, so
     once this column-direction, the row's `flex: 1 1 140px` stops meaning
     "at least 140px wide" and starts meaning "140px TALL", which is what it
     did — fields rendered at 140px against the button's 50px. */
  .field-row {
    flex-direction: column;
  }

  .field-row .field,
  .field-row .btn {
    width: 100%;
    flex: 0 0 auto;
  }
}

/* Sits on the chartreuse card, so it needs more contrast than .fine's
   default grey gives it. Small print proper — it's a footnote to the field
   above it, not a line of copy. */
/* Scoped through .waitlist deliberately: `.waitlist p` above is a class plus
   an element, which outranks a bare class, so `.waitlist-fine` alone lost the
   font-size fight and the line stayed at 18px. */
.waitlist .waitlist-fine {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
  color: rgba(38, 68, 58, 0.6);
}

/* Magazine-style float: the photo sits top-right of the opening and the text
   runs around it. Opposite side to the drop cap on purpose — the two frame
   the first paragraph rather than fighting over the same edge. */
.prose-figure {
  float: right;
  width: 200px;
  margin: 6px 0 22px 30px;
}

.prose-figure img {
  width: 100%;
  height: auto;
  /* One oversized corner, echoing the cards elsewhere on the site. */
  border-radius: 4px 44px 4px 4px;
}

/* The float is the last thing in the flow if the text runs short, so contain
   it — otherwise the signature and signup below would ride up beside it. */
.prose::after {
  content: "";
  display: block;
  clear: both;
}

@media (max-width: 720px) {
  /* A 200px float on a phone leaves a column too narrow to read. Centre it
     instead and let the text run full width above and below. */
  .prose-figure {
    float: none;
    width: 62%;
    margin: 4px auto 24px;
  }
}
