/* ════════════════════════════════════════════════════════════════
   GOBLINS & GUNSLINGERS — 2026 SITE OVERHAUL DESIGN SYSTEM
   Load LAST on every page, after main.css / frontier-redesign.css /
   site-polish.css. This layer is the visual source of truth:
   tokens, nav, footer, buttons, heroes, panels, forms, tables.
   Page-specific styles build on the .gx-* component vocabulary.
   ════════════════════════════════════════════════════════════════ */

:root {
    /* Palette */
    --gx-bg-0: #070503;
    --gx-bg-1: #0d0a07;
    --gx-bg-2: #14100b;
    --gx-ink: #f4e9d3;
    --gx-ink-soft: #d9cbab;
    --gx-muted: #b3a487;
    --gx-faint: #9a8b6e;
    --gx-gold: #d9ac54;
    --gx-gold-hi: #f3cf75;
    --gx-gold-deep: #a87c2e;
    --gx-rust: #c2572f;
    --gx-teal: #58c9cf;
    --gx-violet: #8b64d7;
    --gx-green: #7cb663;
    --gx-red: #d4543e;

    /* Surfaces */
    --gx-panel: rgba(22, 17, 12, 0.82);
    --gx-panel-solid: #161009;
    --gx-card: rgba(28, 22, 15, 0.88);
    --gx-glass: rgba(16, 12, 8, 0.72);
    --gx-hairline: rgba(217, 172, 84, 0.16);
    --gx-hairline-strong: rgba(217, 172, 84, 0.34);

    /* Effects */
    --gx-radius-sm: 6px;
    --gx-radius: 10px;
    --gx-radius-lg: 16px;
    --gx-shadow-sm: 0 4px 18px rgba(0, 0, 0, 0.35);
    --gx-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
    --gx-shadow-lg: 0 30px 90px rgba(0, 0, 0, 0.55);
    --gx-glow-gold: 0 0 28px rgba(217, 172, 84, 0.22);
    --gx-ease: cubic-bezier(0.22, 1, 0.36, 1);

    /* Type scale (fluid) */
    --gx-display-xl: clamp(2.6rem, 6.2vw, 4.4rem);
    --gx-display: clamp(2.1rem, 4.6vw, 3.2rem);
    --gx-h2: clamp(1.7rem, 3.4vw, 2.4rem);
    --gx-h3: clamp(1.25rem, 2.2vw, 1.55rem);
    --gx-body-lg: clamp(1.08rem, 1.5vw, 1.22rem);
    --gx-body: 1.05rem;
    --gx-small: 0.92rem;
    --gx-tiny: 0.8rem;

    /* Spacing rhythm */
    --gx-section-pad: clamp(4.5rem, 9vw, 7.5rem);
    --gx-gap: clamp(1.25rem, 2.5vw, 2rem);
}

/* ── Base ──────────────────────────────────────────────────────── */

html {
    scroll-behavior: smooth;
    scroll-padding-top: 96px;
}

/* <picture> wrappers must not break existing `.container img{width/height:100%}`
   layout rules — collapse the wrapper so the <img> behaves as a direct child. */
picture { display: contents; }

body {
    color: var(--gx-ink);
    background:
        radial-gradient(1100px 520px at 12% -4%, rgba(217, 172, 84, 0.10), transparent 70%),
        radial-gradient(900px 480px at 88% 6%, rgba(139, 100, 215, 0.07), transparent 70%),
        radial-gradient(1100px 620px at 50% 104%, rgba(194, 87, 47, 0.08), transparent 72%),
        linear-gradient(180deg, #0e0b08 0%, var(--gx-bg-1) 42%, var(--gx-bg-0) 100%);
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

/* Grain overlay for filmic depth */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    pointer-events: none;
    opacity: 0.05;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
}

::selection {
    background: rgba(217, 172, 84, 0.32);
    color: #fff8ea;
}

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

* { scrollbar-width: thin; scrollbar-color: rgba(217, 172, 84, 0.35) rgba(20, 15, 10, 0.6); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: rgba(14, 11, 8, 0.9); }
::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(217, 172, 84, 0.4), rgba(168, 124, 46, 0.4));
    border-radius: 8px;
    border: 2px solid rgba(14, 11, 8, 0.9);
}

/* ── Typography ────────────────────────────────────────────────── */

h1, h2, h3, .gx-display {
    font-family: 'Cinzel', serif;
    letter-spacing: 0.015em;
    color: var(--gx-ink);
}

p { line-height: 1.72; }

.gx-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-family: 'Inter', sans-serif;
    font-size: var(--gx-tiny);
    font-weight: 600;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--gx-gold);
}

.gx-eyebrow::before,
.gx-eyebrow.gx-eyebrow-line::after {
    content: "";
    width: 28px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gx-gold));
}
.gx-eyebrow.gx-eyebrow-line::after {
    background: linear-gradient(90deg, var(--gx-gold), transparent);
}

