/* ==============================================
   mosun.xyz - Contradiction / Duality Design
   Dual palette, mirrored-duality architecture
   ============================================== */

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

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

body {
    font-family: 'Karla', sans-serif;
    font-weight: 400;
    font-size: 16px;
    line-height: 1.7;
    color: #2D3748;
    background-color: #F7F8FA;
    overflow-x: hidden;
    position: relative;
}

/* --- Central Axis Divider --- */
.axis {
    position: fixed;
    top: 0;
    left: 50%;
    width: 1px;
    height: 100vh;
    background-color: #4A5568;
    z-index: 100;
    transform: translateX(-0.5px);
    pointer-events: none;
}

/* --- Main --- */
main {
    position: relative;
    z-index: 1;
}

/* --- Section Base --- */
.section {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100vh;
    overflow: hidden;
}

.section__half {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 4rem 3rem;
}

.section__half[data-half="left"] {
    background-color: #F7F8FA;
    color: #1E2A3A;
    text-align: left;
}

.section__half[data-half="right"] {
    background-color: #2D3748;
    color: #F7F8FA;
    text-align: right;
}

/* === SECTION 1: Entrance Portal === */
#entrance-portal {
    min-height: 100vh;
    align-items: center;
}

#entrance-portal .section__half {
    justify-content: center;
    align-items: stretch;
}

.domain-text {
    font-family: 'Fraunces', serif;
    font-size: clamp(3rem, 8vw, 7rem);
    letter-spacing: 0.02em;
    line-height: 1.1;
    margin-bottom: 2rem;
}

.domain-text--thin {
    font-weight: 100;
    opacity: 0.3;
    color: #1E2A3A;
}

.domain-text--bold {
    font-weight: 900;
    opacity: 1;
    color: #F7F8FA;
}

.entrance-phrase {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.phrase-line {
    font-family: 'Karla', sans-serif;
    font-weight: 300;
    font-size: clamp(1.2rem, 3vw, 2.4rem);
    letter-spacing: 0.5em;
    text-transform: uppercase;
}

[data-half="left"] .entrance-phrase {
    align-items: flex-start;
    color: #8896A8;
}

[data-half="right"] .entrance-phrase {
    align-items: flex-end;
    color: #D8E0EA;
}

/* Marble Fragments */
.marble-fragment {
    position: absolute;
    width: 200px;
    height: 300px;
    z-index: 2;
    pointer-events: none;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.marble-fragment--left {
    left: 0;
    bottom: 5%;
    clip-path: polygon(0% 20%, 60% 0%, 80% 50%, 40% 100%, 0% 70%);
    background: linear-gradient(135deg, #8896A8 0%, #C8D0D8 40%, #A8B4C8 70%, #8896A8 100%);
    opacity: 0.6;
}

.marble-fragment--right {
    right: 0;
    top: 5%;
    clip-path: polygon(100% 80%, 40% 100%, 20% 50%, 60% 0%, 100% 30%);
    background: linear-gradient(315deg, #D8E0EA 0%, #4A5568 40%, #8896A8 70%, #D8E0EA 100%);
    opacity: 0.6;
    filter: invert(0.05);
}

.marble-fragment--left.shake {
    animation: shakeH 0.5s ease-out;
}

.marble-fragment--right.shake {
    animation: shakeV 0.5s ease-out;
}

@keyframes shakeH {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(2px); }
}

@keyframes shakeV {
    0%, 100% { transform: translateY(0); }
    20% { transform: translateY(-8px); }
    40% { transform: translateY(6px); }
    60% { transform: translateY(-4px); }
    80% { transform: translateY(2px); }
}

/* Marble pseudo-elements for right-half sections */
.section__half[data-half="right"]::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(220deg, transparent 85%, rgba(136, 150, 168, 0.08) 100%);
    pointer-events: none;
    filter: invert(0.02);
}

.section__half[data-half="left"]::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(40deg, transparent 85%, rgba(200, 208, 216, 0.08) 100%);
    pointer-events: none;
}

/* === SECTION 2: Dialectic Text Plate === */
#dialectic-plate {
    min-height: 100vh;
}

