/* ═══════════════════════════════════════════════════════
   JURA — GLOBAL FOUNDATION & ROUTING ENGINE
   1. Root Variables & Global Physics
   2. The Stationary Window & Viewport Mask
   3. Navigation & Typography
   4. Environmental Lighting & Fluid Canvas
   5. Dynamic Contrast Engine
   6. Viewport Isolation & Tab Routing
   7. Global Elements (Buttons, Iridescence, Hero)
═══════════════════════════════════════════════════════ */

/* ── 1. ROOT VARIABLES & GLOBAL PHYSICS ── */
:root {
    --light-x: 50vw;
    --light-y: 50vh;
    --light-color: rgba(0,0,0,0);
}

html {
    background-color: #000000; 
}

body {
    margin: 0;
    padding: 0;
    height: 100vh; /* Locks the body height */
    background-color: transparent; 
    overflow: hidden; /* Kills default body scroll so the stationary window can take over */
    font-family: 'Epilogue', sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* ── 2. THE STATIONARY WINDOW & VIEWPORT MASK ── */
#global-scroller {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    
    /* The Absolute Magnetic Lock */
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;

    /* The Composite Optical Mask: 
       Layer 1: The fade effect stopping exactly 16px from the right edge.
       Layer 2: A solid visibility corridor protecting the scrollbar. */
    -webkit-mask-image: 
        linear-gradient(to bottom, transparent 0%, transparent 12vh, rgba(0,0,0,0.1) 15vh, black 25vh, black 100%),
        linear-gradient(to right, black, black);
    -webkit-mask-size: 
        calc(100% - 16px) 100%, 
        16px 100%;
    -webkit-mask-position: 
        left top, 
        right top;
    -webkit-mask-repeat: 
        no-repeat, 
        no-repeat;

    mask-image: 
        linear-gradient(to bottom, transparent 0%, transparent 12vh, rgba(0,0,0,0.1) 15vh, black 25vh, black 100%),
        linear-gradient(to right, black, black);
    mask-size: 
        calc(100% - 16px) 100%, 
        16px 100%;
    mask-position: 
        left top, 
        right top;
    mask-repeat: 
        no-repeat, 
        no-repeat;
}

/* ── 3. NAVIGATION & TYPOGRAPHY ── */
nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 1.8rem 3.5rem; /* Expanded slightly to balance breathing room */
    display: grid;
    grid-template-columns: 1fr auto 1fr; 
    align-items: center;
    box-sizing: border-box;
    z-index: 1000;
    pointer-events: none; 
}

.nav-left { display: flex; justify-content: flex-start; pointer-events: auto; }
.nav-center { display: flex; justify-content: center; pointer-events: auto; }
.nav-right { display: flex; justify-content: flex-end; align-items: center; pointer-events: auto; }

.nav-links {
    display: flex;
    flex-direction: row; 
    gap: 4rem;
}

.brand-container {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* The Base Nav Text (Time and Brand) */
.nav-text {
    font-family: 'Cormorant Garamond', Georgia, serif;
    color: #888888;
    transition: color 0.4s ease, transform 0.4s ease;
    margin: 0;
    padding: 0;
    border: none;
    background: none;
    cursor: default;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.9), 0 0 20px rgba(0, 0, 0, 0.7);
}

/* The Functional Tabs (Clean, sharp sans-serif) */
button.nav-text {
    font-family: 'Montserrat', -apple-system, sans-serif;
    font-size: 0.75rem; 
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    cursor: pointer;
}

button.nav-text:hover, button.nav-text.active {
    color: #EAEAEA; 
    transform: translateY(-2px); 
}

.clock-display {
    font-size: 1rem; 
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-variant-numeric: tabular-nums;
}

.brand-text {
    font-size: 1.1rem; 
    text-transform: uppercase;
    letter-spacing: 0.25em;
    color: #EAEAEA;
}

