/* DataHub
   ------------------------------------------------------------------
   Single stylesheet for the rendered pages and the gate. Dark by design:
   the 3D viewer and the Stream player are dark, and scanned material
   reads better against a deep ground. No framework, no inline styles
   (the CSP forbids them), system font stack so nothing is fetched.

   Classes keyed by a data type (badge-model, media-video, viewer-model...)
   take the type's id from src/types.js; a new type gets its own rules
   under "Badges" and "Cards" below. */

/* Country flags. Windows has no flag emoji and draws the two letters
   instead ("BZ" for Belize), so flags come from this font everywhere: the
   Twemoji flags (CC BY 4.0, credited on the privacy page), subset by
   TalkJS (country-flag-emoji-polyfill, MIT; licence beside the file). The
   unicode-range limits it to flag characters, so a browser downloads it
   only for a page that shows a flag, and no other text changes. To
   upgrade, copy the package's dist/TwemojiCountryFlags.woff2 and
   LICENSE.md into css/fonts under the new version and point src here. */
@font-face {
    font-family: "Twemoji Country Flags";
    unicode-range: U+1F1E6-1F1FF, U+1F3F4, U+E0062-E0063, U+E0065, U+E0067,
        U+E006C, U+E006E, U+E0073-E0074, U+E0077, U+E007F;
    src: url("/css/fonts/twemoji-country-flags-0.1.10.woff2") format("woff2");
    font-display: swap;
}

:root {
    --bg: #0b1220;
    --bg-raised: #0f182b;
    --surface: #131d33;
    --surface-hover: #182541;
    --border: rgba(148, 163, 184, 0.14);
    --border-strong: rgba(148, 163, 184, 0.28);
    --text: #e6edf7;
    --text-soft: #b7c2d6;
    --muted: #8d9bb3;
    --accent: #2dd4bf;
    --accent-ink: #063a35;
    --accent-soft: rgba(45, 212, 191, 0.14);
    --amber: #f4b74a;
    --amber-soft: rgba(244, 183, 74, 0.16);
    --danger: #f87171;
    --focus: #7dd3fc;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 12px 32px rgba(2, 6, 23, 0.45);
    --wrap: 1120px;
    --header-h: 64px;
    --font: "Twemoji Country Flags", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    margin: 0;
    display: flex;
    flex-direction: column;
    font-family: var(--font);
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    background-image:
        radial-gradient(60rem 30rem at 15% -10%, rgba(45, 212, 191, 0.16), transparent 60%),
        radial-gradient(40rem 24rem at 95% 0%, rgba(56, 130, 246, 0.14), transparent 60%);
    background-repeat: no-repeat;
}

[hidden] { display: none !important; }

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

h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -0.015em; }
p { margin: 0; }
img, svg { display: block; max-width: 100%; }
svg { width: 1em; height: 1em; }

code {
    padding: 0.1em 0.4em;
    border-radius: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    font-family: var(--mono);
    font-size: 0.9em;
}

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

.wrap {
    width: 100%;
    max-width: var(--wrap);
    margin: 0 auto;
    padding: 0 24px;
}

main.wrap {
    flex: 1;
    padding-top: 36px;
    padding-bottom: 72px;
}

.skip-link {
    position: absolute;
    left: 16px;
    top: -100px;
    z-index: 100;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: var(--accent-ink);
    font-weight: 600;
}
.skip-link:focus { top: 12px; }