#dialectic-plate .section__half[data-half="left"] {
    background: repeating-linear-gradient(
        to bottom,
        #F7F8FA 0,
        #F7F8FA 4rem,
        #EDEEF2 4rem,
        #EDEEF2 8rem
    );
}

#dialectic-plate .section__half[data-half="right"] {
    background: repeating-linear-gradient(
        to bottom,
        #2D3748 0,
        #2D3748 4rem,
        #1E2A3A 4rem,
        #1E2A3A 8rem
    );
}

.dialectic-text {
    font-family: 'Karla', sans-serif;
    font-weight: 400;
    font-size: 16px;
    line-height: 1.7;
    max-width: 90%;
}

[data-half="left"] .dialectic-text {
    color: #2D3748;
    text-align: left;
}

[data-half="right"] .dialectic-text {
    color: #F7F8FA;
    text-align: right;
    margin-left: auto;
}

.dialectic-text p {
    margin-bottom: 1.5rem;
}

.pivot-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #8896A8;
    transform: translate(-50%, -50%);
    z-index: 10;
}

.dialectical-vein {
    position: absolute;
    left: 10%;
    right: 10%;
    height: 1px;
    z-index: 5;
    pointer-events: none;
}

.dialectical-vein--solid {
    top: 25%;
    background-color: #C8D0D8;
}

.dialectical-vein--dashed {
    bottom: 25%;
    background: repeating-linear-gradient(
        to right,
        #C8D0D8 0,
        #C8D0D8 8px,
        transparent 8px,
        transparent 16px
    );
    height: 1px;
}

/* === SECTION 3: Animated Paradox Plate === */
#paradox-plate {
    min-height: 120vh;
}

.paradox-shapes {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 80vh;
}

.shape {
    position: absolute;
    transition: all 1.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Left-side shapes (thesis states) */
.shape--1 {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: #8896A8;
    top: 10%;
    left: 20%;
}

.shape--2 {
    width: 4px;
    height: 120px;
    background-color: #A8B4C8;
    top: 35%;
    left: 60%;
}

.shape--3 {
    width: 0;
    height: 0;
    border-left: 40px solid transparent;
    border-right: 40px solid transparent;
    border-bottom: 70px solid #C8D0D8;
    top: 60%;
    left: 15%;
}

.shape--4 {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: #1E2A3A;
    top: 80%;
    left: 45%;
}

.shape--5 {
    width: 60px;
    height: 60px;
    background-color: #8896A8;
    transform: rotate(45deg);
    top: 20%;
    left: 70%;
}

.shape--6 {
    width: 100px;
    height: 40px;
    background-color: #C8D0D8;
    top: 50%;
    left: 30%;
}

/* Right-side shapes (antithesis states) */
.shape--7 {
    width: 80px;
    height: 80px;
    border-radius: 0;
    background-color: #D8E0EA;
    top: 10%;
    right: 20%;
    left: auto;
}

.shape--8 {
    width: 120px;
    height: 4px;
    background-color: #4A5568;
    top: 35%;
    right: 15%;
    left: auto;
}

.shape--9 {
    width: 0;
    height: 0;
    border-left: 40px solid transparent;
    border-right: 40px solid transparent;
    border-top: 70px solid #4A5568;
    top: 60%;
    right: 20%;
    left: auto;
}

.shape--10 {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #F7F8FA;
    background: transparent;
    top: 80%;
    right: 40%;
    left: auto;
}

.shape--11 {
    width: 60px;
    height: 60px;
    position: absolute;
    top: 20%;
    right: 10%;
    left: auto;
    background: transparent;
}

.shape--11::before,
.shape--11::after {
    content: '';
    position: absolute;
    background-color: #D8E0EA;
}

.shape--11::before {
    width: 100%;
    height: 4px;
    top: 50%;
    transform: translateY(-50%);
}

.shape--11::after {
    width: 4px;
    height: 100%;
    left: 50%;
    transform: translateX(-50%);
}

.shape--12 {
    width: 100px;
    height: 2px;
    background-color: #4A5568;
    top: 50%;
    right: 25%;
    left: auto;
}

/* Shape transformations on scroll (toggled via JS) */
.shape--1.transformed {
    border-radius: 0;
    background-color: #C8D0D8;
}

.shape--2.transformed {
    width: 120px;
    height: 4px;
}

.shape--3.transformed {
    border-bottom-color: #8896A8;
    opacity: 0.4;
}

.shape--7.transformed {
    border-radius: 50%;
    background-color: #4A5568;
}

.shape--8.transformed {
    width: 4px;
    height: 120px;
}

.shape--9.transformed {
    border-top-color: #D8E0EA;
    opacity: 0.4;
}

/* Synthesis grayscale pass-through */
.shape.synthesizing {
    filter: grayscale(1);
    opacity: 0.5;
}

/* === SECTION 4: Layered Opposition Plate === */
#opposition-plate {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.opposition-word-container {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 2rem;
}

