/* Book My Life landing page.
   Palette mirrors constants/theme.ts so the site and the app read as one product.
   Legal pages keep using /styles.css; this file only styles the homepage. */

@font-face {
  font-family: 'Newsreader';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('/assets/fonts/newsreader-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Newsreader';
  font-style: italic;
  font-weight: 300 700;
  font-display: swap;
  src: url('/assets/fonts/newsreader-italic-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('/assets/fonts/manrope-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Caveat';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/assets/fonts/caveat-600.woff') format('woff');
}

:root {
  --cream: #FAF6F0;
  --cream-deep: #F2EBE0;
  --paper: #FFFDF9;
  --ink: #2C2421;
  --ink-soft: #5A4F49;
  --muted: #9B8E84;
  --clay: #C4886B;
  --clay-dark: #A36F54;
  --clay-deep: #8A573F;   /* accessible text/button shade of the app accent */
  --border: #E5DCD0;
  --walnut: #231C19;
  --gold: #D8B075;

  --serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --sans: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --hand: 'Caveat', 'Segoe Print', 'Bradley Hand', cursive;

  --gutter: clamp(16px, 5vw, 64px);
  --measure: 34rem;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; height: auto; }
p { margin: 0; }
h1, h2, h3 { margin: 0; font-weight: 400; }

a { color: var(--clay-deep); }
:focus-visible { outline: 3px solid var(--clay-deep); outline-offset: 3px; border-radius: 4px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.skip {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--ink); color: var(--cream); padding: 10px 14px; border-radius: 8px;
}
.skip:focus { top: 12px; }

.scrawl {
  font-family: var(--hand);
  font-weight: 600;
  color: var(--clay-deep);
  line-height: 1.1;
}

/* ---------- buttons & links ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 24px;
  border-radius: 999px;
  background: var(--clay-deep);
  color: #FFF8F1;
  font-weight: 700; font-size: 1rem; text-decoration: none;
  box-shadow: 0 2px 0 #6E4330;
  transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.btn:hover { background: #7A4B35; transform: translateY(-1px); box-shadow: 0 3px 0 #5E3828; }
.btn:active { transform: translateY(1px); box-shadow: 0 1px 0 #5E3828; }
.btn-small { min-height: 40px; padding: 0 18px; font-size: .9375rem; }
.btn-light { background: var(--cream); color: var(--walnut); box-shadow: 0 2px 0 #C9B9A6; }
.btn-light:hover { background: #FFFFFF; box-shadow: 0 3px 0 #C9B9A6; }

.link {
  font-weight: 700; text-decoration: underline;
  text-decoration-thickness: 2px; text-underline-offset: 5px;
  text-decoration-color: color-mix(in srgb, var(--clay) 55%, transparent);
}
.link:hover { text-decoration-color: var(--clay-deep); }

/* ---------- header ---------- */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 20px var(--gutter);
  max-width: 1240px; margin: 0 auto;
}
.wordmark {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--ink); text-decoration: none;
  font-family: var(--serif); font-size: 1.3rem; letter-spacing: -.01em;
}
.wordmark img { width: 32px; height: 32px; border-radius: 8px; }
.top nav { display: flex; align-items: center; gap: clamp(12px, 3vw, 28px); }
.top nav a:not(.btn) { color: var(--ink-soft); text-decoration: none; font-weight: 600; font-size: .9375rem; }
.top nav a:not(.btn):hover { color: var(--ink); }

