/* ========================================
   mujun.dev — Aurora Over Leather
   ======================================== */

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

:root {
    --void: #0b0b14;
    --leather: #1a1510;
    --leather-light: #241e16;
    --cold-depth: #0d2847;
    --dark-violet: #1a0a3e;
    --teal: #00d2c6;
    --violet: #7b2ff7;
    --magenta: #e91e9c;
    --gold: #c9a84c;
    --parchment: #e8e0d0;
    --ghost: #f0f0f5;
}

html {
    scroll-snap-type: y proximity;
    scroll-behavior: smooth;
}

body {
    background: var(--void);
    color: var(--parchment);
    font-family: 'Commissioner', sans-serif;
    font-weight: 300;
    line-height: 1.75;
    letter-spacing: 0.01em;
    overflow-x: hidden;
}

/* ========================================
   Typography
   ======================================== */

.section-header {
    font-family: 'Cormorant Garamond', 'Noto Serif JP', serif;
    font-weight: 700;
    font-size: clamp(2.5rem, 8vw, 7rem);
    line-height: 1.1;
    color: var(--parchment);
    margin-bottom: 1.5rem;
}

.paradox-italic {
    font-family: 'Cormorant Garamond', 'Noto Serif JP', serif;
    font-weight: 300;
    font-style: italic;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    line-height: 1.3;
    color: var(--parchment);
    margin-bottom: 1.5rem;
}

.body-text {
    font-family: 'Commissioner', sans-serif;
    font-weight: 300;
    font-size: clamp(0.95rem, 1.2vw, 1.15rem);
    line-height: 1.75;
    color: var(--parchment);
    margin-bottom: 1.25rem;
}

.mono-accent {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-variant: small-caps;
    letter-spacing: 0.15em;
    color: var(--gold);
    opacity: 0.6;
    font-size: 0.8rem;
    display: block;
    margin-bottom: 0.75rem;
}

/* ========================================
   Section 1: The Paradox Gate
   ======================================== */

#paradox-gate {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--void);
    overflow: hidden;
    scroll-snap-align: start;
}

.gate-kanji {
    font-family: 'Noto Serif JP', serif;
    font-weight: 700;
    font-size: clamp(8rem, 20vw, 20rem);
    background: linear-gradient(135deg, var(--teal), var(--violet), var(--magenta));
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: absolute;
    animation: aurora-shift 8s ease-in-out infinite;
    will-change: transform;
}

#gate-kanji-left {
    transform: translateX(-100vw);
}

#gate-kanji-right {
    transform: translateX(100vw);
}

.gate-kanji.animate-in-left {
    animation: kanji-enter-left 1.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.5s forwards, aurora-shift 8s ease-in-out infinite;
}

.gate-kanji.animate-in-right {
    animation: kanji-enter-right 1.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.5s forwards, aurora-shift 8s ease-in-out infinite;
}

@keyframes kanji-enter-left {
    from { transform: translateX(-100vw); }
    to { transform: translateX(-60px); }
}

@keyframes kanji-enter-right {
    from { transform: translateX(100vw); }
    to { transform: translateX(60px); }
}

@keyframes aurora-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

#gate-domain {
    font-family: 'Commissioner', sans-serif;
    font-weight: 200;
    font-size: clamp(1.2rem, 2.5vw, 2rem);
    color: var(--ghost);
    letter-spacing: 0.2em;
    opacity: 0;
    position: relative;
    z-index: 2;
    transition: opacity 800ms ease;
}

#gate-domain.visible {
    opacity: 1;
}

#gate-subtitle {
    position: absolute;
    bottom: 10vh;
    text-align: center;
    font-family: 'Commissioner', sans-serif;
    font-weight: 300;
    font-size: clamp(0.75rem, 1.2vw, 1rem);
    color: var(--parchment);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 600ms ease, transform 600ms ease;
    padding: 0 2rem;
}

#gate-subtitle.visible {
    opacity: 0.7;
    transform: translateY(0);
}

/* Kanji vibration */
.gate-kanji.vibrate {
    animation: vibrate 0.05s linear infinite, aurora-shift 8s ease-in-out infinite;
}

@keyframes vibrate {
    0% { transform: var(--rest-x) translateY(0); }
    25% { transform: var(--rest-x) translateY(-1px); }
    50% { transform: var(--rest-x) translateY(0); }
    75% { transform: var(--rest-x) translateY(1px); }
    100% { transform: var(--rest-x) translateY(0); }
}

/* ========================================
   Section 2 & 3: Duality Scroll
   ======================================== */

#duality-scroll,
#paradox-question {
    position: relative;
    min-height: 100vh;
    scroll-snap-align: start;
    display: flex;
    align-items: center;
}

.duality-grid {
    display: grid;
    grid-template-columns: 1fr 2px 1fr;
    width: 100%;
    min-height: 100vh;
}

/* Left column — Leather texture */
.col-left {
    position: relative;
    padding: 6rem 4rem;
    display: flex;
    align-items: center;
}

.col-left::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(ellipse 200px 200px at 30% 40%, var(--leather-light) 0%, transparent 70%),
        radial-gradient(ellipse 300px 300px at 70% 60%, var(--leather-light) 0%, transparent 70%),
        radial-gradient(ellipse 500px 500px at 50% 50%, var(--leather) 0%, transparent 70%),
        var(--leather);
    filter: url(#noise);
}

/* Dot grid overlay on leather */
.col-left::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background-image: radial-gradient(circle 1.5px at center, var(--gold) 0%, transparent 100%);
    background-size: 40px 40px;
    opacity: 0.08;
}

/* Right column — Aurora gradient */
.col-right {
    position: relative;
    padding: 6rem 4rem;
    display: flex;
    align-items: center;
}

