/* ============================================================================
   Xanadu.quest - Muji-Glitch Pastoral CSS
   ========================================================================== */

:root {
    /* Color Palette */
    --phantom-lavender: #e0d1f0;
    --drowned-mint: #c8e6df;
    --fever-rose: #f2cfd4;
    --wisteria-mist: #c4a7d7;
    --fog: #8b9eaa;
    --deep-current: #2a2438;
    --abyssal-teal: #1e2a2e;
    --bone-silk: #f7f3f0;
    --glitch-coral: #ff8a80;
    --frosted-border: #b8c6db;
    --iridescent-shimmer: #d4b8e0;

    /* Typography */
    --font-outfit: 'Outfit', sans-serif;
    --font-garamond: 'Cormorant Garamond', serif;
    --font-mono: 'DM Mono', monospace;

    /* Animation */
    --scroll-weight: 200;
}

/* ============================================================================
   Global Reset
   ========================================================================== */

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

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

body {
    font-family: var(--font-outfit), sans-serif;
    background: #f7f3f0;
    color: #2a2438;
    overflow-x: hidden;
    position: relative;
}

/* ============================================================================
   Bubble Field (Background Layer)
   ========================================================================== */

.bubble-field {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: -1;
    opacity: 0.15;
    pointer-events: none;
}

/* ============================================================================
   Opening Chamber - Full Viewport Entry
   ========================================================================== */

.opening-chamber {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100vh;
    background: linear-gradient(180deg, #f0e6f6 0%, #e6f2f0 100%);
    position: relative;
    overflow: hidden;
}

.opening-chamber::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, #f0e6f6 0%, #e6f2f0 100%);
    animation: subtle-drift 30s ease-in-out infinite;
    z-index: -1;
}

.chamber-content {
    text-align: center;
    z-index: 1;
}

.hero-title {
    font-family: var(--font-outfit);
    font-size: clamp(2.8rem, 7vw, 6rem);
    font-weight: 100;
    letter-spacing: 0.04em;
    opacity: 0.3;
    animation: hero-materialize 3s cubic-bezier(0.23, 1, 0.32, 1) forwards;
    line-height: 1.2;
}

.hero-tagline {
    font-family: var(--font-garamond);
    font-size: clamp(1rem, 1.8vw, 1.35rem);
    font-style: italic;
    letter-spacing: 0.01em;
    color: var(--wisteria-mist);
    line-height: 1.6;
    margin-top: 2rem;
    opacity: 0;
    animation: tagline-fade 0.8s ease-in-out 2s forwards;
    max-width: 80%;
    margin-left: auto;
    margin-right: auto;
}

.chevron-down {
    position: absolute;
    bottom: 3rem;
    left: 50%;
    transform: translateX(-50%);
    color: var(--wisteria-mist);
    animation: chevron-pulse 2s ease-in-out infinite 2.5s;
    opacity: 0;
}

/* ============================================================================
   Vitrine Grid Section
   ========================================================================== */

.vitrines-section {
    padding: 4rem 2rem;
    position: relative;
    z-index: 2;
    background: #f7f3f0;
}

.vitrines-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* Vitrine Base Styling */
.vitrine {
    background: rgba(247, 243, 240, 0.95);
    border: 1px solid var(--frosted-border);
    border-radius: 0;
    padding: 2rem;
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 600ms cubic-bezier(0.23, 1, 0.32, 1),
                transform 600ms cubic-bezier(0.23, 1, 0.32, 1);
    position: relative;
    overflow: hidden;
}

.vitrine.in-view {
    opacity: 1;
    transform: translateY(0);
}

/* Grid sizing */
.vitrine-wide {
    grid-column: span 6;
}

.vitrine-tall {
    grid-column: span 4;
    grid-row: span 2;
}

.vitrine-medium {
    grid-column: span 6;
}

/* Vitrine content */
.vitrine-content {
    position: relative;
    z-index: 1;
}

.vitrine-title {
    font-family: var(--font-outfit);
    font-size: clamp(1.1rem, 2vw, 1.6rem);
    font-weight: 300;
    letter-spacing: 0.04em;
    margin-bottom: 1rem;
    font-variation-settings: 'wght' var(--scroll-weight);
    transition: font-variation-settings 100ms ease-out;
}

.vitrine-text {
    font-family: var(--font-outfit);
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    font-weight: 400;
    line-height: 1.72;
    color: #2a2438;
    margin-bottom: 1.5rem;
}

.vitrine-text.serif {
    font-family: var(--font-garamond);
    font-style: italic;
    color: var(--wisteria-mist);
    font-size: clamp(1rem, 1.8vw, 1.35rem);
}

/* Hover effect */
.vitrine:hover {
    filter: hue-rotate(15deg);
}

.vitrine:hover .vitrine-text {
    text-shadow: 1px 0 var(--glitch-coral);
}

/* Iridescent border animation */
.vitrine::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--phantom-lavender), var(--drowned-mint),
                var(--fever-rose), var(--wisteria-mist), var(--iridescent-shimmer));
    background-size: 300% 100%;
    animation: shimmer 12s linear infinite;
    opacity: 0.8;
}

/* SVG Artifacts */
.svg-artifact {
    margin-top: 1.5rem;
    min-height: 80px;
}

/* Responsive */
@media (max-width: 768px) {
    .vitrines-grid {
        grid-template-columns: 1fr;
    }

    .vitrine-wide,
    .vitrine-tall,
    .vitrine-medium {
        grid-column: 1;
        grid-row: auto;
    }

    .vitrine-tall {
        grid-row: auto;
    }
}

