/* ============================================================================
   UNSEALED — The Epstein Estate Archive
   State-of-the-art editorial design: Fraunces display, paper + grain,
   oxblood accent, kinetic redaction motif, layered micro-interactions.
   ========================================================================== */

:root {
  --paper:      #eef1f5;
  --paper-2:    #e6eaf0;
  --surface:    #ffffff;
  --surface-2:  #f5f7fa;
  --surface-3:  #e8edf2;
  --ink:        #12161b;
  --ink-2:      #454d57;
  --ink-3:      #616b79;
  --line:       #e0e5eb;
  --line-2:     #cbd3dc;
  --accent:     #b0271d;
  --accent-2:   #8c1d15;
  --accent-soft:#fbe8e5;
  --accent-glow:rgba(176,39,29,.15);
  --gold:       #77602f;
  --redact:     #11151b;

  --shadow-sm: 0 1px 2px rgba(26,23,18,.05);
  --shadow:    0 10px 34px -12px rgba(26,23,18,.18);
  --shadow-lg: 0 40px 90px -28px rgba(26,23,18,.40);

  --display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans:    'Space Grotesk', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --mono:    'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --r-sm: 8px;  --r: 13px;  --r-lg: 20px;
  --maxw: 1220px;
  --ease: cubic-bezier(.4,0,.2,1);
  --ease-out: cubic-bezier(.16,1,.3,1);
  --grain: .5;

  color-scheme: light;
}

[data-theme="dark"] {
  --paper:      #0e1116;
  --paper-2:    #0a0c10;
  --surface:    #171b21;
  --surface-2:  #1d222a;
  --surface-3:  #262c35;
  --ink:        #eef1f6;
  --ink-2:      #a6aeba;
  --ink-3:      #7d8794;
  --line:       #262c34;
  --line-2:     #353d48;
  --accent:     #e3604f;
  --accent-2:   #ef7867;
  --accent-soft:#2a1714;
  --accent-glow:rgba(227,96,79,.22);
  --gold:       #c2a062;
  --redact:     #04060a;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow:    0 14px 40px -14px rgba(0,0,0,.6);
  --shadow-lg: 0 48px 110px -30px rgba(0,0,0,.78);
  --grain: .85;
  color-scheme: dark;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  font-size: 16px; line-height: 1.55;
  color: var(--ink); background: var(--paper);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility; font-optical-sizing: auto;
  min-height: 100vh; overflow-x: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
*::-webkit-scrollbar { width: 11px; height: 11px; }
*::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 99px; border: 3px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--ink-3); background-clip: padding-box; }

.mono { font-family: var(--mono); }

/* ---------- film grain + paper warmth ---------- */
.grain {
  position: fixed; inset: 0; z-index: 40; pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  opacity: calc(.045 * var(--grain)); mix-blend-mode: var(--grain-blend, multiply);
}
[data-theme="dark"] .grain { mix-blend-mode: screen; opacity: calc(.03 * var(--grain)); }
body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(120% 80% at 50% -10%, color-mix(in oklab, var(--accent) 6%, transparent), transparent 60%);
}
#app { position: relative; z-index: 2; }

/* ---------- scroll progress ---------- */
.progress { position: fixed; top: 0; left: 0; height: 2px; width: 100%; z-index: 60;
  background: linear-gradient(90deg, var(--accent), var(--gold)); transform: scaleX(0); transform-origin: left;
  transition: transform .1s linear; }

/* ============================================================
   MASTHEAD
   ============================================================ */
.masthead {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in oklab, var(--paper) 82%, transparent);
  backdrop-filter: saturate(150%) blur(16px); -webkit-backdrop-filter: saturate(150%) blur(16px);
  border-bottom: 1px solid transparent; transition: border-color .3s, box-shadow .3s, background .3s;
}
.masthead.scrolled { border-bottom-color: var(--line); box-shadow: 0 1px 0 rgba(0,0,0,.02), var(--shadow-sm); }
.masthead-inner { max-width: var(--maxw); margin: 0 auto; display: flex; align-items: center; gap: 22px; padding: 15px 26px; }
.wordmark { display: flex; align-items: baseline; gap: 11px; flex-shrink: 0; }
.wordmark .logo { font-family: var(--display); font-size: 28px; line-height: 1; letter-spacing: -.015em; font-weight: 430; }
.wordmark .logo b { color: var(--accent); font-weight: 430; font-style: italic; }
.wordmark .tag {
  font-family: var(--mono); font-size: 9px; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-3);
  border: 1px solid var(--line-2); border-radius: 99px; padding: 4px 9px; white-space: nowrap; position: relative; top: -2px;
}
.nav { display: flex; gap: 1px; margin-left: 8px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { position: relative; padding: 9px 14px; border-radius: var(--r-sm); font-size: 14.5px; font-weight: 500; color: var(--ink-2); white-space: nowrap; transition: color .18s var(--ease); }
.nav a:hover { color: var(--ink); }
.nav a.active { color: var(--ink); }
.nav a::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: 3px; height: 2px; background: var(--accent); border-radius: 2px; transform: scaleX(0); transform-origin: left; transition: transform .3s var(--ease-out); }
.nav a.active::after { transform: scaleX(1); }
.mast-actions { display: flex; align-items: center; gap: 7px; flex-shrink: 0; }
.mast-search { display: flex; align-items: center; gap: 9px; padding: 9px 13px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line-2); color: var(--ink-3); font-size: 13.5px; cursor: text; transition: border-color .18s, box-shadow .18s, color .18s; }
.mast-search:hover { border-color: var(--ink-3); color: var(--ink-2); box-shadow: var(--shadow-sm); }
.mast-search kbd { font-family: var(--mono); font-size: 10px; padding: 2px 6px; border: 1px solid var(--line-2); border-radius: 5px; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; color: var(--ink-2); transition: background .18s, color .18s, transform .18s; }
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.icon-btn:active { transform: scale(.92); }
.nav-toggle { display: none; }

/* ============================================================
   LAYOUT + VIEW TRANSITIONS
   ============================================================ */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 26px; }
main { min-height: 64vh; padding-bottom: 90px; }
.view { animation: viewin .55s var(--ease-out) both; }
@keyframes viewin { from { opacity: 0; transform: translateY(14px); filter: blur(6px); } to { opacity: 1; transform: none; filter: blur(0); } }