.gx-lead {
    font-size: var(--gx-body-lg);
    color: var(--gx-ink-soft);
    line-height: 1.75;
    max-width: 62ch;
}

.section-title,
.gx-section-title {
    font-family: 'Cinzel', serif;
    font-size: var(--gx-h2);
    font-weight: 700;
    color: var(--gx-ink);
    line-height: 1.18;
    text-wrap: balance;
}

.section-subtitle,
.gx-section-sub {
    color: var(--gx-muted);
    font-size: var(--gx-body-lg);
    max-width: 64ch;
    text-wrap: pretty;
}

/* Ornamental divider */
.gx-ornament {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    margin: 1.1rem 0 1.6rem;
}
.gx-ornament::before,
.gx-ornament::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gx-hairline-strong), transparent);
}
.gx-ornament span {
    width: 8px;
    height: 8px;
    transform: rotate(45deg);
    background: linear-gradient(135deg, var(--gx-gold-hi), var(--gx-gold-deep));
    box-shadow: var(--gx-glow-gold);
}

/* ── Layout primitives ─────────────────────────────────────────── */

.gx-section { padding: var(--gx-section-pad) 0; position: relative; }
.gx-section-tight { padding: calc(var(--gx-section-pad) * 0.6) 0; }

.gx-container {
    width: min(1200px, calc(100% - 3rem));
    margin-inline: auto;
}
.gx-container-wide { width: min(1380px, calc(100% - 3rem)); margin-inline: auto; }
.gx-container-narrow { width: min(820px, calc(100% - 3rem)); margin-inline: auto; }

.gx-grid { display: grid; gap: var(--gx-gap); }
.gx-grid-2 { display: grid; gap: var(--gx-gap); grid-template-columns: repeat(2, 1fr); }
.gx-grid-3 { display: grid; gap: var(--gx-gap); grid-template-columns: repeat(3, 1fr); }
.gx-grid-4 { display: grid; gap: var(--gx-gap); grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
    .gx-grid-4 { grid-template-columns: repeat(2, 1fr); }
    .gx-grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 700px) {
    .gx-grid-2, .gx-grid-3, .gx-grid-4 { grid-template-columns: 1fr; }
}

/* ── Navigation ────────────────────────────────────────────────── */

.main-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: linear-gradient(180deg, rgba(10, 8, 5, 0.94), rgba(10, 8, 5, 0.86));
    -webkit-backdrop-filter: blur(14px) saturate(1.2);
    backdrop-filter: blur(14px) saturate(1.2);
    border-bottom: 1px solid var(--gx-hairline);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

.main-nav .nav-inner {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    width: min(1380px, calc(100% - 2.5rem));
    margin-inline: auto;
    min-height: 68px;
    padding: 0;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: 0.04em;
    color: var(--gx-ink);
    text-decoration: none;
    margin-right: auto;
}
.nav-logo img { display: block; }

.nav-logo-mana-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 0.85rem;
    color: #1a1206;
    background: radial-gradient(circle at 32% 28%, #ffe9ae, var(--gx-gold) 55%, var(--gx-gold-deep));
    box-shadow: 0 0 0 1px rgba(243, 207, 117, 0.45), 0 0 18px rgba(217, 172, 84, 0.35);
}

.nav-links { display: flex; align-items: center; gap: 0.25rem; list-style: none; margin: 0; }

.nav-links a {
    position: relative;
    display: inline-block;
    padding: 0.55rem 0.85rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.86rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    color: var(--gx-ink-soft);
    text-decoration: none;
    border-radius: var(--gx-radius-sm);
    transition: color 0.25s var(--gx-ease), background 0.25s var(--gx-ease);
}

.nav-links a::after {
    content: "";
    position: absolute;
    left: 0.85rem;
    right: 0.85rem;
    bottom: 0.3rem;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gx-gold-hi), transparent);
    transform: scaleX(0);
    transition: transform 0.3s var(--gx-ease);
}

.nav-links a:hover { color: var(--gx-gold-hi); }
.nav-links a:hover::after { transform: scaleX(1); }

.nav-links a.active {
    color: var(--gx-gold-hi);
}
.nav-links a.active::after { transform: scaleX(1); }

.nav-links a.nav-play-link {
    margin-left: 0.5rem;
    padding: 0.55rem 1.25rem;
    color: #1c1305;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 0.78rem;
    background: linear-gradient(135deg, var(--gx-gold-hi), var(--gx-gold) 55%, var(--gx-gold-deep));
    border-radius: 999px;
    box-shadow: 0 4px 16px rgba(217, 172, 84, 0.3), inset 0 1px 0 rgba(255, 240, 200, 0.5);
    transition: transform 0.25s var(--gx-ease), box-shadow 0.25s var(--gx-ease);
}
.nav-links a.nav-play-link::after { display: none; }
.nav-links a.nav-play-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 26px rgba(217, 172, 84, 0.45), inset 0 1px 0 rgba(255, 240, 200, 0.5);
    color: #1c1305;
}

