
/* ==========================================================================
   Looking Back — Nightbook.

   The book is not modelled. It is the rendered take, scrubbed by scroll: one
   object, one lighting setup, one continuous shot from shut to open and all
   the way through. The canvas only adds what the render does not carry — the
   light out of the gutter, the sparks, and the words the book gives back.

   Committed single-theme: the plum world is the design, so both host themes
   get the same page and every colour is painted explicitly.
   ========================================================================== */

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

:root {
  --plum-lift: #4b292c;
  --plum: #30171d;
  --plum-deep: #1b0c0e;
  --page: #F3EEE3;
  --citron: #CFC18F;
  --gilt: #CFC18F;
  --ember: #A6AD75;
  --muted: #C4B5AD;
  --faint: #AF9D94;
  --rule: rgba(239,231,211,.14);

  /* one scale; the canvas reads these same numbers through two probes */
  --label: clamp(12.5px, 1.05vw, 15px);
  --track: 0.2em;
  --display-lg: clamp(34px, 4.2vw, 58px);
  --display-md: clamp(28px, 3.4vw, 48px);
  --display-sm: clamp(22px, 2.4vw, 32px);
  --body: clamp(16px, 1.3vw, 19px);
}

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--plum-deep);
  color: var(--page);
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--citron); color: #22240A; }
:focus-visible { outline: 2px solid var(--citron); outline-offset: 3px; }
.skip-link {
  position: fixed; top: 10px; left: 16px; z-index: 50;
  padding: 10px 14px; background: var(--citron); color: #22240A;
  font-weight: 700; text-decoration: none; transform: translateY(-160%);
  transition: transform .15s ease-out;
}
.skip-link:focus { transform: translateY(0); }

.scene {
  position: fixed; inset: 0; z-index: 0;
  background: radial-gradient(120% 92% at 58% 6%, var(--plum-lift) 0%, var(--plum) 44%, var(--plum-deep) 82%, #0C050A 100%);
}
.scene canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 18px clamp(20px, 5vw, 56px);
  background: linear-gradient(180deg, rgba(21,10,16,.96) 0%, rgba(21,10,16,.78) 48%, rgba(21,10,16,0) 100%);
}
.brand {
  font-family: "Newsreader", Georgia, serif;
  font-weight: 400; font-size: 23px; letter-spacing: -0.02em;
  text-decoration: none; color: var(--page);
  display: flex; align-items: center; gap: 10px;
}
.brand i { width: 9px; height: 22px; background: var(--citron); border-radius: 1px 3px 3px 1px; display: block; }
.nav-cta {
  font-size: 14px; font-weight: 600;
  padding: 9px 18px; border-radius: 2px; text-decoration: none;
  color: var(--page); border: 1px solid rgba(239,231,211,.26);
  min-height: 44px; display: inline-flex; align-items: center;
  transition: border-color .15s, background .15s;
}
.nav-cta:hover { border-color: var(--page); background: rgba(239,231,211,.08); }

main { position: relative; z-index: 10; }

/* A hard split. Every step is two halves: the copy owns one and stops at the
   centre line, the book and everything it lifts own the other. The hero and
   the close are the only full-width moments. */
.panel {
  min-height: 120vh;
  display: flex; align-items: center;
  padding: 100px clamp(20px, 5vw, 56px) 40px;
}
.inner {
  max-width: 1320px; margin: 0 auto; width: 100%;
  display: grid; grid-template-columns: 1fr 1fr; align-items: center;
}
.col {
  grid-column: 1 / 2;
  max-width: 60ch;
  padding-right: clamp(24px, 3vw, 56px);
  justify-self: start;
  opacity: var(--in, 1);
  transform: translateY(calc((1 - var(--in, 1)) * 16px));
  transition:
    opacity .68s cubic-bezier(.22, 1, .36, 1),
    transform .68s cubic-bezier(.22, 1, .36, 1);
  will-change: opacity, transform;
}
/* every other step swaps which half holds the words */
.panel.flip .col {
  grid-column: 2 / 3;
  padding-right: 0; padding-left: clamp(24px, 3vw, 56px);
  justify-self: end;
}