/* ---------- hero ---------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  align-items: center;
  gap: clamp(24px, 4vw, 56px);
  max-width: 1240px; margin: 0 auto;
  padding: clamp(24px, 5vw, 72px) var(--gutter) clamp(56px, 8vw, 112px);
}
.hero h1 {
  font-family: var(--serif);
  font-weight: 360;
  font-size: clamp(2.75rem, 6.2vw, 5.4rem);
  line-height: 1.0;
  letter-spacing: -.028em;
  max-width: 9ch;
  text-wrap: balance;
}
.lede {
  margin-top: 24px;
  max-width: 28rem;
  font-size: clamp(1.0625rem, 1.5vw, 1.25rem);
  color: var(--ink-soft);
}
.cta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 28px; margin-top: 32px; }
.fineprint { margin-top: 16px; font-size: .875rem; color: var(--muted); }

/* ---------- the book ---------- */
.stage {
  position: relative;
  container-type: inline-size;
  perspective: 2400px;
  padding: 24px 0 56px;
}
.book {
  --pw: min(47cqi, 290px);           /* one page */
  --ph: calc(var(--pw) * 1.4);
  --turn: 1.15s;
  position: relative;
  width: calc(var(--pw) * 2);
  height: var(--ph);
  margin: 0 auto;
  transform-style: preserve-3d;
  transform: translateX(0) rotateX(6deg);
  transition: transform 1.1s cubic-bezier(.55, .05, .25, 1);
  font-size: calc(var(--pw) * .052);
}
.book[data-state="closed"] { transform: translateX(-25%) rotateX(10deg) rotateZ(-3deg); }

