/* ==========================================================================
   ComputingCache

   Colour tokens live in palettes.css, which must be loaded FIRST. Nothing in
   this file names a hue, so the whole site can be recoloured by setting
   data-palette on <html> without touching a line here.
   ========================================================================== */

:root {
    --body-font:    'Open Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --heading-font: 'Playfair Display', Georgia, serif;
    --speed:        0.22s;
    --max-width:    1100px;
    --radius:       10px;
}

/* Repaint smoothly when the theme toggle flips a palette, but never animate
   the very first paint, and never fight prefers-reduced-motion. */
:root.theme-transition,
:root.theme-transition * {
    transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--body-font);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
    font-family: var(--heading-font);
    line-height: 1.25;
    margin: 0 0 0.5rem;
}

a { color: var(--accent-light); }

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.25rem;
}

.section { padding: 4rem 0; }
.section-alt { background: var(--bg-alt); border-block: 1px solid var(--border); }

.section-title {
    font-size: clamp(1.6rem, 3.5vw, 2.1rem);
    margin-bottom: 0.35rem;
}

.section-lede {
    color: var(--text-muted);
    max-width: 62ch;
    margin: 0 0 2rem;
}

.visually-hidden {
    position: absolute;
    width: 1px; height: 1px;
    margin: -1px; padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* ── Header ───────────────────────────────────────────────────────── */

header.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0.85rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: var(--text);
}

.logo-mark {
    width: 26px;
    height: 26px;
    flex: none;
    color: var(--accent);
}

.logo-text {
    font-family: var(--heading-font);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

nav.site-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 0.35rem;
}

nav.site-nav a {
    display: block;
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.93rem;
    font-weight: 600;
    transition: color var(--speed), background var(--speed);
}

nav.site-nav a:hover,
nav.site-nav a:focus-visible {
    color: var(--text);
    background: var(--accent-dim);
}

.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 26px;
    height: 18px;
    padding: 0;
    background: none;
    border: 0;
    cursor: pointer;
}

.menu-toggle span {
    display: block;
    height: 2px;
    width: 100%;
    border-radius: 2px;
    background: var(--text);
    transition: transform var(--speed), opacity var(--speed);
}

.menu-toggle.active span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.menu-toggle.active span:nth-child(2) { opacity: 0; }
.menu-toggle.active span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

@media (max-width: 760px) {
    .menu-toggle { display: flex; }

    nav.site-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg-alt);
        border-bottom: 1px solid var(--border);
        padding: 0.5rem 1.25rem 1rem;
    }

    nav.site-nav.active { display: block; }
    nav.site-nav ul { flex-direction: column; gap: 0; }
    nav.site-nav a { padding: 0.7rem 0.5rem; }
}

/* ── Hero ─────────────────────────────────────────────────────────── */

.hero {
    position: relative;
    isolation: isolate;
    padding: 5rem 0 4rem;
    overflow: hidden;
}

#hero-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    /* Decorative only: the mesh must never eat a click. */
    pointer-events: none;
}

.hero::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(circle at 18% 25%, var(--accent-dim), transparent 58%),
        radial-gradient(circle at 82% 8%, rgba(34, 211, 238, 0.10), transparent 52%);
    pointer-events: none;
}

.hero h1 {
    font-size: clamp(2.2rem, 6vw, 3.4rem);
    letter-spacing: -0.02em;
    margin-bottom: 0.75rem;
}

.hero .tagline {
    font-size: clamp(1rem, 2.2vw, 1.18rem);
    color: var(--text-muted);
    max-width: 60ch;
    margin: 0 0 1.75rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: var(--accent-dim);
    color: var(--accent-light);
    border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 1.1rem;
}

.btn-row { display: flex; flex-wrap: wrap; gap: 0.75rem; }

.btn {
    display: inline-block;
    padding: 0.7rem 1.4rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 700;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background var(--speed), border-color var(--speed), transform var(--speed);
}

.btn-primary { background: var(--accent); color: var(--accent-on); }
.btn-primary:hover { background: var(--accent-light); transform: translateY(-1px); }

.btn-secondary {
    background: transparent;
    color: var(--text);
    border-color: var(--border);
}
.btn-secondary:hover { border-color: var(--accent); background: var(--accent-dim); }

