:root {
    --deep-maritime: #0D1B2A;
    --dusk-rose: #C4616C;
    --parchment-fog: #F0EDE5;
    --midnight-ink: #1B1B2F;
    --teal-prism: #1A8A7D;
    --slate-calm: #7F8C8D;
    --spectral-lilac: #B8A9C9;
    --amber-reason: #D4A857;
    --bone-white: #FAF8F5;
    --text-left: #2C3E50;
    --text-right: #34495E;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Source Sans 3', sans-serif;
    line-height: 1.618;
    overflow-x: hidden;
    background: var(--deep-maritime);
    color: var(--text-left);
}

.svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* ========== SECTION BASE ========== */

.section {
    position: relative;
    width: 100%;
}

/* ========== OPENING SPLIT ========== */

.section--opening {
    height: 100vh;
    display: grid;
    grid-template-columns: 1fr 2px 1fr;
    overflow: hidden;
}

.opening-left {
    background: var(--deep-maritime);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    animation: fadeInLeft 1.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.2s forwards;
}

.opening-right {
    background: var(--bone-white);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    animation: fadeInRight 1.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.5s forwards;
}

.opening-text {
    padding: 48px;
}

.title-ronri {
    font-family: 'Libre Baskerville', serif;
    font-weight: 400;
    font-size: clamp(3rem, 8vw, 6rem);
    letter-spacing: -0.02em;
    color: var(--parchment-fog);
}

.title-day {
    font-family: 'Libre Baskerville', serif;
    font-weight: 400;
    font-size: clamp(3rem, 8vw, 6rem);
    letter-spacing: -0.02em;
    color: var(--dusk-rose);
}

/* ========== SEAM ========== */

.seam {
    width: 2px;
    position: relative;
    z-index: 10;
}

.seam::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: conic-gradient(
        from 0deg,
        var(--teal-prism),
        var(--spectral-lilac),
        var(--dusk-rose),
        var(--amber-reason),
        var(--teal-prism)
    );
    background-size: 100% 400%;
    animation: seamShimmer 12s linear infinite;
}

@keyframes seamShimmer {
    0% { background-position: 0% 0%; }
    100% { background-position: 0% 400%; }
}

.seam--opening {
    opacity: 0;
    animation: fadeIn 0.5s ease 2s forwards;
}

/* ========== PREMISE FIELD ========== */

.section--premise {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 60% 2px 1fr;
}

.premise-left {
    background: var(--deep-maritime);
    padding: 128px 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.premise-right {
    background: var(--midnight-ink);
    position: relative;
    overflow: hidden;
}

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

.accent-label {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--slate-calm);
    display: block;
    margin-bottom: 16px;
    transition: background 0.3s ease;
}

