/* ============================================================
   dilemma.quest — Surreal Bifurcation Theater
   ============================================================ */

/* --- CSS Custom Properties --- */
:root {
    /* Warm Side (Left / Option A) */
    --amber-glow: #D4A574;
    --deep-sienna: #8B5E3C;
    --cream-ground: #F5EDE3;

    /* Cool Side (Right / Option B) */
    --twilight-indigo: #3D4F7C;
    --steel-lavender: #8E92AA;
    --frost-ground: #E8EAF0;

    /* Shared Neutrals */
    --fracture-black: #1C1C24;
    --void-white: #FAFAFA;
    --tension-red: #C44536;

    /* Closing blend */
    --merge-neutral: #C4B89A;

    /* Typography */
    --font-display: 'Cormorant Garamond', Georgia, serif;
    --font-body: 'Libre Franklin', 'Helvetica Neue', sans-serif;
    --font-mono: 'Azeret Mono', 'Courier New', monospace;

    /* Sizing */
    --heading-size: clamp(2.8rem, 7vw, 5rem);
    --body-size: clamp(0.95rem, 1.15vw, 1.1rem);
    --label-size: 0.75rem;
}

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

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

body {
    font-family: var(--font-body);
    font-size: var(--body-size);
    font-weight: 300;
    line-height: 1.9;
    letter-spacing: 0.01em;
    color: var(--fracture-black);
    background-color: var(--void-white);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- SVG Filters (hidden) --- */
.svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* --- Grain Overlay --- */
.grain-overlay {
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
    transition: opacity 1.5s ease;
    background-image: 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.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
    background-repeat: repeat;
}

.grain-overlay.active {
    opacity: 1;
}

.grain-overlay.closing {
    opacity: 1;
}

/* --- Floating Geometric Shapes --- */
.floating-shapes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.shape {
    position: absolute;
    opacity: 0;
    transition: opacity 2s ease;
}

.shape.active {
    opacity: 1;
}

.shape-warm {
    opacity: 0.12;
}

.shape-cool {
    opacity: 0.12;
}

.shape-triangle-1 {
    width: 120px;
    height: 120px;
    top: 15%;
    left: 8%;
    background: var(--amber-glow);
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}

.shape-triangle-2 {
    width: 80px;
    height: 80px;
    top: 55%;
    left: 15%;
    background: var(--deep-sienna);
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
    transform: rotate(30deg);
}

.shape-circle-1 {
    width: 60px;
    height: 60px;
    top: 80%;
    left: 5%;
    background: var(--amber-glow);
    border-radius: 50%;
}

.shape-triangle-3 {
    width: 100px;
    height: 100px;
    top: 20%;
    right: 10%;
    background: var(--twilight-indigo);
    clip-path: polygon(50% 100%, 0% 0%, 100% 0%);
}

.shape-triangle-4 {
    width: 70px;
    height: 70px;
    top: 60%;
    right: 8%;
    background: var(--steel-lavender);
    clip-path: polygon(50% 100%, 0% 0%, 100% 0%);
    transform: rotate(-25deg);
}

.shape-circle-2 {
    width: 50px;
    height: 50px;
    top: 85%;
    right: 12%;
    background: var(--twilight-indigo);
    border-radius: 50%;
}

/* --- HERO SECTION --- */
.hero-section {
    position: relative;
    width: 100%;
    height: 100vh;
    min-height: 600px;
    overflow: hidden;
    display: flex;
    z-index: 2;
}

.hero-warm-side {
    position: absolute;
    top: 0;
    left: 0;
    width: 52%;
    height: 100%;
    background-color: var(--cream-ground);
    clip-path: polygon(0 0, 100% 0, 96% 100%, 0 100%);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    opacity: 0;
    transition: opacity 1s ease 1.5s;
    z-index: 3;
}

.hero-cool-side {
    position: absolute;
    top: 0;
    right: 0;
    width: 52%;
    height: 100%;
    background-color: var(--frost-ground);
    clip-path: polygon(4% 0, 100% 0, 100% 100%, 0% 100%);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    opacity: 0;
    transition: opacity 1s ease 1.5s;
    z-index: 3;
}

.hero-warm-side.revealed,
.hero-cool-side.revealed {
    opacity: 1;
}

.hero-title-half {
    padding: 0 2rem;
}

.hero-title {
    font-family: var(--font-display);
    font-size: var(--heading-size);
    font-style: italic;
    font-weight: 300;
    line-height: 1;
    letter-spacing: -0.02em;
}

.hero-title--warm .hero-title-main {
    color: var(--twilight-indigo);
}

.hero-title--cool .hero-title-main {
    color: var(--amber-glow);
}

/* Fracture Seam */
.fracture-seam {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 100%;
    z-index: 10;
    overflow: visible;
}

.seam-path {
    stroke: var(--fracture-black);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    stroke-dasharray: 2800;
    stroke-dashoffset: 2800;
    transition: stroke-width 0.6s ease;
}

.seam-path.drawing {
    animation: drawSeam 1.2s ease forwards;
}

@keyframes drawSeam {
    to {
        stroke-dashoffset: 0;
    }
}

/* Hero Subtitle */
.hero-subtitle {
    position: absolute;
    bottom: 18%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 11;
    opacity: 0;
    transition: opacity 0.8s ease 2.5s;
}

.hero-subtitle.revealed {
    opacity: 1;
}

.hero-quest {
    font-family: var(--font-mono);
    font-size: var(--label-size);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--fracture-black);
}