/* ============================================================================
   Terminal Pool (Final Section)
   ========================================================================== */

.terminal-pool {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100vh;
    background: linear-gradient(180deg, var(--deep-current) 0%, var(--abyssal-teal) 100%);
    position: relative;
    overflow: hidden;
}

.pool-content {
    text-align: center;
    z-index: 2;
}

.center-bubble {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 300px;
    height: 300px;
    border: 2px solid var(--wisteria-mist);
    border-radius: 50%;
    animation: bubble-pulse 4s ease-in-out infinite;
}

.pool-message {
    font-family: var(--font-garamond);
    font-size: clamp(1.1rem, 2vw, 1.5rem);
    font-style: italic;
    color: var(--bone-silk);
    line-height: 1.6;
    letter-spacing: 0.01em;
}

.pool-subtitle {
    font-family: var(--font-garamond);
    font-size: clamp(0.95rem, 1.5vw, 1.1rem);
    font-style: italic;
    color: var(--phantom-lavender);
    margin-top: 1rem;
    opacity: 0.8;
}

/* ============================================================================
   Navigation Bubble Cluster
   ========================================================================== */

.bubble-nav {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 1000;
}

.bubble-cluster {
    position: relative;
    width: 50px;
    height: 50px;
}

.nav-bubble {
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--wisteria-mist);
    border: none;
    cursor: pointer;
    opacity: 0.5;
    transition: all 300ms cubic-bezier(0.23, 1, 0.32, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    animation: bubble-breathe 3s ease-in-out infinite;
}

.nav-bubble:hover {
    opacity: 1;
    transform: scale(1.3);
}

.nav-bubble:nth-child(1) {
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    animation-delay: 0s;
}

.nav-bubble:nth-child(2) {
    top: 15px;
    right: 5px;
    animation-delay: 0.4s;
}

.nav-bubble:nth-child(3) {
    top: 30px;
    right: -10px;
    animation-delay: 0.8s;
}

.nav-bubble:nth-child(4) {
    bottom: 5px;
    right: 10px;
    animation-delay: 1.2s;
}

.nav-bubble:nth-child(5) {
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    animation-delay: 1.6s;
}

.bubble-label {
    font-family: var(--font-mono);
    font-size: 0.5rem;
    font-weight: 400;
    letter-spacing: 0.18em;
    color: var(--bone-silk);
    opacity: 0;
    transition: opacity 300ms ease-out;
    pointer-events: none;
}

.nav-bubble:hover .bubble-label {
    opacity: 1;
}

/* ============================================================================
   Glitch Overlay
   ========================================================================== */

.glitch-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--glitch-coral);
    display: none;
    z-index: 999;
    pointer-events: none;
    box-shadow: 0 0 20px var(--glitch-coral);
}

.glitch-overlay.active {
    display: block;
    animation: glitch-flash 100ms ease-out;
}

/* ============================================================================
   Animations
   ========================================================================== */

@keyframes hero-materialize {
    0% {
        opacity: 0.3;
        font-weight: 100;
    }
    100% {
        opacity: 1;
        font-weight: 400;
    }
}

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

@keyframes chevron-pulse {
    0%, 100% {
        opacity: 0.3;
        transform: translateX(-50%) translateY(0);
    }
    50% {
        opacity: 1;
        transform: translateX(-50%) translateY(6px);
    }
}

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

@keyframes bubble-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
}

@keyframes bubble-breathe {
    0%, 100% {
        transform: scale(0.95);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes glitch-flash {
    0% {
        opacity: 0.6;
    }
    100% {
        opacity: 0;
    }
}

@keyframes subtle-drift {
    0%, 100% {
        background: linear-gradient(180deg, #f0e6f6 0%, #e6f2f0 100%);
    }
    50% {
        background: linear-gradient(200deg, #f0e6f6 0%, #e6f2f0 100%);
    }
}

/* Bubble rise animations */
@keyframes rise1 {
    to {
        transform: translateY(-150px) translateX(20px);
    }
}

@keyframes rise2 {
    to {
        transform: translateY(-150px) translateX(-15px);
    }
}

@keyframes rise3 {
    to {
        transform: translateY(-150px) translateX(30px);
    }
}

@keyframes rise4 {
    to {
        transform: translateY(-150px) translateX(-25px);
    }
}

@keyframes rise5 {
    to {
        transform: translateY(-150px) translateX(10px);
    }
}

@keyframes rise6 {
    to {
        transform: translateY(-150px) translateX(-35px);
    }
}

@keyframes rise7 {
    to {
        transform: translateY(-150px) translateX(25px);
    }
}

@keyframes rise8 {
    to {
        transform: translateY(-150px) translateX(-20px);
    }
}

/* ============================================================================
   Typography System - Responsive & Variable Weight
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-outfit);
    font-weight: 300;
    line-height: 1.3;
}

p {
    line-height: 1.72;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .hero-title {
        font-size: clamp(1.8rem, 5vw, 3rem);
    }

    .vitrines-section {
        padding: 2rem 1rem;
    }

    .vitrines-grid {
        gap: 1rem;
    }

    .vitrine {
        padding: 1.5rem;
    }

    .bubble-nav {
        top: 1rem;
        right: 1rem;
    }

    .center-bubble {
        width: 200px;
        height: 200px;
    }
}

/* ============================================================================
   Accessibility
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Focus states for keyboard navigation */
button:focus-visible {
    outline: 2px solid var(--phantom-lavender);
    outline-offset: 2px;
}

a:focus-visible {
    outline: 2px solid var(--phantom-lavender);
    outline-offset: 2px;
}
