/* ============================================
   dilemma.quest — Styles
   Colors: #1b1464, #8b2500, #f5f0e8, #c9a227, #2d2d3a, #e8e6f0
   Fonts: Cormorant Garamond, Source Code Pro, Cinzel
   ============================================ */

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background-color: #2d2d3a;
    color: #f5f0e8;
    font-family: 'Cormorant Garamond', Georgia, serif;
    line-height: 1.6;
    overflow-x: hidden;
}

/* --- Typography Classes --- */
.mono-font {
    font-family: 'Source Code Pro', 'Courier New', monospace;
    font-weight: 400;
    font-size: 0.9rem;
}

.accent-font {
    font-family: 'Cinzel', 'Times New Roman', serif;
    font-weight: 700;
    letter-spacing: 0.3em;
    text-transform: uppercase;
}

/* --- Balance Scale Navigation --- */
#scale-nav {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    padding: 16px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.scale-container {
    perspective: 800px;
}

.scale-beam {
    position: relative;
    width: 160px;
    height: 50px;
}

.scale-pivot {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 8px;
    background: #c9a227;
    border-radius: 50%;
    box-shadow: 0 0 12px #c9a227;
}

.scale-arm {
    position: absolute;
    top: 8px;
    left: 0;
    right: 0;
    height: 2px;
    background: #c9a227;
    transform-origin: center top;
    transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.scale-pan {
    position: relative;
    top: 2px;
    width: 40px;
    height: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scale-pan::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 16px;
    border: 1px solid #e8e6f0;
    border-top: none;
    border-radius: 0 0 6px 6px;
    opacity: 0.6;
    transition: opacity 0.3s;
}

.scale-pan:hover::after {
    opacity: 1;
}

.scale-label {
    font-family: 'Source Code Pro', monospace;
    font-size: 0.55rem;
    color: #e8e6f0;
    opacity: 0;
    transition: opacity 0.3s;
    white-space: nowrap;
    position: absolute;
    top: 22px;
}

.scale-pan:hover .scale-label {
    opacity: 0.8;
}

.scale-beam:hover .scale-arm {
    transform: rotateZ(0deg);
}

.scale-pan-left:hover ~ .scale-pan-right,
.scale-beam:has(.scale-pan-left:hover) .scale-arm {
    transform: rotateY(-15deg) rotateZ(-5deg);
}

.scale-beam:has(.scale-pan-right:hover) .scale-arm {
    transform: rotateY(15deg) rotateZ(5deg);
}

.section-indicators {
    display: flex;
    gap: 8px;
    align-items: center;
}

.section-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #e8e6f0;
    opacity: 0.3;
    transition: all 0.4s;
    cursor: pointer;
}

.section-dot.active {
    opacity: 1;
    background: #c9a227;
    box-shadow: 0 0 8px #c9a227;
    transform: scale(1.4);
}

/* --- Fissure SVG --- */
#fissure-svg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 50;
    pointer-events: none;
}

#fissure-path {
    stroke-dasharray: 10000;
    stroke-dashoffset: 10000;
    transition: stroke-dashoffset 0.05s linear;
}

#fissure-glow {
    stroke-dasharray: 10000;
    stroke-dashoffset: 10000;
    transition: stroke-dashoffset 0.05s linear;
    animation: fissure-pulse 3s ease-in-out infinite;
}

@keyframes fissure-pulse {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 0.5; }
}

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

/* --- Split Grid --- */
.split-grid {
    display: grid;
    grid-template-columns: var(--split-left, 1fr) var(--split-right, 1fr);
    width: 100%;
    min-height: 100vh;
    transition: grid-template-columns 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}

.split-left,
.split-right {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 40px;
    overflow: hidden;
}

