/* SPDX-License-Identifier: AGPL-3.0-or-later */
/* Copyright (C) 2026 Tech1k */
/* TestnetHub stylesheet: the shared, token-driven design system from the testnet
   suite (CypherFaucet / TestnetPool / TestnetWallet / TestnetScan / TestnetSwap),
   reused so the whole family looks like one product, plus a "TestnetHub additions"
   block for the hub's landing / router / guide components. Dark by default; light
   is an explicit opt-in via data-theme, set by /assets/theme-init.js. */

:root {
    color-scheme: dark;

    /* Shared testnet-suite design tokens - kept in sync with the rest of the family. */
    --bg:        #14161b;
    --card:      #1c1f27;
    --surface:   #232730;
    --border:    #2a2e37;
    --border2:   #353b46;
    --text:      #e6e8ec;
    --muted:     #a7adba;
    --faint:     #8b919b;
    --num:       #e6e8ec;

    --accent:     #6b86ff;
    --accent-soft:#9db2ff;
    --accent-bg:  #1b2236;
    --accent-dim: #2e3a5c;
    --accent-2:   #e07a3e;
    --btn:        #4a63e0;
    --on-accent:  #ffffff;

    /* Per-coin accents (used on the coin guide heros + chips) */
    --btc: #f7931a;
    --ltc: #55b3f3;
    --xmr: #ff6b3d;

    --ok:   #4fbf75; --ok-bg:   rgba(79, 191, 117, 0.13);
    --bad:  #ef6b6b; --bad-bg:  rgba(239, 107, 107, 0.13);
    --warn: #e0894f; --warn-bg: rgba(224, 137, 79, 0.14);

    --nav-bg: rgba(20, 22, 27, 0.86);

    --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --mono: ui-monospace, 'SF Mono', 'JetBrains Mono', 'DejaVu Sans Mono', Menlo, Consolas, 'Liberation Mono', monospace;

    --r: 12px;
    --r-sm: 8px;
    --pill: 999px;
    --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
    --maxw: 960px;
}

/* Light theme: explicit opt-in via data-theme (set by /assets/theme-init.js, toggled by
   the nav button). Markup hardcodes data-theme="dark", so no-JS users get the dark default. */
:root[data-theme="light"] {
    color-scheme: light;

    --bg:        #f7f7f7;
    --card:      #ffffff;
    --surface:   #f4f5f7;
    --border:    #e5e5e5;
    --border2:   #d8dbe0;
    --text:      #1b1d23;
    --muted:     #5b6270;
    --faint:     #606673;
    --num:       #1b1d23;

    --accent:     #3a54e6;
    --accent-soft:#2f49c9;
    --accent-bg:  #eef1ff;
    --accent-dim: #d7ddff;
    --accent-2:   #c05617;
    --btn:        #3a54e6;

    --btc: #d97b06;
    --ltc: #2477b8;
    --xmr: #d4491f;

    --ok:   #1f8f4d; --ok-bg:   rgba(31, 143, 77, 0.12);
    --bad:  #c62f2f; --bad-bg:  rgba(198, 47, 47, 0.10);
    --warn: #8a4b12; --warn-bg: rgba(178, 95, 22, 0.12);

    --nav-bg: rgba(255, 255, 255, 0.85);
}

@font-face {
    font-family: 'Inter';
    src: url('/assets/fonts/inter.woff2') format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

/* ---- Base -------------------------------------------------------------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    font-variant-numeric: tabular-nums;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

::selection { background: rgba(107, 134, 255, 0.28); color: var(--text); }

a, a:visited { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
/* Inline text links in the content area carry a resting underline, so a link is
   never signalled by color alone (WCAG 1.4.1). Component links opt out below. */
#main a { text-decoration: underline; text-underline-offset: 2px; }
#main a.formbtn, #main a.btn-secondary, #main a.route, #main a.flow-node, #main a.guide-card, #main a.anchor, #main .pagenav a { text-decoration: none; }
/* Card-style links must keep their text color after being visited (a:visited
   would otherwise recolor the whole card's inherited text to the accent). */
#main a.route:visited, #main a.flow-node:visited, #main a.guide-card:visited { color: var(--text); }

code, pre, .mono { font-family: var(--mono); }
.mono { word-break: break-word; }

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

/* ---- Layout ------------------------------------------------------------ */
#main {
    width: 90%;
    max-width: var(--maxw);
    align-self: center;
    margin: 24px 0 0;
    flex: 1 0 auto;
}