/* Header ----------------------------------------------------------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    border-bottom: 1px solid var(--border);
    background: rgba(11, 18, 32, 0.78);
    backdrop-filter: blur(14px) saturate(1.3);
    -webkit-backdrop-filter: blur(14px) saturate(1.3);
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: var(--header-h);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
    font-weight: 700;
    letter-spacing: -0.01em;
    text-decoration: none;
}
.brand:hover { text-decoration: none; }

.brand-mark {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 11px;
    color: var(--accent-ink);
    background: linear-gradient(145deg, #5eead4, #14b8a6 60%, #0e9488);
    box-shadow: 0 6px 18px rgba(20, 184, 166, 0.35);
}
.brand-mark svg, .brand-mark img { width: 22px; height: 22px; }

.brand-text { font-size: 1.1rem; }
.brand-sub { color: var(--muted); font-weight: 500; }

.site-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    color: var(--text-soft);
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.nav-link:hover { color: var(--text); background: var(--surface); text-decoration: none; }
.nav-link.is-active { color: var(--accent); background: var(--accent-soft); }

.nav-count {
    display: inline-grid;
    place-items: center;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.16);
    color: var(--text-soft);
    font-size: 0.75rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.nav-link.is-active .nav-count { background: rgba(45, 212, 191, 0.22); color: var(--accent); }
/* A link that leaves the site (data/site.json "website"). */
.nav-external { gap: 6px; }
.nav-external svg { width: 14px; height: 14px; color: var(--muted); }
.nav-external:hover svg { color: var(--accent); }

.env-badge {
    padding: 3px 9px;
    border: 1px solid var(--amber);
    border-radius: 999px;
    color: var(--amber);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.nav-toggle {
    display: none;
    margin-left: auto;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
}
.nav-toggle svg { width: 22px; height: 22px; margin: auto; }

@media (max-width: 720px) {
    .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
    .site-nav {
        display: none;
        position: absolute;
        left: 16px;
        right: 16px;
        top: calc(var(--header-h) + 8px);
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        padding: 8px;
        border: 1px solid var(--border);
        border-radius: var(--radius);
        background: var(--bg-raised);
        box-shadow: var(--shadow);
    }
    .site-nav.is-open { display: flex; }
    .nav-link { justify-content: space-between; padding: 12px 14px; }
}

/* Typography blocks ------------------------------------------------ */

.eyebrow {
    margin-bottom: 12px;
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.lead {
    max-width: 62ch;
    color: var(--text-soft);
    font-size: 1.1rem;
}

.hero {
    padding: 56px 0 40px;
}

.hero-title {
    max-width: 16ch;
    margin-bottom: 20px;
    font-size: clamp(2.4rem, 6vw, 4.25rem);
    font-weight: 750;
    letter-spacing: -0.03em;
    background: linear-gradient(120deg, #ffffff 0%, #d7e5f5 55%, #7fe6d9 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* The link to the deployment's website (data/site.json "website"). */
.hero-link {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
    max-width: 62ch;
    margin-top: 22px;
    color: var(--muted);
    font-size: 0.95rem;
}
.hero-link a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 9px 18px;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font-weight: 600;
    transition: border-color 0.15s, background-color 0.15s;
}
.hero-link a:hover { border-color: var(--accent); background: var(--surface-hover); text-decoration: none; }
.hero-link svg { width: 16px; height: 16px; color: var(--accent); }

.hero-compact { padding-top: 32px; }
.hero-compact .hero-title { font-size: clamp(2rem, 5vw, 3.25rem); }

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    max-width: 560px;
    margin: 36px 0 0;
}
@media (max-width: 480px) {
    .stat { padding: 12px 12px; }
    .stat dd { font-size: 1.6rem; }
    .stat dt { font-size: 0.68rem; letter-spacing: 0.06em; }
}

.stat {
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(19, 29, 51, 0.7);
}
.stat dt {
    order: 2;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.stat dd {
    margin: 0 0 2px;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
}

.section { margin-top: 44px; }

.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}
.section-head h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.35rem;
    font-weight: 650;
}

.count {
    display: inline-grid;
    place-items: center;
    min-width: 26px;
    height: 26px;
    padding: 0 8px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.text-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    white-space: nowrap;
}
.text-link svg { width: 18px; height: 18px; }

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px 32px;
    margin: 12px 0 28px;
}
.page-head h1 {
    margin: 4px 0 12px;
    font-size: clamp(1.9rem, 4vw, 2.75rem);
    font-weight: 720;
    letter-spacing: -0.025em;
}
.page-head .lead { font-size: 1.05rem; }
.page-meta {
    color: var(--muted);
    font-size: 0.95rem;
    font-variant-numeric: tabular-nums;
}
.page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* Breadcrumbs ------------------------------------------------------ */

