/* =============================================
   XANADU.QUEST - Cyberpunk Marble Palace
   ============================================= */

:root {
    --primary-dark: #1a1a2e;
    --secondary-dark: #16213e;
    --marble-white: #e8e4df;
    --muted-rose: #c9a9a6;
    --faded-teal: #7ba0a8;
    --neon-peach: #e8956a;
    --shadow-plum: #3d2c4e;
    --hue-shift: 0deg;
    --cell-gap: 6px;
}

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    line-height: 1.65;
    color: var(--marble-white);
    background: linear-gradient(180deg, var(--primary-dark) 0%, var(--secondary-dark) 50%, var(--shadow-plum) 100%);
    background-attachment: fixed;
    overflow-x: hidden;
    min-height: 100vh;
    padding-left: 32px;
    padding-bottom: 80px;
}

/* =============================================
   GRAIN OVERLAY
   ============================================= */
#grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

/* =============================================
   CONSTELLATION CANVAS
   ============================================= */
#constellation-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
}

/* =============================================
   SIDEBAR GLYPHS
   ============================================= */
#sidebar-glyphs {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    z-index: 100;
    padding: 8px 0;
}

.glyph-indicator {
    width: 16px;
    height: 16px;
    color: var(--muted-rose);
    opacity: 0.4;
    cursor: pointer;
    transition: opacity 0.3s ease, color 0.3s ease, transform 0.3s ease;
}

.glyph-indicator.active {
    opacity: 1;
    color: var(--neon-peach);
    transform: scale(1.2);
}

.glyph-indicator:hover {
    opacity: 0.8;
}

/* =============================================
   ROOMS (Sections)
   ============================================= */
.room {
    min-height: 100vh;
    padding: 48px 24px 48px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    filter: hue-rotate(var(--hue-shift));
    transition: filter 0.8s ease;
}

/* =============================================
   BENTO GRID SYSTEM
   ============================================= */
.bento-grid {
    display: grid;
    gap: var(--cell-gap);
    width: 100%;
    max-width: 1200px;
}

/* Hero Grid */
.bento-hero {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(60vh, auto);
}

/* Discovery Grid - 4 columns */
.bento-discovery {
    grid-template-columns: 2fr 1fr 1.5fr 1fr;
    grid-template-rows: auto auto;
    grid-template-areas:
        "about about quote quote"
        "about about stat1 stat2";
}

.bento-discovery .cell-lg { grid-area: about; }
.bento-discovery .cell-md { grid-area: quote; }
.bento-discovery #cell-stat-1 { grid-area: stat1; }
.bento-discovery #cell-stat-2 { grid-area: stat2; }

/* Galleries Grid */
.bento-galleries {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: auto 1fr 1fr auto;
    grid-template-areas:
        "gheader gheader gheader gheader"
        "g1 g1 g2 g2"
        "g1 g1 g3 g3"
        "g4 g4 g4 g4";
}

.bento-galleries #cell-gallery-header { grid-area: gheader; }
.bento-galleries #cell-gallery-1 { grid-area: g1; }
.bento-galleries #cell-gallery-2 { grid-area: g2; }
.bento-galleries #cell-gallery-3 { grid-area: g3; }
.bento-galleries #cell-gallery-4 { grid-area: g4; }

/* Journey Grid */
.bento-journey {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    grid-template-areas:
        "j1 j2"
        "jcta jcta";
}

.bento-journey #cell-journey-1 { grid-area: j1; }
.bento-journey #cell-journey-2 { grid-area: j2; }
.bento-journey #cell-journey-cta { grid-area: jcta; }

/* Sanctum Grid */
.bento-sanctum {
    grid-template-columns: 2fr 1fr 1fr;
    grid-template-rows: auto auto;
    grid-template-areas:
        "comm signal coord"
        "closing closing closing";
}

.bento-sanctum #cell-community { grid-area: comm; }
.bento-sanctum #cell-signal { grid-area: signal; }
.bento-sanctum #cell-coordinates { grid-area: coord; }
.bento-sanctum #cell-closing { grid-area: closing; }

/* =============================================
   BENTO CELLS
   ============================================= */
.bento-cell {
    background: var(--secondary-dark);
    border-radius: 16px;
    padding: 32px;
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateY(24px);
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.bento-cell.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Partial borders - 2-3 sides only */
.bento-cell::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 16px;
    pointer-events: none;
    z-index: 1;
}

.bento-cell:nth-child(odd)::before {
    border-top: 1px solid var(--muted-rose);
    border-left: 1px solid var(--muted-rose);
    border-bottom: 1px solid var(--muted-rose);
}

.bento-cell:nth-child(even)::before {
    border-top: 1px solid var(--muted-rose);
    border-right: 1px solid var(--muted-rose);
    border-bottom: 1px solid var(--muted-rose);
}

/* Corner ornaments */
.bento-cell::after {
    content: '';
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--muted-rose);
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
    z-index: 2;
}

.bento-cell:nth-child(odd)::after {
    top: 8px;
    left: 8px;
}

.bento-cell:nth-child(even)::after {
    top: 8px;
    right: 8px;
}

