/* MistIntel – Shared Site Styles */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Prevent ANY horizontal overflow site-wide.
   `overflow-x: clip` (not `hidden`) — `hidden` creates a scroll container
   on <html>/<body> which silently breaks `position: sticky` for descendants. */
html { overflow-x: clip; scroll-behavior: smooth; }
body { overflow-x: clip; }

:root {
    --bg-deep:       #0c0c1e;
    --bg-dark:       #12122a;
    --bg-card:       #16213e;
    --bg-hover:      #1a2a50;
    --border:        #2a2a4a;
    --accent-blue:   #4a9eff;
    --accent-red:    #e94560;
    --accent-gold:   #f0a030;
    --text-primary:  #e0e0e0;
    --text-muted:    #888;
    --text-dim:      #555;
    --glow-blue:     rgba(74,158,255,.18);
    --glow-red:      rgba(233,69,96,.18);
    --radius:        8px;
    --radius-sm:     4px;
}

html { scroll-behavior: smooth; }
body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: var(--bg-deep);
    color: var(--text-primary);
    line-height: 1.65;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-top: 56px; /* space for fixed #site-topbar from nav.css */
}

a { color: var(--accent-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; }

/* ─── SITE HEADER ──────────────────────────────────────────────── */
.site-header {
    position: sticky; top: 0; z-index: 200;
    background: var(--bg-deep);
    border-bottom: 1px solid var(--border);
    padding: 0 1.5rem;
    height: 56px;
    display: flex; align-items: center; gap: 1.5rem;
}
.site-header .brand {
    font-size: 1.1rem; font-weight: 700; letter-spacing: .04em;
    color: #fff; white-space: nowrap;
    flex-shrink: 0; display: flex; align-items: center; gap: .45rem;
    text-decoration: none;
}
.site-header .brand img {
    height: 36px !important;
    width: auto !important;
    max-width: none !important;
    display: block;
    flex-shrink: 0;
}
.site-header .brand .brand-mist { color: #ffffff; font-weight: 700; font-size: 1.1rem; }
.site-header .brand .brand-intel { color: #4a9eff; font-weight: 700; font-size: 1.1rem; }
.site-nav {
    display: flex; align-items: center; gap: .25rem; flex: 1;
}
.site-nav a {
    color: var(--text-muted); font-size: .85rem; padding: .3rem .7rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    transition: color .15s, border-color .15s;
    white-space: nowrap;
}
.site-nav a:hover, .site-nav a.active {
    color: var(--text-primary);
    border-color: var(--border);
    text-decoration: none;
}
.site-nav a.active { color: var(--accent-blue); border-color: var(--accent-blue); }
.site-header .cta-btn {
    background: var(--accent-red); color: #fff; border: none;
    padding: .35rem .9rem; border-radius: var(--radius-sm);
    font-size: .82rem; font-weight: 600; cursor: pointer;
    white-space: nowrap; flex-shrink: 0;
    transition: opacity .15s;
    text-decoration: none;
}
.site-header .cta-btn:hover { opacity: .85; text-decoration: none; }

/* hamburger */
.hamburger { display: none; background: none; border: none; color: var(--text-primary); font-size: 1.4rem; cursor: pointer; }
.mobile-nav {
    display: none; flex-direction: column; gap: .5rem;
    background: var(--bg-dark); padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
}
.mobile-nav a { color: var(--text-muted); font-size: .9rem; padding: .3rem 0; }
.mobile-nav a:hover { color: var(--text-primary); }
.mobile-nav.open { display: flex; }

/* ─── AD PLACEHOLDERS ──────────────────────────────────────────── */
/* Note: the legacy decorative .ad-banner placeholder was removed from every
   page on 2026-05-08 — top-banner ads on docs/wiki sites have low CTR and
   added visual clutter. Real ad units now live in .ad-sidebar, .ad-content-block,
   and .ad-content-block--mid (auto-injected). */
/* Sidebar ad — bottom of the sticky right column, fixed height so the
   scrollspy above can take all remaining space. 250px is the AdSense
   "medium rectangle" standard size. */
.ad-sidebar {
    flex: 0 0 250px;        /* fixed 250px slot, never grows or shrinks */
    height: 250px;
    width: 100%;
    overflow: hidden;       /* clip any oversized creative inside the slot */
    border-radius: var(--radius);
}
/* When the sidebar ad is empty (no AdSense ins inside or unfilled),
   show the dashed-border preview so the slot is still visible during dev. */
.ad-sidebar:not(:has(ins.adsbygoogle)) {
    background: var(--bg-dark); border: 1px dashed var(--border);
    display: flex; align-items: center; justify-content: center;
    color: var(--text-dim); font-size: .75rem; letter-spacing: .06em;
    text-transform: uppercase;
}
.ad-inline {
    width: 100%; min-height: 90px;
    background: var(--bg-dark); border: 1px dashed var(--border);
    display: flex; align-items: center; justify-content: center;
    color: var(--text-dim); font-size: .75rem; letter-spacing: .06em;
    text-transform: uppercase; margin: 1.5rem 0;
}

/* Collapse AdSense slots that AdSense itself reported as "unfilled".
   By default AdSense reserves the full computed slot height even when no ad
   is shown, leaving a large empty gap. */
ins.adsbygoogle[data-ad-status="unfilled"] { display: none !important; }
.ad-content-block:has(> ins[data-ad-status="unfilled"]) { display: none; }
.ad-sidebar:has(> ins[data-ad-status="unfilled"]) { display: none; }

/* Development / pre-fill placeholder.
   When an ad slot's <ins> is still empty (AdSense hasn't injected an iframe
   yet — common on localhost, with ad-blockers, or before approval), paint a
   dashed-border "Advertisement" preview so the slot is visible during build.
   Once AdSense fills it (iframe inserted), :empty no longer matches and the
   placeholder treatment vanishes automatically. */
.ad-sidebar:has(> ins.adsbygoogle:empty),
.ad-content-block:has(> ins.adsbygoogle:empty) {
    position: relative;
    background: var(--bg-dark);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    min-height: 200px;
}
.ad-content-block:has(> ins.adsbygoogle:empty) {
    min-height: 250px;
}
.ad-sidebar:has(> ins.adsbygoogle:empty)::before,
.ad-content-block:has(> ins.adsbygoogle:empty)::before {
    content: 'Advertisement';
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: .75rem; font-weight: 600; letter-spacing: .12em;
    text-transform: uppercase; color: var(--text-dim);
}
/* The mid-content variant keeps its own border-top/bottom + top "Advertisement"
   label (defined above), so override the bigger placeholder block treatment. */
.ad-content-block--mid:has(> ins.adsbygoogle:empty) {
    background: transparent;
    border: none;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    min-height: 80px;
}

/* Mid-article ad — subtle "sponsored" treatment so it doesn't look like
   editorial content. The injector adds .ad-content-block--mid. */
.ad-content-block--mid {
    position: relative;
    padding-top: 1.5rem !important;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding-bottom: 1.5rem !important;
}
.ad-content-block--mid::before {
    content: 'Advertisement';
    position: absolute; top: .35rem; left: 50%;
    transform: translateX(-50%);
    font-size: .65rem; font-weight: 600; letter-spacing: .12em;
    text-transform: uppercase; color: var(--text-dim);
}
.ad-content-block--mid:has(> ins[data-ad-status="unfilled"]) { display: none; }

/* ─── MAIN CONTENT WRAPPER ─────────────────────────────────────── */
.page-wrap { flex: 1; width: 100%; max-width: 1160px; margin: 0 auto; padding: 2rem 1.5rem; }
.page-wrap.wide { max-width: 1280px; }
/* Article pages get a wider canvas so the central column has room for images & prose */
.page-wrap:has(.article-layout) { max-width: 1320px; }

/* ─── HERO ─────────────────────────────────────────────────────── */
.hero {
    padding: 5rem 0 4rem;
    text-align: center;
}
.hero h1 {
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: 800; line-height: 1.15;
    background: linear-gradient(135deg, #4a9eff 0%, #a0c8ff 60%, #e94560 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
    margin-bottom: 1rem;
}
.hero .subheadline {
    font-size: clamp(1rem, 2.5vw, 1.2rem); color: var(--text-muted);
    max-width: 680px; margin: 0 auto 2rem;
    line-height: 1.6;
}
.hero-btns { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.btn-primary {
    background: var(--accent-red); color: #fff;
    padding: .75rem 2rem; border-radius: var(--radius-sm);
    font-size: 1rem; font-weight: 600; border: none; cursor: pointer;
    transition: opacity .15s; text-decoration: none; display: inline-block;
}
.btn-primary:hover { opacity: .85; text-decoration: none; }
.btn-secondary {
    background: transparent; color: var(--text-primary);
    padding: .75rem 2rem; border-radius: var(--radius-sm);
    font-size: 1rem; font-weight: 600;
    border: 1px solid var(--border); cursor: pointer;
    transition: border-color .15s, color .15s; text-decoration: none; display: inline-block;
}
.btn-secondary:hover { border-color: var(--accent-blue); color: var(--accent-blue); text-decoration: none; }

/* ─── SECTION ──────────────────────────────────────────────────── */
.section { padding: 3.5rem 0; }
.section-title {
    font-size: clamp(1.4rem, 3vw, 2rem); font-weight: 700;
    text-align: center; margin-bottom: .5rem;
    color: var(--text-primary);
}
.section-sub {
    text-align: center; color: var(--text-muted);
    max-width: 600px; margin: 0 auto 2.5rem;
    font-size: .95rem;
}
.divider { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }

/* ─── CARDS ────────────────────────────────────────────────────── */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 1.25rem; }
.card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.5rem;
    transition: border-color .2s, box-shadow .2s;
}
.card:hover { border-color: var(--accent-blue); box-shadow: 0 0 18px var(--glow-blue); }
.card-icon { font-size: 2rem; margin-bottom: .75rem; }
.card h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: .4rem; }
.card p { font-size: .88rem; color: var(--text-muted); line-height: 1.55; }

/* ─── HOW IT WORKS ─────────────────────────────────────────────── */
.steps-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: 1.5rem; }
.step-item { text-align: center; padding: 1.25rem; }
.step-num {
    display: inline-flex; align-items: center; justify-content: center;
    width: 48px; height: 48px; border-radius: 50%;
    background: var(--accent-red); color: #fff; font-weight: 800; font-size: 1.1rem;
    margin: 0 auto .75rem;
}
.step-item h3 { font-size: 1rem; font-weight: 700; margin-bottom: .35rem; }
.step-item p { font-size: .87rem; color: var(--text-muted); }

/* ─── USE CASES ────────────────────────────────────────────────── */
.use-case-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 1.25rem; }
.use-case-card {
    background: var(--bg-dark); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.5rem;
    border-left: 3px solid var(--accent-blue);
}
.use-case-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: .5rem; color: var(--accent-blue); }
.use-case-card ul { padding-left: 1.1rem; color: var(--text-muted); font-size: .88rem; line-height: 1.7; }

