/* sora.day — Botanical Circuit Herbarium */
/* Translucent Frost Palette */
:root {
    --frost-white: #f4f7f9;
    --deep-frost: #e8eef3;
    --frost-line: #b8c9d4;
    --deep-ink: #2c3e50;
    --frost-slate: #4a6274;
    --ice-accent: #7ba7c2;
    --specimen-green: #8fb5a1;
    --petal-blush: #c4a6b5;
    --trace-gold: #b8a88a;
    --snow: #ffffff;
    --ease-settle: cubic-bezier(0.23, 1, 0.32, 1);
    --d0dde6: #d0dde6;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--frost-white);
    color: var(--frost-slate);
    font-family: 'Quicksand', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.75;
    letter-spacing: 0.01em;
    overflow-x: hidden;
}

/* ========== FROST TEXTURE ========== */
.frost-texture {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(circle at 15% 25%, rgba(184, 201, 212, 0.012) 0%, transparent 50%),
        radial-gradient(circle at 72% 18%, rgba(184, 201, 212, 0.015) 0%, transparent 45%),
        radial-gradient(circle at 40% 65%, rgba(184, 201, 212, 0.01) 0%, transparent 55%),
        radial-gradient(circle at 85% 70%, rgba(184, 201, 212, 0.013) 0%, transparent 40%),
        radial-gradient(circle at 25% 85%, rgba(184, 201, 212, 0.008) 0%, transparent 60%),
        radial-gradient(circle at 60% 45%, rgba(184, 201, 212, 0.011) 0%, transparent 50%);
}

/* ========== EDITORIAL SPINE ========== */
.editorial-spine {
    position: fixed;
    top: 0;
    left: 33.33%;
    width: 1px;
    height: 100vh;
    z-index: 100;
    pointer-events: none;
}

.spine-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 1px;
    height: 100%;
    background-color: var(--frost-line);
    opacity: 0;
    transition: opacity 0.8s var(--ease-settle);
}

.spine-line.visible {
    opacity: 0.4;
}

.spine-progress {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    z-index: 101;
}

.progress-circle {
    width: 24px;
    height: 24px;
}

.progress-bg {
    fill: none;
    stroke: var(--frost-line);
    stroke-width: 1.5;
    opacity: 0.3;
}

.progress-fill {
    fill: none;
    stroke: var(--ice-accent);
    stroke-width: 1.5;
    stroke-dasharray: 62.83;
    stroke-dashoffset: 62.83;
    transform: rotate(-90deg);
    transform-origin: center;
    transition: stroke-dashoffset 0.3s ease;
}

.junction-node {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    border: 1px solid var(--frost-line);
    background: transparent;
    opacity: 0.2;
    animation: nodePulse 4s ease-in-out infinite;
}

.junction-node[data-plate="1"] { top: 10%; }
.junction-node[data-plate="2"] { top: 30%; }
.junction-node[data-plate="3"] { top: 50%; }
.junction-node[data-plate="4"] { top: 70%; }
.junction-node[data-plate="5"] { top: 90%; }

.junction-node.final-pulse {
    animation: finalPulse 1.5s ease-in-out;
}

@keyframes nodePulse {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 0.5; }
}

@keyframes finalPulse {
    0% { opacity: 0.2; transform: translateX(-50%) scale(1); }
    50% { opacity: 0.8; transform: translateX(-50%) scale(1.8); border-color: var(--ice-accent); }
    100% { opacity: 0.2; transform: translateX(-50%) scale(1); }
}

/* ========== PLATES (Sections) ========== */
.plate {
    position: relative;
    z-index: 1;
}

/* ========== PLATE I — TITLE CARTOUCHE ========== */
.plate-1 {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 0 5vw;
    overflow: hidden;
}

.plate-content.recto {
    position: relative;
    margin-left: 36%;
    max-width: 520px;
    z-index: 2;
}

.domain-title {
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: clamp(2.8rem, 6vw, 5rem);
    color: var(--deep-ink);
    letter-spacing: 0.02em;
    line-height: 1.1;
    margin-bottom: 1.5rem;
}

.domain-title .letter {
    display: inline-block;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.6s var(--ease-settle), transform 0.6s var(--ease-settle);
    transition-delay: calc(var(--delay) * 80ms + 0.8s);
}

.plate-1.in-view .domain-title .letter {
    opacity: 1;
    transform: translateY(0);
}

.subtitle {
    font-family: 'Quicksand', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.1rem);
    color: var(--frost-slate);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 1.2s var(--ease-settle) 1.8s, transform 1.2s var(--ease-settle) 1.8s;
    line-height: 1.6;
}

.plate-1.in-view .subtitle {
    opacity: 1;
    transform: translateY(0);
}

