/* ==========================================================================
   Reader pages: the memoir (letters/the-gift-of-a-second-chance.html)
   and plain-language pages such as how-we-use-ai.html.
   Loaded after site.css. Paper theme only. Nothing here moves on its own:
   the reading-progress port follows the reader's own scroll, and it snaps
   instead of turning when prefers-reduced-motion is set.
   ========================================================================== */

/* The whole page is paper, including overscroll. */
body.reader-page { background: var(--paper); }

/* ---- Reading progress: a port in the nav whose stripe levels at the end ---- */
/* Markup (inside .site-nav__inner, after the wordmark):
   <div class="read-progress" aria-hidden="true">
     <span class="read-progress__dial"><svg …><circle class="track"/><circle class="arc"/></svg>
       <span class="port"><span class="port__stripe"></span></span></span>
     <span class="read-progress__label">15 min left</span>
   </div>
   JS writes --rp (0 → 1). Where CSS scroll timelines exist and motion is
   allowed, the arc and stripe run on a view timeline of the article instead. */
.read-progress {
  --rp: 0;
  display: inline-flex; align-items: center; gap: .7rem;
  margin-left: .4rem; padding-left: 1.3rem;
  border-left: 1px solid currentColor;
  border-left-color: color-mix(in oklab, currentColor 22%, transparent);
  font-size: .7rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase;
  opacity: .9; white-space: nowrap;
}
.read-progress__dial { position: relative; width: 30px; height: 30px; display: grid; place-items: center; flex: none; }
.read-progress__dial svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.read-progress__dial circle { fill: none; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.read-progress__dial .track { stroke: currentColor; opacity: .16; }
.read-progress__dial .arc {
  stroke: var(--nav-accent, var(--violet-light));
  stroke-dasharray: 1; stroke-dashoffset: calc(1 - var(--rp));
  stroke-linecap: round;
}
.site-nav[data-nav="light"] .read-progress__dial .arc { stroke: var(--violet); }
.read-progress .port { --size: 20px; color: currentColor; border-color: color-mix(in oklab, currentColor 55%, transparent); }
.read-progress .port__stripe {
  background: var(--nav-accent, var(--violet-light));
  transform: rotate(calc(-28deg * (1 - var(--rp))));
  transition: none;
}
.site-nav[data-nav="light"] .read-progress .port__stripe { background: var(--violet); }
.read-progress__label { font-variant-numeric: tabular-nums lining-nums; opacity: .78; }
.read-progress.is-done .read-progress__label { opacity: 1; }

/* Scroll-driven version (Chromium today). The article publishes its timeline
   to the whole document so the nav can use it. */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    html { timeline-scope: --article; }
    .prose { view-timeline: --article block; }
    .read-progress__dial .arc { animation: rp-arc linear both; animation-timeline: --article; animation-range: contain 0% contain 100%; }
    .read-progress .port__stripe { animation: rp-stripe linear both; animation-timeline: --article; animation-range: contain 0% contain 100%; }
  }
}
@keyframes rp-arc { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes rp-stripe { from { transform: rotate(-28deg); } to { transform: rotate(0deg); } }

/* Reduced motion: the ring still reports position (it is a readout, not
   motion), but the stripe does not turn. It snaps level at the end. */
@media (prefers-reduced-motion: reduce) {
  .read-progress .port__stripe { transform: rotate(-28deg); }
  .read-progress.is-done .port__stripe { transform: rotate(0deg); }
}

@media (max-width: 860px) {
  .read-progress { padding-left: 1rem; margin-left: .1rem; }
  .read-progress__dial { width: 28px; height: 28px; }
  .read-progress .port { --size: 18px; }
}
@media (max-width: 1080px) and (min-width: 861px) { .read-progress__label { display: none; } }
@media (max-width: 460px) { .read-progress__label { display: none; } }

/* ---- Title page -------------------------------------------------------- */
.reader-head {
  padding: clamp(132px, 22vh, 220px) var(--gutter) clamp(56px, 9vh, 96px);
  text-align: center;
}
.reader-head .eyebrow { display: inline-flex; gap: .9rem; align-items: center; }
.reader-head .eyebrow i { width: 28px; height: 1px; background: var(--brass-deep); opacity: .7; }
.reader-head h1 {
  margin: 1.8rem auto 0; max-width: 11em;
  font-size: clamp(3rem, 1.6rem + 5.4vw, 6.6rem); line-height: .94; letter-spacing: -.03em; font-weight: 300;
}
.reader-head__sub {
  margin: 1.8rem auto 0; max-width: 30em;
  font-family: var(--serif); font-style: italic; font-weight: 320;
  font-size: var(--step-1); line-height: 1.4; color: var(--muted); text-wrap: balance;
}
.reader-head__rule { width: min(220px, 40vw); height: 1px; margin: 2.6rem auto 2.2rem; background: var(--brass-deep); opacity: .55; border: 0; }
.reader-head__by { font-family: var(--sans); font-size: .82rem; font-weight: 700; letter-spacing: .28em; text-transform: uppercase; }
.reader-head__meta { margin-top: .8rem; display: flex; flex-wrap: wrap; justify-content: center; gap: .3rem 1.1rem; font-size: .84rem; color: var(--muted); }
.reader-head__meta span + span::before { content: "·"; margin-right: 1.1rem; opacity: .6; }

/* Contents: the six parts, set like a book's contents line */
.reader-toc { margin: 3.4rem auto 0; max-width: 46rem; }
.reader-toc ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem 1.6rem; }
.reader-toc a { text-decoration: none; font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); display: inline-flex; gap: .5rem; align-items: baseline; padding-block: .2rem; }
.reader-toc a b { font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: 0; text-transform: none; font-size: 1rem; color: var(--accent); }
.reader-toc a:hover { color: var(--fg); }