.accent-label:hover {
    background: conic-gradient(
        from 0deg,
        var(--teal-prism),
        var(--spectral-lilac),
        var(--dusk-rose),
        var(--amber-reason),
        var(--teal-prism)
    );
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.premise-text {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.618;
    letter-spacing: 0.01em;
    color: var(--parchment-fog);
    margin-bottom: 32px;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.premise-text.visible {
    opacity: 1;
    transform: translateY(0);
}

.symbol-divider {
    display: block;
    margin: 32px auto;
    opacity: 0.5;
}

/* ========== LEATHER TEXTURE ========== */

.leather-panel {
    position: relative;
}

.leather-surface {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.leather-surface::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--midnight-ink);
    filter: url(#leather-grain);
    contain: layout paint;
}

.leather-surface::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        linear-gradient(15deg, transparent 49.5%, rgba(26, 138, 125, 0.15) 49.8%, rgba(26, 138, 125, 0.15) 50.2%, transparent 50.5%),
        linear-gradient(45deg, transparent 49.5%, rgba(196, 97, 108, 0.12) 49.8%, rgba(196, 97, 108, 0.12) 50.2%, transparent 50.5%),
        linear-gradient(75deg, transparent 49.5%, rgba(184, 169, 201, 0.1) 49.8%, rgba(184, 169, 201, 0.1) 50.2%, transparent 50.5%);
    animation: veinsShift 20s linear infinite;
    opacity: 0.15;
    contain: layout paint;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.leather-surface.ripple::after {
    opacity: 0.3;
}

.leather-surface--energized::after {
    opacity: 0.35;
    background:
        linear-gradient(15deg, transparent 49.2%, rgba(26, 138, 125, 0.25) 49.6%, rgba(26, 138, 125, 0.25) 50.4%, transparent 50.8%),
        linear-gradient(45deg, transparent 49.2%, rgba(196, 97, 108, 0.2) 49.6%, rgba(196, 97, 108, 0.2) 50.4%, transparent 50.8%),
        linear-gradient(75deg, transparent 49.2%, rgba(212, 168, 87, 0.18) 49.6%, rgba(212, 168, 87, 0.18) 50.4%, transparent 50.8%);
    animation: veinsShiftEnergized 15s linear infinite;
}

@keyframes veinsShift {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes veinsShiftEnergized {
    0% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.02); }
    100% { transform: rotate(360deg) scale(1); }
}

/* Leather watermark symbols */
.leather-panel::after {
    content: '\2200';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 200px;
    color: var(--slate-calm);
    opacity: 0.04;
    pointer-events: none;
    font-family: serif;
}

/* ========== REASONING MEMBRANE ========== */

.section--membrane {
    height: 100vh;
    position: relative;
    overflow: hidden;
}

.membrane-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.membrane-bg.active {
    opacity: 1;
}

.membrane-gradient {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: conic-gradient(
        from 0deg at 50% 50%,
        var(--teal-prism),
        var(--spectral-lilac),
        var(--dusk-rose),
        var(--amber-reason),
        var(--teal-prism)
    );
    animation: membraneRotate 12s linear infinite;
    will-change: transform;
}

.membrane-radial {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        ellipse at 50% 50%,
        rgba(250, 248, 245, 0.3) 0%,
        transparent 60%
    );
    animation: membraneFocus 15s ease-in-out infinite;
    will-change: transform;
}

@keyframes membraneRotate {
    0% { filter: hue-rotate(0deg); }
    100% { filter: hue-rotate(360deg); }
}

@keyframes membraneFocus {
    0% { transform: translate(0%, 0%); }
    25% { transform: translate(5%, -5%); }
    50% { transform: translate(-5%, 5%); }
    75% { transform: translate(5%, 5%); }
    100% { transform: translate(0%, 0%); }
}

/* ========== LOGIC SYMBOLS ========== */

.logic-symbol {
    position: absolute;
    opacity: 0;
    will-change: transform;
    transition: opacity 0.6s ease;
}

.logic-symbol.visible {
    opacity: 1;
}

.logic-symbol--conjunction {
    top: 15%;
    left: 20%;
    animation: symbolDrift1 25s ease-in-out infinite;
}

.logic-symbol--disjunction {
    top: 60%;
    left: 70%;
    animation: symbolDrift2 30s ease-in-out infinite;
}

.logic-symbol--implication {
    top: 40%;
    left: 45%;
    animation: symbolDrift3 22s ease-in-out infinite;
}

.logic-symbol--biconditional {
    top: 75%;
    left: 25%;
    animation: symbolDrift4 28s ease-in-out infinite;
}

.logic-symbol--forall {
    top: 25%;
    left: 65%;
    animation: symbolDrift5 35s ease-in-out infinite;
}

.logic-symbol--exists {
    top: 85%;
    left: 50%;
    animation: symbolDrift6 20s ease-in-out infinite;
}

@keyframes symbolDrift1 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(30px, -20px) rotate(5deg); }
    66% { transform: translate(-15px, 25px) rotate(-3deg); }
}

@keyframes symbolDrift2 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(-25px, 15px) rotate(-4deg); }
    66% { transform: translate(20px, -30px) rotate(6deg); }
}

@keyframes symbolDrift3 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(15px, 15px) rotate(3deg); }
}

@keyframes symbolDrift4 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(-20px, -15px) rotate(-5deg); }
    66% { transform: translate(25px, 10px) rotate(4deg); }
}

@keyframes symbolDrift5 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(-30px, 20px) rotate(-6deg); }
}