.specimen-hero {
    position: absolute;
    right: 8vw;
    top: 50%;
    transform: translateY(-50%);
    width: clamp(250px, 30vw, 400px);
    z-index: 1;
}

.botanical-specimen {
    width: 100%;
    height: auto;
}

/* SVG Draw Path Animation */
.draw-path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 3s var(--ease-settle);
    transition-delay: var(--draw-delay, 0s);
}

.plate.in-view .draw-path {
    stroke-dashoffset: 0;
}

.wash-layer {
    opacity: 0;
    transition: opacity 1.5s ease 3.5s;
}

.plate.in-view .wash-layer {
    opacity: 1;
}

.wash-layer ellipse {
    mix-blend-mode: multiply;
}

.circuit-node {
    opacity: 0;
    transition: opacity 0.8s ease;
    transition-delay: var(--draw-delay, 2.5s);
}

.plate.in-view .circuit-node {
    opacity: 0.3;
}

/* ========== WATERCOLOR BLEEDS ========== */
.watercolor-bleed {
    position: absolute;
    left: 0;
    width: 100%;
    height: 120px;
    pointer-events: none;
    z-index: 0;
}

.bleed-bottom {
    bottom: -60px;
    background: radial-gradient(ellipse at 30% 50%, rgba(143, 181, 161, 0.04) 0%, transparent 70%),
                radial-gradient(ellipse at 70% 50%, rgba(196, 166, 181, 0.03) 0%, transparent 70%);
}

.bleed-top {
    top: -60px;
    background: radial-gradient(ellipse at 40% 50%, rgba(143, 181, 161, 0.03) 0%, transparent 70%),
                radial-gradient(ellipse at 60% 50%, rgba(196, 166, 181, 0.04) 0%, transparent 70%);
}

/* ========== CIRCUIT DIVIDERS ========== */
.circuit-divider {
    position: relative;
    width: 100%;
    height: 30px;
    z-index: 1;
    padding: 0 5vw;
}

.circuit-divider svg {
    width: 100%;
    height: 30px;
}

/* ========== PLATE II — SPECIMEN GALLERY ========== */
.plate-2 {
    min-height: 100vh;
    padding: 8vh 5vw;
    position: relative;
}

.gallery-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4vw;
    max-width: 900px;
    margin-left: 36%;
    position: relative;
}

.specimen-frame {
    border: 1px solid rgba(208, 221, 230, 0.6);
    padding: 2rem;
    position: relative;
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 1s var(--ease-settle), transform 1s var(--ease-settle);
    background: var(--snow);
}

.plate-2.in-view .specimen-frame {
    opacity: 1;
    transform: translateX(0);
}

.frame-1 { transition-delay: 0.1s; }
.frame-2 { transition-delay: 0.3s; margin-top: 6vh; }
.frame-3 { transition-delay: 0.5s; margin-top: -3vh; }
.frame-4 { transition-delay: 0.7s; margin-top: 4vh; }

.gallery-specimen {
    width: 100%;
    height: auto;
    display: block;
}

.specimen-caption {
    margin-top: 1rem;
    font-family: 'Quicksand', sans-serif;
    font-weight: 500;
    font-size: clamp(0.7rem, 0.85vw, 0.85rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ice-accent);
}

.caption-separator {
    margin: 0 0.3em;
}

/* Counter Animate */
.counter-animate {
    display: inline-block;
    font-variant-numeric: tabular-nums;
}

/* ========== PLATE III — THE VEIN MAP ========== */
.plate-3 {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--deep-frost);
    transition: background-color 1.5s ease-in-out;
    position: relative;
    overflow: hidden;
}

.vein-map-container {
    position: relative;
    width: 90vw;
    max-width: 1000px;
    height: 80vh;
}

.vein-map-svg {
    width: 100%;
    height: 100%;
}

.vein-path {
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    transition: stroke-dashoffset 1.5s var(--ease-settle);
    transition-delay: var(--vein-delay, 0s);
}

.plate-3.in-view .vein-path {
    stroke-dashoffset: 0;
}

.vein-node {
    opacity: 0;
    transition: opacity 0.8s ease;
    transition-delay: var(--vein-delay, 0s);
}

.plate-3.in-view .vein-node {
    opacity: 1;
}

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

