:root {
    --primary-dark: #2a1f2d;
    --primary-light: #e8d4c8;
    --accent-gold: #c4a882;
    --aurora-green: #5ec4b6;
    --aurora-violet: #9b7ec8;
    --marble-vein: #f0e6dc;
    --deep-shadow: #1a1320;
    --muted-label: #8a7b8e;
    --parchment: #d4c5b9;
    --charcoal-plum: #3d2e3a;
    --cabinet-width: 38%;
    --mirror-width: 62%;
    --elastic: cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--deep-shadow);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    font-family: 'Cormorant Garamond', Georgia, serif;
}

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

/* === DIPTYCH LAYOUT === */
.diptych {
    display: grid;
    grid-template-columns: var(--cabinet-width) 2px var(--mirror-width);
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* === CABINET (LEFT PANEL) === */
.cabinet {
    position: relative;
    background-color: var(--primary-dark);
    height: 100vh;
    overflow: hidden;
    z-index: 2;
}

.cabinet::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 30% 40%, var(--marble-vein), transparent 60%),
        radial-gradient(ellipse at 70% 60%, var(--primary-light), transparent 50%);
    opacity: 0.06;
    pointer-events: none;
}

/* Aurora Lights */
.aurora-container {
    position: absolute;
    inset: 0;
    overflow: hidden;
    z-index: 0;
}

.aurora {
    position: absolute;
    border-radius: 50%;
    filter: blur(40px);
    will-change: transform;
}

.aurora-1 {
    width: 400px;
    height: 300px;
    background: radial-gradient(ellipse, rgba(94,196,182,0.3), transparent 70%);
    top: 10%;
    left: -10%;
    animation: aurora1Drift 20s infinite ease-in-out;
}

.aurora-2 {
    width: 350px;
    height: 280px;
    background: radial-gradient(ellipse, rgba(155,126,200,0.25), transparent 70%);
    top: 40%;
    right: -15%;
    animation: aurora2Drift 15s infinite ease-in-out reverse;
}

.aurora-3 {
    width: 300px;
    height: 240px;
    background: radial-gradient(ellipse, rgba(196,168,130,0.2), transparent 70%);
    bottom: 10%;
    left: 10%;
    animation: aurora3Drift 25s infinite ease-in-out;
}

@keyframes aurora1Drift {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(60px, 30px) scale(1.1); }
    50% { transform: translate(30px, -40px) scale(0.95); }
    75% { transform: translate(-20px, 20px) scale(1.05); }
}

@keyframes aurora2Drift {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(-40px, -30px) scale(1.08); }
    50% { transform: translate(20px, 40px) scale(0.92); }
    75% { transform: translate(30px, -20px) scale(1.03); }
}

@keyframes aurora3Drift {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(40px, -30px) scale(1.05); }
    66% { transform: translate(-30px, 40px) scale(0.97); }
}

/* Cabinet Content */
.cabinet-content {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cabinet-panel {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 300ms ease-out, transform 500ms var(--elastic);
    pointer-events: none;
}

.cabinet-panel.active {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

.filigree-frame {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.filigree-ornament,
.botanical-silhouette {
    width: 160px;
    height: auto;
    max-height: 260px;
}

.frame-ornament {
    width: 180px;
}

/* Filigree Path Draw Animation */
.filigree-path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: drawFiligree 1200ms var(--elastic) forwards;
}

.cabinet-panel.active .filigree-path,
.section-divider .filigree-path,
.corner-filigree .filigree-path {
    animation: drawFiligree 1200ms var(--elastic) forwards;
}

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

/* Marble Swatch in Cabinet */
.marble-swatch {
    width: 80px;
    height: 50px;
    border: 1px solid var(--accent-gold);
    padding: 3px;
    animation: rotateSwatch 60s linear infinite;
}

.marble-swatch-inner {
    width: 100%;
    height: 100%;
    background: var(--primary-light);
    filter: url(#marbleFilter);
}

@keyframes rotateSwatch {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Corner Filigree */
.corner-filigree {
    position: absolute;
    width: 60px;
    height: 60px;
    z-index: 2;
    opacity: 0.5;
}

.corner-filigree.top-left { top: 12px; left: 12px; }
.corner-filigree.top-right { top: 12px; right: 12px; }
.corner-filigree.bottom-left { bottom: 12px; left: 12px; }
.corner-filigree.bottom-right { bottom: 12px; right: 12px; }

/* === SPLIT LINE === */
.split-line {
    width: 2px;
    height: 100vh;
    background: linear-gradient(
        to bottom,
        transparent,
        var(--accent-gold) 15%,
        var(--accent-gold) 85%,
        transparent
    );
    opacity: 0.6;
    z-index: 3;
    transition: clip-path 800ms var(--elastic);
}

.split-line.breathing {
    animation: splitBreath 800ms var(--elastic);
}

@keyframes splitBreath {
    0% { transform: scaleX(1); }
    40% { transform: scaleX(3); opacity: 0.9; }
    100% { transform: scaleX(1); }
}

/* === MIRROR (RIGHT PANEL) === */
.mirror {
    position: relative;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
}

.marble-bg {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--mirror-width);
    height: 100vh;
    background: var(--primary-light);
    background-image:
        radial-gradient(ellipse at 30% 20%, var(--marble-vein) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 80%, var(--marble-vein) 0%, transparent 40%),
        radial-gradient(ellipse at 50% 50%, var(--primary-light) 0%, var(--primary-light) 100%);
    filter: url(#marbleFilter);
    z-index: 0;
    animation: marbleShift 30s ease-in-out infinite alternate;
}

@keyframes marbleShift {
    0% { background-position: 0% 0%; }
    100% { background-position: 5% 3%; }
}

/* === CHAMBERS === */
.chamber {
    position: relative;
    min-height: 90vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1;
    padding: 60px 40px;
}

.chamber:first-child {
    min-height: 100vh;
}

.chamber-content {
    max-width: 42ch;
    width: 100%;
    margin: 0 auto;
}

/* Chamber I: Threshold */
.threshold-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 70vh;
}

.site-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: clamp(2.4rem, 5vw, 4.2rem);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--charcoal-plum);
    font-feature-settings: 'liga' 1, 'dlig' 1;
    opacity: 0;
    animation: fadeInUp 600ms ease-out 200ms forwards;
}

.tagline {
    font-family: 'Tangerine', cursive;
    font-weight: 700;
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    color: var(--accent-gold);
    margin-top: 16px;
    opacity: 0;
    animation: fadeInUp 600ms ease-out 800ms forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Chapter Labels */
.chapter-label {
    font-family: 'DM Mono', monospace;
    font-weight: 300;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted-label);
    display: block;
    margin-bottom: 24px;
}

/* Chamber Titles */
.chamber-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: clamp(1.8rem, 3.5vw, 2.8rem);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--charcoal-plum);
    font-feature-settings: 'liga' 1, 'dlig' 1;
    margin-bottom: 32px;
}