.theme-toggle, .nav-toggle {
    background: rgba(28, 22, 15, 0.6);
    border: 1px solid var(--gx-hairline);
    border-radius: var(--gx-radius-sm);
    transition: border-color 0.25s, background 0.25s;
}
.theme-toggle:hover, .nav-toggle:hover { border-color: var(--gx-hairline-strong); }

/* Mobile nav panel */
@media (max-width: 1023px) {
    .nav-links {
        position: fixed;
        top: 68px;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 0.75rem 1rem 1.25rem;
        background: linear-gradient(180deg, rgba(12, 9, 6, 0.98), rgba(9, 7, 4, 0.98));
        border-bottom: 1px solid var(--gx-hairline);
        box-shadow: var(--gx-shadow);
        transform: translateY(-12px);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s var(--gx-ease), transform 0.3s var(--gx-ease), visibility 0.3s;
        max-height: calc(100vh - 68px);
        overflow-y: auto;
    }
    .nav-links.open {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }
    /* Neutralize the legacy side-drawer treatment from main.css and keep
       the whole header above the body.nav-menu-open scrim (z-index 1280) */
    .main-nav { z-index: 1300; }
    .nav-links { width: auto; border-left: none; box-shadow: var(--gx-shadow); padding-top: 0.75rem; }
    .nav-links::before { content: none; }
    .nav-links a { display: block; padding: 0.9rem 0.75rem; font-size: 1rem; border-bottom: 1px solid rgba(217, 172, 84, 0.08); }
    .nav-links a::after { display: none; }
    .nav-links a.nav-play-link { margin: 0.9rem 0 0; text-align: center; }
}

/* ── Footer ────────────────────────────────────────────────────── */

footer.site-footer,
.site-footer-v2 {
    position: relative;
    margin-top: var(--gx-section-pad);
    padding: clamp(3rem, 6vw, 4.5rem) 0 2rem;
    background:
        radial-gradient(900px 320px at 50% 0%, rgba(217, 172, 84, 0.06), transparent 70%),
        linear-gradient(180deg, #0b0805, #060403);
    border-top: 1px solid var(--gx-hairline);
}
footer.site-footer::before,
.site-footer-v2::before {
    content: "";
    position: absolute;
    top: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: min(560px, 70%);
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gx-gold), transparent);
    opacity: 0.65;
}

.footer-inner-v2 {
    display: grid;
    grid-template-columns: 1.5fr repeat(5, 1fr);
    gap: 2rem;
    padding-bottom: 2.5rem;
}
@media (max-width: 1200px) { .footer-inner-v2 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 760px) { .footer-inner-v2 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .footer-inner-v2 { grid-template-columns: 1fr; } }

.footer-brand {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--gx-ink);
}
.footer-mana-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #1a1206;
    font-weight: 700;
    background: radial-gradient(circle at 32% 28%, #ffe9ae, var(--gx-gold) 55%, var(--gx-gold-deep));
    box-shadow: 0 0 0 1px rgba(243, 207, 117, 0.4), 0 0 16px rgba(217, 172, 84, 0.3);
}
.footer-tagline {
    margin-top: 0.9rem;
    color: var(--gx-muted);
    font-size: var(--gx-small);
    max-width: 32ch;
    line-height: 1.65;
}
.footer-socials { display: flex; gap: 0.6rem; margin-top: 1.1rem; }
.footer-socials a {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    color: var(--gx-ink-soft);
    border: 1px solid var(--gx-hairline);
    background: rgba(28, 22, 15, 0.55);
    transition: all 0.25s var(--gx-ease);
}
.footer-socials a:hover {
    color: var(--gx-gold-hi);
    border-color: var(--gx-hairline-strong);
    transform: translateY(-2px);
    box-shadow: var(--gx-glow-gold);
}

.footer-col h4 {
    font-family: 'Inter', sans-serif;
    font-size: var(--gx-tiny);
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--gx-gold);
    margin-bottom: 1rem;
}
.footer-col a {
    display: block;
    padding: 0.32rem 0;
    color: var(--gx-muted);
    font-size: var(--gx-small);
    text-decoration: none;
    transition: color 0.2s, transform 0.2s var(--gx-ease);
}
.footer-col a:hover { color: var(--gx-gold-hi); transform: translateX(3px); }

.footer-bottom-v2 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding-top: 1.6rem;
    border-top: 1px solid rgba(217, 172, 84, 0.1);
    color: var(--gx-faint);
    font-size: var(--gx-tiny);
}
.footer-legal a { color: var(--gx-muted); text-decoration: none; }
.footer-legal a:hover { color: var(--gx-gold-hi); }

/* ── Buttons ───────────────────────────────────────────────────── */