.opposition-word {
    font-family: 'Fraunces', serif;
    font-size: clamp(4rem, 18vw, 12rem);
    font-weight: 900;
    line-height: 1;
    display: flex;
    letter-spacing: -0.02em;
    user-select: none;
}

.letter-split {
    position: relative;
    display: inline-block;
    color: transparent;
    background: linear-gradient(to right, #1E2A3A 50%, rgba(30, 42, 58, 0.2) 50%);
    -webkit-background-clip: text;
    background-clip: text;
}

.dual-definition {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    padding: 3rem 4rem;
    max-width: 1000px;
    margin: 0 auto;
}

.definition {
    font-size: 14px;
    line-height: 1.8;
    color: #2D3748;
}

.definition--serif {
    font-family: 'Fraunces', serif;
    font-weight: 300;
    text-align: left;
}

.definition--sans {
    font-family: 'Karla', sans-serif;
    font-weight: 400;
    text-align: right;
}

/* === SECTION 5: Scroll-Direction Reversal Plate === */
#reversal-plate {
    min-height: 100vh;
}

.reversal-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100vh;
    width: 100%;
}

#reversal-plate .section__half[data-half="left"] {
    background-color: #F7F8FA;
}

#reversal-plate .section__half[data-half="right"] {
    background-color: #D8E0EA;
    transform: scaleY(-1);
}

#reversal-plate .section__half[data-half="right"] .reversal-text {
    transform: scaleY(-1);
    color: #8896A8;
}

.reversal-text {
    font-family: 'Karla', sans-serif;
    font-weight: 400;
    font-size: 18px;
    line-height: 1.8;
    max-width: 85%;
}

[data-half="left"] .reversal-text {
    color: #1E2A3A;
}

/* === SECTION 6: Synthesis Fragment Plate === */
#synthesis-plate {
    min-height: 80vh;
}

.synthesis-fragment {
    width: 250px;
    height: 350px;
    position: relative;
}

.synthesis-fragment--left {
    clip-path: polygon(10% 0%, 90% 15%, 100% 60%, 70% 100%, 0% 85%);
    background: linear-gradient(135deg, #8896A8 0%, #C8D0D8 35%, #A8B4C8 65%, #D8E0EA 100%);
    margin-left: auto;
    margin-right: 2rem;
}

.synthesis-fragment--right {
    clip-path: polygon(90% 100%, 10% 85%, 0% 40%, 30% 0%, 100% 15%);
    background: linear-gradient(315deg, #D8E0EA 0%, #4A5568 35%, #8896A8 65%, #2D3748 100%);
    margin-left: 2rem;
}

.synthesis-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Inconsolata', monospace;
    font-size: 13px;
    letter-spacing: 0.15em;
    color: #8896A8;
    white-space: nowrap;
    z-index: 10;
    text-transform: uppercase;
}

/* Double text effect for monospace */
.synthesis-text::after {
    content: 'THESE ARE THE SAME AND DIFFERENT SHAPES.';
    position: absolute;
    top: 0;
    left: 1px;
    color: #8896A8;
    opacity: 0.3;
    filter: invert(1);
}

/* === SECTION 7: Exit Dissipation === */
#exit-plate {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(to bottom, #F7F8FA 0%, #EDEEF2 100%);
}