/* back board: peeks out around the right-hand pages */
.book::before {
  content: '';
  position: absolute;
  left: 50%; top: -2.5%;
  width: 52.5%; height: 105%;
  border-radius: 2px 10px 10px 2px;
  background: linear-gradient(160deg, #B97C5F, #8E5A42);
  box-shadow: 0 40px 60px -30px rgba(44, 36, 33, .55), 0 12px 24px -12px rgba(44, 36, 33, .35);
  transform: translateZ(-2px);
}
/* front board's inside, revealed on the left once the cover turns */
.book::after {
  content: '';
  position: absolute;
  right: 50%; top: -2.5%;
  width: 52.5%; height: 105%;
  border-radius: 10px 2px 2px 10px;
  background: linear-gradient(200deg, #B97C5F, #8E5A42);
  box-shadow: 0 40px 60px -30px rgba(44, 36, 33, .55);
  transform: translateZ(-2px);
  opacity: 0;
  transition: opacity .2s linear .45s;
}
.book[data-state="open"]::after { opacity: 1; }

.leaf, .base {
  position: absolute;
  left: 50%; top: 0;
  width: 50%; height: 100%;
}
.leaf {
  transform-origin: left center;
  transform-style: preserve-3d;
  transition: transform var(--turn) cubic-bezier(.6, .04, .3, 1);
  z-index: calc(10 - var(--i));
}
.leaf:nth-child(1) { --i: 0; }
.leaf:nth-child(2) { --i: 1; }
.leaf:nth-child(3) { --i: 2; }
.leaf.turned { transform: rotateY(-180deg); z-index: calc(10 + var(--i)); }
.leaf:first-child { top: -2.5%; height: 105%; width: 52.5%; }   /* the cover is a board, slightly larger than the pages */
.base { z-index: 1; overflow: hidden; }

.face {
  position: absolute; inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
}
.face.back { transform: rotateY(180deg); }

.page, .base {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  padding: 13% 12% 10%;
  display: flex; flex-direction: column;
}
/* gutter shadow on the spine side */
.front.page, .base { background-image: linear-gradient(90deg, rgba(90, 60, 40, .16), rgba(90, 60, 40, 0) 12%); border-radius: 0 4px 4px 0; }
.back.page { background-image: linear-gradient(270deg, rgba(90, 60, 40, .16), rgba(90, 60, 40, 0) 12%); border-radius: 4px 0 0 4px; }
/* the page block's edge, so it reads as a stack and not a sheet */
.base { box-shadow: 1px 0 0 #EDE3D6, 2px 1px 0 #E2D6C6, 3px 1px 0 #EDE3D6, 4px 2px 0 #DCCDBB; }

.page-date { font-family: var(--sans); font-size: .78em; font-weight: 600; color: var(--muted); }
.page-title { font-size: 1.62em; line-height: 1.12; letter-spacing: -.015em; margin-top: .45em; text-wrap: balance; }
.page-body { font-size: 1em; line-height: 1.5; margin-top: .8em; color: #3D3330; }
.folio { margin-top: auto; align-self: center; font-family: var(--serif); font-size: .8em; color: var(--muted); }
.margin-note { font-size: 1.45em; transform: rotate(-4deg); margin-top: .7em; align-self: flex-end; text-align: right; max-width: 85%; }
.margin-note::before { content: '\2191\00a0'; font-family: var(--sans); font-size: .7em; }

.dropcap::first-letter {
  float: left;
  font-size: 3.3em; line-height: .85;
  padding: .06em .08em 0 0;
  color: var(--clay-dark);
}

/* cover */
.cover {
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .025) 0 2px, rgba(0, 0, 0, .02) 2px 4px),
    linear-gradient(150deg, #CB9174 0%, #B47657 55%, #9C6248 100%);
  border-radius: 2px 10px 10px 2px;
  box-shadow: inset 6px 0 10px -4px rgba(0, 0, 0, .35), inset -1px 0 0 rgba(255, 255, 255, .15);
  color: #F8EADB;
  padding: 9%;
}
.cover-frame {
  height: 100%;
  border: 1px solid rgba(248, 234, 219, .35);
  outline: 1px solid rgba(248, 234, 219, .18); outline-offset: 5px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  font-family: var(--serif);
}
.cover-kicker { font-family: var(--sans); font-size: .62em; font-weight: 700; letter-spacing: .32em; opacity: .8; }
.cover-title { font-size: 3.1em; line-height: 1; letter-spacing: -.02em; margin-top: .35em; }
.cover-sub { font-style: italic; font-size: 1.15em; margin-top: .4em; opacity: .92; }
.cover-rule { width: 22%; height: 1px; background: var(--gold); margin: 1.3em 0 1.1em; }
.cover-author { font-family: var(--sans); font-size: .72em; font-weight: 700; letter-spacing: .3em; }
.ribbon {
  position: absolute; right: 16%; top: 0;
  width: 7%; height: 26%;
  background: linear-gradient(90deg, #C99A5E, var(--gold) 45%, #B9884F);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 84%, 0 100%);
}

/* endpaper */
.endpaper {
  background-color: #F1E4D4;
  background-image:
    radial-gradient(circle at 25% 25%, rgba(196, 136, 107, .22) 0 6%, transparent 7%),
    radial-gradient(circle at 75% 75%, rgba(196, 136, 107, .16) 0 4%, transparent 5%);
  background-size: 14% 10%;
  border-radius: 10px 2px 2px 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  font-family: var(--serif);
}
.ex-libris {
  font-style: italic; font-size: 1.05em; color: var(--ink-soft);
  background: var(--paper); padding: .9em 1.4em .2em; border-radius: 6px 6px 0 0;
}
.owner {
  font-size: 2.3em; background: var(--paper); padding: 0 .7em .45em; border-radius: 0 0 6px 6px;
  transform: rotate(-3deg);
}
.doodle.heart { width: 2.6em; margin-top: 1em; fill: none; stroke: var(--clay); stroke-width: 2.4; stroke-linecap: round; transform: rotate(10deg); }

/* plate */
.plate { padding: 12% 11% 10%; }
.plate img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 2px; box-shadow: 0 0 0 1px rgba(44, 36, 33, .08); }
.plate-caption { font-style: italic; font-size: .95em; color: var(--ink-soft); margin-top: .9em; text-align: center; text-wrap: balance; }

/* question */
.question-text { font-style: italic; font-size: 1.75em; line-height: 1.15; letter-spacing: -.01em; margin-top: .6em; text-wrap: balance; }
.answer {
  font-size: 1.6em; margin-top: 1em;
  background-image: repeating-linear-gradient(transparent 0 1.02em, rgba(196, 136, 107, .35) 1.02em calc(1.02em + 1px));
  padding-bottom: .1em;
}

/* chapter mark */
.chapter-mark { align-items: center; justify-content: center; text-align: center; }
.chapter-num { font-size: 4.6em; line-height: 1; color: var(--clay); margin-top: auto; }
.chapter-label { font-style: italic; font-size: 1.15em; color: var(--ink-soft); margin-top: .3em; margin-bottom: auto; }
.chapter-mark .folio { margin-top: 0; }

/* the whole book is one big button */
.book-hit {
  position: absolute; inset: -3% -2%;
  z-index: 60;
  background: transparent; border: 0; padding: 0;
  cursor: pointer;
  transform: translateZ(40px);
  border-radius: 12px;
}

.hint {
  position: absolute; right: max(0px, calc(50% - var(--hint-x, 300px))); bottom: 0;
  display: flex; align-items: flex-start; gap: 4px;
  font-size: 1.6rem;
  transform: rotate(-4deg);
  opacity: 0;
  transition: opacity .5s ease .2s;
  pointer-events: none;
}
.hint svg { width: 56px; height: 34px; fill: none; stroke: var(--clay-deep); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; transform: scale(-1, -1) translateY(8px); }
.stage[data-hint] .hint { opacity: 1; }

/* ---------- how it works ---------- */
.how {
  background: var(--cream-deep);
  padding: clamp(64px, 9vw, 120px) var(--gutter);
  border-block: 1px solid var(--border);
}
.how h2, .helper h2, .private h2, .finale h2 {
  font-family: var(--serif);
  font-size: clamp(2.1rem, 4.2vw, 3.4rem);
  line-height: 1.05;
  letter-spacing: -.022em;
  text-wrap: balance;
}
.how h2 { max-width: 1240px; margin: 0 auto; }
.steps {
  list-style: none; margin: clamp(40px, 6vw, 72px) auto 0; padding: 0;
  max-width: 1240px;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(24px, 3vw, 44px);
}
.step:nth-child(1) .taped { rotate: -2.2deg; }
.step:nth-child(2) .taped { rotate: 1.6deg; margin-top: 28px; }
.step:nth-child(3) .taped { rotate: -1deg; }
.step:nth-child(4) .taped { rotate: 2.4deg; margin-top: 28px; }

.taped {
  position: relative;
  margin: 0;
  max-width: 250px;
  margin-inline: auto;
}
.taped img { filter: drop-shadow(0 18px 22px rgba(44, 36, 33, .22)); }
.taped::before {
  content: '';
  position: absolute; left: 50%; top: -14px; z-index: 2;
  width: 44%; height: 30px;
  translate: -50% 0; rotate: -3deg;
  background: rgba(232, 214, 190, .78);
  box-shadow: 0 1px 2px rgba(44, 36, 33, .12);
  clip-path: polygon(2% 0, 98% 4%, 100% 30%, 97% 60%, 100% 100%, 3% 96%, 0 70%, 3% 40%);
}
.step-copy { position: relative; margin-top: 28px; padding-left: 52px; }
.step-num {
  position: absolute; left: 0; top: -4px;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  font-family: var(--hand); font-weight: 600; font-size: 1.7rem; color: var(--clay-deep);
  border: 2px solid var(--clay);
  border-radius: 52% 46% 55% 44% / 48% 56% 44% 52%;
  rotate: -8deg;
}
.step h3 { font-family: var(--serif); font-size: 1.45rem; line-height: 1.2; letter-spacing: -.01em; }
.step p { margin-top: 6px; color: var(--ink-soft); font-size: 1rem; }
.step .aside { margin-top: 10px; font-size: 1.45rem; color: var(--clay-deep); rotate: -3deg; transform-origin: left; }

/* ---------- writing help ---------- */
.helper {
  display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
  gap: clamp(32px, 6vw, 96px);
  align-items: center;
  max-width: 1120px; margin: 0 auto;
  padding: clamp(72px, 10vw, 136px) var(--gutter);
}
.helper-phone { rotate: -3deg; max-width: 280px; }
.helper-copy > p { margin-top: 20px; max-width: var(--measure); color: var(--ink-soft); font-size: 1.125rem; }

.styles { margin-top: 48px; padding-top: 32px; border-top: 1px dashed var(--border); }
.styles h3 { font-family: var(--serif); font-size: 1.6rem; letter-spacing: -.01em; }
.styles > p { margin-top: 6px; color: var(--ink-soft); max-width: var(--measure); }
.style-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.style-tabs button {
  font: inherit; font-weight: 700; font-size: .9375rem;
  min-height: 44px; padding: 0 18px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--paper); color: var(--ink-soft);
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.style-tabs button:hover { border-color: var(--clay); color: var(--ink); }
.style-tabs button[aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: var(--cream); }
.style-print {
  margin-top: 20px;
  max-width: 420px;
  background: var(--paper);
  padding: 12px 12px 14px;
  border-radius: 3px;
  rotate: 1.2deg;
  box-shadow: 0 22px 34px -20px rgba(44, 36, 33, .5), 0 0 0 1px rgba(44, 36, 33, .05);
}
.style-print img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; transition: opacity .25s ease; }
.style-print img.swapping { opacity: 0; }

/* ---------- privacy ---------- */
.private {
  max-width: 1120px; margin: 0 auto;
  padding: 0 var(--gutter) clamp(72px, 10vw, 136px);
}
.private ul { list-style: none; margin: 28px 0 24px; padding: 0; display: grid; gap: 14px; max-width: var(--measure); }
.private li { position: relative; padding-left: 36px; font-size: 1.125rem; }
.private li::before {
  content: '';
  position: absolute; left: 6px; top: .28em;
  width: 9px; height: 16px;
  border: solid var(--clay-dark); border-width: 0 3px 3px 0;
  border-radius: 1px 1px 3px 1px;
  rotate: 40deg;
}

/* ---------- finale ---------- */
.finale {
  background: var(--walnut);
  color: var(--cream);
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  align-items: center;
  gap: clamp(32px, 6vw, 80px);
  padding: clamp(64px, 9vw, 120px) max(var(--gutter), calc((100vw - 1120px) / 2));
}
.finale-art { width: 100%; max-width: 460px; border-radius: 6px; rotate: -2deg; box-shadow: 0 30px 50px -24px rgba(0, 0, 0, .7); }
.finale p { margin-top: 18px; color: #D8CFC4; font-size: 1.125rem; max-width: 26rem; }
.finale .btn { margin-top: 32px; }
.finale :focus-visible { outline-color: var(--gold); }

/* ---------- footer ---------- */
.foot {
  max-width: 1240px; margin: 0 auto;
  padding: 40px var(--gutter) 56px;
  color: var(--muted); font-size: .875rem;
}
.foot nav { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-bottom: 16px; }
.foot nav a { color: var(--ink-soft); font-weight: 600; }
.foot p + p { margin-top: 4px; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; }
  .hero h1 { max-width: 12ch; }
  .stage { margin-top: 8px; }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 56px; }
  .helper { grid-template-columns: 1fr; }
  .helper-phone { max-width: 220px; }
  .finale { grid-template-columns: 1fr; }
  .finale-art { max-width: 360px; }
}
@media (max-width: 560px) {
  .top nav a:not(.btn) { display: none; }
  .book { --pw: 48cqi; }
  .page-body { line-height: 1.4; }
  .margin-note { font-size: 1.3em; }
  .hint { font-size: 1.35rem; }
  .steps { gap: 40px 18px; }
  .step:nth-child(2) .taped, .step:nth-child(4) .taped { margin-top: 0; }
  .step-copy { padding-left: 0; padding-top: 48px; }
  .step-num { top: 0; }
  .step h3 { font-size: 1.25rem; }
  .step .aside { font-size: 1.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .book, .leaf, .book::after, .hint, .style-print img { transition: none !important; }
}

/* Store listing is not public yet: the CTA is a badge, not a link. Swap back to <a class="btn"> at launch. */
.btn-soon, .btn-soon:hover, .btn-soon:active { cursor: default; transform: none; }
.btn-soon:not(.btn-light), .btn-soon:not(.btn-light):hover { background: var(--clay-deep); box-shadow: 0 2px 0 #6E4330; }
.btn-light.btn-soon:hover { background: var(--cream); box-shadow: 0 2px 0 #C9B9A6; }