/* Short pages: pin the footer to the bottom of the viewport via flexbox. */
#main.filled { display: flex; flex-direction: column; }
#main.filled footer { margin-top: auto; }

/* ---- Nav (frosted, sticky, full-bleed; content capped to --maxw) ------- */
.navbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    width: 100%;
    margin: 0;
    padding: 12px max(20px, calc((100% - var(--maxw)) / 2));
    background: var(--nav-bg);
    -webkit-backdrop-filter: saturate(140%) blur(10px);
    backdrop-filter: saturate(140%) blur(10px);
    border-bottom: 1px solid var(--border);
}

.navbar a { text-decoration: none; font-weight: 600; }

/* Brand wordmark: "TestnetHub" text in the nav */
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-logo { width: 26px; height: 26px; display: block; flex: none; color: var(--accent); }
.brand-logo .mark-bg { fill: var(--accent-bg); }
.brand-name { font-size: 21px; font-weight: 700; color: var(--text); letter-spacing: 0.2px; }
.brand-name b { color: var(--accent); font-weight: 700; }

.nav-links { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }

.nav-links a {
    color: var(--muted);
    font-size: 15px;
    padding: 6px 10px;
    border-radius: var(--r-sm);
}
.nav-links a:hover { color: var(--text); text-decoration: none; }

#curpage { color: var(--accent) !important; background: var(--accent-bg); }

/* Theme toggle (sun/moon) */
.theme-toggle { background: var(--surface); border: 1px solid var(--border); color: var(--text); width: 34px; height: 34px; border-radius: 999px; cursor: pointer; padding: 0; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle .ico { width: 17px; height: 17px; display: block; }
:root[data-theme="dark"] .theme-toggle .ico-moon { display: none; }
:root[data-theme="light"] .theme-toggle .ico-sun { display: none; }

/* CSS-only hamburger (mobile). Padding gives a ~44px touch target without moving
   the bars (the negative margin cancels it in the layout). */
.menu-toggle { display: none; }
.hamburger { display: none; flex-direction: column; justify-content: center; align-items: center; cursor: pointer; gap: 5px; padding: 12px; margin: -12px; }
.hamburger div { width: 25px; height: 3px; background: var(--text); border-radius: 2px; transition: transform .2s ease, opacity .2s ease; }

@media (max-width: 680px) {
    .hamburger { display: flex; }
    .menu-toggle { display: block; position: absolute; width: 1px; height: 1px; opacity: 0; margin: 0; }
    .menu-toggle:focus-visible + .hamburger { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }
    .nav-links {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        margin-top: 6px;
    }
    .nav-links a { width: 100%; padding: 11px 12px; }
    .menu-toggle:checked + .hamburger + .nav-links { display: flex; }
    /* Bars morph into an X when the menu is open (visible open/close feedback). */
    .menu-toggle:checked + .hamburger div:nth-child(1) { transform: translateY(8px) rotate(45deg); }
    .menu-toggle:checked + .hamburger div:nth-child(2) { opacity: 0; }
    .menu-toggle:checked + .hamburger div:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }
}

/* Touch devices: raise the smaller controls to the ~44px tap-target guideline. */
@media (hover: none) {
    .theme-toggle { width: 44px; height: 44px; }
    .copybtn { min-height: 44px; }
}