.btn, .gx-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    padding: 0.85rem 1.9rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-decoration: none;
    border-radius: var(--gx-radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform 0.25s var(--gx-ease), box-shadow 0.25s var(--gx-ease), background 0.25s, border-color 0.25s, color 0.25s;
    will-change: transform;
}

.btn-primary, .gx-btn-gold {
    color: #1c1305;
    background: linear-gradient(135deg, var(--gx-gold-hi) 0%, var(--gx-gold) 52%, var(--gx-gold-deep) 100%);
    box-shadow: 0 6px 22px rgba(217, 172, 84, 0.32), inset 0 1px 0 rgba(255, 242, 205, 0.55);
}
.btn-primary:hover, .gx-btn-gold:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 34px rgba(217, 172, 84, 0.45), inset 0 1px 0 rgba(255, 242, 205, 0.55);
    color: #1c1305;
}
.btn-primary:active, .gx-btn-gold:active { transform: translateY(0); }

.btn-secondary, .gx-btn-ghost {
    color: var(--gx-ink);
    background: rgba(28, 22, 15, 0.5);
    border-color: var(--gx-hairline-strong);
    box-shadow: inset 0 1px 0 rgba(255, 242, 205, 0.06);
}
.btn-secondary:hover, .gx-btn-ghost:hover {
    transform: translateY(-2px);
    border-color: var(--gx-gold);
    color: var(--gx-gold-hi);
    box-shadow: var(--gx-glow-gold);
    background: rgba(38, 30, 20, 0.6);
}

.gx-btn-rust {
    color: #fff3ea;
    background: linear-gradient(135deg, #d96f43, var(--gx-rust) 60%, #93401f);
    box-shadow: 0 6px 22px rgba(194, 87, 47, 0.35), inset 0 1px 0 rgba(255, 220, 200, 0.35);
}
.gx-btn-rust:hover { transform: translateY(-2px); box-shadow: 0 12px 34px rgba(194, 87, 47, 0.5); color: #fff3ea; }

.gx-btn-lg { padding: 1.05rem 2.4rem; font-size: 0.95rem; }
.gx-btn-sm { padding: 0.55rem 1.2rem; font-size: 0.75rem; }

/* ── Panels & cards ────────────────────────────────────────────── */

.gx-panel {
    position: relative;
    background: var(--gx-panel);
    border: 1px solid var(--gx-hairline);
    border-radius: var(--gx-radius-lg);
    box-shadow: var(--gx-shadow-sm);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.gx-card {
    position: relative;
    background: var(--gx-card);
    border: 1px solid var(--gx-hairline);
    border-radius: var(--gx-radius-lg);
    padding: clamp(1.4rem, 2.6vw, 2rem);
    box-shadow: var(--gx-shadow-sm);
    transition: transform 0.35s var(--gx-ease), box-shadow 0.35s var(--gx-ease), border-color 0.35s;
    overflow: hidden;
}
.gx-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(243, 207, 117, 0.5), transparent);
    opacity: 0;
    transition: opacity 0.35s;
}
.gx-card:hover {
    transform: translateY(-5px);
    border-color: var(--gx-hairline-strong);
    box-shadow: var(--gx-shadow), var(--gx-glow-gold);
}
.gx-card:hover::before { opacity: 1; }

.gx-card h3 { font-size: var(--gx-h3); margin-bottom: 0.6rem; }
.gx-card p { color: var(--gx-muted); font-size: var(--gx-small); line-height: 1.66; }

/* Decorative corner notches (western poster feel) */
.gx-corners::after {
    content: "";
    position: absolute;
    inset: 9px;
    pointer-events: none;
    border-radius: calc(var(--gx-radius-lg) - 6px);
    background:
        linear-gradient(var(--gx-hairline-strong), var(--gx-hairline-strong)) top left / 14px 1px,
        linear-gradient(var(--gx-hairline-strong), var(--gx-hairline-strong)) top left / 1px 14px,
        linear-gradient(var(--gx-hairline-strong), var(--gx-hairline-strong)) top right / 14px 1px,
        linear-gradient(var(--gx-hairline-strong), var(--gx-hairline-strong)) top right / 1px 14px,
        linear-gradient(var(--gx-hairline-strong), var(--gx-hairline-strong)) bottom left / 14px 1px,
        linear-gradient(var(--gx-hairline-strong), var(--gx-hairline-strong)) bottom left / 1px 14px,
        linear-gradient(var(--gx-hairline-strong), var(--gx-hairline-strong)) bottom right / 14px 1px,
        linear-gradient(var(--gx-hairline-strong), var(--gx-hairline-strong)) bottom right / 1px 14px;
    background-repeat: no-repeat;
}

/* ── Badges, pills, chips ──────────────────────────────────────── */

.gx-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    font-family: 'Inter', sans-serif;
    font-size: var(--gx-tiny);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--gx-ink-soft);
    background: rgba(28, 22, 15, 0.7);
    border: 1px solid var(--gx-hairline);
}
.gx-badge-gold { color: var(--gx-gold-hi); border-color: var(--gx-hairline-strong); }
.gx-badge-live { color: #9fe8a8; border-color: rgba(124, 182, 99, 0.4); }
.gx-badge-live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #7ce087; box-shadow: 0 0 10px #7ce087; animation: gx-pulse 2.2s infinite; }
.gx-badge-teal { color: var(--gx-teal); border-color: rgba(88, 201, 207, 0.35); }
.gx-badge-violet { color: #b9a0ef; border-color: rgba(139, 100, 215, 0.4); }
.gx-badge-rust { color: #f0a384; border-color: rgba(194, 87, 47, 0.45); }

@keyframes gx-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.55; transform: scale(0.8); }
}

/* ── Heroes ────────────────────────────────────────────────────── */

.gx-hero {
    position: relative;
    display: flex;
    align-items: center;
    min-height: clamp(420px, 62vh, 660px);
    padding: calc(68px + clamp(3rem, 7vw, 5.5rem)) 0 clamp(3rem, 7vw, 5rem);
    overflow: hidden;
    isolation: isolate;
}
.gx-hero-bg {
    position: absolute;
    inset: 0;
    z-index: -2;
}
.gx-hero-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 30%;
}
.gx-hero-scrim {
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        linear-gradient(180deg, rgba(7, 5, 3, 0.72) 0%, rgba(7, 5, 3, 0.35) 38%, rgba(7, 5, 3, 0.88) 88%, var(--gx-bg-0) 100%),
        radial-gradient(900px 480px at 22% 60%, rgba(7, 5, 3, 0.55), transparent 70%);
}
.gx-hero h1 {
    font-size: var(--gx-display);
    font-weight: 800;
    line-height: 1.08;
    text-wrap: balance;
    text-shadow: 0 4px 30px rgba(0, 0, 0, 0.7);
}
.gx-hero .gx-lead { text-shadow: 0 2px 18px rgba(0, 0, 0, 0.8); }