/* ── Cards & service grid ─────────────────────────────────────────── */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
    gap: 1.1rem;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.4rem;
    display: flex;
    flex-direction: column;
    transition: border-color var(--speed), transform var(--speed), box-shadow var(--speed);
}

.card:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.card-head {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 0.6rem;
}

.card-icon {
    width: 34px;
    height: 34px;
    flex: none;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: var(--accent-dim);
    color: var(--accent-light);
}

.card-icon svg { width: 19px; height: 19px; }

.card h3 { margin: 0; font-size: 1.15rem; }

.card .proto {
    display: block;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.74rem;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

.card p { margin: 0 0 1rem; font-size: 0.94rem; color: var(--text-muted); }

.card-foot {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.card-foot a {
    font-weight: 700;
    font-size: 0.9rem;
    text-decoration: none;
    border-bottom: 1px dotted currentColor;
}
.card-foot a:hover { border-bottom-style: solid; }

.pill {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    padding: 0.18rem 0.55rem;
    border-radius: 999px;
    border: 1px solid currentColor;
    white-space: nowrap;
}

.pill-open    { color: var(--ok); }
.pill-request { color: var(--warn); }
.pill-lab     { color: var(--accent-alt); }

/* ── Note / callout ───────────────────────────────────────────────── */

.note {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1rem;
    align-items: start;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius);
    padding: 1.1rem 1.3rem;
    margin: 2rem 0 0;
}

.note-icon { color: var(--accent-light); flex: none; padding-top: 0.15rem; }
.note-icon svg { width: 22px; height: 22px; display: block; }
.note h3 { font-size: 1.05rem; margin: 0 0 0.35rem; }
.note p  { margin: 0 0 0.5rem; font-size: 0.93rem; color: var(--text-muted); }
.note p:last-child { margin-bottom: 0; }

@media (max-width: 540px) {
    .note { grid-template-columns: 1fr; }
}

/* ── Contact ──────────────────────────────────────────────────────── */

.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0.9rem;
    margin-bottom: 2.2rem;
}

.contact-card {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 1rem 1.1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    transition: border-color var(--speed), transform var(--speed);
}

.contact-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.contact-card svg { width: 22px; height: 22px; flex: none; color: var(--accent-light); }
.contact-card strong { display: block; font-size: 0.95rem; }
.contact-card span {
    display: block;
    font-size: 0.82rem;
    color: var(--text-muted);
    word-break: break-word;
}

.contact-form-intro { color: var(--text-muted); margin: 0 0 1rem; }

.contact-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    max-width: 720px;
}

.cf-field { display: flex; flex-direction: column; }
.cf-field.full { grid-column: 1 / -1; }

.cf-field label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.contact-form input,
.contact-form textarea {
    font: inherit;
    font-size: 0.95rem;
    color: var(--text);
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.65rem 0.8rem;
    transition: border-color var(--speed);
}

.contact-form input:focus,
.contact-form textarea:focus { outline: none; border-color: var(--accent); }

.contact-form textarea { resize: vertical; min-height: 8rem; }

