/* ========== EVIDENCE + BINDER: THE DARK PAGE ==========
   The preamble and intro play on the folder's beige. When they finish, #app takes the
   class `dark` and the rest (the evidence parts, ending with the binder) is on #232323. */

.binder-stage::before { /* a gradient can't transition, so the dark page fades in over the beige */
    content: '';
    position: absolute;
    inset: 0;
    background: #232323;
    opacity: 0;
    transition: opacity 0.8s ease;
    pointer-events: none;
}
#app.dark .binder-stage::before { opacity: 1; }
#app.dark .binder-stage { --drop: rgba(0,0,0,0.55); }
#app.dark .turn-hint { color: rgba(255,255,255,0.5); }
#app.dark .section-nav > button { color: rgba(255,255,255,0.45); }
#app.dark .section-nav > button:hover { color: #fff; }
#app.dark .section-nav > button[aria-current] { color: #fff; background: rgba(255,255,255,0.1); }
#app.dark .section-nav .sep { background: rgba(255,255,255,0.2); }

#app.dark .binder-hud {
    background: rgba(20,20,20,0.72);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.8);
}
#app.dark .binder-hud button:hover:not(:disabled) { background: rgba(255,255,255,0.12); color: #fff; }
#app.dark .binder-hud .count { color: rgba(255,255,255,0.45); }

/* the binder only shows on its own part */
.binder-stage[data-part]:not([data-binder]) .book { visibility: hidden; }
.binder-stage[data-part]:not([data-binder]) .turn-hint { display: none; }

/* a chapter's title card. The binder's chapter shows its card first, then the binder. */
.evidence-panel {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    padding: 0 20px;
    text-align: center;
    color: #fff;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0s 0.5s;
}
.evidence-panel.on { opacity: 1; visibility: visible; transition-delay: 0.15s, 0s; }
.evidence-panel .eyebrow { margin: 0; font: 400 12px/1 'Roboto Mono', ui-monospace, Menlo, monospace; letter-spacing: 0.16em; text-transform: uppercase; color: rgba(255,255,255,0.45); }
.evidence-panel h2 { margin: 0; max-width: 12em; text-wrap: balance; font: 400 clamp(40px, 7vw, 104px)/1 'Instrument Serif', 'Times New Roman', serif; letter-spacing: -0.03em; }
.evidence-panel h2 br.phone { display: none; } /* a break a card wants only on a phone (see the max-width block) */
.binder-stage.intro .evidence-panel { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
    .binder-stage::before, .evidence-panel { transition: none; }
}

/* ========== EVIDENCE TIMELINE ==========
   One scrolling page per chapter (built by story/evidence-timeline.js). Every entry is a row of
   three: its date, its mark on the line, and its body (the words, with the pictures beside them). */