/* Skip-to-content link: off-screen until focused. */
.skip-link { position: absolute; left: 8px; top: -48px; z-index: 200; background: var(--accent); color: #fff; padding: 8px 14px; border-radius: var(--r-sm); transition: top .15s ease; }
.skip-link:focus { top: 8px; }

/* ---- Cards ------------------------------------------------------------- */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--r);
    overflow: hidden;
    margin: 16px 0;
    width: 100%;
}

.card-header {
    background: var(--surface);
    margin: 0;
    padding: 13px 18px;
    font-weight: 700;
    font-size: 1em;
    border-bottom: 1px solid var(--border);
}

.card-body { padding: 16px 18px; }

.success { background: var(--ok-bg) !important; color: var(--ok); border-bottom-color: var(--ok); }
.successborder { border-color: var(--ok); }
.alert { background: var(--bad-bg) !important; color: var(--bad); border-bottom-color: var(--bad); }
.alertborder { border-color: var(--bad); }

/* ---- Buttons ----------------------------------------------------------- */
.formbtn {
    display: inline-block;
    text-align: center;
    padding: 0.7em 1.2em;
    background: var(--btn);
    border: 1px solid var(--btn);
    color: var(--on-accent);
    font-family: inherit;
    font-size: 1.02rem;
    font-weight: 600;
    border-radius: var(--pill);
    cursor: pointer;
    transition: filter 0.15s ease, transform 0.15s ease;
}
.formbtn:hover { filter: brightness(1.08); text-decoration: none; transform: translateY(-1px); }
.formbtn:disabled { opacity: 0.5; cursor: default; }
.formbtn:link, .formbtn:visited { color: var(--on-accent); }

.btn-secondary, .formbtn.ghost {
    display: inline-block;
    text-align: center;
    padding: 0.7em 1.2em;
    border-radius: var(--pill);
    border: 1px solid var(--border2);
    background: transparent;
    color: var(--text);
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.15s ease;
}
.btn-secondary:hover, .formbtn.ghost:hover { border-color: var(--accent); background: var(--accent-bg); text-decoration: none; filter: none; transform: translateY(-1px); }
.formbtn.ghost:link, .formbtn.ghost:visited { color: var(--text); }

/* ---- Badges + dots ----------------------------------------------------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 10px;
    border-radius: var(--pill);
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 0.9em;
    font-weight: 600;
}
.dot { font-size: 0.85em; line-height: 1; }
.dot-ok { color: var(--ok); }
.dot-warn { color: var(--warn); }
.dot-off { color: var(--muted); }

/* ---- Footer ------------------------------------------------------------ */
footer { margin-top: 40px; padding-bottom: 8px; }
.foot-inner { max-width: var(--maxw); margin: 0 auto; padding: 22px 20px; display: flex; gap: 8px 16px; flex-wrap: wrap; align-items: center; justify-content: center; border-top: 1px solid var(--border); font-size: 14px; }
.foot-inner a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; padding: 5px 3px; }
.foot-inner a:hover { color: var(--accent); }
.foot-inner .faint { color: var(--faint); }

/* ===================================================================== */
/* TestnetHub additions - landing / router / guide components, built on   */
/* the shared tokens so they inherit dark/light theming automatically.    */
/* ===================================================================== */