.col-right::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -2;
    background: linear-gradient(180deg, var(--void), var(--cold-depth), var(--dark-violet));
}

.col-right::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: conic-gradient(from 0deg at 50% 50%, transparent, var(--teal), transparent, var(--violet), transparent, var(--magenta), transparent);
    opacity: 0.12;
    mix-blend-mode: screen;
    animation: aurora-rotate 30s linear infinite;
    will-change: transform;
    transform: scale(1.5);
}

@keyframes aurora-rotate {
    from { transform: rotate(0deg) scale(1.5); }
    to { transform: rotate(360deg) scale(1.5); }
}

/* Central spine */
.spine {
    width: 2px;
    background: var(--gold);
    animation: spine-pulse 6s ease-in-out infinite;
}

@keyframes spine-pulse {
    0% { background: var(--gold); }
    50% { background: var(--teal); }
    100% { background: var(--gold); }
}

.duality-content {
    max-width: 500px;
}

.col-left .duality-content {
    transform: translateX(15%);
}

.col-right .duality-content {
    transform: translateX(-15%);
}

/* ========================================
   Section 4: Paradox Cards
   ======================================== */

#paradox-cards {
    position: relative;
    min-height: 100vh;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6rem 2rem;
    background: var(--void);
    gap: 3rem;
}

.cards-container {
    display: flex;
    flex-wrap: wrap;
    gap: 4rem;
    justify-content: center;
    max-width: 1200px;
}

.card-pair {
    position: relative;
    width: 320px;
    height: 280px;
    perspective: 1000px;
    cursor: pointer;
}

.card {
    position: absolute;
    inset: 0;
    padding: 2rem;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.card h3 {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
    font-size: 1.8rem;
    margin-bottom: 0.75rem;
}

.card p {
    font-family: 'Commissioner', sans-serif;
    font-weight: 300;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--parchment);
    opacity: 0.85;
}

.card-spear {
    background: linear-gradient(135deg, rgba(0, 210, 198, 0.15), rgba(11, 11, 20, 0.95));
    border: 1px solid rgba(0, 210, 198, 0.3);
    z-index: 2;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.card-spear h3 {
    color: var(--teal);
}

.card-shield {
    background: linear-gradient(135deg, rgba(123, 47, 247, 0.15), rgba(11, 11, 20, 0.95));
    border: 1px solid rgba(123, 47, 247, 0.3);
    z-index: 1;
    transform: translate(20px, -20px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.card-shield h3 {
    color: var(--violet);
}

.card-pair:hover .card-shield {
    z-index: 3;
    transform: translate(0, 0);
    box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}

.card-pair:hover .card-spear {
    transform: translate(20px, -20px);
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

/* ========================================
   Section 5: The Synthesis
   ======================================== */

#synthesis {
    position: relative;
    min-height: 100vh;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6rem 2rem;
    overflow: hidden;
}

#synthesis::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(135deg, var(--leather), var(--void), var(--cold-depth), var(--dark-violet));
}

.synthesis-content {
    max-width: 700px;
    text-align: center;
    margin-bottom: 4rem;
}

.synthesis-content .section-header {
    font-size: clamp(1.8rem, 4vw, 3.5rem);
}

#harmony-character {
    font-family: 'Noto Serif JP', serif;
    font-weight: 700;
    font-size: clamp(6rem, 15vw, 14rem);
    background: linear-gradient(135deg, var(--teal), var(--violet), var(--magenta));
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: aurora-shift 8s ease-in-out infinite, harmony-rotate 12s linear infinite;
}

@keyframes harmony-rotate {
    from { transform: rotateY(0deg); }
    to { transform: rotateY(360deg); }
}

#taijitu {
    position: absolute;
    width: 400px;
    height: 400px;
    opacity: 0.05;
    bottom: 10%;
    right: 10%;
}

/* ========================================
   Han Feizi Vertical Text
   ======================================== */

#han-feizi-text {
    position: fixed;
    right: 50%;
    top: 50%;
    transform: translate(50%, -50%);
    writing-mode: vertical-rl;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    color: var(--gold);
    opacity: 0;
    letter-spacing: 0.3em;
    z-index: 0;
    pointer-events: none;
    transition: opacity 1s ease;
}

#han-feizi-text.visible {
    opacity: 0.15;
}

/* ========================================
   Reveal Animations
   ======================================== */

.reveal-left {
    opacity: 0;
    transform: translateX(-40px) translateX(15%);
    transition: opacity 600ms cubic-bezier(0.16, 1, 0.3, 1), transform 600ms cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-left.revealed {
    opacity: 1;
    transform: translateX(15%);
}

.reveal-right {
    opacity: 0;
    transform: translateX(40px) translateX(-15%);
    transition: opacity 600ms cubic-bezier(0.16, 1, 0.3, 1), transform 600ms cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-right.revealed {
    opacity: 1;
    transform: translateX(-15%);
}

.reveal-up {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 600ms cubic-bezier(0.16, 1, 0.3, 1), transform 600ms cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-up.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ========================================
   Responsive (< 768px)
   ======================================== */

@media (max-width: 768px) {
    .duality-grid {
        grid-template-columns: 1fr;
    }

    .spine {
        display: none;
    }

    .col-left,
    .col-right {
        padding: 4rem 2rem;
    }

    .col-left .duality-content,
    .col-right .duality-content {
        transform: none;
    }

    .reveal-left {
        transform: translateX(-40px);
    }

    .reveal-left.revealed {
        transform: translateX(0);
    }

    .reveal-right {
        transform: translateX(40px);
    }

    .reveal-right.revealed {
        transform: translateX(0);
    }

    .card-pair {
        width: 280px;
        height: 300px;
    }

    #han-feizi-text {
        display: none;
    }
}