.ev-tl {
    overflow-x: clip;
    --when: clamp(120px, 13vw, 190px);  /* the date column */
    --mark: 64px;                       /* the line's column */
    --red: #EA3325; /* the avatars' red in the pictures: solid, not the cast diagram's softer one */
    position: absolute;
    inset: 0;
    z-index: 30;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    color: #fff;
    outline: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.6s ease, visibility 0s 0.6s;
    /* entries slip away under the Cover link and the chip */
    --nav: 96px; /* the navigation's height, which the page's foot fades out under */
    -webkit-mask-image: linear-gradient(transparent 0, #000 84px, #000 calc(100% - var(--nav)), transparent 100%);
    mask-image: linear-gradient(transparent 0, #000 84px, #000 calc(100% - var(--nav)), transparent 100%);
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.18) transparent;
}
.ev-tl.on { opacity: 1; visibility: visible; transition-delay: 0.15s, 0s; }
.binder-stage.intro .ev-tl { opacity: 0; }
.ev-col { width: min(100% - 48px, 1240px); margin: 0 auto; padding: clamp(96px, 16vh, 170px) 0 calc(170px + var(--nav) - 96px); }

.ev-head .ev-button + .intro { margin-top: 2.2em; }
.ev-head .ev-subhead { max-width: 34em; }
.ev-head .ev-subhead + .intro { margin-top: 0.7em; } /* the subhead sits over its passage; .ev-rule's own margin spaces it from the one before */
.ev-head .intro + .intro, .ev-head .intro + ol, .ev-head .intro + ul, .ev-head ol + .intro, .ev-head ul + .intro { margin-top: 0.95em; }
.ev-head ol, .ev-head ul { max-width: 34em; font: 400 clamp(18px, 1.55vw, 24px)/1.4 'Inter Tight', sans-serif; color: rgba(255,255,255,0.82); padding-left: 1.3em; }
.ev-head li + li { margin-top: 0.5em; }
.ev-button { display: table; margin-top: 2.2em; padding: 16px 26px; border-radius: 999px; background: #fff; color: #232323; text-decoration: none; font: 600 clamp(16px, 1.3vw, 19px)/1 'Inter Tight', sans-serif; letter-spacing: -0.01em; transition: transform 0.15s, box-shadow 0.15s; }
.ev-button.chip { margin-top: 1.4em; padding: 10px 16px; background: none; color: rgba(255,255,255,0.75); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.28); font-size: 14px; font-weight: 500; }
.ev-button.chip:hover { color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.5); transform: none; }
.ev-button:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
.ev-rule { width: 2.5em; margin: 2.2em 0; border: 0; border-top: 1px solid rgba(255,255,255,0.3); }
/* buttons under the bio */
.ev-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; }
.ev-links a { display: inline-flex; align-items: baseline; gap: 8px; padding: 11px 16px 11px 18px; border-radius: 999px; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.22); color: #fff; text-decoration: none; font: 500 14px/1 'Inter Tight', sans-serif; letter-spacing: 0.01em; transition: background 0.2s, box-shadow 0.2s; }
.ev-links a:hover { background: rgba(255,255,255,0.08); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.45); }
.ev-links .h { color: rgba(255,255,255,0.55); font-weight: 400; }
.ev-links .go { font-size: 12px; color: rgba(255,255,255,0.55); }
.ev-head { padding-left: calc(var(--when) + var(--mark)); margin-bottom: clamp(64px, 11vh, 120px); }
.ev-head .eyebrow, .ev-next .eyebrow { display: block; margin: 0 0 16px; font: 400 12px/1 'Roboto Mono', ui-monospace, Menlo, monospace; letter-spacing: 0.16em; text-transform: uppercase; color: rgba(255,255,255,0.45); }
.ev-head .intro { max-width: 34em; margin: 0; font: 400 clamp(18px, 1.55vw, 24px)/1.4 'Inter Tight', sans-serif; text-wrap: pretty; color: rgba(255,255,255,0.82); user-select: text; -webkit-user-select: text; }

