/* ========== INTRO: THE TIMELINE ==========
   Drawn by timeline.js; shown by the frame sequence in index.html, which adds the state
   classes below one after another (they add up). Units inside the drawing are canvas
   units (2000 wide); the headline is HTML, sized from the drawing's width. */

#timeline-scene {
    width: min(100vw - 32px, 1500px, 88dvh * 1.794);
    container-type: inline-size;
}
#timeline-scene svg { overflow: visible; }
#timeline-scene text { font-family: 'Inter Tight', sans-serif; text-anchor: start; dominant-baseline: auto; fill: #111; transition: fill 0.8s ease; }

/* headline: editorial serif, top of the canvas */
#timeline-scene .scene-header {
    top: 7%;
    bottom: auto;
    font: 400 clamp(30px, 6.6vw, 110px)/1 'Instrument Serif', 'Times New Roman', serif;
    font-size: 7.4cqw; /* of the drawing's width, so it keeps the comp's proportions */
    letter-spacing: -0.035em;
    text-wrap: nowrap;
    color: #111;
}
#timeline-scene .scene-header .line + .line { margin-top: 0; }
#timeline-scene .scene-header em { font-style: italic; letter-spacing: -0.04em; }

/* ---------- parts ---------- */
.tl-tick, .tl-axis, .tl-axis-ext { stroke: #111; stroke-width: 2.5px; }
.tl-soft { fill: #EC615F; }
.tl-hard { fill: #EA3323; }
.tl-wedge { fill: #EC615F; }
.tl-label { fill: #222; }
#timeline-scene .tl-mono { font: 24px 'Roboto Mono', ui-monospace, Menlo, monospace; fill: #fff; dominant-baseline: central; }
#timeline-scene .tl-title { font-size: 31px; font-weight: 500; }
#timeline-scene .tl-sub { font-size: 26px; }
#timeline-scene .tl-date { font-size: 26px; font-style: italic; }
#timeline-scene .tl-mark { font-size: 27px; text-anchor: middle; }
#timeline-scene .tl-strong { font-size: 31px; font-weight: 800; }

/* everything starts away */
.tl-axis { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 1.3s cubic-bezier(0.6, 0, 0.2, 1) 0.2s, opacity 0.4s ease; }
.tl-axis-ext { opacity: 0; transition: opacity 0.5s ease; }
.tl-ms { opacity: 0; transform: translateY(10px); transition: opacity 0.6s ease, transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1); }
.tl-mstext { transition: opacity 0.8s ease; }
.tl-wedge { transform: scale(0); transform-origin: 350px 800px; transition: transform 1.7s cubic-bezier(0.6, 0, 0.2, 1), opacity 0.4s ease; }
.tl-pop { opacity: 0; transform: scale(0.5); transform-origin: var(--ox) var(--oy); transition: opacity 0.3s ease, transform 0.5s cubic-bezier(0.2, 0.9, 0.25, 1.3); }
.tl-grow { transform: scale(0); transform-origin: var(--ox) var(--oy); transition: transform 0.7s cubic-bezier(0.2, 0.9, 0.2, 1); }
.tl-grow-y { transform: scaleY(0); }
.tl-slow, .tl-sudden, .tl-esc-labels, .tl-milestones { transition: opacity 0.45s ease; }

/* journey: the line draws, the milestones arrive in the order they happened */
.journey .tl-axis { stroke-dashoffset: 0; }
.journey .tl-ms { opacity: 1; transform: none; transition-delay: calc(0.9s + var(--i) * 0.45s); }

/* pattern: the work recedes, the red rises */
.pattern .tl-ms { transition-delay: 0s; }
.pattern .tl-mstext text { fill: #8a8272; }
.pattern .tl-wedge { transform: none; transition-delay: 0.3s; }

/* slowly: one at a time */
.slowly .tl-mstext { opacity: 0.22; }
.slowly .tl-slow .tl-pop { opacity: 1; transform: none; transition-delay: calc(0.7s + var(--at)); } /* --at: arrival times that bunch up (timeline.js) */

/* suddenly: the old stretch goes, the new one lands almost together */
.suddenly .tl-milestones, .suddenly .tl-slow { opacity: 0; }
.suddenly .tl-wedge { opacity: 0; transition-delay: 0s; }
.suddenly .tl-axis-ext { opacity: 1; }
.suddenly .tl-sudden .tl-grow { transform: none; transition-delay: calc(0.35s + var(--i) * 0.09s); }
.suddenly .tl-sudden .tl-pop { opacity: 1; transform: none; transition-delay: calc(0.5s + var(--i) * 0.06s); }

/* escalate: one block */
.escalate .tl-sudden { opacity: 0; }
.escalate .tl-esc .tl-grow { transform: none; transition: transform 1s cubic-bezier(0.7, 0, 0.15, 1) 0.3s; }
.escalate .tl-esc .tl-pop { opacity: 1; transform: none; transition-delay: calc(0.8s + var(--i) * 0.12s); }

/* territory: the block becomes the page */
.territory .tl-esc .tl-block { transform: scale(9); transition: transform 0.9s cubic-bezier(0.7, 0, 0.2, 1); }
.territory .tl-esc-labels, .territory .tl-esc > .tl-pop { opacity: 0; transition: opacity 0.25s ease; }
.territory .tl-axis, .territory .tl-axis-ext { opacity: 0; transition: opacity 0.25s ease; }

/* the sentence on the red: white bars, black type, no easing */
.tl-verdict {
    position: absolute;
    inset: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.16em;
    font: italic 800 clamp(24px, 6vw, 88px)/1 'Inter Tight', sans-serif;
    font-size: 6.4cqw;
    letter-spacing: -0.03em;
    color: #000;
    text-align: center;
}
.tl-verdict span { background: #fff; padding: 0.1em 0.28em 0.14em; white-space: nowrap; visibility: hidden; }
/* each bar is stamped on alone, with a long beat before the next */
.territory .tl-verdict span { visibility: visible; transition: visibility 0s calc(0.7s + var(--i) * 0.75s); }

/* legal: the sentence goes, the red drains to the evidence section's charcoal, and a
   spreadsheet page lies on it, a little askew */
.tl-block .tl-hard { transition: fill 1.3s ease 0.2s; }
.legal .tl-block .tl-hard { fill: #232323; }
.legal .tl-verdict { opacity: 0; transition: opacity 0.5s ease; }
.tl-legal {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 90cqw;
    padding: 3.2cqw 3.4cqw 3.6cqw 2.2cqw;
    border-radius: 3.4cqw;
    background: #fff;
    color: #111;
    font: 400 1.22cqw/1.25 Arial, Helvetica, sans-serif;
    box-shadow: 0 2.4cqw 5cqw rgba(0, 0, 0, 0.35);
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, -44%) rotate(-5deg);
    transition: opacity 0.5s ease, transform 0.9s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s 0.5s;
}
.legal .tl-legal { pointer-events: auto; cursor: pointer; opacity: 1; visibility: visible; transform: translate(-50%, -50%) rotate(-5deg); transition-delay: 0.55s, 0.55s, 0s; }
.tl-legal-row { display: grid; grid-template-columns: 2.4em 10.6em 1fr 6.2em 4.6em 3.6em 5.2em; align-items: baseline; border-bottom: 1px solid #e3e3e3; }
.tl-legal-row > span { padding: 0.36em 0.5em; }
.tl-legal-row .n { color: #b0b0b0; text-align: center; font-size: 0.92em; }
.tl-legal-row .code { border-left: 1px solid #e3e3e3; }
.tl-legal-row .claim { border-left: 1px solid #e3e3e3; font-weight: 700; }
.tl-legal-row .kind { border-left: 1px solid #e3e3e3; font-size: 0.86em; letter-spacing: 0.04em; text-transform: uppercase; color: #666; }
.tl-legal-row .kind.criminal { color: #b3261e; }
.tl-legal-row .kind.both { color: #e0761b; }
.tl-legal-row .tick { border-left: 1px solid #e3e3e3; text-align: center; padding-left: 0; padding-right: 0; font-weight: 700; align-self: stretch; line-height: 1.2; }
.tl-legal-row .tick:empty::before { content: '\00a0'; }
/* pairs: one cell across all three columns, with a line joining each pair (--a to --b, as column indexes) */
.tl-legal-row .tick.pairs { grid-column: 5 / span 3; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: 0.55em 0.55em; align-content: center; row-gap: 0.4em; align-self: stretch; }
.tl-legal-row .tick.pairs .pair { height: 2px; align-self: center; background: #111; border-radius: 1px; margin: 0 1.1em; } /* each line spans its pair's two columns (set inline), a little in from the centres */
.tl-legal-row .tick.pairs .pair + .pair { grid-row: 2; } /* an empty box still fills its row, so the column lines run through */
.tl-legal-row.tl-legal-head .tick { color: #555; font-size: 0.9em; }
.tl-legal-head .short { display: none; } /* a phone shows the initials instead of the names */
.tl-legal-row.tl-legal-head { background: #efefef; font-weight: 700; }
.tl-legal-row.tl-legal-head > span + span { border-left: 1px solid #e3e3e3; }
.tl-legal-row:not(.tl-legal-head) { opacity: 0; transition: opacity 0.4s ease; }
.legal .tl-legal-row:not(.tl-legal-head) { opacity: 1; transition-delay: calc(1s + var(--i) * 0.07s); }

/* ========== upright phone: the vertical version ==========
   The wide drawing is swapped for .tlv (built by timeline.js). The line runs down the left;
   each state has its own set of items, which take the class `in` one step at a time.
   Sizes are in em off a base that follows the screen's height, so every state fits. */
.tlv { display: none; }
@media (max-width: 767px) and (orientation: portrait) {
    #timeline-scene { top: 0; left: 0; width: 100%; height: 100%; transform: none; }
    #timeline-scene.on.leaving { transform: translateY(-10px); }
    #timeline-scene svg { display: none; }
    #timeline-scene .scene-header {
        top: 62px;
        left: 16px;
        right: 16px;
        font-size: clamp(30px, 9.4vw, 44px);
        text-wrap: balance;
        white-space: normal;
        text-align: left;
    }
    .tl-verdict { font-size: 11.5vw; }
    /* the sheet: one column, the claim over its code */
    .tl-legal { width: 92vw; padding: 20px 14px 22px 8px; border-radius: 22px; font-size: clamp(9.5px, 1.32dvh, 12px); transform: translate(-50%, -46%) rotate(-3deg); }
    .legal .tl-legal { transform: translate(-50%, -50%) rotate(-3deg); }
    .tl-legal-row { grid-template-columns: 2.4em 1fr auto 1.6em 1.6em 1.6em; }
    .tl-legal-row .claim { grid-column: 2; grid-row: 1; padding-bottom: 0; }
    .tl-legal-row .claim .nb { display: inline-block; } /* a phone breaks the long claim before "Economic Advantage" */
    .tl-legal-row .code { grid-column: 2; grid-row: 2; padding-top: 0.1em; color: #444; }
    .tl-legal-row .kind { grid-column: 3; grid-row: 1 / span 2; align-self: center; border-left: 0; }
    .tl-legal-row .tick { grid-row: 1 / span 2; align-self: center; border-left: 0 !important; padding-left: 0.2em; padding-right: 0.2em; }
    .tl-legal-row .tick:empty::before { content: '·'; color: #ccc; } /* an empty box still shows the column */
    .tl-legal-row .tick.pairs { grid-column: 4 / span 3; }
    .tl-legal-row .n { grid-row: 1 / span 2; align-self: center; }
    /* the head row stays, but only for the initials over the tick columns */
    .tl-legal-row.tl-legal-head { display: grid; background: none; border-top: 0; border-bottom: 0; }
    .tl-legal-row.tl-legal-head > span { display: none; } /* only the initials over the tick columns remain */
    .tl-legal-row.tl-legal-head { border-bottom: 1px solid #e3e3e3; }
    .tl-legal-row.tl-legal-head .tick { display: block; grid-row: 1; font-size: 0.85em; line-height: 1; padding-top: 0.2em; padding-bottom: 0.3em; }
    .tl-legal-row.tl-legal-head .tick:nth-last-child(3) { grid-column: 4; }
    .tl-legal-row.tl-legal-head .tick:nth-last-child(2) { grid-column: 5; }
    .tl-legal-row.tl-legal-head .tick:nth-last-child(1) { grid-column: 6; }
    .tl-legal-head .full { display: none; }
    .tl-legal-head .short { display: inline; }

    .tlv {
        --x: 2.6em; /* where the line is */
        display: block;
        position: absolute;
        top: 168px;
        left: 16px;
        right: 16px;
        bottom: 76px;
        font: 400 clamp(10px, 1.55dvh, 14px)/1.25 'Inter Tight', sans-serif;
        color: #111;
    }
    .tlv-line { position: absolute; left: var(--x); top: 0; bottom: 0; width: 2px; margin-left: -1px; background: #111; transform: scaleY(0); transform-origin: 50% 0; transition: transform 1.2s cubic-bezier(0.6, 0, 0.2, 1) 0.2s, opacity 0.3s ease; }
    .journey .tlv-line { transform: none; }
    .tlv-wedge { position: absolute; left: var(--x); width: 2.3em; top: 10%; bottom: 0; background: #EC615F; clip-path: polygon(0 0, 100% 100%, 0 100%); /* widens to the right of the line, under the labels */ transform: scaleY(0); transform-origin: 50% 0; transition: transform 1.6s cubic-bezier(0.6, 0, 0.2, 1) 0.3s, opacity 0.4s ease; }
    .pattern .tlv-wedge { transform: none; }
    .suddenly .tlv-wedge { opacity: 0; transition-delay: 0s; }

    .tlv-set { position: absolute; inset: 0; margin: 0; padding: 0; list-style: none; opacity: 0; visibility: hidden; transition: opacity 0.45s ease, visibility 0s 0.45s, color 0.8s ease; }
    .tlv-item { opacity: 0; transform: translateY(0.6em); transition: opacity 0.45s ease, transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1); transition-delay: calc(var(--i, 0) * 0.07s); }
    .tlv-item.in { opacity: 1; transform: none; }
    .tlv-chip { display: inline-block; background: #222; color: #fff; font: 0.95em/1 'Roboto Mono', ui-monospace, Menlo, monospace; padding: 0.55em 0.7em; white-space: nowrap; }

    /* journey */
    .journey .tlv-journey, .slowly .tlv-slowly, .suddenly .tlv-suddenly, .escalate .tlv-escalate { opacity: 1; visibility: visible; transition-delay: 0s; }
    .tlv-journey { font-size: 1.28em; display: flex; flex-direction: column; justify-content: space-between; padding: 0.4em 0 1.2em; }
    .tlv-journey .tlv-item { position: relative; padding-left: calc(var(--x) / 1.28 + 2.2em); display: flex; flex-direction: column; gap: 0.18em; }
    .tlv-journey .tlv-item::before { content: ''; position: absolute; left: calc(var(--x) / 1.28); top: 0.62em; width: 1.7em; height: 2px; background: #111; }
    .tlv-title { font-weight: 500; }
    .tlv-sub { font-size: 0.86em; }
    .tlv-date { font-size: 0.86em; font-style: italic; }
    .pattern .tlv-journey { color: #8a8272; }
    .slowly .tlv-journey { opacity: 0; visibility: hidden; transition-delay: 0s, 0.45s, 0s; }

    /* slowly */
    .tlv-slowly { font-size: 1.12em; display: flex; flex-direction: column; justify-content: space-between; padding: 0.2em 0 0.6em; }
    .tlv-slowly .tlv-item { position: relative; display: flex; align-items: center; min-height: max(2.3em, var(--d)); padding-left: calc(var(--x) / 1.12 + 2em); }
    .tlv-dot { position: absolute; left: calc(var(--x) / 1.12); top: 50%; width: var(--d); height: var(--d); translate: -50% -50%; border-radius: 50%; background: #EC615F; }
    .tlv-slowly .tlv-chip { position: relative; }
    .suddenly .tlv-slowly { opacity: 0; visibility: hidden; transition-delay: 0s, 0.45s, 0s; }

    /* suddenly */
    .tlv-suddenly { display: flex; flex-direction: column; justify-content: space-between; }
    .tlv-group { position: relative; padding-left: calc(var(--x) + 1.4em); }
    .tlv-group::before { content: ''; position: absolute; left: var(--x); top: 0.7em; width: 1em; height: 2px; background: #111; z-index: 1; }
    .tlv-mark { position: relative; margin: 0 0 0.55em; font: 500 1.15em/1.2 'Inter Tight', sans-serif; }
    .tlv-strong { font-weight: 800; }
    .tlv-chips { position: relative; display: flex; flex-wrap: wrap; gap: 0.45em; }
    .tlv-chips .tlv-chip:nth-child(even) { margin-left: 1.2em; }
    .tlv-shape { position: absolute; left: var(--x); transform: scaleX(0); transform-origin: 0 50%; transition: transform 0.7s cubic-bezier(0.2, 0.9, 0.2, 1) calc(0.15s + var(--i, 0) * 0.09s); }
    .tlv-item.in .tlv-shape { transform: none; }
    .tlv-shape.bar { top: 2.1em; height: 2.4em; }
    .tlv-shape.soft { width: 78%; background: #EC615F; }
    .tlv-shape.hard { width: 62%; background: #EA3323; }
    .tlv-shape.disc { top: 50%; width: 8.5em; height: 8.5em; margin-top: -4.25em; border-radius: 50%; background: #EA3323; transform: scale(0); transform-origin: 0 50%; }
    .tlv-shape.disc.big { width: 13em; height: 13em; margin-top: -6.5em; }
    .tlv-group:nth-child(3) { min-height: 7.5em; }
    .tlv-group:nth-child(4) { min-height: 10em; }
    .escalate .tlv-suddenly { opacity: 0; visibility: hidden; transition-delay: 0s, 0.45s, 0s; }

    /* escalate, then territory */
    .tlv-escalate { display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; padding: 0 0 1.2em; }
    .tlv-block { position: absolute; left: calc(var(--x) + 1em); right: -16px; top: 4.6em; bottom: -76px; background: #EA3323; transform: scaleY(0); transform-origin: 50% 100%; transition: transform 1s cubic-bezier(0.7, 0, 0.15, 1) 0.2s; }
    .escalate .tlv-block { transform: none; }
    .tlv-escalate .tlv-mark { padding-left: calc((var(--x) + 1.4em) / 1.15); margin-bottom: 1.6em; }
    .tlv-escalate .tlv-mark::before { content: ''; position: absolute; left: calc(var(--x) / 1.15); top: 0.6em; width: calc(1em / 1.15); height: 2px; background: #111; } /* the same notch the four moments before it have */
    .tlv-escalate .tlv-chip { position: relative; margin-left: calc(var(--x) + 2.2em); font-size: 1.05em; }
    .tlv-escalate .tlv-chip:nth-child(odd) { align-self: flex-end; margin-right: 0.6em; }
    .tlv-escalate .tlv-chip:first-of-type { margin-top: 1.4em; } /* well inside the red, not on its edge */
    .territory .tlv-block { transform: scale(4); transition: transform 0.9s cubic-bezier(0.7, 0, 0.2, 1); }
    .legal .tlv-block { background: #232323; transition: background-color 1.3s ease 0.2s; } /* after .territory: both classes are on */
    .territory .tlv-escalate .tlv-item, .territory .tlv-line { opacity: 0; transition: opacity 0.25s ease; }
}

/* ========== milestone previews (only on "I dive into creating Jury.") ==========
   timeline.js opens #tl-peek for the milestone under the pointer (or tapped, on touch). */
.tl-hit { fill: transparent; }
.tl-ms { pointer-events: none; }
.journey:not(.pattern) .tl-ms { pointer-events: all; cursor: pointer; }
.journey:not(.pattern) .tlv-journey .tlv-item.in { pointer-events: auto; cursor: pointer; }
.tl-peek {
    position: absolute;
    inset: 0;
    z-index: 47;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 22px;
    padding: 64px 20px;
    background: rgba(232, 217, 196, 0.9); /* the folder's beige, faded over the page */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s 0.3s;
    pointer-events: none; /* with a mouse it follows the pointer; nothing to click */
}
.tl-peek.on { opacity: 1; visibility: visible; transition-delay: 0s; }
@media (hover: none) { .tl-peek.on { pointer-events: auto; } } /* touch: a tap on it closes it */
.tl-peek-slot { --h: min(62dvh, 640px); display: none; margin: 0; width: min(100%, 900px); height: var(--h); place-items: center; grid-template: minmax(0, 1fr) / minmax(0, 1fr); }
.tl-peek-slot.on { display: grid; }
.tl-peek-slot:empty { border: 1.5px dashed rgba(35, 35, 35, 0.28); border-radius: 12px; }
/* sized against the slot's own height: a percentage max-height doesn't hold inside a grid cell */
.tl-peek-slot > * { width: auto; height: auto; max-width: 100%; max-height: var(--h); object-fit: contain; }
.tl-peek-slot > img, .tl-peek-slot > video { border-radius: 10px; box-shadow: 0 18px 50px rgba(74, 54, 28, 0.28); }
/* a comp already on the folder's beige: fills the slot's height and sits straight on the page, unframed */
.tl-peek-slot > img.flat { height: var(--h); border-radius: 0; box-shadow: none; }
/* a transparent render (a pile of prints, say): the same, with a shadow that follows its outline */
.tl-peek-slot > img.cutout { height: var(--h); border-radius: 0; box-shadow: none; filter: drop-shadow(0 14px 26px rgba(74, 54, 28, 0.3)); }
.tl-peek-caption { margin: 0; text-align: center; color: #111; }
.tl-peek-caption .t { display: block; font: 400 clamp(26px, 3.4vw, 46px)/1.05 'Instrument Serif', 'Times New Roman', serif; letter-spacing: -0.02em; }
.tl-peek-caption .d { display: block; margin-top: 8px; font: italic 400 15px/1 'Inter Tight', sans-serif; color: rgba(17, 17, 17, 0.6); }

@media (prefers-reduced-motion: reduce) {
    .tl-peek { transition: none; }
    .tlv *, .tlv { transition: none !important; }
    #timeline-scene *, #timeline-scene { transition: none !important; }
}
