/* ======================================================================
 * THE RECORD — the homepage as one document read in chapters.
 * Monumental type, full-bleed plates, whole chapters alternating ivory and
 * slate, a fixed chapter index, viewport-scale numerals, no boxes.
 * Motion: fade-and-rise only. Palette and type unchanged. Loaded by
 * page-home.hbs only.
 * ==================================================================== */

/* Chapter index — fixed on wide screens, hidden below. */
.record-index { display: none; }
@media (min-width: 1100px) {
  /* Appears once the reader has left the opening page, so it never sits on
   * the headline. Without JS it stays hidden; the anchors are still in DOM. */
  .record-index {
    display: block; position: fixed; left: var(--space-6); top: 50%; z-index: 40;
    transform: translateY(-50%);
    opacity: 0; visibility: hidden;
    transition: opacity var(--motion-duration) var(--motion-ease), visibility var(--motion-duration);
  }
  .record-index.is-visible { opacity: 1; visibility: visible; }
  .record-index ol { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-4); }
  .record-index a {
    display: grid; grid-template-columns: 2.5ch auto; align-items: baseline; gap: var(--space-3);
    text-decoration: none; color: var(--text);
    font-family: var(--font-display); font-size: 0.875rem; letter-spacing: 0.04em;
    opacity: 0.45; transition: opacity var(--motion-duration) var(--motion-ease), color var(--motion-duration) var(--motion-ease);
  }
  .record-index a:hover, .record-index a:focus-visible, .record-index a.is-current { opacity: 1; }
  .record-index__label {
    font-family: var(--font-body); font-size: 0.8125rem; letter-spacing: 0.06em; text-transform: uppercase;
    opacity: 0; transition: opacity var(--motion-duration) var(--motion-ease);
  }
  .record-index a.is-current .record-index__label, .record-index a:hover .record-index__label { opacity: 1; }
  .record-index.is-on-slate a { color: var(--ivory); }
}
/* Mobile: a thin progress line at the top, CSS scroll-driven. */
.record-progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 100%; z-index: 60;
  background: var(--slate); transform-origin: left; transform: scaleX(0);
}
@supports (animation-timeline: scroll()) {
  .record-progress { animation: record-progress linear both; animation-timeline: scroll(root); }
}
@keyframes record-progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@media (min-width: 1100px) { .record-progress { display: none; } }
@media (prefers-reduced-motion: reduce) { .record-progress { display: none; } }

/* Opening — the words are the image. */
.record-open { min-height: calc(100svh - 72px); display: flex; align-items: stretch; }
.record-open__inner { display: flex; flex-direction: column; justify-content: center; padding-block: var(--space-7) var(--space-8); }
.record-open__kicker {
  font-size: var(--size-eyebrow); letter-spacing: 0.22em; text-transform: uppercase; margin: 0;
}
/* Large but contained: three lines, the sub and the actions all sit in one
 * desktop screen. Flush left — no stepped indent. */
.record-open__title {
  font-size: clamp(3rem, 9vw, 7.75rem);
  line-height: 0.95; letter-spacing: -0.02em;
  margin-block: var(--space-6) var(--space-8);
  max-width: none;
}
.record-open__line { display: block; }
.record-open__line--em em { font-style: italic; color: var(--olive); }
.record-open__foot { display: grid; gap: var(--space-6); align-items: end; }
@media (min-width: 900px) {
  .record-open__foot { grid-template-columns: minmax(0, 38ch) 1fr; gap: var(--space-9); }
  .record-open__actions { justify-self: end; }
}
.record-open__sub { margin: 0; font-size: 1.1em; }
.record-open__actions { display: flex; flex-wrap: wrap; gap: var(--space-6); align-items: center; }
.record-open__actions .link-arrow { margin-top: 0; }