.vein-annotation {
    position: absolute;
    font-family: 'Quicksand', sans-serif;
    font-weight: 500;
    font-size: clamp(0.7rem, 0.85vw, 0.85rem);
    color: var(--ice-accent);
    opacity: 0;
    transition: opacity 1s var(--ease-settle);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.plate-3.in-view .vein-annotation {
    opacity: 1;
}

.annotation-counter {
    font-variant-numeric: tabular-nums;
    font-size: 1.1em;
}

.annotation-label {
    font-size: clamp(0.6rem, 0.7vw, 0.75rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--frost-slate);
    opacity: 0.5;
}

/* ========== PLATE IV — FROST DETAIL ========== */
.plate-4 {
    min-height: 80vh;
    padding: 10vh 5vw;
    position: relative;
    background-color: var(--frost-white);
}

.frost-detail-layout {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 4vw;
    max-width: 1200px;
    margin: 0 auto;
}

.text-column {
    max-width: 280px;
    font-family: 'Quicksand', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.05rem);
    line-height: 1.85;
    color: var(--frost-slate);
    opacity: 0;
    transition: opacity 1.2s var(--ease-settle), transform 1.2s var(--ease-settle);
}

.text-column p {
    margin-bottom: 1.5em;
}

.text-column-left {
    transform: translateX(-15px);
    transition-delay: 0.2s;
}

.text-column-right {
    transform: translateX(15px);
    transition-delay: 0.4s;
}

.plate-4.in-view .text-column {
    opacity: 1;
    transform: translateX(0);
}

.central-specimen {
    position: relative;
    flex-shrink: 0;
    width: clamp(280px, 30vw, 400px);
}

.specimen-classification {
    position: absolute;
    top: -2rem;
    right: 0;
    font-family: 'Quicksand', sans-serif;
    font-weight: 500;
    font-size: clamp(0.65rem, 0.8vw, 0.8rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ice-accent);
    z-index: 2;
}

.classification-label {
    margin-right: 0.5em;
}

.detail-botanical {
    width: 100%;
    height: auto;
}

/* Parallax effect for Plate IV */
.central-specimen {
    will-change: transform;
}

/* ========== PLATE V — CLOSING NOTATION ========== */
.plate-5 {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.closing-watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Nunito', sans-serif;
    font-weight: 300;
    font-size: clamp(8rem, 18vw, 16rem);
    color: var(--ice-accent);
    opacity: 0.06;
    white-space: nowrap;
    pointer-events: none;
    z-index: 0;
    user-select: none;
}

.closing-content {
    position: relative;
    z-index: 1;
    text-align: center;
}

.closing-text {
    font-family: 'Quicksand', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    color: var(--frost-slate);
    line-height: 2;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 1.2s var(--ease-settle), transform 1.2s var(--ease-settle);
}

.plate-5.in-view .closing-text:nth-child(1) { opacity: 1; transform: translateY(0); transition-delay: 0.2s; }
.plate-5.in-view .closing-text:nth-child(2) { opacity: 1; transform: translateY(0); transition-delay: 0.6s; }
.plate-5.in-view .closing-text:nth-child(3) { opacity: 1; transform: translateY(0); transition-delay: 1s; }

.closing-fade {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 10vh;
    background: linear-gradient(to bottom, transparent, var(--snow));
    pointer-events: none;
    z-index: 2;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 900px) {
    .editorial-spine {
        left: 10%;
    }

    .plate-content.recto {
        margin-left: 15%;
    }

    .gallery-grid {
        margin-left: 15%;
        grid-template-columns: 1fr;
        max-width: 400px;
    }

    .frost-detail-layout {
        flex-direction: column;
        align-items: center;
    }

    .text-column {
        max-width: 90%;
    }

    .specimen-hero {
        right: 2vw;
        width: clamp(180px, 40vw, 300px);
        opacity: 0.5;
    }
}

@media (max-width: 600px) {
    .editorial-spine {
        display: none;
    }

    .plate-content.recto {
        margin-left: 5%;
    }

    .gallery-grid {
        margin-left: 5%;
    }

    .specimen-hero {
        position: relative;
        right: auto;
        top: auto;
        transform: none;
        margin: 2rem auto;
        width: 60%;
    }

    .plate-1 {
        flex-direction: column;
        justify-content: center;
        text-align: center;
    }

    .plate-content.recto {
        margin-left: 0;
    }
}

/* ========== REDUCED MOTION ========== */
@media (prefers-reduced-motion: reduce) {
    .draw-path {
        stroke-dashoffset: 0 !important;
        stroke-dasharray: none !important;
        transition: none !important;
    }

    .wash-layer {
        opacity: 1 !important;
        transition: none !important;
    }

    .domain-title .letter {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }

    .subtitle {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }

    .specimen-frame {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }

    .vein-path {
        stroke-dashoffset: 0 !important;
        stroke-dasharray: none !important;
        transition: none !important;
    }

    .vein-node {
        opacity: 1 !important;
        transition: none !important;
    }

    .vein-annotation {
        opacity: 1 !important;
        transition: none !important;
    }

    .text-column {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }

    .closing-text {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }

    .circuit-node {
        opacity: 0.3 !important;
        transition: none !important;
    }

    .junction-node {
        animation: none !important;
    }
}