/* ========================================
   lupine.day — Cyberpunk Botanical Anomaly
   ======================================== */

:root {
    --void: #0e0e1a;
    --circuit-dusk: #1a1a2e;
    --irradiated-rose: #f8c8dc;
    --bleached-mint: #b8e0d2;
    --faded-orchid: #c3b1e1;
    --lavender-mist: #e8dff5;
    --ghost-lilac: #9a8fb5;
    --lupine-gold: #f5e6a3;
    --spine-width: 48px;
}

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

html {
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: var(--faded-orchid) var(--void);
}

body {
    background: var(--void);
    color: var(--lavender-mist);
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.3vw, 1.25rem);
    line-height: 1.75;
    overflow-x: hidden;
}

/* ========== Noise Overlay ========== */
.noise-svg {
    position: absolute;
    width: 0;
    height: 0;
}

.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1000;
    pointer-events: none;
    mix-blend-mode: soft-light;
    opacity: 1;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
    background-repeat: repeat;
}

/* ========== The Spine ========== */
.spine {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--spine-width);
    height: 100vh;
    background: rgba(26, 26, 46, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 900;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 800ms ease-out;
}

.spine.visible {
    opacity: 1;
}

.spine-lupine {
    position: absolute;
    top: 16px;
    width: 20px;
    height: 120px;
}

.lupine-icon {
    width: 20px;
    height: 120px;
}

.lupine-icon .petal {
    transition: opacity 600ms ease-out;
}

.spine-indicators {
    display: flex;
    flex-direction: column;
    gap: 24px;
    align-items: center;
}

.spine-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ghost-lilac);
    border: none;
    cursor: pointer;
    position: relative;
    transition: all 300ms ease;
    opacity: 0.5;
}

.spine-dot.active {
    opacity: 1;
    box-shadow: 0 0 12px var(--irradiated-rose), 0 0 24px rgba(248, 200, 220, 0.3);
    background: var(--irradiated-rose);
}

.spine-dot .spine-label {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-family: 'Cormorant Garamond', serif;
    font-weight: 500;
    font-variant: small-caps;
    font-size: 0.7rem;
    color: var(--faded-orchid);
    opacity: 0;
    white-space: nowrap;
    transition: opacity 200ms ease;
    pointer-events: none;
}

.spine-dot:hover .spine-label {
    opacity: 0.7;
}

.spine-dot:hover {
    transform: scale(1.5);
}

/* ========== Center Line ========== */
.center-line {
    position: fixed;
    left: calc(var(--spine-width) + 60%);
    top: 0;
    width: 2px;
    height: 100vh;
    z-index: 50;
    animation: centerLinePulse 4s ease-in-out infinite;
}

@keyframes centerLinePulse {
    0%, 100% { background: rgba(248, 200, 220, 0.15); }
    50% { background: rgba(195, 177, 225, 0.15); }
}

/* ========== Strata / Sections ========== */
.stratum {
    min-height: 100vh;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-left: var(--spine-width);
}

.stratum-content {
    display: flex;
    align-items: stretch;
    min-height: 80vh;
    padding: 4rem 2rem;
    gap: 0;
}

.primary-zone {
    padding: 2rem 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1.5rem;
}

/* Split ratios */
.stratum[data-split="60"] .primary-zone { flex: 0 0 60%; }
.stratum[data-split="60"] .diagnostic-panel { flex: 0 0 38%; }
.stratum[data-split="55"] .primary-zone { flex: 0 0 55%; }
.stratum[data-split="55"] .diagnostic-panel { flex: 0 0 43%; }
.stratum[data-split="65"] .primary-zone { flex: 0 0 65%; }
.stratum[data-split="65"] .diagnostic-panel { flex: 0 0 33%; }

/* ========== Typography ========== */
.section-header {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-style: italic;
    font-size: clamp(2.8rem, 6vw, 5.5rem);
    letter-spacing: 0.02em;
    color: var(--irradiated-rose);
    text-shadow: 0 0 40px rgba(248, 200, 220, 0.3);
    line-height: 1.1;
    position: relative;
}

.section-header::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, transparent, transparent);
    pointer-events: none;
    opacity: 0;
}

.section-header:hover::after {
    animation: scanLine 600ms linear;
}

@keyframes scanLine {
    0% { background: linear-gradient(to bottom, rgba(248,200,220,0.2) 0%, transparent 2%); background-position: 0 0; opacity: 1; }
    100% { background: linear-gradient(to bottom, rgba(248,200,220,0.2) 0%, transparent 2%); background-position: 0 100%; opacity: 1; background-size: 100% 100%; }
}

.section-body {
    color: rgba(232, 223, 245, 0.88);
    max-width: 60ch;
}

.section-body em {
    color: var(--irradiated-rose);
    font-style: italic;
}

/* ========== Diagnostic Panel ========== */
.diagnostic-panel {
    position: relative;
    background: rgba(26, 26, 46, 0.6);
    padding: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Scan lines */
    background-image: repeating-linear-gradient(
        to bottom,
        rgba(195, 177, 225, 0.08) 0px,
        rgba(195, 177, 225, 0.08) 1px,
        transparent 1px,
        transparent 4px
    );
}

