/* =====================================================
   prototype.bar — generative timeline-vertical
   palette: cool->warm gradient journey
   ===================================================== */

:root {
    --c-midnight: #0F1629;
    --c-blueprint: #1A1F36;
    --c-charcoal: #2A2D3A;
    --c-teal: #3B82C8;
    --c-bubble: #5B9BD5;
    --c-gray: #7A8BA8;
    --c-orange: #E8A87C;
    --c-paper: #F0EDE8;
    --c-glow: #F4C9A8;

    --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;
    --font-body: "DM Sans", "Inter", system-ui, sans-serif;
    --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", monospace;

    --spine-x: 50%;
    --bounce-ease: cubic-bezier(0.34, 1.56, 0.64, 1);
    --scroll-progress: 0;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    background: var(--c-midnight);
    color: var(--c-paper);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.7;
    overflow-x: hidden;
    scroll-behavior: smooth;
}

body {
    position: relative;
    min-height: 100vh;
    background:
        radial-gradient(circle at 50% 0%, rgba(59,130,200,0.12), transparent 55%),
        var(--c-midnight);
}

.hidden-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ----------- scroll progress bar ----------- */
#scroll-progress {
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--c-teal), var(--c-orange));
    transform-origin: left center;
    transform: scaleX(var(--scroll-progress, 0));
    z-index: 1000;
    pointer-events: none;
    transition: transform 80ms linear;
}

/* ----------- timeline spine ----------- */
.timeline-spine {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 100vh;
    z-index: 4;
    pointer-events: none;
    overflow: visible;
}

.timeline-spine #spine-line {
    stroke-dasharray: 1 0;
    filter: drop-shadow(0 0 6px rgba(59,130,200,0.45));
    animation: spinePulse 4.5s ease-in-out infinite;
}

@keyframes spinePulse {
    0%, 100% { opacity: 0.85; }
    50%      { opacity: 1; }
}

.spine-pulse {
    transform-origin: center;
    animation: pulseDot 3s ease-in-out infinite;
    cy: 0;
}

@keyframes pulseDot {
    0%, 100% { r: 4; opacity: 0.7; }
    50%      { r: 8; opacity: 1; }
}

/* ----------- timeline shell ----------- */
.timeline {
    position: relative;
    width: 100%;
    z-index: 2;
}

.epoch {
    position: relative;
    width: 100%;
    padding: 120px 0;
    overflow: hidden;
    isolation: isolate;
}

