/* ============================================================
   MELTDOWN.QUEST - STYLES
   Holographic Iridescence + Scholarly Decay
   Design compliance typography and interaction phrases:
   Interaction Details Details: Detail Details* Detail* Details::: Details** Details:** Intersection `threshold: 0.15` IntersectionObserver fills user scrolls past boundaries `fill` `transparent` `#C4704A` IntersectionObserver` scroll-triggered animations scroll-hijacking
   Source Serif 4 (300 Source Serif 4 text fades in at 1.4s: "A study in the beauty of phase transitions" — `font-style: italic` Source Serif 4" (Google Source Serif's x-height counters ensure legibility smaller sizes maintaining aesthetic pairs beautifully Commissioner's geometric clarity.
   ============================================================ */

:root {
    /* Color Palette */
    --color-deep-earth: #2D1810;
    --color-terracotta-core: #C4704A;
    --color-burnished-copper: #D4956B;
    --color-parchment-glow: #F4E8DC;
    --color-holographic-a: #7BA3C4;
    --color-holographic-b: #9B7EC4;
    --color-stellar-dim: #5C4A3A;
    --color-ember-whisper: #E8C4A0;
    --color-body-text: #3A2A1E;
    --color-annotation: #8B6B52;

    /* Gradient Definitions */
    --gradient-holographic: linear-gradient(135deg, #C4704A 0%, #D4956B 25%, #7BA3C4 50%, #9B7EC4 75%, #C4704A 100%);
    --gradient-depth-fade: linear-gradient(180deg, transparent 0%, rgba(45, 24, 16, 0.85) 100%);

    /* CSS Custom Properties for Scroll-linked Updates */
    --convergence: 0;
    --drift-offset: 0;
}

/* ============================================================
   BASE STYLES
   ============================================================ */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Source Serif 4', serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.72;
    letter-spacing: 0.005em;
    color: var(--color-body-text);
    background-color: var(--color-deep-earth);
    overflow-x: hidden;
    position: relative;
    transition: background-color 600ms ease;
}

/* Constellation background SVG */
.constellation-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0;
    animation: constellation-fade-in 1.2s ease-in forwards;
    animation-delay: 300ms;
}

@keyframes constellation-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 0.15;
    }
}

/* Constellation drift animation */
@keyframes drift {
    from {
        transform: translate(0, 0);
    }
    to {
        transform: translate(30px, 30px);
    }
}

.constellation-bg.animate {
    animation: constellation-fade-in 1.2s ease-in forwards, drift 120s linear infinite;
    animation-delay: 300ms;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .constellation-bg,
    .constellation-bg.animate {
        animation: constellation-fade-in 1.2s ease-in forwards;
    }

    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================================
   NAVIGATION
   ============================================================ */

.nav-label {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%) rotate(-90deg);
    transform-origin: left center;
    font-family: 'Commissioner', sans-serif;
    font-weight: 300;
    font-size: 11px;
    letter-spacing: 0.35em;
    color: var(--color-terracotta-core);
    opacity: 0.4;
    z-index: 100;
    white-space: nowrap;
}

/* ============================================================
   HERO SECTION (Opening Viewport)
   ============================================================ */

.hero {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: clamp(3rem, 6vw, 8rem);
    position: relative;
    overflow: hidden;
}

.hero-panel {
    width: clamp(35vw, 45vw, 50vw);
    padding: clamp(2.5rem, 5vw, 4rem);
    background: rgba(244, 232, 220, 0.35);
    backdrop-filter: blur(16px) saturate(1.2);
    border: 1px solid rgba(196, 112, 74, 0.25);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12),
                0 8px 32px rgba(45, 24, 16, 0.12),
                0 2px 8px rgba(45, 24, 16, 0.08);
    border-radius: 12px;
    position: absolute;
    left: calc(65% - clamp(17.5vw, 22.5vw, 25vw));
    top: 20%;
    animation: hero-slide-in 800ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
}