/* ── 4. ENVIRONMENTAL LIGHTING & FLUID CANVAS ── */
#ambient-light {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -5; /* Dropped below 0 to eradicate foreground stacking contexts */
    background: radial-gradient(circle at var(--light-x) var(--light-y), var(--light-color) 0%, transparent 100%);
    mix-blend-mode: screen; 
    transition: background 2s ease-out;
}

#unicorn-void {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: -10; 
    pointer-events: none; 
    opacity: 0.9; 
    transform-origin: center center;
    will-change: transform, filter;
    /* The Contrast Forcer: Polarizes the fluid to eliminate the mid-grey blind spots */
    filter: contrast(160%) brightness(0.8);
}

#unicorn-void.shockwave {
    animation: void-shockwave 1.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes void-shockwave {
    0%   { transform: scale(1); filter: contrast(160%) brightness(0.8); }
    10%  { transform: scale(1.03); filter: contrast(200%) brightness(1.4); }
    100% { transform: scale(1); filter: contrast(160%) brightness(0.8); }
}

/* ── 5. DYNAMIC CONTRAST ENGINE ── */
/* JS-driven colour flip for light backgrounds */
html[data-bg-brightness="light"] .nav-text,
html[data-bg-brightness="light"] #live-clock {
    color: #111111;
    text-shadow: 0 0 10px rgba(255,255,255,0.8), 0 0 20px rgba(255,255,255,0.6);
    transition: color 0.5s ease, text-shadow 0.5s ease;
}

html[data-bg-brightness="light"] .brand-text {
    color: #111111;
}

html[data-bg-brightness="light"] button.nav-text:hover,
html[data-bg-brightness="light"] button.nav-text.active {
    color: #000000;
}

html[data-bg-brightness="light"] .welcome-title {
    color: #111111;
}

html[data-bg-brightness="light"] .welcome-subtitle {
    color: #111111;
    text-shadow: 0 0 6px rgba(255, 255, 255, 1), 0 0 18px rgba(255, 255, 255, 0.8);
}

/* Layered shadow halo for body/context text only */
.vault-content p,
.matrix-item p {
    text-shadow: 0 0 6px rgba(0, 0, 0, 1), 0 0 18px rgba(0, 0, 0, 0.9), 0 0 36px rgba(0, 0, 0, 0.7);
}

/* ── 6. VIEWPORT ISOLATION & TAB ROUTING ── */
body[data-active-tab="join"] #center-stage,
body[data-active-tab="join"] #features-apparatus,
body[data-active-tab="join"] #monolith-apparatus,
body[data-active-tab="membership"] #center-stage,
body[data-active-tab="membership"] #features-apparatus,
body[data-active-tab="membership"] #monolith-apparatus {
    display: none !important;
}

body:not([data-active-tab="join"]) #join-apparatus {
    display: none !important;
}

body:not([data-active-tab="membership"]) #membership-apparatus {
    display: none !important;
}

/* The Void Purge */
body.tab-isolated #center-stage,
body.tab-isolated #features-apparatus,
body.tab-isolated #monolith-apparatus,
body.tab-isolated #join-apparatus,
body.tab-isolated #membership-apparatus {
    display: none !important;
}

/* ── 7. GLOBAL ELEMENTS (Buttons, Iridescence, Hero) ── */
#center-stage {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start; 
    padding: 0 max(5vw, 4rem);
    box-sizing: border-box;
    scroll-snap-align: center; /* Anchors the Hero */
}

.welcome-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    max-width: 900px; 
    gap: 1.5rem;
}

.welcome-title {
    font-family: 'Epilogue', sans-serif;
    font-size: clamp(4rem, 8vw, 80px);
    font-weight: 200;
    line-height: 1.1;
    letter-spacing: -0.04em;
    color: #FFFFFF;
    margin: 0;
    opacity: 0; 
}

