/* === Chapter 2 — date eyebrow gets the ochre accent === */
.chapter--meet .eyebrow { color: var(--color-accent-warm); }

/* === Chapter 3 — milestones === */
.milestones {
  display: grid;
  gap: var(--space-lg);
  margin-top: var(--space-xl);
}

.milestone {
  display: grid;
  gap: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--color-fg-faint);
  min-width: 0;       /* allow grid children to shrink instead of pushing out */
}

.milestone__date {
  font-family: var(--font-sans);
  font-size: var(--type-micro);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--color-fg-muted);
}

.milestone__caption {
  font-family: var(--font-serif);
  font-size: var(--type-h2);
  font-weight: 350;
  line-height: 1.2;
  letter-spacing: -0.01em;
  min-width: 0;
  overflow-wrap: anywhere;   /* even an unbreakable placeholder will wrap rather than overflow */
}

@media (min-width: 600px) {
  .milestone {
    grid-template-columns: 9rem 1fr;
    gap: var(--space-xl);
    align-items: baseline;
  }

  .milestone__date {
    white-space: nowrap;
  }
}

/* === Chapter 4 — live feed === */
/* === Chapter 4 — live feed === */
.feed-hero {
  margin-top: var(--space-xl);
}

.feed-empty {
  aspect-ratio: 4 / 5;
  background: color-mix(in oklab, var(--color-fg) 4%, transparent);
  border: 1px solid var(--color-fg-faint);
  border-radius: 2px;
  display: grid;
  place-content: center;
  text-align: center;
  font-family: var(--font-serif);
  font-size: var(--type-h2);
  font-weight: 300;
  color: var(--color-fg-muted);
  padding: var(--space-md);
}

.feed-empty__sub {
  display: block;
  margin-top: var(--space-xs);
  font-family: var(--font-sans);
  font-size: var(--type-small);
  letter-spacing: 0.02em;
  color: var(--color-fg-muted);
}

.feed-grid {
  display: flex;
  gap: var(--space-sm);
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding: var(--space-md) 0 var(--space-lg);
  margin-top: var(--space-md);
  scrollbar-width: none;
}
.feed-grid::-webkit-scrollbar { display: none; }

.feed-grid__item {
  flex: 0 0 70%;
  scroll-snap-align: start;
  margin: 0;
}

@media (min-width: 600px) { .feed-grid__item { flex: 0 0 38%; } }
@media (min-width: 960px) { .feed-grid__item { flex: 0 0 28%; } }

/* === Feed items === */
.feed-item {
  margin: 0;
  display: grid;
  gap: var(--space-sm);
}

.feed-item img,
.feed-item video {
  width: 100%;
  object-fit: cover;
  display: block;
  border-radius: 2px;
  background: color-mix(in oklab, var(--color-fg) 4%, transparent);
}

.feed-item--hero img,
.feed-item--hero video {
  aspect-ratio: 4 / 5;
}

.feed-grid__item .feed-item img,
.feed-grid__item .feed-item video {
  aspect-ratio: 1 / 1;
}

.feed-item__caption {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: var(--type-small);
  color: var(--color-fg-muted);
  text-align: center;
  letter-spacing: 0.01em;
  line-height: 1.4;
}

.feed-grid__item { margin: 0; }

/* === Chapter 5 — letter === */
.letter {
  margin-top: var(--space-xl);
  display: grid;
  gap: var(--space-lg);
}

.letter__paragraph {
  font-family: var(--font-serif);
  font-size: var(--type-lede);
  font-weight: 300;
  line-height: 1.45;
  letter-spacing: -0.005em;
  max-width: 38ch;
}

.letter__signoff {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: var(--type-body);
  color: var(--color-fg-muted);
  margin-top: var(--space-md);
}

/* === Chapter 6 — sealed reveal === */
.reveal {
  margin-top: var(--space-xl);
  display: grid;
  place-content: center;
}

