/* ============================================
   mujun.dev — Paradox Descent Stylesheet
   Art Deco x Crystalline Digital Contradiction
   ============================================ */

:root {
    --void-bg: #0a0b14;
    --deep-layer: #12132a;
    --gold: #c9a84c;
    --violet: #6e5aff;
    --body-text: #8a8399;
    --headline: #e8dcc8;
    --fracture: #4a4860;
    --hover-glow: #d4a0c7;
    --col-offset: 12vw;
    --scroll-pct: 0;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--void-bg);
    color: var(--body-text);
    font-family: 'Libre Caslon Text', serif;
    overflow-x: hidden;
    min-height: 420vh;
    cursor: default;
}

/* ---- Dot Grid Background ---- */
#dot-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
    background-image: radial-gradient(circle, rgba(138, 131, 153, 0.03) 1px, transparent 1px);
    background-size: 80px 80px;
    transition: opacity 1s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

/* ---- Scroll Progress Line ---- */
#scroll-progress {
    position: fixed;
    top: 0;
    right: 2vw;
    width: 1px;
    height: 100vh;
    z-index: 100;
    pointer-events: none;
}

#scroll-progress-fill {
    width: 1px;
    height: 0%;
    background: linear-gradient(to bottom, var(--gold), var(--violet), var(--hover-glow));
    transition: height 0.1s linear;
}

/* ---- Content Column ---- */
#content-column {
    position: relative;
    max-width: 520px;
    width: 90vw;
    padding: 0 20px;
    z-index: 10;
    transform: translateX(var(--col-offset));
    box-shadow: -4px 0 20px rgba(110, 90, 255, 0.12);
    transition: box-shadow 0.5s ease;
}

#content-column.intensified {
    box-shadow: -4px 0 24px rgba(110, 90, 255, 0.18);
}

/* ---- Stages ---- */
.stage {
    position: relative;
}

/* Stage 0 — The Void Entry */
#stage-0 {
    height: 50vh;
    display: flex;
    align-items: center;
    padding-top: 30vh;
}

.stage-0-content {
    position: relative;
}

#mujun-title {
    font-family: 'Fraunces', serif;
    font-size: clamp(4rem, 10vw, 8rem);
    font-weight: 300;
    font-variation-settings: 'wght' 300, 'SOFT' 0, 'WONK' 1;
    color: var(--headline);
    opacity: 0;
    letter-spacing: 0.04em;
    line-height: 1;
    transition: opacity 2s cubic-bezier(0.25, 0.1, 0.25, 1.0),
                font-variation-settings 0.8s ease;
    will-change: transform;
}

#mujun-title.visible {
    opacity: 0.6;
}

#mujun-subtitle {
    opacity: 0;
    transition: opacity 1.5s cubic-bezier(0.25, 0.1, 0.25, 1.0);
    margin-top: 12px;
}

#mujun-subtitle.visible {
    opacity: 0.4;
}

/* ---- Typography ---- */
.headline {
    font-family: 'Fraunces', serif;
    font-size: clamp(2.2rem, 5vw, 4rem);
    font-weight: 400;
    font-variation-settings: 'wght' 300, 'SOFT' 0, 'WONK' 1;
    color: var(--headline);
    letter-spacing: 0.04em;
    line-height: 1.2;
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 2;
    transition: font-variation-settings 0.8s ease,
                text-shadow 0.8s ease;
    will-change: transform;
}

.headline.activated {
    font-variation-settings: 'wght' 700, 'SOFT' 30, 'WONK' 1;
    text-shadow: 0 0 12px rgba(201, 168, 76, 0.6);
}

.body-text {
    font-family: 'Libre Caslon Text', serif;
    font-size: clamp(0.95rem, 1.3vw, 1.15rem);
    line-height: 1.75;
    color: var(--body-text);
    max-width: 42ch;
    margin-bottom: 1.2rem;
}

.accent-label {
    font-family: 'DM Mono', monospace;
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--gold);
}

.annotation {
    font-family: 'DM Mono', monospace;
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--gold);
    position: absolute;
    left: -80px;
    top: 0;
    opacity: 0.6;
    white-space: nowrap;
}

/* ---- Statements (Stage 1) ---- */
#stage-1 {
    padding: 8vh 0;
}

.statement {
    margin-bottom: 15vh;
}