.reveal-up { animation: revUp .8s var(--ease-out) both; }
@keyframes revUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }

/* ============================================================
   HERO
   ============================================================ */
.hero { padding: clamp(40px, 7vw, 86px) 0 30px; position: relative; }
.hero-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.kicker { font-family: var(--mono); font-size: 11.5px; letter-spacing: .22em; text-transform: uppercase; color: var(--accent); display: flex; align-items: center; gap: 12px; }
.kicker::before { content: ""; width: 30px; height: 1px; background: var(--accent); display: inline-block; transform-origin: left; animation: drawline .9s var(--ease-out) .1s both; }
@keyframes drawline { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.hero-stamp {
  font-family: var(--mono); font-size: 10px; letter-spacing: .24em; text-transform: uppercase; color: var(--accent);
  border: 1.5px solid var(--accent); border-radius: 5px; padding: 7px 12px; transform: rotate(-3.5deg);
  opacity: 0; animation: stampin .5s var(--ease-out) 1.5s both; box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--accent) 30%, transparent); }
@keyframes stampin { 0% { opacity: 0; transform: rotate(-3.5deg) scale(1.5); } 60% { opacity: .95; } 100% { opacity: .9; transform: rotate(-3.5deg) scale(1); } }
.hero-title {
  font-family: var(--display); font-weight: 380; font-optical-sizing: auto;
  font-variation-settings: 'opsz' 144, 'SOFT' 0, 'WONK' 0;
  font-size: clamp(50px, 9.5vw, 132px); line-height: .96; letter-spacing: -.025em;
  margin: 22px 0 0; }
.hero-title .ln { display: block; overflow: hidden; }
.hero-title .ln > span { display: inline-block; animation: lineup 1s var(--ease-out) both; }
.hero-title .ln:nth-child(2) > span { animation-delay: .12s; }
@keyframes lineup { from { transform: translateY(105%); } to { transform: translateY(0); } }
.redact-reveal { position: relative; display: inline-block; color: var(--accent); font-style: italic; }
.redact-reveal::after { content: ""; position: absolute; inset: -.04em -.12em; background: var(--redact); transform-origin: right; animation: unredact .9s var(--ease-out) .9s both; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
@keyframes unredact { 0%,18% { transform: scaleX(1); } 100% { transform: scaleX(0); } }
.dek { color: var(--ink-2); font-size: clamp(16px, 2vw, 20px); max-width: 56ch; margin: 26px 0 0; line-height: 1.55; font-weight: 400; }

.stats { display: flex; flex-wrap: wrap; gap: clamp(26px, 4vw, 56px); margin-top: 42px; }
.stat .n { font-family: var(--display); font-size: clamp(34px, 4.4vw, 52px); line-height: 1; font-weight: 400; font-variation-settings: 'opsz' 90; letter-spacing: -.01em; }
.stat .l { font-family: var(--mono); font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); margin-top: 9px; }

/* generic section head (non-hero views) */
.section-head { padding: clamp(34px,5vw,60px) 0 26px; }
.section-head h1 { font-family: var(--display); font-weight: 380; font-variation-settings: 'opsz' 144; letter-spacing: -.02em; font-size: clamp(40px, 6.5vw, 78px); line-height: 1; margin: 18px 0 0; }
.section-head .dek { margin-top: 18px; }

/* ============================================================
   SEARCH + FILTERS
   ============================================================ */
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 8px 0 0; }
.searchbox { flex: 1; min-width: 250px; display: flex; align-items: center; gap: 13px; padding: 16px 18px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line-2); box-shadow: var(--shadow-sm); transition: border-color .2s, box-shadow .2s, transform .2s; }
.searchbox:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-glow), var(--shadow); }
.searchbox svg { color: var(--ink-3); flex-shrink: 0; }
.searchbox input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 16px; }
.searchbox input::placeholder { color: var(--ink-3); }
.searchbox .clear { color: var(--ink-3); display: grid; place-items: center; }
.searchbox .clear:hover { color: var(--accent); }

.filters { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 16px; }
.chip { font-family: var(--mono); font-size: 11.5px; letter-spacing: .03em; padding: 9px 15px; border-radius: 99px; border: 1px solid var(--line-2); color: var(--ink-2); background: var(--surface); transition: all .16s var(--ease); white-space: nowrap; }
.chip:hover { border-color: var(--ink-3); color: var(--ink); transform: translateY(-1px); }
.chip.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.result-meta { font-family: var(--mono); font-size: 12px; color: var(--ink-3); padding: 22px 2px 12px; }
.result-meta b { color: var(--accent); font-weight: 600; }

/* ============================================================
   EMAIL LIST
   ============================================================ */
.maillist { border-top: 1px solid var(--line); }
.mailrow {
  display: grid; grid-template-columns: 70px 1fr auto; gap: 20px; align-items: baseline;
  padding: 20px 16px 20px 14px; border-bottom: 1px solid var(--line);
  cursor: pointer; position: relative; text-decoration: none;
  transition: background .2s var(--ease), padding-left .25s var(--ease-out);
  animation: rowin .5s var(--ease-out) both; animation-delay: var(--d, 0s);
}
@keyframes rowin { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.mailrow::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 2px; background: var(--accent); border-radius: 2px; transform: scaleY(0); transform-origin: top; transition: transform .25s var(--ease-out); }
.mailrow:hover { background: var(--surface); padding-left: 22px; }
.mailrow:hover::before { transform: scaleY(1); }
.mailrow:hover .m-no { color: var(--accent); }
.mailrow .m-no { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); padding-top: 6px; transition: color .2s; letter-spacing: .02em; }
.m-main { min-width: 0; }
.m-top { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.m-from { font-weight: 600; font-size: 13.5px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 320px; letter-spacing: .005em; }
.m-from .dir { font-family: var(--mono); font-size: 9.5px; color: var(--accent); font-weight: 500; text-transform: uppercase; letter-spacing: .1em; margin-right: 8px; }
.m-subj { font-family: var(--display); font-size: 23px; line-height: 1.18; letter-spacing: -.012em; font-weight: 400; font-variation-settings: 'opsz' 60; color: var(--ink); margin: 2px 0 6px; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.mailrow:hover .m-subj { color: var(--accent-2); }
[data-theme="dark"] .mailrow:hover .m-subj { color: var(--accent-2); }
.m-snip { color: var(--ink-2); font-size: 13.5px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.m-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; text-align: right; flex-shrink: 0; }
.m-date { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); white-space: nowrap; }
.m-tags { display: flex; gap: 5px; }
.tag { font-family: var(--mono); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; padding: 4px 8px; border-radius: 5px; border: 1px solid var(--line-2); color: var(--ink-3); display: inline-flex; align-items: center; gap: 4px; }
.tag.redact { color: var(--accent); border-color: color-mix(in oklab, var(--accent) 35%, var(--line-2)); background: var(--accent-soft); }
.tag.epstein { color: var(--gold); border-color: color-mix(in oklab, var(--gold) 38%, var(--line-2)); }

.loadmore-wrap { display: grid; place-items: center; padding: 44px 0; }
.btn { font-family: var(--sans); font-weight: 600; font-size: 14px; padding: 13px 28px; border-radius: 99px; background: var(--ink); color: var(--paper); border: 1px solid var(--ink); transition: transform .14s var(--ease), opacity .18s, box-shadow .2s; }
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0) scale(.98); }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--line-2); box-shadow: var(--shadow-sm); }
.btn.ghost:hover { border-color: var(--ink-3); }