.welcome-subtitle {
    font-family: 'Inter', sans-serif; 
    font-size: clamp(1rem, 1.5vw, 18px);
    font-weight: 400; 
    line-height: 1.6;
    color: #ffffff; 
    max-width: 42rem;
    opacity: 0; 
    margin: 0;
    text-shadow: 0 0 6px rgba(0, 0, 0, 1), 0 0 18px rgba(0, 0, 0, 0.9), 0 0 38px rgba(0, 0, 0, 0.7);
}

@keyframes cinematic-text-up {
    from { opacity: 0; transform: translateY(40px); filter: blur(8px); }
    to   { opacity: 1; transform: translateY(0); filter: blur(0); }
}

.iridescent-brand, .text-gradient, .text-hl {
    background-image: 
        radial-gradient(circle at 50% 50%, #C4B5D4 0%, transparent 55%),
        radial-gradient(circle at 50% 50%, #4D638C 0%, transparent 60%),
        linear-gradient(135deg, #A2B9E7 0%, #4D638C 50%, #A2B9E7 100%);
    background-size: 250% 250%, 250% 250%, 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: liquid-iridescence 8s ease-in-out infinite alternate;
}

.text-gradient {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 400; 
    display: block; 
}

.text-hl {
    font-weight: 600;
    text-shadow: transparent 0 0 0 !important; 
    filter: drop-shadow(0 0 0 transparent) !important;
}

.iridescent-brand {
    display: inline-block;
    font-weight: 400;
}

.iridescent-brand sup { 
    font-size: 0.5em; 
    vertical-align: super; 
    line-height: 0; 
    margin-left: 0.05em; 
}

@keyframes liquid-iridescence {
    0%   { background-position: 0% 0%,    100% 100%, 0% 0%; }
    33%  { background-position: 100% 0%,  0% 100%,   100% 50%; }
    66%  { background-position: 100% 100%,0% 0%,     50% 100%; }
    100% { background-position: 0% 100%,  100% 0%,   100% 100%; }
}

/* Global Join Button (Pill & Flow) */
.join-button {
    pointer-events: auto; 
    display: inline-block;
    padding: 0.8rem 2.2rem;
    background-color: transparent !important; 
    color: #000000 !important;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    text-decoration: none;
    border-radius: 500px;
    position: relative;
    transition: transform 0.3s ease, color 0.3s ease; 
    
    border: 1px solid transparent;
    background-image: 
        linear-gradient(#fff, #fff), 
        radial-gradient(circle at 50% 50%, #C4B5D4 0%, transparent 55%), 
        radial-gradient(circle at 50% 50%, #4D638C 0%, transparent 60%), 
        linear-gradient(135deg, #A2B9E7 0%, #4D638C 50%, #A2B9E7 100%);  
    background-origin: border-box;
    background-clip: padding-box, border-box, border-box, border-box;
    background-size: 100% 100%, 250% 250%, 250% 250%, 300% 300%;
    animation: liquid-border-flow 8s ease-in-out infinite alternate;
}

.join-button:hover {
    transform: translateY(-2px);
    color: #ffffff !important;
    background-image: 
        linear-gradient(transparent, transparent), 
        radial-gradient(circle at 50% 50%, #C4B5D4 0%, transparent 55%),
        radial-gradient(circle at 50% 50%, #4D638C 0%, transparent 60%),
        linear-gradient(135deg, #A2B9E7 0%, #4D638C 50%, #A2B9E7 100%);
}

@keyframes liquid-border-flow {
    0%   { background-position: 0% 0%,  0% 0%,    100% 100%, 0% 0%; }
    33%  { background-position: 0% 0%,  100% 0%,  0% 100%,   100% 50%; }
    66%  { background-position: 0% 0%,  100% 100%,0% 0%,     50% 100%; }
    100% { background-position: 0% 0%,  0% 100%,  100% 0%,   100% 100%; }
}

/* ── 8. GLOBAL SCROLLBAR PHYSICS ── */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background-color: #ffffff;
    border-radius: 9999px;
    border: 3px solid transparent;
    background-clip: padding-box;
}

* {
    scrollbar-width: thin;
    scrollbar-color: #ffffff transparent;
}