/* ==========================================================================
   persona.quest — A Corridor of Mirrors
   Aesthetic: surreal-dreamscape / mysterious-moody
   Layout: diagonal-sections + layered-depth
   Palette: aubergine-absinthe corridor
   ========================================================================== */

:root {
    --c-obsidian: #0E0818;       /* deepest background */
    --c-aubergine: #2A1234;      /* primary chamber background */
    --c-twilight: #3D1F4E;       /* elevated surfaces */
    --c-pale-smoke: #D4CBDF;     /* body text */
    --c-tarnished: #B8B0C8;      /* display type */
    --c-absinthe: #A8E06C;       /* accent / labels */
    --c-faded-rose: #C4708A;     /* secondary highlights */
    --c-phantom: #4A2D5E;        /* borders, seams */

    --ease-corridor: cubic-bezier(0.16, 1, 0.3, 1);

    --chamber-progress: 0;
}

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

html {
    scroll-behavior: smooth;
    background: var(--c-obsidian);
}

body {
    background: var(--c-obsidian);
    color: var(--c-pale-smoke);
    font-family: 'Nunito', 'Inter', system-ui, sans-serif;
    font-weight: 300;
    font-size: 18px;
    line-height: 1.72;
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

/* ==========================================================================
   ATMOSPHERE LAYER — drifting masks, fractures, grain
   ========================================================================== */

.atmosphere {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.grain {
    position: absolute;
    inset: -50%;
    background-image:
        radial-gradient(circle at 20% 10%, rgba(168, 224, 108, 0.025) 0%, transparent 35%),
        radial-gradient(circle at 80% 90%, rgba(196, 112, 138, 0.04) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(74, 45, 94, 0.18) 0%, transparent 70%);
    mix-blend-mode: screen;
    opacity: 0.9;
}

.grain::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        repeating-linear-gradient(0deg, rgba(212, 203, 223, 0.012) 0px, rgba(212, 203, 223, 0.012) 1px, transparent 1px, transparent 3px);
    mix-blend-mode: overlay;
    opacity: 0.6;
    animation: breathe-grain 14s ease-in-out infinite;
}

@keyframes breathe-grain {
    0%, 100% { opacity: 0.55; transform: translateY(0); }
    50% { opacity: 0.7; transform: translateY(-6px); }
}

.drift-mask {
    position: absolute;
    width: 110px;
    height: 132px;
    opacity: 0.06;
    filter: blur(0.3px);
}

.drift-mask--a {
    top: 12%;
    left: 8%;
    animation: drift-a 64s ease-in-out infinite;
}
.drift-mask--b {
    top: 38%;
    right: 6%;
    width: 90px;
    height: 108px;
    animation: drift-b 72s ease-in-out infinite;
}
.drift-mask--c {
    top: 64%;
    left: 18%;
    width: 130px;
    height: 156px;
    animation: drift-c 60s ease-in-out infinite;
}
.drift-mask--d {
    top: 86%;
    right: 14%;
    width: 100px;
    height: 120px;
    animation: drift-d 68s ease-in-out infinite;
}

@keyframes drift-a {
    0%, 100% { transform: translateX(0) translateY(0); opacity: 0.04; }
    50% { transform: translateX(30px) translateY(-12px); opacity: 0.09; }
}
@keyframes drift-b {
    0%, 100% { transform: translateX(0) translateY(0); opacity: 0.05; }
    50% { transform: translateX(-28px) translateY(18px); opacity: 0.08; }
}
@keyframes drift-c {
    0%, 100% { transform: translateX(0) translateY(0); opacity: 0.04; }
    50% { transform: translateX(26px) translateY(-20px); opacity: 0.085; }
}
@keyframes drift-d {
    0%, 100% { transform: translateX(0) translateY(0); opacity: 0.05; }
    50% { transform: translateX(-32px) translateY(14px); opacity: 0.09; }
}

.fracture {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0.55;
}

.fracture--1 {
    top: 6%;
    left: -10%;
    transform: rotate(-3deg);
}
.fracture--2 {
    top: 36%;
    left: -5%;
    transform: rotate(2deg);
}
.fracture--3 {
    top: 66%;
    left: 0;
    transform: rotate(-1deg);
    opacity: 0.4;
}

/* ==========================================================================
   THRESHOLD / TITLE PLATE
   ========================================================================== */

.threshold {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    padding: 0 6vw;
}

.threshold__inner {
    position: relative;
    max-width: 880px;
    text-align: left;
    z-index: 3;
}

.threshold__title {
    font-family: 'Bodoni Moda', 'Inter', serif;
    font-weight: 900;
    font-size: clamp(56px, 11vw, 144px);
    line-height: 0.96;
    letter-spacing: -0.035em;
    color: var(--c-tarnished);
    text-shadow: 2px 2px 14px rgba(42, 18, 52, 0.7);
    margin: 24px 0 32px;
    transition: color 800ms var(--ease-corridor), text-shadow 800ms var(--ease-corridor);
}

.threshold__title .dot {
    color: var(--c-absinthe);
    transition: transform 800ms var(--ease-corridor);
    display: inline-block;
}

.threshold:hover .threshold__title {
    color: var(--c-absinthe);
}
.threshold:hover .threshold__title .dot {
    transform: scale(1.4);
}

.threshold__sub {
    font-family: 'Nunito', 'Inter', sans-serif;
    font-weight: 300;
    font-size: clamp(16px, 1.6vw, 22px);
    line-height: 1.65;
    color: var(--c-pale-smoke);
    opacity: 0.85;
    max-width: 580px;
    margin-bottom: 56px;
}

.threshold__cue {
    display: inline-flex;
    align-items: center;
    gap: 16px;
}

.cue-line {
    display: block;
    width: 64px;
    height: 1px;
    background: var(--c-absinthe);
    opacity: 0.7;
    animation: cue-pulse 4s ease-in-out infinite;
}

@keyframes cue-pulse {
    0%, 100% { transform: scaleX(1); opacity: 0.5; }
    50% { transform: scaleX(1.6); opacity: 0.9; }
}

.cue-label {
    font-family: 'Azeret Mono', 'Space Mono', monospace;
    font-weight: 400;
    font-size: 12px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--c-absinthe);
    opacity: 0.75;
}