/* Honeypot: off-screen rather than display:none, which some bots skip. */
.cf-hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.cf-submit-row {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.cf-status { font-size: 0.9rem; color: var(--text-muted); }
.cf-status.ok  { color: var(--ok); }
.cf-status.err { color: var(--danger); }

.contact-form button[type="submit"] {
    font: inherit;
    font-weight: 700;
    background: var(--accent);
    color: var(--accent-on);
    border: 0;
    border-radius: 8px;
    padding: 0.7rem 1.4rem;
    cursor: pointer;
    transition: background var(--speed);
}

.contact-form button[type="submit"]:hover { background: var(--accent-light); }
.contact-form button[type="submit"][disabled] { opacity: 0.6; cursor: default; }

@media (max-width: 620px) {
    .contact-form { grid-template-columns: 1fr; }
}

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

footer.site-footer {
    background: var(--bg-alt);
    border-top: 1px solid var(--border);
    padding: 2.5rem 0 2rem;
    font-size: 0.9rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.75rem;
    margin-bottom: 1.75rem;
}

.footer-grid h4 {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    margin: 0 0 0.6rem;
}

.footer-grid ul { list-style: none; margin: 0; padding: 0; }
.footer-grid li { margin-bottom: 0.35rem; }
.footer-grid a { color: var(--text); text-decoration: none; }
.footer-grid a:hover { color: var(--accent-light); }
.footer-grid p { margin: 0 0 0.35rem; color: var(--text-muted); }

.footer-bottom {
    border-top: 1px solid var(--border);
    padding-top: 1.25rem;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ── Legal pages ──────────────────────────────────────────────────── */

.legal {
    max-width: 800px;
    margin: 0 auto;
    padding: 3rem 1.25rem 4rem;
}

.legal-hero { margin-bottom: 2rem; }

.legal-hero h1 {
    font-size: clamp(2rem, 4.5vw, 2.7rem);
    margin: 0.7rem 0 0.3rem;
}

.legal-hero .updated { color: var(--text-muted); font-size: 0.88rem; margin: 0; }

.legal > p { color: var(--text); }

.legal-tldr {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1rem;
    align-items: start;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius);
    padding: 1.1rem 1.3rem;
    margin: 1.6rem 0 2.2rem;
}

.legal-tldr .icon { color: var(--accent-light); flex: none; padding-top: 0.2rem; }
.legal-tldr .icon svg { width: 22px; height: 22px; display: block; }
.legal-tldr h2 { font-size: 1.02rem; margin: 0 0 0.3rem; }
.legal-tldr ul { margin: 0; padding-left: 1.1rem; font-size: 0.92rem; }
.legal-tldr li { margin-bottom: 0.2rem; }
.legal-tldr li::marker { color: var(--accent-light); }

.legal-section {
    margin-top: 1.7rem;
    padding: 0.4rem 0 0.4rem 1.2rem;
    border-left: 2px solid var(--border);
    transition: border-color var(--speed);
}

.legal-section:hover { border-left-color: var(--accent); }
.legal-section h2 { font-size: 1.25rem; margin: 0 0 0.5rem; }
.legal-section h3 { font-size: 1rem; margin: 1rem 0 0.35rem; }
.legal-section p  { margin: 0 0 0.7rem; }
.legal-section p:last-child { margin-bottom: 0; }
.legal-section ul, .legal-section ol { padding-left: 1.4rem; margin: 0.4rem 0 0.8rem; }
.legal-section li { margin-bottom: 0.3rem; }

.legal a { color: var(--accent-light); text-decoration: none; border-bottom: 1px dotted currentColor; }
.legal a:hover { border-bottom-style: solid; }

.legal address {
    font-style: normal;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.9rem 1.1rem;
    margin: 0.6rem 0;
    font-size: 0.94rem;
}

@media (max-width: 540px) {
    .legal-tldr { grid-template-columns: 1fr; }
}

/* ── Error pages ──────────────────────────────────────────────────── */

.error-page {
    min-height: 60vh;
    display: grid;
    place-items: center;
    text-align: center;
    padding: 3rem 1.25rem;
}

.error-page .code {
    font-family: var(--heading-font);
    font-size: clamp(4rem, 14vw, 7rem);
    line-height: 1;
    color: var(--accent);
    margin: 0;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ── Utilities ────────────────────────────────────────────────────── */

.center { margin-inline: auto; justify-content: center; }

.footnote { margin-top: 1.5rem; font-size: 0.9rem; }

/* ── Crisis resources ─────────────────────────────────────────────
   Deliberately set apart from the surrounding legal text: someone who
   lands here mid-crisis should be able to spot it without reading the
   page. Uses the calm cyan accent rather than the warning red/amber. */

.crisis-note {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent-alt);
    border-radius: var(--radius);
    padding: 1.1rem 1.3rem;
    margin: 0.9rem 0 1rem;
}

.crisis-note p { margin: 0 0 0.6rem; }
.crisis-note ul { margin: 0; padding-left: 1.2rem; }
.crisis-note li { margin-bottom: 0.4rem; }
.crisis-note li:last-child { margin-bottom: 0; }
.crisis-note li::marker { color: var(--accent-alt); }

/* ── Theme toggle ─────────────────────────────────────────────────
   Two icons live in the button; CSS decides which is visible, so the
   script only ever sets data-theme and never touches the markup. The
   icon shown is the theme you would switch TO. */

.theme-toggle {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: none;
    padding: 0;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: color var(--speed), border-color var(--speed), background var(--speed);
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
    color: var(--accent-light);
    border-color: var(--accent);
    background: var(--accent-dim);
}

.theme-toggle svg { width: 17px; height: 17px; display: block; }

/* Dark theme active -> offer the sun. Light active -> offer the moon. */
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
    :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: block; }