/* Chapters. */
.record-chapter { position: relative; padding-block: 0 clamp(var(--space-9), 12vw, var(--space-10)); }
.record-chapter--slate {
  --border: color-mix(in srgb, var(--ivory) 22%, transparent);
  --text-muted: var(--mist);
  background: var(--slate); color: var(--ivory);
}
.record-chapter--slate h2, .record-chapter--slate h3 { color: var(--off-white); }
.record-chapter--slate .kicker, .record-chapter--slate .link-arrow { color: var(--ivory); }
.record-chapter--surface { background: var(--off-white); }
.record-chapter--slate ::selection { background: var(--ivory); color: var(--slate); }
.record-chapter__num {
  display: block;
  font-family: var(--font-display); font-size: 0.9375rem; letter-spacing: 0.18em;
  color: var(--text);
  margin-bottom: var(--space-5);
}
.record-chapter--slate .record-chapter__num { color: var(--mist); }
.record-chapter__title {
  font-size: clamp(2.5rem, 6.5vw, 5.5rem); line-height: 0.98; letter-spacing: -0.015em;
  max-width: 14ch; margin-bottom: var(--space-7);
}
.record-body { padding-top: clamp(var(--space-8), 10vw, var(--space-10)); }
.record-body--narrow { max-width: 56ch; margin-left: auto; margin-right: var(--space-6); }
@media (min-width: 900px) { .record-body--narrow { margin-right: 10vw; } }
.record-lede { font-size: clamp(1.25rem, 1.8vw, 1.5rem); line-height: 1.45; max-width: 34ch; margin-bottom: var(--space-5); }
.record-chapter--slate .record-lede { color: var(--ivory); }
.record-head-row { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-6); flex-wrap: wrap; }
.record-head-row .record-chapter__title { margin-bottom: 0; }
.record-head-row .link-arrow { margin-top: 0; }

/* Plates — full-bleed photography with a line set into it. */
.record-plate { position: relative; margin: 0; height: 100svh; min-height: 560px; overflow: hidden; }
.record-plate--short { height: 72svh; min-height: 480px; }
.record-plate img { width: 100%; height: 100%; object-fit: cover; display: block; }
.record-plate::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to top, color-mix(in srgb, var(--slate) 82%, transparent) 0%, color-mix(in srgb, var(--slate) 35%, transparent) 40%, transparent 70%);
}
.record-plate__caption {
  position: absolute; left: 0; right: 0; bottom: clamp(var(--space-7), 8vw, var(--space-10)); z-index: 1;
  color: var(--off-white);
}
.record-plate__caption .record-chapter__num { color: var(--mist); }
.record-plate__title {
  color: var(--off-white);
  font-size: clamp(2.25rem, 6vw, 5.25rem); line-height: 0.98; letter-spacing: -0.015em;
  max-width: 16ch; margin: 0;
}

/* Facing pages — Lifespan / Healthspan without boxes. */
.record-facing { display: grid; gap: var(--space-8); margin-top: var(--space-9); border-top: 1px solid var(--border); }
@media (min-width: 820px) { .record-facing { grid-template-columns: 1fr 1fr; gap: var(--space-10); } }
.record-facing__page { padding-top: var(--space-6); }
.record-facing__num {
  display: block; font-family: var(--font-display); font-size: clamp(3.5rem, 7vw, 6rem); line-height: 1;
  color: var(--olive); margin-bottom: var(--space-5);
}
.record-facing__title { font-size: var(--size-h2); margin-bottom: var(--space-4); }
.record-facing__page p { max-width: 36ch; }

/* Ledger — the four drivers as lines in a record. */
.record-ledger { list-style: none; margin: var(--space-9) 0 0; padding: 0; border-top: 1px solid var(--border); }
.record-ledger__row {
  display: grid; gap: var(--space-2); padding-block: var(--space-6);
  border-bottom: 1px solid var(--border);
}
@media (min-width: 820px) { .record-ledger__row { grid-template-columns: 3ch 1fr 1fr; gap: var(--space-8); align-items: baseline; } }
.record-ledger__num { font-family: var(--font-display); font-size: 1.125rem; color: var(--mist); }
.record-ledger__title { font-size: clamp(1.75rem, 3.6vw, 3rem); line-height: 1.05; margin: 0; }
.record-ledger__body { margin: 0; max-width: 40ch; color: var(--ivory); }