/* ============================================================
   READING VIEW
   ============================================================ */
.reader { max-width: 720px; margin: 0 auto; padding-top: 30px; }
.backlink { display: inline-flex; align-items: center; gap: 9px; font-family: var(--mono); font-size: 12px; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 30px; transition: color .18s, gap .18s; }
.backlink:hover { color: var(--accent); gap: 13px; }
.reader-head { border-bottom: 2px solid var(--ink); padding-bottom: 26px; }
.reader-head .doc-no { font-family: var(--mono); font-size: 11.5px; color: var(--accent); letter-spacing: .16em; text-transform: uppercase; }
.reader-head h1 { font-family: var(--display); font-weight: 380; font-variation-settings: 'opsz' 144; letter-spacing: -.02em; font-size: clamp(32px, 5vw, 52px); line-height: 1.04; margin: 14px 0 0; }
.reader-tags { display: flex; gap: 6px; margin-top: 20px; flex-wrap: wrap; }
.msg { padding: 30px 0; border-bottom: 1px solid var(--line); }
.msg-head { display: flex; gap: 15px; align-items: flex-start; margin-bottom: 22px; }
.avatar { width: 46px; height: 46px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; color: #fff; font-weight: 600; font-size: 15px; box-shadow: inset 0 1px 0 rgba(255,255,255,.28), var(--shadow-sm); }
.msg-meta { min-width: 0; flex: 1; }
.msg-from { font-weight: 600; font-size: 15.5px; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.pill { font-family: var(--mono); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; padding: 3px 8px; border-radius: 99px; border: 1px solid var(--line-2); color: var(--ink-3); }
.pill.epstein { color: var(--gold); border-color: color-mix(in oklab, var(--gold) 45%, var(--line-2)); }
.msg-addr { font-family: var(--mono); font-size: 12px; color: var(--ink-3); margin-top: 4px; word-break: break-word; }
.msg-date { font-family: var(--mono); font-size: 12px; color: var(--ink-3); white-space: nowrap; flex-shrink: 0; padding-top: 3px; }
.msg-body { font-family: var(--display); font-variation-settings: 'opsz' 22; font-size: 19px; line-height: 1.66; color: var(--ink); white-space: pre-wrap; word-break: break-word; }
.msg-body::first-letter { /* graceful, only meaningful on the opening line */ }
.redacted { display: inline-block; vertical-align: baseline; color: transparent; user-select: none; background: repeating-linear-gradient(135deg, var(--redact), var(--redact) 5px, #2a2f37 5px, #2a2f37 10px); border-radius: 2px; padding: 0 .35em; margin: 0 1px; position: relative; box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--accent) 40%, transparent); }
.redacted::after { content: "REDACTED"; position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--mono); font-size: 7.5px; letter-spacing: .1em; color: var(--accent); opacity: 0; transition: opacity .18s; }
.redacted:hover::after { opacity: 1; }
.attachments { margin-top: 26px; }
.attachments .lbl, .thread-lbl { font-family: var(--mono); font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 13px; }
.attach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 10px; }
.attach { display: flex; align-items: center; gap: 12px; padding: 13px 15px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface); transition: transform .15s, box-shadow .2s; }
.attach:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.attach .ico { width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex-shrink: 0; }
.attach .nm { font-size: 13px; font-weight: 500; }
.attach .sz { font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); }

/* ============================================================
   PHOTOS
   ============================================================ */
.photo-grid { columns: 5 210px; column-gap: 14px; }
.photo { break-inside: avoid; margin-bottom: 14px; border-radius: var(--r); overflow: hidden; position: relative; background: var(--surface-3); border: 1px solid var(--line); cursor: zoom-in; display: block; box-shadow: var(--shadow-sm); transition: transform .3s var(--ease-out), box-shadow .3s; }
.photo:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.photo img { width: 100%; height: auto; display: block; transition: transform .5s var(--ease-out); background: var(--surface-3); }
.photo:hover img { transform: scale(1.04); }
.photo .ph-meta { position: absolute; inset: auto 0 0 0; padding: 22px 12px 11px; font-family: var(--mono); font-size: 10px; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.82)); opacity: 0; transition: opacity .22s; }
.photo .ph-meta .cap { display: block; font-family: var(--sans); font-size: 11.5px; line-height: 1.45; margin-bottom: 6px; color: #f0ede4; }
.photo:hover .ph-meta { opacity: 1; }
.ph-fallback { aspect-ratio: 3/4; display: grid; place-items: center; font-family: var(--mono); font-size: 11px; color: var(--ink-3); padding: 14px; text-align: center; }
.lightbox { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 5vh 5vw; background: rgba(8,10,13,.92); backdrop-filter: blur(8px); animation: viewin .3s var(--ease-out); }
.lightbox img { max-width: 100%; max-height: 82vh; border-radius: var(--r); box-shadow: var(--shadow-lg); }
.lightbox .lb-meta { position: absolute; bottom: 4vh; left: 0; right: 0; text-align: center; color: #d9d4c7; font-family: var(--mono); font-size: 12px; padding: 0 6vw; }
.lightbox .lb-cap { display: block; font-family: var(--sans); font-size: 14px; color: #fff; margin-bottom: 7px; line-height: 1.5; }
.lightbox .lb-meta a { color: #fff; text-decoration: underline; }
.lb-close { position: absolute; top: 3vh; right: 4vw; color: #fff; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.12); transition: background .18s, transform .18s; }
.lb-close:hover { background: rgba(255,255,255,.24); transform: rotate(90deg); }

/* ============================================================
   DOCUMENTS
   ============================================================ */
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px,1fr)); gap: 13px; }
.doc { display: flex; flex-direction: column; gap: 15px; padding: 20px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow-sm); transition: transform .16s var(--ease), box-shadow .25s, border-color .18s; }
.doc:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--line-2); }
.doc .ico { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.doc .nm { font-family: var(--mono); font-size: 13px; font-weight: 500; word-break: break-all; }
.doc .src { font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); margin-top: 3px; }
.doc .open { font-size: 12.5px; color: var(--accent); font-weight: 600; margin-top: auto; }
.doc .doc-snip { font-size: 12.5px; color: var(--ink-2); line-height: 1.55; border-left: 2px solid var(--line-2); padding-left: 10px; }