/* ─── BLOG ─────────────────────────────────────────────────────── */
.blog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 1.5rem; }
.blog-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
    transition: border-color .2s, box-shadow .2s, transform .15s;
    display: flex; flex-direction: column;
    position: relative;            /* anchor for the stretched-link ::before */
    cursor: pointer;
}
.blog-card:hover {
    border-color: var(--accent-blue); box-shadow: 0 0 18px var(--glow-blue);
    transform: translateY(-2px);
}
/* Stretched link: the h2 anchor's ::before covers the whole card so the
   entire card is clickable, while keeping the visible link text on the title. */
.blog-card h2 a::before {
    content: ''; position: absolute; inset: 0; z-index: 1;
}
.blog-card-body { padding: 1.25rem; flex: 1; display: flex; flex-direction: column; }
.blog-tag {
    display: inline-block; font-size: .7rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .07em; color: var(--accent-blue); margin-bottom: .5rem;
}
.blog-card h2 { font-size: 1rem; font-weight: 700; margin-bottom: .4rem; line-height: 1.35; }
.blog-card h2 a { color: var(--text-primary); }
.blog-card h2 a:hover { color: var(--accent-blue); text-decoration: none; }
.blog-card p { font-size: .85rem; color: var(--text-muted); flex: 1; line-height: 1.55; margin-bottom: .75rem; }
.blog-meta { font-size: .75rem; color: var(--text-dim); position: relative; z-index: 2; }
/* Sit the "Read →" link above the stretched overlay so it can still be hovered directly. */
.read-more { font-size: .82rem; color: var(--accent-blue); font-weight: 600; position: relative; z-index: 2; }

