/* ============================================
   layer2.quest — styles.css
   Cinematic zen meditation on architectural depth
   ============================================ */

/* Palette: #120F24 #1A1E3A #2E3466 */
/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background: linear-gradient(180deg, #0a0a14 0%, #0d1117 100%);
    background-attachment: fixed;
    color: #c8cad4;
    font-family: 'Libre Franklin', sans-serif;
    font-weight: 300;
    cursor: default;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* --- Progress Indicator --- */
.progress-track {
    position: fixed;
    right: 16px;
    top: 10vh;
    bottom: 10vh;
    width: 2px;
    background: rgba(42, 42, 74, 0.3);
    z-index: 100;
    border-radius: 1px;
}

.progress-fill {
    width: 100%;
    background: linear-gradient(180deg, #2a2a4a, #6e7bff);
    border-radius: 1px;
    height: 0%;
    transition: height 0.3s ease-out;
}

/* --- Depth Particles --- */
.depth-particles {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: rgba(110, 123, 255, 0.06);
    border-radius: 50%;
    animation: particleRise linear infinite;
}

.particle:nth-child(1)  { left: 5%;  bottom: -10px; animation-duration: 28s; animation-delay: 0s; }
.particle:nth-child(2)  { left: 12%; bottom: -10px; animation-duration: 34s; animation-delay: 2s; }
.particle:nth-child(3)  { left: 22%; bottom: -10px; animation-duration: 30s; animation-delay: 5s; }
.particle:nth-child(4)  { left: 30%; bottom: -10px; animation-duration: 26s; animation-delay: 1s; }
.particle:nth-child(5)  { left: 38%; bottom: -10px; animation-duration: 32s; animation-delay: 8s; }
.particle:nth-child(6)  { left: 45%; bottom: -10px; animation-duration: 29s; animation-delay: 3s; }
.particle:nth-child(7)  { left: 53%; bottom: -10px; animation-duration: 35s; animation-delay: 6s; }
.particle:nth-child(8)  { left: 60%; bottom: -10px; animation-duration: 27s; animation-delay: 10s; }
.particle:nth-child(9)  { left: 68%; bottom: -10px; animation-duration: 31s; animation-delay: 4s; }
.particle:nth-child(10) { left: 75%; bottom: -10px; animation-duration: 33s; animation-delay: 7s; }
.particle:nth-child(11) { left: 82%; bottom: -10px; animation-duration: 28s; animation-delay: 12s; }
.particle:nth-child(12) { left: 88%; bottom: -10px; animation-duration: 36s; animation-delay: 9s; }
.particle:nth-child(13) { left: 15%; bottom: -10px; animation-duration: 30s; animation-delay: 14s; }
.particle:nth-child(14) { left: 35%; bottom: -10px; animation-duration: 25s; animation-delay: 11s; }
.particle:nth-child(15) { left: 50%; bottom: -10px; animation-duration: 33s; animation-delay: 16s; }
.particle:nth-child(16) { left: 65%; bottom: -10px; animation-duration: 29s; animation-delay: 13s; }
.particle:nth-child(17) { left: 78%; bottom: -10px; animation-duration: 31s; animation-delay: 15s; }
.particle:nth-child(18) { left: 92%; bottom: -10px; animation-duration: 27s; animation-delay: 18s; }

@keyframes particleRise {
    0%   { transform: translateY(0); opacity: 0; }
    10%  { opacity: 1; }
    90%  { opacity: 1; }
    100% { transform: translateY(-110vh); opacity: 0; }
}

/* --- Layer Sections --- */
.layer {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    z-index: 1;
}

/* --- Void Gap (80vh between layers) --- */
.void-gap {
    height: 80vh;
    position: relative;
    display: flex;
    align-items: center;
    z-index: 1;
}

.void-gap--final {
    height: 30vh;
}

.stratum-line {
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(110, 123, 255, 0.15) 30%, rgba(110, 123, 255, 0.15) 70%, transparent 100%);
}

/* --- Layer Numerals --- */
.layer-numeral {
    position: absolute;
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: clamp(8rem, 15vw, 18rem);
    color: rgba(110, 123, 255, 0.04);
    z-index: -1;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    line-height: 1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.6s ease-out;
}

.layer-numeral.visible {
    opacity: 1;
}

.layer-numeral--amber {
    color: rgba(212, 168, 83, 0.06);
}

/* --- Glass Cards --- */
.glass-card {
    background: rgba(26, 30, 58, 0.55);
    backdrop-filter: blur(24px) saturate(1.3);
    -webkit-backdrop-filter: blur(24px) saturate(1.3);
    border: 1px solid rgba(110, 123, 255, 0.12);
    border-radius: 16px;
    box-shadow: 0 40px 80px rgba(18, 15, 36, 0.6), 0 8px 24px rgba(0, 0, 0, 0.3);
    padding: clamp(2rem, 4vw, 3.5rem);
    max-width: clamp(320px, 38vw, 520px);
    position: relative;
    transform: perspective(1200px) rotateX(4deg) rotateY(-2deg);
    transition: transform 1.2s cubic-bezier(0.22, 1, 0.36, 1),
                backdrop-filter 0.6s ease,
                border-color 0.6s ease,
                opacity 1.5s ease-out;
    opacity: 0;
}

.glass-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(110, 123, 255, 0.05) 0%, transparent 60%);
    pointer-events: none;
}