.epoch-1 { min-height: 100vh; padding-top: 0; padding-bottom: 80px; display: flex; flex-direction: column; justify-content: center; }
.epoch-2 { min-height: 120vh; }
.epoch-3 { min-height: 110vh; background: var(--c-blueprint); }
.epoch-4 { min-height: 130vh; background: var(--c-blueprint); }
.epoch-5 {
    min-height: 100vh;
    padding: 160px 0 220px;
    background: linear-gradient(180deg, var(--c-blueprint) 0%, #5B6F8E 22%, var(--c-orange) 60%, var(--c-glow) 100%);
}

/* pattern overlays */
.pattern-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.18;
    mix-blend-mode: screen;
}
.pattern-arabesque { background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='60' height='60' viewBox='0 0 60 60'><g fill='none' stroke='%237A8BA8' stroke-width='0.6' opacity='0.7'><polygon points='30,4 38,18 54,18 42,30 48,46 30,38 12,46 18,30 6,18 22,18'/><circle cx='30' cy='30' r='14'/><circle cx='0' cy='0' r='14'/><circle cx='60' cy='0' r='14'/><circle cx='0' cy='60' r='14'/><circle cx='60' cy='60' r='14'/></g></svg>") repeat; opacity: 0.35; }
.pattern-sashiko    { background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'><g fill='none' stroke='%233B82C8' stroke-width='0.9' stroke-dasharray='4,8' opacity='0.85'><line x1='0' y1='0' x2='40' y2='0'/><line x1='0' y1='20' x2='40' y2='20'/><line x1='0' y1='40' x2='40' y2='40'/><line x1='0' y1='0' x2='0' y2='40'/><line x1='20' y1='0' x2='20' y2='40'/><line x1='40' y1='0' x2='40' y2='40'/><line x1='0' y1='0' x2='40' y2='40'/><line x1='40' y1='0' x2='0' y2='40'/></g></svg>") repeat; opacity: 0.32; }
.pattern-kente      { background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='60' height='40' viewBox='0 0 60 40'><g opacity='0.85'><rect x='0' y='0' width='60' height='5' fill='%23E8A87C'/><rect x='0' y='14' width='6' height='6' fill='%23E8A87C'/><rect x='12' y='14' width='6' height='6' fill='%23E8A87C'/><rect x='24' y='14' width='6' height='6' fill='%23E8A87C'/><rect x='36' y='14' width='6' height='6' fill='%23E8A87C'/><rect x='48' y='14' width='6' height='6' fill='%23E8A87C'/><polyline points='0,30 10,24 20,30 30,24 40,30 50,24 60,30' fill='none' stroke='%23E8A87C' stroke-width='1.2'/></g></svg>") repeat; opacity: 0.25; }
.pattern-celtic     { background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'><g fill='none' stroke='%235B9BD5' stroke-width='1.3' opacity='0.65'><path d='M 10 40 Q 10 10, 40 10 Q 70 10, 70 40 Q 70 70, 40 70 Q 10 70, 10 40 Z'/><path d='M 25 40 Q 25 25, 40 25 Q 55 25, 55 40 Q 55 55, 40 55 Q 25 55, 25 40 Z'/><path d='M 0 0 Q 20 20, 40 0 Q 60 20, 80 0'/><path d='M 0 80 Q 20 60, 40 80 Q 60 60, 80 80'/></g></svg>") repeat; opacity: 0.22; }
.pattern-bauhaus    { background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='60' height='60' viewBox='0 0 60 60'><g opacity='0.85'><rect x='0' y='0' width='60' height='60' fill='none' stroke='%232A2D3A' stroke-width='0.8'/><circle cx='30' cy='30' r='22' fill='none' stroke='%232A2D3A' stroke-width='0.8'/><circle cx='30' cy='30' r='14' fill='none' stroke='%232A2D3A' stroke-width='0.8'/><circle cx='30' cy='30' r='6' fill='%232A2D3A'/></g></svg>") repeat; opacity: 0.30; }

/* noise (Epoch 1) */
.noise-layer {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 20% 30%, rgba(59,130,200,0.12), transparent 45%),
        radial-gradient(circle at 80% 70%, rgba(232,168,124,0.08), transparent 55%);
    opacity: 0.9;
}

/* ----------- epoch markers (mono labels alongside spine) ----------- */
.epoch-marker {
    position: absolute;
    top: 60px;
    z-index: 5;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--c-gray);
    letter-spacing: 0.04em;
}
.epoch-marker.left  { left: calc(50% - 360px); text-align: right; align-items: flex-end; }
.epoch-marker.right { right: calc(50% - 360px); text-align: left; align-items: flex-start; }
.epoch-marker.centered { left: 50%; transform: translateX(-50%); align-items: center; text-align: center; }
.epoch-marker .mono-coord { color: rgba(122,139,168,0.65); font-size: 12px; }

/* ----------- content placement ----------- */
.epoch-content {
    position: relative;
    z-index: 3;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 60px;
}
.content-left  { padding-right: calc(50% + 40px); padding-left: 60px; }
.content-right { padding-left: calc(50% + 40px); padding-right: 60px; }
.content-center { display: flex; flex-direction: column; align-items: center; padding: 0 60px; }

/* ----------- mono labels ----------- */
.mono-label {
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: 0.08em;
    color: var(--c-gray);
    text-transform: uppercase;
    display: inline-block;
}

/* ====================================================
   EPOCH 1 — RAW MATERIAL
   ==================================================== */

.epoch-1-content {
    padding-right: calc(50% + 40px);
    padding-left: 60px;
    display: flex;
    flex-direction: column;
    gap: 28px;
    align-items: flex-end;
    text-align: right;
}

.display-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(60px, 14vw, 180px);
    line-height: 0.92;
    letter-spacing: -0.02em;
    color: var(--c-paper);
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.display-title .letter {
    display: inline-block;
    opacity: 0;
    transform: translateY(60px);
    will-change: transform, opacity;
}
.display-title .letter.in {
    animation: bounceEnter 700ms var(--bounce-ease) forwards;
}
.display-title .letter.accent { color: var(--c-orange); }

.subtitle {
    font-family: var(--font-body);
    font-size: 18px;
    color: var(--c-gray);
    max-width: 460px;
    letter-spacing: 0.02em;
}

/* scroll hint */
.scroll-hint {
    position: absolute;
    bottom: 36px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    z-index: 6;
}
.hint-arrow {
    width: 1px;
    height: 36px;
    background: linear-gradient(180deg, var(--c-teal), transparent);
    position: relative;
    animation: hintBob 2.4s ease-in-out infinite;
}
.hint-arrow::after {
    content: "";
    position: absolute;
    bottom: -2px;
    left: 50%;
    width: 6px;
    height: 6px;
    border-right: 1px solid var(--c-orange);
    border-bottom: 1px solid var(--c-orange);
    transform: translateX(-50%) rotate(45deg);
}
@keyframes hintBob {
    0%, 100% { transform: translateY(0); opacity: 0.7; }
    50% { transform: translateY(8px); opacity: 1; }
}

/* bubble cluster (decorative near spine) */
.bubble-cluster {
    width: 260px;
    height: 100px;
    margin-top: 18px;
    opacity: 0;
    transform: translateY(40px);
}
.bubble-cluster.in { animation: bounceEnter 800ms var(--bounce-ease) forwards; animation-delay: 1.4s; }
.bubble-cluster svg { width: 100%; height: 100%; }

/* rosettes */
.rosette {
    width: 120px; height: 120px;
    margin-top: 8px;
    opacity: 0;
    transform: translateY(30px);
}
.rosette.in { animation: bounceEnter 700ms var(--bounce-ease) forwards; }
.rosette svg { width: 100%; height: 100%; display: block; }

.rosette-stage-5 {
    width: 280px; height: 280px;
    margin: 0 auto 28px;
    animation: rosetteSpin 60s linear infinite;
}

@keyframes rosetteSpin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ====================================================
   EPOCH 2 — SKETCH PHASE
   ==================================================== */

.epoch-2-content {
    display: flex;
    flex-direction: column;
    gap: 32px;
    align-items: flex-start;
}

.epoch-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(40px, 6vw, 72px);
    letter-spacing: -0.02em;
    line-height: 1.05;
    color: var(--c-paper);
    max-width: 560px;
}

.epoch-lede {
    font-size: 18px;
    color: var(--c-paper);
    opacity: 0.82;
    max-width: 520px;
    line-height: 1.65;
}

.card-rail {
    display: grid;
    grid-template-columns: repeat(3, 280px);
    gap: 24px;
    margin-top: 16px;
}

.proto-card {
    width: 280px;
    height: 400px;
    border-radius: 16px;
    background: linear-gradient(160deg, rgba(26,31,54,0.7), rgba(15,22,41,0.65));
    border: 1px solid rgba(240,237,232,0.15);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    opacity: 0;
    transform: translateY(60px);
    will-change: transform, opacity;
    box-shadow: 0 20px 60px -20px rgba(0,0,0,0.55);
}
.proto-card.in { animation: bounceEnter 700ms var(--bounce-ease) forwards; }
.proto-card[data-card="1"].in { animation-delay: 0ms; }
.proto-card[data-card="2"].in { animation-delay: 120ms; }
.proto-card[data-card="3"].in { animation-delay: 240ms; }

.card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.mono-tag {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--c-orange);
    letter-spacing: 0.06em;
}

.card-figure {
    flex: 1;
    border-radius: 10px;
    background: rgba(15,22,41,0.55);
    border: 1px dashed rgba(122,139,168,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}
.card-svg { width: 90%; height: 90%; }

.card-body h3 {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 20px;
    color: var(--c-paper);
    letter-spacing: -0.01em;
}
.card-body p {
    font-size: 14px;
    color: var(--c-gray);
    line-height: 1.6;
}

/* ====================================================
   EPOCH 3 — ITERATION LOOP
   ==================================================== */

.epoch-3-content {
    display: flex;
    flex-direction: column;
    gap: 32px;
    align-items: flex-end;
    text-align: right;
}
.epoch-3-content .epoch-title,
.epoch-3-content .epoch-lede { max-width: 560px; text-align: right; }

.filmstrip-wrap {
    width: 100%;
    max-width: 600px;
    overflow: hidden;
    border-top: 1px solid rgba(122,139,168,0.25);
    border-bottom: 1px solid rgba(122,139,168,0.25);
    padding: 22px 0;
    margin-top: 8px;
    background: rgba(15,22,41,0.4);
    border-radius: 4px;
}

.filmstrip-track {
    display: flex;
    gap: 24px;
    transform: translateX(0);
    will-change: transform;
    transition: transform 220ms linear;
    padding: 0 22px;
}

.frame {
    flex: 0 0 200px;
    width: 200px;
    height: 240px;
    background: rgba(26,31,54,0.7);
    border: 1px solid rgba(122,139,168,0.18);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px;
    position: relative;
}
.frame::before {
    content: "";
    position: absolute;
    top: 6px; left: 6px;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--c-teal);
    opacity: 0.55;
}
.frame::after {
    content: "";
    position: absolute;
    bottom: 6px; right: 6px;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--c-orange);
    opacity: 0.55;
}
.frame-mono {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--c-gray);
    letter-spacing: 0.08em;
    align-self: flex-start;
}
.frame-svg { width: 170px; height: 170px; }