.crumbs ol {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
    color: var(--muted);
    font-size: 0.9rem;
}
.crumbs li + li::before { content: "/"; margin-right: 6px; color: var(--border-strong); }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--text); }
.crumbs [aria-current] { color: var(--text-soft); }

/* Badges & buttons ------------------------------------------------- */

.badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.badge-model { background: var(--accent-soft); color: var(--accent); }
.badge-video { background: var(--amber-soft); color: var(--amber); }

.button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 18px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: var(--accent);
    color: var(--accent-ink);
    font-weight: 650;
    font-size: 0.95rem;
    text-decoration: none;
    white-space: nowrap;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
.button svg { width: 18px; height: 18px; }
.button:hover {
    text-decoration: none;
    background: #5eead4;
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(45, 212, 191, 0.3);
}
.button-ghost {
    background: transparent;
    border-color: var(--border-strong);
    color: var(--text);
}
.button-ghost:hover { background: var(--surface); box-shadow: none; }

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 28px;
}

/* Cards ------------------------------------------------------------ */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.card {
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}
.card:hover {
    text-decoration: none;
    transform: translateY(-3px);
    border-color: var(--border-strong);
    background: var(--surface-hover);
    box-shadow: var(--shadow);
}

.card-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px 18px 18px;
}
.card-title { font-size: 1.05rem; font-weight: 650; }
.card-sub { color: var(--muted); font-size: 0.9rem; }
.card-meta {
    margin-top: auto;
    padding-top: 10px;
    color: var(--text-soft);
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
}

.card-media {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #060a14;
}
.card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}
.card:hover .card-media img { transform: scale(1.04); }

