/* Story page: the scrolling narrative behind the island. Tokens mirror cinematic.css so the two pages read as one site. */
:root {
  --ink: oklch(24% 0.03 290);
  --ink-2: oklch(42% 0.03 290);
  --ground: oklch(91% 0.018 295);
  --glass: oklch(97% 0.008 295 / 0.82);
  --rule: oklch(24% 0.03 290 / 0.16);
  --font: "Manrope", ui-sans-serif, sans-serif;
  --edge: clamp(20px, 2.6vw, 40px);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  /* one accent per chapter, used only for a short bar and a timeline marker */
  --c-fab: #9a7cf0;
  --c-enterprise: #7b86a8;
  --c-rebuild: #d86aa0;
  --c-portfolio: #4a6fe0;
  --c-builder: #d9772c;
  --c-family: #d86aa0;

  --top-h: 56px;
  --page: 1200px;
  --measure: 62ch;
}
:root[data-theme="dark"] {
  --ink: oklch(94% 0.015 295);
  --ink-2: oklch(72% 0.03 295);
  --ground: oklch(10% 0.04 285);
  --glass: oklch(14% 0.045 285 / 0.78);
  --rule: oklch(94% 0.015 295 / 0.14);
  --c-enterprise: #cfd6e6;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: oklch(94% 0.015 295); --ink-2: oklch(72% 0.03 295); --ground: oklch(10% 0.04 285);
    --glass: oklch(14% 0.045 285 / 0.78); --rule: oklch(94% 0.015 295 / 0.14);
    --c-enterprise: #cfd6e6;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
/* No smooth scrolling: a card link such as story.html#fab must land on its section at once. */
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 400 17px/1.65 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}
a { color: inherit; }
:focus-visible { outline: 1px solid var(--ink); outline-offset: 4px; }
h1, h2, h3, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
[id] { scroll-margin-top: calc(var(--top-h) + 28px); }

/* small letterspaced label, shared by kicker, chapter meta and contents */
.kicker, .chapter__meta, .contents__label {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-2);
}

/* ---- header */
.top {
  position: sticky; top: 0; z-index: 5;
  background: var(--ground);
  border-bottom: 1px solid var(--rule);
}
.top__in {
  max-width: var(--page); margin: 0 auto; min-height: var(--top-h);
  padding: 0 max(var(--edge), env(safe-area-inset-right)) 0 max(var(--edge), env(safe-area-inset-left));
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.name { font-weight: 600; font-size: 17px; letter-spacing: -0.01em; text-decoration: none; white-space: nowrap; }
.top__nav { display: flex; align-items: baseline; gap: clamp(16px, 3vw, 28px); font-size: 14px; }
.top__nav a, .foot__links a, .contents a {
  color: var(--ink-2); text-decoration: none;
  transition: color 0.2s var(--ease);
}
.top__nav a:hover, .foot__links a:hover, .contents a:hover { color: var(--ink); }

/* ---- hero */
.hero {
  max-width: var(--page); margin: 0 auto;
  padding: clamp(40px, 7vw, 96px) var(--edge) clamp(40px, 6vw, 80px);
  display: grid; gap: clamp(32px, 5vw, 64px);
  align-items: center;
}
h1 {
  margin-top: 20px;
  font-size: clamp(2rem, 1.1rem + 3.6vw, 3.75rem);
  font-weight: 500;
  line-height: 1.06;
  letter-spacing: -0.03em;
  text-wrap: balance;
}
.h1__turn { color: var(--ink-2); }
.standfirst {
  margin-top: clamp(20px, 2.4vw, 32px);
  max-width: 34ch;
  font-size: clamp(1.125rem, 1rem + 0.5vw, 1.375rem);
  line-height: 1.45;
  color: var(--ink-2);
  text-wrap: pretty;
}
.hero__figure { display: block; border: 1px solid var(--rule); border-radius: 4px; overflow: hidden; }
.poster { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; }
.poster--night { display: none; }
:root[data-theme="dark"] .poster--day { display: none; }
:root[data-theme="dark"] .poster--night { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .poster--day { display: none; }
  :root:not([data-theme="light"]) .poster--night { display: block; }
}
@media (min-width: 860px) {
  .hero { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
}

/* ---- page body: contents + flow */
.layout {
  max-width: var(--page); margin: 0 auto;
  padding: 0 var(--edge);
  border-top: 1px solid var(--rule);
}
.flow { min-width: 0; }

.contents { padding: 20px 0; border-bottom: 1px solid var(--rule); }
.contents ol { display: flex; flex-wrap: wrap; gap: 4px 20px; margin-top: 10px; font-size: 14px; }
.contents a { display: inline-block; padding: 4px 0; }

@media (min-width: 1100px) {
  .layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); column-gap: 72px; }
  .contents {
    position: sticky; top: calc(var(--top-h) + 1px); align-self: start;
    padding: 72px 0 0; border-bottom: 0;
  }
  .contents ol { display: block; margin-top: 16px; }
  .contents li { border-top: 1px solid var(--rule); }
  .contents li:last-child { border-bottom: 1px solid var(--rule); }
  .contents a { display: flex; align-items: center; gap: 10px; padding: 9px 0; }
  .contents a::before {
    content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%;
    background: var(--c, transparent); border: 1px solid var(--c, var(--rule));
  }
}

