/* nfth.ing - A Museum of Digital Things */
/* Color Palette:
   Slate Ink:       #1e1e28  (bg primary)
   Archive Parchment: #f0ebe3 (bg secondary)
   Faded Teal:      #5e8a8f  (headline cool)
   Dusty Amber:     #c4956a  (headline warm)
   Aged Linen:      #e8e2d8  (body light)
   Museum Charcoal: #2a2a32  (body dark)
   Muted Gold:      #b8a07a  (accent primary)
   Aurora Rose:     #a3707a  (accent secondary)
   Phosphor Green:  #6a9e7e  (accent tertiary)
   Violet Shadow:   #14141e  (shadow/depth)
*/

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    background-color: #1e1e28;
    color: #e8e2d8;
    font-family: 'Libre Baskerville', Georgia, serif;
    font-weight: 400;
    font-size: 1.05rem;
    line-height: 1.85;
    overflow-x: hidden;
}

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

.chamber {
    position: relative;
    min-height: 100vh;
    padding: 6rem 5%;
    overflow: hidden;
}

/* ========================================
   AURORA CURTAIN - HERO BACKGROUND
   ======================================== */

.aurora-curtain {
    position: absolute;
    inset: 0;
    z-index: 0;
    opacity: 0.1;
    background:
        radial-gradient(ellipse 80% 60% at 20% 30%, #5e8a8f 0%, transparent 60%),
        radial-gradient(ellipse 60% 80% at 70% 60%, #6a9e7e 0%, transparent 50%),
        radial-gradient(ellipse 70% 50% at 50% 80%, #a3707a 0%, transparent 55%),
        radial-gradient(ellipse 50% 70% at 80% 20%, #c4956a 0%, transparent 45%);
    background-size: 200% 200%, 250% 250%, 200% 200%, 300% 300%;
    animation:
        auroraShift1 15s ease-in-out infinite alternate,
        auroraShift2 20s ease-in-out infinite alternate-reverse,
        auroraShift3 25s ease-in-out infinite alternate;
}

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

@keyframes auroraShift2 {
    0% { opacity: 0.08; }
    50% { opacity: 0.12; }
    100% { opacity: 0.08; }
}

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

/* ========================================
   VESTIBULE (HERO)
   ======================================== */

.chamber-vestibule {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 0;
    background-color: #1e1e28;
}

.vestibule-content {
    position: relative;
    z-index: 1;
    text-align: center;
}

.vestibule-title {
    font-family: 'Roboto Slab', 'Georgia', serif;
    font-weight: 700;
    font-size: clamp(4rem, 10vw, 8rem);
    letter-spacing: 0.08em;
    color: #5e8a8f;
    text-transform: uppercase;
    line-height: 1.1;
    margin-bottom: 1.5rem;
}

.vestibule-subtitle {
    font-family: 'IBM Plex Mono', 'Courier New', monospace;
    font-weight: 400;
    font-size: clamp(0.8rem, 1.5vw, 1rem);
    letter-spacing: 0.12em;
    color: #b8a07a;
    text-transform: uppercase;
    opacity: 0;
    animation: fadeInSubtitle 1.5s ease-in-out 1.2s forwards;
}

@keyframes fadeInSubtitle {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}

.scroll-arrow {
    position: absolute;
    bottom: 3rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1;
    animation: pulseArrow 3s ease-in-out infinite;
}

@keyframes pulseArrow {
    0%, 100% { opacity: 0.4; transform: translateX(-50%) translateY(0); }
    50% { opacity: 0.9; transform: translateX(-50%) translateY(8px); }
}

.iso-arrow {
    display: block;
}

/* ========================================
   FLOOR TILE DIVIDER
   ======================================== */

.floor-tile-divider {
    height: 4px;
    margin: 0 10%;
    position: relative;
    background: linear-gradient(90deg, #5e8a8f, #6a9e7e, #a3707a, #c4956a, #b8a07a, #5e8a8f);
    background-size: 300% 100%;
    animation: borderColorCycle 8s ease-in-out infinite;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
    clip-path: polygon(0% 50%, 2% 0%, 4% 50%, 6% 0%, 8% 50%, 10% 0%, 12% 50%, 14% 0%, 16% 50%, 18% 0%, 20% 50%, 22% 0%, 24% 50%, 26% 0%, 28% 50%, 30% 0%, 32% 50%, 34% 0%, 36% 50%, 38% 0%, 40% 50%, 42% 0%, 44% 50%, 46% 0%, 48% 50%, 50% 0%, 52% 50%, 54% 0%, 56% 50%, 58% 0%, 60% 50%, 62% 0%, 64% 50%, 66% 0%, 68% 50%, 70% 0%, 72% 50%, 74% 0%, 76% 50%, 78% 0%, 80% 50%, 82% 0%, 84% 50%, 86% 0%, 88% 50%, 90% 0%, 92% 50%, 94% 0%, 96% 50%, 98% 0%, 100% 50%, 98% 100%, 96% 50%, 94% 100%, 92% 50%, 90% 100%, 88% 50%, 86% 100%, 84% 50%, 82% 100%, 80% 50%, 78% 100%, 76% 50%, 74% 100%, 72% 50%, 70% 100%, 68% 50%, 66% 100%, 64% 50%, 62% 100%, 60% 50%, 58% 100%, 56% 50%, 54% 100%, 52% 50%, 50% 100%, 48% 50%, 46% 100%, 44% 50%, 42% 100%, 40% 50%, 38% 100%, 36% 50%, 34% 100%, 32% 50%, 30% 100%, 28% 50%, 26% 100%, 24% 50%, 22% 100%, 20% 50%, 18% 100%, 16% 50%, 14% 100%, 12% 50%, 10% 100%, 8% 50%, 6% 100%, 4% 50%, 2% 100%);
}

.floor-tile-divider.visible {
    opacity: 0.6;
}

@keyframes borderColorCycle {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ========================================
   CHAMBER GRID LAYOUTS (Z-PATTERN)
   ======================================== */

.chamber-grid {
    display: grid;
    gap: 4rem;
    max-width: 1400px;
    margin: 0 auto;
    align-items: start;
}

.z-sweep-1 {
    grid-template-columns: 5fr 2fr 5fr;
}

.z-sweep-1 .diorama {
    grid-column: 1 / 2;
}

.z-sweep-1 .chamber-text {
    grid-column: 3 / 4;
}

.z-sweep-2 {
    grid-template-columns: 5fr 2fr 5fr;
}

.z-sweep-2 .chamber-text {
    grid-column: 1 / 2;
}

.z-sweep-2 .diorama {
    grid-column: 3 / 4;
}

.z-sweep-gallery {
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
}

.gallery-vitrine {
    grid-column: 1 / 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 3rem;
    min-height: 500px;
}

.gallery-text-wrapper {
    grid-column: 2 / 3;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* ========================================
   BORDER-ANIMATE PANELS
   ======================================== */

.border-animate-panel {
    position: relative;
    padding: 2.5rem;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-in-out, transform 0.8s ease-in-out;
}

.border-animate-panel.visible {
    opacity: 1;
    transform: translateY(0);
}

.border-animate-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    border: 1px solid transparent;
    background: linear-gradient(#1e1e28, #1e1e28) padding-box,
                linear-gradient(var(--border-angle, 0deg), #5e8a8f, #6a9e7e, #a3707a, #c4956a, #b8a07a) border-box;
    animation: borderRotate 8s linear infinite;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1.2s ease-in-out 0.3s;
}

.border-animate-panel.visible::before {
    opacity: 1;
}

@property --border-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

@keyframes borderRotate {
    0% { --border-angle: 0deg; }
    100% { --border-angle: 360deg; }
}

/* Fallback for browsers without @property */
@supports not (background: paint(something)) {
    .border-animate-panel::before {
        background: linear-gradient(#1e1e28, #1e1e28) padding-box,
                    linear-gradient(45deg, #5e8a8f, #6a9e7e, #a3707a, #c4956a, #b8a07a, #5e8a8f) border-box;
        background-size: 100% 100%, 300% 300%;
        animation: borderSweepFallback 8s ease-in-out infinite;
    }

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

/* ========================================
   TYPOGRAPHY
   ======================================== */

.chamber-heading {
    font-family: 'Roboto Slab', 'Georgia', serif;
    font-weight: 700;
    font-size: clamp(2.4rem, 5vw, 4.8rem);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #5e8a8f;
    margin-bottom: 2rem;
    line-height: 1.15;
}

.chamber-heading.heading-warm {
    color: #c4956a;
}

.exhibit-text {
    display: flex;
    gap: 1.2rem;
    margin-bottom: 1.5rem;
    align-items: flex-start;
}

.exhibit-text p {
    color: #e8e2d8;
    font-family: 'Libre Baskerville', Georgia, serif;
    font-weight: 400;
    font-size: 1.05rem;
    line-height: 1.85;
}

.exhibit-label {
    display: block;
    font-family: 'IBM Plex Mono', 'Courier New', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    color: #b8a07a;
    text-transform: uppercase;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(184, 160, 122, 0.2);
}

/* ========================================
   ISOMETRIC BULLET CUBES
   ======================================== */

.iso-bullet {
    flex-shrink: 0;
    width: 18px;
    height: 20px;
    margin-top: 0.4rem;
    position: relative;
}

.iso-bullet::before {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    top: 0;
    left: 0;
    border-left: 9px solid transparent;
    border-right: 9px solid transparent;
    border-bottom: 5px solid #5e8a8f;
}

.iso-bullet::after {
    content: '';
    position: absolute;
    top: 5px;
    left: 0;
    width: 9px;
    height: 10px;
    background: #14141e;
    transform: skewY(25deg);
    transform-origin: top left;
    border-right: 9px solid #c4956a;
}

/* ========================================
   DIORAMA ILLUSTRATIONS
   ======================================== */

.diorama {
    display: flex;
    align-items: center;
    justify-content: center;
}

.diorama svg {
    width: 100%;
    height: auto;
    max-width: 400px;
}

/* Press handle animation (triggered by visible) */
.diorama-mint.visible .press-handle {
    animation: pressDown 4s ease-in-out infinite;
    transform-origin: 40px 0px;
}

@keyframes pressDown {
    0%, 100% { transform: rotate(0deg); }
    40% { transform: rotate(-15deg); }
    60% { transform: rotate(-15deg); }
}

/* Minted tokens slide out */
.diorama-mint .minted-tokens .token-cube {
    opacity: 0;
    transition: opacity 0.6s ease-in-out, transform 0.6s ease-in-out;
}

.diorama-mint.visible .token-1 {
    opacity: 1;
    animation: slideOutToken 4s ease-in-out infinite;
}

.diorama-mint.visible .token-2 {
    opacity: 1;
    animation: slideOutToken 4s ease-in-out 0.3s infinite;
}

.diorama-mint.visible .token-3 {
    opacity: 1;
    animation: slideOutToken 4s ease-in-out 0.6s infinite;
}

@keyframes slideOutToken {
    0%, 30% { opacity: 0; transform: translateX(-20px); }
    50% { opacity: 1; transform: translateX(0); }
    80%, 100% { opacity: 1; transform: translateX(0); }
}

/* Chain archive drawer animations */
.diorama-chain .open-drawer {
    opacity: 0;
    transform: translateX(0);
    transition: opacity 0.8s ease-in-out 0.4s, transform 0.8s ease-in-out 0.4s;
}

.diorama-chain.visible .open-drawer {
    opacity: 1;
    transform: translateX(-15px);
}

/* Cabinet sequential reveal */
.diorama-chain .cabinet {
    opacity: 0;
    transition: opacity 0.6s ease-in-out;
}

.diorama-chain.visible .cabinet-1 {
    opacity: 1;
    transition-delay: 0s;
}

.diorama-chain.visible .cabinet-2 {
    opacity: 0.85;
    transition-delay: 0.2s;
}

.diorama-chain.visible .cabinet-3 {
    opacity: 0.65;
    transition-delay: 0.4s;
}

.diorama-chain.visible .cabinet-4 {
    opacity: 0.45;
    transition-delay: 0.6s;
}

/* ========================================
   GALLERY VITRINE
   ======================================== */

.spotlight-cone {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 300px;
    background: conic-gradient(from 250deg at 50% 0%, transparent 0deg, rgba(184, 160, 122, 0.06) 10deg, rgba(184, 160, 122, 0.12) 20deg, rgba(184, 160, 122, 0.06) 30deg, transparent 40deg);
    animation: spotlightPulse 6s ease-in-out infinite;
    pointer-events: none;
}

@keyframes spotlightPulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

.gem-token {
    width: 180px;
    height: 180px;
    animation: gemRotate 30s linear infinite;
    position: relative;
    z-index: 1;
}

@keyframes gemRotate {
    0% { transform: rotateY(0deg); }
    100% { transform: rotateY(360deg); }
}

.vitrine-label {
    margin-top: 2rem;
    text-align: center;
}

/* ========================================
   REFLECTION TEXT
   ======================================== */

.reflection {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-style: italic;
    font-size: 1.05rem;
    line-height: 1.85;
    color: #e8e2d8;
    opacity: 0.85;
}

.reflection-text {
    background-color: rgba(240, 235, 227, 0.03);
}

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

.compass-nav {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 0;
}

.compass-rose {
    cursor: pointer;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 2;
}

.compass-rose:hover {
    transform: scale(1.1);
}

.compass-svg {
    display: block;
    filter: drop-shadow(0 2px 8px rgba(20, 20, 30, 0.6));
}

.compass-links {
    position: absolute;
    bottom: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-10px);
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1), transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding-right: 70px;
    padding-bottom: 5px;
}

.compass-nav:hover .compass-links,
.compass-nav.active .compass-links {
    opacity: 1;
    pointer-events: all;
    transform: translateX(0);
}

.compass-link {
    font-family: 'IBM Plex Mono', 'Courier New', monospace;
    font-weight: 400;
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    color: #b8a07a;
    text-decoration: none;
    text-transform: uppercase;
    padding: 0.25rem 0.6rem;
    background-color: rgba(30, 30, 40, 0.9);
    border: 1px solid rgba(184, 160, 122, 0.3);
    white-space: nowrap;
    transition: color 0.3s ease-in-out, border-color 0.3s ease-in-out;
}

.compass-link:hover {
    color: #a3707a;
    border-color: #a3707a;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 900px) {
    .chamber {
        padding: 4rem 4%;
    }

    .z-sweep-1,
    .z-sweep-2 {
        grid-template-columns: 1fr;
    }

    .z-sweep-1 .diorama,
    .z-sweep-1 .chamber-text,
    .z-sweep-2 .chamber-text,
    .z-sweep-2 .diorama {
        grid-column: 1 / -1;
    }

    .z-sweep-gallery {
        grid-template-columns: 1fr;
    }

    .gallery-vitrine,
    .gallery-text-wrapper {
        grid-column: 1 / -1;
    }

    .floor-tile-divider {
        margin: 0 5%;
    }
}

@media (max-width: 600px) {
    .vestibule-title {
        letter-spacing: 0.04em;
    }

    .chamber-heading {
        font-size: clamp(1.8rem, 8vw, 3rem);
    }

    .border-animate-panel {
        padding: 1.5rem;
    }

    .compass-nav {
        bottom: 1rem;
        right: 1rem;
    }

    .exhibit-text {
        gap: 0.8rem;
    }
}

/* ========================================
   PREFERS REDUCED MOTION
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    .aurora-curtain,
    .floor-tile-divider,
    .border-animate-panel::before,
    .diorama-mint .press-handle,
    .diorama-mint .token-cube,
    .gem-token,
    .spotlight-cone,
    .scroll-arrow {
        animation: none;
    }

    .vestibule-subtitle {
        animation: none;
        opacity: 1;
    }

    .border-animate-panel {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .diorama-chain .cabinet,
    .diorama-chain .open-drawer {
        opacity: 1;
        transform: none;
        transition: none;
    }
}