/* ─── ARTICLE PAGE ─────────────────────────────────────────────── */
.article-layout { display: grid; grid-template-columns: 1fr 280px; gap: 2rem; align-items: start; }
/* Desktop: GitBook-style 3-column — wiki tree | content | scrollspy + ad */
@media (min-width: 1180px) { .article-layout { grid-template-columns: 230px 1fr 260px; } }
@media (max-width: 900px) { .article-layout { grid-template-columns: 1fr; } .ad-sidebar { display: none; } }

/* Right sidebar: a single sticky flex column holding scrollspy (top, ~80%)
   and the ad (bottom, ~20%), so both follow the reader together. */
.article-sidebar {
    position: sticky;
    top: 88px;
    align-self: start;
    max-height: calc(100vh - 110px);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
@media (max-width: 900px) {
    .article-sidebar { position: static; max-height: none; }
}
.article-content { min-width: 0; }
.article-header { margin-bottom: 2rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--border); }
.article-header .blog-tag { display: block; margin-bottom: .5rem; }
.article-header h1 { font-size: clamp(1.6rem, 3.5vw, 2.4rem); font-weight: 800; line-height: 1.2; margin-bottom: .75rem; }
.article-header .article-meta { color: var(--text-muted); font-size: .82rem; }
.article-body h2 { font-size: 1.4rem; font-weight: 700; margin: 2rem 0 .75rem; color: var(--text-primary); }
.article-body h3 { font-size: 1.1rem; font-weight: 700; margin: 1.5rem 0 .5rem; color: var(--accent-blue); }
.article-body p { margin-bottom: 1rem; font-size: .96rem; line-height: 1.75; color: #ccc; }
.article-body ul, .article-body ol { padding-left: 1.5rem; margin-bottom: 1rem; }
.article-body li { font-size: .96rem; line-height: 1.7; color: #ccc; margin-bottom: .25rem; }
.article-body strong { color: var(--text-primary); }
.article-body blockquote {
    border-left: 3px solid var(--accent-blue); padding: .75rem 1.25rem;
    background: var(--bg-card); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin: 1.5rem 0;
}
.article-body blockquote p { margin: 0; font-style: italic; color: var(--text-muted); }
.article-cta {
    background: linear-gradient(135deg, var(--bg-card), var(--bg-hover));
    border: 1px solid var(--accent-blue); border-radius: var(--radius);
    padding: 1.5rem; margin: 2rem 0; text-align: center;
}
.article-cta h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: .4rem; }
.article-cta p { font-size: .88rem; color: var(--text-muted); margin-bottom: 1rem; }
.article-sidebar { /* sticky moved to .scrollspy-toc so the TOC stays visible while related/ad blocks scroll normally */ }
.related-articles { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1.5rem; }
.related-articles h3 { font-size: .9rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); margin-bottom: 1rem; }
.related-articles ul { list-style: none; }
.related-articles li { margin-bottom: .6rem; }
.related-articles a { font-size: .85rem; color: var(--text-primary); }
.related-articles a:hover { color: var(--accent-blue); }

