/* ============================
   conc.quest - Chrome Fairy Codex
   ============================ */

/* CSS Custom Properties */
:root {
    --void-chrome: #0B0F14;
    --gunmetal-mist: #1A1F27;
    --liquid-silver: #C8CED6;
    --fairy-teal: #7FDBCA;
    --moth-wing: #9B8EC4;
    --silver-breath: #B8BFC6;
    --plasma-mint: #4AEDC4;
    --chrome-rose: #D4728C;
    --text-bright: #D4DAE0;
    --panel-mid: #2A3040;
    --chrome-gray: #A8A8A8;

    --cursor-x: 50%;
    --cursor-y: 50%;

    --ease-moth: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --spine-width: 2px;
}

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--void-chrome);
    color: var(--silver-breath);
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 400;
    font-size: 18px;
    line-height: 1.7;
    overflow-x: hidden;
    position: relative;
}

/* ============================
   Grid Overlay
   ============================ */
#grid-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    background-image:
        linear-gradient(to right, rgba(200, 206, 214, 0.04) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(200, 206, 214, 0.04) 1px, transparent 1px);
    background-size: 60px 60px;
}

/* ============================
   Cursor-Follow Light
   ============================ */
#cursor-light {
    position: fixed;
    top: 0;
    left: 0;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(127, 219, 202, 0.08) 0%, transparent 70%);
    pointer-events: none;
    z-index: 2;
    transform: translate(-50%, -50%);
    will-change: transform;
    transition: opacity 0.3s var(--ease-moth);
}

#cursor-light.fading {
    opacity: 0;
}

/* ============================
   Central Spine
   ============================ */
#spine {
    position: fixed;
    top: 0;
    left: 50%;
    width: var(--spine-width);
    height: 100vh;
    background: linear-gradient(180deg, #7FDBCA, #9B8EC4, #7FDBCA);
    transform: translateX(-50%);
    z-index: 3;
    pointer-events: none;
    animation: spinePulse 4s ease-in-out infinite;
}

@keyframes spinePulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.8; }
}

/* ============================
   Sections - General
   ============================ */
.section {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* ============================
   Section 1: Portal
   ============================ */
.section--portal {
    background: radial-gradient(ellipse at var(--cursor-x) var(--cursor-y), var(--panel-mid) 0%, var(--void-chrome) 70%);
    z-index: 4;
}

.portal-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--gunmetal-mist) 0%, var(--panel-mid) 40%, var(--gunmetal-mist) 100%);
    opacity: 0.6;
}

.portal-title {
    position: relative;
    z-index: 5;
    font-family: 'Libre Baskerville', serif;
    font-weight: 400;
    font-size: clamp(48px, 8vw, 96px);
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #C0C0C0, #E8E8E8, #A8A8A8);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-align: center;
    opacity: 0;
    animation: portalReveal 2s var(--ease-moth) 0.5s forwards;
}

@keyframes portalReveal {
    from {
        opacity: 0;
        filter: blur(8px);
    }
    to {
        opacity: 1;
        filter: blur(0);
    }
}

/* ============================
   Interstitials
   ============================ */
.interstitial {
    position: relative;
    height: 30vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--void-chrome);
    overflow: hidden;
}

.chrome-torus {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 3px solid transparent;
    background:
        linear-gradient(var(--void-chrome), var(--void-chrome)) padding-box,
        linear-gradient(135deg, var(--fairy-teal), var(--moth-wing), var(--fairy-teal)) border-box;
    position: relative;
    animation: torusRotate 12s linear infinite;
    opacity: 0.6;
}

.chrome-torus::before {
    content: '';
    position: absolute;
    top: 15px;
    left: 15px;
    right: 15px;
    bottom: 15px;
    border-radius: 50%;
    border: 1px solid rgba(200, 206, 214, 0.2);
}

.chrome-torus::after {
    content: '';
    position: absolute;
    top: 30px;
    left: 30px;
    right: 30px;
    bottom: 30px;
    border-radius: 50%;
    border: 1px solid rgba(200, 206, 214, 0.1);
}

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

/* ============================
   Narrative Sections
   ============================ */
.section--narrative {
    background: linear-gradient(135deg, var(--gunmetal-mist) 0%, var(--panel-mid) 40%, var(--gunmetal-mist) 100%);
    padding: 80px 0;
}

.section-inner {
    display: flex;
    align-items: center;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    gap: 0;
    position: relative;
    z-index: 4;
}

.section--image-left .section-inner {
    flex-direction: row;
}

.section--image-right .section-inner {
    flex-direction: row-reverse;
}

/* Narrative Image */
.narrative-image {
    flex: 0 0 50%;
    position: relative;
    overflow: visible;
}