.two-column {
    display: grid;
    grid-template-columns: 280px 280px;
    gap: 32px;
    text-align: left;
    margin-top: 12px;
}
.two-column p {
    font-size: 15px;
    color: var(--c-paper);
    opacity: 0.85;
    line-height: 1.7;
}

/* ====================================================
   EPOCH 4 — TEST CHAMBER
   ==================================================== */

.epoch-4 { background: linear-gradient(180deg, var(--c-blueprint) 0%, #0E1429 100%); }

.bubble-field {
    position: absolute;
    inset: 0;
    overflow: hidden;
    z-index: 1;
    pointer-events: none;
}
.bubble-field .bubble {
    position: absolute;
    bottom: -160px;
    border-radius: 50%;
    will-change: transform, opacity;
    animation-name: floatUp;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}
.bubble-field .bubble.blue   { background: radial-gradient(circle at 35% 35%, rgba(157,196,230,0.55), rgba(91,155,213,0.18) 60%, rgba(91,155,213,0) 100%); }
.bubble-field .bubble.orange { background: radial-gradient(circle at 35% 35%, rgba(244,201,168,0.50), rgba(232,168,124,0.15) 60%, rgba(232,168,124,0) 100%); }

@keyframes floatUp {
    0%   { transform: translate3d(0,0,0) scale(1); opacity: 0.15; }
    20%  { opacity: 0.25; }
    50%  { opacity: 0.28; }
    100% { transform: translate3d(0,-130vh,0) scale(0.6); opacity: 0; }
}

.epoch-4-content {
    display: flex;
    flex-direction: column;
    gap: 32px;
    align-items: flex-start;
}

.test-blocks {
    display: flex;
    flex-direction: column;
    gap: 28px;
    max-width: 540px;
    margin-top: 12px;
}

.test-block {
    background: rgba(15,22,41,0.7);
    border: 1px solid rgba(91,155,213,0.22);
    border-left: 3px solid var(--c-teal);
    padding: 22px 26px;
    border-radius: 6px;
    opacity: 0;
    transform: translateY(60px);
    will-change: transform, opacity;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.test-block.in { animation: bounceEnter 700ms var(--bounce-ease) forwards; }
.test-block[data-block="craft"].in       { animation-delay: 0ms; }
.test-block[data-block="failure"].in     { animation-delay: 140ms; }
.test-block[data-block="breakthrough"].in{ animation-delay: 280ms; border-left-color: var(--c-orange); }

.test-block .mono-label { color: var(--c-bubble); margin-bottom: 8px; }
.test-block[data-block="breakthrough"] .mono-label { color: var(--c-orange); }
.test-block h3 {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 22px;
    color: var(--c-paper);
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}
.test-block p {
    font-size: 15px;
    color: var(--c-paper);
    opacity: 0.82;
    line-height: 1.7;
}

/* ====================================================
   EPOCH 5 — LAUNCH
   ==================================================== */

.epoch-5 {
    color: var(--c-charcoal);
}
.epoch-5 .mono-label { color: var(--c-charcoal); opacity: 0.7; }
.epoch-5 .epoch-marker .mono-coord { color: rgba(42,45,58,0.55); }

.launch-circle {
    position: relative;
    width: min(720px, 90vw);
    aspect-ratio: 1 / 1;
    margin: 60px auto 0;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 45%, rgba(255,255,255,0.65) 0%, rgba(244,201,168,0.85) 35%, rgba(232,168,124,0.7) 65%, rgba(232,168,124,0) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
    box-shadow:
        0 0 80px rgba(232,168,124,0.4),
        inset 0 0 80px rgba(255,255,255,0.3);
    transform: scale(0.6);
    opacity: 0;
    transition: transform 1200ms cubic-bezier(0.22, 1, 0.36, 1), opacity 800ms ease-out;
}
.launch-circle.in { transform: scale(1); opacity: 1; }

.closing-statement {
    text-align: center;
    color: var(--c-charcoal);
    margin-top: 18px;
    opacity: 0;
    transform: translateY(40px);
}
.closing-statement.in { animation: bounceEnter 800ms var(--bounce-ease) forwards; animation-delay: 200ms; }

.closing-pre {
    color: var(--c-charcoal);
    opacity: 0.6;
    margin-bottom: 12px;
    letter-spacing: 0.16em;
}

.closing-line {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(34px, 5.5vw, 64px);
    line-height: 1.05;
    letter-spacing: -0.02em;
    color: var(--c-charcoal);
}

.closing-sub {
    margin-top: 22px;
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: 0.08em;
    color: var(--c-charcoal);
    opacity: 0.65;
}

/* ====================================================
   GENERIC reveal-bounce
   ==================================================== */

.reveal-bounce {
    opacity: 0;
    transform: translateY(60px);
    will-change: transform, opacity;
}
.reveal-bounce.in {
    animation: bounceEnter 700ms var(--bounce-ease) forwards;
}

@keyframes bounceEnter {
    0%   { opacity: 0; transform: translateY(60px); }
    60%  { opacity: 1; transform: translateY(-8px); }
    80%  { transform: translateY(3px); }
    100% { transform: translateY(0); }
}

/* ====================================================
   RESPONSIVE
   ==================================================== */

@media (max-width: 900px) {
    .epoch-marker.left,
    .epoch-marker.right { left: 24px; right: 24px; align-items: flex-start; text-align: left; }
    .epoch-marker.centered { left: 50%; }

    .content-left, .content-right, .epoch-1-content, .epoch-3-content, .epoch-2-content, .epoch-4-content {
        padding: 0 24px;
        align-items: center;
        text-align: center;
    }
    .epoch-1-content { padding-top: 80px; }

    .display-title { justify-content: center; font-size: clamp(48px, 16vw, 96px); }

    .card-rail {
        grid-template-columns: 1fr;
        justify-items: center;
    }

    .filmstrip-wrap { max-width: 100%; overflow-x: auto; }
    .filmstrip-track { transition: none !important; }

    .two-column { grid-template-columns: 1fr; }

    .epoch-3-content, .epoch-3-content .epoch-title, .epoch-3-content .epoch-lede {
        text-align: center; align-items: center;
    }

    .timeline-spine { left: 24px; transform: none; }
    .epoch-marker.left, .epoch-marker.right { left: 56px; right: auto; align-items: flex-start; text-align: left; }
}

@media (max-width: 540px) {
    .epoch { padding: 80px 0; }
    .epoch-title { font-size: clamp(32px, 9vw, 48px); }
    .frame { flex: 0 0 160px; width: 160px; height: 200px; }
    .frame-svg { width: 130px; height: 130px; }
}