.threshold__mask {
    position: absolute;
    top: 50%;
    right: 8vw;
    width: clamp(160px, 26vw, 320px);
    height: auto;
    transform: translateY(-50%) rotate(-4deg);
    opacity: 0.7;
    z-index: 2;
    animation: breathe-mask 4s ease-in-out infinite;
}

@keyframes breathe-mask {
    0%, 100% { transform: translateY(-50%) rotate(-4deg) scale(1); }
    50% { transform: translateY(-50%) rotate(-4deg) scale(1.02); }
}

.meta {
    font-family: 'Azeret Mono', 'Space Mono', monospace;
    font-weight: 400;
    font-size: 12px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--c-absinthe);
    opacity: 0.7;
    margin-bottom: 18px;
}

/* ==========================================================================
   CORRIDOR / CHAMBERS
   ========================================================================== */

.corridor {
    position: relative;
    z-index: 2;
    isolation: isolate;
}

.chamber {
    position: relative;
    padding: 140px 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    margin: -70px 0;
}

.chamber__plane {
    position: relative;
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: 96px 56px;
    border: 1px solid rgba(74, 45, 94, 0.7);
    background: linear-gradient(180deg,
        rgba(42, 18, 52, 0.75) 0%,
        rgba(42, 18, 52, 0.92) 50%,
        rgba(42, 18, 52, 0.75) 100%
    );
    box-shadow:
        0 30px 80px rgba(14, 8, 24, 0.55),
        inset 0 1px 0 rgba(196, 112, 138, 0.12);
    transition: transform 1200ms var(--ease-corridor);
    will-change: transform;
}

/* Alternating diagonal rotations */
.chamber--01 .chamber__plane { transform: rotate(2.5deg); }
.chamber--02 .chamber__plane { transform: rotate(-2.5deg); }
.chamber--03 .chamber__plane { transform: rotate(2.5deg); }
.chamber--04 .chamber__plane { transform: rotate(-2.5deg); }
.chamber--05 .chamber__plane { transform: rotate(0deg); }

/* Mix-blend-mode on chamber overlap seams */
.chamber + .chamber {
    mix-blend-mode: normal;
}

.chamber__plane::before,
.chamber__plane::after {
    content: "";
    position: absolute;
    left: 8%;
    right: 8%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--c-phantom), transparent);
    opacity: 0.7;
}
.chamber__plane::before { top: -1px; }
.chamber__plane::after { bottom: -1px; }

.chamber__grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 40px;
    align-items: start;
}

.chamber__grid--centered {
    grid-template-columns: 1fr;
    text-align: center;
    justify-items: center;
}

.chamber__text {
    grid-column: 1 / span 4;
    max-width: 620px;
}

/* Even chambers invert positions */
.chamber--02 .chamber__text,
.chamber--04 .chamber__text {
    grid-column: 3 / span 4;
}