/* "About this piece": the third-person abstract, kept small and labeled */
.about-piece {
  margin: 3.4rem auto 0; max-width: 38rem; text-align: left;
  padding: 1.3rem 1.5rem 1.4rem; border: 1px solid var(--hair); border-radius: 16px; background: var(--card);
}
.about-piece summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.about-piece summary::-webkit-details-marker { display: none; }
.about-piece summary::after { content: "+"; font-size: 1.1rem; line-height: 1; color: var(--muted); }
.about-piece[open] summary::after { content: "–"; }
.about-piece summary:focus-visible { outline-offset: 8px; }
.about-piece__who { font-size: .82rem; color: var(--muted); margin-top: .35rem; }
.about-piece p.about-piece__text { margin-top: 1rem; font-size: .95rem; line-height: 1.6; color: var(--muted); }

/* ---- The text ------------------------------------------------------------ */
.prose {
  --measure-read: 38em;
  padding: 0 var(--gutter) clamp(72px, 12vh, 140px);
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-size: clamp(1.1rem, 1.02rem + .35vw, 1.22rem);
  line-height: 1.7;
  font-weight: 380;
  font-variant-numeric: oldstyle-nums proportional-nums;
  font-kerning: normal;
  hanging-punctuation: first;
  color: var(--fg);
}
.prose > * { max-width: var(--measure-read); margin-inline: auto; }
.prose p { text-wrap: pretty; hyphens: manual; }
.prose p + p { margin-top: 0; text-indent: 1.6em; }   /* book paragraphs: indented, no gap */
.prose em { font-style: italic; }
@media (max-width: 560px) { .prose p { hyphens: auto; -webkit-hyphens: auto; } .prose p + p { text-indent: 1.2em; } }

/* Part headings */
.prose .part { margin-top: 0; margin-bottom: 2.4rem; text-align: center; font-weight: inherit; scroll-margin-top: 96px; }
.part__num { display: block; font-family: var(--sans); font-size: .72rem; font-weight: 600; letter-spacing: .3em; text-transform: uppercase; color: var(--accent); }
.part__title { display: block; margin-top: .9rem; font-family: var(--serif); font-weight: 300; font-size: var(--step-3); line-height: 1.05; letter-spacing: -.018em; text-wrap: balance; font-variant-numeric: lining-nums; }
.prose .part + p, .prose .pull + p { text-indent: 0; }

/* Section break: one port on a hairline. It levels once you've passed it. */
.sbreak { display: flex; align-items: center; justify-content: center; gap: 1.1rem; margin: clamp(4.5rem, 11vh, 7.5rem) auto clamp(3rem, 7vh, 4.5rem); }
.sbreak::before, .sbreak::after { content: ""; width: min(96px, 18vw); height: 1px; background: var(--hair); }
.sbreak .port { --size: 28px; color: var(--brass-deep); }
.sbreak .port__stripe { background: var(--violet); }
@media (prefers-reduced-motion: reduce) { .sbreak .port__stripe { transition: none; } }

/* Drop cap at the opening, with small caps on the first line */
.dropcap .lead-in { font-variant-caps: small-caps; letter-spacing: .04em; }
.dropcap::first-letter {
  float: left; font-size: 4.35em; line-height: .8; font-weight: 300;
  margin: .07em .1em -.05em -.04em; color: var(--fg);
}
@supports (initial-letter: 3) {
  .dropcap::first-letter { float: none; font-size: inherit; line-height: inherit; margin: 0 .12em 0 0; initial-letter: 3; font-weight: 300; }
}

