/* ===================================================
   MonkHOOD - Ancient Monastery Pixel Sanctuary Theme

   Google Fonts are loaded once, via <link> in index.html.
   Do NOT add an @import here — it duplicates the request and
   defeats the preconnect hints in the document head.
   =================================================== */

:root {
    --bg-dark: #080C09;
    --parchment: #F4E8D1;
    --parchment-dark: #2A2118;
    --monk-gold: #FFD700;
    --robinhood-green: #00FF88;
    --robinhood-glow: rgba(0, 255, 136, 0.4);
    --border-pixel: #4A3A2C;

    /* Font stacks. Family names carry ONE level of quoting only — the previous
       '"Press Start 2P"' double-wrapping produced a string that matched no font. */
    --font-heading: 'Cinzel', serif;
    --font-pixel: 'Press Start 2P', monospace;
    --font-mono: 'JetBrains Mono', monospace;
    --font-ui: 'Plus Jakarta Sans', sans-serif;
}

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

html, body {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    background-color: var(--bg-dark);
    color: #F3F4F6;
    font-family: var(--font-ui);
    -webkit-font-smoothing: antialiased;
}

body.modal-open {
    overflow: hidden;
}

/* Keyboard escape hatch past the decorative header */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 100;
    padding: 10px 16px;
    background: var(--robinhood-green);
    color: #040906;
    font-weight: 700;
    font-size: 13px;
    border-radius: 0 0 6px 0;
}
.skip-link:focus {
    left: 0;
}

/* Scenic Background Image Layer with Atmospheric Depth */
.monastery-bg-layer {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    background: url('monastery_bg.jpg') center top / cover no-repeat;
    opacity: 0.85;
    z-index: 1;
    filter: brightness(0.88) contrast(1.05);
    pointer-events: none;
}

/* Subtle Vignette & Mist */
.monastery-vignette {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at 50% 50%, rgba(4, 9, 6, 0.2) 0%, rgba(4, 9, 6, 0.85) 100%);
    z-index: 2;
    pointer-events: none;
}

#sanctuary-3d-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    z-index: 3;
    pointer-events: none;
}

/* Canvases injected by three-scene.js */
.sanctuary-layer {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}
.sanctuary-layer--webgl { z-index: 1; }
.sanctuary-layer--pixel { z-index: 2; image-rendering: pixelated; }

/* Shared treatment for the pixel-art portraits (was repeated inline; inline styles
   are also blocked under a strict style-src CSP). */
.pixel-face {
    image-rendering: pixelated;
    object-position: center 25%;
}

/* ===================================================
   ANCIENT PIXEL BORDERS & FRAMES
   =================================================== */

.pixel-border-box {
    background: rgba(14, 18, 15, 0.88);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 2px solid #5A432E;
    box-shadow: 0 0 0 2px #1C120C, 0 15px 40px rgba(0, 0, 0, 0.8), inset 0 0 20px rgba(0, 255, 136, 0.04);
    border-radius: 6px;
}

.scroll-banner {
    background: #EEDCC4;
    color: #2D1E12;
    border: 2px solid #5A432E;
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.15), 0 8px 25px rgba(0, 0, 0, 0.5);
    border-radius: 4px;
}

/* Grand Hero Monk Pedestal */
.grand-monk-pedestal {
    background: radial-gradient(circle at 50% 50%, rgba(0, 255, 136, 0.12) 0%, rgba(10, 15, 12, 0.92) 80%);
    border: 2px solid #5A432E;
    box-shadow: 0 0 35px rgba(0, 255, 136, 0.25), inset 0 0 25px rgba(0, 0, 0, 0.85);
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

.grand-monk-img {
    filter: drop-shadow(0 0 20px rgba(0, 255, 136, 0.45));
    transition: transform 0.3s ease;
}

.grand-monk-img:hover {
    transform: scale(1.05);
}

.halo-slow-spin {
    animation-duration: 25s;
}

/* ===================================================
   RETRO MONASTIC NAVIGATION TABS
   =================================================== */

.monk-nav-btn {
    background: rgba(30, 22, 16, 0.85);
    border: 2px solid #5A432E;
    box-shadow: 0 0 0 1px #1C120C;
    color: #D6C2A6;
    font-size: 11px;
    font-weight: 700;
    padding: 7px 11px;
    border-radius: 4px;
    transition: all 0.2s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;      /* keep labels intact in the mobile scroll strip */
    white-space: nowrap;
}

/* The tab strip scrolls on mobile; a visible scrollbar there is just noise. */
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.no-scrollbar::-webkit-scrollbar {
    display: none;
}

.monk-nav-btn:hover {
    background: #4A3320;
    color: #FFFFFF;
    border-color: var(--robinhood-green);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 255, 136, 0.25);
}