/* Refit legacy page heroes to the new look */
.page-hero, .page-hero-tall {
    border-bottom: 1px solid var(--gx-hairline);
}
.page-hero-content h1 {
    font-size: var(--gx-display);
    text-shadow: 0 4px 30px rgba(0, 0, 0, 0.7);
}

/* ── Forms ─────────────────────────────────────────────────────── */

.gx-input,
input[type="text"], input[type="email"], input[type="password"],
input[type="search"], input[type="number"], select, textarea {
    font-family: 'Inter', sans-serif;
    color: var(--gx-ink);
    background: rgba(16, 12, 8, 0.75);
    border: 1px solid var(--gx-hairline);
    border-radius: var(--gx-radius-sm);
    padding: 0.8rem 1rem;
    font-size: 0.95rem;
    transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
}
.gx-input:focus,
input[type="text"]:focus, input[type="email"]:focus, input[type="password"]:focus,
input[type="search"]:focus, input[type="number"]:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--gx-gold);
    box-shadow: 0 0 0 3px rgba(217, 172, 84, 0.15);
    background: rgba(22, 17, 11, 0.85);
}
input::placeholder, textarea::placeholder { color: var(--gx-faint); }

label { font-family: 'Inter', sans-serif; font-size: var(--gx-small); color: var(--gx-ink-soft); }

/* ── Tables ────────────────────────────────────────────────────── */

.gx-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Inter', sans-serif;
    font-size: var(--gx-small);
    background: var(--gx-panel);
    border: 1px solid var(--gx-hairline);
    border-radius: var(--gx-radius);
    overflow: hidden;
}
.gx-table th {
    text-align: left;
    padding: 0.85rem 1.1rem;
    font-size: var(--gx-tiny);
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--gx-gold);
    background: rgba(217, 172, 84, 0.07);
    border-bottom: 1px solid var(--gx-hairline-strong);
}
.gx-table td {
    padding: 0.85rem 1.1rem;
    color: var(--gx-ink-soft);
    border-bottom: 1px solid rgba(217, 172, 84, 0.08);
}
.gx-table tr:last-child td { border-bottom: none; }
.gx-table tbody tr { transition: background 0.2s; }
.gx-table tbody tr:hover { background: rgba(217, 172, 84, 0.05); }

/* ── Motion ────────────────────────────────────────────────────── */

/* Reveal-on-scroll. Elements are only hidden when a reveal observer is
   actually running (site-polish.js adds body.gx-motion) — pages without
   the script render everything visible. */
body.gx-motion .reveal, body.gx-motion .gx-reveal {
    opacity: 0;
    transform: translateY(26px);
    transition: opacity 0.7s var(--gx-ease), transform 0.7s var(--gx-ease);
}
body.gx-motion .reveal.visible, body.gx-motion .gx-reveal.visible,
body.gx-motion .reveal.in, body.gx-motion .gx-reveal.in {
    opacity: 1;
    transform: none;
}

