/* ============================
   dilemma.quest - Styles
   ============================ */

/* CSS Custom Properties */
:root {
    --cool-path: #2b3a67;
    --warm-path: #a8432d;
    --axis-gold: #e8c870;
    --obsidian: #0e0e18;
    --alabaster: #f0ece2;
    --ash-lavender: #9a95b0;
    --pale-aureate: #f5e6a3;
    --charcoal-veil: #1a1a2e;
    --merge-violet: #5a3d5c;

    --font-display: 'Playfair Display', Georgia, serif;
    --font-body: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    --font-mono: 'Azeret Mono', 'Courier New', monospace;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--obsidian);
    color: var(--alabaster);
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.72;
    overflow-x: hidden;
}

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

.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    opacity: 0.03;
    filter: url(#noise);
    background: rgba(255, 255, 255, 0.5);
}

.noise-overlay.intense {
    opacity: 0.05;
}

/* Vignette */
.vignette {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(14, 14, 24, 0.5) 100%);
}

/* Central Axis */
.central-axis {
    position: fixed;
    top: 0;
    left: 50%;
    width: 1px;
    height: 100vh;
    background: var(--axis-gold);
    box-shadow: 0 0 12px var(--axis-gold);
    z-index: 100;
    pointer-events: none;
    transform: translateX(-50%);
    opacity: 0;
    animation: axis-pulse 4s ease-in-out infinite;
}

.central-axis.visible {
    opacity: 1;
}

.central-axis.fading {
    animation: axis-fade 3s ease-out forwards;
}

@keyframes axis-pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

@keyframes axis-fade {
    from { opacity: 0.4; }
    to { opacity: 0; }
}

@keyframes axis-draw {
    from { clip-path: inset(0 0 100% 0); }
    to { clip-path: inset(0 0 0% 0); }
}

/* Balance Scale */
.balance-scale {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 200;
    opacity: 0.3;
    transition: opacity 0.3s;
}

.balance-scale .scale-beam {
    transform-origin: 24px 20px;
    transition: transform 0.5s ease-out;
}

/* ============================
   SECTION: The Threshold
   ============================ */
.threshold {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.threshold-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Doors */
.door {
    position: absolute;
    width: 120px;
    height: 240px;
    perspective: 800px;
}

.door-left {
    left: 10%;
    transform-origin: left center;
}

.door-right {
    right: 10%;
    transform-origin: right center;
}

.door-inner {
    width: 100%;
    height: 100%;
    border-radius: 4px 4px 60px 60px / 4px 4px 20px 20px;
    position: relative;
    transition: transform 0.6s ease;
}

.door-left .door-inner {
    background: linear-gradient(135deg, var(--cool-path), var(--charcoal-veil));
    transform: perspective(800px) rotateY(8deg);
    transform-origin: left center;
    border: 1px solid rgba(43, 58, 103, 0.5);
}

.door-right .door-inner {
    background: linear-gradient(225deg, var(--warm-path), var(--charcoal-veil));
    transform: perspective(800px) rotateY(-8deg);
    transform-origin: right center;
    border: 1px solid rgba(168, 67, 45, 0.5);
}

.door-glow {
    position: absolute;
    top: 10%;
    width: 80%;
    height: 80%;
    border-radius: 2px;
    opacity: 0.15;
}

.door-left .door-glow {
    right: -5%;
    background: radial-gradient(ellipse at right center, var(--cool-path), transparent);
}

.door-right .door-glow {
    left: -5%;
    background: radial-gradient(ellipse at left center, var(--warm-path), transparent);
}

.threshold .door {
    opacity: 0;
    transition: opacity 1.5s ease 1s;
}

.threshold.active .door {
    opacity: 1;
}

/* Threshold Text */
.threshold-text {
    position: relative;
    z-index: 10;
    text-align: center;
    max-width: 600px;
    padding: 0 20px;
}

.site-title {
    font-family: var(--font-mono);
    font-size: clamp(1.2rem, 3vw, 2rem);
    font-weight: 500;
    color: var(--axis-gold);
    letter-spacing: 0.08em;
    margin-bottom: 2rem;
    min-height: 2.5rem;
}

.site-title .cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    background: var(--axis-gold);
    margin-left: 2px;
    animation: blink 0.8s step-end infinite;
}

@keyframes blink {
    50% { opacity: 0; }
}

.opening-question {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.2rem, 2.5vw, 2rem);
    color: var(--alabaster);
    opacity: 0;
    transition: opacity 2s ease 3.5s;
    line-height: 1.5;
}

.threshold.active .opening-question {
    opacity: 1;
}

/* ============================
   SECTION: Fork Zones
   ============================ */
.fork-zone {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
    min-height: 100vh;
    padding: 80px 0;
}