/* Generic helpers */
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.center { text-align: center; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.wrap-btns { display: flex; flex-wrap: wrap; gap: 10px; }
.lede { font-size: 1.1rem; color: var(--muted); margin: 8px 0 0; max-width: 62ch; }
.small { font-size: 0.9rem; }
h1, h2, h3 { line-height: 1.25; }
.section-title { font-size: 1.25rem; font-weight: 700; margin: 34px 0 4px; }
.section-sub { color: var(--muted); margin: 0 0 14px; }

/* External-link marker */
.ext::after { content: "\2197"; font-size: .72em; opacity: .55; margin-left: 2px; vertical-align: 1px; }

/* Ecosystem tool logos (self-hosted copies of each tool's own mark). */
.tool-logo { border-radius: 6px; vertical-align: middle; flex: none; }
.card-header .tool-logo { margin-right: 10px; vertical-align: -0.26em; }
.ext .tool-logo { margin-right: 7px; }

/* ---- Hero -------------------------------------------------------------- */
.hero { background: var(--accent-bg); border-color: var(--border2); }
.hero .card-body { padding: 30px 26px; }
.hero h1 { margin: 0 0 8px; font-size: clamp(1.8rem, 5vw, 2.5rem); letter-spacing: -0.02em; }
.hero h1 .grad {
    background: linear-gradient(100deg, var(--accent-soft), var(--accent));
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero .lede { font-size: 1.15rem; }
.hero-tag { font-size: 1.28rem; font-weight: 600; margin: 0 0 6px; color: var(--text); }
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }

/* Coin-guide hero: tinted by --coin (set inline per page) */
.hero.coin { background: color-mix(in srgb, var(--coin) 12%, var(--card)); border-color: color-mix(in srgb, var(--coin) 40%, var(--border)); }
.hero.coin h1 .grad { background: none; color: var(--coin); -webkit-text-fill-color: var(--coin); }
.hero-eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 0.82rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.hero-eyebrow .coin-ico { width: 22px; height: 22px; }

/* ---- Router grid (the "map" into the stack) ---------------------------- */
.routes { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 14px; }
.route {
    display: flex; flex-direction: column;
    background: var(--card); border: 1px solid var(--border); border-radius: var(--r);
    padding: 18px; text-decoration: none; color: var(--text);
    transition: border-color .15s ease, transform .15s ease, background-color .15s ease;
}
.route:hover { border-color: var(--accent); transform: translateY(-2px); text-decoration: none; background: color-mix(in srgb, var(--accent) 6%, var(--card)); }
.route-top { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.route-logo { width: 42px; height: 42px; border-radius: 11px; flex: none; display: block; }
.route-name { font-weight: 700; font-size: 1.08rem; }
.route-tool { font-size: 0.8rem; color: var(--accent); font-weight: 600; }
.route-desc { color: var(--muted); font-size: 0.94rem; margin: 0; flex: 1; }
.route-go { margin-top: 12px; font-size: 0.85rem; font-weight: 600; color: var(--accent); }
.route-go::after { content: " \2192"; }

/* ---- Numbered "what can you do" list ----------------------------------- */
.dolist { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 14px; counter-reset: dostep; }
.doitem { display: grid; grid-template-columns: 34px 1fr; gap: 12px; align-items: start; padding: 4px 0; }
.doitem .n { counter-increment: dostep; width: 30px; height: 30px; border-radius: var(--pill); background: var(--accent-bg); color: var(--accent); border: 1px solid var(--border2); display: flex; align-items: center; justify-content: center; font-weight: 700; }
.doitem .n::before { content: counter(dostep); }
.doitem h3 { margin: 3px 0 3px; font-size: 1rem; }
.doitem p { margin: 0; color: var(--muted); font-size: .94rem; }

/* ---- Flow diagram (Get coins -> Send -> Watch -> Swap -> Learn) --------- */
.flow { display: flex; flex-wrap: wrap; align-items: stretch; gap: 10px; margin: 4px 0; }
.flow-node {
    flex: 1 1 120px; min-width: 110px;
    background: var(--surface); border: 1px solid var(--border2); border-radius: var(--r-sm);
    padding: 12px 10px; text-align: center; text-decoration: none; color: var(--text);
    display: flex; flex-direction: column; gap: 4px; justify-content: center;
    transition: border-color .15s ease, background-color .15s ease;
}
a.flow-node:hover { border-color: var(--accent); background: var(--accent-bg); text-decoration: none; }
.flow-node .fn-ico { font-size: 20px; line-height: 1; }
.flow-node .fn-t { font-weight: 700; font-size: 0.92rem; }
.flow-node .fn-s { font-size: 0.76rem; color: var(--muted); }
.flow-arrow { display: flex; align-items: center; color: var(--accent); font-size: 20px; font-weight: 700; flex: none; }
@media (max-width: 640px) {
    .flow { flex-direction: column; }
    .flow-arrow { justify-content: center; transform: rotate(90deg); }
}

/* ---- Steps (how-to) ---------------------------------------------------- */
.steps { display: grid; gap: 14px; counter-reset: step; margin: 4px 0; }
.step { display: grid; grid-template-columns: 34px 1fr; gap: 12px; align-items: start; }
.step .n { counter-increment: step; width: 30px; height: 30px; border-radius: var(--pill); background: var(--accent-bg); color: var(--accent); border: 1px solid var(--border2); display: flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.step .n::before { content: counter(step); }
.step h3 { margin: 2px 0 4px; font-size: 1.02rem; }
.step p { margin: 0 0 6px; color: var(--muted); font-size: .95rem; }
.step :last-child { margin-bottom: 0; }

/* ---- Feature / definition list ----------------------------------------- */
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.feature { margin: 0; }
.feature h3 { margin: 0 0 3px; font-size: 1rem; }
.feature p { margin: 0; color: var(--muted); font-size: 0.95rem; }

/* ---- Stat tiles -------------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 12px 14px; }
.stat .k { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.stat .v { font-size: 1.2rem; font-weight: 700; margin-top: 2px; }

/* ---- Audience chips ---------------------------------------------------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: var(--pill); background: var(--surface); border: 1px solid var(--border); font-size: 0.88rem; font-weight: 600; color: var(--text); }

/* Coin chips */
.coin-ico { width: 20px; height: 20px; border-radius: 50%; display: inline-block; flex: none; vertical-align: text-bottom; }
.coin-chip { display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px; border-radius: var(--pill); background: var(--surface); border: 1px solid var(--border); font-weight: 600; font-size: 0.9rem; }

/* ---- Warning / notice box (fake-money disclaimer) ---------------------- */
.warnbox {
    display: flex; gap: 12px; align-items: flex-start;
    background: var(--warn-bg); border: 1px solid var(--warn); border-radius: var(--r);
    padding: 14px 16px; margin: 16px 0;
}
.warnbox .wb-ico { flex: none; font-size: 20px; line-height: 1.3; }
.warnbox .wb-body { min-width: 0; }
.warnbox h3 { margin: 0 0 6px; font-size: 1rem; color: var(--warn); }
.warnbox ul { margin: 0; padding-left: 18px; }
.warnbox li { color: var(--text); margin: 2px 0; }
.warnbox p { margin: 0; }

/* ---- Callouts (inline, within prose) ----------------------------------- */
.callout { border: 1px solid var(--border2); border-left-width: 4px; border-radius: var(--r-sm); background: var(--surface); padding: 12px 16px; margin: 16px 0; }
.callout p:first-child { margin-top: 0; }
.callout p:last-child { margin-bottom: 0; }
.callout .co-title { font-weight: 700; margin: 0 0 4px; }
.callout.tip { border-left-color: var(--accent); }
.callout.tip .co-title { color: var(--accent); }
.callout.warn { border-left-color: var(--warn); background: var(--warn-bg); }
.callout.warn .co-title { color: var(--warn); }
.callout.danger { border-left-color: var(--bad); background: var(--bad-bg); }
.callout.danger .co-title { color: var(--bad); }
.callout.note { border-left-color: var(--faint); }

/* ---- Guide index ------------------------------------------------------- */
.guide-group { margin: 0 0 26px; }
.guide-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 12px; }
.guide-card { display: block; background: var(--card); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 14px 16px; text-decoration: none; color: var(--text); transition: border-color .15s ease, transform .15s ease; }
.guide-card:hover { border-color: var(--accent); transform: translateY(-2px); text-decoration: none; }
.guide-card .gc-t { font-weight: 700; margin: 0 0 3px; }
.guide-card .gc-d { color: var(--muted); font-size: 0.9rem; margin: 0; }
.guide-card .gc-badge { display: inline-block; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--accent); margin-bottom: 6px; }

/* ---- Table of contents (on-page) --------------------------------------- */
.toc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 12px 16px; margin: 0 0 20px; }
.toc-title { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 0 0 8px; }
.toc ul { margin: 0; padding-left: 18px; columns: 2; column-gap: 24px; }
.toc li { margin: 3px 0; break-inside: avoid; }
@media (max-width: 560px) { .toc ul { columns: 1; } }