/* ─── CREDIBILITY ──────────────────────────────────────────────── */
.credibility { background: var(--bg-dark); border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem; text-align: center; }
.credibility p { color: var(--text-muted); font-size: .92rem; max-width: 560px; margin: .5rem auto 0; }

/* ─── CONTACT FORM ─────────────────────────────────────────────── */
.contact-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem; max-width: 560px; }
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; font-size: .85rem; color: var(--text-muted); margin-bottom: .35rem; }
.form-group input, .form-group textarea {
    width: 100%; background: var(--bg-dark); border: 1px solid var(--border);
    color: var(--text-primary); border-radius: var(--radius-sm);
    padding: .55rem .75rem; font-size: .9rem; font-family: inherit;
    outline: none; transition: border-color .15s;
}
.form-group input:focus, .form-group textarea:focus { border-color: var(--accent-blue); }
.form-group textarea { resize: vertical; min-height: 120px; }

/* ─── LEGAL PAGES ──────────────────────────────────────────────── */
.legal-body h2 { font-size: 1.2rem; font-weight: 700; margin: 2rem 0 .6rem; color: var(--text-primary); }
.legal-body h3 { font-size: 1rem; font-weight: 700; margin: 1.25rem 0 .4rem; color: var(--accent-blue); }
.legal-body p { font-size: .92rem; color: #ccc; line-height: 1.75; margin-bottom: .85rem; }
.legal-body ul { padding-left: 1.4rem; margin-bottom: .85rem; }
.legal-body li { font-size: .92rem; color: #ccc; line-height: 1.7; margin-bottom: .2rem; }

/* ─── SITE FOOTER ──────────────────────────────────────────────── */
.site-footer {
    background: var(--bg-dark); border-top: 1px solid var(--border);
    padding: 2.5rem 1.5rem 1.5rem;
    margin-top: auto;
}
.footer-inner { max-width: 1160px; margin: 0 auto; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 2rem; margin-bottom: 2rem; }
.footer-col h4 { font-size: .82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); margin-bottom: .75rem; }
.footer-col .brand { font-size: 1rem; font-weight: 700; color: var(--accent-blue); margin-bottom: .5rem; }
.footer-col p { font-size: .82rem; color: var(--text-dim); line-height: 1.6; }
.footer-col ul { list-style: none; }
.footer-col ul li { margin-bottom: .4rem; }
.footer-col ul a { font-size: .82rem; color: var(--text-dim); }
.footer-col ul a:hover { color: var(--text-primary); text-decoration: none; }
.footer-bottom { border-top: 1px solid var(--border); padding-top: 1rem; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem; }
.footer-bottom p { font-size: .75rem; color: var(--text-dim); }
.footer-bottom a { color: var(--text-dim); }
.footer-bottom a:hover { color: var(--accent-blue); text-decoration: none; }

/* ─── LATEST ARTICLES (homepage) ───────────────────────────────── */
.latest-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 1.25rem; }
.mini-article {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 1.1rem; transition: border-color .2s;
}
.mini-article:hover { border-color: var(--accent-blue); }
.mini-article .blog-tag { display: block; margin-bottom: .3rem; }
.mini-article h3 { font-size: .92rem; font-weight: 700; margin-bottom: .3rem; }
.mini-article h3 a { color: var(--text-primary); }
.mini-article h3 a:hover { color: var(--accent-blue); text-decoration: none; }
.mini-article p { font-size: .8rem; color: var(--text-muted); }

/* ─── MOCK UI PREVIEW ──────────────────────────────────────────── */
.ui-preview {
    background: var(--bg-dark); border: 1px solid var(--border); border-radius: var(--radius);
    overflow: hidden; max-width: 900px; margin: 2rem auto 0;
}
.ui-preview-bar { background: var(--bg-deep); padding: .45rem .75rem; display: flex; align-items: center; gap: .5rem; }
.ui-dot { width: 10px; height: 10px; border-radius: 50%; }
.ui-preview-body { padding: 1.25rem; display: grid; grid-template-columns: min(180px, 35%) 1fr; gap: 1rem; }
.ui-sidebar-mock { background: var(--bg-card); border-radius: var(--radius-sm); padding: .75rem; display: flex; flex-direction: column; gap: .5rem; }
.ui-sidebar-item { height: 10px; border-radius: 3px; background: var(--border); }
.ui-sidebar-item.active { background: var(--accent-red); width: 70%; }
.ui-map-mock { background: #0a1628; border-radius: var(--radius-sm); min-height: 200px; display: flex; align-items: center; justify-content: center; color: var(--text-dim); font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; position: relative; overflow: hidden; }
.ui-map-mock::before { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse at 40% 50%, rgba(74,158,255,.12) 0%, transparent 70%); }

