:root {
    color-scheme: dark;
    --ink: #f5f1ff;
    --ink-soft: #bab5c8;
    --ink-faint: #807b8c;
    --ground: #0b0b12;
    --raised: #12121c;
    --line: rgba(239, 233, 255, 0.14);
    --line-strong: rgba(239, 233, 255, 0.28);
    --violet: #9a82ff;
    --magenta: #ff5aa5;
    --coral: #ff8464;
    --mint: #64e6c4;
    --gradient: linear-gradient(115deg, var(--violet), var(--magenta) 55%, var(--coral));
    --display: "Segoe UI Variable Display", "Aptos Display", "Segoe UI", sans-serif;
    --body: "Segoe UI Variable Text", "Aptos", "Segoe UI", sans-serif;
    --mono: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
    --page: min(1260px, calc(100vw - 64px));
    --header-height: 76px;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-height) + 30px);
    background: var(--ground);
}

body {
    margin: 0;
    overflow-x: hidden;
    color: var(--ink);
    background:
        radial-gradient(circle at 15% 8%, rgba(154, 130, 255, 0.11), transparent 28rem),
        radial-gradient(circle at 85% 32%, rgba(255, 90, 165, 0.065), transparent 26rem),
        var(--ground);
    font-family: var(--body);
    font-size: 1rem;
    line-height: 1.65;
    text-rendering: optimizeLegibility;
}

::selection { color: var(--ground); background: #c8bcff; }
a { color: inherit; text-decoration: none; }
iframe { border: 0; }
:focus-visible { outline: 2px solid var(--mint); outline-offset: 4px; }

.skip-link {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1000;
    padding: 10px 16px;
    color: var(--ground);
    background: var(--ink);
    transform: translateY(-160%);
    transition: transform 180ms ease;
}

.skip-link:focus { transform: translateY(0); }

.scroll-progress {
    position: fixed;
    inset: 0 0 auto;
    z-index: 1000;
    height: 2px;
    pointer-events: none;
}

.scroll-progress span {
    display: block;
    width: 100%;
    height: 100%;
    background: var(--gradient);
    transform: scaleX(0);
    transform-origin: left;
    will-change: transform;
}

.archive-header {
    position: fixed;
    inset: 0 0 auto;
    z-index: 100;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    width: 100%;
    height: var(--header-height);
    padding: 0 max(24px, calc((100vw - 1420px) / 2));
    border-bottom: 1px solid transparent;
    transition: height 250ms var(--ease), background 250ms ease, border-color 250ms ease;
}

.archive-header.is-scrolled {
    height: 64px;
    border-color: var(--line);
    background: rgba(11, 11, 18, 0.84);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
}

.wordmark {
    display: inline-flex;
    align-items: center;
    justify-self: start;
    gap: 11px;
    width: max-content;
    color: var(--ink-soft);
    font-family: var(--mono);
    font-size: 0.76rem;
}

.wordmark-mark {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--line-strong);
    border-radius: 50%;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.03);
    font-weight: 700;
}

.archive-header > p {
    margin: 0;
    color: var(--ink-faint);
    font-family: var(--mono);
    font-size: 0.68rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.back-link {
    position: relative;
    justify-self: end;
    padding: 8px 0;
    font-size: 0.84rem;
}

.back-link::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 4px;
    left: 0;
    height: 1px;
    background: currentColor;
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 250ms var(--ease);
}

.back-link:hover::after { transform: scaleX(1); transform-origin: left; }

.archive-hero {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    width: var(--page);
    min-height: 86svh;
    margin: 0 auto;
    padding: calc(var(--header-height) + 80px) 0 clamp(72px, 9vw, 120px);
    border-bottom: 1px solid var(--line);
}