/* ---- the arc */
.arc { padding-top: clamp(48px, 6vw, 72px); }
.lead-in {
  font-size: clamp(1.375rem, 1.1rem + 1.1vw, 2rem);
  font-weight: 500; line-height: 1.2; letter-spacing: -0.02em;
}
.timeline {
  position: relative;
  margin-top: clamp(32px, 4vw, 48px);
  padding-left: clamp(26px, 4vw, 44px);
}
.timeline::before {
  content: ""; position: absolute; left: 5px; top: 6px; bottom: 0;
  width: 1px; background: var(--rule);
}
.chapter { position: relative; padding-bottom: clamp(56px, 7vw, 88px); }
.chapter:last-child { padding-bottom: clamp(40px, 5vw, 64px); }
.chapter::before {
  content: ""; position: absolute; top: 3px;
  left: calc(-1 * clamp(26px, 4vw, 44px));
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--c);
  outline: 5px solid var(--ground);
}
.chapter__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
.chapter__no { color: var(--ink); }
.chapter__sub { display: inline-flex; align-items: center; gap: 14px; }
.chapter__sub::before { content: ""; width: 20px; height: 1px; background: var(--ink-2); opacity: 0.6; }

h2 {
  font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.125rem);
  font-weight: 500; line-height: 1.15; letter-spacing: -0.022em;
  text-wrap: balance;
}
/* the card's swatch bar: 28 x 2, one accent */
.chapter h2::before, .aside h2::before {
  content: ""; display: block; width: 28px; height: 2px;
  background: var(--c); margin-bottom: 18px;
}
.chapter h2 { margin-top: 26px; max-width: 24ch; }
.chapter__body { margin-top: 18px; max-width: var(--measure); text-wrap: pretty; }

.proof { margin-top: 28px; max-width: var(--measure); font-size: 16px; line-height: 1.55; }
.proof li { padding: 13px 0; border-top: 1px solid var(--rule); color: var(--ink-2); text-wrap: pretty; }
.proof li:last-child { border-bottom: 1px solid var(--rule); }

/* ---- how I work */
.method { padding: clamp(48px, 6vw, 80px) 0; border-top: 1px solid var(--rule); }
.method__lead { margin-top: 16px; max-width: var(--measure); color: var(--ink-2); text-wrap: pretty; }
.habits { margin-top: clamp(28px, 3.5vw, 40px); display: grid; border-bottom: 1px solid var(--rule); }
.habit { padding: 22px 0 24px; border-top: 1px solid var(--rule); }
.habit h3 { font-size: 17px; font-weight: 600; line-height: 1.35; letter-spacing: -0.005em; }
.habit p { margin-top: 6px; font-size: 16px; line-height: 1.55; color: var(--ink-2); max-width: 40ch; }
@media (min-width: 700px) {
  .habits { grid-template-columns: 1fr 1fr; }
  .habit { padding: 26px 32px 30px 0; }
  .habit:nth-child(even) { padding-left: 32px; padding-right: 0; border-left: 1px solid var(--rule); }
}

/* ---- builder + family */
.pair {
  display: grid; gap: clamp(40px, 5vw, 64px);
  padding: clamp(48px, 6vw, 80px) 0 clamp(64px, 8vw, 112px);
  border-top: 1px solid var(--rule);
}
.aside p { margin-top: 16px; max-width: 52ch; color: var(--ink-2); text-wrap: pretty; }
@media (min-width: 700px) { .pair { grid-template-columns: 1fr 1fr; } }

/* ---- footer */
.foot { border-top: 1px solid var(--rule); }
.foot__in {
  max-width: var(--page); margin: 0 auto;
  padding: clamp(28px, 4vw, 44px) var(--edge) max(clamp(28px, 4vw, 44px), env(safe-area-inset-bottom));
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 16px 32px;
}
.foot__back {
  font-size: clamp(1.125rem, 1rem + 0.5vw, 1.375rem); font-weight: 500; letter-spacing: -0.015em;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 6px;
  text-decoration-color: var(--rule);
  transition: text-decoration-color 0.2s var(--ease);
}
.foot__back:hover { text-decoration-color: currentColor; }
.foot__links { display: flex; gap: 28px; font-size: 14px; }

@media (max-width: 480px) {
  .chapter__meta { flex-direction: column; align-items: flex-start; }
  .chapter__sub::before { display: none; }
}
@media (max-width: 420px) {
  body { font-size: 16px; }
  :root { --edge: 16px; }
}