/* ─── RESPONSIVE ────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .article-layout { grid-template-columns: 1fr; }
    .ad-sidebar { display: none; }
}
@media (max-width: 768px) {
    body { padding-top: 56px; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .page-wrap { padding: 1.5rem 1rem; }
    .hero { padding: 2.5rem 0 2rem; }
    .section { padding: 2rem 0; }
    /* Contacts and similar 2-col inline grids */
    .contact-grid { grid-template-columns: 1fr !important; }
    /* Tables: make them scrollable horizontally within their own container */
    .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    /* Charts: full width */
    canvas { max-width: 100% !important; width: 100% !important; height: auto !important; }
    /* Prevent any fixed-width element from overflowing */
    * { max-width: 100%; }
    /* But don't break flex/grid children sizing */
    img, svg, canvas, video, iframe { max-width: 100%; }
}
@media (max-width: 480px) {
    .footer-grid { grid-template-columns: 1fr; }
    .hero h1 { font-size: 1.8rem; }
    .hero { padding: 2rem 0 1.5rem; }
    .card { padding: 1.1rem; }
    .page-wrap { padding: 1rem .75rem; }
    .footer-bottom { flex-direction: column; align-items: flex-start; }
}

/* ═══════════════════════════════════════════════════════════════
   WIKI  — GW2 WvW Knowledge Base
   ═══════════════════════════════════════════════════════════════ */

/* ── Breadcrumb ── */
.wiki-breadcrumb {
    display: flex; align-items: center; flex-wrap: wrap; gap: .25rem;
    font-size: .78rem; color: var(--text-muted); margin-bottom: 1.5rem;
}
.wiki-breadcrumb a { color: var(--text-muted); }
.wiki-breadcrumb a:hover { color: var(--accent-blue); text-decoration: none; }
.wiki-breadcrumb span { color: var(--text-dim); }

/* ── TOC ── */
.wiki-toc {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.1rem 1.4rem;
    margin-bottom: 2rem; display: inline-block; min-width: 220px; max-width: 380px;
}
.wiki-toc-title { font-size: .78rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .07em; color: var(--text-muted); margin-bottom: .6rem; }
.wiki-toc ol { padding-left: 1.2rem; margin: 0; }
.wiki-toc li { font-size: .84rem; line-height: 1.7; }
.wiki-toc a { color: var(--text-primary); }
.wiki-toc a:hover { color: var(--accent-blue); text-decoration: none; }
.wiki-toc ol ol { margin-top: .2rem; }
.wiki-toc ol ol li { font-size: .79rem; color: var(--text-muted); }

/* ── Wiki tree nav (left rail, desktop only, GitBook-style) ── */
.wiki-tree-nav {
    position: sticky;
    top: 88px;
    align-self: start;
    max-height: calc(100vh - 110px);
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1rem .8rem;
    font-size: .85rem;
    z-index: 5;
}
.wiki-tree-nav .wt-section + .wt-section { margin-top: 1.1rem; padding-top: .9rem; border-top: 1px solid var(--border); }
.wiki-tree-nav .wt-section-title {
    display: block;
    font-size: .72rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .07em; color: var(--text-muted);
    padding: .25rem .35rem;
    margin-bottom: .4rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: color .12s, background .12s;
}
.wiki-tree-nav .wt-section-title:hover { color: var(--text-primary); background: rgba(255,255,255,.03); text-decoration: none; }
.wiki-tree-nav .wt-section-title.active { color: var(--accent-blue); background: rgba(56,139,253,.08); }
.wiki-tree-nav .wt-list,
.wiki-tree-nav .wt-sublist { list-style: none; padding: 0; margin: 0; }
.wiki-tree-nav .wt-item { margin: 0; }
.wiki-tree-nav .wt-link {
    display: block;
    padding: .32rem .55rem;
    color: var(--text-muted);
    border-left: 2px solid transparent;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    text-decoration: none;
    line-height: 1.4;
    transition: color .12s, background .12s, border-color .12s;
}
.wiki-tree-nav .wt-link:hover { color: var(--text-primary); background: rgba(255,255,255,.04); text-decoration: none; }
.wiki-tree-nav .wt-link.active {
    color: var(--accent-blue);
    background: rgba(56,139,253,.10);
    border-left-color: var(--accent-blue);
    font-weight: 600;
}
.wiki-tree-nav .wt-sublist { margin: .15rem 0 .3rem .9rem; border-left: 1px solid var(--border); }
.wiki-tree-nav .wt-sublink { font-size: .8rem; padding: .26rem .55rem; }
.wiki-tree-nav .wt-item-current-branch > .wt-link { color: var(--text-primary); }
@media (max-width: 1179px) { .wiki-tree-nav { display: none; } }