.ev-list { position: relative; display: grid; }
.ev-item + .ev-item, .ev-gap + .ev-item { margin-top: clamp(72px, 13vh, 150px); }
.ev-list::before { /* the line */
    content: '';
    position: absolute;
    top: 6px;
    bottom: 0;
    left: calc(var(--when) + var(--mark) / 2);
    width: 1px;
    background: linear-gradient(rgba(255,255,255,0.22) calc(100% - 120px), transparent);
}
.ev-item {
    display: grid;
    grid-template-columns: var(--when) var(--mark) minmax(0, 1fr);
    align-items: start;
    opacity: 0;
    transform: translateY(22px);
    transition: opacity 0.8s ease, transform 0.9s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.ev-item.in { opacity: 1; transform: none; }

.ev-when { text-align: right; font: 700 clamp(16px, 1.35vw, 21px)/1.3 'Inter Tight', sans-serif; letter-spacing: -0.005em; }
.ev-mark { display: flex; justify-content: center; padding-top: 0.1em; font-size: clamp(16px, 1.35vw, 21px); }
.ev-mark .dot { position: relative; z-index: 1; width: 9px; height: 9px; margin-top: 0.42em; border-radius: 50%; background: #fff; box-shadow: 0 0 0 6px #232323; }
.ev-item.undated .dot { width: 7px; height: 7px; background: rgba(255,255,255,0.5); }
.ev-mark .chip { /* whose move: their red initial, as on the phones in the pictures */
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--red);
    color: #111;
    font: 800 13px/1 'Inter Tight', sans-serif;
    box-shadow: 0 0 0 5px #232323;
    position: relative; /* over the line, never under it */
    z-index: 1;
}
.ev-mark .chip + .chip { margin-left: -5px; }

.ev-body { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 28px clamp(28px, 4vw, 64px); align-items: start; }
.ev-body > :only-child, .ev-item.wide .ev-body > * { grid-column: 1 / -1; }
/* Caption: the regular text of an entry */
.ev-text { max-width: 30em; font: 400 clamp(18px, 1.55vw, 24px)/1.36 'Inter Tight', sans-serif; text-wrap: pretty; user-select: text; -webkit-user-select: text; }
.ev-text > * + * { margin-top: 0.95em; }
.ev-text ul { padding-left: 1.05em; }
.ev-text ol { padding-left: 1.3em; }
.ev-text ol li { padding-left: 0.2em; }
.ev-text li + li { margin-top: 0.7em; }
.ev-text .ev-inline { max-width: var(--max); margin: 1.2em 0; } /* a picture set among the words */
.ev-text .ev-inline + * { margin-top: 1.2em; }
.ev-note { position: relative; padding-left: 1.5em; font-size: 0.76em; line-height: 1.4; color: rgba(255,255,255,0.74); }
.ev-note::before { content: '✳︎'; position: absolute; left: 0; top: -0.05em; font-size: 1.15em; color: #fff; }
.ev-note.plain { padding-left: 0; }
.ev-note.plain::before { content: none; }
.ev-note p + p { margin-top: 0.9em; }

.ev-figs { display: flex; align-items: flex-start; gap: 22px; } /* side by side, shrinking to fit */
.ev-item.stack .ev-figs { flex-direction: column; }
.ev-item.stack .ev-fig { flex: none; width: 100%; }
.ev-fig { margin: 0; flex: 0 1 var(--max); max-width: var(--max); min-width: 0; }
.ev-fig img { display: block; width: 100%; height: auto; cursor: zoom-in; }
.ev-fig video { display: block; width: 100%; height: auto; background: #000; }
.ev-credit { margin: 8px 0 0; font: 400 12px/1.3 'Roboto Mono', ui-monospace, Menlo, monospace; letter-spacing: 0.04em; color: rgba(255,255,255,0.45); } /* a small line under a picture */
.ev-fig.screen .ev-credit { padding-left: 4px; }
.ev-fig { position: relative; }
.ev-fig canvas.stars { position: absolute; pointer-events: none; } /* sized and placed by story/stars.js: three pictures wide, centred on the picture, so the stars can fly past its frame */
.ev-fig:has(canvas.stars) > img:first-child { cursor: default; }
.ev-fig canvas.stars + img, .ev-fig:has(canvas.stars) > img:first-child { visibility: hidden; } /* the still is only for when the stars can't be drawn */

/* ========== NIGHT ==========
   While a night figure is mostly in view: the page fades to black and a sky of twinkling
   lights comes out behind everything (story/stars.js draws it on .night-sky). */
.binder-stage::before { transition: opacity 0.8s ease, background-color 1.6s ease; }
#app.dark .binder-stage.night::before { background: #000; }
.night-sky { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; opacity: 0; transition: opacity 1.6s ease; }
.binder-stage.night .night-sky { opacity: 1; }
.binder-stage.night .ev-mark .dot, .binder-stage.night .ev-mark .chip { box-shadow: 0 0 0 5px #000; transition: box-shadow 1.6s ease; }
.binder-stage.night .ev-list::before { opacity: 0.6; }
.ev-fig .over { position: absolute; width: var(--w); max-width: calc(100% - var(--x, 0px)); height: auto; filter: drop-shadow(0 6px 18px rgba(0,0,0,0.55)); } /* a picture laid over another */
.ev-fig .over.screen { border-radius: 999px; box-shadow: none; }
/* a raw screenshot: a screen's corners, and an edge so its black doesn't melt into the page */
.ev-fig.screen img, .ev-fig.screen video { border-radius: clamp(18px, 2.2vw, 30px); box-shadow: 0 0 0 1px rgba(255,255,255,0.14); }
/* a paper document: a relic laid on the page, not a scan */
.ev-fig.relic { padding: 14px 10px 22px; }
.ev-fig.relic img { transform: rotate(-2.2deg); border-radius: 1px; box-shadow: 0 1px 2px rgba(0,0,0,0.3), 0 6px 14px rgba(0,0,0,0.28); }
/* a picture the comp ran off its edge fades out there instead of stopping dead */
.ev-fig.cut-bottom img { -webkit-mask-image: linear-gradient(#000 91%, transparent); mask-image: linear-gradient(#000 91%, transparent); }
.ev-fig.cut-right img { -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); mask-image: linear-gradient(90deg, #000 88%, transparent); }
/* an IP instance: a log card, the address in a dot-matrix face on one line (evidence-timeline.js
   shrinks it where the column is narrower still) over the analyst's note as label / value rows */
.ev-log { max-width: 520px; margin: 0 0 22px; padding: 18px 20px 20px; border: 1px solid rgba(255,255,255,0.16); border-radius: 12px; }
.ev-log:last-child { margin-bottom: 0; }
.ev-ip { margin: 0; font: 700 clamp(34px, 4vw, 60px)/1 'Handjet', 'Anton', Impact, 'Arial Narrow Bold', sans-serif; letter-spacing: 0.02em; white-space: nowrap; user-select: text; -webkit-user-select: text; }
.ev-ip + dl { margin-top: 16px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,0.12); }
.ev-log dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 9px 20px; align-items: baseline; margin: 0; }
.ev-log dt { font: 400 11px/1.4 'Roboto Mono', ui-monospace, Menlo, monospace; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(255,255,255,0.45); white-space: nowrap; }
.ev-log dd { margin: 0; font: 400 15px/1.4 'Inter Tight', sans-serif; color: #fff; }
.ev-item.wide .ev-fig { flex: 1 1 0; }

/* a break in the timeline: the line zig-zags for a stretch, then straightens out again */
.ev-gap { position: relative; height: 0; z-index: 1; } /* the zig-zag is drawn in the space between the entries either side */
.ev-gap::before { position: absolute; top: calc(0.5 * clamp(72px, 13vh, 150px) - 34px); height: 68px; }
.ev-gap::before {
    content: '';
    left: calc(var(--when) + var(--mark) / 2 - 7px);
    width: 14px;
    /* the page's dark blots out the straight line; the zig-zag is drawn over it */
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='16' viewBox='0 0 14 16'%3E%3Cpath d='M7 0 L1.5 4 L12.5 12 L7 16' fill='none' stroke='rgba(255,255,255,0.32)' stroke-width='1'/%3E%3C/svg%3E") center top / 14px 16px repeat-y,
        #232323;
}
.ev-gap-words { position: absolute; left: calc(var(--when) + var(--mark)); top: calc(0.5 * clamp(72px, 13vh, 150px) - 0.65em); font: 400 clamp(15px, 1.2vw, 18px)/1.3 'Inter Tight', sans-serif; font-style: italic; color: rgba(255,255,255,0.45); }
.ev-gap-words:empty { display: none; }
.binder-stage.night .ev-gap::before { background-color: #000; }

/* Subhead: the large serif, for a beat of my own story. (Caption is .ev-text's own style, above.) */
.ev-subhead { margin: 0; font: 400 clamp(34px, 4.2vw, 64px)/1.04 'Instrument Serif', 'Times New Roman', serif; letter-spacing: -0.03em; text-wrap: balance; }
.ev-text > .ev-subhead:first-child { margin-top: -0.12em; } /* its cap height lines up with the date */
.ev-text > .ev-subhead + .ev-subhead { margin-top: 0.3em; }
.ev-text > .ev-subhead + p { margin-top: 0.8em; }
.beat .ev-body { display: block; }
.has-subhead .ev-text { max-width: none; }
.has-subhead .ev-text p { max-width: 30em; }
.beat .ev-side { margin-top: 28px; }


/* the chapter's closing words: the bio's style, under the last entry */
.ev-outro { max-width: 34em; margin: clamp(90px, 16vh, 170px) 0 0 calc(var(--when) + var(--mark)); font: 400 clamp(18px, 1.55vw, 24px)/1.4 'Inter Tight', sans-serif; text-wrap: pretty; color: rgba(255,255,255,0.82); user-select: text; -webkit-user-select: text; }
.ev-outro > * + * { margin-top: 0.95em; }
.ev-outro a, .ev-text a { color: #fff; text-decoration: underline; text-underline-offset: 0.18em; text-decoration-color: rgba(255,255,255,0.4); }
.ev-outro a:hover, .ev-text a:hover { text-decoration-color: #fff; }
.ev-outro ul { padding-left: 1.05em; }
.ev-outro ol { padding-left: 1.3em; }
.ev-outro li + li { margin-top: 0.5em; }
.ev-coda { max-width: none; width: min(100% - 48px, 1240px); margin: clamp(60px, 10vh, 120px) auto clamp(120px, 20vh, 220px); padding-left: calc(var(--when) + var(--mark)); box-sizing: border-box; } /* after the binder: the same column as the timeline's */
.ev-coda p { max-width: 34em; }

.ev-next {
    appearance: none;
    display: block;
    margin: clamp(90px, 16vh, 170px) 0 0 calc(var(--when) + var(--mark));
    padding: 0;
    border: 0;
    background: none;
    color: #fff;
    text-align: left;
    cursor: pointer;
}
.ev-next.in-coda { margin-left: 0; } /* inside the closing words' column already */
.ev-next .name { font: 400 clamp(28px, 3.2vw, 46px)/1.05 'Instrument Serif', 'Times New Roman', serif; letter-spacing: -0.02em; opacity: 0.85; transition: opacity 0.2s; }
.ev-next:hover .name { opacity: 1; }

/* a picture, enlarged */
.ev-zoom { position: fixed; inset: 0; z-index: 400; display: grid; place-items: center; padding: 20px; background: rgba(20,20,20,0.94); opacity: 0; visibility: hidden; transition: opacity 0.25s ease, visibility 0s 0.25s; cursor: zoom-out; }
.ev-zoom.on { opacity: 1; visibility: visible; transition-delay: 0s; }
.ev-zoom img { max-width: 100%; max-height: calc(100dvh - 40px); object-fit: contain; }

/* the binder, at the foot of its chapter's page: a screen of its own, which the page settles on */
.ev-tl { scroll-snap-type: y proximity; }
.ev-binder { min-height: 100dvh; display: grid; place-items: center; padding: 56px 0 66px; overflow-x: clip; overflow-y: visible; scroll-snap-align: center; }
.binder-stage[data-part] .ev-tl .book, .binder-stage[data-part]:not([data-binder]) .ev-tl .book { visibility: visible; }

/* narrow: the line moves to the edge; date, words, pictures stack beside it */
@media (max-width: 860px) {
    .evidence-panel h2 br.phone { display: inline; }
    .ev-tl { --when: 0px; --mark: 34px; }
    .ev-col { width: min(100% - 36px, 560px); }
    .ev-item { grid-template-columns: var(--mark) minmax(0, 1fr); }
    .ev-when { grid-column: 2; grid-row: 1; text-align: left; margin-bottom: 12px; }
    .ev-mark { grid-column: 1; grid-row: 1; justify-content: flex-start; }
    .ev-mark .dot { margin-left: 4px; }
    .ev-item.undated .ev-when { display: none; }
    .ev-body { grid-column: 2; grid-template-columns: minmax(0, 1fr); }
    .ev-gap::before { left: 1px; }
    .ev-gap-words { left: var(--mark); }
    .ev-list::before { left: 8px; }
    .ev-mark .chip { width: 18px; height: 18px; font-size: 10px; box-shadow: 0 0 0 4px #232323; margin-top: 0.1em; }
    .ev-mark .chip + .chip { margin-left: -8px; }
    .ev-item.wide .ev-figs { flex-wrap: wrap; }
    .ev-item.wide .ev-fig { flex: none; width: 100%; }
    .ev-item.wide .ev-fig.screen { width: calc(50% - 11px); } /* raw screenshots go two by two */
    .ev-log { max-width: none; padding: 16px 16px 18px; }
    .ev-ip { font-size: clamp(26px, 8.6vw, 44px); }
    .ev-log dl { gap: 8px 14px; }
}

@media (prefers-reduced-motion: reduce) {
    .ev-tl, .ev-item, .ev-zoom { transition: none; }
}
