/* Shared styles for every Alarm Hero page: design tokens, base layer, the night
   sky, and the site header + footer. Page-specific rules live in each page's
   inline <style>, which is loaded after this file so it can override. */

:root {
    --night-0:   #060B1A;
    --night-1:   #0D1B3E;
    --night-2:   #142252;
    --night-3:   #1A2A5E;
    --night-deep:#0A1230;

    --orange:    #FF9500;
    --gold:      #FFD14A;

    --text:      #EEF1FB;
    --text-muted:#A7B0D6;
    --text-dim:  #6B76A3;

    --surface:      rgba(255, 255, 255, 0.045);
    --surface-2:    rgba(255, 255, 255, 0.07);
    --border:       rgba(255, 255, 255, 0.10);
    --border-bright:rgba(255, 255, 255, 0.18);

    --green:  #34D27B;
    --indigo: #8E8BFF;
    --yellow: #FFD75E;
    --pink:   #FF8FB1;
    --red:    #FF6B63;
    --mint:   #57E0C4;
    --teal:   #45C7D8;
    --cyan:   #5CD1F0;
    --purple: #B98BFF;
    --blue:   #6BA6FF;

    /* Full site width, used by the header and footer so the chrome lines up
       everywhere. Fixed: article pages narrow their content, not the chrome. */
    --site-max: 1120px;
    /* Content column width. Narrow article pages override this to 760px. */
    --content-max: var(--site-max);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; background: #060B1A; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text);
    line-height: 1.65;
    /* Base color lives on <html> so it fills the safe area; body stays
       transparent so the fixed sky/star layer shows through. */
    background: transparent;
    /* Containing block for the full-page absolute .sky layer. */
    position: relative;
    -webkit-font-smoothing: antialiased;
}

/* ── FIXED NIGHT SKY ── */
.sky {
    position: absolute;
    inset: 0;
    z-index: -2;
    background-color: #060B1A;
    /* Full-page night gradient that scrolls with the content: dark at the top
       and bottom edges (so the page ends blend into the browser bars) with
       steady deep navy through the middle. */
    background-image:
        linear-gradient(180deg,
            #060B1A 0,
            #0F1E48 420px,
            #0F1E48 calc(100% - 260px),
            #060B1A 100%);
}
.sky-glow {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(ellipse 60% 42% at 78% 8%, rgba(197,202,240,0.10) 0%, transparent 62%);
}
#stars {
    position: fixed;
    top: 0; left: 0;
    /* Explicit CSS size (a canvas is a replaced element, so left/right:0 won't
       stretch it). Height is a stable 100vh, so the mobile toolbar showing or
       hiding changes innerHeight but not the canvas box — the star field never
       reflows (and appears to jump) on scroll. */
    width: 100%;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
}

/* ── LAYOUT ── */
.wrap { max-width: var(--content-max); margin: 0 auto; padding: 0 24px; position: relative; }

/* ── TOP BAR (sticks to the top of the screen; identical on every page) ── */
header.nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 50;
    padding-top: env(safe-area-inset-top);
    /* Solid, matching the page's top color and the browser toolbar tint. */
    background: #060B1A;
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
header.nav.scrolled {
    border-bottom-color: rgba(255,255,255,0.08);
    box-shadow: 0 6px 24px rgba(0,0,0,0.28);
}
.nav-inner {
    position: relative;
    max-width: var(--site-max); margin: 0 auto; padding: 14px 24px;
    display: flex; align-items: center; justify-content: space-between;
}
.nav-toggle {
    display: none;
    background: none; border: none; padding: 8px; margin: -8px -6px -8px 0;
    color: var(--text); cursor: pointer; line-height: 0;
}
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; color: var(--text); line-height: 1; }
.brand img { width: 38px; height: 38px; border-radius: 9px; box-shadow: 0 4px 14px rgba(0,0,0,0.4); }
.brand span { font-family: 'Nunito', sans-serif; font-weight: 800; font-size: 1.05rem; letter-spacing: -0.01em; }
.nav-links { display: flex; align-items: center; gap: 30px; }
.nav-links a {
    color: var(--text-muted); text-decoration: none; font-size: 0.9rem; font-weight: 500;
    transition: color 0.2s ease;
}
.nav-links a:hover { color: var(--text); }
.nav-links a.current { color: var(--text); }

/* Compact: collapse the links into a menu behind the toggle button. */
@media (max-width: 720px) {
    .nav-toggle { display: inline-flex; }
    .nav-links {
        position: absolute; top: calc(100% + 8px); right: 24px;
        flex-direction: column; align-items: stretch; gap: 2px;
        min-width: 180px; padding: 8px;
        background: rgba(9,14,32,0.92); border: 1px solid rgba(255,255,255,0.10);
        border-radius: 16px; box-shadow: 0 16px 40px rgba(0,0,0,0.5);
        -webkit-backdrop-filter: blur(18px) saturate(150%); backdrop-filter: blur(18px) saturate(150%);
        opacity: 0; visibility: hidden; transform: translateY(-6px);
        transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
    }
    .nav-links.open { opacity: 1; visibility: visible; transform: none; }
    .nav-links a { padding: 11px 14px; border-radius: 10px; font-size: 0.98rem; }
    .nav-links a:hover { background: rgba(255,255,255,0.06); color: var(--text); }
}

/* ── FOOTER ── */
footer { border-top: 1px solid var(--border); padding: 40px 0; background: rgba(6,11,26,0.5); }
/* The footer spans the site width even where the content column is narrower. */
footer .wrap { max-width: var(--site-max); }
.foot-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px 20px; flex-wrap: wrap; }
.foot-links { display: flex; gap: 26px; }
.foot-links a { color: var(--text-muted); text-decoration: none; font-size: 0.88rem; transition: color 0.2s ease; }
.foot-links a:hover { color: var(--text); }
.foot-copy { font-size: 0.8rem; color: var(--text-dim); }
@media (max-width: 640px) {
    /* column-reverse so the copyright (first in the DOM) sits below the links. */
    .foot-inner { flex-direction: column-reverse; align-items: center; text-align: center; gap: 14px; }
    .foot-links { justify-content: center; flex-wrap: wrap; }
}

/* ── LANGUAGE SWITCHER (footer picker, on every localized page) ── */
.sr-only {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip-path: inset(50%); white-space: nowrap;
}
.lang-switch { position: relative; display: inline-flex; align-items: center; }
.lang-switch svg { position: absolute; left: 11px; color: var(--text-muted); pointer-events: none; }
.lang-switch select {
    appearance: none; cursor: pointer;
    padding: 8px 30px 8px 34px; border-radius: 100px;
    font: inherit; font-size: 0.86rem; font-weight: 600; color: var(--text-muted);
    background: rgba(255,255,255,0.05); border: 1px solid var(--border);
    transition: color 0.2s ease, border-color 0.2s ease;
}
.lang-switch select:hover { color: #fff; border-color: rgba(255,255,255,0.22); }
.lang-switch select:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
/* The native menu paints with the OS palette, so force a readable pairing. */
.lang-switch option { background: #0D1B3E; color: #fff; }
/* Chevron, drawn after the select so it sits above the transparent control. */
.lang-switch::after {
    content: ''; position: absolute; right: 13px; width: 7px; height: 7px;
    border-right: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted);
    transform: translateY(-2px) rotate(45deg); pointer-events: none;
}
