/**
 * Paper Trail series navigation (pages/investors/paper-trail/*).
 * Tokens only (D-011). Components: sticky series bar with prev/next and a
 * ten-segment progress strip, hub Continue module, act rail, episode rows,
 * document plate, chapter list with tap-to-seek, "what you now own" callout,
 * next card, foot nav. The listener's progress lives in localStorage
 * (assets/js/paper-trail.js); everything here renders sensibly without it.
 */

/* ── Sticky series bar (episode pages) ── */
.pt-bar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: var(--fh-space-sm);
    padding: var(--fh-space-sm) var(--fh-space-md);
    background: color-mix(in srgb, var(--fh-surface) 92%, transparent);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--fh-rule);
    font-family: var(--fh-font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--fh-ink-2);
}
.pt-bar__mid {
    flex: 1;
    text-align: center;
    color: var(--fh-ink);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pt-bar__mid a {
    color: inherit;
    text-decoration: none;
}
.pt-bar__nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    min-height: 36px;
    border-radius: 50%;
    border: 1px solid var(--fh-rule);
    color: var(--fh-ink);
    background: var(--fh-surface);
    text-decoration: none;
    font-family: var(--fh-font-body);
    font-size: 1rem;
    line-height: 1;
}
.pt-bar__nav:hover { border-color: var(--fh-ink); }
.pt-bar__nav[aria-disabled="true"] { opacity: 0.35; pointer-events: none; }

/* ── Ten-segment progress strip (episode pages and hub) ── */
.pt-strip {
    display: flex;
    gap: 4px;
    justify-content: center;
    padding: var(--fh-space-sm) var(--fh-space-md) 0;
    list-style: none;
    margin: 0;
}
.pt-strip li {
    width: 22px;
    height: 3px;
    border-radius: 2px;
    background: var(--fh-rule);
}
.pt-strip li.is-done { background: var(--fh-accent); }
.pt-strip li.is-now { background: var(--fh-ink); }
.pt-strip li.is-soon { opacity: 0.5; }

/* ── Hub: Continue / Start module ── */
.pt-continue {
    margin: var(--fh-space-lg) 0 0;
    background: var(--fh-surface);
    border: 1px solid var(--fh-rule);
    border-radius: 12px;
    padding: var(--fh-space-md) var(--fh-space-lg);
    box-shadow: 0 4px 16px rgba(20, 30, 24, 0.07);
}
html[data-theme="night"] .pt-continue { box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35); }
.pt-continue__k {
    font-family: var(--fh-font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--fh-accent-text);
    margin: 0 0 4px;
}
.pt-continue__title {
    font-family: var(--fh-font-display);
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.01em;
    line-height: 1.1;
    margin: 0 0 var(--fh-space-sm);
}
.pt-continue__row {
    display: flex;
    align-items: center;
    gap: var(--fh-space-md);
    flex-wrap: wrap;
}
.pt-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    min-height: 40px;
    border-radius: 999px;
    font-family: var(--fh-font-body);
    font-weight: 600;
    font-size: 0.9rem;
    background: var(--fh-accent);
    color: var(--fh-accent-ink) !important;
    text-decoration: none !important;
    border: 1px solid transparent;
}
.pt-btn:hover { filter: brightness(0.95); }
.pt-btn--ghost {
    background: transparent;
    color: var(--fh-ink) !important;
    border-color: var(--fh-rule);
}
.pt-btn--ghost:hover { border-color: var(--fh-ink); filter: none; }
.pt-prog {
    flex: 1;
    min-width: 120px;
    height: 4px;
    background: var(--fh-rule);
    border-radius: 2px;
    position: relative;
    overflow: hidden;
}
.pt-prog i {
    position: absolute;
    inset: 0 auto 0 0;
    width: 0;
    background: var(--fh-accent);
    border-radius: 2px;
}
.pt-mono {
    font-family: var(--fh-font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.04em;
    color: var(--fh-ink-2);
    white-space: nowrap;
}

/* ── Hub: act rail ── */
.pt-rail {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin: var(--fh-space-lg) 0 0;
    padding: 0;
    list-style: none;
}
.pt-rail li {
    border-top: 3px solid var(--fh-rule);
    padding-top: 6px;
    font-family: var(--fh-font-mono);
    font-size: 0.62rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--fh-ink-2);
    line-height: 1.35;
}
.pt-rail li a { color: inherit; text-decoration: none; }
.pt-rail li.is-done { border-top-color: var(--fh-accent); }
.pt-rail li.is-now { border-top-color: var(--fh-ink); color: var(--fh-ink); font-weight: 600; }