/* Steps — numerals the height of the viewport. */
.record-steps { list-style: none; margin: 0; padding: 0; }
.record-step {
  position: relative; display: grid; align-items: center;
  min-height: 70svh; border-top: 1px solid var(--border); overflow: hidden;
}
.record-step__num {
  position: absolute; right: -0.05em; top: 50%; transform: translateY(-50%);
  font-family: var(--font-display); font-size: clamp(14rem, 42vw, 40rem); line-height: 1;
  color: var(--olive); opacity: 0.32; font-variant-numeric: lining-nums;
  pointer-events: none; user-select: none;
}
.record-step__copy { position: relative; z-index: 1; padding-block: var(--space-8); max-width: 40ch; }
.record-step__title { font-size: clamp(1.75rem, 3.4vw, 2.75rem); line-height: 1.1; margin-bottom: var(--space-4); }
.record-step__copy p { font-size: 1.05em; }

/* The coach — a cut-out against the ground. */
.record-coach { display: grid; gap: var(--space-7); align-items: end; padding-top: clamp(var(--space-8), 8vw, var(--space-10)); }
@media (min-width: 900px) { .record-coach { grid-template-columns: 5fr 6fr; gap: var(--space-9); } }
.record-coach__figure { margin: 0; }
/* The portrait is already black and white on a flat #EAEAD6 ground — the
 * page ivory — so on an ivory chapter it needs no filter to read as a
 * cut-out. Any filter or blend would tint the ground and draw a box. */