.chamber__visual {
    grid-column: 5 / span 2;
    position: relative;
    transform: translateY(-40px);
    min-height: 360px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chamber--02 .chamber__visual,
.chamber--04 .chamber__visual {
    grid-column: 1 / span 2;
    transform: translateY(40px);
}

.chamber__text--core {
    grid-column: 1;
    max-width: 720px;
    text-align: center;
}

.chamber__visual--core {
    grid-column: 1;
    transform: translateY(0);
    margin-top: 40px;
}

.chamber__title {
    font-family: 'Bodoni Moda', 'Inter', serif;
    font-weight: 900;
    font-size: clamp(56px, 9vw, 120px);
    line-height: 0.94;
    letter-spacing: -0.03em;
    color: var(--c-tarnished);
    text-shadow: 2px 2px 8px rgba(42, 18, 52, 0.6);
    margin: 8px 0 36px;
    transition: color 800ms var(--ease-corridor);
    cursor: default;
}

.chamber__title:hover {
    color: var(--c-absinthe);
}

.chamber__text p:not(.meta):not(.annotation):not(.core-line) {
    margin-bottom: 22px;
    color: var(--c-pale-smoke);
    opacity: 0.85;
    font-size: clamp(16px, 1.25vw, 19px);
    line-height: 1.72;
    font-weight: 300;
}

.annotation {
    font-family: 'Azeret Mono', 'Space Mono', monospace;
    font-weight: 400;
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--c-faded-rose);
    opacity: 0.55;
    margin-top: 32px;
    border-left: 1px solid var(--c-phantom);
    padding-left: 12px;
}

/* Progressive-disclosure blur reveal */
.reveal {
    opacity: 0.15;
    filter: blur(2px);
    transform: translateY(8px);
    transition:
        opacity 600ms var(--ease-corridor),
        filter 500ms var(--ease-corridor),
        transform 600ms var(--ease-corridor);
}

.reveal.revealed {
    opacity: 0.85;
    filter: blur(0);
    transform: translateY(0);
}

/* ==========================================================================
   OVAL MASKS
   ========================================================================== */

.oval {
    width: 100%;
    height: auto;
    max-width: 280px;
    transform-origin: center;
    transition: transform 1200ms var(--ease-corridor);
}

.oval--large {
    width: clamp(180px, 22vw, 280px);
    animation: breathe-mask-large 4s ease-in-out infinite;
}

@keyframes breathe-mask-large {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.oval--shadow {
    filter: drop-shadow(0 0 22px rgba(196, 112, 138, 0.18));
    animation: breathe-mask-large 5s ease-in-out infinite;
}

.oval--small {
    position: absolute;
    width: 60px;
    height: auto;
    top: 18%;
    right: -20px;
    opacity: 0.55;
    animation: breathe-mask-large 6s ease-in-out infinite;
}

.oval--small-2 {
    top: auto;
    right: auto;
    bottom: 8%;
    left: -10px;
    width: 48px;
    opacity: 0.45;
}

.oval--core {
    width: clamp(220px, 30vw, 380px);
    height: auto;
    animation: breathe-core 5s ease-in-out infinite;
    filter: drop-shadow(0 0 40px rgba(196, 112, 138, 0.25));
}

@keyframes breathe-core {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}

/* Approach scale on chamber visibility */
.chamber.in-view .oval--large,
.chamber.in-view .oval--core {
    animation-play-state: running;
}

.chamber:not(.in-view) .oval--large {
    transform: scale(0.85);
}

/* ==========================================================================
   GLOW POINTS
   ========================================================================== */

.glow {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    background: radial-gradient(circle, rgba(168, 224, 108, 0.2) 0%, rgba(168, 224, 108, 0) 70%);
    opacity: 0;
    transition: opacity 800ms var(--ease-corridor);
}

.chamber.in-view .glow {
    opacity: 1;
    animation: glow-pulse 6s ease-in-out infinite;
}

@keyframes glow-pulse {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.1); opacity: 0.85; }
}

.glow--a { width: 80px; height: 80px; top: 12%; right: 8%; animation-delay: 0.4s; }
.glow--b { width: 50px; height: 50px; bottom: 18%; left: 12%; animation-delay: 1.6s; }
.glow--c { width: 70px; height: 70px; top: 24%; left: -8%; animation-delay: 0.8s; }
.glow--d { width: 60px; height: 60px; top: 8%; right: 22%; animation-delay: 2.2s; }
.glow--e { width: 90px; height: 90px; bottom: 6%; right: -6%; animation-delay: 3.0s; }
.glow--f { width: 55px; height: 55px; top: 32%; right: -10%; animation-delay: 1.2s; }

.glow--core {
    background: radial-gradient(circle, rgba(196, 112, 138, 0.22) 0%, rgba(196, 112, 138, 0) 70%);
}
.glow--core-1 { width: 200px; height: 200px; top: -10%; left: 50%; transform: translateX(-50%); animation-delay: 0s; }
.glow--core-2 { width: 140px; height: 140px; top: 60%; left: 18%; animation-delay: 1.4s; }
.glow--core-3 { width: 160px; height: 160px; bottom: -10%; right: 14%; animation-delay: 2.6s; }

/* ==========================================================================
   CHAMBER 05 — CORE — the warm rupture
   ========================================================================== */