.monk-nav-btn.active {
    background: #00FF88;
    color: #040906;
    border-color: #FFFFFF;
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.5);
    font-weight: 800;
}

/* Primary Consecrate CTA Button */
.consecrate-cta-btn {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #00FF88 0%, #00CC66 100%);
    color: #040906;
    font-weight: 800;
    font-size: 13px;
    border: 2px solid #FFFFFF;
    border-radius: 6px;
    box-shadow: 0 0 25px var(--robinhood-glow), 0 6px 15px rgba(0, 0, 0, 0.6);
    transition: all 0.2s ease;
    cursor: pointer;
}

.consecrate-cta-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 0 35px rgba(0, 255, 136, 0.6);
    filter: brightness(1.08);
}

.consecrate-cta-btn:active:not(:disabled) {
    transform: scale(0.98);
}

/* Disabled is a real, readable state — not a dead green button. */
.consecrate-cta-btn:disabled,
.consecrate-cta-btn.is-disabled {
    background: linear-gradient(135deg, #33413A 0%, #232C27 100%);
    color: #9CA3AF;
    border-color: #4B5563;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
    filter: none;
}

/* Quantity Preset Pills */
.qty-pill {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #D1D5DB;
    transition: all 0.15s ease;
    cursor: pointer;
}

.qty-pill:hover {
    background: rgba(0, 255, 136, 0.15);
    color: #00FF88;
    border-color: rgba(0, 255, 136, 0.4);
}

.qty-pill.active {
    background: #00FF88;
    color: #040906;
    border-color: #FFFFFF;
    font-weight: 800;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

/* ===================================================
   FOCUS VISIBILITY (was absent entirely)
   =================================================== */

:focus-visible {
    outline: 3px solid var(--robinhood-green);
    outline-offset: 2px;
    border-radius: 4px;
}

.scroll-banner :focus-visible {
    outline-color: #1A5336;
}

/* ===================================================
   LOADING / PENDING DATA
   =================================================== */

.is-loading {
    color: #9CA3AF !important;
    animation: dataPulse 1.6s ease-in-out infinite;
}

@keyframes dataPulse {
    0%, 100% { opacity: 0.45; }
    50% { opacity: 0.9; }
}

/* Screen Transitions */
.chamber-screen {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.chamber-screen.hidden-screen {
    display: none;
}

.chamber-screen.active-screen {
    display: block;
    animation: satoriFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.reveal-badge {
    animation: revealBounce 1s ease-in-out infinite;
}

@keyframes revealBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

/* Custom Scrollbar */
.custom-scroll::-webkit-scrollbar {
    width: 4px;
}
.custom-scroll::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}
.custom-scroll::-webkit-scrollbar-thumb {
    background: #00FF88;
    border-radius: 2px;
}
.custom-scroll {
    scrollbar-width: thin;
    scrollbar-color: #00FF88 rgba(0, 0, 0, 0.2);
}

/* ===================================================
   REDUCED MOTION
   The 3D engine is not even constructed when this is set (see app.js), and it
   stops itself if the preference changes at runtime. This handles the CSS side.
   =================================================== */

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

    .monk-nav-btn:hover,
    .consecrate-cta-btn:hover:not(:disabled),
    .grand-monk-img:hover {
        transform: none;
    }

    .is-loading {
        animation: none;
        opacity: 0.7;
    }

    #sanctuary-3d-canvas {
        display: none;
    }
}