/* The pull line: full width, in the accent */
.prose > .pull {
  max-width: min(1180px, 100%);
  margin: clamp(4.5rem, 12vh, 8rem) auto;
  padding: clamp(2.6rem, 6vh, 4rem) 0;
  text-align: center; text-indent: 0;
  font-family: var(--serif); font-weight: 300;
  font-size: clamp(2.2rem, 1rem + 4.6vw, 5.6rem); line-height: 1.02; letter-spacing: -.028em;
  color: var(--accent);
  border-block: 1px solid var(--hair);
  text-wrap: balance;
}
.pull span { display: block; }
.pull span + span { margin-top: .1em; }
.pull span:last-child { font-style: italic; }

/* The end: one aligned port */
.endmark { margin: clamp(4rem, 10vh, 6rem) auto 0; display: grid; justify-items: center; gap: 1rem; text-align: center; }
.endmark .port { --size: 34px; color: var(--brass-deep); }
.endmark .port__stripe { background: var(--violet); }
.endmark .eyebrow { letter-spacing: .34em; }

/* ---- Next on this path ---------------------------------------------------- */
.next-path { padding: clamp(72px, 12vh, 140px) 0; background: var(--paper-2); border-top: 1px solid var(--hair); }
.next-path__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 1rem 2rem; margin-bottom: 2rem; }
.next-path__head .display { font-size: var(--step-3); }
.paths { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.path {
  display: grid; align-content: space-between; gap: 2.2rem; height: 100%; min-height: 230px;
  padding: 26px; border-radius: 22px; text-decoration: none;
  background: var(--linen); border: 1px solid var(--hair);
  transition: transform var(--med) var(--ease-out), box-shadow var(--med) var(--ease-out), border-color var(--fast) ease;
}
.path:hover { transform: translateY(-4px); box-shadow: 0 24px 60px rgba(60,40,20,.12); border-color: rgba(20,20,20,.22); }
.path:hover .port { --angle: 0deg; }
.path__top { display: flex; justify-content: space-between; align-items: center; }
.path .port { --size: 36px; color: var(--brass-deep); }
.path .port__stripe { background: var(--violet); }
.path__kind { font-size: .7rem; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.path h3 { font-family: var(--serif); font-weight: 400; font-size: 1.75rem; line-height: 1.05; letter-spacing: -.01em; }
.path p { margin-top: .6rem; color: var(--muted); font-size: .94rem; line-height: 1.5; }
.path--dark { background: var(--charcoal); color: var(--bone); border-color: var(--charcoal); }
.path--dark p, .path--dark .path__kind { color: rgba(240,237,232,.7); }
.path--dark .port { color: var(--brass); }
.path--dark .port__stripe { background: var(--violet-light); }
.path--dark:focus-visible { outline-color: var(--violet); }
@media (prefers-reduced-motion: reduce) { .path { transition: none; } .path:hover { transform: none; } }
@media (max-width: 900px) { .paths { grid-template-columns: 1fr; } .path { min-height: 0; } }

/* ==========================================================================
   Disclosure page (how-we-use-ai.html)
   ========================================================================== */
.disc-head { padding: clamp(132px, 22vh, 210px) 0 clamp(48px, 8vh, 88px); }
.disc-head h1 { margin-top: 1.6rem; max-width: 10em; }
.disc-head__grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: clamp(32px, 6vw, 110px); align-items: end; }
@media (max-width: 900px) { .disc-head__grid { grid-template-columns: 1fr; } }
.quote--xs { font-size: var(--step-1); line-height: 1.35; }   /* mirrors story.css, which this page doesn't load */
.disc-head .lede { margin-top: 2rem; color: var(--muted); max-width: 36rem; }
.disc-head__meta { margin-top: 1.6rem; font-size: .84rem; color: var(--muted); }

/* At a glance: aligned ports as checkmarks */
.glance { margin: 0; display: grid; gap: 10px; list-style: none; padding: 0; }
@media (max-width: 900px) { .glance { margin-top: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); } }
.glance li { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: start; padding: 20px 20px 22px; border: 1px solid var(--hair); border-radius: 18px; background: var(--card); }
.glance .port { --size: 30px; color: var(--brass-deep); margin-top: .1rem; }
.glance .port__stripe { background: var(--violet); }
.glance b { display: block; font-family: var(--serif); font-weight: 400; font-size: 1.22rem; line-height: 1.2; }
.glance span.small { display: block; margin-top: .35rem; color: var(--muted); line-height: 1.45; }

