/* ============================================================
   Base: reset, tokens, layout shell, menu, view transitions
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

* , *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
    transition: background .5s ease, color .5s ease;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; }
ul { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, p { margin: 0; }
::selection { background: var(--accent); color: #05060a; }

/* ---------- Theme tokens ---------- */
:root {
    --bg: #05060b;
    --bg-elevated: #0b0d16;
    --text: #e8e9f3;
    --text-dim: #9497ab;
    --accent: #a855f7;
    --accent-2: #22d3ee;
    --accent-3: #ec4899;
    --glass-bg: rgba(255,255,255,0.055);
    --glass-border: rgba(255,255,255,0.12);
    --glass-blur: 18px;
    --radius: 18px;
    --shadow-glow: 0 0 60px -12px rgba(168,85,247,0.35);
    --font-display: 'Space Grotesk', 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

body.theme-pro {
    --accent: #38bdf8;
    --accent-2: #818cf8;
    --accent-3: #34d399;
    --shadow-glow: 0 0 60px -12px rgba(56,189,248,0.3);
}

body.theme-gamer {
    --bg: #060a14;
    --accent: #ffb347;
    --accent-2: #4ade80;
    --accent-3: #f472b6;
    --shadow-glow: 0 0 60px -12px rgba(255,179,71,0.35);
}

/* ---------- Glass utility ---------- */
.glass {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
    border-radius: var(--radius);
}

/* ---------- Top-right menu ---------- */
.site-menu {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    font-family: var(--font-display);
}

.menu-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    color: var(--text);
    cursor: pointer;
    box-shadow: 0 8px 30px -10px rgba(0,0,0,.6);
    transition: border-color .25s ease, transform .2s ease;
    border-width: 1px;
    border-style: solid;
}
.menu-toggle:hover { border-color: var(--accent); transform: translateY(-1px); }
.menu-toggle .dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 12px 2px var(--accent);
    animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: .5; transform: scale(.7); }
}
.menu-toggle-label {
    font-size: .82rem; font-weight: 600; letter-spacing: .02em;
}
.menu-toggle .burger {
    width: 18px; height: 12px; position: relative;
}
.menu-toggle .burger span {
    position: absolute; left: 0; width: 100%; height: 2px;
    background: var(--text); border-radius: 2px;
    transition: transform .3s ease, opacity .3s ease, top .3s ease;
}
.menu-toggle .burger span:nth-child(1) { top: 0; }
.menu-toggle .burger span:nth-child(2) { top: 5px; }
.menu-toggle .burger span:nth-child(3) { top: 10px; }
.site-menu.open .menu-toggle .burger span:nth-child(1) { top: 5px; transform: rotate(45deg); }
.site-menu.open .menu-toggle .burger span:nth-child(2) { opacity: 0; }
.site-menu.open .menu-toggle .burger span:nth-child(3) { top: 5px; transform: rotate(-45deg); }

.menu-dropdown {
    min-width: 240px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    opacity: 0;
    transform: translateY(-8px) scale(.97);
    pointer-events: none;
    transition: opacity .22s ease, transform .22s ease;
    transform-origin: top right;
}
.site-menu.open .menu-dropdown {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    cursor: pointer;
    color: var(--text-dim);
    transition: background .2s ease, color .2s ease;
    border: 1px solid transparent;
}
.menu-item:hover { background: rgba(255,255,255,.06); color: var(--text); }
.menu-item.active {
    color: var(--text);
    background: rgba(255,255,255,.07);
    border-color: var(--glass-border);
}
.menu-item .icon {
    display: flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
    background: rgba(255,255,255,.05);
    border: 1px solid transparent;
    transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.menu-item:hover .icon { color: var(--accent); }
.menu-item.active .icon {
    background: linear-gradient(140deg, rgba(168,85,247,.25), rgba(34,211,238,.15));
    border-color: var(--glass-border);
    color: var(--accent);
}
.menu-item .label-group { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.menu-item .label { font-weight: 600; font-size: .92rem; }
.menu-item .sub { font-size: .71rem; color: var(--text-dim); font-family: 'Inter', sans-serif; }
.menu-item.active .active-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--accent); margin-left: auto; flex-shrink: 0;
    box-shadow: 0 0 8px 1px var(--accent);
}
.menu-foot {
    margin: 8px 6px 4px;
    padding-top: 10px;
    border-top: 1px solid var(--glass-border);
    font-family: var(--font-mono);
    font-size: .66rem;
    letter-spacing: .06em;
    color: var(--text-dim);
    opacity: .75;
    text-align: center;
}

/* ---------- View shell / transitions ---------- */
#view-root { position: relative; min-height: 100%; }
.view {
    display: none;
    min-height: 100vh;
}
.view.active { display: block; }
/* Opacity only -- a transform here would create a containing block and break
   every position:fixed descendant (canvas backgrounds, the game HUD). */
.view.fade-in { animation: view-fade-in .45s ease both; }
@keyframes view-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.container { max-width: 1180px; margin: 0 auto; padding: 0 28px; }

.section-eyebrow {
    font-family: var(--font-mono);
    letter-spacing: .2em;
    text-transform: uppercase;
    font-size: .72rem;
    color: var(--accent-2);
}
.section-title {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    font-weight: 700;
    margin-top: 8px;
}

.scroll-hint {
    position: absolute;
    bottom: 26px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--text-dim);
    font-family: var(--font-mono);
    font-size: .72rem;
    letter-spacing: .15em;
    text-transform: uppercase;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.scroll-hint .line { width: 1px; height: 26px; background: linear-gradient(var(--accent), transparent); animation: hint-scroll 1.8s ease-in-out infinite; }
@keyframes hint-scroll { 0% { opacity: 0; transform: scaleY(0); transform-origin: top;} 40% { opacity: 1; transform: scaleY(1); transform-origin: top;} 100% { opacity: 0; transform: scaleY(1); transform-origin: bottom;} }

@media (max-width: 640px) {
    .container { padding: 0 18px; }
    .site-menu { top: 14px; right: 14px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
        scroll-behavior: auto !important;
    }
    [data-reveal] { opacity: 1 !important; transform: none !important; }
}
