/* ==========================================================================
   Archive pages: letters/*.html rebuilt from the old site by tools/build_letters.py.
   Loaded after site.css and reader.css (title page, prose, reading progress).
   Paper theme only. Nothing here moves.
   ========================================================================== */

/* ---- Title page: shorter than the memoir's, titles here run long ---- */
.letter-head { padding: clamp(116px, 17vh, 180px) var(--gutter) clamp(36px, 6vh, 64px); }
.letter-head h1 {
  max-width: 17em; margin-top: 1.4rem;
  font-size: clamp(2.1rem, 1.3rem + 2.8vw, 4rem); line-height: 1.04; letter-spacing: -.022em;
  text-wrap: balance; overflow-wrap: anywhere;
}
.letter-head .reader-head__rule { margin: 2rem auto 1.4rem; }
.letter-head .reader-head__meta { max-width: 40rem; margin-inline: auto; overflow-wrap: anywhere; }

/* ---- Voice badge (same look as the Library's, library.css) ---- */
.letter-voice { margin-top: 1.3rem; display: flex; justify-content: center; }
.letter-voice__note { margin: .9rem auto 0; max-width: 32rem; font-size: .9rem; line-height: 1.5; color: var(--muted); text-wrap: pretty; }
.badge {
  display: inline-flex; align-items: center; gap: .4rem; flex: none;
  padding: .26rem .6rem; border-radius: 999px; border: 1px solid var(--hair);
  font: 600 .68rem/1.2 var(--sans); letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); white-space: nowrap;
}
.badge--words { color: var(--accent); border-color: color-mix(in oklab, var(--accent) 50%, transparent); }
.badge--words::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--joel { color: var(--accent); border-color: color-mix(in oklab, var(--accent) 30%, transparent); }
.badge--joel::before { content: ""; width: 6px; height: 6px; border-radius: 50%; border: 1px solid currentColor; background: linear-gradient(90deg, currentColor 50%, transparent 50%); }
.badge--summary {
  color: var(--fg); border: 1px dashed var(--faint); font-style: italic; text-transform: none; letter-spacing: .01em; font-size: .74rem;
  background: repeating-linear-gradient(135deg, transparent 0 5px, color-mix(in oklab, var(--fg) 6%, transparent) 5px 6px);
}
.badge--summary::before { content: "≠"; font-style: normal; font-weight: 700; }
.badge--scan::before { content: ""; width: 7px; height: 9px; border: 1px solid currentColor; border-radius: 1px; }

/* ---- The text ---- */
/* Old pages hold short lines (commands, registry keys) and long unbroken strings: wrap them, never scroll sideways. */
.letter-body p, .letter-body li, .letter-body blockquote, .letter-body a { overflow-wrap: anywhere; }
.letter-body p + p { text-indent: 0; margin-top: 1.05em; }   /* spaced paragraphs, not book indents */
.letter-body h2 {
  margin-top: 2.4em; margin-bottom: .7em;
  font-family: var(--serif); font-weight: 400; font-size: var(--step-2); line-height: 1.15; letter-spacing: -.012em;
  font-variant-numeric: lining-nums; text-wrap: balance;
}
.letter-body h2 + p { margin-top: 0; }
.letter-body ul, .letter-body ol { padding-left: 1.3em; margin-block: 1.05em; }
.letter-body li + li { margin-top: .5em; }
.letter-body a:not(.btn):not(.artifact__open) { text-decoration-thickness: 1px; text-underline-offset: .18em; }
.letter-body code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .86em; }
.letter-body > blockquote, .letter-body .letter-quote {
  margin-block: 1.8em; padding-left: 1.2rem; border-left: 2px solid var(--brass-deep);
  font-style: italic; color: var(--muted);
}

/* Not Stuart's words: set in the sans (DESIGN.md: his words in the serif, everything else in the sans) */
.letter-body--sans { font-family: var(--sans); font-weight: 400; font-size: clamp(1.02rem, .98rem + .2vw, 1.1rem); line-height: 1.72; font-variant-numeric: normal; }
.letter-body--sans h2 { font-family: var(--sans); font-weight: 600; font-size: var(--step-1); letter-spacing: -.005em; }

/* The privacy page's short version */
.letter-body .summary-box { margin-block: 0 2.4em; padding: 1.4rem 1.6rem; border: 1px solid var(--hair); border-radius: 16px; background: var(--card); }
.letter-body .summary-box h2 { margin-top: 0; }

/* ---- Images: open in the site's image viewer (site.js, a.artifact__open) ---- */
.letter-body > .letter-fig { margin: 0 auto 2.2rem; }
.letter-body > .letter-fig--inline { margin-block: 1.8em; }
.letter-body > .letter-fig--wide { max-width: min(1040px, 100%); }
.letter-fig a { display: block; cursor: zoom-in; border-radius: 10px; }
.letter-fig img { display: block; width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--hair); background: var(--card); }
.letter-body > .letter-fig--cover { max-width: 300px; }
.letter-fig--cover img { border-radius: 3px; box-shadow: 0 18px 40px rgba(40, 30, 15, .18); }
.letter-body > .letter-fig--logo { max-width: 260px; }
.letter-fig--logo img { border: 0; background: transparent; }

/* A book with no local cover: a typographic cover instead of a broken image */
.type-cover {
  aspect-ratio: 2 / 3; display: flex; flex-direction: column; justify-content: space-between;
  padding: 1.6rem 1.4rem; border-radius: 3px; background: var(--charcoal); color: var(--bone);
  box-shadow: 0 18px 40px rgba(40, 30, 15, .18);
}
.type-cover__title { font-family: var(--serif); font-weight: 400; font-size: 1.6rem; line-height: 1.08; }
.type-cover__by { font-family: var(--sans); font-size: .72rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--brass); }

/* ---- Source links (old "Watch on YouTube" buttons and former embeds) ---- */
.letter-sources { list-style: none; padding: 0; margin: 2.4rem auto 0; display: flex; flex-wrap: wrap; gap: .7rem; font-family: var(--sans); }
.letter-sources .btn { white-space: normal; text-align: left; }

/* ---- Back to the Library ---- */
.letter-back { max-width: 38em; margin: 0 auto; padding: 0 var(--gutter) clamp(56px, 9vh, 96px); font-family: var(--sans); }
@media (min-width: 700px) { .letter-back { padding-inline: 0; } }