.corner-bracket {
    position: absolute;
    width: 24px;
    height: 24px;
    border-color: rgba(184, 224, 210, 0.4);
    border-style: solid;
    border-width: 0;
    transition: all 600ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.corner-bracket.tl { top: 12px; left: 12px; border-top-width: 2px; border-left-width: 2px; transform: translate(-20px, -20px); opacity: 0; }
.corner-bracket.tr { top: 12px; right: 12px; border-top-width: 2px; border-right-width: 2px; transform: translate(20px, -20px); opacity: 0; }
.corner-bracket.bl { bottom: 12px; left: 12px; border-bottom-width: 2px; border-left-width: 2px; transform: translate(-20px, 20px); opacity: 0; }
.corner-bracket.br { bottom: 12px; right: 12px; border-bottom-width: 2px; border-right-width: 2px; transform: translate(20px, 20px); opacity: 0; }

.stratum.in-view .corner-bracket {
    transform: translate(0, 0);
    opacity: 1;
}

/* Radial Ping */
.radial-ping {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    border-radius: 50%;
    pointer-events: none;
    animation: radialPing 4s ease-out infinite;
}

@keyframes radialPing {
    0% { box-shadow: 0 0 0 0 rgba(248, 200, 220, 0.15); }
    70% { box-shadow: 0 0 0 100px rgba(248, 200, 220, 0); }
    100% { box-shadow: 0 0 0 100px rgba(248, 200, 220, 0); }
}

.diag-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
    z-index: 2;
    width: 100%;
}

.diag-label {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(184, 224, 210, 0.65);
    transition: color 200ms ease, opacity 200ms ease;
}

.diag-value {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    color: rgba(184, 224, 210, 0.65);
    margin-bottom: 0.75rem;
    transition: color 200ms ease, opacity 200ms ease;
}

.diag-label:hover,
.diag-value:hover {
    color: var(--irradiated-rose);
    opacity: 1;
}

/* Data Ticker */
.data-ticker {
    height: 1.5rem;
    overflow: hidden;
    margin-top: 1rem;
    border-top: 1px solid rgba(184, 224, 210, 0.15);
    padding-top: 0.5rem;
}

.ticker-track {
    display: flex;
    flex-direction: column;
    animation: tickerScroll 20s linear infinite;
}

.ticker-track span {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    color: rgba(184, 224, 210, 0.45);
    line-height: 1.5rem;
    white-space: nowrap;
}

@keyframes tickerScroll {
    0% { transform: translateY(0); }
    100% { transform: translateY(calc(-1.5rem * 9)); }
}

/* ========== Blur / Progressive Disclosure ========== */
.blurred {
    filter: blur(20px);
    opacity: 0.3;
    transition: filter 1200ms ease-out, opacity 1200ms ease-out;
}

.blurred.delay-1 {
    transition-delay: 200ms;
}

.blurred.delay-2 {
    transition-delay: 400ms;
}

.stratum.in-view .blurred {
    filter: blur(0);
    opacity: 1;
}

/* First section auto-reveal after load */
.stratum-0.in-view .section-header.blurred {
    transition-delay: 0ms;
}

/* ========== Section Divider ========== */
.section-divider {
    padding: 0 var(--spine-width);
    height: 20px;
    display: flex;
    align-items: center;
}

.divider-lupines {
    width: 100%;
    height: 20px;
    opacity: 0.6;
}

/* ========== Watermark Lupine (last section) ========== */
.watermark-lupine {
    position: absolute;
    right: -10%;
    top: 10%;
    width: 60vh;
    height: 80vh;
    opacity: 0.03;
    transform: rotate(12deg);
    pointer-events: none;
    background: var(--faded-orchid);
    clip-path: polygon(
        50% 0%, 35% 8%, 50% 12%, 65% 8%,
        50% 16%, 30% 24%, 50% 28%, 70% 24%,
        50% 32%, 25% 40%, 50% 44%, 75% 40%,
        50% 48%, 20% 56%, 50% 60%, 80% 56%,
        50% 64%, 25% 72%, 50% 76%, 75% 72%,
        50% 80%, 30% 88%, 50% 92%, 70% 88%,
        50% 100%, 48% 92%, 50% 0%
    );
}

/* ========== Spine Dot Glow per Section ========== */
.stratum-0.in-view ~ .spine .spine-dot[data-section="0"],
.spine-dot[data-section="0"].active {
    background: var(--irradiated-rose);
    box-shadow: 0 0 12px var(--irradiated-rose);
}

/* ========== Spine dot pulse animation ========== */
@keyframes dotPulse {
    0% { opacity: 1; box-shadow: 0 0 20px var(--irradiated-rose); }
    100% { opacity: 0.7; box-shadow: 0 0 12px rgba(248, 200, 220, 0.3); }
}

.spine-dot.pulse {
    animation: dotPulse 400ms ease-out forwards;
}

/* ========== Header scan effect ========== */
.section-header .scan-sweep {
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: rgba(248, 200, 220, 0.4);
    pointer-events: none;
    animation: sweepDown 600ms linear forwards;
}

@keyframes sweepDown {
    0% { top: 0; opacity: 1; }
    100% { top: 100%; opacity: 0; }
}

/* ========== No-JS Fallback ========== */
noscript + .stratum .blurred,
body:not(.js-enabled) .blurred {
    filter: none;
    opacity: 1;
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
    :root {
        --spine-width: 36px;
    }

    .stratum-content {
        flex-direction: column;
        padding: 2rem 1rem;
    }

    .primary-zone,
    .stratum[data-split="60"] .primary-zone,
    .stratum[data-split="55"] .primary-zone,
    .stratum[data-split="65"] .primary-zone {
        flex: 1 1 auto;
        padding: 1rem;
    }

    .diagnostic-panel,
    .stratum[data-split="60"] .diagnostic-panel,
    .stratum[data-split="55"] .diagnostic-panel,
    .stratum[data-split="65"] .diagnostic-panel {
        flex: 0 0 auto;
        min-height: 200px;
    }

    .center-line {
        display: none;
    }

    .section-header {
        font-size: clamp(2rem, 8vw, 3.5rem);
    }
}