.dissipation-container {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2.5rem;
    padding: 4rem 2rem;
}

.dissipation-instance {
    font-family: 'Fraunces', serif;
    font-size: clamp(2rem, 6vw, 5rem);
    font-weight: 700;
    color: #1E2A3A;
    line-height: 1;
    letter-spacing: 0.05em;
}

.dissipation-instance--1 {
    opacity: 1;
    filter: none;
}

.dissipation-instance--2 {
    opacity: 0.7;
    filter: invert(1);
}

.dissipation-instance--3 {
    opacity: 0.5;
    filter: saturate(0.5);
}

.dissipation-instance--4 {
    opacity: 0.3;
    filter: hue-rotate(180deg);
}

.dissipation-instance--5 {
    opacity: 0.2;
    filter: blur(2px);
}

.dissipation-instance--6 {
    opacity: 0.1;
    filter: grayscale(1);
}

.dissipation-instance--7 {
    opacity: 0.05;
    filter: contrast(0);
}

/* === Decorative Elements === */

/* Rotation Frames */
.rotation-frame {
    position: fixed;
    width: 80px;
    height: 80px;
    border: 1px solid #C8D0D8;
    pointer-events: none;
    z-index: 50;
    opacity: 0.4;
    transition: transform 2s ease-out;
}

.rotation-frame--tl {
    top: 2rem;
    left: 2rem;
    transform: rotate(0deg);
}

.rotation-frame--tr {
    top: 2rem;
    right: 2rem;
    transform: rotate(0deg);
}

.rotation-frame--bl {
    bottom: 2rem;
    left: 2rem;
    transform: rotate(0deg);
}

.rotation-frame--br {
    bottom: 2rem;
    right: 2rem;
    transform: rotate(0deg);
}

/* Split M Decorative */
.split-m {
    position: fixed;
    bottom: 50%;
    left: 50%;
    transform: translate(-50%, 50%);
    font-family: 'Fraunces', serif;
    font-size: 15rem;
    font-weight: 900;
    line-height: 1;
    pointer-events: none;
    z-index: 0;
    opacity: 0.03;
    display: flex;
    overflow: hidden;
}

.split-m__left {
    color: #1E2A3A;
    clip-path: inset(0 50% 0 0);
    margin-right: -0.5em;
}

.split-m__right {
    color: #2D3748;
    clip-path: inset(0 0 0 50%);
    filter: invert(0.3);
}

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

    .section__half[data-half="right"] {
        text-align: left;
    }

    [data-half="right"] .dialectic-text {
        text-align: left;
        margin-left: 0;
    }

    .axis {
        opacity: 0.3;
    }

    .domain-text {
        font-size: clamp(2rem, 10vw, 4rem);
    }

    .opposition-word {
        font-size: clamp(2.5rem, 14vw, 6rem);
    }

    .dual-definition {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding: 2rem;
    }

    .reversal-content {
        grid-template-columns: 1fr;
    }

    .synthesis-fragment {
        width: 150px;
        height: 220px;
    }

    .rotation-frame {
        width: 50px;
        height: 50px;
    }

    .split-m {
        font-size: 8rem;
    }
}

/* === Reduced Motion === */
@media (prefers-reduced-motion: reduce) {
    .shape {
        transition: none;
    }

    .marble-fragment {
        transition: none;
    }

    .rotation-frame {
        transition: none;
    }
}
