/*
 * Caelorn theme — derived from the "Cosmic Dawn" banner and the "Celestial C Compass" emblem:
 * deep-space ground, brushed-silver Trajan-style capitals, a warm gold starburst, cool blue
 * atmospheric rim light, and thin gold orbital rings. Self-hosted fonts only (no third-party
 * requests — see assets/fonts/OFL-Cinzel.txt), so it works under a strict `default-src 'self'` CSP.
 */

@font-face {
    font-family: "Cinzel";
    src: url("fonts/cinzel-latin-400-normal.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Cinzel";
    src: url("fonts/cinzel-latin-600-normal.woff2") format("woff2");
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Cinzel";
    src: url("fonts/cinzel-latin-700-normal.woff2") format("woff2");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    color-scheme: dark;

    /* Ground */
    --void: #03050a;
    --deep: #070c18;
    --navy: #0b1426;
    --surface: rgba(12, 20, 38, 0.82);
    --surface-raised: rgba(18, 29, 52, 0.9);

    /* Metal and light */
    --silver: #e4e8ef;
    --silver-dim: #a9b2c3;
    --muted: #7f8aa0;
    --gold: #e9b25c;
    --gold-bright: #ffd58a;
    --gold-core: #ffe6b0;
    --gold-deep: #b9822f;
    --sky: #7fb3ff;
    --sky-deep: #3b6fc4;

    /* States */
    --ok: #6fd3a8;
    --warn: #ffd166;
    --danger: #ff7f7f;

    /* Lines and glows */
    --orbit: rgba(233, 178, 92, 0.35);
    --orbit-strong: rgba(233, 178, 92, 0.7);
    --hairline: rgba(169, 178, 195, 0.14);
    /* Form field edges: 3.4:1 against the panels, so an empty field is visible (WCAG 1.4.11; D6). The
       decorative --hairline is 1.3:1, fine for dividers but not for a field's only boundary. */
    --field-border: rgba(169, 178, 195, 0.55);
    --glow-gold: 0 0 18px rgba(255, 190, 100, 0.35), 0 0 2px rgba(255, 230, 176, 0.8);
    --glow-sky: 0 0 24px rgba(127, 179, 255, 0.25);

    --silver-text: linear-gradient(180deg, #ffffff 0%, #e4e8ef 38%, #9aa3b4 62%, #f4f6fa 100%);
    --gold-fill: linear-gradient(180deg, #ffe0a3 0%, #e9b25c 55%, #b9822f 100%);

    /* Type */
    --font-display: "Cinzel", "Trajan Pro", "Cormorant SC", Georgia, serif;
    --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

    --radius: 10px;
    --radius-sm: 6px;
    --gutter: clamp(16px, 4vw, 40px);
}

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

html {
    background: var(--void);
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.55;
    color: var(--silver);
    background:
        radial-gradient(ellipse 80% 50% at 50% 115%, rgba(59, 111, 196, 0.22), transparent 70%),
        radial-gradient(ellipse 60% 40% at 50% -10%, rgba(233, 178, 92, 0.08), transparent 70%),
        radial-gradient(1px 1px at 12% 18%, rgba(255, 255, 255, 0.7), transparent 60%),
        radial-gradient(1px 1px at 72% 12%, rgba(255, 255, 255, 0.55), transparent 60%),
        radial-gradient(1px 1px at 38% 64%, rgba(255, 255, 255, 0.45), transparent 60%),
        radial-gradient(1.5px 1.5px at 86% 46%, rgba(255, 220, 160, 0.6), transparent 60%),
        radial-gradient(1px 1px at 22% 82%, rgba(160, 200, 255, 0.5), transparent 60%),
        radial-gradient(1px 1px at 56% 30%, rgba(255, 255, 255, 0.4), transparent 60%),
        linear-gradient(180deg, var(--void) 0%, var(--deep) 55%, var(--navy) 100%);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: var(--gold-bright);
    text-decoration-color: var(--orbit-strong);
    text-underline-offset: 3px;
}

a:hover {
    color: var(--gold-core);
}

:focus-visible {
    outline: 2px solid var(--gold-bright);
    outline-offset: 2px;
}

h1,
h2,
h3 {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: 0.08em;
    line-height: 1.2;
    color: var(--silver);
    margin: 0 0 0.6em;
}

h1 { font-size: clamp(1.6rem, 3.2vw, 2.4rem); }
h2 { font-size: 1.15rem; }
h3 { font-size: 0.95rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--silver-dim); }

code,
.mono {
    font-family: var(--font-mono);
    font-size: 0.85em;
    color: var(--sky);
    word-break: break-all;
}

/* Brushed-silver display text, as in the wordmark */
.silver {
    background: var(--silver-text);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.muted { color: var(--muted); }

/* ---------- Layout ---------- */

.container {
    width: 100%;
    max-width: 1120px;
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px var(--gutter);
    background: linear-gradient(180deg, rgba(3, 5, 10, 0.92), rgba(3, 5, 10, 0.72));
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--orbit);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
}

.brand img {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    box-shadow: 0 0 0 1px var(--orbit-strong), var(--glow-gold);
}

.brand .wordmark {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: 0.22em;
    background: var(--silver-text);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

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

.site-footer {
    margin-top: 64px;
    padding: 24px var(--gutter) 32px;
    border-top: 1px solid var(--hairline);
    color: var(--muted);
    font-size: 0.85rem;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 24px;
    justify-content: center;
}

/* Orbital divider: a hairline with the compass star at its centre */
.orbit-rule {
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--gold-bright);
    margin: 40px 0;
}

.orbit-rule::before,
.orbit-rule::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--orbit-strong), transparent);
}

