/* prototype.bar — Cinematic Prototype Unveiling */

/* ===== CUSTOM PROPERTIES ===== */
:root {
    --bg-current: #f0e6ef;
    --text-current: #1e1a20;
    --accent-current: #d4a0a0;

    /* Palette */
    --foundation-rose: #f0e6ef;
    --deep-stage: #2d2b3d;
    --studio-ground: #3a3540;
    --concept-blush: #d4a0a0;
    --archive-sage: #b5c4b1;
    --gold-whisper: #d9c89e;
    --mauve-mist: #c5b3c9;
    --pure-light: #faf5f0;
    --deep-text: #1e1a20;

    /* Typography */
    --font-display: 'Playfair Display', serif;
    --font-body: 'Libre Franklin', sans-serif;
    --font-label: 'Space Mono', monospace;
}

/* ===== RESET ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: auto;
    overflow-x: hidden;
}

body {
    background-color: var(--bg-current);
    color: var(--text-current);
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(0.95rem, 1.6vw, 1.2rem);
    letter-spacing: 0.08em;
    line-height: 1.6;
    transition: background-color 1.2s ease, color 0.8s ease;
    overflow-x: hidden;
}

/* ===== GRAIN CANVAS ===== */
#grain-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
    mix-blend-mode: overlay;
    opacity: 0.04;
}

body.dark-section #grain-canvas {
    opacity: 0.08;
}

body.grain-idle #grain-canvas {
    opacity: 0.12;
    transition: opacity 2s ease;
}

/* ===== CONSTRUCTION LINES SVG ===== */
#construction-lines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    transition: opacity 1s ease;
}

body.show-construction #construction-lines {
    opacity: 1;
}

.cline {
    fill: none;
    stroke: var(--concept-blush);
    stroke-width: 0.5px;
    opacity: 0.2;
    vector-effect: non-scaling-stroke;
}

.cline-radial {
    opacity: 0.12;
}

.cline-dashed {
    stroke-dasharray: 12 6;
    opacity: 0.15;
}

.crosshair line,
.crosshair circle {
    fill: none;
    stroke: var(--concept-blush);
    stroke-width: 0.5px;
    opacity: 0.25;
    vector-effect: non-scaling-stroke;
}

/* ===== DECORATIVE GLYPHS ===== */
#glyphs-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 5;
}

.glyph {
    position: absolute;
    color: var(--concept-blush);
    opacity: 0.3;
    animation: glyph-breathe 6s ease-in-out infinite, glyph-float 6s ease-in-out infinite;
}

.glyph-1 { top: 12%; left: 8%; animation-delay: 0s; }
.glyph-2 { top: 28%; right: 6%; animation-delay: 1s; }
.glyph-3 { top: 45%; left: 4%; animation-delay: 2s; }
.glyph-4 { top: 62%; right: 10%; animation-delay: 3s; }
.glyph-5 { top: 78%; left: 12%; animation-delay: 4s; }
.glyph-6 { bottom: 8%; right: 5%; animation-delay: 5s; }

@keyframes glyph-breathe {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.7; }
}

@keyframes glyph-float {
    0%, 100% { transform: translateY(-4px); }
    50% { transform: translateY(4px); }
}

/* ===== ACT SECTIONS ===== */
.act {
    position: relative;
    width: 100%;
    min-height: 100vh;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.act-tall {
    min-height: 150vh;
}

.act-medium {
    min-height: 120vh;
}

.act-archive {
    min-height: 130vh;
}

.act-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

/* ===== ACT I — THE DRAPE ===== */
#act-1 {
    background-color: var(--foundation-rose);
}

.prototype-container {
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 2s ease, transform 2s ease;
    will-change: transform, opacity;
}

.prototype-container.visible {
    opacity: 1;
    transform: scale(1);
}

.prototype-svg {
    max-width: 50vmin;
    height: auto;
    animation: proto-rotate 30s linear infinite;
}

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

.proto-wire > * {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 3s ease;
}

.prototype-container.visible .proto-wire > * {
    stroke-dashoffset: 0;
}

/* ===== KINETIC TYPOGRAPHY ===== */
.kinetic-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-style: italic;
    font-size: clamp(3.2rem, 8vw, 7rem);
    color: var(--text-current);
    letter-spacing: 0.02em;
    line-height: 1.1;
    text-align: center;
    margin-top: 2rem;
    overflow: hidden;
}

.kinetic-title .char {
    display: inline-block;
    opacity: 0;
    transform: perspective(800px) rotateY(-90deg);
    transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.6s ease;
    will-change: transform, opacity;
}

.kinetic-title.animated .char {
    opacity: 1;
    transform: perspective(800px) rotateY(0deg);
}

.kinetic-title.deconstructing .char {
    opacity: 0;
    transform: perspective(800px) rotateY(90deg) translateY(-20px);
}

/* ===== BODY TEXT ===== */
.body-text {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(0.95rem, 1.6vw, 1.2rem);
    letter-spacing: 0.08em;
    line-height: 1.7;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
    will-change: transform, opacity;
}

.body-text.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===== LABEL FLOAT ===== */
.label-float {
    font-family: var(--font-label);
    font-weight: 400;
    font-size: clamp(0.65rem, 1vw, 0.85rem);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    animation: label-float 4s ease-in-out infinite;
    will-change: transform;
}