.eyebrow, .version-label {
    margin: 0;
    color: var(--ink-faint);
    font-family: var(--mono);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.archive-hero h1 {
    max-width: 1180px;
    margin: 26px 0 58px;
    font-family: var(--display);
    font-size: clamp(4.2rem, 9.4vw, 9rem);
    font-weight: 680;
    letter-spacing: -0.075em;
    line-height: 0.84;
}

.archive-hero h1 span {
    color: transparent;
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
}

.hero-bottom {
    display: grid;
    grid-template-columns: minmax(280px, 0.65fr) minmax(440px, 0.55fr);
    align-items: end;
    justify-content: space-between;
    gap: 60px;
}

.hero-bottom > p {
    max-width: 520px;
    margin: 0;
    color: var(--ink-soft);
    font-size: clamp(1.05rem, 1.6vw, 1.3rem);
}

.archive-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    margin: 0;
    border-top: 1px solid var(--line);
}

.archive-stats div { padding: 18px 10px 0; }

.archive-stats dt {
    font-family: var(--display);
    font-size: clamp(1.8rem, 3vw, 2.7rem);
    font-weight: 580;
    letter-spacing: -0.05em;
    line-height: 1;
}

.archive-stats dd {
    margin: 7px 0 0;
    color: var(--ink-faint);
    font-family: var(--mono);
    font-size: 0.62rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.timeline-section {
    position: relative;
    width: var(--page);
    margin: 0 auto;
    padding: clamp(110px, 14vw, 190px) 0 120px;
}

.timeline-line {
    position: absolute;
    top: 88px;
    bottom: 70px;
    left: 50%;
    width: 1px;
    background: var(--line);
    transform: translateX(-50%);
}

.timeline-fill {
    display: block;
    width: 100%;
    height: 100%;
    background: var(--gradient);
    transform: scaleY(0);
    transform-origin: top;
    will-change: transform;
}

.timeline-entry {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 110px minmax(0, 1fr);
    align-items: center;
    min-height: 570px;
    margin-bottom: clamp(110px, 14vw, 190px);
}

.timeline-entry:last-of-type { margin-bottom: 80px; }
.timeline-preview { grid-column: 1; }
.timeline-marker { grid-column: 2; grid-row: 1; }
.timeline-copy { grid-column: 3; grid-row: 1; }

.entry-right .timeline-preview { grid-column: 3; grid-row: 1; }
.entry-right .timeline-copy { grid-column: 1; grid-row: 1; }

.timeline-preview, .timeline-copy {
    opacity: 0;
    transition: opacity 750ms var(--ease), transform 850ms var(--ease);
}

.entry-left .timeline-preview, .entry-right .timeline-copy { transform: translateX(-34px); }
.entry-left .timeline-copy, .entry-right .timeline-preview { transform: translateX(34px); }
.timeline-entry.is-visible .timeline-preview, .timeline-entry.is-visible .timeline-copy {
    opacity: 1;
    transform: translateX(0);
}

.timeline-marker {
    position: relative;
    z-index: 3;
    display: grid;
    place-items: center;
    width: 110px;
    height: 110px;
}

.timeline-marker::before, .timeline-marker::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 36px;
    height: 1px;
    background: var(--line-strong);
}

.timeline-marker::before { left: 0; }
.timeline-marker::after { right: 0; }

.timeline-marker span {
    display: block;
    width: 17px;
    height: 17px;
    border: 4px solid var(--ground);
    border-radius: 50%;
    background: var(--ink-faint);
    box-shadow: 0 0 0 1px var(--line-strong);
    transition: background 300ms ease, box-shadow 300ms ease, transform 400ms var(--ease);
}

.timeline-entry.is-visible .timeline-marker span {
    background: var(--violet);
    box-shadow: 0 0 0 1px var(--violet), 0 0 28px rgba(154, 130, 255, 0.48);
    transform: scale(1.18);
}

.current-entry .timeline-marker span {
    background: var(--mint);
    box-shadow: 0 0 0 1px var(--mint), 0 0 30px rgba(100, 230, 196, 0.55);
}