/* =============================================
   MARBLE TEXTURES (Pure CSS)
   ============================================= */
.marble-swirl {
    background:
        radial-gradient(ellipse at 20% 50%, rgba(232, 228, 223, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(201, 169, 166, 0.06) 0%, transparent 40%),
        radial-gradient(circle at 60% 80%, rgba(232, 228, 223, 0.05) 0%, transparent 30%),
        var(--secondary-dark);
    background-size: 200% 200%;
    background-position: 0% 0%;
    transition: background-position 0.8s ease;
}

.marble-swirl:hover {
    background-position: 5% 5%;
}

.marble-streaks {
    background:
        linear-gradient(75deg, transparent 40%, rgba(232, 228, 223, 0.07) 45%, transparent 50%),
        linear-gradient(75deg, transparent 60%, rgba(201, 169, 166, 0.05) 63%, transparent 66%),
        linear-gradient(75deg, transparent 75%, rgba(232, 228, 223, 0.06) 77%, transparent 80%),
        var(--secondary-dark);
    background-size: 200% 200%;
    background-position: 0% 0%;
    transition: background-position 0.8s ease;
}

.marble-streaks:hover {
    background-position: 3% 3%;
}

.marble-crackle {
    background:
        radial-gradient(circle at 30% 40%, rgba(232, 228, 223, 0.09) 0%, transparent 20%),
        radial-gradient(circle at 70% 60%, rgba(201, 169, 166, 0.07) 0%, transparent 25%),
        radial-gradient(circle at 50% 20%, rgba(232, 228, 223, 0.04) 0%, transparent 15%),
        radial-gradient(circle at 20% 80%, rgba(201, 169, 166, 0.06) 0%, transparent 18%),
        var(--secondary-dark);
    background-size: 200% 200%;
    background-position: 0% 0%;
    transition: background-position 0.8s ease;
}

.marble-crackle:hover {
    background-position: 4% 4%;
}

/* =============================================
   TYPOGRAPHY
   ============================================= */
h1, h2, h3 {
    font-family: 'Fredoka', sans-serif;
    letter-spacing: -0.02em;
}

h1 {
    font-weight: 600;
    font-size: clamp(2.5rem, 6vw, 5rem);
    line-height: 1.1;
}

h2 {
    font-weight: 600;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    margin-bottom: 16px;
}

h3 {
    font-weight: 500;
    font-size: clamp(1.1rem, 2vw, 1.4rem);
    margin-bottom: 8px;
}

p {
    margin-bottom: 12px;
    color: rgba(232, 228, 223, 0.85);
}

p:last-child {
    margin-bottom: 0;
}

blockquote {
    font-family: 'Fredoka', sans-serif;
    font-weight: 500;
    font-size: clamp(1.1rem, 2vw, 1.5rem);
    font-style: italic;
    line-height: 1.5;
    color: var(--muted-rose);
    position: relative;
    padding-left: 24px;
}

blockquote cite {
    display: block;
    font-size: 0.8rem;
    font-style: normal;
    color: var(--faded-teal);
    margin-top: 12px;
    font-family: 'IBM Plex Mono', monospace;
    letter-spacing: 0.08em;
}

/* Display title with neon stroke */
.display-title {
    font-family: 'Fredoka', sans-serif;
    font-weight: 700;
}

.neon-stroke {
    -webkit-text-stroke: 1px var(--neon-peach);
    color: transparent;
}

/* Cell label (technical tag) */
.cell-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.72rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--faded-teal);
    display: block;
    margin-bottom: 12px;
}

/* Meta tag */
.meta-tag {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: var(--muted-rose);
    display: flex;
    align-items: center;
    gap: 8px;
}

.mono-text {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 1.2rem;
    letter-spacing: 0.08em;
    color: var(--marble-white);
    line-height: 1.8;
}

.neon-accent {
    color: var(--neon-peach);
}

/* =============================================
   DIAMOND BULLET
   ============================================= */
.diamond-bullet {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--muted-rose);
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
    flex-shrink: 0;
}

/* =============================================
   HERO SECTION
   ============================================= */
.hero-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 60vh;
}

.hero-content {
    position: relative;
    z-index: 2;
}

.hero-subtitle {
    font-family: 'Nunito', sans-serif;
    font-size: clamp(1rem, 2vw, 1.4rem);
    color: var(--muted-rose);
    margin-top: 16px;
    margin-bottom: 24px;
}

/* =============================================
   STAT DISPLAY
   ============================================= */
.stat-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
}

.stat-number {
    font-family: 'Fredoka', sans-serif;
    font-weight: 700;
    font-size: 3rem;
    color: var(--neon-peach);
    line-height: 1;
    display: block;
    margin-bottom: 8px;
}

.stat-desc {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--faded-teal);
}

/* =============================================
   GALLERY CARDS
   ============================================= */
.gallery-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.gallery-card.horizontal {
    flex-direction: row;
    align-items: center;
    gap: 24px;
}

.octagon-icon {
    margin-bottom: 16px;
    flex-shrink: 0;
}

.gallery-card.horizontal .octagon-icon {
    margin-bottom: 0;
}

