/* mosoon.xyz - Contradiction (矛盾) Split-Screen Narrative */
/* Victorian Ornate vs Geometric Minimalism */

:root {
    /* Left Panel - Warm/Victorian */
    --left-primary: #c4613a;
    --left-secondary: #e8a84c;
    --left-bg: #f5ebe0;
    --left-text: #3d1f12;
    --left-accent: #8b4c2a;
    --left-hover: #d97a4a;

    /* Right Panel - Cool/Geometric */
    --right-primary: #5a6e7f;
    --right-secondary: #8fa3b2;
    --right-bg: #e8edf1;
    --right-text: #1e2a35;
    --right-accent: #3a4f62;
    --right-hover: #7090a5;

    /* Synthesis */
    --syn-primary: #a0725a;
    --syn-secondary: #d4b896;
    --syn-dark: #2d3330;

    /* Layout */
    --left-ratio: 50%;
    --right-ratio: 50%;
    --divider-x: 50%;
}

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

html {
    scroll-behavior: smooth;
}

body {
    overflow-x: hidden;
    background: #f5ebe0;
    min-height: 500vh;
}

/* ============================================
   CHAPTER INDICATOR
   ============================================ */
#chapter-indicator {
    position: fixed;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.indicator-track {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 3px;
}

.indicator-segment {
    width: 3px;
    height: 40px;
    background: rgba(90, 110, 127, 0.2);
    transition: background 0.5s ease, border-radius 0.5s ease;
}

.indicator-segment.active {
    background: var(--left-primary);
}

.seg-1, .seg-3, .seg-5 {
    border-radius: 3px;
}

.seg-2, .seg-4 {
    border-radius: 0;
}

.indicator-segment.active.seg-1,
.indicator-segment.active.seg-3,
.indicator-segment.active.seg-5 {
    background: var(--left-primary);
    border-radius: 3px;
}

.indicator-segment.active.seg-2,
.indicator-segment.active.seg-4 {
    background: var(--right-accent);
    border-radius: 0;
}

.indicator-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    color: var(--right-accent);
    writing-mode: vertical-rl;
    text-orientation: mixed;
    margin-top: 8px;
}

/* ============================================
   WAVE BACKGROUNDS
   ============================================ */
#wave-bg-left,
#wave-bg-right {
    position: fixed;
    top: 0;
    width: 50%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

#wave-bg-left {
    left: 0;
}

#wave-bg-right {
    right: 0;
}

#wave-bg-left svg,
#wave-bg-right svg {
    width: 100%;
    height: 100%;
}

/* ============================================
   SPLIT CONTAINER
   ============================================ */
#split-container {
    position: relative;
    width: 100%;
}

/* ============================================
   MORPH DIVIDER
   ============================================ */
#morph-divider {
    position: fixed;
    top: 0;
    left: var(--divider-x);
    width: 2px;
    height: 100vh;
    background: linear-gradient(to bottom, var(--left-primary), var(--right-primary));
    z-index: 50;
    transform: translateX(-50%);
    transition: opacity 0.8s ease;
}

#morph-divider::before {
    content: '';
    position: absolute;
    top: 0;
    left: -4px;
    width: 10px;
    height: 100%;
    background: linear-gradient(to bottom,
        transparent 0%,
        rgba(196, 97, 58, 0.15) 25%,
        rgba(90, 110, 127, 0.15) 75%,
        transparent 100%
    );
    filter: blur(4px);
}

/* ============================================
   CHAPTERS - SHARED
   ============================================ */
.chapter {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: grid;
    grid-template-columns: var(--left-ratio) var(--right-ratio);
}

.panel {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
}

.panel-left {
    background: var(--left-bg);
}

.panel-right {
    background: var(--right-bg);
}

.panel-content {
    position: relative;
    z-index: 2;
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100vh;
}

/* ============================================
   LEFT PANEL - VICTORIAN TYPOGRAPHY
   ============================================ */
.victorian-heading {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
    font-size: clamp(2.5rem, 6vw, 5rem);
    letter-spacing: 0.04em;
    line-height: 1.05;
    color: var(--left-text);
    margin-bottom: 1.5rem;
}

.ch1-title {
    font-size: clamp(5rem, 15vw, 12rem);
    text-align: center;
    color: var(--left-primary);
}

.victorian-body {
    font-family: 'Lora', serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.25rem);
    line-height: 1.72;
    color: var(--left-text);
    text-indent: 2em;
    margin-bottom: 1rem;
    max-width: 40ch;
}

.victorian-body em {
    font-style: italic;
}

.dropcap {
    float: left;
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
    font-size: 3.5rem;
    line-height: 0.8;
    margin-right: 0.1em;
    margin-top: 0.1em;
    color: var(--left-primary);
}