/* ============================================================
   FLIGHTS
   ============================================================ */
.flighttable { border-top: 1px solid var(--line); }
.flighthead, .flightrow { display: grid; grid-template-columns: 120px 140px 110px 1fr 90px; gap: 20px; align-items: baseline; }
.flighthead { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); padding: 14px 12px; border-bottom: 1px solid var(--line); }
.flightrow { padding: 18px 12px; border-bottom: 1px solid var(--line); transition: background .15s, padding-left .2s var(--ease-out); }
.flightrow:hover { background: var(--surface); padding-left: 18px; }
.f-date { font-family: var(--mono); font-size: 12.5px; color: var(--ink); }
.f-ac { font-family: var(--mono); font-size: 12px; color: var(--ink-2); }
.f-ac .type { color: var(--ink-3); font-size: 10px; display: block; margin-top: 2px; }
.f-route { font-family: var(--mono); font-size: 15px; display: flex; align-items: center; gap: 9px; }
.f-route .arr { color: var(--accent); }
.f-route svg { color: var(--ink-3); }
.f-px { display: flex; flex-wrap: wrap; gap: 5px; }
.f-px .px { font-size: 11.5px; padding: 4px 11px; border-radius: 99px; background: var(--surface-3); border: 1px solid var(--line); white-space: nowrap; transition: background .15s; }
.f-px .px:hover { background: var(--accent-soft); }
.f-src { font-family: var(--mono); font-size: 10px; color: var(--ink-3); }