/* The header packs logo + toggle + burger on small screens. */
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Nav and the header actions cluster on the right; the logo holds the left.
   On mobile the nav is taken out of flow, leaving logo | actions. */
nav.site-nav { margin-left: auto; }

/* ── Reveal on scroll ─────────────────────────────────────────────
   Starting styles apply only once JS has added .reveal-ready, so with
   JS off (or reduced motion) everything is simply visible. */

.reveal-ready [data-reveal] {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.5s ease, transform 0.5s ease;
    transition-delay: var(--reveal-delay, 0ms);
    will-change: opacity, transform;
}

.reveal-ready [data-reveal].is-revealed {
    opacity: 1;
    transform: none;
    will-change: auto;
}

@media (prefers-reduced-motion: reduce) {
    .reveal-ready [data-reveal] {
        opacity: 1 !important;
        transform: none !important;
    }
}

/* ── Status band ──────────────────────────────────────────────────
   Sits directly under the hero and breaks the page between the
   headline and the service grid. */

.status-band {
    background: var(--bg-alt);
    border-block: 1px solid var(--border);
}

.status-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0.9rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem 1.5rem;
    flex-wrap: wrap;
    font-size: 0.9rem;
}

.status-live {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    font-weight: 700;
    color: var(--text);
}

.status-checked {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.status-facts {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
    margin-left: auto;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.status-facts b {
    color: var(--text);
    font-weight: 700;
}

/* ── Status dots ──────────────────────────────────────────────────
   One shared component: a dot in the band and a dot on every service
   card. Unknown is the honest default until the first response. */

.dot {
    position: relative;
    display: inline-block;
    width: 9px;
    height: 9px;
    flex: none;
    border-radius: 50%;
    background: var(--text-muted);
}

.dot.is-up   { background: var(--ok); }
.dot.is-down { background: var(--danger); }
.dot.is-unknown { background: var(--text-muted); }

/* A slow halo on the healthy dot: enough to read as live, not enough to
   pull the eye away from the text. */
.dot.is-up::after {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 1px solid var(--ok);
    opacity: 0;
    animation: dot-pulse 2.8s ease-out infinite;
}

@keyframes dot-pulse {
    0%   { opacity: 0.55; transform: scale(0.6); }
    70%  { opacity: 0;    transform: scale(1.25); }
    100% { opacity: 0;    transform: scale(1.25); }
}

@media (prefers-reduced-motion: reduce) {
    .dot.is-up::after { animation: none; }
}

.card-status {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
}

.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    margin: -1px; padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* ── Card polish ──────────────────────────────────────────────────
   A faint accent wash sweeps in from the top-left on hover, so the
   grid responds to the pointer instead of only lifting. */

.card { position: relative; overflow: hidden; }

.card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 0% 0%, var(--accent-dim), transparent 60%);
    opacity: 0;
    transition: opacity var(--speed);
    pointer-events: none;
}

.card:hover::before { opacity: 1; }

.card-icon { transition: transform var(--speed), background var(--speed); }
.card:hover .card-icon { transform: scale(1.08); }

@media (max-width: 760px) {
    .status-facts { margin-left: 0; }
}

/* ── Service status line ──────────────────────────────────────────
   Lives inside the Services section, aligned with the heading, so it
   reads as a caption for the grid rather than a bar across the page. */

.service-status {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
    margin: -0.75rem 0 1.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

.service-status .status-checked {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.footer-facts { list-style: none; margin: 0; padding: 0; }
.footer-facts li { margin-bottom: 0.35rem; color: var(--text-muted); }
.footer-facts b { color: var(--text); font-weight: 700; }

/* ── Live relay panel ─────────────────────────────────────────────
   A monitoring-console read: dark inset surface, lane guides, and a
   legend that doubles as the running tally. */

.relay-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.1rem 1.1rem;
    overflow: hidden;
}

.relay-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
    font-size: 0.86rem;
}