/* ============================================
   RIGHT PANEL - GEOMETRIC TYPOGRAPHY
   ============================================ */
.geometric-heading {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(2.5rem, 6vw, 5rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    line-height: 1.05;
    color: var(--right-text);
    margin-bottom: 1.5rem;
}

.ch1-title-right {
    font-size: clamp(5rem, 15vw, 12rem);
    text-align: center;
    color: var(--right-primary);
}

.geometric-body {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.6vw, 1.15rem);
    line-height: 1.6;
    color: var(--right-text);
    max-width: 40ch;
}

/* ============================================
   GEOMETRIC GRID
   ============================================ */
.geo-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: var(--right-accent);
    border: 1px solid var(--right-accent);
    margin-top: 1.5rem;
}

.geo-cell {
    background: var(--right-bg);
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.geo-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    color: var(--right-secondary);
    text-transform: uppercase;
}

.geo-value {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 300;
    font-size: 1.1rem;
    letter-spacing: 0.04em;
    color: var(--right-text);
}

.geo-desc {
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--right-primary);
}

/* ============================================
   3D ORNAMENTS - CSS SCULPTURES
   ============================================ */
.ornament-3d {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 2rem;
    perspective: 800px;
    transform-style: preserve-3d;
}

.ornament-layer {
    position: absolute;
    border-radius: 50%;
    border: 2px solid var(--left-primary);
}

/* Acanthus ornament - Chapter 1 */
.ornament-acanthus {
    width: 140px;
    height: 140px;
    animation: ornamentRotate 20s linear infinite;
}

.ornament-acanthus .o-l1 {
    width: 100%;
    height: 100%;
    border-color: var(--left-primary);
    border-width: 3px;
    box-shadow:
        0 0 0 3px rgba(196, 97, 58, 0.1),
        0 4px 8px rgba(61, 31, 18, 0.15),
        inset 0 0 20px rgba(196, 97, 58, 0.08);
    transform: rotateY(0deg);
}

.ornament-acanthus .o-l2 {
    width: 80%;
    height: 80%;
    top: 10%;
    left: 10%;
    border-color: var(--left-secondary);
    transform: rotateY(45deg) rotateX(10deg);
    box-shadow: 0 2px 6px rgba(61, 31, 18, 0.1);
}

.ornament-acanthus .o-l3 {
    width: 60%;
    height: 60%;
    top: 20%;
    left: 20%;
    border-color: var(--left-accent);
    transform: rotateY(90deg) rotateX(20deg);
    box-shadow: 0 2px 4px rgba(61, 31, 18, 0.08);
}

.ornament-acanthus .o-l4 {
    width: 30%;
    height: 30%;
    top: 35%;
    left: 35%;
    background: radial-gradient(circle, var(--left-primary) 30%, transparent 70%);
    border: none;
    transform: rotateY(135deg);
}

/* Rosette ornament - Chapter 2 */
.ornament-rosette {
    width: 100px;
    height: 100px;
    animation: ornamentRotate 25s linear infinite reverse;
}

.ornament-rosette .o-r1 {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid var(--left-primary);
    box-shadow:
        0 0 0 6px rgba(196, 97, 58, 0.05),
        0 0 0 12px rgba(196, 97, 58, 0.03),
        0 4px 12px rgba(61, 31, 18, 0.12);
    transform: rotateX(30deg);
}

.ornament-rosette .o-r2 {
    width: 70%;
    height: 70%;
    top: 15%;
    left: 15%;
    border-radius: 50%;
    border: 2px solid var(--left-secondary);
    transform: rotateX(30deg) rotateY(60deg);
}

.ornament-rosette .o-r3 {
    width: 35%;
    height: 35%;
    top: 32.5%;
    left: 32.5%;
    border-radius: 50%;
    background: var(--left-primary);
    opacity: 0.3;
    transform: rotateX(30deg) rotateY(120deg);
    border: none;
}

/* Scroll ornament - Chapter 3 */
.ornament-scroll {
    width: 90px;
    height: 90px;
    animation: ornamentRotate 18s linear infinite;
}

.ornament-scroll .o-sc1 {
    width: 100%;
    height: 100%;
    border: 2px solid var(--left-primary);
    border-radius: 8px 50% 8px 50%;
    transform: rotateY(20deg);
    box-shadow: 0 3px 10px rgba(61, 31, 18, 0.15);
}

.ornament-scroll .o-sc2 {
    width: 75%;
    height: 75%;
    top: 12.5%;
    left: 12.5%;
    border: 1.5px solid var(--left-accent);
    border-radius: 50% 8px 50% 8px;
    transform: rotateY(40deg) rotateX(15deg);
}