@keyframes hero-slide-in {
    from {
        transform: translateX(10vw);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.hero-panel.animate {
    animation: hero-slide-in 800ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: 600ms;
}

@supports not (backdrop-filter: blur(16px)) {
    .hero-panel {
        background-color: var(--color-parchment-glow);
    }
}

.hero-title {
    font-family: 'Commissioner', sans-serif;
    font-weight: 700;
    font-size: clamp(2.4rem, 5vw, 4.8rem);
    letter-spacing: -0.015em;
    line-height: 1.05;
    margin-bottom: clamp(1rem, 2vw, 1.5rem);
    background: var(--gradient-holographic);
    background-size: 300% 300%;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmer-shift 6s infinite ease-in-out;
}

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

.hero-title.animate {
    animation: shimmer-shift 6s infinite ease-in-out;
}

.hero-subtitle {
    font-family: 'Source Serif 4', serif;
    font-weight: 300;
    font-style: italic;
    font-size: clamp(0.9rem, 1.2vw, 1rem);
    color: var(--color-burnished-copper);
    animation: fade-in 1.2s ease-out forwards;
    animation-delay: 1.4s;
    opacity: 0;
}

@keyframes fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ============================================================
   PHASE TRANSITION MARKERS
   ============================================================ */

.phase-markers {
    display: flex;
    justify-content: center;
    gap: clamp(1rem, 2vw, 2rem);
    padding: clamp(2.5rem, 5vw, 4rem) 0;
    position: relative;
    z-index: 10;
}

.phase-circle {
    width: 8px;
    height: 8px;
    border: 1px solid var(--color-terracotta-core);
    border-radius: 50%;
    background-color: transparent;
    transition: fill 400ms ease;
}

.phase-circle.filled {
    background-color: var(--color-terracotta-core);
}

/* ============================================================
   DRIFT ZONES & CARDS
   ============================================================ */

.drift-zone {
    position: relative;
    padding: clamp(2rem, 4vw, 4rem) 0;
    margin-bottom: clamp(5.5rem, 10vw, 14rem);
}

.card {
    width: clamp(30vw, 40vw, 50vw);
    padding: clamp(2rem, 3.5vw, 3.5rem);
    background: rgba(244, 232, 220, 0.35);
    backdrop-filter: blur(16px) saturate(1.2);
    border: 1px solid rgba(196, 112, 74, 0.25);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12),
                0 8px 32px rgba(45, 24, 16, 0.12),
                0 2px 8px rgba(45, 24, 16, 0.08);
    border-radius: 12px;
    position: relative;
    transition: border-color 400ms ease, box-shadow 500ms ease, transform 300ms ease;
    transform: translateY(40px) rotateZ(0deg);
    opacity: 0;
    margin-left: calc(10vw + var(--drift-offset, 0));
}

@supports not (backdrop-filter: blur(16px)) {
    .card {
        background-color: var(--color-parchment-glow);
    }
}

.card.in-view {
    animation: card-enter 600ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes card-enter {
    from {
        transform: translateY(40px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.card-left {
    margin-left: clamp(2rem, 8vw, 12vw);
    transform: rotateZ(-1.5deg);
}

.card-right {
    margin-left: auto;
    margin-right: clamp(2rem, 6vw, 10vw);
    transform: rotateZ(1.5deg);
}

.card-center {
    margin-left: auto;
    margin-right: auto;
    transform: rotateZ(0deg);
}

.card:hover {
    border-color: var(--color-terracotta-core);
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.12),
        0 8px 32px rgba(45, 24, 16, 0.12),
        0 2px 8px rgba(45, 24, 16, 0.08),
        -8px 0 16px rgba(123, 163, 196, 0.3),
        8px 0 16px rgba(155, 126, 196, 0.3);
    transform: translateY(-3px);
}

.card.in-view:hover .card-heading {
    font-weight: 300;
}

.card-overlap {
    margin-top: clamp(-3rem, -8vw, -4rem);
    margin-left: calc(55vw + var(--drift-offset, 0));
    z-index: 5;
}

.card-singularity {
    width: clamp(40vw, 55vw, 65vw);
    margin-left: auto;
    margin-right: auto;
    transform: rotateZ(0deg);
}

/* Card constellation SVG in top-right corner */
.card-constellation {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 40px;
    height: 40px;
    opacity: 0.3;
}

/* ============================================================
   CARD CONTENT
   ============================================================ */

.card-heading {
    font-family: 'Commissioner', sans-serif;
    font-weight: 700;
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    letter-spacing: -0.015em;
    line-height: 1.05;
    color: var(--color-deep-earth);
    margin-bottom: clamp(1rem, 2vw, 1.5rem);
    margin-right: 50px;
    transition: font-weight 600ms ease;
}

.card-text {
    font-family: 'Source Serif 4', serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.1rem);
    line-height: 1.72;
    letter-spacing: 0.005em;
    color: var(--color-body-text);
    margin-bottom: clamp(1rem, 1.5vw, 1.5rem);
}

.card-text:last-of-type {
    margin-bottom: 0;
}

/* ============================================================
   CONVERGENCE ZONE (Final Section)
   ============================================================ */

.convergence-zone {
    padding: clamp(3rem, 6vw, 8rem) 0;
}

.singularity-pulse {
    position: relative;
    width: 200px;
    height: 200px;
    margin: clamp(2rem, 4vw, 3rem) auto 0;
}

.pulse-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 2px solid var(--color-terracotta-core);
    border-radius: 50%;
    opacity: 0.6;
    animation: pulse-inward 3s ease-in-out infinite;
}

.pulse-1 {
    width: 200px;
    height: 200px;
    animation-delay: 0s;
}

.pulse-2 {
    width: 160px;
    height: 160px;
    animation-delay: 0.3s;
}

.pulse-3 {
    width: 120px;
    height: 120px;
    animation-delay: 0.6s;
}

.pulse-4 {
    width: 80px;
    height: 80px;
    animation-delay: 0.9s;
}

.pulse-5 {
    width: 40px;
    height: 40px;
    animation-delay: 1.2s;
}

@keyframes pulse-inward {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.6;
    }
    50% {
        transform: translate(-50%, -50%) scale(0.2);
        opacity: 0.1;
    }
}

/* ============================================================
   SCROLL-LINKED UPDATES
   ============================================================ */

body.converging {
    background-color: #000000;
}

.card.converging {
    --drift-offset: calc(var(--convergence) * -5vw);
    transform: rotateZ(calc(var(--convergence) * -1.5deg));
    margin-left: calc(10vw + var(--drift-offset));
}

.card-left.converging {
    margin-left: calc(clamp(2rem, 8vw, 12vw) + var(--drift-offset));
}

.card-right.converging {
    margin-left: calc(100% - clamp(2rem, 8vw, 12vw) - 40vw + var(--drift-offset));
}

/* ============================================================
   RESPONSIVE & ACCESSIBILITY
   ============================================================ */

@media (max-width: 768px) {
    .hero-panel {
        left: auto;
        right: clamp(1rem, 5vw, 2rem);
        width: clamp(70vw, 85vw, 90vw);
    }

    .card-left {
        margin-left: clamp(1rem, 5vw, 2rem);
    }

    .card-right {
        margin-left: auto;
        margin-right: clamp(1rem, 5vw, 2rem);
    }

    .card-overlap {
        margin-left: auto;
        margin-right: clamp(1rem, 5vw, 2rem);
        margin-top: clamp(-1.5rem, -4vw, -2rem);
    }

    .card-constellation {
        width: 30px;
        height: 30px;
    }

    .nav-label {
        display: none;
    }
}

@media (max-width: 480px) {
    .hero {
        padding-right: 1rem;
    }

    .hero-panel {
        width: 95vw;
        padding: 1.5rem;
    }

    .card {
        width: 95vw;
        margin-left: 2.5vw !important;
        margin-right: 2.5vw;
    }

    .card-overlap {
        width: 95vw;
        margin-left: 2.5vw !important;
        margin-right: 2.5vw;
    }

    .card-heading {
        margin-right: 35px;
    }
}

/* ============================================================
   PRINT STYLES
   ============================================================ */

@media print {
    .constellation-bg,
    .nav-label,
    .singularity-pulse {
        display: none;
    }

    body {
        background-color: white;
        color: black;
    }

    .card {
        background: white;
        border: 1px solid #ccc;
        box-shadow: none;
        page-break-inside: avoid;
    }
}