.record-coach__figure img {
  width: 100%; height: auto; display: block;
  /* The edited ground is a shade off the page ivory; feather the edges so
   * the photograph has no frame. */
  -webkit-mask-image: linear-gradient(to right, transparent, #000 12%, #000 88%, transparent),
                      linear-gradient(to bottom, transparent, #000 10%, #000 100%);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to right, transparent, #000 12%, #000 88%, transparent),
              linear-gradient(to bottom, transparent, #000 10%, #000 100%);
  mask-composite: intersect;
}
.record-coach__copy { padding-bottom: var(--space-6); }
.record-coach__copy p { max-width: 44ch; }
.record-credentials { font-family: var(--font-display); font-size: 1.0625rem; color: var(--text); margin-block: var(--space-5); }

/* Writing — an index of titles. */
.record-titles { list-style: none; margin: var(--space-8) 0 0; padding: 0; border-top: 1px solid var(--border); }
.record-titles__row { border-bottom: 1px solid var(--border); }
.record-titles__link {
  display: grid; gap: var(--space-3) var(--space-7); align-items: center;
  padding-block: var(--space-6); text-decoration: none; color: inherit;
}
@media (min-width: 820px) {
  .record-titles__link { grid-template-columns: 160px 1fr; grid-template-rows: auto auto; }
  .record-titles__thumb { grid-row: 1 / 3; }
}
.record-titles__thumb { width: 160px; height: 107px; object-fit: cover; border-radius: 4px; }
.record-titles__meta { font-size: var(--size-eyebrow); letter-spacing: 0.16em; text-transform: uppercase; color: var(--text); }
.record-titles__title { font-family: var(--font-display); font-size: clamp(1.5rem, 3vw, 2.5rem); line-height: 1.1; color: var(--text-strong); }
.record-titles__link:hover .record-titles__title, .record-titles__link:focus-visible .record-titles__title { text-decoration: underline; text-underline-offset: 0.18em; text-decoration-thickness: 1px; }

/* Closing page. */
.record-close { background: var(--slate); color: var(--ivory); padding-block: clamp(var(--space-9), 12vw, var(--space-10)); }
.record-close__inner { display: grid; gap: var(--space-8); align-items: end; }
@media (min-width: 900px) { .record-close__inner { grid-template-columns: 1.4fr 1fr; gap: var(--space-9); } }
.record-close__title { color: var(--off-white); font-size: clamp(3rem, 8vw, 7rem); line-height: 0.95; letter-spacing: -0.02em; margin: 0; }
.record-close__copy p { max-width: 36ch; margin-bottom: var(--space-6); }
.record-close .newsletter__heading { color: var(--off-white); font-size: var(--size-h3); }
.record-close .newsletter { --border: color-mix(in srgb, var(--ivory) 22%, transparent); }
/* Footer follows the slate closing page directly: no gap. */
.record-close + .site-footer, .site-footer { margin-top: 0; }

/* ---- Inner pages ------------------------------------------------------ */

/* Page opener — the home opening at a smaller scale. */
.record-open--page { min-height: 0; }
.record-open--page .record-open__inner { padding-block: clamp(var(--space-8), 9vw, var(--space-10)) clamp(var(--space-7), 6vw, var(--space-9)); justify-content: flex-start; }
.record-open--page .record-open__title { font-size: clamp(2.75rem, 8vw, 6.75rem); margin-block: var(--space-5) var(--space-7); max-width: 12ch; }
.record-open--page .record-open__sub { font-size: clamp(1.125rem, 1.5vw, 1.375rem); max-width: 44ch; }
.record-open__actions--single { margin-top: var(--space-6); }

/* Ledger on light grounds: inherit the page colours. */
.record-chapter:not(.record-chapter--slate) .record-ledger__num { color: var(--olive); }
.record-chapter:not(.record-chapter--slate) .record-ledger__body { color: var(--text); }
.record-ledger__note { margin: var(--space-3) 0 0; font-style: italic; font-size: var(--size-small); color: var(--text-muted); }
.record-chapter--slate .record-ledger__note { color: var(--mist); }
.record-ledger__row--wide { grid-template-columns: 3ch 1fr 1.4fr; }

/* Facing halves — two full pages side by side, one slate, one ivory. */
.record-facing-halves { display: grid; }
@media (min-width: 900px) { .record-facing-halves { grid-template-columns: 1fr 1fr; } }
.record-half { padding: clamp(var(--space-8), 8vw, var(--space-10)) var(--space-6); }
@media (min-width: 900px) {
  .record-half { padding-inline: clamp(var(--space-7), 6vw, var(--space-10)); min-height: 100svh; display: flex; flex-direction: column; justify-content: center; }
}
.record-half--slate { background: var(--slate); color: var(--ivory); --border: color-mix(in srgb, var(--ivory) 22%, transparent); }
.record-half--slate h2 { color: var(--off-white); }
.record-half__title { font-size: clamp(2.25rem, 4.5vw, 4rem); line-height: 1; margin-bottom: var(--space-7); max-width: 10ch; }
.record-half .check-list { max-width: 40ch; }
.record-half .check-list li { font-size: 1.05em; }
.record-half--slate .check-list__mark { color: var(--mist); }
.record-half .check-list-host ul { max-width: 40ch; }
.record-half .check-list-host li { font-size: 1.05em; }
.record-half--slate .check-list-host li::before { color: var(--mist); }
.record-half .qual-note { max-width: 40ch; }

/* Statement chapter — one sentence, display size. */
.record-statement {
  font-family: var(--font-display);
  font-size: clamp(1.625rem, 3.2vw, 2.75rem); line-height: 1.25; letter-spacing: -0.01em;
  max-width: 28ch; margin: 0;
}
.record-chapter--slate .record-statement { color: var(--off-white); }

/* Quote — the brief's one permitted flourish. */
.record-quote {
  font-family: var(--font-display); font-style: italic;
  font-size: clamp(1.75rem, 3.5vw, 3rem); line-height: 1.15;
  color: var(--olive); max-width: 22ch; margin: var(--space-8) 0 0;
}
.record-quote p { margin: 0; }

/* Two-column reading: lede left, body right. */
.record-read { display: grid; gap: var(--space-6); }
@media (min-width: 900px) { .record-read { grid-template-columns: 0.9fr 1.1fr; gap: var(--space-10); align-items: start; } }
.record-read__body p { max-width: 52ch; }
.record-read__body .note-accent { margin-top: var(--space-4); }

/* Portrait chapter — About. */
.record-portrait { display: grid; gap: var(--space-7); align-items: end; }
@media (min-width: 900px) { .record-portrait { grid-template-columns: 5fr 7fr; gap: var(--space-9); } }
.record-portrait__figure { margin: 0; }
.record-portrait__figure img { width: 100%; height: auto; display: block; }
.record-portrait__figure--cutout img {
  -webkit-mask-image: linear-gradient(to right, transparent, #000 12%, #000 88%, transparent),
                      linear-gradient(to bottom, transparent, #000 10%, #000 100%);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to right, transparent, #000 12%, #000 88%, transparent),
              linear-gradient(to bottom, transparent, #000 10%, #000 100%);
  mask-composite: intersect;
}
.record-portrait__figure--duotone img { filter: grayscale(1) contrast(1.06); border-radius: 4px; }
.record-portrait__name { font-size: clamp(3rem, 8vw, 6.75rem); line-height: 0.95; letter-spacing: -0.02em; margin-bottom: var(--space-4); }
.record-portrait__copy p { max-width: 52ch; }

/* Journal index as a record of titles; the first entry carries its image large. */
.record-titles--index .record-titles__row:first-child .record-titles__link { grid-template-columns: 1fr; }
@media (min-width: 900px) {
  .record-titles--index .record-titles__row:first-child .record-titles__link { grid-template-columns: 1.1fr 1fr; align-items: end; gap: var(--space-8); }
  .record-titles--index .record-titles__row:first-child .record-titles__thumb { width: 100%; height: auto; aspect-ratio: 3 / 2; grid-row: 1 / 3; }
  .record-titles--index .record-titles__row:first-child .record-titles__title { font-size: clamp(2rem, 4.2vw, 3.75rem); }
}
.record-titles__excerpt { display: none; }
@media (min-width: 900px) { .record-titles--index .record-titles__row:first-child .record-titles__excerpt { display: block; margin: var(--space-4) 0 0; max-width: 44ch; } }
.pillar-nav { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-6); }

/* Post header at document scale. */
.post__title { font-size: clamp(2.5rem, 6vw, 5rem); line-height: 0.98; letter-spacing: -0.015em; }

/* --- Slots ------------------------------------------------------------
   Ghost wraps slot bodies in <p>, which brings margins into elements that
   set margin: 0. Reset them here rather than per template. */
.slot-body > p:first-child { margin-top: 0; }
.slot-body > p:last-child  { margin-bottom: 0; }

/* A chapter is one editable body. Handlebars cannot split {{content}}, so
   the opening paragraph is given the lede styling in CSS instead. Adding or
   removing a paragraph therefore needs no template change. */
.record-chapter__prose > p:first-of-type {
  font-size: clamp(1.25rem, 1.8vw, 1.5rem);
  line-height: 1.45;
  max-width: 34ch;
  margin-bottom: var(--space-5);
}
.record-chapter__prose > p:last-child { margin-bottom: 0; }
.record-chapter--slate .record-chapter__prose > p:first-of-type { color: var(--ivory); }

/* Ledger rows may carry a closing note. When a row's body has two or more
   paragraphs, the last one takes the note styling. */
.record-ledger__row .slot-body > p:nth-child(n + 2):last-child {
  font-size: 0.9em;
  opacity: 0.8;
  margin-top: var(--space-3);
}