.media-model {
    display: grid;
    place-items: center;
    background:
        radial-gradient(60% 80% at 50% 110%, rgba(45, 212, 191, 0.35), transparent 70%),
        linear-gradient(160deg, #142038, #0a1224);
}
/* The rendered thumbnail covers the glyph. If it is missing, site.js drops
   the image and the glyph shows through unchanged. */
.model-thumb {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.model-glyph { color: var(--accent); opacity: 0.9; transition: transform 0.3s ease; }
.model-glyph svg { width: 64px; height: 64px; }
.card:hover .model-glyph { transform: translateY(-4px) scale(1.06); }

.play-badge {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #fff;
}
.play-badge svg {
    width: 52px;
    height: 52px;
    padding: 12px;
    border-radius: 999px;
    background: rgba(11, 18, 32, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(4px);
    transition: transform 0.2s ease, background-color 0.2s ease;
}
.card:hover .play-badge svg { transform: scale(1.08); background: var(--amber); color: #2b1a02; }

.project-card { min-height: 220px; padding-top: 22px; }
.project-icon {
    padding: 0 18px;
    font-size: 2.6rem;
    line-height: 1;
}
.project-card .card-body { padding-top: 14px; flex: 1; }
.project-card .card-title { font-size: 1.35rem; }
.card-region {
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.page-catalog .about { margin: -8px 0 24px; }
.card-arrow {
    position: absolute;
    right: 18px;
    top: 22px;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    border: 1px solid var(--border);
    color: var(--muted);
    transition: transform 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
.card-arrow svg { width: 18px; height: 18px; }
.card:hover .card-arrow { color: var(--accent); border-color: var(--accent); transform: translateX(3px); }

/* Toolbar (catalog filter) ----------------------------------------- */

.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 16px;
    margin-bottom: 8px;
}

.search {
    position: relative;
    flex: 1 1 260px;
    max-width: 420px;
    display: flex;
    align-items: center;
    color: var(--muted);
}
.search svg {
    position: absolute;
    left: 14px;
    width: 18px;
    height: 18px;
    pointer-events: none;
}
.search input {
    width: 100%;
    padding: 11px 14px 11px 42px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 0.95rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.search input::placeholder { color: var(--muted); }
.search input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: transparent;
    color: var(--text-soft);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.chip:hover { background: var(--surface); color: var(--text); }
.chip[aria-pressed="true"] {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-ink);
}

.empty {
    padding: 48px 20px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    color: var(--muted);
    text-align: center;
}

/* Viewer (model / video pages) ------------------------------------- */

.viewer {
    margin: 0;
}
.viewer iframe,
.viewer model-viewer {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #000;
    box-shadow: var(--shadow);
}
/* The 3D viewer (static/js/vendor/model-viewer) paints on a transparent
   canvas, so the backdrop is ours. A soft vignette keeps dark scanned
   material readable against the page. The custom properties are the
   viewer's own. */
.viewer model-viewer {
    /* The viewer's own :host rule sets a fixed height; height: auto here
       outranks it so the aspect ratio above decides the size. */
    height: auto;
    background: radial-gradient(ellipse at 50% 45%, #1b2742 0%, #0d1526 70%, #0b1220 100%);
    --poster-color: transparent;
    --progress-bar-color: var(--accent);
    --progress-bar-height: 3px;
    --progress-mask: none;
}
.viewer model-viewer:fullscreen {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    aspect-ratio: auto;
}
.viewer-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}
.viewer-status {
    margin-top: 12px;
    padding: 10px 14px;
    border: 1px solid var(--amber);
    border-radius: var(--radius-sm);
    background: var(--amber-soft);
    color: var(--text);
    font-size: 0.925rem;
}
.viewer figcaption {
    margin-top: 12px;
    color: var(--muted);
    font-size: 0.875rem;
}

/* About an item (description and details) ------------------------- */

.about { max-width: 68ch; margin-top: 28px; }
.about-text { color: var(--text-soft); font-size: 1.05rem; }
.details {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 8px 20px;
    margin: 18px 0 0;
}
.details .detail { display: contents; }
.details dt {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding-top: 3px;
}
.details dd { margin: 0; color: var(--text); }

/* Pictures (Cloudflare Images) ------------------------------------- */

.viewer .picture {
    display: block;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: #000;
    box-shadow: var(--shadow);
}
.viewer .picture img { width: 100%; height: auto; max-height: 80vh; object-fit: contain; }
.badge-image { background: rgba(125, 211, 252, 0.16); color: var(--focus); }
.media-image { background: #060a14; }

/* Documents (PDF in the browser's viewer) --------------------------- */

.viewer iframe.document {
    aspect-ratio: 4 / 5;
    max-height: 80vh;
    background: #fff;
}
.badge-document { background: rgba(167, 139, 250, 0.16); color: #c4b5fd; }
.media-document {
    display: grid;
    place-items: center;
    background:
        radial-gradient(60% 80% at 50% 110%, rgba(167, 139, 250, 0.3), transparent 70%),
        linear-gradient(160deg, #1a1838, #0a1224);
}
.media-document .model-glyph { color: #c4b5fd; }

/* What's new ------------------------------------------------------- */

.whats-new {
    position: fixed;
    inset: 0;
    z-index: 100;
    width: min(640px, calc(100% - 32px));
    height: fit-content;
    max-height: 85vh;
    margin: auto;
    padding: 28px 28px 22px;
    overflow: auto;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--bg-raised);
    color: var(--text);
    box-shadow: var(--shadow);
}
/* Opened without JavaScript it is not modal, so it draws its own backdrop. */
.whats-new:not(:modal) { box-shadow: 0 0 0 100vmax rgba(2, 6, 23, 0.6), var(--shadow); }
.whats-new::backdrop { background: rgba(2, 6, 23, 0.6); }
.whats-new h2 { font-size: 1.35rem; margin-bottom: 6px; }
.whats-new-section { margin-top: 18px; }
.whats-new-section h3 {
    margin-bottom: 8px;
    color: var(--accent);
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.whats-new-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.whats-new-note p + p { margin-top: 2px; color: var(--text-soft); }
.whats-new-date, .whats-new-list small { color: var(--muted); font-size: 0.85rem; }
.whats-new-more { margin-top: 8px; color: var(--muted); font-size: 0.9rem; }
.whats-new-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 22px;
}
.whats-new-actions form { margin: 0; }
.whats-new-actions .button { cursor: pointer; }
.tag {
    display: inline-block;
    min-width: 5.5em;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-align: center;
    text-transform: uppercase;
}
.tag-new { background: var(--accent-soft); color: var(--accent); }
.tag-updated { background: var(--amber-soft); color: var(--amber); }
.tag-removed { background: rgba(248, 113, 113, 0.14); color: var(--danger); }
.whats-new-page .whats-new-list { gap: 14px; }

/* Admin panel ------------------------------------------------------ */

.form { max-width: 640px; display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { color: var(--text-soft); font-size: 0.85rem; font-weight: 600; }
.field-hint { color: var(--muted); font-size: 0.85rem; }
.field input:not([type=checkbox]):not([type=file]),
.field textarea,
.field select,
.inline-form input[type=password],
.inline-form select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-raised);
    color: var(--text);
    font: inherit;
    font-size: 1rem;
}
.field input[readonly] { color: var(--muted); background: var(--surface); }
.field textarea { resize: vertical; min-height: 4.5rem; font-family: inherit; }
.field input:focus, .field textarea:focus, .field select:focus,
.inline-form input:focus, .inline-form select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
}
fieldset.field { margin: 0; padding: 0; border: 0; }
.checks { display: flex; flex-direction: column; gap: 8px; }
.check { display: flex; align-items: flex-start; gap: 10px; color: var(--text-soft); font-size: 0.95rem; cursor: pointer; }
.check input { margin-top: 4px; accent-color: var(--accent); }
.form-actions { display: flex; gap: 12px; padding-top: 4px; }
.form button { cursor: pointer; }
.button-danger { background: var(--danger); color: #2b0a0a; }
.button-danger:hover { background: #fca5a5; box-shadow: 0 8px 20px rgba(248, 113, 113, 0.3); }
.button-small { padding: 7px 12px; font-size: 0.85rem; }

.notice {
    margin: 0 0 18px;
    padding: 10px 14px;
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    background: var(--accent-soft);
    color: var(--text);
}
.error-box {
    margin: 0 0 18px;
    padding: 12px 16px;
    border: 1px solid var(--danger);
    border-radius: var(--radius-sm);
    background: rgba(248, 113, 113, 0.12);
    color: var(--text);
}
.error-box ul { margin: 8px 0 0; padding-left: 20px; color: var(--text-soft); }

.table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 12px;
    font-size: 0.95rem;
}
.table th {
    text-align: left;
    padding: 8px 12px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-strong);
}
.table td { padding: 12px; vertical-align: top; border-bottom: 1px solid var(--border); }
.table small { color: var(--muted); }
.table a { font-weight: 600; }
.table-accounts td { vertical-align: middle; }
.table-changes td.when { white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
.page-account .form { max-width: 480px; }

.inline-form { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.inline-form input[type=password] { width: 12rem; padding: 7px 10px; font-size: 0.9rem; }
.inline-form select { width: auto; padding: 7px 10px; font-size: 0.9rem; }
.icon-button {
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    cursor: pointer;
}
.icon-button:hover { background: var(--surface-hover); border-color: var(--border-strong); }

.section.danger { padding-top: 24px; border-top: 1px solid var(--border); }
.section.danger h2 { color: var(--danger); font-size: 1.1rem; margin-bottom: 12px; }

.upload {
    margin-top: 14px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}
.upload-head { margin-bottom: 8px; }
.upload-head code { margin-left: 4px; }
.upload-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; color: var(--text-soft); font-size: 0.9rem; }
.upload-status { min-height: 1.3rem; margin-top: 8px; color: var(--muted); font-size: 0.9rem; }
.upload-status.is-error { color: var(--danger); }
/* A file picker inside a form field, uploading to a host (src/uploads.js). */
.upload-host { margin-top: 0; padding: 12px 14px; }
.upload-host .upload-status:empty { min-height: 0; margin-top: 0; }
.upload-progress {
    display: block;
    width: 100%;
    height: 8px;
    margin-top: 10px;
    accent-color: var(--accent);
}
.thumbnail-stage { margin-top: 12px; max-width: 640px; }
.thumbnail-stage model-viewer {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    height: auto;
    border-radius: var(--radius-sm);
    background: radial-gradient(ellipse at 50% 45%, #1b2742 0%, #0d1526 70%, #0b1220 100%);
}

/* Prose pages ------------------------------------------------------ */

.prose { max-width: 68ch; margin-top: 12px; }
.prose h1 { margin: 4px 0 20px; font-size: clamp(1.9rem, 4vw, 2.5rem); }
.prose h2 { margin: 32px 0 10px; font-size: 1.2rem; }
.prose p { margin-bottom: 14px; color: var(--text-soft); }

/* Footer ----------------------------------------------------------- */

.site-footer {
    border-top: 1px solid var(--border);
    background: rgba(11, 18, 32, 0.6);
}
.footer-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 24px;
    padding-top: 26px;
    padding-bottom: 26px;
    color: var(--muted);
    font-size: 0.9rem;
}
.footer-inner nav { display: flex; gap: 20px; }
.footer-inner a { color: var(--muted); }
.footer-inner a:hover { color: var(--text); }

/* Account (signed-in user) ----------------------------------------- */

.account {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 0 12px;
    padding-left: 14px;
    border-left: 1px solid var(--border);
}
.account-name {
    max-width: 14ch;
    overflow: hidden;
    color: var(--muted);
    font-size: 0.9rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}
a.account-name:hover { color: var(--text); text-decoration: none; }
.account-signout {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: transparent;
    color: var(--text-soft);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.account-signout:hover { background: var(--surface); color: var(--text); border-color: var(--border-strong); }

@media (max-width: 720px) {
    .account {
        justify-content: space-between;
        margin: 4px 0 0;
        padding: 12px 14px 4px;
        border-left: 0;
        border-top: 1px solid var(--border);
    }
}

/* Sign-in gate (/welcome) ------------------------------------------ */

.gate-body {
    align-items: center;
    justify-content: center;
    padding: 24px;
}

/* The picture behind the sign-in card. Kept faint and under a navy veil
   in the site's own ground colour, so the page still reads as the site's
   dark blue rather than as the photograph's warm browns. */
.gate-backdrop {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    background: var(--bg);
}
.gate-backdrop img {
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
    opacity: 0.38;
}
.gate-backdrop::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(60rem 30rem at 15% -10%, rgba(45, 212, 191, 0.14), transparent 60%),
        linear-gradient(180deg, rgba(11, 18, 32, 0.35), rgba(11, 18, 32, 0.7));
}

.gate-card {
    width: 100%;
    max-width: 420px;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    padding: 40px 32px 32px;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: 24px;
    background: rgba(19, 29, 51, 0.85);
    box-shadow: var(--shadow);
}

.gate-brand { justify-content: center; margin: 0 0 26px; }

.gate-title {
    margin-bottom: 10px;
    font-size: 2rem;
    font-weight: 720;
    letter-spacing: -0.025em;
}

.gate-lead {
    margin-bottom: 26px;
    color: var(--text-soft);
}

.gate-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    text-align: left;
}
.gate-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: var(--text-soft);
    font-size: 0.85rem;
    font-weight: 600;
}
.gate-form input {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-raised);
    color: var(--text);
    font: inherit;
    font-size: 1rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.gate-form input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
}
.gate-form .button {
    justify-content: center;
    width: 100%;
    margin-top: 4px;
    border-radius: var(--radius-sm);
    font-size: 1rem;
}
.gate-form .button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    transform: none;
    box-shadow: none;
}

.gate-widget {
    display: flex;
    justify-content: center;
    min-height: 65px;
    margin-top: 4px;
}

.gate-status {
    min-height: 1.5rem;
    margin: 18px 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}
.gate-status-error { color: var(--danger); }

/* The way out to the organisation's website (data/site.json "website"). */
.gate-website {
    margin: 22px 0 0;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    font-size: 0.95rem;
}
.gate-website a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    color: var(--text-soft);
    font-weight: 600;
}
.gate-website a:hover { color: var(--text); text-decoration: none; }
.gate-website svg { width: 16px; height: 16px; color: var(--accent); }

/* Motion ----------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition: none !important;
        scroll-behavior: auto !important;
    }
}