.ornament-scroll .o-sc3 {
    width: 40%;
    height: 40%;
    top: 30%;
    left: 30%;
    background: var(--left-secondary);
    border-radius: 50%;
    opacity: 0.2;
    border: none;
    transform: rotateY(60deg);
}

/* Collision ornament - Chapter 4 */
.ornament-collision {
    width: 80px;
    height: 80px;
    animation: ornamentChaos 4s ease-in-out infinite;
}

.ornament-collision .o-c1 {
    width: 100%;
    height: 100%;
    border: 3px solid var(--left-primary);
    border-radius: 50%;
    box-shadow: 0 0 20px rgba(196, 97, 58, 0.3);
    transform: rotateX(45deg) rotateZ(45deg);
}

.ornament-collision .o-c2 {
    width: 100%;
    height: 100%;
    border: 2px solid var(--right-accent);
    border-radius: 0;
    transform: rotateX(45deg) rotateZ(0deg);
}

.ornament-collision .o-c3 {
    width: 60%;
    height: 60%;
    top: 20%;
    left: 20%;
    background: linear-gradient(135deg, var(--left-primary), var(--right-primary));
    opacity: 0.2;
    border-radius: 50% 0 50% 0;
    border: none;
}

/* Synthesis ornament - Chapter 5 */
.ornament-synthesis {
    width: 100px;
    height: 100px;
    animation: ornamentRotate 30s linear infinite;
}

.ornament-synthesis .o-syn1 {
    width: 100%;
    height: 100%;
    border: 2px solid var(--syn-primary);
    border-radius: 50%;
    box-shadow:
        0 0 0 4px rgba(160, 114, 90, 0.08),
        0 4px 12px rgba(45, 51, 48, 0.1);
    transform: rotateX(20deg);
}

.ornament-synthesis .o-syn2 {
    width: 60%;
    height: 60%;
    top: 20%;
    left: 20%;
    border: 1.5px solid var(--syn-secondary);
    border-radius: 4px;
    transform: rotateX(20deg) rotateY(45deg);
}

@keyframes ornamentRotate {
    from { transform: rotateY(0deg); }
    to { transform: rotateY(360deg); }
}

@keyframes ornamentChaos {
    0%, 100% { transform: rotateY(0deg) rotateX(0deg) scale(1); }
    25% { transform: rotateY(90deg) rotateX(45deg) scale(1.1); }
    50% { transform: rotateY(180deg) rotateX(0deg) scale(0.9); }
    75% { transform: rotateY(270deg) rotateX(-45deg) scale(1.05); }
}

/* ============================================
   WIREFRAMES
   ============================================ */
.wireframe-container {
    width: 200px;
    height: 200px;
    margin: 0 auto 2rem;
    opacity: 0.6;
}

.wireframe-svg {
    width: 100%;
    height: 100%;
}

.wire-shape,
.wire-line {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 2s ease-out;
    opacity: 0.5;
}

.wire-shape.drawn,
.wire-line.drawn {
    stroke-dashoffset: 0;
}

.wireframe-aggressive {
    width: 250px;
    height: 250px;
    opacity: 0.8;
}

.wireframe-synthesis {
    width: 150px;
    height: 150px;
    margin: 2rem auto;
}

/* ============================================
   INTRUSIONS
   ============================================ */