@keyframes gx-fade-up {
    from { opacity: 0; transform: translateY(22px); }
    to { opacity: 1; transform: none; }
}
.gx-fade-up { animation: gx-fade-up 0.8s var(--gx-ease) both; }
.gx-delay-1 { animation-delay: 0.12s; }
.gx-delay-2 { animation-delay: 0.24s; }
.gx-delay-3 { animation-delay: 0.36s; }
.gx-delay-4 { animation-delay: 0.48s; }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .reveal, .gx-reveal { opacity: 1; transform: none; }
}

/* ── Mobile compositing hygiene ────────────────────────────────────
   Touch devices: fixed full-viewport layers (grain, aurora, dust) and
   backdrop blur force a recomposite every scroll frame on iOS/Android,
   which reads as flicker/shimmer. Strip them all on coarse pointers —
   the design holds up fine without the atmospherics. */
@media (hover: none) and (pointer: coarse) {
    body::before,
    body::after {
        display: none !important;
        animation: none !important;
    }
    .home-dust,
    .site-dust {
        display: none !important;
    }
    .main-nav {
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
        background: linear-gradient(180deg, rgba(10, 8, 5, 0.985), rgba(10, 8, 5, 0.96));
    }
    /* Scroll-driven parallax transforms jitter on mobile — pin the art.
       (!important beats the inline transform the scroll handler writes.) */
    .parallax-element {
        transform: none !important;
    }
}

/* ── Light theme adjustments ───────────────────────────────────── */