.panel.hero, .panel.closing {
  min-height: 100vh;
  align-items: flex-end;
  padding-bottom: clamp(28px, 4.5vh, 60px);
}
.panel.hero .inner, .panel.closing .inner { grid-template-columns: 1fr; }
.panel.hero .col, .panel.closing .col {
  grid-column: 1; max-width: 64ch; margin: 0 auto;
  text-align: center; padding-right: 0;
}
.panel.hero .lede { max-width: 78ch; margin-inline: auto; }
.panel.closing .lede { max-width: 50ch; margin-inline: auto; }
.panel.hero .kicker, .panel.closing .kicker,
.panel.hero .actions, .panel.closing .actions { justify-content: center; }

/* A chapter number, the way the book would print it. */
.step-no {
  display: block; margin: 0 0 2px;
  font-family: "Newsreader", Georgia, serif;
  font-weight: 300; font-variation-settings: "SOFT" 20, "WONK" 1;
  font-size: clamp(54px, 6.2vw, 92px);
  line-height: 0.86; letter-spacing: -0.035em;
  color: var(--gilt);
}
.step-label {
  font-family: "DM Sans", ui-monospace, monospace;
  font-size: var(--label); font-weight: 700;
  letter-spacing: var(--track); text-transform: uppercase;
  color: var(--citron); margin: 0 0 26px;
  display: flex; align-items: center; gap: 14px;
}
.step-label s { flex: 1; height: 1px; background: currentColor; opacity: .34; text-decoration: none; }

.kicker {
  font-family: "DM Sans", ui-monospace, monospace;
  font-size: var(--label); font-weight: 700;
  letter-spacing: var(--track); text-transform: uppercase;
  color: var(--citron); margin: 0 0 18px;
  display: flex; align-items: center; gap: 12px;
}
.kicker s { flex: 0 0 54px; height: 1px; background: currentColor; opacity: .45; text-decoration: none; }

h1, h2 {
  color: #F7F1E4;
  font-family: "Newsreader", Georgia, serif;
  font-weight: 300; font-variation-settings: "SOFT" 20, "WONK" 1;
  line-height: 1.03; letter-spacing: -0.022em; margin: 0;
  text-wrap: balance;
}
h1 { font-size: var(--display-lg); }
h2 { font-size: var(--display-md); }
em { font-style: italic; font-weight: 500; color: var(--citron); }