/* ── Hub: act heading and episode rows ── */
.pt-act {
    font-family: var(--fh-font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--fh-ink-2);
    margin: var(--fh-space-2xl) 0 var(--fh-space-sm);
}
.pt-ep {
    display: grid;
    grid-template-columns: 44px 1fr auto;
    gap: var(--fh-space-md);
    align-items: start;
    background: var(--fh-surface);
    border: 1px solid var(--fh-rule);
    border-radius: 12px;
    padding: var(--fh-space-md);
    margin: 0 0 var(--fh-space-sm);
    text-decoration: none;
    color: inherit;
}
a.pt-ep:hover { border-color: var(--fh-ink); }
.pt-ep > span:nth-child(2) { display: block; min-width: 0; }
.pt-ep__doc, .pt-ep__title, .pt-ep__teaches, .pt-ep__meta { display: block; }
.pt-stat { white-space: normal; margin: var(--fh-space-sm) 0 0; }
.pt-ep__n {
    font-family: var(--fh-font-display);
    font-weight: 800;
    font-size: 1.75rem;
    line-height: 1;
    letter-spacing: -0.03em;
    color: var(--fh-ink-2);
}
.pt-ep.is-done .pt-ep__n { color: var(--fh-accent-text); }
.pt-ep__doc {
    font-family: var(--fh-font-mono);
    font-size: 0.65rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--fh-accent-text);
    margin: 0 0 3px;
}
.pt-ep__title {
    font-family: var(--fh-font-display);
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: -0.01em;
    line-height: 1.1;
    margin: 0 0 4px;
    color: var(--fh-ink);
}
.pt-ep__teaches {
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--fh-ink-2);
    margin: 0;
}
.pt-ep__meta {
    font-family: var(--fh-font-mono);
    font-size: 0.62rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--fh-ink-2);
    margin: 6px 0 0;
}
.pt-ep.is-done .pt-ep__meta { color: var(--fh-accent-text); }
.pt-ep__row[hidden],
.pt-prog[hidden],
.pt-mono[hidden] {
    display: none;
}
.pt-ep__row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}
.pt-ep__play {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--fh-accent);
    color: var(--fh-accent-ink);
    display: grid;
    place-items: center;
    font-size: 0.75rem;
}
.pt-ep--soon { opacity: 0.6; }
.pt-ep--soon .pt-ep__play { background: var(--fh-rule); color: var(--fh-ink-2); }
.pt-ep--soon .pt-ep__doc { color: var(--fh-ink-2); }

/* ── Document plate (episode and hub shelf) ── */
.pt-doc {
    display: grid;
    grid-template-columns: 56px 1fr;
    gap: var(--fh-space-md);
    align-items: center;
    background: var(--fh-tint);
    border: 1px solid var(--fh-rule);
    border-radius: 12px;
    padding: var(--fh-space-md);
    margin: var(--fh-space-md) 0 0;
    text-decoration: none;
    color: inherit;
}
.pt-doc__art {
    width: 56px;
    height: 72px;
    background: var(--fh-surface);
    border: 1px solid var(--fh-rule);
    border-radius: 3px;
    position: relative;
    box-shadow: 0 4px 12px rgba(20, 30, 24, 0.08);
}
.pt-doc__art::before {
    content: "";
    position: absolute;
    left: 8px;
    right: 8px;
    top: 10px;
    height: 3px;
    background: var(--fh-rule);
    box-shadow: 0 8px 0 var(--fh-rule), 0 16px 0 var(--fh-rule), 0 24px 0 var(--fh-rule), 0 32px 0 var(--fh-rule), 0 40px 0 var(--fh-rule);
}
.pt-doc__k {
    font-family: var(--fh-font-mono);
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--fh-accent-text);
    margin: 0 0 3px;
}
.pt-doc__title {
    font-family: var(--fh-font-display);
    font-weight: 700;
    font-size: 1.05rem;
    line-height: 1.15;
    letter-spacing: -0.01em;
    margin: 0 0 3px;
    color: var(--fh-ink);
}
.pt-doc__sub {
    font-size: 0.8rem;
    color: var(--fh-ink-2);
    margin: 0;
}
.pt-doc__sub a { color: var(--fh-accent-text); }

/* Hub: the documents shelf */
.pt-shelf { margin-top: var(--fh-space-2xl); }
.pt-shelf ol {
    list-style: none;
    padding: 0;
    margin: var(--fh-space-sm) 0 0;
    display: grid;
    gap: 6px;
}
.pt-shelf li {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    gap: var(--fh-space-sm);
    align-items: baseline;
    padding: 8px 0;
    border-bottom: 1px solid var(--fh-rule);
    font-size: 0.875rem;
}
.pt-shelf li span:first-child {
    font-family: var(--fh-font-mono);
    font-size: 0.7rem;
    color: var(--fh-ink-2);
}
.pt-shelf li a { color: var(--fh-accent-text); text-decoration: none; }
.pt-shelf li .pt-mono { font-size: 0.62rem; }

/* ── Chapter list (episode) ── */
.pt-chapters {
    list-style: none;
    padding: 0;
    margin: var(--fh-space-md) 0 0;
    border-top: 1px solid var(--fh-rule);
}
.pt-chapters li {
    border-bottom: 1px solid var(--fh-rule);
}
.pt-chapters button {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: var(--fh-space-sm);
    align-items: baseline;
    padding: 10px 0;
    background: none;
    border: 0;
    text-align: left;
    font-family: var(--fh-font-body);
    font-size: 0.9rem;
    color: var(--fh-ink);
    cursor: pointer;
}
.pt-chapters button:hover .pt-chapters__t { color: var(--fh-accent-text); }
.pt-chapters li.is-now button { font-weight: 600; }
.pt-chapters__time {
    font-family: var(--fh-font-mono);
    font-size: 0.68rem;
    color: var(--fh-accent-text);
    white-space: nowrap;
}