.reveal__trigger {
  padding: var(--space-md) var(--space-xl);
  border: 1px solid var(--color-fg);
  border-radius: 999px;
  background: transparent;
  color: var(--color-fg);
  font-size: var(--type-small);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  transition: background var(--duration-fast) var(--ease-out),
              color var(--duration-fast) var(--ease-out);
}
.reveal__trigger:hover { background: var(--color-fg); color: var(--color-bg); }

.reveal[data-state="open"] .reveal__trigger { display: none; }
.reveal__body {
  font-family: var(--font-serif);
  font-size: var(--type-h2);
  font-weight: 300;
  line-height: 1.3;
  color: var(--color-accent-warm);
  text-align: center;
  max-width: 30ch;
}

/* === Outro === */
.chapter--outro {
  display: grid;
  place-content: center;
  text-align: center;
  min-height: 100svh;
}

.outro__wordmark { margin-bottom: var(--space-xl); }

.outro__actions {
  display: grid;
  gap: var(--space-sm);
  justify-content: center;
  margin-bottom: var(--space-2xl);
}

.ghost-button {
  padding: var(--space-sm) var(--space-md);
  background: transparent;
  border: 1px solid var(--color-fg-faint);
  border-radius: 999px;
  color: var(--color-fg-muted);
  font-size: var(--type-small);
  letter-spacing: 0.1em;
  transition: color var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out);
}
.ghost-button:hover { color: var(--color-fg); border-color: var(--color-fg-muted); }

.outro__joke {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: var(--type-small);
  color: var(--color-fg-faint);
}

