/*
 * Twinkle Lights: shared base styles, loaded by every page.
 *
 * A clear winter night: deep navy sky, snow-white text, warm bulb-gold links. Always dark,
 * so there is no light variant. System fonts only; nothing is loaded from another host.
 * Measured contrast (WCAG 2.x) on --night: --snow 16.8:1, --frost 10.4:1, --gold 12.9:1
 * (on --night-high at the top of the page: 11.9, 7.4 and 9.2).
 *
 * Page-specific rules live next door: home.css and lights.css (index only), prose.css
 * (support, privacy, impressum).
 */

/* =========================================================================
   Tokens
   ========================================================================= */

:root {
    color-scheme: dark;

    --night: #0B1426;          /* the sky behind everything */
    --night-high: #18305A;     /* the sky near the top of the page */
    --night-raised: #13223D;   /* cards and notes */
    --snow: #F2F5FA;           /* body text */
    --frost: #B9C4D6;          /* secondary text */
    --gold: #FFD36B;           /* links: the warm glow of a lit bulb */
    --rule: rgb(242 245 250 / 0.18);

    /* The app's "Classic colors" preset (TwinkleLights/Settings/ColorPreset.swift). */
    --bulb-red: #F22121;
    --bulb-green: #1ACC40;
    --bulb-blue: #266BFF;
    --bulb-yellow: #FFD61A;
    --bulb-orange: #FF800D;

    --serif: ui-serif, "New York", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
    --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

    --measure: 36rem;
    --radius: 12px;
    --page-pad: clamp(20px, 5vw, 48px);
}

/* =========================================================================
   Base
   ========================================================================= */

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

html { -webkit-text-size-adjust: 100%; background: var(--night); }

body {
    margin: 0;
    min-height: 100vh;
    background: linear-gradient(to bottom, var(--night-high), var(--night) 34rem) var(--night) no-repeat;
    color: var(--snow);
    font: 1.0625rem/1.6 var(--sans);
}

img, svg { max-width: 100%; height: auto; display: block; }

h1, h2, h3 {
    font-family: var(--serif);
    font-weight: 600;
    line-height: 1.15;
    text-wrap: balance;
    margin: 0 0 0.5em;
}
h1 { font-size: clamp(2.6rem, 8vw, 4.5rem); letter-spacing: -0.015em; }
h2 { font-size: clamp(1.5rem, 3.4vw, 2rem); }
h3 { font-size: 1.2rem; }

p { margin: 0 0 1em; max-width: var(--measure); }

a { color: var(--gold); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }

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

code { font-family: var(--mono); font-size: 0.92em; }

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

.skip-link {
    position: absolute; left: 1rem; top: -4rem; z-index: 10;
    background: var(--gold); color: var(--night); padding: 0.5rem 1rem; font-weight: 600;
}
.skip-link:focus { top: 1rem; }

.wrap { max-width: 64rem; margin-inline: auto; padding-inline: var(--page-pad); }

/* =========================================================================
   Header and navigation
   ========================================================================= */

.site-header {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: 0.75rem 1.5rem;
    padding-block: 1.5rem;
}

.brand {
    display: flex; align-items: center; gap: 0.55rem;
    font-family: var(--serif); font-size: 1.2rem; font-weight: 600;
    color: var(--snow); text-decoration: none;
}
.brand img { width: 32px; height: 32px; }

.site-nav ul { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; list-style: none; margin: 0; padding: 0; }
.site-nav a { color: var(--snow); text-decoration: none; padding: 0.25rem 0; }
.site-nav a:hover, .site-nav a[aria-current="page"] { text-decoration: underline; color: var(--gold); }

/* =========================================================================
   Footer
   ========================================================================= */

.site-footer {
    color: var(--frost); font-size: 0.92rem;
    padding-block: 2rem 2.5rem;
    border-top: 1px solid var(--rule);
}
.site-footer ul { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; list-style: none; margin: 0 0 0.75rem; padding: 0; }
.site-footer a { color: var(--snow); }
.site-footer p { margin: 0; max-width: none; }