/* --- SPLIT SECTIONS --- */
.split-section {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 4px 1fr;
    min-height: 100vh;
    z-index: 2;
}

.split-warm {
    background-color: var(--cream-ground);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
}

.split-cool {
    background-color: var(--frost-ground);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
}

.split-content {
    max-width: 440px;
}

.split-seam {
    position: relative;
    display: flex;
    align-items: stretch;
}

.seam-line {
    width: 100%;
    height: 100%;
}

.seam-line path {
    stroke: var(--fracture-black);
    stroke-width: 2;
    fill: none;
}

.path-label {
    font-family: var(--font-mono);
    font-size: var(--label-size);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    display: block;
    margin-bottom: 1.5rem;
    opacity: 0.6;
}

.split-warm .path-label {
    color: var(--deep-sienna);
}

.split-cool .path-label {
    color: var(--twilight-indigo);
}

.split-heading {
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 3.5vw, 2.4rem);
    font-weight: 300;
    line-height: 1.3;
    margin-bottom: 1.5rem;
}

.split-heading--italic {
    font-style: italic;
}

.split-warm .split-heading {
    color: var(--deep-sienna);
}

.split-cool .split-heading {
    color: var(--twilight-indigo);
}

.split-body {
    margin-bottom: 2rem;
}

.split-body--warm {
    color: var(--deep-sienna);
}

.split-body--cool {
    color: var(--steel-lavender);
}

/* --- DILEMMA CARDS (Card Flip) --- */
.dilemma-card {
    perspective: 1000px;
    width: 100%;
    height: 200px;
    cursor: pointer;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 600ms ease-in-out;
    transform-style: preserve-3d;
}

.dilemma-card:hover .card-inner {
    transform: rotateY(180deg);
}