.intrusion {
    position: absolute;
    z-index: 10;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.left-intrusion {
    right: 5%;
    top: 30%;
}

.right-intrusion {
    left: 5%;
    top: 20%;
}

.intrusion.visible {
    opacity: 1;
}

.ornament-small {
    width: 50px;
    height: 50px;
}

.ornament-small .o-s1 {
    width: 100%;
    height: 100%;
    border: 1.5px solid var(--left-primary);
    border-radius: 50%;
    animation: ornamentRotate 15s linear infinite;
}

.ornament-small .o-s2 {
    width: 60%;
    height: 60%;
    top: 20%;
    left: 20%;
    border: 1px solid var(--left-secondary);
    border-radius: 50%;
    animation: ornamentRotate 10s linear infinite reverse;
}

.intrusion-orn-1 {
    margin-bottom: 30px;
}

.geo-intrusion-svg {
    width: 200px;
    height: 400px;
    opacity: 0.4;
}

.geo-cut,
.geo-cut-line {
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    transition: stroke-dashoffset 1.5s ease;
}

.right-intrusion.visible .geo-cut,
.right-intrusion.visible .geo-cut-line {
    stroke-dashoffset: 0;
}

/* ============================================
   CHAPTER 4 - COLLISION ZONE
   ============================================ */
.chapter-4 {
    position: relative;
}

.collision-zone {
    position: absolute;
    top: 0;
    left: 30%;
    width: 40%;
    height: 100%;
    z-index: 20;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    opacity: 0;
    transition: opacity 0.8s ease;
    background: linear-gradient(
        135deg,
        rgba(245, 235, 224, 0.7) 0%,
        rgba(232, 237, 241, 0.7) 100%
    );
    backdrop-filter: blur(8px);
}

.collision-zone.visible {
    opacity: 1;
}

.collision-heading {
    font-size: clamp(1.5rem, 4vw, 3rem);
    line-height: 1.2;
    text-align: center;
    margin-bottom: 2rem;
}

.word-victorian {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
    color: var(--left-primary);
    font-style: italic;
}

.word-geometric {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 300;
    letter-spacing: 0.12em;
    color: var(--right-accent);
}

.collision-fragments {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    max-width: 36ch;
}

.fragment {
    font-family: 'Lora', serif;
    font-size: clamp(0.9rem, 1.5vw, 1.1rem);
    line-height: 1.6;
    color: var(--syn-dark);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
    text-align: center;
}

.fragment.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   CHAPTER 5 - SYNTHESIS
   ============================================ */
.chapter-5 {
    display: block;
}

.synthesis-panel {
    min-height: 100vh;
    background: linear-gradient(
        180deg,
        var(--left-bg) 0%,
        #f0e6da 20%,
        #e8e0d8 50%,
        #e2e4e4 80%,
        var(--right-bg) 100%
    );
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 4rem 2rem;
}

.synthesis-content {
    max-width: 700px;
    text-align: center;
}

.synthesis-heading {
    font-size: clamp(2rem, 5vw, 4rem);
    line-height: 1.15;
    margin-bottom: 2.5rem;
}

.syn-word {
    display: inline-block;
}

.sw-v {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
    color: var(--syn-primary);
}

.sw-g {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 300;
    letter-spacing: 0.08em;
    color: var(--syn-dark);
}

.synthesis-body {
    margin-bottom: 3rem;
}

.synthesis-body p {
    font-family: 'Lora', serif;
    font-size: clamp(1rem, 1.6vw, 1.2rem);
    line-height: 1.72;
    color: var(--syn-dark);
    margin-bottom: 1.2rem;
    text-align: left;
}

.synthesis-final {
    padding: 2rem 0;
    border-top: 1px solid var(--syn-primary);
}

.final-question {
    font-size: clamp(1.2rem, 2.5vw, 2rem);
    line-height: 1.4;
    letter-spacing: 0.02em;
}

.alt-char {
    display: inline;
}

.c-v {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
    color: var(--syn-primary);
}

.c-g {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 300;
    color: var(--syn-dark);
}

.synthesis-silence {
    height: 30vh;
}

/* ============================================
   VICTORIAN BORDER SYSTEM
   ============================================ */
.chapter-1 .left-content,
.chapter-2 .left-content,
.chapter-3 .left-content {
    border: 2px solid transparent;
    border-image: linear-gradient(
        to bottom,
        transparent 0%,
        var(--left-accent) 10%,
        var(--left-primary) 50%,
        var(--left-accent) 90%,
        transparent 100%
    ) 1;
    margin: 2rem;
    padding: 2rem;
}

/* Right panel hairline borders */
.chapter-1 .right-content,
.chapter-2 .right-content,
.chapter-3 .right-content {
    border-left: 1px solid var(--right-accent);
    margin: 2rem;
    padding: 2rem;
}

/* ============================================
   DIVIDER MORPHS PER CHAPTER
   ============================================ */
.morph-wave {
    clip-path: none;
}

/* ============================================
   HOVER STATES
   ============================================ */
.panel-left:hover .victorian-heading {
    color: var(--left-hover);
    transition: color 0.3s ease;
}

.panel-right:hover .geometric-heading {
    color: var(--right-hover);
    transition: color 0.3s ease;
}

.geo-cell:hover {
    background: rgba(112, 144, 165, 0.05);
    transition: background 0.3s ease;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .chapter {
        grid-template-columns: 1fr;
    }

    .panel {
        min-height: 50vh;
    }

    #morph-divider {
        display: none;
    }

    .collision-zone {
        left: 10%;
        width: 80%;
    }

    #chapter-indicator {
        left: 8px;
    }

    .panel-content {
        padding: 1.5rem;
    }

    .geo-grid {
        grid-template-columns: 1fr;
    }

    .chapter-1 .left-content,
    .chapter-2 .left-content,
    .chapter-3 .left-content {
        margin: 1rem;
        padding: 1rem;
    }

    .chapter-1 .right-content,
    .chapter-2 .right-content,
    .chapter-3 .right-content {
        margin: 1rem;
        padding: 1rem;
    }
}