.relay-live {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.8rem;
}

/* The head dot tracks the socket, not a service probe, so it is driven
   by data-relay on the section rather than the .dot state classes. */
.relay-live .dot { background: var(--text-muted); }
#relay[data-relay="live"] .relay-live .dot { background: var(--ok); }
#relay[data-relay="down"] .relay-live .dot { background: var(--danger); }

#relay[data-relay="live"] .relay-live .dot::after {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 1px solid var(--ok);
    opacity: 0;
    animation: dot-pulse 2.8s ease-out infinite;
}

.relay-rate { color: var(--text-muted); font-size: 0.82rem; }
.relay-rate b { color: var(--accent-light); font-weight: 700; font-size: 1rem; }

#relay-canvas {
    display: block;
    width: 100%;
    height: 160px;
    /* A soft fade on the left so blips age out rather than clipping. */
    -webkit-mask-image: linear-gradient(to right, transparent, #000 12%, #000 100%);
    mask-image: linear-gradient(to right, transparent, #000 12%, #000 100%);
}

.relay-legend {
    list-style: none;
    margin: 0.85rem 0 0;
    padding: 0.85rem 0 0;
    border-top: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.relay-legend li { display: inline-flex; align-items: center; gap: 0.4rem; }
.relay-legend b { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
.relay-legend .relay-total { margin-left: auto; }

.swatch {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-light);
    opacity: 0.8;
}

.swatch-alt { background: var(--accent-alt); }

#relay[data-relay="down"] #relay-canvas { opacity: 0.25; }

@media (max-width: 620px) {
    .relay-legend .relay-total { margin-left: 0; }
}

/* ── Federation reach ─────────────────────────────────────────────
   A wide, short stage: the orbit is squashed into a disc so it reads
   as a plane seen at an angle rather than a sphere. */

.federation-stage {
    position: relative;
    width: 100%;
    height: clamp(280px, 42vw, 440px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background:
        radial-gradient(ellipse at 50% 50%, var(--accent-dim), transparent 62%),
        var(--bg-card);
    overflow: hidden;
}

#federation-canvas { display: block; width: 100%; height: 100%; }

#peer-count {
    color: var(--accent-light);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

#federation[data-peers="unavailable"] .federation-stage { opacity: 0.6; }

/* ── Uptime sparkline ─────────────────────────────────────────────
   A 24h strip on each service card. Hidden until there is data, so a
   fresh deploy shows a clean card rather than an empty box. */

.card-spark {
    margin: 0 0 0.9rem;
    height: 18px;
    opacity: 0.75;
    transition: opacity var(--speed);
}

.card:hover .card-spark { opacity: 1; }

.card-spark svg { display: block; width: 100%; height: 100%; }
.card-spark rect.ok      { fill: var(--ok); opacity: 0.45; }
.card-spark rect.partial { fill: var(--warn); opacity: 0.85; }
.card-spark rect.down    { fill: var(--danger); opacity: 0.9; }

/* ── Federation page ──────────────────────────────────────────────── */

.container.narrow { max-width: 760px; }

.page-title {
    font-size: clamp(2rem, 5vw, 3rem);
    letter-spacing: -0.02em;
    margin: 0.6rem 0 0.9rem;
}

/* Numbered flow: a spine with the steps hanging off it. */
.steps {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1.1rem;
}

.steps li {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.6rem 1.1rem 1.1rem;
}

.step-n {
    position: absolute;
    top: -0.75rem;
    left: 1.1rem;
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--accent);
    color: var(--accent-on);
    font-size: 0.8rem;
    font-weight: 700;
}

.steps h3 { font-size: 1.02rem; margin: 0 0 0.35rem; }
.steps p { margin: 0; font-size: 0.9rem; color: var(--text-muted); }

/* ── Sandbox ──────────────────────────────────────────────────────── */

.sandbox {
    display: grid;
    grid-template-columns: minmax(0, 1.9fr) minmax(240px, 1fr);
    gap: 1.1rem;
    align-items: start;
}

.sb-stage {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem;
}

.sb-home {
    background: var(--bg-alt);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    padding: 0.9rem 1rem;
    margin-bottom: 1.1rem;
    transition: box-shadow var(--speed);
}

.sb-home.has-copy { box-shadow: 0 0 0 3px var(--accent-dim); }
.sb-home h4 { margin: 0; font-size: 1rem; }

.sb-home-state {
    display: inline-block;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.76rem;
    color: var(--text-muted);
    margin-bottom: 0.65rem;
}

.sb-home-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.sb-peers {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 0.9rem;
}

.sb-peer {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.85rem 0.9rem;
    transition: border-color var(--speed), box-shadow var(--speed);
}

.sb-peer.has-copy { border-color: var(--warn); }
.sb-peer h4 { margin: 0 0 0.35rem; font-size: 0.92rem; }
.sb-peer p { margin: 0 0 0.7rem; font-size: 0.8rem; color: var(--text-muted); }

.sb-tags { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-bottom: 0.5rem; }

.tag {
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.12rem 0.4rem;
    border-radius: 999px;
    border: 1px solid currentColor;
}

.tag.follows { color: var(--accent-light); }
.tag.copy    { color: var(--warn); }
.tag.blocked { color: var(--danger); }
.tag.muted   { color: var(--text-muted); }

.sb-btn {
    font: inherit;
    font-size: 0.8rem;
    font-weight: 700;
    width: 100%;
    margin-bottom: 0.35rem;
    padding: 0.45rem 0.7rem;
    border-radius: 7px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    cursor: pointer;
    transition: border-color var(--speed), background var(--speed), color var(--speed);
}

.sb-btn:hover:not([disabled]) { border-color: var(--accent); background: var(--accent-dim); }
.sb-btn[disabled] { opacity: 0.45; cursor: default; }
.sb-btn.primary { background: var(--accent); color: var(--accent-on); border-color: var(--accent); }
.sb-btn.primary:hover:not([disabled]) { background: var(--accent-light); }
.sb-home-actions .sb-btn { width: auto; margin-bottom: 0; }

/* Delivery packet: a dot flung from the home server to each recipient. */
.sb-packet {
    position: absolute;
    width: 9px;
    height: 9px;
    margin: -4.5px 0 0 -4.5px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent);
    pointer-events: none;
    transition: transform 0.55s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.55s ease;
    z-index: 3;
}

.sb-side {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.1rem 1.1rem;
}

.sb-objectives-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
}