@keyframes symbolDrift6 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(20px, -25px) rotate(3deg); }
    66% { transform: translate(-10px, 15px) rotate(-2deg); }
}

/* ========== CONCLUSION FIELD ========== */

.section--conclusion {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 40% 2px 1fr;
}

.conclusion-left {
    background: var(--midnight-ink);
    position: relative;
    overflow: hidden;
}

.conclusion-right {
    background: var(--parchment-fog);
    padding: 128px 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.conclusion-text {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.618;
    letter-spacing: 0.01em;
    color: var(--text-right);
    margin-bottom: 32px;
    opacity: 0;
    transform: translateX(12px);
    transition: opacity 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.conclusion-text.visible {
    opacity: 1;
    transform: translateX(0);
}

/* ========== RESOLUTION ========== */

.section--resolution {
    height: 100vh;
    display: grid;
    grid-template-columns: 1fr 2px 1fr;
    position: relative;
}

.resolution-left {
    background: var(--deep-maritime);
    transition: background 2s ease;
}

.resolution-right {
    background: var(--bone-white);
    transition: background 2s ease;
}

.section--resolution.converged .resolution-left,
.section--resolution.converged .resolution-right {
    background: var(--parchment-fog);
}

.seam--resolution {
    transition: width 1.5s ease, box-shadow 1.5s ease;
}

.section--resolution.converged .seam--resolution {
    box-shadow: 0 0 40px 10px rgba(26, 138, 125, 0.2),
                0 0 80px 20px rgba(184, 169, 201, 0.1);
}

.resolution-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 20;
    opacity: 0;
    transition: opacity 1.5s ease;
}

.section--resolution.converged .resolution-center {
    opacity: 1;
}

.resolution-kanji {
    font-family: 'Libre Baskerville', serif;
    font-weight: 400;
    font-size: clamp(2.5rem, 6vw, 5rem);
    color: var(--midnight-ink);
    display: block;
    letter-spacing: 0.1em;
}

.resolution-subtitle {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 300;
    font-size: 0.9rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--slate-calm);
    display: block;
    margin-top: 16px;
}

/* ========== SECTION TRANSITIONS ========== */

.section--premise::before {
    content: '';
    position: absolute;
    top: -200px;
    left: 0;
    width: 100%;
    height: 200px;
    background: linear-gradient(to bottom, transparent, var(--deep-maritime));
    pointer-events: none;
    z-index: 5;
}

.section--membrane::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 200px;
    background: linear-gradient(to bottom, var(--deep-maritime), transparent);
    pointer-events: none;
    z-index: 5;
}

.section--membrane::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 200px;
    background: linear-gradient(to top, var(--midnight-ink), transparent);
    pointer-events: none;
    z-index: 5;
}

/* ========== GRID REVEAL (section boundaries) ========== */

.grid-reveal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
    opacity: 0;
    transition: opacity 0.3s ease;
    background:
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent calc(12.5% - 0.5px),
            rgba(127, 140, 141, 0.05) calc(12.5% - 0.5px),
            rgba(127, 140, 141, 0.05) calc(12.5% + 0.5px),
            transparent calc(12.5% + 0.5px)
        );
}

.grid-reveal.active {
    opacity: 1;
}

/* ========== ANIMATIONS ========== */

@keyframes fadeInLeft {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ========== RESPONSIVE (below 768px) ========== */

@media (max-width: 768px) {
    .section--opening {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 2px 1fr;
    }

    .seam {
        width: 100%;
        height: 2px;
    }

    .section--premise {
        grid-template-columns: 1fr;
        grid-template-rows: auto 2px auto;
    }

    .premise-left {
        padding: 64px 32px;
    }

    .premise-right {
        min-height: 40vh;
    }

    .section--conclusion {
        grid-template-columns: 1fr;
        grid-template-rows: auto 2px auto;
    }

    .conclusion-left {
        min-height: 40vh;
        order: 2;
    }

    .seam--conclusion {
        order: 1;
    }

    .conclusion-right {
        padding: 64px 32px;
        order: 0;
    }

    .section--resolution {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 2px 1fr;
    }

    .title-ronri,
    .title-day {
        font-size: clamp(2.5rem, 12vw, 4rem);
    }

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