/* ---- Prose (guide body typography) ------------------------------------- */
.prose { font-size: 1rem; }
.prose h2 { font-size: 1.35rem; margin: 30px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border); scroll-margin-top: 76px; }
.prose h3 { font-size: 1.1rem; margin: 22px 0 8px; scroll-margin-top: 76px; }
.prose h2:first-child, .prose h3:first-child { margin-top: 4px; }
.prose p { margin: 12px 0; }
.prose ul, .prose ol { margin: 12px 0; padding-left: 24px; }
.prose li { margin: 6px 0; }
.prose li > ul, .prose li > ol { margin: 6px 0; }
.prose a { text-decoration: underline; text-underline-offset: 2px; text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.prose a:hover { text-decoration-color: var(--accent); }
.prose strong { color: var(--text); font-weight: 700; }
.prose hr { border: none; border-top: 1px solid var(--border); margin: 26px 0; }
.prose blockquote { margin: 16px 0; padding: 4px 16px; border-left: 3px solid var(--accent); color: var(--muted); background: var(--surface); border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.prose blockquote p { margin: 8px 0; }

/* Inline code + code blocks */
code { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); border: 1px solid var(--border); padding: 1px 6px; border-radius: 5px; font-size: 0.88em; overflow-wrap: break-word; }
pre { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 14px 16px; overflow-x: auto; font-size: 13px; line-height: 1.55; margin: 14px 0; }
pre code { background: none; border: none; padding: 0; font-size: inherit; }
kbd { font-family: var(--mono); font-size: 0.82em; background: var(--card); border: 1px solid var(--border2); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; }

/* Tables (spec / comparison tables in guides) */
.table-wrap { overflow-x: auto; margin: 16px 0; border: 1px solid var(--border); border-radius: var(--r-sm); }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
th, td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
thead th { background: var(--surface); font-weight: 700; white-space: nowrap; }
tbody tr:last-child td { border-bottom: none; }
td code, th code { white-space: nowrap; }

/* Inline explanatory diagrams (theme-aware SVG, no scripts, no external assets) */
.diagram { margin: 20px 0; }
.diagram svg { display: block; width: 100%; height: auto; max-width: 560px; margin: 0 auto; }
.diagram figcaption { color: var(--muted); font-size: 0.9rem; line-height: 1.5; text-align: center; margin: 10px auto 0; max-width: 60ch; }

/* Anchor links on headings */
.anchor { color: var(--faint); text-decoration: none; font-weight: 400; opacity: 0; margin-left: 8px; }
.prose h2:hover .anchor, .prose h3:hover .anchor { opacity: 1; }
.anchor:hover { color: var(--accent); text-decoration: none; }

/* Definition rows (key/value spec lists) */
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.95rem; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--muted); }
.kv .v { font-weight: 600; text-align: right; }
.kv .v.mono { font-family: var(--mono); font-size: 0.86rem; word-break: break-all; }