html[data-theme="light"] body {
    background:
        radial-gradient(1100px 520px at 12% -4%, rgba(217, 172, 84, 0.14), transparent 70%),
        linear-gradient(180deg, #f7efdd 0%, #f1e6cf 50%, #e9dcc0 100%);
    color: #2a2115;
}
html[data-theme="light"] body::after { opacity: 0.035; }
html[data-theme="light"] .main-nav {
    background: linear-gradient(180deg, rgba(247, 239, 221, 0.95), rgba(243, 233, 211, 0.88));
    border-bottom-color: rgba(140, 100, 40, 0.18);
}
html[data-theme="light"] .nav-links a { color: #4d3d24; }
html[data-theme="light"] .nav-links a:hover,
html[data-theme="light"] .nav-links a.active { color: #8a5d16; }
html[data-theme="light"] .gx-card,
html[data-theme="light"] .gx-panel {
    background: rgba(255, 250, 238, 0.86);
    border-color: rgba(140, 100, 40, 0.2);
}
html[data-theme="light"] .gx-card p, html[data-theme="light"] .section-subtitle { color: #6b5a3d; }
html[data-theme="light"] h1, html[data-theme="light"] h2, html[data-theme="light"] h3 { color: #2a2115; }

/* ── Helpers ───────────────────────────────────────────────────── */

.gx-text-gold { color: var(--gx-gold-hi); }
.gx-text-muted { color: var(--gx-muted); }
.gx-center { text-align: center; }
.gx-center .gx-section-sub, .gx-center .gx-lead { margin-inline: auto; }
.gx-mt-1 { margin-top: 0.75rem; } .gx-mt-2 { margin-top: 1.5rem; } .gx-mt-3 { margin-top: 2.5rem; }
.gx-mb-1 { margin-bottom: 0.75rem; } .gx-mb-2 { margin-bottom: 1.5rem; } .gx-mb-3 { margin-bottom: 2.5rem; }
.gx-flex { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.gx-actions { display: flex; gap: 0.9rem; flex-wrap: wrap; align-items: center; }

.gx-stat {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.gx-stat-value {
    font-family: 'Cinzel', serif;
    font-size: clamp(1.7rem, 3vw, 2.3rem);
    font-weight: 800;
    background: linear-gradient(180deg, var(--gx-gold-hi), var(--gx-gold-deep));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.gx-stat-label {
    font-family: 'Inter', sans-serif;
    font-size: var(--gx-tiny);
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--gx-muted);
}

/* ════════════════════════════════════════════════════════════════
   ===== 2026 AUDIT POLISH =====
   Appended last so later same-specificity rules win. Dark mode is
   left untouched; only light-theme overrides and additive polish
   live here. All animations are transform/opacity only and gated
   behind body.gx-motion (mirroring the reveal rules); the existing
   prefers-reduced-motion block neutralizes them.
   ════════════════════════════════════════════════════════════════ */

/* ── 1. Light-theme contrast (WCAG AA, all >= 4.5:1) ─────────────────
   Gold accent text → #7d4f12 (min 5.16:1 across every light bg stop
   #fffaee / #f1e6cf / #f7efdd / #e9dcc0).
   Muted / lead / secondary text → #6b5a3d (min 4.90:1 across the same).
   Footer flips from dark gradient to a light surface with dark text. */

html[data-theme="light"] .gx-eyebrow,
html[data-theme="light"] .gx-table th,
html[data-theme="light"] .footer-col h4,
html[data-theme="light"] .gx-text-gold,
html[data-theme="light"] .gx-badge-gold {
    color: #7d4f12;
}
/* Eyebrow / ornament gold rules use gradients to transparent — retint
   them to the darker gold so the hairline stays visible on light bg. */
html[data-theme="light"] .gx-eyebrow::before,
html[data-theme="light"] .gx-eyebrow.gx-eyebrow-line::after {
    background: linear-gradient(90deg, transparent, #7d4f12);
}
html[data-theme="light"] .gx-eyebrow.gx-eyebrow-line::after {
    background: linear-gradient(90deg, #7d4f12, transparent);
}

html[data-theme="light"] .gx-section-sub,
html[data-theme="light"] .section-subtitle,
html[data-theme="light"] .gx-stat-label,
html[data-theme="light"] .footer-col a,
html[data-theme="light"] .footer-tagline,
html[data-theme="light"] .footer-legal a,
html[data-theme="light"] .gx-lead,
html[data-theme="light"] .gx-text-muted,
html[data-theme="light"] .gx-muted,
html[data-theme="light"] .gx-card p,
html[data-theme="light"] .gx-table td,
html[data-theme="light"] label {
    color: #6b5a3d;
}

/* tiny "faint" body text (footer baseline, placeholders) — darker still
   for the smaller sizes; #5e4f35 ~5.9:1 on the mid bg. */
html[data-theme="light"] .footer-bottom-v2,
html[data-theme="light"] input::placeholder,
html[data-theme="light"] textarea::placeholder {
    color: #5e4f35;
}

/* Footer: light surface + readable text in light mode. */
html[data-theme="light"] footer.site-footer,
html[data-theme="light"] .site-footer-v2 {
    background:
        radial-gradient(900px 320px at 50% 0%, rgba(217, 172, 84, 0.10), transparent 70%),
        linear-gradient(180deg, #f4ead5, #ecdfc4);
    border-top-color: rgba(140, 100, 40, 0.24);
}
html[data-theme="light"] .footer-brand,
html[data-theme="light"] .footer-col a:hover,
html[data-theme="light"] .footer-legal a:hover,
html[data-theme="light"] .footer-socials a:hover {
    color: #2a2115;
}
html[data-theme="light"] .footer-socials a {
    color: #6b5a3d;
    border-color: rgba(140, 100, 40, 0.28);
    background: rgba(255, 250, 238, 0.6);
}
html[data-theme="light"] .footer-bottom-v2 {
    border-top-color: rgba(140, 100, 40, 0.2);
}

/* Table header: light background in light mode (header text already
   recolored to dark gold above). */
html[data-theme="light"] .gx-table {
    background: rgba(255, 250, 238, 0.92);
    border-color: rgba(140, 100, 40, 0.22);
}
html[data-theme="light"] .gx-table th {
    background: rgba(217, 172, 84, 0.18);
    border-bottom-color: rgba(140, 100, 40, 0.34);
}
html[data-theme="light"] .gx-table td {
    border-bottom-color: rgba(140, 100, 40, 0.16);
}
html[data-theme="light"] .gx-table tbody tr:hover {
    background: rgba(217, 172, 84, 0.12);
}

/* ── 2. Skip link (JS injects the element elsewhere) ───────────────── */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 2147483600;
    padding: 10px 16px;
    border-radius: var(--gx-radius-sm);
    background: var(--gx-gold);
    color: #1c1305;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
    box-shadow: var(--gx-shadow-sm);
}
.skip-link:focus,
.skip-link:focus-visible {
    left: 12px;
    top: 12px;
    outline: 2px solid #1c1305;
    outline-offset: 2px;
}

/* ── 3. Rounded focus ring matching component radius ───────────────── */
.home-faction-tile:focus-visible,
.home-quick-link:focus-visible,
.dispatch-feed-card:focus-visible,
.gx-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--gx-bg-0), 0 0 0 4px var(--gx-gold);
}

/* ── 4. Tabular stat numerals ──────────────────────────────────────── */
.gx-stat-value { font-variant-numeric: tabular-nums; }

/* ── 5. CTA shimmer — single light sweep on hover ──────────────────── */
.gx-btn-gold,
.btn-primary {
    position: relative;
    overflow: hidden;
}
.gx-btn-gold::after,
.btn-primary::after {
    content: "";
    position: absolute;
    top: -20%;
    left: -60%;
    width: 40%;
    height: 140%;
    pointer-events: none;
    transform: skewX(-20deg) translateX(0);
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 248, 230, 0.55),
        transparent
    );
    opacity: 0;
}
.gx-btn-gold:hover::after,
.btn-primary:hover::after {
    opacity: 1;
    animation: gx-cta-shimmer 0.85s var(--gx-ease) 1;
}
@keyframes gx-cta-shimmer {
    from { left: -60%; }
    to { left: 130%; }
}
/* No hover sweep on touch devices (also avoids the recomposite cost). */
@media (hover: none) and (pointer: coarse) {
    .gx-btn-gold::after,
    .btn-primary::after {
        display: none;
    }
}

/* ── 6. Stagger children in — mirrors the reveal gating ────────────── */
body.gx-motion .gx-stagger > * {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.6s var(--gx-ease), transform 0.6s var(--gx-ease);
}
body.gx-motion .gx-stagger.visible > *,
body.gx-motion .gx-stagger.in > * {
    opacity: 1;
    transform: none;
}
body.gx-motion .gx-stagger.visible > *:nth-child(1),
body.gx-motion .gx-stagger.in > *:nth-child(1) { transition-delay: 0s; }
body.gx-motion .gx-stagger.visible > *:nth-child(2),
body.gx-motion .gx-stagger.in > *:nth-child(2) { transition-delay: 0.06s; }
body.gx-motion .gx-stagger.visible > *:nth-child(3),
body.gx-motion .gx-stagger.in > *:nth-child(3) { transition-delay: 0.12s; }
body.gx-motion .gx-stagger.visible > *:nth-child(4),
body.gx-motion .gx-stagger.in > *:nth-child(4) { transition-delay: 0.18s; }
body.gx-motion .gx-stagger.visible > *:nth-child(5),
body.gx-motion .gx-stagger.in > *:nth-child(5) { transition-delay: 0.24s; }
body.gx-motion .gx-stagger.visible > *:nth-child(6),
body.gx-motion .gx-stagger.in > *:nth-child(6) { transition-delay: 0.30s; }
body.gx-motion .gx-stagger.visible > *:nth-child(7),
body.gx-motion .gx-stagger.in > *:nth-child(7) { transition-delay: 0.36s; }
body.gx-motion .gx-stagger.visible > *:nth-child(8),
body.gx-motion .gx-stagger.in > *:nth-child(8) { transition-delay: 0.42s; }

/* ── 7. Faction tile label lift + deeper hover scrim ───────────────── */
.home-faction-tile span {
    transition: transform 0.3s var(--gx-ease), color 0.3s var(--gx-ease);
}
.home-faction-tile:hover span {
    transform: translateY(-3px);
    color: var(--gx-gold-hi);
}
.home-faction-tile:hover::after {
    background: linear-gradient(180deg, transparent 30%, rgba(7, 5, 3, 0.82) 100%);
}

/* ── 8. Scroll-hint gentle bob (transform/opacity only) ────────────── */
body.gx-motion .home-scroll-hint::after {
    animation: gx-scroll-bob 2.4s ease-in-out infinite;
}
@keyframes gx-scroll-bob {
    0%, 100% { transform: translateY(0); opacity: 0.7; }
    50% { transform: translateY(4px); opacity: 1; }
}

/* ── 9. Inline animated-underline link (opt-in) ────────────────────── */
.gx-link {
    color: var(--gx-gold-hi);
    text-decoration: none;
    background-image: linear-gradient(currentColor, currentColor);
    background-repeat: no-repeat;
    background-position: 0 100%;
    background-size: 0% 1px;
    transition: background-size 0.3s var(--gx-ease), color 0.2s var(--gx-ease);
}
.gx-link:hover,
.gx-link:focus-visible {
    background-size: 100% 1px;
}

/* ── 10. Rust button contrast — deepen gradient for #fff3ea label ──── */
.gx-btn-rust {
    background: linear-gradient(135deg, #b8501f, var(--gx-rust) 55%, #7a3318);
}
.gx-btn-rust:hover {
    background: linear-gradient(135deg, #c25a26, #b8501f 55%, #7a3318);
}

/* ── 11. (token bump for --gx-faint lives in :root above) ──────────── */

/* Light-mode parity for the rounded focus ring (bg-0 is dark; use the
   light page background so the inner gap reads on light surfaces). */
html[data-theme="light"] .home-faction-tile:focus-visible,
html[data-theme="light"] .home-quick-link:focus-visible,
html[data-theme="light"] .dispatch-feed-card:focus-visible,
html[data-theme="light"] .gx-btn:focus-visible {
    box-shadow: 0 0 0 2px #f1e6cf, 0 0 0 4px #7d4f12;
}

/* Ensure reduced-motion neutralizes the additive transform animations
   (the global block already kills animations/transitions via duration,
   but pin the resting state for the looping/stagger pieces explicitly). */
@media (prefers-reduced-motion: reduce) {
    body.gx-motion .gx-stagger > * { opacity: 1; transform: none; }
    .home-scroll-hint::after { animation: none; }
    .gx-btn-gold::after,
    .btn-primary::after { animation: none; opacity: 0; }
}