.sb-side h3 { font-size: 0.95rem; margin: 0 0 0.5rem; }
.sb-log-head { margin-top: 1.2rem !important; }
.sb-score { font-weight: 700; color: var(--accent-light); font-variant-numeric: tabular-nums; }

.sb-objectives { list-style: none; margin: 0; padding: 0; font-size: 0.84rem; }
.sb-objectives li {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    margin-bottom: 0.35rem;
    color: var(--text-muted);
}
.sb-objectives li.done { color: var(--text); }
.sb-objectives .tick {
    width: 1rem;
    flex: none;
    color: var(--ok);
    font-weight: 700;
}

.sb-log {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 0.8rem;
    max-height: 230px;
    overflow-y: auto;
}

.sb-log li {
    padding: 0.4rem 0 0.4rem 0.6rem;
    border-left: 2px solid var(--border);
    margin-bottom: 0.3rem;
    color: var(--text-muted);
}

.sb-log li.good { border-left-color: var(--ok); color: var(--text); }
.sb-log li.warn { border-left-color: var(--warn); color: var(--text); }
.sb-log li.bad  { border-left-color: var(--danger); color: var(--text); }

.sb-reset { margin-top: 1rem; width: 100%; }

@media (max-width: 820px) {
    .sandbox { grid-template-columns: 1fr; }
}

/* Call to action pairing a button with a line of explanation. */
.cta-row {
    display: flex;
    align-items: center;
    gap: 1rem 1.25rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

.cta-note {
    margin: 0;
    max-width: 46ch;
    font-size: 0.9rem;
    color: var(--text-muted);
}