/* Breadcrumb / back link on guide pages */
.crumb { font-size: 0.88rem; color: var(--muted); margin: 4px 0 2px; }
.crumb a { color: var(--muted); }
.crumb a:hover { color: var(--accent); }

/* Next/prev page nav at the bottom of guides */
.pagenav { display: flex; gap: 12px; flex-wrap: wrap; margin: 26px 0 0; }
.pagenav a { flex: 1 1 220px; background: var(--card); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 12px 16px; text-decoration: none; color: var(--text); transition: border-color .15s ease; }
.pagenav a:hover { border-color: var(--accent); text-decoration: none; }
.pagenav .pn-dir { font-size: 0.78rem; color: var(--muted); font-weight: 600; }
.pagenav .pn-t { font-weight: 700; margin-top: 2px; }
.pagenav .pn-next { text-align: right; }

/* ---- Donate ------------------------------------------------------------ */
.donate-grid { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.qr { flex: none; background: #fff; border: 1px solid var(--border); border-radius: var(--r-sm); padding: 8px; line-height: 0; display: inline-block; }
.qr img { display: block; width: 168px; height: 168px; max-width: 100%; }
.donate-side { flex: 1; min-width: 240px; }
.addr { display: block; font-family: var(--mono); font-size: 13px; word-break: break-all; background: var(--surface); border: 1px solid var(--border2); border-radius: var(--r-sm); padding: 0.6em 0.7em; margin: 0 0 10px; }
.coin-tag { font-weight: 400; font-size: 13px; color: var(--muted); }
.copybtn { font: inherit; font-size: 13px; font-weight: 600; padding: 0.5em 1em; border-radius: var(--pill); border: 1px solid var(--border2); background: var(--surface); color: var(--text); cursor: pointer; transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease; }
.copybtn:hover { border-color: var(--accent); background: var(--accent-bg); }
/* Copied state: keep the label at full --text contrast (green-on-green failed AA
   in light mode); signal success with a green border + check mark instead. */
.copybtn.copied { border-color: var(--ok); color: var(--text); background: var(--surface); }
.copybtn.copied::before { content: "\2713\00a0"; color: var(--ok); font-weight: 700; }

/* Copy button auto-wrapped around <pre><code> blocks at build time. It sits in its
   own right-aligned row above the code: always visible, never overlapping the text,
   and a full-size tap target on touch (via the .copybtn rules). */
.codeblock { display: flex; flex-direction: column; margin: 14px 0; }
.codeblock pre { margin: 0; }
.code-copy { align-self: flex-end; margin: 0 0 6px; }

/* Visually hidden but available to screen readers (e.g. the copy live region). */
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; }

/* Status page: service name + live badge on one line. */
.svc-name { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 1.05rem; margin: 0; }
.svc [data-detail] { margin: 8px 0 0; }

/* Scrollbar */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
*::-webkit-scrollbar-thumb:hover { background: var(--border2); }

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

/* Print: guides get printed by students and devs, so give paper an ink-friendly
   light layout. Redeclaring the tokens flips every component at once; interactive
   chrome (nav, footer, buttons, flows) is dropped, and external link targets are
   exposed inline. */
@media print {
    :root {
        color-scheme: light;
        --bg: #fff; --card: #fff; --surface: #f4f4f4; --border: #bbb; --border2: #bbb;
        --text: #111; --muted: #444; --faint: #555; --num: #111;
        --accent: #00339a; --accent-soft: #00339a; --accent-bg: #eef; --accent-dim: #ccd;
        --btn: #00339a; --on-accent: #fff;
        --warn: #8a4b12; --warn-bg: #fbf3ea; --ok: #1f7a43; --ok-bg: #eef7f0; --bad: #b02020; --bad-bg: #fbeeee;
    }
    body { background: #fff; color: #111; }
    .navbar, .skip-link, .hamburger, .menu-toggle, .theme-toggle,
    .pagenav, .flow, .flow-arrow, .hero-cta, .routes, footer { display: none !important; }
    #main { width: 100%; max-width: none; margin: 0; }
    a { text-decoration: underline; }
    .card, .callout, .warnbox, .toc, pre, .table-wrap, .step, .doitem, .feature { break-inside: avoid; }
    h2, h3 { break-after: avoid; }
    .hero, .hero.coin { background: #fff !important; border-color: #bbb !important; }
    h1 .grad, .hero.coin h1 .grad { -webkit-text-fill-color: #111 !important; color: #111 !important; background: none !important; }
    /* Expose external link targets on paper */
    .prose a[href^="http"]::after, .feature a[href^="http"]::after {
        content: " (" attr(href) ")"; font-size: 0.85em; color: #555; word-break: break-all;
    }
}