.fork-half {
    padding: clamp(40px, 6vw, 80px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fork-left {
    text-align: right;
    background: linear-gradient(135deg, rgba(43, 58, 103, 0.15), transparent);
    transform: translateX(-40px);
}

.fork-right {
    text-align: left;
    background: linear-gradient(225deg, rgba(168, 67, 45, 0.15), transparent);
    transform: translateX(40px);
}

.fork-zone.visible .fork-left {
    opacity: 1;
    transform: translateX(0);
}

.fork-zone.visible .fork-right {
    opacity: 1;
    transform: translateX(0);
}

.path-label {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ash-lavender);
    margin-bottom: 1rem;
    display: block;
}

.fork-heading {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    letter-spacing: -0.02em;
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

.fork-left .fork-heading {
    color: var(--pale-aureate);
}

.fork-right .fork-heading {
    color: var(--pale-aureate);
}

.fork-text {
    font-family: var(--font-body);
    font-weight: 400;
    color: var(--alabaster);
    line-height: 1.72;
    max-width: 48ch;
}

.fork-left .fork-text {
    margin-left: auto;
}

.fork-right .fork-text {
    margin-right: auto;
}

.fork-text-sm {
    font-family: var(--font-body);
    font-weight: 400;
    color: var(--alabaster);
    line-height: 1.6;
    font-size: 0.95rem;
    max-width: 40ch;
}

.fork-left .fork-text-sm {
    margin-left: auto;
}

.fork-right .fork-text-sm {
    margin-right: auto;
}

/* ============================
   SECTION: Contemplation Zones
   ============================ */
.contemplation {
    position: relative;
    background: var(--charcoal-veil);
    padding: clamp(60px, 10vw, 120px) 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.contemplation-text {
    max-width: 42ch;
    margin: 0 auto;
}

.contemplation-text h2 {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.8rem, 4vw, 3rem);
    letter-spacing: -0.02em;
    color: var(--alabaster);
    margin-bottom: 2rem;
}

.contemplation-text p {
    font-family: var(--font-body);
    font-weight: 400;
    color: var(--alabaster);
    line-height: 1.72;
    margin-bottom: 1.5rem;
}

.contemplation-text p em {
    color: var(--pale-aureate);
    font-style: italic;
}

.contemplation-text .aside {
    font-family: var(--font-body);
    font-weight: 300;
    color: var(--ash-lavender);
    font-size: 0.95rem;
    font-style: italic;
    margin-top: 2rem;
}

.contemplation-text .final-aside {
    font-family: var(--font-body);
    font-weight: 300;
    color: var(--ash-lavender);
}

/* Fork SVG Divider */
.fork-svg-divider {
    margin-bottom: 3rem;
}

.fork-svg-divider svg {
    overflow: visible;
}

.fork-path {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 2s ease;
}

.contemplation.visible .fork-path {
    stroke-dashoffset: 0;
}

/* Coin */
.coin {
    width: 32px;
    height: 32px;
    position: relative;
    margin: 0 auto 2rem;
    perspective: 200px;
}

.coin-face {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    backface-visibility: hidden;
    font-family: var(--font-mono);
    font-size: 0.5rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.coin-front {
    background: linear-gradient(135deg, var(--axis-gold), #d4a843);
    color: var(--obsidian);
}

.coin-back {
    background: linear-gradient(135deg, #d4a843, var(--axis-gold));
    color: var(--obsidian);
    transform: rotateY(180deg);
}

.coin {
    animation: coin-flip 6s linear infinite;
}

@keyframes coin-flip {
    0% { transform: rotateY(0deg); }
    100% { transform: rotateY(360deg); }
}

.final-coin .coin {
    animation: coin-flip 6s linear infinite;
}

.final-coin .coin.paused {
    animation-play-state: paused;
}

/* ============================
   SECTION: Interactive Doors
   ============================ */
.door-interactive {
    position: relative;
    width: 100px;
    height: 200px;
    margin-bottom: 2rem;
    perspective: 800px;
    cursor: pointer;
}

.fork-left .door-interactive {
    margin-left: auto;
}

.fork-right .door-interactive {
    margin-right: auto;
}

.door-interactive .door-inner {
    border-radius: 4px 4px 50px 50px / 4px 4px 16px 16px;
}

.door-left-2 .door-inner {
    background: linear-gradient(135deg, var(--cool-path), var(--charcoal-veil));
    transform: perspective(800px) rotateY(8deg);
    transform-origin: left center;
    border: 1px solid rgba(43, 58, 103, 0.5);
}

.door-right-2 .door-inner {
    background: linear-gradient(225deg, var(--warm-path), var(--charcoal-veil));
    transform: perspective(800px) rotateY(-8deg);
    transform-origin: right center;
    border: 1px solid rgba(168, 67, 45, 0.5);
}

.door-interactive:hover .door-left-2 .door-inner,
.door-left-2:hover .door-inner {
    transform: perspective(800px) rotateY(25deg);
}

.door-interactive:hover .door-right-2 .door-inner,
.door-right-2:hover .door-inner {
    transform: perspective(800px) rotateY(-25deg);
}

.door-reveal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--pale-aureate);
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: -1;
    text-shadow: 0 0 20px var(--axis-gold);
}

.door-interactive:hover .door-reveal {
    opacity: 1;
}

/* ============================
   SECTION: The Descent
   ============================ */
.descent {
    position: relative;
}

.fork-zone-rapid {
    min-height: 60vh;
    padding: 40px 0;
}

.fork-zone-rapid .fork-half {
    padding: clamp(20px, 4vw, 40px);
}

.descent .path-label {
    font-size: 0.85rem;
    color: var(--axis-gold);
    margin-bottom: 0.75rem;
}

/* ============================
   SECTION: The Resolution
   ============================ */
.resolution {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    overflow: hidden;
}

.resolution-content {
    position: relative;
    z-index: 10;
    text-align: center;
    max-width: 52ch;
}

.resolution-merge {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    pointer-events: none;
    z-index: 1;
}

.merge-left {
    flex: 1;
    background: linear-gradient(to right, rgba(43, 58, 103, 0.2), transparent);
    transition: background 1s ease;
}

.merge-right {
    flex: 1;
    background: linear-gradient(to left, rgba(168, 67, 45, 0.2), transparent);
    transition: background 1s ease;
}

.resolution.merging .merge-left {
    background: linear-gradient(to right, rgba(90, 61, 92, 0.3), rgba(90, 61, 92, 0.15));
}

.resolution.merging .merge-right {
    background: linear-gradient(to left, rgba(90, 61, 92, 0.3), rgba(90, 61, 92, 0.15));
}

.resolution-text {
    position: relative;
    z-index: 10;
}

.resolution-heading {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.8rem, 4vw, 3.5rem);
    letter-spacing: -0.02em;
    color: var(--pale-aureate);
    margin-bottom: 2rem;
    line-height: 1.3;
}

.resolution-text p {
    font-family: var(--font-body);
    font-weight: 400;
    color: var(--alabaster);
    line-height: 1.72;
    margin-bottom: 1.5rem;
}

.resolution-text .final-aside {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 400;
    color: var(--ash-lavender);
    font-size: 1.1rem;
    margin-top: 2rem;
}

.final-coin {
    margin-top: 3rem;
}

/* ============================
   Rubin's Vase Defs
   ============================ */
.rubin-defs {
    position: absolute;
    width: 0;
    height: 0;
}

/* ============================
   Rubin Divider Lines
   ============================ */
.fork-zone::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 10%;
    width: 80%;
    height: 40px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='40'%3E%3Cpath d='M0,0 Q15,10 10,20 Q5,30 15,40 M60,0 Q45,10 50,20 Q55,30 45,40' fill='none' stroke='%239a95b0' stroke-width='1' opacity='0.2'/%3E%3C/svg%3E") repeat-x;
    opacity: 0.5;
    pointer-events: none;
}

/* ============================
   Mobile Responsive
   ============================ */
@media (max-width: 768px) {
    .central-axis {
        display: none;
    }

    .fork-zone {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .fork-half {
        text-align: center;
        transform: none;
        padding: clamp(30px, 5vw, 60px) 20px;
    }

    .fork-left {
        background: linear-gradient(180deg, rgba(43, 58, 103, 0.15), transparent);
        border-bottom: 1px solid var(--axis-gold);
        box-shadow: 0 1px 8px rgba(232, 200, 112, 0.2);
        transform: translateY(-20px);
    }

    .fork-right {
        background: linear-gradient(0deg, rgba(168, 67, 45, 0.15), transparent);
        transform: translateY(20px);
    }

    .fork-zone.visible .fork-left {
        transform: translateY(0);
    }

    .fork-zone.visible .fork-right {
        transform: translateY(0);
    }

    .fork-left .fork-text,
    .fork-right .fork-text,
    .fork-left .fork-text-sm,
    .fork-right .fork-text-sm {
        margin-left: auto;
        margin-right: auto;
    }

    .fork-left .door-interactive,
    .fork-right .door-interactive {
        margin-left: auto;
        margin-right: auto;
    }

    .door {
        width: 80px;
        height: 160px;
    }

    .door-left {
        left: 5%;
    }

    .door-right {
        right: 5%;
    }

    .balance-scale {
        bottom: 12px;
        right: 12px;
        opacity: 0.2;
    }

    .fork-zone-rapid {
        min-height: auto;
        padding: 20px 0;
    }
}

/* ============================
   Selection / Highlight
   ============================ */
::selection {
    background: var(--pale-aureate);
    color: var(--obsidian);
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--obsidian);
}

::-webkit-scrollbar-thumb {
    background: var(--charcoal-veil);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--ash-lavender);
}