/* Scrollbar styling for the wiki tree (so it doesn't look like a Windows scrollbar) */
.wiki-tree-nav::-webkit-scrollbar { width: 6px; }
.wiki-tree-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.wiki-tree-nav::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ── Scrollspy sidebar TOC (top of the sticky right column, fills available space) ── */
.scrollspy-toc {
    flex: 1 1 auto;     /* take all space the ad doesn't claim */
    min-height: 0;      /* lets the inner overflow-y actually scroll */
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1.25rem;
    overflow-y: auto;
}
.scrollspy-toc::-webkit-scrollbar { width: 6px; }
.scrollspy-toc::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.scrollspy-toc::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }
.scrollspy-back {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    padding: .35rem .6rem;
    margin: 0 0 .9rem -.3rem;
    border-radius: var(--radius-sm);
    transition: color .12s, background .12s;
}
.scrollspy-back:hover {
    color: var(--accent-blue);
    background: rgba(56, 139, 253, 0.08);
    text-decoration: none;
}
.scrollspy-back-arrow { font-size: 1rem; line-height: 1; }
.scrollspy-toc-title {
    font-size: .78rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .07em; color: var(--text-muted); margin-bottom: .8rem;
}
.scrollspy-list { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--border); }
.scrollspy-item { margin: 0; }
.scrollspy-item.lvl-h3 { padding-left: .9rem; }
.scrollspy-item a {
    display: block;
    padding: .35rem .75rem;
    margin-left: -2px;
    font-size: .85rem;
    line-height: 1.4;
    color: var(--text-muted);
    border-left: 2px solid transparent;
    text-decoration: none;
    transition: color .12s, border-color .12s, background .12s;
}
.scrollspy-item.lvl-h3 a { font-size: .8rem; }
.scrollspy-item a:hover { color: var(--text-primary); background: rgba(255,255,255,.03); }
.scrollspy-item a.active {
    color: var(--accent-blue);
    border-left-color: var(--accent-blue);
    font-weight: 600;
    background: rgba(56, 139, 253, 0.08);
}
@media (max-width: 900px) { .scrollspy-toc { display: none; } }