.section--image-left .narrative-image {
    margin-left: -5vw;
}

.section--image-right .narrative-image {
    margin-right: -5vw;
}

.image-placeholder {
    width: 100%;
    height: auto;
    display: block;
}

/* Duotone treatments */
.duotone-image {
    position: relative;
    overflow: hidden;
}

.duotone-image::after {
    content: '';
    position: absolute;
    inset: 0;
    mix-blend-mode: color;
    z-index: 1;
}

.duotone--teal::after {
    background: linear-gradient(to bottom, var(--fairy-teal), var(--void-chrome));
}

.duotone--moth::after {
    background: linear-gradient(to bottom, var(--moth-wing), var(--void-chrome));
}

.duotone--silver::after {
    background: linear-gradient(to bottom, var(--liquid-silver), var(--gunmetal-mist));
}

.duotone--rose::after {
    background: linear-gradient(to bottom, var(--chrome-rose), var(--void-chrome));
}

/* Scan Rings */
.scan-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    border: 1px solid var(--fairy-teal);
    transform: translate(-50%, -50%);
    pointer-events: none;
    opacity: 0;
    animation: scanExpand 8s ease-out infinite;
}

.scan-ring--2 {
    animation-delay: 2.67s;
}

.scan-ring--3 {
    animation-delay: 5.33s;
}

@keyframes scanExpand {
    0% {
        width: 0;
        height: 0;
        opacity: 0.08;
    }
    100% {
        width: 400px;
        height: 400px;
        opacity: 0;
    }
}

/* Narrative Text */
.narrative-text {
    flex: 0 0 50%;
    padding: 0 40px;
}

.section--image-left .narrative-text {
    padding-left: 120px;
    padding-right: 40px;
}

.section--image-right .narrative-text {
    padding-right: 120px;
    padding-left: 40px;
}

/* Chrome Panel */
.chrome-panel {
    position: relative;
    background: linear-gradient(135deg, rgba(26, 31, 39, 0.8) 0%, rgba(42, 48, 64, 0.4) 100%);
    backdrop-filter: blur(8px);
    padding: 48px;
    border: 1px solid rgba(200, 206, 214, 0.08);
}

/* ============================
   HUD Corner Brackets
   ============================ */
.hud-bracket {
    position: absolute;
    width: 24px;
    height: 24px;
    pointer-events: none;
    transition: transform 0.3s var(--ease-moth);
}

.hud-bracket--tl {
    top: -1px;
    left: -1px;
    border-top: 2px solid var(--plasma-mint);
    border-left: 2px solid var(--plasma-mint);
    opacity: 0.25;
}

.hud-bracket--tr {
    top: -1px;
    right: -1px;
    border-top: 2px solid var(--plasma-mint);
    border-right: 2px solid var(--plasma-mint);
    opacity: 0.25;
}

.hud-bracket--bl {
    bottom: -1px;
    left: -1px;
    border-bottom: 2px solid var(--plasma-mint);
    border-left: 2px solid var(--plasma-mint);
    opacity: 0.25;
}

.hud-bracket--br {
    bottom: -1px;
    right: -1px;
    border-bottom: 2px solid var(--plasma-mint);
    border-right: 2px solid var(--plasma-mint);
    opacity: 0.25;
}

/* ============================
   Typography
   ============================ */
.section-heading {
    font-family: 'Libre Baskerville', serif;
    font-weight: 400;
    font-size: clamp(32px, 4vw, 56px);
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #C0C0C0, #E8E8E8, #A8A8A8);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 32px;
    line-height: 1.2;
}

.body-text {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 400;
    font-size: 18px;
    line-height: 1.7;
    color: var(--silver-breath);
    margin-bottom: 24px;
    max-width: 540px;
}

.body-text:last-of-type {
    margin-bottom: 0;
}

.pull-quote {
    font-family: 'Libre Baskerville', serif;
    font-style: italic;
    font-weight: 400;
    font-size: clamp(22px, 2.5vw, 32px);
    line-height: 1.5;
    color: var(--text-bright);
    text-shadow: 0 0 12px rgba(127, 219, 202, 0.3);
    margin-top: 32px;
    padding-left: 24px;
    border-left: 2px solid var(--fairy-teal);
    max-width: 540px;
}

/* Accent / UI Text */
.ticker-text {
    font-family: 'Orbitron', sans-serif;
    font-weight: 500;
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--fairy-teal);
}

/* ============================
   Data Ticker
   ============================ */
.data-ticker {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 32px;
    overflow: hidden;
    display: flex;
    align-items: center;
    z-index: 5;
    opacity: 0.3;
    border-top: 1px solid rgba(200, 206, 214, 0.06);
}

.data-ticker .ticker-text {
    display: inline-block;
    white-space: nowrap;
    animation: tickerScroll 40s linear infinite;
    padding-left: 100%;
}