/* === Sound toggle === */
.sound-toggle {
  position: fixed;
  bottom: var(--space-md);
  right: var(--space-md);
  z-index: var(--z-ui);
  padding: var(--space-xs) var(--space-md);
  border: 1px solid var(--color-fg-faint);
  border-radius: 999px;
  background: color-mix(in oklab, var(--color-bg) 80%, transparent);
  backdrop-filter: blur(8px);
  color: var(--color-fg-muted);
  font-size: var(--type-micro);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

/* === Preloader === */
.preloader {
  position: fixed;
  inset: 0;
  z-index: var(--z-preloader);
  background: var(--color-bg);
  display: grid;
  place-content: center;
  pointer-events: none;
  transition: opacity 0.8s var(--ease-out);
}

.preloader[data-state="hidden"] { opacity: 0; }

.preloader__mark {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: var(--type-body);
  color: var(--color-fg-muted);
  letter-spacing: 0.02em;
  animation: preloader-pulse 1.6s var(--ease-in-out) infinite;
}

@keyframes preloader-pulse {
  0%, 100% { opacity: 0.3; }
  50%      { opacity: 0.8; }
}

/* === Constellation === */
.constellation {
  width: 100%;
  height: auto;
  margin-top: var(--space-2xl);
  opacity: 0.9;
  display: block;
}

.constellation circle {
  fill: var(--color-fg);
}

.constellation__moment {
  fill: var(--color-accent);
  filter: drop-shadow(0 0 4px var(--color-accent));
}

.constellation__caption {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: var(--type-micro);
  color: var(--color-fg-muted);
  text-align: center;
  margin-top: var(--space-sm);
  letter-spacing: 0.04em;
}

/* === Sound toggle ON state === */
.sound-toggle[data-state="on"] {
  color: var(--color-fg);
  border-color: var(--color-fg-muted);
}

/* === Reveal sealed-state cue === */
.reveal__trigger:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.reveal[data-gate="sealed"] .reveal__trigger {
  border-style: dashed;
}

/* === Heartbeat — 70 BPM, lub-DUB pattern === */
.heartbeat {
  position: fixed;
  bottom: calc(var(--space-md) + 4px);
  left: var(--space-md);
  width: 6px;
  height: 6px;
  background: var(--color-accent);
  border-radius: 50%;
  z-index: var(--z-ui);
  opacity: 0.6;
  pointer-events: none;
  animation: heartbeat 0.857s infinite;
}

@keyframes heartbeat {
  0%   { transform: scale(1);    opacity: 0.4; }
  8%   { transform: scale(1.5);  opacity: 0.95; }
  18%  { transform: scale(1);    opacity: 0.5; }
  30%  { transform: scale(1.3);  opacity: 0.78; }
  45%  { transform: scale(1);    opacity: 0.4; }
  100% { transform: scale(1);    opacity: 0.4; }
}

@media (prefers-reduced-motion: reduce) {
  .heartbeat { animation: none; opacity: 0.6; }
}

/* === Noon letter === */
.noon-letter {
  margin-top: var(--space-xl);
  border: 1px solid var(--color-fg-faint);
  border-radius: 2px;
  padding: var(--space-xl) var(--space-lg);
  background: color-mix(in oklab, var(--color-fg) 6%, var(--color-bg));
  text-align: center;
}

.noon-letter__seal {
  background: none;
  border: none;
  width: 100%;
  padding: 0;
  cursor: pointer;
  color: inherit;
}

.noon-letter[data-gate="sealed"] .noon-letter__seal {
  cursor: not-allowed;
  opacity: 0.55;
}

.noon-letter__time {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: var(--type-h1);
  font-weight: 200;
  color: var(--color-accent);
  letter-spacing: -0.02em;
  line-height: 1;
  margin-bottom: var(--space-sm);
}

.noon-letter__hint {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: var(--type-small);
  color: var(--color-fg-muted);
}

.noon-letter__body {
  font-family: var(--font-serif);
  font-size: var(--type-lede);
  font-weight: 300;
  line-height: 1.5;
  color: var(--color-fg);
  max-width: 38ch;
  margin: 0 auto;
}

/* === Chapter 7 numeral === */
.chapter--year .layer--bg::before { content: "07"; }

/* === Interlude numeral (used in step F) === */
.chapter--interlude .layer--bg::before { content: "—"; font-size: clamp(8rem, 25vw, 18rem); }

/* === Year letter === */
.year-letter {
  margin-top: var(--space-xl);
  border: 1px solid var(--color-fg-faint);
  border-radius: 2px;
  padding: var(--space-3xl) var(--space-xl);
  background: color-mix(in oklab, var(--color-fg) 6%, var(--color-bg));
  text-align: center;
}

.year-letter__seal {
  background: none;
  border: none;
  width: 100%;
  padding: 0;
  cursor: pointer;
  color: inherit;
}

.year-letter[data-gate="sealed"] .year-letter__seal {
  cursor: not-allowed;
  opacity: 0.55;
}

.year-letter__date {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: var(--type-h1);
  font-weight: 200;
  color: var(--color-accent);
  letter-spacing: -0.02em;
  line-height: 1;
  margin-bottom: var(--space-sm);
}

.year-letter__hint {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: var(--type-small);
  color: var(--color-fg-muted);
}

.year-letter__body {
  font-family: var(--font-serif);
  font-size: var(--type-lede);
  font-weight: 300;
  line-height: 1.5;
  color: var(--color-fg);
  max-width: 38ch;
  margin: 0 auto;
}

/* === Interlude — graphs === */
.graphs {
  display: grid;
  gap: var(--space-2xl);
  margin-top: var(--space-xl);
  padding-right: var(--space-xl);   /* generous right buffer on narrow + tablet */
}

@media (min-width: 1024px) {
  .graphs {
    grid-template-columns: repeat(2, 1fr);
    padding-right: 0;
    gap: var(--space-2xl) var(--space-xl);
  }
}

/* Belt and suspenders — bars and heights cannot exceed their container */
.bar,
.height-figure {
  max-width: 100%;
  box-sizing: border-box;
}

.graph {
  margin: 0;
  display: grid;
  gap: var(--space-md);
}

.graph__title {
  font-family: var(--font-serif);
  font-size: var(--type-h2);
  font-weight: 350;
  letter-spacing: -0.01em;
  line-height: 1.2;
  max-width: 28ch;
}

.graph__caption {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: var(--type-small);
  color: var(--color-fg-muted);
  max-width: 32ch;
}

.graph__big {
  font-family: var(--font-serif);
  font-weight: 200;
  font-size: clamp(3.5rem, 11vw, 7rem);
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--color-accent);
}

/* Bar chart */
.bar-chart { display: grid; gap: var(--space-sm); }

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  width: var(--w, 100%);
  min-width: 6rem;
  border-radius: 2px;
  transition: width 1.2s var(--ease-out);
}