/* Numbered disclosure rows */
.disc { border-top: 1px solid var(--hair); }
.disc__row { display: grid; grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr); gap: clamp(24px, 5vw, 88px); padding: clamp(48px, 9vh, 96px) 0; border-bottom: 1px solid var(--hair); scroll-margin-top: 80px; }
.disc__label { position: sticky; top: 104px; align-self: start; }
.disc__num { display: block; font-family: var(--serif); font-style: italic; font-weight: 300; font-size: 1.3rem; color: var(--accent); margin-bottom: .8rem; }
.disc__label h2 { font-family: var(--serif); font-weight: 320; font-size: var(--step-3); line-height: 1.04; letter-spacing: -.018em; text-wrap: balance; }
.disc__label .tag { margin-top: 1.2rem; }
.disc__body { max-width: 38rem; }
.disc__body > p { font-size: var(--step-1); line-height: 1.6; text-wrap: pretty; }
.disc__body > p.muted { font-size: var(--step-0); }
.disc__body > * + * { margin-top: 1.2rem; }
.disc__body ul.plain { margin: 1.4rem 0 0; padding: 0; list-style: none; display: grid; gap: .8rem; }
.disc__body ul.plain li { display: grid; grid-template-columns: auto 1fr; gap: .9rem; align-items: baseline; }
.disc__body ul.plain li::before { content: ""; width: 14px; height: 1px; background: var(--brass-deep); transform: translateY(-.3em); }
@media (max-width: 900px) { .disc__row { grid-template-columns: 1fr; } .disc__label { position: static; } }

/* Voice badges legend */
.badges { margin: 1.8rem 0 0; display: grid; gap: 0; border-top: 1px solid var(--hair); }
.badges > div { display: grid; grid-template-columns: 13.5rem 1fr; gap: 1.2rem; align-items: baseline; padding: 1.1rem 0; border-bottom: 1px solid var(--hair); }
.badges dt { margin: 0; }
.badges dd { margin: 0; font-size: .98rem; line-height: 1.55; }
@media (max-width: 560px) { .badges > div { grid-template-columns: 1fr; gap: .6rem; } }
.tag--summary { border-style: dashed; }
.tag--ai { border-color: color-mix(in oklab, var(--brass-deep) 60%, transparent); color: var(--brass-deep); }
.tag--scan::before { content: ""; width: 8px; height: 10px; border: 1px solid currentColor; border-radius: 1px; }
.tag--voice::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* Honest example of an old label, before and after */
.relabel { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: center; margin-top: 1.8rem; }
.relabel__card { padding: 16px 18px; border: 1px solid var(--hair); border-radius: 14px; background: var(--card); }
.relabel__card .eyebrow { font-size: .64rem; }
.relabel__card p { margin-top: .5rem; font-weight: 600; }
.relabel__card small { display: block; margin-top: .6rem; }
.relabel__was p { text-decoration: line-through; text-decoration-color: color-mix(in oklab, currentColor 45%, transparent); color: var(--muted); }
.relabel__arrow { color: var(--muted); }
@media (max-width: 560px) { .relabel { grid-template-columns: 1fr; } .relabel__arrow { transform: rotate(90deg); justify-self: center; } }

/* The Twin door (dark card on paper) */
.twin-door { margin-top: 2rem; display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center; padding: 24px 26px; border-radius: 22px; background: var(--charcoal); color: var(--bone); text-decoration: none; transition: transform var(--med) var(--ease-out), box-shadow var(--med) var(--ease-out); }
.twin-door:hover { transform: translateY(-3px); box-shadow: 0 24px 60px rgba(20,20,20,.22); }
.twin-door:hover .port { --angle: 0deg; }
.twin-door .port { --size: 40px; color: var(--brass); }
.twin-door .port__stripe { background: var(--violet-light); }
.twin-door h3 { font-family: var(--serif); font-weight: 400; font-size: 1.5rem; line-height: 1.1; }
.twin-door p { margin-top: .3rem; font-size: .9rem; color: rgba(240,237,232,.7); }
.twin-door__go { font-size: .82rem; font-weight: 600; letter-spacing: .04em; white-space: nowrap; }
@media (max-width: 560px) { .twin-door { grid-template-columns: auto 1fr; } .twin-door__go { grid-column: 1 / -1; } }
@media (prefers-reduced-motion: reduce) { .twin-door { transition: none; } .twin-door:hover { transform: none; } }

/* The standard (Stuart's line) */
.standard { padding: clamp(80px, 16vh, 180px) 0; text-align: center; }
.standard .quote { max-width: 18em; margin-inline: auto; }
.standard .cite { text-align: center; }

.corrections { display: flex; flex-wrap: wrap; gap: .8rem 1.2rem; align-items: center; margin-top: 1.8rem; }

/* Mobile QA: "Before / Now" labels were 10.2px */
.relabel__card .eyebrow { font-size: .72rem; }
/* Smallest phones: the wordmark wrapped onto two lines beside the reading-progress dial */
@media (max-width: 379.98px) {
  .site-nav__inner { gap: .75rem; }
  .site-nav .wordmark { white-space: nowrap; letter-spacing: .14em; gap: .5rem; }
  .read-progress { padding-left: .5rem; }
}
@media (max-width: 340px) {
  .site-nav__inner { gap: .5rem; }
  .site-nav .wordmark { letter-spacing: .08em; }
  .site-nav .nav-toggle { padding-inline: .75rem; }
}