/* Chamber Text */
.chamber-text {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1.05rem, 1.8vw, 1.25rem);
    line-height: 1.72;
    color: var(--charcoal-plum);
}

.chamber-text p {
    margin-bottom: 1.5em;
}

.chamber-text p:last-child {
    margin-bottom: 0;
}

.accent-text {
    font-family: 'Tangerine', cursive;
    font-weight: 700;
    font-size: 1.5em;
    color: var(--accent-gold);
    line-height: 1;
    position: relative;
    display: inline;
}

.accent-text::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    right: 50%;
    height: 1px;
    background: var(--aurora-green);
    transition: left 400ms var(--elastic), right 400ms var(--elastic);
    opacity: 0;
}

.accent-text:hover::after {
    left: 0;
    right: 0;
    opacity: 1;
}

/* Section Dividers */
.section-divider {
    display: flex;
    justify-content: center;
    margin-top: 60px;
    padding-bottom: 20px;
}

.divider-ornament {
    width: 200px;
    height: 30px;
    opacity: 0.7;
}

/* Closing Signature */
.closing-signature {
    font-family: 'Tangerine', cursive;
    font-weight: 700;
    font-size: clamp(2.4rem, 5vw, 4rem);
    color: var(--accent-gold);
    text-align: center;
    margin-top: 60px;
}

/* === FOOTER === */
.site-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 10vh;
    padding: 40px 20px;
    margin-top: 40px;
    position: relative;
    width: calc(100% + 80px);
    margin-left: -40px;
}

.footer-ornament {
    width: min(400px, 90%);
    height: 20px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.footer-text {
    display: flex;
    gap: 24px;
    align-items: center;
}

.footer-domain {
    font-family: 'DM Mono', monospace;
    font-weight: 300;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted-label);
}

.footer-year {
    font-family: 'DM Mono', monospace;
    font-weight: 300;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    color: var(--muted-label);
}

/* === CHAMBER REVEAL ANIMATIONS === */
.chamber .chamber-content {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 600ms ease-out, transform 600ms ease-out;
}

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

.chamber:first-child .chamber-content {
    opacity: 1;
    transform: none;
}

/* === AURORA STATE CHANGES === */
.aurora-container.chamber-2 .aurora-1 {
    background: radial-gradient(ellipse, rgba(94,196,182,0.35), transparent 70%);
}

.aurora-container.chamber-3 .aurora-2 {
    background: radial-gradient(ellipse, rgba(155,126,200,0.3), transparent 70%);
}

.aurora-container.chamber-4 .aurora-1 {
    background: radial-gradient(ellipse, rgba(94,196,182,0.45), transparent 70%);
}

.aurora-container.chamber-4 .aurora-2 {
    background: radial-gradient(ellipse, rgba(155,126,200,0.35), transparent 70%);
}

/* Renewal warmth shift */
.mirror.chamber-4-active .marble-bg {
    transition: filter 2s ease;
    filter: url(#marbleFilter) hue-rotate(2deg);
}

/* === SCROLLBAR === */
.mirror::-webkit-scrollbar {
    width: 4px;
}

.mirror::-webkit-scrollbar-track {
    background: transparent;
}

.mirror::-webkit-scrollbar-thumb {
    background: var(--accent-gold);
    border-radius: 2px;
    opacity: 0.5;
}

/* === MOBILE === */
@media (max-width: 768px) {
    .diptych {
        grid-template-columns: 1fr;
        grid-template-rows: 56px 1fr;
    }

    .cabinet {
        height: 56px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .aurora-container {
        display: none;
    }

    .cabinet-content {
        display: none;
    }

    .corner-filigree {
        display: none;
    }

    .cabinet::before {
        content: '';
        display: block;
        width: 30px;
        height: 30px;
        border: 1px solid var(--accent-gold);
        border-radius: 50%;
        opacity: 0.6;
    }

    .split-line {
        display: none;
    }

    .mirror {
        height: calc(100vh - 56px);
    }

    .marble-bg {
        width: 100%;
        height: 100%;
    }

    .chamber {
        padding: 40px 24px;
    }

    .section-divider {
        margin-top: 40px;
    }

    .site-footer {
        width: calc(100% + 48px);
        margin-left: -24px;
    }
}