.card-front,
.card-back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 8px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.card-front {
    background-color: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.card-back {
    background-color: var(--fracture-black);
    color: var(--void-white);
    transform: rotateY(180deg);
}

.card-label {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 0.75rem;
    opacity: 0.7;
}

.card-back .card-label {
    color: var(--tension-red);
    opacity: 1;
}

.card-text {
    font-family: var(--font-display);
    font-size: clamp(1rem, 1.5vw, 1.2rem);
    font-weight: 300;
    font-style: italic;
    line-height: 1.6;
}

/* --- UNIFIED SECTIONS --- */
.unified-section {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
    padding: 6rem 2rem;
    background-color: var(--void-white);
    z-index: 2;
}

.unified-content {
    max-width: 72ch;
    text-align: center;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

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

.unified-heading {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 4vw, 3rem);
    font-weight: 600;
    font-style: italic;
    line-height: 1.3;
    color: var(--fracture-black);
    margin-bottom: 2rem;
}

.unified-body {
    font-weight: 300;
    line-height: 2;
    color: var(--fracture-black);
    opacity: 0.8;
}

/* --- CHOICE MOMENTS --- */
.choice-moment {
    position: relative;
    height: 100vh;
    min-height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    z-index: 2;
}

.choice-warm-curtain {
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    background-color: var(--cream-ground);
    transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 1;
}

.choice-cool-curtain {
    position: absolute;
    top: 0;
    right: 0;
    width: 50%;
    height: 100%;
    background-color: var(--frost-ground);
    transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 1;
}

.choice-moment.opened .choice-warm-curtain {
    transform: translateX(-15%);
}

.choice-moment.opened .choice-cool-curtain {
    transform: translateX(15%);
}

.decision-node {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 2px solid var(--tension-red);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    animation: nodePulse 3s ease-in-out infinite;
    box-shadow: 0 0 30px rgba(196, 69, 54, 0.2);
}

.node-number {
    font-family: var(--font-mono);
    font-size: 1.2rem;
    letter-spacing: 0.1em;
    color: var(--tension-red);
}

@keyframes nodePulse {
    0%, 100% {
        transform: scale(1.0);
    }
    50% {
        transform: scale(1.03);
    }
}

.choice-question {
    position: absolute;
    bottom: 20%;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 5;
    width: 80%;
    max-width: 600px;
    opacity: 0;
    transition: opacity 0.6s ease 0.4s;
}

.choice-moment.opened .choice-question {
    opacity: 1;
}

.choice-heading {
    font-family: var(--font-display);
    font-size: clamp(1.4rem, 3vw, 2.2rem);
    font-weight: 300;
    font-style: italic;
    color: var(--fracture-black);
    line-height: 1.4;
}

/* --- CLOSING SECTION --- */
.closing-section {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 6rem 2rem;
    background-color: var(--merge-neutral);
    z-index: 2;
    transition: background-color 2s ease;
}

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

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

.closing-heading {
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 600;
    line-height: 1.2;
    color: var(--fracture-black);
    margin-bottom: 2rem;
}

.closing-body {
    font-weight: 300;
    line-height: 2;
    color: var(--fracture-black);
    opacity: 0.75;
}

/* --- TORN PAPER EDGES between sections --- */
.split-section + .unified-section {
    clip-path: polygon(
        0% 3%, 8% 1%, 15% 4%, 23% 0%, 31% 3%, 40% 1%, 48% 4%, 55% 0%, 63% 3%, 72% 1%, 80% 4%, 88% 0%, 95% 3%, 100% 1%,
        100% 100%, 0% 100%
    );
    margin-top: -2px;
}

.unified-section + .choice-moment {
    clip-path: polygon(
        0% 2%, 6% 0%, 14% 3%, 22% 1%, 30% 4%, 38% 0%, 47% 3%, 55% 1%, 64% 4%, 72% 0%, 80% 3%, 89% 1%, 96% 3%, 100% 0%,
        100% 100%, 0% 100%
    );
    margin-top: -2px;
}

.choice-moment + .split-section {
    clip-path: polygon(
        0% 4%, 7% 1%, 16% 3%, 24% 0%, 32% 4%, 41% 1%, 49% 3%, 58% 0%, 66% 4%, 74% 1%, 83% 3%, 91% 0%, 97% 3%, 100% 1%,
        100% 100%, 0% 100%
    );
    margin-top: -2px;
}

.choice-moment + .unified-section {
    clip-path: polygon(
        0% 3%, 9% 0%, 17% 4%, 25% 1%, 33% 3%, 42% 0%, 50% 4%, 59% 1%, 67% 3%, 76% 0%, 84% 4%, 92% 1%, 98% 3%, 100% 0%,
        100% 100%, 0% 100%
    );
    margin-top: -2px;
}

.unified-section + .closing-section {
    clip-path: polygon(
        0% 2%, 5% 0%, 13% 3%, 21% 1%, 29% 4%, 37% 0%, 46% 3%, 54% 1%, 63% 4%, 71% 0%, 79% 3%, 88% 1%, 95% 3%, 100% 0%,
        100% 100%, 0% 100%
    );
    margin-top: -2px;
}

/* --- SCROLL-DRIVEN SEAM WIDTH ANIMATION --- */
.fracture-seam.widened .seam-path {
    stroke-width: 6;
}

.fracture-seam.narrow .seam-path {
    stroke-width: 1;
}

/* --- prefers-reduced-motion --- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .grain-overlay {
        opacity: 0.04;
        transition: none;
    }

    .unified-content,
    .closing-content {
        opacity: 1;
        transform: none;
    }

    .hero-warm-side,
    .hero-cool-side,
    .hero-subtitle {
        opacity: 1;
        transition: none;
    }

    .seam-path {
        stroke-dashoffset: 0;
    }
}

/* --- MOBILE LAYOUT --- */
@media (max-width: 768px) {
    .hero-section {
        flex-direction: column;
    }

    .hero-warm-side {
        width: 100%;
        height: 52%;
        clip-path: polygon(0 0, 100% 0, 100% 96%, 0 100%);
        justify-content: center;
    }

    .hero-cool-side {
        width: 100%;
        height: 52%;
        clip-path: polygon(0 4%, 100% 0, 100% 100%, 0 100%);
        justify-content: center;
        top: auto;
        bottom: 0;
        right: auto;
    }

    .fracture-seam {
        top: 50%;
        left: 0;
        transform: translateY(-50%) rotate(90deg);
        width: 100vh;
        height: 20px;
        transform-origin: center center;
    }

    .hero-subtitle {
        bottom: auto;
        top: 50%;
        transform: translate(-50%, -50%);
    }

    .split-section {
        grid-template-columns: 1fr;
        grid-template-rows: auto 4px auto;
    }

    .split-seam {
        height: 4px;
    }

    .seam-line {
        width: 100%;
        height: 4px;
    }

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

    .dilemma-card {
        height: 180px;
    }

    .choice-moment.opened .choice-warm-curtain {
        transform: translateY(-15%);
    }

    .choice-moment.opened .choice-cool-curtain {
        transform: translateY(15%);
    }

    .choice-warm-curtain {
        width: 100%;
        height: 50%;
        transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    }

    .choice-cool-curtain {
        width: 100%;
        height: 50%;
        top: 50%;
        right: auto;
        transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    }

    .floating-shapes {
        display: none;
    }
}