.split-left {
    background: var(--panel-color, #1b1464);
}

.split-right {
    background: var(--panel-color, #8b2500);
}

.split-left::after,
.split-right::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40px;
    pointer-events: none;
}

.split-left::after {
    right: 0;
    background: linear-gradient(to right, transparent, rgba(201, 162, 39, 0.1));
}

.split-right::after {
    left: 0;
    background: linear-gradient(to left, transparent, rgba(201, 162, 39, 0.1));
}

/* Diagonal collision effect */
.split-left {
    clip-path: polygon(0 0, 100% 0, calc(100% - 3vw) 100%, 0 100%);
}

.split-right {
    clip-path: polygon(3vw 0, 100% 0, 100% 100%, 0 100%);
    margin-left: -3vw;
}

.panel-content {
    max-width: 480px;
    position: relative;
    z-index: 2;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.panel-content.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Chess Pieces --- */
.chess-piece {
    width: 60px;
    height: 60px;
    margin-bottom: 20px;
    opacity: 0.15;
}

.chess-king {
    clip-path: polygon(50% 0%, 40% 15%, 30% 15%, 30% 25%, 40% 25%, 35% 50%, 20% 85%, 20% 100%, 80% 100%, 80% 85%, 65% 50%, 60% 25%, 70% 25%, 70% 15%, 60% 15%);
    background: #e8e6f0;
}

.chess-queen {
    clip-path: polygon(50% 0%, 35% 20%, 15% 5%, 25% 35%, 5% 25%, 25% 50%, 20% 85%, 20% 100%, 80% 100%, 80% 85%, 75% 50%, 95% 25%, 75% 35%, 85% 5%, 65% 20%);
    background: #e8e6f0;
}

.chess-knight {
    clip-path: polygon(30% 100%, 70% 100%, 70% 85%, 65% 60%, 75% 45%, 70% 25%, 55% 10%, 50% 0%, 35% 5%, 25% 20%, 30% 40%, 25% 55%, 35% 60%, 30% 85%);
    background: #e8e6f0;
}

.chess-bishop {
    clip-path: polygon(50% 0%, 45% 10%, 40% 10%, 42% 20%, 35% 50%, 25% 85%, 25% 100%, 75% 100%, 75% 85%, 65% 50%, 58% 20%, 60% 10%, 55% 10%);
    background: #e8e6f0;
}

/* --- Section Label --- */
.section-label {
    font-size: 0.7rem;
    color: #c9a227;
    margin-bottom: 12px;
    text-shadow: 1px 1px 2px rgba(201, 162, 39, 0.3);
}

/* --- Dilemma Headings --- */
.dilemma-heading {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: clamp(2rem, 5vw, 4.5rem);
    font-weight: 600;
    color: #f5f0e8;
    line-height: 1.1;
    margin-bottom: 20px;
    text-shadow: 1px 1px 0 rgba(201, 162, 39, 0.4);
}

/* --- Dilemma Text --- */
.dilemma-text {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.15rem;
    color: #e8e6f0;
    margin-bottom: 30px;
    line-height: 1.7;
}

/* --- Consequence Block --- */
.consequence-block {
    border-top: 1px solid rgba(201, 162, 39, 0.3);
    padding-top: 20px;
    margin-top: 10px;
}

.consequence-label {
    font-size: 0.6rem;
    color: #c9a227;
    display: block;
    margin-bottom: 10px;
}

.consequence-text {
    color: #e8e6f0;
    opacity: 0.8;
    line-height: 1.6;
}

/* --- Ghost Text (hero) --- */
.ghost-text {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.3rem;
    font-style: italic;
    color: #e8e6f0;
    opacity: 0.5;
    text-align: center;
}

/* --- Hero Section --- */
#hero .split-grid {
    position: absolute;
    inset: 0;
    z-index: 1;
}

#hero .panel-content {
    opacity: 0.6;
    transform: none;
}

.hero-title-wrapper {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
    pointer-events: none;
}

.hero-title {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: clamp(3rem, 10vw, 8rem);
    font-weight: 700;
    color: #f5f0e8;
    text-shadow: 2px 2px 0 rgba(201, 162, 39, 0.5);
    display: flex;
    align-items: center;
    gap: 0;
    letter-spacing: 0.05em;
}

.title-crack {
    display: inline-block;
    width: 4px;
    height: 1em;
    background: #c9a227;
    box-shadow: 0 0 20px #c9a227, 0 0 40px rgba(201, 162, 39, 0.3);
    animation: crack-pulse 2s ease-in-out infinite;
    margin: 0 2px;
}

@keyframes crack-pulse {
    0%, 100% {
        box-shadow: 0 0 20px #c9a227, 0 0 40px rgba(201, 162, 39, 0.3);
        opacity: 1;
    }
    50% {
        box-shadow: 0 0 30px #c9a227, 0 0 60px rgba(201, 162, 39, 0.5);
        opacity: 0.7;
    }
}

.hero-subtitle {
    font-size: clamp(1rem, 3vw, 2rem);
    color: #c9a227;
    margin-top: 8px;
}

.hero-tagline {
    font-family: 'Source Code Pro', monospace;
    font-size: 0.9rem;
    color: #e8e6f0;
    opacity: 0.6;
    margin-top: 16px;
}

/* --- Scroll Indicator --- */
.scroll-indicator {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-10px); }
}

.scroll-text {
    font-size: 0.65rem;
    letter-spacing: 0.2em;
    color: #e8e6f0;
    opacity: 0.5;
}

/* --- Hourglass --- */
.hourglass {
    width: 30px;
    height: 50px;
    position: relative;
}

.hourglass-large {
    width: 50px;
    height: 80px;
    margin-top: 40px;
}

.hourglass-top,
.hourglass-bottom {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    border: 1.5px solid #c9a227;
}