.browser-frame {
    overflow: hidden;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: var(--raised);
    box-shadow: 0 28px 70px rgba(0, 0, 0, 0.34);
    transition: border-color 250ms ease, transform 400ms var(--ease), box-shadow 400ms ease;
}

.browser-frame:hover {
    border-color: rgba(154, 130, 255, 0.58);
    box-shadow: 0 34px 90px rgba(0, 0, 0, 0.45);
    transform: translateY(-7px);
}

.browser-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 12px;
    border-bottom: 1px solid var(--line);
    background: #171721;
}

.browser-bar > span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ink-faint);
}

.browser-bar > span:first-child { background: #ff7a77; }
.browser-bar > span:nth-child(2) { background: #ffc66d; }
.browser-bar > span:nth-child(3) { background: #67d7ad; }

.browser-bar p {
    margin: 0 0 0 10px;
    color: var(--ink-faint);
    font-family: var(--mono);
    font-size: 0.58rem;
    letter-spacing: 0.04em;
}

.preview-viewport {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background:
        linear-gradient(145deg, rgba(154, 130, 255, 0.1), transparent 50%),
        #0e0e16;
}

.preview-viewport iframe {
    display: block;
    width: 200%;
    height: 200%;
    pointer-events: none;
    transform: scale(0.5);
    transform-origin: top left;
}

.preview-viewport::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    box-shadow: inset 0 0 70px rgba(0, 0, 0, 0.26);
    pointer-events: none;
}

.preview-open {
    position: absolute;
    inset: 0;
    z-index: 3;
}

.preview-open::after {
    content: "Open version ↗";
    position: absolute;
    right: 14px;
    bottom: 14px;
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 999px;
    color: white;
    background: rgba(11, 11, 18, 0.72);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    font-size: 0.7rem;
    opacity: 0;
    transform: translateY(5px);
    transition: opacity 200ms ease, transform 250ms var(--ease);
}

.browser-frame:hover .preview-open::after,
.preview-open:focus-visible::after {
    opacity: 1;
    transform: translateY(0);
}

.timeline-copy { padding: 0 clamp(12px, 3vw, 42px); }

.timeline-copy time {
    display: block;
    margin: 14px 0 0;
    color: var(--ink-faint);
    font-family: var(--mono);
    font-size: 0.68rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.timeline-copy h2 {
    margin: 15px 0 22px;
    font-family: var(--display);
    font-size: clamp(2.1rem, 4vw, 4rem);
    font-weight: 620;
    letter-spacing: -0.055em;
    line-height: 0.98;
}

.timeline-copy > p:not(.version-label) {
    max-width: 500px;
    margin: 0 0 24px;
    color: var(--ink-soft);
    font-size: 0.96rem;
}

.timeline-copy > a {
    display: inline-flex;
    gap: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--line-strong);
    font-size: 0.86rem;
    transition: color 180ms ease, border-color 180ms ease;
}

.timeline-copy > a:hover { color: var(--mint); border-color: var(--mint); }

.timeline-origin {
    position: relative;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    width: max-content;
    margin: 0 auto;
    padding: 12px 20px;
    color: var(--ink-faint);
    background: var(--ground);
    font-family: var(--mono);
    font-size: 0.62rem;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.timeline-origin span {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--coral);
    box-shadow: 0 0 20px rgba(255, 132, 100, 0.48);
}

.timeline-origin p { margin: 0; }

.archive-footer {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: end;
    gap: 48px;
    padding: clamp(90px, 12vw, 150px) max(32px, calc((100vw - 1260px) / 2)) 34px;
    border-top: 1px solid var(--line);
    background:
        radial-gradient(circle at 78% 20%, rgba(255, 90, 165, 0.09), transparent 25rem),
        #08080d;
}

.archive-footer h2 {
    margin: 18px 0 0;
    font-family: var(--display);
    font-size: clamp(3.2rem, 7vw, 7rem);
    font-weight: 650;
    letter-spacing: -0.065em;
    line-height: 0.9;
}

.archive-footer > a {
    display: inline-flex;
    gap: 10px;
    margin-bottom: 12px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--line-strong);
}

.archive-footer > a:hover { color: var(--mint); border-color: var(--mint); }

.footer-bottom {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    gap: 30px;
    margin-top: 80px;
    padding-top: 24px;
    border-top: 1px solid var(--line);
    color: var(--ink-faint);
    font-family: var(--mono);
    font-size: 0.65rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.footer-bottom p { margin: 0; }
.footer-bottom a:hover { color: var(--ink); }

@media (max-width: 980px) {
    :root { --page: min(100% - 40px, 760px); }
    .archive-hero { min-height: 790px; }
    .hero-bottom { grid-template-columns: 1fr; gap: 45px; }
    .archive-stats { max-width: 520px; }

    .timeline-section { padding-left: 58px; }
    .timeline-line { left: 20px; transform: none; }
    .timeline-entry,
    .entry-right {
        grid-template-columns: 1fr;
        gap: 34px;
        min-height: auto;
        margin-bottom: 130px;
    }

    .timeline-preview,
    .entry-right .timeline-preview {
        grid-column: 1;
        grid-row: 1;
    }

    .timeline-copy,
    .entry-right .timeline-copy {
        grid-column: 1;
        grid-row: 2;
        padding: 0;
    }

    .timeline-marker {
        position: absolute;
        top: 25%;
        left: -93px;
        grid-column: auto;
        width: 110px;
        height: 70px;
    }

    .timeline-marker::before { display: none; }
    .timeline-marker::after { right: 0; width: 30px; }
    .entry-left .timeline-copy,
    .entry-right .timeline-copy,
    .entry-left .timeline-preview,
    .entry-right .timeline-preview { transform: translateY(28px); }
    .timeline-entry.is-visible .timeline-copy,
    .timeline-entry.is-visible .timeline-preview { transform: translateY(0); }

    .timeline-origin {
        align-items: flex-start;
        margin: 0 0 0 -50px;
    }

    .archive-footer { grid-template-columns: 1fr; }
    .archive-footer > a { justify-self: start; margin-bottom: 0; }
}

@media (max-width: 640px) {
    :root { --page: calc(100vw - 32px); --header-height: 68px; }
    .archive-header { grid-template-columns: 1fr auto; padding: 0 16px; }
    .archive-header > p { display: none; }
    .wordmark > span:last-child { display: none; }
    .back-link { font-size: 0.78rem; }
    .archive-hero { min-height: 720px; padding-bottom: 70px; }
    .archive-hero h1 { margin: 22px 0 44px; font-size: clamp(3.8rem, 18vw, 6.4rem); }
    .archive-stats { grid-template-columns: repeat(3, 1fr); }
    .archive-stats dt { font-size: 1.8rem; }
    .archive-stats dd { font-size: 0.56rem; }

    .timeline-section {
        width: calc(100vw - 24px);
        padding: 100px 0 80px 34px;
    }

    .timeline-line { top: 80px; bottom: 50px; left: 10px; }
    .timeline-entry { margin-bottom: 105px; }
    .timeline-marker { top: 19%; left: -79px; }
    .timeline-marker::after { width: 22px; }
    .timeline-copy h2 { font-size: clamp(2.25rem, 11vw, 3.3rem); }
    .browser-frame { border-radius: 7px; }
    .browser-bar { height: 30px; }
    .browser-bar p { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .preview-open::after { right: 9px; bottom: 9px; opacity: 1; transform: none; }

    .archive-footer { padding-right: 16px; padding-left: 16px; }
    .footer-bottom { align-items: flex-start; flex-direction: column; margin-top: 56px; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .timeline-preview, .timeline-copy { opacity: 1; transform: none !important; }
}