p.lede { font-size: var(--body); line-height: 1.66; color: #D6C9CB; margin: 22px 0 0; }
.panel:not(.hero):not(.closing) .lede { max-width: 50ch; }

/* The centre line the whole layout is built on, finally drawn. Copy stops
   here; the book and everything it lifts own the other side. */
.panel:not(.hero):not(.closing) { position: relative; }
.panel:not(.hero):not(.closing)::after {
  content: ""; position: absolute; left: 50%; top: 11%; bottom: 11%;
  width: 1px; margin-left: -0.5px; pointer-events: none;
  background: linear-gradient(180deg,
    rgba(239,231,211,0) 0%, rgba(239,231,211,.30) 20%,
    rgba(239,231,211,.30) 80%, rgba(239,231,211,0) 100%);
}

.actions { display: flex; gap: 12px; margin-top: 26px; flex-wrap: wrap; }
.btn {
  font-weight: 600; font-size: 15px;
  padding: 14px 24px; border-radius: 2px; text-decoration: none;
  background: var(--citron); color: #22240A; border: 1px solid var(--citron);
  transition: background .15s, border-color .15s;
}
.btn.ghost { background: transparent; color: var(--page); border-color: rgba(239,231,211,.26); }
.btn:hover { background: #D9E465; border-color: #D9E465; }
.btn.ghost:hover { border-color: var(--page); background: rgba(239,231,211,.07); }

.fine {
  font-family: "DM Sans", ui-monospace, monospace;
  font-size: calc(var(--label) * 0.86); letter-spacing: .08em;
  color: var(--faint); margin: 18px 0 0;
}

.tail { height: 34vh; }
.lift { display: none; }



footer {
  position: relative; z-index: 10;
  padding: 40px clamp(20px, 5vw, 56px) 46px;
  border-top: 1px solid var(--rule);
  font-family: "DM Sans", ui-monospace, monospace;
  font-size: calc(var(--label) * 0.86); letter-spacing: .08em; color: var(--faint);
  display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap;
  background: rgba(12,5,10,.62);
}
footer a { color: var(--muted); text-decoration: none; }
footer a:hover { color: var(--page); text-decoration: underline; }
.foot-nav { display: flex; flex-wrap: wrap; gap: 10px 24px; margin-left: auto; }

.hint {
  position: fixed; left: clamp(20px, 5vw, 56px); bottom: 24px; z-index: 20;
  pointer-events: none;
  font-family: "DM Sans", ui-monospace, monospace;
  font-size: calc(var(--label) * 0.82); letter-spacing: var(--track); text-transform: uppercase;
  color: var(--faint);
  display: flex; align-items: center; gap: 10px;
  transition: opacity .4s;
}
.hint::after {
  content: ""; width: 30px; height: 1px; background: currentColor;
  animation: cue 2.4s ease-in-out infinite; transform-origin: left center;
}
@keyframes cue { 0%,100% { transform: scaleX(.3); } 50% { transform: scaleX(1); } }
@media (prefers-reduced-motion: reduce) {
  .hint::after { animation: none; }
  .col { transition: none; }
}

@media (max-width: 820px) {
  /* The book owns the top of the viewport and the panel starts below it. */
  .panel {
    min-height: 0; align-items: flex-start;
    padding: 41vh clamp(20px, 6vw, 32px) 13vh;
  }
  .panel.hero, .panel.closing { padding-top: 39vh; padding-bottom: 15vh; }
  .inner, .panel.hero .inner, .panel.closing .inner { grid-template-columns: 1fr; }
  .col, .panel.hero .col, .panel.closing .col, .panel.flip .col {
    grid-column: 1; max-width: 100%; text-align: left;
    padding-right: 0; padding-left: 0; margin: 0;
  }
  .panel:not(.hero):not(.closing)::after { display: none; }
  .panel.hero .kicker, .panel.closing .kicker,
  .panel.hero .actions, .panel.closing .actions { justify-content: flex-start; }
  .panel:not(.hero):not(.closing) .lede { max-width: none; }
  .col { opacity: 1; transform: none; }
  .step-no { font-size: clamp(46px, 15vw, 68px); }
  .tail { height: 8vh; }

  /* What the book gives back, as text instead of as paint. */
  .lift { display: grid; gap: 26px; margin: 34px 0 0; padding: 0; list-style: none; }
  .lift li {
    display: grid; grid-template-columns: 1fr auto; gap: 4px 14px;
    padding-bottom: 20px; border-bottom: 1px solid rgba(239,231,211,.12);
  }
  .lift li > * { grid-column: 1; }
  .lift-tag {
    font-family: "DM Sans", ui-monospace, monospace;
    font-size: 11px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase;
    margin-bottom: 4px;
  }
  .lift-head {
    font-family: "Newsreader", Georgia, serif;
    font-weight: 300; font-variation-settings: "SOFT" 20, "WONK" 1;
    font-size: clamp(22px, 6.2vw, 27px); line-height: 1.18; letter-spacing: -0.022em;
    color: var(--page); margin: 0;
  }
  .lift-sub {
    font-size: var(--body); line-height: 1.55;
    color: var(--muted); margin: 8px 0 0;
  }
  .lift-val {
    grid-column: 2; grid-row: 1 / span 2; align-self: start;
    font-family: "Newsreader", Georgia, serif; font-weight: 300;
    font-size: clamp(19px, 5vw, 23px);
  }
  .lift-bar {
    grid-column: 1 / -1; height: 4px; border-radius: 2px;
    background: rgba(239,231,211,.13); margin-top: 14px; overflow: hidden;
  }
  .lift-bar i { display: block; height: 100%; border-radius: 2px; }
  .acc-0, .acc-2 { color: var(--ember); }
  .acc-1 { color: var(--gilt); }
  .acc-0 .lift-bar i, .acc-2 .lift-bar i { background: var(--ember); }
  .acc-1 .lift-bar i { background: var(--gilt); }
  .lift em { color: inherit; font-style: normal; font-weight: 500; }
}

/* The original scene and layout, dressed in the new visual identity. */
html { scroll-padding-top: 90px; }
.nav { background: linear-gradient(180deg, rgba(48,23,29,.64), rgba(48,23,29,.24) 55%, transparent); padding-block: 16px; }
.brand { font-size: 35px; letter-spacing: -.045em; gap: 16px; }
.rhythm { display: flex; align-items: center; gap: 3px; height: 23px; }
.brand .brand-symbol { display: block; width: 34px; height: 34px; flex-shrink: 0; }
.brand { gap: 9px; letter-spacing: -.055em; }
.nav-cta { font-size: 12px; border-radius: 0; gap: 25px; padding: 10px 18px; }
h1, h2 { color: #f3eee3; font-weight: 400; letter-spacing: -.04em; }
h1 { font-size: clamp(44px, 4.9vw, 72px); }
h2 { font-size: clamp(36px, 4vw, 60px); }
em { color: var(--gilt); font-weight: 400; }
p.lede { color: #cfc1b8; line-height: 1.8; }
.step-no { font-size: clamp(60px, 6.5vw, 96px); color: #cfc18f; margin-bottom: 9px; }
.step-label { font-size: 11px; color: #a6ad75; letter-spacing: .18em; font-weight: 500; margin-bottom: 30px; }
.step-label s { opacity: .24; }
.panel:not(.hero):not(.closing)::after { opacity: .35; }
.panel.hero { position: relative; min-height: max(740px, 100svh); padding-bottom: 125px; }
.panel.hero .col { max-width: 800px; }
.panel.hero .lede { max-width: 76ch; font-size: 16px; margin-top: 23px; }
.actions { align-items: center; gap: 28px; margin-top: 27px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 32px; min-height: 52px; font-size: 12px; font-weight: 500; padding: 14px 24px; border-radius: 0; color: #382129; background: #f3eee3; border-color: #f3eee3; }
.btn:hover { background: #ded5bf; border-color: #ded5bf; }
.btn.ghost { border-width: 0 0 1px; padding: 9px 0; min-height: 44px; color: #f3eee3; background: transparent; border-color: rgba(243,238,227,.4); gap: 25px; }
.btn.ghost:hover { background: transparent; border-color: #f3eee3; }
.fine { font-size: 10px; letter-spacing: .04em; color: #b3a396; }
.chapter-rail { position: absolute; left: clamp(20px,5vw,56px); right: clamp(20px,5vw,56px); bottom: 28px; display: flex; gap: 30px; }
.chapter-rail a { display: flex; align-items: center; flex: 1; gap: 13px; padding: 12px 0; color: #d6ccc0; text-decoration: none; font-size: 10px; letter-spacing: .13em; text-transform: uppercase; white-space: nowrap; }
.chapter-rail a::after { content: ''; height: 1px; background: rgba(243,238,227,.18); flex: 1; margin-left: 8px; }
.chapter-rail a:hover { color: var(--gilt); }
.chapter-rail span { color: var(--gilt); }
.chapter-rail i { width: 6px; height: 6px; border: 1px solid #96996a; border-radius: 50%; }
.chapter-rail a:first-child i { background: #96996a; }
.hint { display: none; }
.anchor-alias { display: block; height: 0; }
footer { font-size: 11px; letter-spacing: .02em; background: rgba(23,11,13,.75); }
@media (min-width: 821px) {
  /* Canvas is decorative; the same narration remains accessible in the DOM. */
  .lift { display: block; position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
@media (max-width: 820px) {
  .nav { padding-top: 18px; }
  .brand { font-size: 30px; gap: 10px; }
  .rhythm { transform: scale(.8); }
  .nav-cta { font-size: 11px; padding: 8px 13px; gap: 16px; }
  .panel.hero { min-height: 100svh; padding-top: 37svh; padding-bottom: 155px; }
  .panel.hero .lede { font-size: 15px; }
  h1 { font-size: clamp(43px, 9vw, 62px); }
  h2 { font-size: clamp(35px, 7.2vw, 50px); }
  .panel { padding-top: 34svh; padding-bottom: 9svh; }
  .panel.closing { padding-top: 37svh; }
  .step-no { font-size: 64px; }
  .step-label { font-size: 10px; }
  .actions { gap: 22px; }
  .btn { padding: 13px 18px; font-size: 11px; gap: 20px; }
  .chapter-rail { bottom: 24px; flex-wrap: wrap; gap: 4px 19px; }
  .chapter-rail a { flex: 1 0 calc(50% - 20px); font-size: 9px; padding: 9px 0; gap: 10px; }
  .chapter-rail i { display: none; }
  .lift { margin-top: 35px; }
  .lift-sub { font-size: 15px; }
  .lift-head { font-size: 26px; }
  .fine { font-size: 10px; }
}
@media (max-width: 370px) {
  .actions { gap: 15px; }
  .btn { padding-inline: 13px; gap: 12px; }
  .btn.ghost { padding-inline: 0; }
  h1 { font-size: 41px; }
}
@media (min-width: 821px) {
  .panel.hero { align-items: center; padding-top: 135px; padding-bottom: 145px; }
  .panel.hero .inner { grid-template-columns: 1fr 1fr; }
  .panel.hero .col { grid-column: 1; max-width: 100%; margin: 0; text-align: left; padding-right: 35px; }
  .panel.hero .lede { margin-inline: 0; font-size: 15px; }
  .panel.hero .actions { justify-content: flex-start; gap: 24px; }
  .panel.hero h1 { font-size: clamp(45px, 4.8vw, 70px); }
}

.nav.scrolled { background: linear-gradient(180deg, rgba(48,23,29,.9), rgba(48,23,29,.55) 55%, transparent); border-bottom: 0; }
@media (min-width: 821px) {
  .panel[id] { scroll-margin-top: calc(-90px - 10vh); }
  .col { transition: none; }
}
/* End on the invitation, without an empty scroll-out after it. */
.tail { height: 0; }
/* Saffron gives the primary action its own color in the oxblood scene. */
.btn:not(.ghost) { background: #E6B451; border-color: #E6B451; color: #27150E; transition: background .2s, border-color .2s, box-shadow .2s; }
.btn:not(.ghost):hover { background: #F1C66D; border-color: #F1C66D; box-shadow: 0 0 28px rgba(230,180,81,.18); }
@media (max-width: 820px) {
  .lift { gap: 16px; }
  .lift li { position: relative; padding: 22px 0; border: 0; border-bottom: 1px solid rgba(243,238,227,.1); background: transparent; }
  .lift li:last-child, .lift.example-3 li { border-bottom: 0; }
  .lift-head { font-size: 25px; }
  .lift.example-1 li, .lift.example-2 li { background: transparent; border: 0; border-bottom: 1px solid rgba(243,238,227,.1); padding: 22px 0; }
  .lift.example-1 li:last-child, .lift.example-2 li:last-child { border-bottom: 0; }
  .score-card .lift-sub { font-size: 14px; margin-top: 16px; }
  .score-display { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 26px; width: 100%; grid-column: 1 / -1 !important; }
  .score-number { font: 400 55px/1 'Newsreader', Georgia, serif; letter-spacing: -.04em; white-space: nowrap; }
  .score-number small { font: 400 16px 'DM Sans', sans-serif; letter-spacing: 0; }
  .score-caption { display: block; font-size: 9px; letter-spacing: .15em; text-transform: uppercase; margin-bottom: 10px; }
  .score-ticks { display: flex; gap: 3px; }
  .score-ticks i { flex: 1; height: 5px; background: #5B4842; }
  .score-ticks .filled { background: var(--gilt); }
  .frequency { display: flex; align-items: center; gap: 18px; margin-top: 15px; font-size: 10px; color: #c4b5ad; grid-column: 1 / -1 !important; }
  .frequency-marks { display: flex; gap: 10px; }
  .frequency-marks i { width: 6px; height: 6px; border-radius: 50%; background: #5B4842; }
  .frequency-marks .filled { background: var(--gilt); }
  .example-4 li { padding-left: 32px; }
  .example-4 .review-index { position: absolute; top: 28px; left: 0; font: 11px 'DM Sans', sans-serif; color: var(--gilt); }
  .lift .lift-bar { height: 1px; border-radius: 0; overflow: visible; margin-top: 22px; }
  .lift .lift-bar i { position: relative; border-radius: 0; }
  .lift .lift-bar i::after { content: ''; position: absolute; right: -3px; top: -2.5px; width: 6px; height: 6px; border-radius: 50%; background: inherit; }
}
@media (max-width: 820px) { .lift li .lift-val { grid-column: 2; } }