.hourglass-top {
    top: 0;
    width: 100%;
    height: 45%;
    clip-path: polygon(0 0, 100% 0, 60% 100%, 40% 100%);
    border-radius: 2px 2px 0 0;
}

.hourglass-bottom {
    bottom: 0;
    width: 100%;
    height: 45%;
    clip-path: polygon(40% 0, 60% 0, 100% 100%, 0 100%);
    border-radius: 0 0 2px 2px;
}

.sand-particles {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 20%;
}

.sand-grain {
    position: absolute;
    width: 2px;
    height: 2px;
    background: #c9a227;
    border-radius: 50%;
    animation: sand-fall 1.5s linear infinite;
}

.sand-grain:nth-child(1) { left: 0; animation-delay: 0s; }
.sand-grain:nth-child(2) { left: 1px; animation-delay: 0.3s; }
.sand-grain:nth-child(3) { left: -1px; animation-delay: 0.6s; }
.sand-grain:nth-child(4) { left: 0; animation-delay: 0.9s; }
.sand-grain:nth-child(5) { left: 1px; animation-delay: 1.2s; }
.sand-grain:nth-child(6) { left: -1px; animation-delay: 0.15s; }
.sand-grain:nth-child(7) { left: 0; animation-delay: 0.45s; }

@keyframes sand-fall {
    0% {
        transform: translateY(0);
        opacity: 1;
    }
    100% {
        transform: translateY(30px);
        opacity: 0;
    }
}

/* --- Balance Scale Divider --- */
.balance-divider {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 20px 0;
    background: #2d2d3a;
}

.balance-scale {
    width: 120px;
    height: auto;
    opacity: 0.6;
    transition: transform 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}

.balance-divider.tilted-left .balance-scale {
    transform: rotate(-8deg);
}

.balance-divider.tilted-right .balance-scale {
    transform: rotate(8deg);
}

/* --- Timeline Vertical --- */
.timeline-vertical {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    padding: 40px 20px 60px;
    position: relative;
    background: #2d2d3a;
}

.timeline-vertical::before {
    content: '';
    position: absolute;
    left: 20px;
    top: 40px;
    bottom: 60px;
    width: 1px;
    background: linear-gradient(to bottom, #c9a227, transparent);
}

.timeline-node {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding: 16px 0;
    padding-left: 10px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.timeline-node.visible {
    opacity: 1;
    transform: translateY(0);
}

.timeline-dot {
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #c9a227;
    margin-top: 6px;
    box-shadow: 0 0 8px rgba(201, 162, 39, 0.5);
}

.timeline-text {
    color: #e8e6f0;
    opacity: 0.7;
    font-size: 0.85rem;
    line-height: 1.5;
}

/* --- Closing Section --- */
.closing-section {
    background: #2d2d3a;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.closing-content {
    text-align: center;
    max-width: 600px;
    padding: 60px 20px;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 1s ease, transform 1s ease;
}

.closing-content.visible {
    opacity: 1;
    transform: translateY(0);
}

.branching-tree {
    margin-bottom: 40px;
}

.tree-svg {
    width: 300px;
    height: auto;
    opacity: 0.6;
}

.tree-svg line {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    transition: stroke-dashoffset 1.5s ease;
}

.closing-content.visible .tree-svg line {
    stroke-dashoffset: 0;
}

.tree-svg circle {
    opacity: 0;
    transition: opacity 1s ease 1s;
}

.closing-content.visible .tree-svg circle {
    opacity: 1;
}

.closing-heading {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 600;
    color: #f5f0e8;
    text-shadow: 1px 1px 0 rgba(201, 162, 39, 0.4);
    margin-bottom: 16px;
}

.closing-subtext {
    font-family: 'Source Code Pro', monospace;
    font-size: 1rem;
    color: #e8e6f0;
    opacity: 0.6;
    margin-bottom: 40px;
}

.closing-domain {
    font-size: 1.2rem;
    color: #c9a227;
    letter-spacing: 0.4em;
}

/* --- Animations for section entry --- */
.dilemma-section .split-left .panel-content {
    transition-delay: 0.2s;
}

.dilemma-section .split-right .panel-content {
    transition-delay: 0.4s;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .split-grid {
        grid-template-columns: 1fr !important;
        grid-template-rows: auto auto;
    }

    .split-left,
    .split-right {
        clip-path: none;
        margin-left: 0;
        padding: 60px 24px;
        min-height: 50vh;
    }

    .dilemma-heading {
        font-size: clamp(1.8rem, 6vw, 3rem);
    }

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

    #fissure-svg {
        display: none;
    }

    .timeline-vertical {
        padding: 30px 16px 40px;
    }

    .panel-content {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .split-left,
    .split-right {
        padding: 40px 16px;
    }

    #scale-nav {
        padding: 10px 16px;
    }

    .scale-beam {
        width: 120px;
    }
}