@keyframes tickerScroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}

/* ============================
   Reveal Animation
   ============================ */
.reveal-element {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s var(--ease-moth), transform 0.8s var(--ease-moth);
}

.reveal-element.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ============================
   Terminal Section
   ============================ */
.section--terminal {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.terminal-chrome {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg,
        var(--void-chrome) 0%,
        var(--gunmetal-mist) 30%,
        var(--panel-mid) 50%,
        var(--gunmetal-mist) 70%,
        var(--void-chrome) 100%
    );
    opacity: 0.8;
}

.terminal-message {
    position: relative;
    z-index: 5;
    font-family: 'Libre Baskerville', serif;
    font-style: italic;
    font-weight: 400;
    font-size: clamp(20px, 3vw, 36px);
    line-height: 1.6;
    text-align: center;
    color: var(--text-bright);
    text-shadow: 0 0 12px rgba(127, 219, 202, 0.3);
    max-width: 700px;
    padding: 0 40px;
    opacity: 0;
    transition: opacity 1.2s var(--ease-moth);
}

.terminal-message.revealed {
    opacity: 1;
}

.section--terminal .hud-bracket {
    z-index: 6;
}

.section--terminal .hud-bracket--tl {
    top: 40px;
    left: 40px;
    width: 48px;
    height: 48px;
}

.section--terminal .hud-bracket--tr {
    top: 40px;
    right: 40px;
    width: 48px;
    height: 48px;
}

.section--terminal .hud-bracket--bl {
    bottom: 40px;
    left: 40px;
    width: 48px;
    height: 48px;
}

.section--terminal .hud-bracket--br {
    bottom: 40px;
    right: 40px;
    width: 48px;
    height: 48px;
}

/* ============================
   Dewdrops
   ============================ */
.dewdrop {
    position: fixed;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(200, 206, 214, 0.5), rgba(200, 206, 214, 0.1));
    pointer-events: none;
    z-index: 2;
    transition: filter 0.2s var(--ease-moth);
}

.dewdrop.bright {
    filter: brightness(1.4);
}

/* ============================
   Moth Paths
   ============================ */
.moth-paths {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

/* ============================
   Vine Filigree
   ============================ */
.vine-filigree {
    position: fixed;
    top: 0;
    width: 60px;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.vine-filigree--left {
    left: 0;
}

.vine-filigree--right {
    right: 0;
}

/* ============================
   Chrome Mushroom Ring Decorations
   ============================ */
.mushroom-ring {
    position: absolute;
    pointer-events: none;
    z-index: 1;
}

.mushroom-dome {
    width: 12px;
    height: 8px;
    background: linear-gradient(135deg, var(--liquid-silver), var(--chrome-gray));
    border-radius: 50% 50% 0 0;
    position: absolute;
    opacity: 0.15;
}

/* ============================
   Responsive
   ============================ */
@media (max-width: 768px) {
    body {
        font-size: 16px;
        line-height: 1.65;
    }

    .section-inner {
        flex-direction: column !important;
        padding: 0 20px;
    }

    .narrative-image {
        flex: 0 0 auto;
        width: 100%;
        margin: 0 !important;
        margin-bottom: 32px !important;
    }

    .narrative-text {
        flex: 0 0 auto;
        width: 100%;
        padding: 0 !important;
    }

    .section--image-left .narrative-text,
    .section--image-right .narrative-text {
        padding: 0 !important;
    }

    .chrome-panel {
        padding: 32px 24px;
    }

    .body-text {
        font-size: 16px;
        line-height: 1.65;
        max-width: 100%;
    }

    .pull-quote {
        font-size: 20px;
        max-width: 100%;
    }

    #spine {
        opacity: 0.2;
    }

    .vine-filigree {
        display: none;
    }

    .section--terminal .hud-bracket--tl,
    .section--terminal .hud-bracket--tr,
    .section--terminal .hud-bracket--bl,
    .section--terminal .hud-bracket--br {
        width: 32px;
        height: 32px;
    }

    .section--terminal .hud-bracket--tl { top: 20px; left: 20px; }
    .section--terminal .hud-bracket--tr { top: 20px; right: 20px; }
    .section--terminal .hud-bracket--bl { bottom: 20px; left: 20px; }
    .section--terminal .hud-bracket--br { bottom: 20px; right: 20px; }
}

@media (max-width: 480px) {
    .section--narrative {
        padding: 40px 0;
    }

    .chrome-panel {
        padding: 24px 16px;
    }

    .interstitial {
        height: 20vh;
    }

    .chrome-torus {
        width: 80px;
        height: 80px;
    }

    .section-heading {
        font-size: 28px;
    }
}