/* ── Callout boxes ── */
.callout {
    border-left: 3px solid var(--accent-blue);
    background: var(--bg-card); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    padding: .75rem 1.1rem; margin: 1.5rem 0; display: flex; gap: .7rem; align-items: flex-start;
}
.callout-icon { font-size: 1.1rem; line-height: 1.6; flex-shrink: 0; }
.callout-body { flex: 1; }
.callout-body strong { display: block; font-size: .85rem; margin-bottom: .25rem; color: var(--text-primary); }
.callout-body p { font-size: .88rem; color: var(--text-muted); margin: 0; line-height: 1.6; }
.callout.tip  { border-color: #3dcf8e; }
.callout.tip .callout-icon { color: #3dcf8e; }
.callout.warn { border-color: var(--accent-gold); }
.callout.warn .callout-icon { color: var(--accent-gold); }
.callout.info { border-color: var(--accent-blue); }
.callout.info .callout-icon { color: var(--accent-blue); }
.callout.danger { border-color: var(--accent-red); }
.callout.danger .callout-icon { color: var(--accent-red); }

/* ── Stat / data tables ── */
.wiki-table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; font-size: .88rem; }
.wiki-table th {
    background: var(--bg-dark); color: var(--text-muted); font-size: .75rem;
    text-transform: uppercase; letter-spacing: .06em;
    padding: .55rem .85rem; border: 1px solid var(--border); text-align: left;
}
.wiki-table td { padding: .55rem .85rem; border: 1px solid var(--border); color: #ccc; vertical-align: top; }
.wiki-table tr:nth-child(even) td { background: rgba(255,255,255,.02); }
.wiki-table tr:hover td { background: var(--bg-hover); }
.wiki-table .gold { color: var(--accent-gold); font-weight: 700; }
.wiki-table .blue { color: var(--accent-blue); font-weight: 700; }
.wiki-table .red  { color: var(--accent-red);  font-weight: 700; }
.wiki-table .green { color: #3dcf8e; font-weight: 700; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 1.5rem 0; }

/* ── Figures / images ── */
.wiki-figure {
    margin: 2rem 0; text-align: center;
}
.wiki-figure img {
    border-radius: var(--radius); border: 1px solid var(--border);
    max-width: 100%; height: auto; display: block; margin: 0 auto;
    background: var(--bg-dark);
}
.wiki-figure figcaption {
    font-size: .78rem; color: var(--text-dim); margin-top: .5rem;
    font-style: italic;
}
/* Graceful fallback when wiki images 404 */
.wiki-figure img[src=""], .wiki-figure img:not([src]) {
    min-height: 120px; background: var(--bg-dark);
}

/* ── Image grid (2-up, 3-up) ── */
.wiki-img-grid {
    display: grid; gap: 1rem; margin: 1.5rem 0;
}
.wiki-img-grid.cols-2 { grid-template-columns: repeat(auto-fill, minmax(min(280px,100%), 1fr)); }
.wiki-img-grid.cols-3 { grid-template-columns: repeat(auto-fill, minmax(min(220px,100%), 1fr)); }
.wiki-img-grid figure { margin: 0; }
.wiki-img-grid img { border-radius: var(--radius-sm); border: 1px solid var(--border); width: 100%; height: auto; object-fit: cover; }
.wiki-img-grid figcaption { font-size: .74rem; color: var(--text-dim); margin-top: .3rem; text-align: center; }

/* ── Glossary terms ── */
.glossary-list { list-style: none; padding: 0; margin: 0; }
.glossary-entry { border-bottom: 1px solid var(--border); padding: 1rem 0; }
.glossary-entry:first-child { border-top: 1px solid var(--border); }
.glossary-term { font-size: 1rem; font-weight: 700; color: var(--accent-blue); margin-bottom: .25rem; }
.glossary-term abbr { font-size: .75rem; color: var(--text-muted); font-weight: 400; margin-left: .4rem; }
.glossary-def { font-size: .9rem; color: #ccc; line-height: 1.7; margin: 0; }

/* Term names that have a wiki page render as deep-links with a small "→".
   Hover shows the underline so the affordance is unambiguous. */
.glossary-term .gloss-term-link {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dashed transparent;
    transition: border-bottom-color .12s, color .12s;
}
.glossary-term .gloss-term-link::after {
    content: ' \2197';   /* ↗ — links out to a wiki page */
    font-size: .85em;
    opacity: .55;
    margin-left: .2rem;
    transition: opacity .12s;
}
.glossary-term .gloss-term-link:hover {
    color: var(--text-primary);
    border-bottom-color: var(--accent-blue);
    text-decoration: none;
}
.glossary-term .gloss-term-link:hover::after { opacity: 1; }

/* Alphabet fast-nav */
.glossary-alpha { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: 1.5rem; }
.glossary-alpha a {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); font-size: .8rem; font-weight: 700;
    color: var(--text-muted); transition: all .15s;
}
.glossary-alpha a:hover, .glossary-alpha a.has-entries { border-color: var(--accent-blue); color: var(--accent-blue); text-decoration: none; }

/* ── Code / API snippets ── */
.wiki-code {
    background: #0a0a1a; border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 1rem 1.25rem; font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: .82rem; color: #a8d8ff; overflow-x: auto;
    margin: 1rem 0; line-height: 1.6;
}
.wiki-code .c  { color: #555; font-style: italic; } /* comment */
.wiki-code .k  { color: #c792ea; } /* keyword */
.wiki-code .s  { color: #c3e88d; } /* string */
.wiki-code .n  { color: #ffcb6b; } /* number */
.wiki-code .u  { color: #80cbc4; } /* url/property */
.wiki-code .p  { color: #89ddff; } /* punctuation */

/* ── Category hub grid ── */
.wiki-hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
    gap: 1.25rem; margin: 2rem 0;
}
.wiki-hub-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.5rem;
    transition: border-color .2s, box-shadow .2s, transform .15s;
    display: flex; flex-direction: column; text-decoration: none;
    position: relative;
}
.wiki-hub-card:hover {
    border-color: var(--accent-blue); box-shadow: 0 0 22px var(--glow-blue);
    transform: translateY(-2px); text-decoration: none;
}
.wiki-hub-card .wc-icon { font-size: 2.2rem; margin-bottom: .75rem; }
.wiki-hub-card .wc-title { font-size: 1.05rem; font-weight: 700; color: var(--text-primary); margin-bottom: .35rem; }
.wiki-hub-card .wc-desc { font-size: .84rem; color: var(--text-muted); line-height: 1.55; flex: 1; }
.wiki-hub-card .wc-tag {
    display: inline-block; font-size: .7rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .07em;
    color: var(--accent-blue); margin-top: .75rem;
}

/* Stretched-link pattern: the .wc-link makes the whole card clickable,
   while .wc-sub chips below stay independently clickable. */
.wiki-hub-card .wc-link {
    display: flex; flex-direction: column; flex: 1;
    color: inherit; text-decoration: none;
}
.wiki-hub-card .wc-link::before {
    content: ''; position: absolute; inset: 0;
    border-radius: inherit; z-index: 0;
}
.wiki-hub-card .wc-sublinks {
    margin-top: .9rem; padding-top: .75rem;
    border-top: 1px solid var(--border);
    display: flex; flex-wrap: wrap; gap: .35rem;
    position: relative; z-index: 1;
}
.wiki-hub-card .wc-sublinks-label {
    font-size: .68rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .07em; color: var(--text-muted);
    margin-right: .15rem; align-self: center;
}
.wiki-hub-card .wc-sub {
    display: inline-block;
    font-size: .74rem; font-weight: 600;
    color: var(--text-primary);
    background: rgba(255,255,255,.04);
    padding: .25rem .6rem; border-radius: 999px;
    text-decoration: none;
    border: 1px solid transparent;
    transition: background .12s, color .12s, border-color .12s;
    position: relative; z-index: 2;
}
.wiki-hub-card .wc-sub:hover {
    background: rgba(56, 139, 253, 0.15);
    color: var(--accent-blue);
    border-color: var(--accent-blue);
    text-decoration: none;
}

/* Compact variant for the Focused Topics row */
.wiki-hub-card.compact { padding: 1.1rem 1.25rem; }
.wiki-hub-card.compact .wc-title { font-size: .95rem; }
.wiki-hub-card.compact .wc-desc { font-size: .8rem; }
.wiki-hub-card.compact .wc-icon { font-size: 1.4rem; margin-bottom: .35rem; }

/* ── Glossary auto-link (terms inside articles linked to the glossary entry) ── */
.gloss-link {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dotted var(--accent-blue);
    cursor: help;
    transition: color .12s, border-color .12s;
}
.gloss-link:hover {
    color: var(--accent-blue);
    border-bottom-color: var(--accent-blue);
    border-bottom-style: solid;
    text-decoration: none;
}

/* Highlight a glossary entry briefly when linked-to via #anchor */
.glossary-entry:target {
    outline: 2px solid var(--accent-blue);
    outline-offset: 4px;
    border-radius: var(--radius-sm);
    background: rgba(56, 139, 253, 0.06);
    transition: background 1.5s, outline 1.5s;
}

/* ── Inline tag badges ── */
.tag-badge {
    display: inline-block; font-size: .7rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .05em;
    padding: .15rem .5rem; border-radius: 20px; margin: 0 .1rem;
    vertical-align: middle;
}
.tag-badge.red   { background: rgba(233,69,96,.2);   color: var(--accent-red); }
.tag-badge.blue  { background: rgba(74,158,255,.2);  color: var(--accent-blue); }
.tag-badge.green { background: rgba(61,207,142,.2);  color: #3dcf8e; }
.tag-badge.gold  { background: rgba(240,160,48,.2);  color: var(--accent-gold); }
.tag-badge.gray  { background: rgba(255,255,255,.08); color: var(--text-muted); }

/* ── Wiki article TOC sidebar (desktop) ── */
.wiki-layout {
    display: grid;
    grid-template-columns: 220px 1fr 300px;
    gap: 2rem; align-items: start;
}
.wiki-left-nav { position: sticky; top: 72px; }
.wiki-left-nav h4 {
    font-size: .75rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .07em; color: var(--text-muted); margin-bottom: .75rem;
}
.wiki-left-nav ul { list-style: none; padding: 0; }
.wiki-left-nav li { margin-bottom: .35rem; }
.wiki-left-nav a { font-size: .84rem; color: var(--text-muted); display: block; padding: .2rem 0; }
.wiki-left-nav a:hover, .wiki-left-nav a.active { color: var(--accent-blue); text-decoration: none; }
.wiki-left-nav a.current-page { color: var(--accent-blue); font-weight: 700; }

/* ── Progress / rank bar ── */
.rank-bar { background: var(--bg-dark); border-radius: 20px; height: 8px; overflow: hidden; margin: .4rem 0 .7rem; }
.rank-bar-fill { height: 100%; border-radius: 20px; background: linear-gradient(90deg, var(--accent-blue), #a0c8ff); }

/* ── Quick-stat chips ── */
.stat-chips { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0; }
.stat-chip {
    background: var(--bg-dark); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: .35rem .75rem;
    font-size: .8rem; color: var(--text-muted);
}
.stat-chip strong { color: var(--text-primary); }

/* ── GDPR Cookie Consent Modal ────────────────────────────────────────── */
#gdpr-consent-banner {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(5, 8, 22, .72);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    transition: opacity .25s ease;
    overflow-y: auto;
}
#gdpr-consent-banner.gcb-visible  { opacity: 1; }
#gdpr-consent-banner.gcb-hidden   { opacity: 0; }

.gcb-inner {
    width: 100%;
    max-width: 560px;
    margin: auto;
    background: #1a1a36;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0,0,0,.6);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    transform: translateY(8px) scale(.98);
    transition: transform .25s ease;
}
#gdpr-consent-banner.gcb-visible .gcb-inner { transform: translateY(0) scale(1); }

.gcb-text { }
.gcb-title {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: .5rem;
    color: var(--text-primary);
}
.gcb-body {
    font-size: .88rem;
    color: var(--text-muted);
    line-height: 1.55;
    margin: 0;
}
.gcb-link { color: var(--accent-blue); text-decoration: none; }
.gcb-link:hover { text-decoration: underline; }

.gcb-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.gcb-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem 1.25rem;
}
.gcb-toggle {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: .85rem;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
}
.gcb-toggle input[type="checkbox"] { accent-color: var(--accent-blue); cursor: pointer; }

.gcb-btns {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    justify-content: flex-end;
}
.gcb-btn {
    padding: .55rem 1rem;
    font-size: .85rem;
    font-weight: 600;
    border-radius: var(--radius);
    cursor: pointer;
    border: none;
    transition: opacity .15s;
    white-space: nowrap;
}
.gcb-btn:hover { opacity: .85; }
.gcb-btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
}
.gcb-btn-primary {
    background: var(--accent-blue);
    color: #fff;
}

/* Lock body scroll while modal is open */
body.gcb-open { overflow: hidden; }

@media (max-width: 600px) {
    #gdpr-consent-banner { padding: .5rem; align-items: flex-start; }
    .gcb-inner    { padding: 1.1rem; gap: 1rem; margin-top: 1rem; }
    .gcb-title    { font-size: 1rem; }
    .gcb-body     { font-size: .82rem; }
    .gcb-btns     { flex-direction: column; }
    .gcb-btn      { width: 100%; text-align: center; }
}

/* ── Responsive overrides ── */
@media (max-width: 1100px) {
    .wiki-layout { grid-template-columns: 1fr 300px; }
    .wiki-left-nav { display: none; }
}
@media (max-width: 900px) {
    .wiki-layout { grid-template-columns: 1fr; }
    .wiki-left-nav { display: none; }
    .ad-sidebar { display: none; }
}