.fade-in-statement {
    opacity: 0;
    transition: opacity 0.6s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.fade-in-statement.visible {
    opacity: 0.8;
}

/* ---- Fracture Lines ---- */
.fracture-container {
    width: 100%;
    overflow: visible;
    margin: 4vh 0;
    position: relative;
}

.fracture-svg {
    width: 100%;
    height: 60px;
    overflow: visible;
}

.fracture-line {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 1.5s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.fracture-container.drawn .fracture-line {
    stroke-dashoffset: 0;
}

.fracture-terminal {
    opacity: 0;
    transition: opacity 0.3s ease 1.5s;
}

.fracture-container.drawn .fracture-terminal {
    opacity: 1;
}

.fracture-terminal.pulsed {
    filter: drop-shadow(0 0 6px var(--hover-glow));
}

/* ---- Hexagonal Facets ---- */
.hex-cluster {
    position: relative;
    height: 60px;
    margin: 6vh 0 3vh 0;
}

.hex-facet {
    position: absolute;
    width: var(--hex-size);
    height: var(--hex-size);
    left: var(--hex-x);
    top: calc(50% + var(--hex-y));
    background: var(--hex-color);
    opacity: 0.1;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    transition: opacity 0.3s ease;
    cursor: default;
}

.hex-facet:hover {
    opacity: 1;
}

.hex-facet.adjacent-bright {
    opacity: 0.6;
}

/* ---- Content Blocks ---- */
.content-block {
    position: relative;
    padding: 3rem 0;
    margin-bottom: 6vh;
}

/* Rhombic Frame */
.rhombic-frame {
    border-top: 1px solid var(--fracture);
    border-bottom: 1px solid var(--fracture);
    padding: 3rem 1rem;
    position: relative;
}

.rhombic-frame::before,
.rhombic-frame::after {
    content: '';
    position: absolute;
    left: 50%;
    width: 20px;
    height: 20px;
    border: 1px solid var(--fracture);
    transform: translateX(-50%) rotate(45deg);
}

.rhombic-frame::before {
    top: -11px;
}

.rhombic-frame::after {
    bottom: -11px;
}

/* ---- Chevron Stack ---- */
.chevron-stack {
    position: absolute;
    top: 2rem;
    left: 0;
    right: 0;
    z-index: 0;
    pointer-events: none;
}

.chevron {
    width: 100%;
    height: 3px;
    margin-bottom: 6px;
    position: relative;
}

.chevron::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 50%;
    height: 1px;
    background: var(--fracture);
    transform-origin: right center;
    transform: rotate(-5deg);
}

.chevron::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    right: 0;
    height: 1px;
    background: var(--fracture);
    transform-origin: left center;
    transform: rotate(5deg);
}

/* ---- Stage 2 — Crystalline Archive ---- */
#stage-2 {
    padding: 8vh 0;
}

/* ---- Stage 3 — Paradox Resolution ---- */
#stage-3 {
    padding: 12vh 0;
}

.mandala-container {
    display: flex;
    justify-content: center;
    margin-bottom: 8vh;
}

#mandala {
    overflow: visible;
}

.mandala-path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 2s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.mandala-container.drawn .mandala-path {
    stroke-dashoffset: 0;
}

/* ---- Stage 4 — Final Void ---- */
#stage-4 {
    height: 40vh;
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    padding-bottom: 8vh;
}

#final-domain {
    opacity: 0.5;
}

/* ---- Magnetic Element Transform ---- */
.magnetic {
    transition: transform 0.4s cubic-bezier(0.25, 0.1, 0.25, 1.0);
    will-change: transform;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    #content-column {
        max-width: 100%;
        width: 100%;
        padding: 0 24px;
    }

    .annotation {
        position: relative;
        left: 0;
        display: block;
        margin-bottom: 0.5rem;
    }

    #mujun-title {
        font-size: clamp(2.5rem, 12vw, 5rem);
    }

    .headline {
        font-size: clamp(1.6rem, 6vw, 2.5rem);
    }

    .hex-cluster {
        margin-left: 20px;
    }
}

@media (max-width: 480px) {
    .rhombic-frame {
        padding: 2rem 0.5rem;
    }

    .rhombic-frame::before,
    .rhombic-frame::after {
        width: 14px;
        height: 14px;
    }

    .rhombic-frame::before {
        top: -8px;
    }

    .rhombic-frame::after {
        bottom: -8px;
    }
}

/* ---- Supports variable fonts ---- */
@supports (font-variation-settings: normal) {
    .variable-headline {
        font-variation-settings: 'wght' 300, 'SOFT' 0, 'WONK' 1;
    }

    .variable-headline.activated {
        font-variation-settings: 'wght' 700, 'SOFT' 30, 'WONK' 1;
    }
}