.glass-card.revealed {
    opacity: 1;
    transform: perspective(1200px) rotateX(0deg) rotateY(0deg);
}

.glass-card:hover {
    backdrop-filter: blur(32px) saturate(1.3);
    -webkit-backdrop-filter: blur(32px) saturate(1.3);
    border-color: rgba(110, 123, 255, 0.25);
}

/* Card positioning — zigzag */
.glass-card--left {
    margin-left: clamp(8vw, 12vw, 20vw);
}

.glass-card--right {
    margin-left: clamp(45vw, 55vw, 65vw);
}

/* --- Amber Card --- */
.glass-card--amber {
    border-color: rgba(212, 168, 83, 0.2);
}

.glass-card--amber:hover {
    border-color: rgba(212, 168, 83, 0.35);
}

/* --- Typography --- */
.title-main {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: clamp(3rem, 6vw, 5.5rem);
    color: #e2e4f0;
    letter-spacing: 0.06em;
    line-height: 1.15;
    margin-bottom: 1rem;
}

.heading {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: clamp(2.5rem, 5vw, 5rem);
    color: #e2e4f0;
    letter-spacing: 0.06em;
    line-height: 1.15;
    margin-bottom: 1.2rem;
}

.heading--amber {
    color: #d4a853;
}

.body-text {
    font-family: 'Libre Franklin', sans-serif;
    font-weight: 300;
    font-size: clamp(0.95rem, 1.1vw, 1.15rem);
    line-height: 1.85;
    letter-spacing: 0.01em;
    color: #c8cad4;
    max-width: 38ch;
}

.subtitle-mono,
.label-mono {
    font-family: 'DM Mono', monospace;
    font-weight: 300;
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #4a5080;
    margin-bottom: 0.75rem;
}

.label-mono--amber {
    color: #d4a853;
}

/* --- Text reveal animation --- */
.glass-card .heading,
.glass-card .body-text,
.glass-card .label-mono {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.glass-card.revealed .label-mono {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.2s;
}

.glass-card.revealed .heading {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.35s;
}

.glass-card.revealed .body-text {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.5s;
}

/* --- Layer 0 special: card focuses in --- */
#card0 {
    opacity: 0;
    backdrop-filter: blur(0px) saturate(1);
    -webkit-backdrop-filter: blur(0px) saturate(1);
    transform: perspective(1200px) rotateX(0deg) rotateY(0deg);
}

#card0.focused {
    opacity: 1;
    backdrop-filter: blur(24px) saturate(1.3);
    -webkit-backdrop-filter: blur(24px) saturate(1.3);
    transition: opacity 1.5s ease-out, backdrop-filter 1.5s ease-out, -webkit-backdrop-filter 1.5s ease-out;
}

#card0 .title-main,
#card0 .subtitle-mono {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

#card0.focused .title-main {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.5s;
}

#card0.focused .subtitle-mono {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.8s;
}

/* --- Amber background shift --- */
body.amber-shift {
    background: linear-gradient(180deg, #0a0a14 0%, #14100a 100%);
    transition: background 2s ease;
}

body {
    transition: background 2s ease;
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .glass-card,
    .glass-card .heading,
    .glass-card .body-text,
    .glass-card .label-mono,
    #card0,
    #card0 .title-main,
    #card0 .subtitle-mono,
    .layer-numeral {
        opacity: 1 !important;
        transform: none !important;
    }

    .particle {
        display: none;
    }
}