.chamber--05 .chamber__plane {
    background:
        radial-gradient(ellipse at center,
            rgba(196, 112, 138, 0.15) 0%,
            rgba(61, 31, 78, 0.6) 30%,
            rgba(14, 8, 24, 0.95) 75%
        );
    border-color: rgba(196, 112, 138, 0.3);
    box-shadow:
        0 30px 100px rgba(196, 112, 138, 0.12),
        0 30px 80px rgba(14, 8, 24, 0.55),
        inset 0 1px 0 rgba(196, 112, 138, 0.18);
}

.chamber__title--core {
    color: var(--c-absinthe);
    text-shadow: 0 0 32px rgba(168, 224, 108, 0.18), 2px 2px 8px rgba(42, 18, 52, 0.6);
}

.meta--core {
    color: var(--c-absinthe);
    opacity: 0.85;
}

.core-line {
    font-family: 'Bodoni Moda', 'Inter', serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(20px, 2.2vw, 28px);
    line-height: 1.55;
    color: var(--c-pale-smoke);
    opacity: 1;
    margin-bottom: 18px;
    letter-spacing: 0.005em;
}

.annotation--core {
    margin-top: 48px;
    color: var(--c-absinthe);
    opacity: 0.7;
    border-left-color: rgba(168, 224, 108, 0.4);
    display: inline-block;
    text-align: left;
}

/* ==========================================================================
   CODA / FOOTER
   ========================================================================== */

.coda {
    position: relative;
    z-index: 2;
    padding: 120px 6vw 100px;
    text-align: center;
}

.coda__text {
    font-family: 'Bodoni Moda', 'Inter', serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(18px, 2vw, 26px);
    color: var(--c-tarnished);
    opacity: 0.7;
    letter-spacing: 0.01em;
}

/* ==========================================================================
   PROGRESS INDICATOR
   ========================================================================== */

.progress {
    position: fixed;
    top: 50%;
    right: 28px;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 14px;
    z-index: 10;
}

.progress__dot {
    appearance: none;
    background: transparent;
    border: none;
    padding: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress__dot span {
    display: block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid var(--c-phantom);
    transition: all 600ms var(--ease-corridor);
}

.progress__dot.active span {
    background: var(--c-absinthe);
    border-color: var(--c-absinthe);
    transform: scale(1.4);
    box-shadow: 0 0 12px rgba(168, 224, 108, 0.5);
}

.progress__dot:hover span {
    border-color: var(--c-faded-rose);
}

/* ==========================================================================
   RESPONSIVE — Mobile (<768px)
   ========================================================================== */

@media (max-width: 768px) {
    .chamber {
        padding: 80px 0;
        margin: -30px 0;
    }
    .chamber__plane {
        padding: 56px 24px;
    }
    .chamber--01 .chamber__plane { transform: rotate(1deg); }
    .chamber--02 .chamber__plane { transform: rotate(-1deg); }
    .chamber--03 .chamber__plane { transform: rotate(1deg); }
    .chamber--04 .chamber__plane { transform: rotate(-1deg); }

    .chamber__grid {
        grid-template-columns: 1fr;
        gap: 28px;
    }
    .chamber__text,
    .chamber--02 .chamber__text,
    .chamber--04 .chamber__text {
        grid-column: 1;
        padding-left: 12px;
    }
    .chamber--02 .chamber__text,
    .chamber--04 .chamber__text {
        padding-left: 0;
        padding-right: 12px;
    }
    .chamber__visual,
    .chamber--02 .chamber__visual,
    .chamber--04 .chamber__visual {
        grid-column: 1;
        transform: translateY(0);
        min-height: 240px;
    }
    .chamber__title {
        font-size: clamp(48px, 14vw, 72px);
    }
    .threshold__mask {
        right: 4vw;
        opacity: 0.4;
    }
    .drift-mask--a,
    .drift-mask--b,
    .drift-mask--c,
    .drift-mask--d {
        animation: none;
    }
    .progress {
        right: 12px;
        gap: 10px;
    }
    .core-line {
        font-size: clamp(18px, 4vw, 22px);
    }
}

@media (max-width: 480px) {
    body { font-size: 16px; }
    .threshold__title { font-size: clamp(48px, 14vw, 72px); }
    .chamber__plane { padding: 44px 18px; }
}

/* ==========================================================================
   PROGRESS-DRIVEN BACKGROUND BLEND
   ========================================================================== */

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: linear-gradient(180deg,
        var(--c-obsidian) 0%,
        var(--c-aubergine) 50%,
        var(--c-obsidian) 100%
    );
    opacity: calc(var(--chamber-progress) * 0.85);
    pointer-events: none;
    z-index: 0;
    transition: opacity 1200ms var(--ease-corridor);
}