/* =============================================
   JOURNEY STEPS
   ============================================= */
.journey-steps {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.step {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.step-number {
    font-family: 'Fredoka', sans-serif;
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--neon-peach);
    -webkit-text-stroke: 1px var(--neon-peach);
    min-width: 36px;
    text-align: center;
    flex-shrink: 0;
}

/* =============================================
   CTA AMBIENT
   ============================================= */
.cta-ambient {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    padding: 24px 0;
}

.geometric-divider {
    display: flex;
    align-items: center;
    gap: 12px;
}

.divider-line {
    width: 60px;
    height: 1px;
    background: var(--muted-rose);
    opacity: 0.4;
}

.ambient-text {
    font-family: 'Fredoka', sans-serif;
    font-weight: 500;
    font-size: clamp(1.1rem, 2.5vw, 1.6rem);
    color: var(--marble-white);
    text-align: center;
}

/* =============================================
   SIGNAL BLOCK
   ============================================= */
.signal-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 16px;
    text-align: center;
}

/* =============================================
   CLOSING MESSAGE
   ============================================= */
.closing-message {
    text-align: center;
    padding: 32px 0;
}

.closing-title {
    font-size: clamp(1.8rem, 4vw, 3.5rem);
    margin-bottom: 12px;
}

.closing-sub {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85rem;
    letter-spacing: 0.08em;
    color: var(--faded-teal);
}

/* =============================================
   PULSE ANIMATION
   ============================================= */
@keyframes pulse-attention {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(232, 149, 106, 0);
    }
    50% {
        transform: scale(1.03);
        box-shadow: 0 0 24px 8px rgba(232, 149, 106, 0.4);
    }
}

.pulse-active {
    animation: pulse-attention 3s ease-in-out infinite;
}

/* =============================================
   TEXT REVEAL
   ============================================= */
.text-reveal p {
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.text-reveal p.revealed {
    opacity: 1;
}

/* =============================================
   BOTTOM DOCK NAVIGATION
   ============================================= */
#bottom-dock {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
}

.dock-container {
    display: flex;
    gap: 8px;
    padding: 10px 20px;
    background: rgba(26, 26, 46, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 32px;
    border: 1px solid rgba(201, 169, 166, 0.2);
}

.dock-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 14px;
    border: none;
    background: transparent;
    color: var(--marble-white);
    cursor: pointer;
    border-radius: 24px;
    transition: background 0.3s ease, color 0.3s ease, transform 0.3s ease;
}

.dock-item:hover {
    background: rgba(123, 160, 168, 0.15);
    transform: translateY(-2px);
}

.dock-item.active {
    background: var(--neon-peach);
    color: var(--primary-dark);
}

.dock-item.active .dock-label {
    color: var(--primary-dark);
}

.dock-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.6rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted-rose);
    transition: color 0.3s ease;
}

/* =============================================
   RESPONSIVE: Tablet (2-column)
   ============================================= */
@media (max-width: 900px) {
    body {
        padding-left: 0;
    }

    #sidebar-glyphs {
        display: none;
    }

    .room {
        padding: 32px 16px;
    }

    .bento-discovery {
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "about about"
            "quote stat1"
            "stat2 stat2";
    }

    .bento-galleries {
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "gheader gheader"
            "g1 g2"
            "g1 g3"
            "g4 g4";
    }

    .bento-journey {
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "j1 j2"
            "jcta jcta";
    }

    .bento-sanctum {
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "comm comm"
            "signal coord"
            "closing closing";
    }
}

/* =============================================
   RESPONSIVE: Mobile (single-column)
   ============================================= */
@media (max-width: 600px) {
    .bento-discovery,
    .bento-galleries,
    .bento-journey,
    .bento-sanctum {
        grid-template-columns: 1fr;
        grid-template-areas: none;
    }

    .bento-discovery .cell-lg,
    .bento-discovery .cell-md,
    .bento-discovery #cell-stat-1,
    .bento-discovery #cell-stat-2,
    .bento-galleries #cell-gallery-header,
    .bento-galleries #cell-gallery-1,
    .bento-galleries #cell-gallery-2,
    .bento-galleries #cell-gallery-3,
    .bento-galleries #cell-gallery-4,
    .bento-journey #cell-journey-1,
    .bento-journey #cell-journey-2,
    .bento-journey #cell-journey-cta,
    .bento-sanctum #cell-community,
    .bento-sanctum #cell-signal,
    .bento-sanctum #cell-coordinates,
    .bento-sanctum #cell-closing {
        grid-area: auto;
    }

    .bento-cell {
        box-shadow: inset 0 0 0 2px rgba(201, 169, 166, 0.1);
        padding: 24px;
    }

    .room {
        min-height: auto;
        padding: 24px 12px;
    }

    .dock-container {
        padding: 8px 12px;
        gap: 4px;
    }

    .dock-item {
        padding: 6px 10px;
    }

    .dock-label {
        font-size: 0.5rem;
    }

    .gallery-card.horizontal {
        flex-direction: column;
    }

    .gallery-card.horizontal .octagon-icon {
        margin-bottom: 16px;
    }
}