@keyframes label-float {
    0%, 100% { transform: rotate(-2deg) translateY(-4px); }
    50% { transform: rotate(2deg) translateY(4px); }
}

/* ===== ACT II — THE REVEAL ===== */
#act-2 {
    background-color: var(--deep-stage);
    color: var(--pure-light);
}

.concept-panels {
    display: flex;
    gap: 4vw;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    padding: 5vh 5vw;
    max-width: 1200px;
}

.concept-panel {
    flex: 1 1 280px;
    max-width: 320px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    padding: 2rem;
    opacity: 0;
    transform: scale(0.3) rotate(-15deg);
    transition: opacity 1s ease, transform 1.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    will-change: transform, opacity;
}

.concept-panel.assembled {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

.panel-glyph {
    opacity: 0.8;
}

.panel-label {
    color: var(--gold-whisper);
    display: block;
}

.panel-text {
    color: var(--pure-light);
    text-align: center;
    max-width: 280px;
}

/* Panel surface fill animation */
.concept-panel.assembled .panel-surface > * {
    opacity: 0.15;
    transition: opacity 2s ease 0.5s;
}

/* ===== ACT III — THE STUDIO ===== */
#act-3 {
    background-color: var(--studio-ground);
    color: var(--pure-light);
}

.studio-blueprint {
    width: 60vmin;
    height: 60vmin;
    max-width: 600px;
    max-height: 600px;
    opacity: 0.6;
    animation: blueprint-breathe 8s ease-in-out infinite;
}

@keyframes blueprint-breathe {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.02); }
}

.studio-labels {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.studio-label {
    position: absolute;
    color: var(--gold-whisper);
    opacity: 0;
    transition: opacity 1.5s ease;
}

.studio-label.visible {
    opacity: 0.7;
}

.studio-title {
    position: absolute;
    bottom: 10vh;
    color: var(--pure-light);
}

/* ===== ACT IV — THE ARCHIVE ===== */
#act-4 {
    background-color: var(--deep-text);
    color: var(--pure-light);
}

.archive-bands {
    width: 100%;
    display: flex;
    flex-direction: column;
}

.archive-band {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3vw;
    padding: 3vh 5vw;
    min-height: 14vh;
    opacity: 0;
    transform: translateX(-40px);
    transition: opacity 0.8s ease, transform 0.8s ease, background-color 0.6s ease;
    will-change: transform, opacity;
}

.archive-band.visible {
    opacity: 1;
    transform: translateX(0);
}

.archive-band:nth-child(odd) {
    transform: translateX(40px);
}

.archive-band:nth-child(odd).visible {
    transform: translateX(0);
}

.band-number {
    font-family: var(--font-display);
    font-weight: 700;
    font-style: italic;
    font-size: clamp(2rem, 5vw, 4rem);
    color: var(--pure-light);
    opacity: 0.9;
    min-width: 100px;
    text-align: right;
}

.band-proto {
    opacity: 0.7;
    flex-shrink: 0;
}

.band-proto .band-wire > * {
    stroke: var(--pure-light);
}

.band-label {
    color: var(--gold-whisper);
    min-width: 120px;
}

/* Band background colors applied via JS */
.archive-band.visible {
    background-color: var(--band-color);
}

.archive-band.visible .band-number,
.archive-band.visible .band-proto .band-wire > * {
    color: var(--deep-text);
    stroke: var(--deep-text);
}

.archive-band.visible .band-label {
    color: var(--studio-ground);
}

/* Surface reveal on scroll */
.archive-band.visible .band-surface > * {
    opacity: 0.1;
    transition: opacity 1.5s ease 0.3s;
}

/* ===== ACT V — THE DEPARTURE ===== */
#act-5 {
    background-color: var(--foundation-rose);
    color: var(--deep-text);
}

.constellation {
    width: 80vw;
    max-width: 800px;
    height: 60vh;
    position: relative;
}

.constellation-svg {
    width: 100%;
    height: 100%;
}

.ghost {
    animation: ghost-pulse 6s ease-in-out infinite;
}

.ghost-1 { animation-delay: 0s; }
.ghost-2 { animation-delay: 0.8s; }
.ghost-3 { animation-delay: 1.6s; }
.ghost-4 { animation-delay: 2.4s; }
.ghost-5 { animation-delay: 3.2s; }
.ghost-6 { animation-delay: 4s; }
.ghost-7 { animation-delay: 4.8s; }

@keyframes ghost-pulse {
    0%, 100% { opacity: 0.15; }
    50% { opacity: 0.4; }
}

.departure-title {
    color: var(--deep-text);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .concept-panels {
        flex-direction: column;
        gap: 3vh;
    }

    .concept-panel {
        max-width: 90vw;
    }

    .archive-band {
        flex-wrap: wrap;
        gap: 1rem;
        padding: 2vh 3vw;
    }

    .band-number {
        min-width: auto;
        text-align: center;
    }

    .studio-blueprint {
        width: 80vmin;
        height: 80vmin;
    }

    .constellation {
        width: 95vw;
    }
}

/* ===== SCROLL TRANSITION CROSSFADE ===== */
.act {
    opacity: 0;
    transition: opacity 1.2s ease;
}

.act.in-view {
    opacity: 1;
}