/* ============================================================
   PEOPLE
   ============================================================ */
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px,1fr)); gap: 13px; }
.person { display: flex; gap: 15px; align-items: center; padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow-sm); transition: transform .16s, border-color .18s, box-shadow .25s; }
.person:hover { transform: translateY(-2px); border-color: var(--line-2); box-shadow: var(--shadow); }
.person .pname { font-weight: 600; font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person .pmail { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person .pbar { display: flex; height: 6px; border-radius: 99px; overflow: hidden; margin-top: 10px; background: var(--surface-3); }
.person .pbar .s { background: var(--accent); }
.person .pbar .r { background: var(--gold); }
.person .pcount { font-family: var(--mono); font-size: 11px; color: var(--ink-3); margin-top: 8px; display: flex; gap: 16px; }
.person .pcount b { color: var(--ink); font-weight: 600; }

/* ============================================================
   ABOUT / PROSE
   ============================================================ */
.prose { max-width: 660px; font-family: var(--display); font-variation-settings: 'opsz' 28; font-size: 20px; line-height: 1.66; color: var(--ink-2); }
.prose h2 { font-family: var(--display); font-weight: 400; color: var(--ink); font-size: 30px; margin: 42px 0 14px; letter-spacing: -.015em; font-variation-settings: 'opsz' 100; }
.prose p { margin: 0 0 1.1em; }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.prose strong { color: var(--ink); font-weight: 600; }

/* ============================================================
   COMMAND PALETTE
   ============================================================ */
.cmdk-scrim { position: fixed; inset: 0; z-index: 150; background: rgba(10,12,16,.55); backdrop-filter: blur(6px); display: flex; justify-content: center; align-items: flex-start; padding: 12vh 20px 20px; animation: viewin .22s var(--ease-out); }
.cmdk { width: 100%; max-width: 620px; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); overflow: hidden; display: flex; flex-direction: column; max-height: 64vh; animation: pop .26s var(--ease-out); }
@keyframes pop { from { transform: translateY(-10px) scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }
.cmdk-in { display: flex; align-items: center; gap: 13px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.cmdk-in svg { color: var(--ink-3); }
.cmdk-in input { flex: 1; border: 0; outline: 0; background: none; font-size: 18px; }
.cmdk-list { overflow-y: auto; padding: 8px; }
.cmdk-group { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); padding: 13px 12px 6px; }
.cmdk-item { display: flex; align-items: center; gap: 13px; padding: 12px; border-radius: var(--r-sm); cursor: pointer; }
.cmdk-item .ci { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2); flex-shrink: 0; font-family: var(--mono); font-size: 12px; font-weight: 600; }
.cmdk-item .cl { flex: 1; min-width: 0; }
.cmdk-item .cl .t { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmdk-item .cl .s { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmdk-item.sel, .cmdk-item:hover { background: var(--surface-3); }
.cmdk-item.sel .ci { background: var(--accent); color: #fff; }
.cmdk-empty { padding: 38px; text-align: center; color: var(--ink-3); font-size: 15px; font-family: var(--display); font-style: italic; }
.cmdk-foot { display: flex; gap: 18px; padding: 11px 18px; border-top: 1px solid var(--line); font-family: var(--mono); font-size: 11px; color: var(--ink-3); }
.cmdk-foot kbd { border: 1px solid var(--line-2); border-radius: 4px; padding: 1px 5px; }

/* ============================================================
   STATES
   ============================================================ */
.skeleton { background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 37%, var(--surface-3) 63%); background-size: 400% 100%; animation: shimmer 1.5s infinite; border-radius: 6px; }
@keyframes shimmer { to { background-position: -135% 0; } }
.empty { text-align: center; padding: 90px 20px; color: var(--ink-3); }
.empty .serif { font-family: var(--display); font-style: italic; font-size: 34px; color: var(--ink-2); display: block; margin-bottom: 10px; }

/* ============================================================
   FOOTER
   ============================================================ */
.foot { border-top: 1px solid var(--line); margin-top: 50px; position: relative; z-index: 2; }
.foot-inner { max-width: var(--maxw); margin: 0 auto; padding: 44px 26px; display: flex; flex-wrap: wrap; gap: 26px; justify-content: space-between; align-items: flex-start; }
.foot .fnote { font-size: 13px; color: var(--ink-3); max-width: 52ch; line-height: 1.65; }
.foot .flinks { display: flex; gap: 20px; font-family: var(--mono); font-size: 12px; }
.foot .flinks a { color: var(--ink-2); transition: color .15s; }
.foot .flinks a:hover { color: var(--accent); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 880px) {
  .mast-search .ph, .mast-search kbd { display: none; }
  .mast-search { padding: 10px; }
  .nav { position: fixed; inset: 64px 0 auto 0; flex-direction: column; background: var(--paper); border-bottom: 1px solid var(--line); padding: 10px 18px 18px; gap: 2px; transform: translateY(-12px); opacity: 0; pointer-events: none; transition: opacity .22s, transform .22s; max-height: 72vh; overflow: auto; }
  body.nav-open .nav { transform: none; opacity: 1; pointer-events: auto; }
  .nav a { padding: 13px 14px; font-size: 16px; }
  .nav a::after { left: 14px; right: auto; width: 18px; }
  .nav-toggle { display: grid; }
  .mast-actions { margin-left: auto; }
}
@media (max-width: 680px) {
  .wrap { padding: 0 18px; }
  .masthead-inner { padding: 13px 18px; gap: 12px; }
  .wordmark .tag { display: none; }
  .hero-stamp { display: none; }
  .mailrow { grid-template-columns: 1fr auto; gap: 14px; }
  .mailrow .m-no { display: none; }
  .m-subj { font-size: 20px; }
  .photo-grid { columns: 2 150px; }
  .flighthead { display: none; }
  .flightrow { grid-template-columns: 1fr; gap: 8px; padding: 18px 8px; }
  .f-route { font-size: 15px; }
}

/* ============================================================
   PERFECT PASS — new components
   ============================================================ */

/* search-term highlight */
mark { background: var(--accent-soft); color: var(--accent-2); border-radius: 3px; padding: 0 .08em; }
[data-theme="dark"] mark { color: var(--accent); }
.m-subj mark { background: transparent; box-shadow: inset 0 -2px 0 var(--accent); color: inherit; border-radius: 0; }

/* skip link */
.skiplink { position: fixed; top: -60px; left: 16px; z-index: 300; padding: 11px 18px; border-radius: 99px;
  background: var(--ink); color: var(--paper); font-weight: 600; font-size: 14px; transition: top .18s var(--ease-out); }
.skiplink:focus-visible { top: 12px; }

/* sort toggle */
.sortbtn { display: inline-flex; align-items: center; gap: 8px; padding: 0 18px; border-radius: var(--r);
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); font-family: var(--mono);
  font-size: 12px; box-shadow: var(--shadow-sm); transition: border-color .18s, color .18s, transform .14s; align-self: stretch; }
.sortbtn:hover { border-color: var(--ink-3); color: var(--ink); }
.sortbtn:active { transform: scale(.97); }

/* keyboard-selected row */
.mailrow.kb { background: var(--surface); padding-left: 22px; }
.mailrow.kb::before { transform: scaleY(1); }
.mailrow.kb .m-no { color: var(--accent); }

/* empty-state suggestions */
.suggest { display: flex; gap: 7px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }

/* reader top row + prev/next */
.reader-toprow { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 30px; flex-wrap: wrap; }
.reader-toprow .backlink { margin-bottom: 0; }
.reader-nav { display: flex; align-items: center; gap: 4px; }
.rnav { display: inline-flex; align-items: center; gap: 5px; padding: 8px 13px; border-radius: 99px;
  font-family: var(--mono); font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink-2); border: 1px solid var(--line-2); background: var(--surface);
  transition: color .15s, border-color .15s; }
.rnav:hover:not(:disabled) { color: var(--accent); border-color: var(--accent); }
.rnav:disabled { opacity: .35; cursor: default; }
.rpos { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); padding: 0 10px; white-space: nowrap; }
.reader-headrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.printbtn { color: var(--ink-3); }
.printbtn:hover { color: var(--ink); }

/* back to top */
.totop { position: fixed; right: 22px; bottom: 22px; z-index: 80; width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center; background: var(--ink); color: var(--paper); box-shadow: var(--shadow);
  opacity: 0; transform: translateY(12px); pointer-events: none;
  transition: opacity .25s var(--ease-out), transform .25s var(--ease-out); }
.totop.show { opacity: 1; transform: none; pointer-events: auto; }
.totop:hover { transform: translateY(-2px); }

/* lightbox prev/next */
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 52px; height: 52px; border-radius: 50%;
  display: grid; place-items: center; color: #fff; background: rgba(255,255,255,.1);
  transition: background .18s, opacity .18s; z-index: 2; }
.lb-nav:hover:not(:disabled) { background: rgba(255,255,255,.24); }
.lb-nav:disabled { opacity: .25; cursor: default; }
.lb-prev { left: 3vw; }
.lb-next { right: 3vw; }

/* inbox loading skeleton rows */
.skel-row { padding: 20px 16px 20px 14px; border-bottom: 1px solid var(--line); }

/* about timeline */
.tl { max-width: 660px; margin: 10px 0 34px; border-left: 2px solid var(--line-2); padding: 6px 0 6px 0; }
.tl-item { display: grid; grid-template-columns: 86px 1fr; gap: 16px; padding: 14px 0 14px 24px; position: relative;
  animation: revUp .7s var(--ease-out) both; animation-delay: var(--d, 0s); }
.tl-item::before { content: ""; position: absolute; left: -6px; top: 22px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 4px var(--paper); }
.tl-year { font-family: var(--mono); font-size: 13px; color: var(--accent); font-weight: 500; letter-spacing: .04em; padding-top: 2px; }
.tl-title { font-family: var(--display); font-size: 21px; font-weight: 400; letter-spacing: -.01em; }
.tl-desc { color: var(--ink-2); font-size: 14px; line-height: 1.6; margin-top: 5px; }