.orbit-rule span {
    font-size: 0.9rem;
    text-shadow: var(--glow-gold);
}

/* ---------- Surfaces ---------- */

.panel {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--orbit);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(6px);
}

.panel.raised {
    background: var(--surface-raised);
}

.grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

/* ---------- Controls ---------- */

.btn,
button {
    font: inherit;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    min-height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--orbit-strong);
    background: rgba(233, 178, 92, 0.06);
    color: var(--gold-core);
    cursor: pointer;
    text-decoration: none;
    letter-spacing: 0.02em;
    transition: background 0.15s, box-shadow 0.15s, border-color 0.15s;
}

.btn:hover,
button:hover {
    background: rgba(233, 178, 92, 0.14);
    box-shadow: var(--glow-gold);
    color: var(--gold-core);
}

.btn-primary {
    background: var(--gold-fill);
    color: #1a1206;
    border-color: var(--gold-bright);
    font-weight: 600;
}

.btn-primary:hover {
    background: var(--gold-fill);
    color: #1a1206;
    filter: brightness(1.08);
}

.btn-ghost {
    border-color: var(--hairline);
    background: transparent;
    color: var(--silver-dim);
}

.btn-ghost:hover {
    border-color: var(--orbit);
    background: rgba(255, 255, 255, 0.03);
    color: var(--silver);
    box-shadow: none;
}

.btn-danger {
    border-color: rgba(255, 127, 127, 0.6);
    color: var(--danger);
    background: rgba(255, 127, 127, 0.06);
}

button:disabled,
.btn[aria-disabled="true"] {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 14px;
}

.field label {
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--silver-dim);
}

input,
select,
textarea {
    font: inherit;
    color: var(--silver);
    background: rgba(3, 5, 10, 0.6);
    border: 1px solid var(--field-border);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    min-height: 36px;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(233, 178, 92, 0.18);
}

input[type="range"] {
    accent-color: var(--gold);
    padding: 0;
    border: 0;
    background: transparent;
}

.hint { font-size: 0.8rem; color: var(--muted); }

.alert {
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-size: 0.9rem;
    border: 1px solid;
}

.alert-error { border-color: rgba(255, 127, 127, 0.5); background: rgba(255, 127, 127, 0.08); color: #ffc2c2; }
.alert-ok { border-color: rgba(111, 211, 168, 0.5); background: rgba(111, 211, 168, 0.08); color: #c4f2dd; }

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border: 1px solid var(--hairline);
    color: var(--silver-dim);
}

.badge-gold { border-color: var(--orbit-strong); color: var(--gold-bright); }
.badge-sky { border-color: rgba(127, 179, 255, 0.5); color: var(--sky); }
.badge-ok { border-color: rgba(111, 211, 168, 0.5); color: var(--ok); }

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

th,
td {
    text-align: left;
    padding: 6px 8px;
    border-bottom: 1px solid var(--hairline);
}

th {
    font-weight: 500;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

/* ---------- Landing hero ---------- */

.hero {
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid var(--orbit);
    background: var(--void);
}

/* The banner never grows past 1280px wide (≈340px tall): on wider screens it sits centred on
   the black ground with its side edges faded out, instead of scaling up to fill the viewport. */
.hero picture {
    display: block;
    max-width: 1280px;
    margin-inline: auto;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.hero img {
    width: 100%;
    /* Crop top/bottom around the wordmark (≈31–62% of the image height) at the capped height. */
    height: min(26.5vw, 340px);
    object-fit: cover;
    object-position: 50% 45%;
}

.hero::after {
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    height: 22%;
    background: linear-gradient(180deg, transparent, var(--void));
    pointer-events: none;
}

.hero-copy {
    text-align: center;
    margin-top: -1.25rem;
    position: relative;
    z-index: 1;
}

.tagline {
    font-family: var(--font-display);
    font-size: clamp(1rem, 2.2vw, 1.35rem);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--gold-bright);
    text-shadow: var(--glow-gold);
    margin: 0 0 12px;
    /* The landing page's h1 (D6): keeps the look it had as a paragraph. */
    font-weight: inherit;
    line-height: inherit;
}

.lede {
    max-width: 640px;
    margin: 0 auto 24px;
    color: var(--silver-dim);
    font-size: 1.05rem;
}

.cta-row {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Feature titles are h2 (D6: no skipped heading level), drawn like the small caps h3. */
.feature h2 {
    font-size: 0.95rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--gold-bright);
}

.feature h2::before {
    content: "\2726"; /* four-pointed star, the compass motif */
    text-shadow: var(--glow-gold);
}

.feature p {
    margin: 0;
    color: var(--silver-dim);
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}

.center { text-align: center; }

/* ---------- Legal pages ---------- */

.legal { max-width: 860px; padding-block: 32px 56px; }
.legal h1 { margin-bottom: 4px; }
.legal section { margin-top: 28px; }
.legal h2 { margin-bottom: 8px; }
.legal p, .legal li { color: var(--silver-dim); line-height: 1.6; }
.legal td { vertical-align: top; color: var(--silver-dim); }