/* In-transcript chapter heads */
.pt-h {
    font-family: var(--fh-font-display);
    font-weight: 700;
    font-size: 1.3rem;
    letter-spacing: -0.01em;
    line-height: 1.1;
    margin: var(--fh-space-xl) 0 var(--fh-space-sm);
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--fh-space-sm);
    scroll-margin-top: 64px;
}
.pt-h button {
    font-family: var(--fh-font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.04em;
    color: var(--fh-accent-text);
    background: none;
    border: 0;
    padding: 6px 0 6px 8px;
    cursor: pointer;
    white-space: nowrap;
    min-height: 32px;
}
.pt-h button:hover { color: var(--fh-ink); }

/* ── "What you now own" ── */
.pt-own {
    border-left: 3px solid var(--fh-accent);
    padding: 6px 0 6px var(--fh-space-md);
    margin: var(--fh-space-xl) 0 0;
}
.pt-own__k {
    font-family: var(--fh-font-mono);
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--fh-accent-text);
    margin: 0 0 4px;
}
.pt-own p:last-child { margin: 0; font-size: 1rem; }

/* ── Next card and foot nav ── */
.pt-next {
    background: var(--fh-surface);
    border: 1px solid var(--fh-rule);
    border-radius: 12px;
    padding: var(--fh-space-md) var(--fh-space-lg);
    margin: var(--fh-space-xl) 0 0;
    box-shadow: 0 4px 16px rgba(20, 30, 24, 0.07);
}
html[data-theme="night"] .pt-next { box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35); }
.pt-next__k {
    font-family: var(--fh-font-mono);
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--fh-ink-2);
    margin: 0 0 4px;
}
.pt-next__title {
    font-family: var(--fh-font-display);
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.01em;
    line-height: 1.1;
    margin: 0 0 4px;
}
.pt-next p { margin: 0 0 var(--fh-space-sm); font-size: 0.9rem; color: var(--fh-ink-2); }
.pt-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--fh-space-sm);
    flex-wrap: wrap;
    margin: var(--fh-space-lg) 0 0;
    padding-top: var(--fh-space-md);
    border-top: 1px solid var(--fh-rule);
    font-family: var(--fh-font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.pt-foot a {
    color: var(--fh-accent-text);
    text-decoration: none;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
}
.pt-foot span[aria-disabled="true"] { color: var(--fh-ink-2); }

/* Investors index card: continue line */
.pt-card-continue {
    display: block;
    font-family: var(--fh-font-mono);
    font-size: 0.65rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--fh-accent-text);
    margin-top: 6px;
}

@media (max-width: 480px) {
    .pt-rail li { font-size: 0.56rem; }
    .pt-strip li { width: 18px; }
    .pt-ep { grid-template-columns: 36px 1fr auto; }
    .pt-ep__n { font-size: 1.5rem; }
}

/* ── Episode band: the numeral ──
   Sixteen episode pages once shared one photograph of Musk, cropped
   identically. A face repeated seventeen times stops identifying anything, so
   the episode number carries the band instead and the portrait keeps only two
   jobs: the series hub and the Paper Trail card on the investors index.

   Set on .ed-band as data-ep-num="01" (not data-ep, which .pt-strip li already
   uses for the progress ticks). No attribute -> no numeral, which is how
   the hub band (still a portrait) opts out. The band's own .ed-band__inner is
   z-index 1, so the numeral sits behind the text at z-index 0. */
.ed-band[data-ep-num]::after {
    content: attr(data-ep-num);
    position: absolute;
    right: 4%;
    top: 50%;
    transform: translateY(-50%);
    z-index: 0;
    font-family: var(--fh-font-display);
    font-weight: 400;
    font-size: 20rem;
    line-height: 0.8;
    letter-spacing: -0.05em;
    /* Deliberately near the floor. The numeral is a watermark, not a headline;
       the episode number is already stated in words in .ed-kicker. */
    color: color-mix(in srgb, var(--fh-on-inverse) 9%, transparent);
    pointer-events: none;
}

/* Night's --fh-surface-inverse is lighter than day's, so the same 9% mix reads
   flatter against it. */
[data-theme="night"] .ed-band[data-ep-num]::after {
    color: color-mix(in srgb, var(--fh-on-inverse) 12%, transparent);
}

/* Narrow: the band text goes full width and the headline wraps, so a centred
   numeral runs straight through it. Drop to a corner mark that bleeds off the
   bottom-right instead, clear of the wrapped title and subtitle. */
@media (max-width: 700px) {
    .ed-band[data-ep-num]::after {
        font-size: 9rem;
        top: auto;
        bottom: -0.22em;
        right: -0.06em;
        transform: none;
        color: color-mix(in srgb, var(--fh-on-inverse) 8%, transparent);
    }
    [data-theme="night"] .ed-band[data-ep-num]::after {
        color: color-mix(in srgb, var(--fh-on-inverse) 11%, transparent);
    }
}