/* skip route-in animations when restoring scroll position */
.no-anim, .no-anim *, .no-anim *::before, .no-anim *::after { animation: none !important; }

/* ============================================================
   MESSAGES — iMessage conversations, editorial style
   ============================================================ */
.conv-list { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.conv {
  display: flex; align-items: center; gap: 16px; padding: 18px 14px;
  border-bottom: 1px solid var(--line); color: var(--ink-3);
  transition: background .15s, padding-left .2s var(--ease-out);
}
.conv:hover { background: var(--surface); padding-left: 20px; }
.conv .avatar { width: 48px; height: 48px; font-size: 16px; }
.conv-main { flex: 1; min-width: 0; }
.conv-top { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.conv-name { font-weight: 600; font-size: 16px; color: var(--ink); }
.conv-n { font-family: var(--mono); font-size: 11px; color: var(--ink-3); margin-left: auto; }
.conv-bio { font-size: 13px; color: var(--ink-2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-last { font-family: var(--display); font-style: italic; font-size: 15px; color: var(--ink-3); margin-top: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.chat-view { max-width: 720px; margin: 0 auto; padding-top: 30px; }
.chat-head { display: flex; align-items: center; gap: 14px; padding-bottom: 20px; border-bottom: 2px solid var(--ink); }
.chat-head .avatar { width: 52px; height: 52px; font-size: 17px; }
.chat-name { font-family: var(--display); font-size: 30px; font-variation-settings: 'opsz' 100; letter-spacing: -.01em; }
.chat-bio { font-size: 12.5px; color: var(--ink-3); margin-top: 3px; }
.chat-scroll { padding: 10px 0 40px; }
.chat-day {
  text-align: center; font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-3); margin: 26px 0 14px;
}
.bubble-row { display: flex; margin: 3px 0; }
.bubble-row.me { justify-content: flex-end; }
.bubble {
  max-width: 76%; padding: 9px 14px; border-radius: 18px;
  font-size: 15px; line-height: 1.45; word-break: break-word; position: relative;
}
.bubble-row.them .bubble { background: var(--surface-3); color: var(--ink); border-bottom-left-radius: 5px; }
.bubble-row.me .bubble { background: var(--ink); color: var(--paper); border-bottom-right-radius: 5px; }
.bubble-t { display: block; font-family: var(--mono); font-size: 9px; opacity: .55; margin-top: 4px; text-align: right; }
.bubble mark { background: var(--accent); color: #fff; }

/* ============================================================
   FACES — identified people on photographs
   ============================================================ */
.face-strip { max-height: 86px; overflow-y: auto; }
.face-strip .chip .c { font-family: var(--mono); font-size: 10px; opacity: .6; margin-left: 4px; }
.ph-who {
  position: absolute; top: 8px; left: 8px; right: 8px;
  display: flex; align-items: center; gap: 5px;
  font-family: var(--mono); font-size: 9.5px; color: #fff;
  background: rgba(10, 12, 16, .62); backdrop-filter: blur(4px);
  border-radius: 6px; padding: 4px 8px; width: fit-content; max-width: calc(100% - 16px);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lb-stage { position: relative; display: inline-block; max-width: 100%; max-height: 82vh; }
.lb-stage img { display: block; }
.lb-boxes { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .25s; }
.lb-boxes.show { opacity: 1; }
.fbox {
  position: absolute; border: 1.5px solid var(--accent, #b0271d);
  border-radius: 3px; box-shadow: 0 0 0 1px rgba(0,0,0,.35);
}
.fbox i {
  position: absolute; top: calc(100% + 3px); left: 50%; transform: translateX(-50%);
  font-family: var(--mono); font-style: normal; font-size: 10px; white-space: nowrap;
  background: rgba(10, 12, 16, .85); color: #fff; border-radius: 5px; padding: 2px 7px;
}
.lb-faces {
  position: absolute; top: 3vh; left: 4vw; z-index: 2;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 15px; border-radius: 99px;
  background: rgba(255,255,255,.14); color: #fff;
  font-family: var(--mono); font-size: 11.5px; letter-spacing: .05em;
  transition: background .18s;
}
.lb-faces:hover { background: rgba(255,255,255,.26); }

/* ============================================================
   EVERYTHING — the complete-corpus search
   ============================================================ */
.all-list { border-top: 1px solid var(--line); }
.all-row {
  display: flex; align-items: baseline; gap: 18px;
  padding: 15px 12px; border-bottom: 1px solid var(--line);
  transition: background .14s, padding-left .2s var(--ease-out);
}
.all-row:hover { background: var(--surface); padding-left: 18px; }
.all-main { flex: 1; min-width: 0; }
.all-subj { display: block; font-family: var(--display); font-size: 18px; font-variation-settings: 'opsz' 40;
  line-height: 1.3; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.all-subj.mono-sm { font-family: var(--mono); font-size: 13px; }
.all-row:hover .all-subj { color: var(--accent-2); }
.all-sub { display: flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--ink-3); margin-top: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.all-ep { color: var(--gold); font-weight: 600; }
.all-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.all-date { font-family: var(--mono); font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.all-open { font-family: var(--mono); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.all-pager { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 30px 0; }
.filters .chip .c { font-family: var(--mono); font-size: 10px; opacity: .6; margin-left: 4px; }
@media (max-width: 680px) {
  .all-row { flex-direction: column; gap: 4px; }
  .all-side { flex-direction: row; align-items: baseline; gap: 12px; }
}

/* the on-site corpus reader */
.tag.mono-sm { text-transform: none; letter-spacing: .02em; }
.msg-body p { margin: 0 0 14px; }
.msg-body p:last-child { margin-bottom: 0; }
.quoteblk {
  margin: 0 0 14px; padding: 2px 0 2px 16px;
  border-left: 2px solid var(--line-2); color: var(--ink-2);
  font-variation-settings: 'opsz' 18; font-size: 17px;
}
.redacted-inline {
  font-family: var(--mono); font-size: .72em; letter-spacing: .05em;
  color: var(--accent); background: var(--accent-soft);
  border: 1px solid color-mix(in oklab, var(--accent) 30%, var(--line-2));
  border-radius: 4px; padding: 1px 5px; vertical-align: 1px; white-space: nowrap;
}
.rcpt { display: flex; gap: 8px; font-size: 13px; color: var(--ink-2); line-height: 1.5; min-width: 0; }
.rcpt-k { font-family: var(--mono); font-size: 10px; letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink-3); flex-shrink: 0; padding-top: 3px; min-width: 22px; }
.msg-src { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.thread-head {
  font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-3); margin: 44px 0 10px;
}
.all-row.current { background: var(--surface); }
.all-row.current .all-open { color: var(--ink-3); }

/* ============================================================
   PRINT — a record prints like a clean document
   ============================================================ */
@media print {
  .masthead, .foot, .grain, .progress, .totop, .skiplink,
  .reader-toprow, .printbtn, .toolbar, .filters, .loadmore-wrap { display: none !important; }
  body, .reader { background: #fff !important; color: #000 !important; }
  body::before { display: none; }
  .reader { max-width: 100%; padding-top: 0; }
  .reader-head { border-bottom-color: #000; }
  .msg { break-inside: avoid; border-bottom-color: #ccc; }
  .msg-body { font-size: 12pt; line-height: 1.6; }
  .redacted { background: #000 !important; box-shadow: none; }
  a { text-decoration: none; color: inherit; }
}

@media (max-width: 680px) {
  .sortbtn { padding: 12px 16px; }
  .reader-toprow { margin-bottom: 22px; }
  .rpos { padding: 0 4px; }
  .tl-item { grid-template-columns: 60px 1fr; gap: 10px; }
  .totop { right: 14px; bottom: 14px; }
}

/* ============================================================
   CUTTING EDGE — techniques you rarely see in production.
   Every block is progressive enhancement behind @supports.
   ============================================================ */

/* ---- platform niceties ---- */
html { scrollbar-gutter: stable; }
input { caret-color: var(--accent); accent-color: var(--accent); }
.section-head h1, .reader-head h1, .empty .serif { text-wrap: balance; }
.dek, .m-snip, .prose p, .tl-desc, .fnote { text-wrap: pretty; }
.mailrow { content-visibility: auto; contain-intrinsic-size: auto 128px; }

/* ---- View Transitions: routes cross-fade with a paper slide;
       the email subject MORPHS from the list row into the reader
       headline, and photos morph into the lightbox ---- */
@supports (view-transition-name: none) {
  ::view-transition-old(root) { animation: vt-out .28s var(--ease) both; }
  ::view-transition-new(root) { animation: vt-in .34s var(--ease-out) both; }
  @keyframes vt-out { to { opacity: 0; filter: blur(6px); transform: translateY(-6px); } }
  @keyframes vt-in { from { opacity: 0; filter: blur(6px); transform: translateY(10px); } }

  .vt-subj-src { view-transition-name: vt-subject; }
  .reader-head h1 { view-transition-name: vt-subject; }
  ::view-transition-group(vt-subject) { animation-duration: .38s; animation-timing-function: var(--ease-out); }
  ::view-transition-old(vt-subject), ::view-transition-new(vt-subject) { height: 100%; object-fit: none; overflow: clip; }

  .vt-photo-src { view-transition-name: vt-photo; }
  .lightbox img { view-transition-name: vt-photo; }
  ::view-transition-group(vt-photo) { animation-duration: .4s; animation-timing-function: var(--ease-out); }
}
/* while a transition runs, don't double-animate the incoming view */
@supports selector(html:active-view-transition) {
  html:active-view-transition .view { animation: none; }
}

/* ---- Scroll-driven animations (pure CSS, no JS): rows reveal as
       they enter the viewport; the hero drifts away as you scroll;
       timeline entries draw themselves in ---- */
@supports (animation-timeline: view()) {
  .mailrow { animation: rowview both var(--ease-out); animation-delay: 0s; animation-timeline: view(); animation-range: entry 0% entry 55%; }
  @keyframes rowview { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
  .tl-item { animation: rowview both var(--ease-out); animation-delay: 0s; animation-timeline: view(); animation-range: entry 0% entry 45%; }
  .doc, .person { animation: rowview both var(--ease-out); animation-timeline: view(); animation-range: entry 0% entry 40%; }
}
@supports (animation-timeline: scroll()) {
  .hero-title { animation: hero-drift linear both; animation-timeline: scroll(); animation-range: 0 420px; }
  @keyframes hero-drift { to { transform: translateY(46px); opacity: .18; filter: blur(5px); } }
  .hero .kicker, .hero-stamp { animation-name: drawline, hero-fade; }
  .hero-stamp { animation: stampin .5s var(--ease-out) 1.5s both, hero-fade linear both; animation-timeline: auto, scroll(); animation-range: normal, 0 300px; }
  @keyframes hero-fade { to { opacity: 0; } }
}

/* ---- Fraunces' hidden axes: the italic word goes gloriously
       wonky on hover (WONK + SOFT are real variable-font axes) ---- */
.redact-reveal, .logo b {
  font-variation-settings: 'opsz' 144, 'SOFT' 0, 'WONK' 0;
  transition: font-variation-settings .5s var(--ease);
}
.redact-reveal:hover, .wordmark:hover .logo b {
  font-variation-settings: 'opsz' 144, 'SOFT' 100, 'WONK' 1;
}

/* ---- interactive spotlight on the hero (follows the pointer) ---- */
.hero { position: relative; }
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .hero::after {
    content: ""; position: absolute; inset: -8% -6%; pointer-events: none; z-index: -1;
    opacity: 0; transition: opacity .5s var(--ease);
    background: radial-gradient(460px circle at var(--mx, 50%) var(--my, 40%),
      color-mix(in oklab, var(--accent) 8%, transparent), transparent 70%);
  }
  .hero:hover::after { opacity: 1; }
}

/* ---- 3D tilt on document & people cards ---- */
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .doc, .person {
    transform: perspective(760px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(var(--ty, 0px));
    transition: transform .3s var(--ease-out), box-shadow .25s, border-color .18s, background .18s;
    will-change: transform;
  }
  .doc:hover, .person:hover { --ty: -3px; }
}

/* ---- :has() focus mode — typing a query dims the hero above ---- */
@supports selector(body:has(a)) {
  .hero { transition: opacity .45s var(--ease), filter .45s var(--ease); }
  body:has(#q:focus) .hero { opacity: .3; filter: blur(3px) saturate(.7); }
}

/* ---- @property: the scroll-progress bar carries a living sheen ---- */
@property --pgx {
  syntax: '<percentage>'; inherits: false; initial-value: 0%;
}
.progress {
  background: linear-gradient(90deg,
    var(--accent) calc(-20% + var(--pgx)),
    var(--gold) calc(30% + var(--pgx)),
    var(--accent) calc(80% + var(--pgx)));
  animation: pgx 4.5s ease-in-out infinite alternate;
}
@keyframes pgx { to { --pgx: 40%; } }

/* ---- spring physics via linear() easing ---- */
@supports (transition-timing-function: linear(0, 1)) {
  .btn, .totop, .chip, .rnav {
    transition-timing-function: linear(0, 0.009, 0.035 2.1%, 0.141 4.4%, 0.723 12.9%, 0.938 16.7%,
      1.017, 1.077 20.4%, 1.121, 1.149 24.3%, 1.159, 1.163 27%, 1.154, 1.129 32.8%,
      1.051 39.6%, 1.017 43.1%, 0.991, 0.977 51%, 0.974 53.8%, 0.975 57.1%,
      0.997 69.8%, 1.003 76.9%, 1);
  }
}

/* ---- progressive blur masthead (Apple-style masked falloff) ---- */
.masthead { background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; }
.masthead::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: color-mix(in oklab, var(--paper) 76%, transparent);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  mask-image: linear-gradient(to bottom, black 58%, rgba(0,0,0,.4) 84%, transparent);
  -webkit-mask-image: linear-gradient(to bottom, black 58%, rgba(0,0,0,.4) 84%, transparent);
}
.masthead::after {
  content: ""; position: absolute; inset: 0 0 -16px 0; z-index: -1; pointer-events: none;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  mask-image: linear-gradient(to bottom, transparent 52%, black 76%, transparent);
  -webkit-mask-image: linear-gradient(to bottom, transparent 52%, black 76%, transparent);
}
.masthead-inner { position: relative; z-index: 1; }

/* ---- redaction bars shimmer while hovered ---- */
.redacted { background-size: 14px 14px; }
.redacted:hover { animation: redslide .5s linear infinite; }
@keyframes redslide { to { background-position: 14px 0; } }

/* ============================================================
   SIGNATURE MOMENTS — the declassification lens, the seismograph,
   and the flight-arc chart. All data-driven from the real archive.
   ============================================================ */

/* ---- declassification lens (canvas behind the hero) ---- */
.lens-canvas {
  position: absolute; inset: 0; z-index: -2; pointer-events: none;
  width: 100%; height: 100%;
}

/* ---- the seismograph: email volume per year, alive under the hero ---- */
.seismo { margin: 34px 0 6px; }
.seismo-label {
  font-family: var(--mono); font-size: 10px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 12px; display: flex; justify-content: space-between; gap: 12px;
}
.seismo-label .clr { color: var(--accent); cursor: pointer; letter-spacing: .1em; }
.seismo-track {
  display: flex; align-items: flex-end; gap: 4px; height: 84px;
  border-bottom: 1px solid var(--line-2); padding-bottom: 0;
}
.sbar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 0; cursor: pointer; position: relative; height: 100%; }
.sbar .fill {
  width: 100%; min-height: 2px; border-radius: 3px 3px 0 0;
  background: color-mix(in oklab, var(--ink-3) 46%, transparent);
  transition: height .55s var(--ease-out), background .25s;
}
.sbar:hover .fill { background: var(--accent); }
.sbar.sel .fill { background: var(--accent); box-shadow: 0 0 14px var(--accent-glow); }
.sbar .tip {
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%) translateY(3px);
  font-family: var(--mono); font-size: 10.5px; white-space: nowrap;
  background: var(--ink); color: var(--paper); border-radius: 6px; padding: 4px 8px;
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s var(--ease-out); z-index: 5;
}
.sbar:hover .tip, .sbar.sel .tip { opacity: 1; transform: translateX(-50%) translateY(0); }
.seismo-years {
  display: flex; gap: 4px; margin-top: 7px;
  font-family: var(--mono); font-size: 9.5px; color: var(--ink-3);
}
.seismo-years span { flex: 1; text-align: center; }

/* ---- flight-arc chart ---- */
.flightmap-wrap { margin: 6px 0 30px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-sm); overflow: hidden; position: relative; }
.flightmap-wrap .fm-label { position: absolute; bottom: 13px; left: 18px; font-family: var(--mono); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); }
.flightmap { display: block; width: 100%; height: auto; }
.flightmap .grat { stroke: var(--line); stroke-width: 1; }
.flightmap .wdot { fill: var(--line-2); }
[data-theme="dark"] .flightmap .wdot { fill: var(--surface-3); }
.flightmap .arc {
  fill: none; stroke: var(--accent); stroke-linecap: round;
  stroke-dasharray: 1; stroke-dashoffset: 1;
  animation: arcdraw 1.3s var(--ease-out) forwards; animation-delay: var(--d, 0s);
  transition: opacity .25s, stroke .25s;
}
@keyframes arcdraw { to { stroke-dashoffset: 0; } }
.flightmap .apg { pointer-events: bounding-box; cursor: pointer; }
.flightmap .apdot { fill: var(--ink); stroke: var(--surface); stroke-width: 1.5; transition: fill .2s; }
.flightmap .apdot:hover { fill: var(--accent); }
.flightmap .aplabel { font-family: var(--mono); font-size: 10.5px; fill: var(--ink-2); letter-spacing: .04em; }
.flightmap .apsub { font-family: var(--mono); font-size: 8.5px; fill: var(--ink-3); }
.flightmap.dimming .arc { opacity: .1; }
.flightmap.dimming .arc.lit { opacity: 1; stroke: var(--accent); }

/* ---- editorial drop cap on the opening message ---- */
.msg-body.dropcap::first-letter {
  font-family: var(--display); font-weight: 400; font-style: normal;
  font-size: 3.1em; line-height: .82; color: var(--accent);
  float: left; padding: .1em .14em .02em 0;
  font-variation-settings: 'opsz' 144;
}

@media (max-width: 680px) {
  .seismo-track { height: 60px; gap: 2px; }
  .seismo-years span:nth-child(odd) { visibility: hidden; }
  .flightmap-wrap .fm-label { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .redact-reveal::after { display: none; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
  .flightmap .arc { stroke-dashoffset: 0 !important; }
}