.bar--her { background: color-mix(in oklab, var(--color-accent) 35%, var(--color-fg-faint)); }
.bar--him { background: color-mix(in oklab, var(--color-fg) 18%, var(--color-fg-faint)); }

.bar__label {
  font-family: var(--font-sans);
  font-size: var(--type-micro);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.bar__value {
  font-family: var(--font-serif);
  font-size: var(--type-h2);
  font-weight: 300;
}

/* Height chart */
.height-chart {
  display: flex;
  align-items: flex-end;
  gap: var(--space-md);
  height: 280px;
  border-bottom: 1px solid var(--color-fg-faint);
  padding-bottom: 4px;
}

.height-figure {
  flex: 1;
  height: var(--h, 100%);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: var(--space-sm);
  border-radius: 2px 2px 0 0;
  transition: height 1.2s var(--ease-out);
}

.height-figure--her { background: color-mix(in oklab, var(--color-accent) 45%, var(--color-fg-faint)); }
.height-figure--him { background: color-mix(in oklab, var(--color-fg) 22%, var(--color-fg-faint)); }

.height-figure span {
  font-family: var(--font-sans);
  font-size: var(--type-micro);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-fg);
}

/* Pie */
.pie { width: 140px; height: 140px; display: block; }

/* === Force numeral positioning for Chapter 7 and Interlude (defensive) === */
.chapter--year .layer--bg::before,
.chapter--interlude .layer--bg::before {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  font-family: var(--font-serif);
  font-weight: 300;
  font-variation-settings: 'opsz' 144;
  line-height: 1;
  letter-spacing: -0.05em;
  color: var(--color-fg);
  opacity: 0.05;
  pointer-events: none;
  user-select: none;
}

.chapter--year .layer--bg::before {
  content: "07";
  font-size: clamp(8rem, 22vw, 14rem);
}

.chapter--interlude .layer--bg::before {
  content: "—";
  font-size: clamp(8rem, 25vw, 18rem);
}

/* === Graph visualization right-edge breathing room === */
.bar-chart,
.height-chart {
  padding-right: var(--space-md);
}

/* Every graph respects its column width, no matter what's inside */
.graph {
  min-width: 0;
  overflow: hidden;
}

.graph > * {
  max-width: 100%;
  overflow-wrap: break-word;
}

/* Pink big-number can be huge on narrow viewports; allow it to shrink */
.graph__big {
  font-size: clamp(2.5rem, 9vw, 5.5rem);
  overflow-wrap: break-word;
}

/* Bars and heights — last-resort containment */
.bar,
.height-figure {
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

/* === Password gate === */
.passgate {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-preloader) + 1);   /* above the preloader */
  background: var(--color-bg);
  display: grid;
  place-content: center;
  padding: var(--space-xl);
  transition: opacity 0.6s var(--ease-out);
}

.passgate[hidden] {
  display: none;
}

.passgate__form {
  display: grid;
  gap: var(--space-md);
  max-width: 22rem;
  width: 100%;
}

.passgate__hint {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: var(--type-h2);
  font-weight: 300;
  color: var(--color-fg-muted);
  text-align: center;
  letter-spacing: -0.01em;
}

.passgate__input {
  width: 100%;
  padding: var(--space-md);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--color-fg-faint);
  color: var(--color-fg);
  font-family: var(--font-sans);
  font-size: var(--type-body);
  text-align: center;
  letter-spacing: 0.1em;
}

.passgate__input:focus {
  outline: none;
  border-bottom-color: var(--color-accent);
}

.passgate__submit {
  padding: var(--space-sm) var(--space-xl);
  border: 1px solid var(--color-fg);
  border-radius: 999px;
  background: transparent;
  color: var(--color-fg);
  font-size: var(--type-small);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  justify-self: center;
}

.passgate__submit:hover {
  background: var(--color-fg);
  color: var(--color-bg);
}

.passgate__error {
  text-align: center;
  font-size: var(--type-small);
  color: var(--color-accent);
  font-style: italic;
}