/* ===== Tokens: light by default; dark via OS setting or the toggle (data-theme) ===== */
:root{
  --bg:#ffffff; --surface:#f4f8fb; --surface-2:#e7f0f6; --fg:#0f1b2d; --muted:#4f6175; --line:#dbe6ee;
  --accent:#0a76a3; --accent-fg:#ffffff; --accent-soft:#e2f4fb; --accent-2:#2ccdf5; --star:#ffd45e;
  --shadow:0 1px 2px rgba(15,27,45,.06),0 6px 20px rgba(15,27,45,.08);
  --radius:12px; --wrap:1200px;
  --font:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
  --display:"Trebuchet MS","Segoe UI",system-ui,-apple-system,Roboto,sans-serif;
}
@media (prefers-color-scheme:dark){
  :root:not([data-theme=light]){
    --bg:#0a1020; --surface:#111a2e; --surface-2:#1a2540; --fg:#e8f0fa; --muted:#9fb0c6; --line:#24324f;
    --accent:#4fd3f7; --accent-fg:#04202b; --accent-soft:#10304a; --accent-2:#2ccdf5;
    --shadow:0 1px 2px rgba(0,0,0,.4),0 8px 24px rgba(0,0,0,.35);
  }
}
:root[data-theme=dark]{
  --bg:#0a1020; --surface:#111a2e; --surface-2:#1a2540; --fg:#e8f0fa; --muted:#9fb0c6; --line:#24324f;
  --accent:#4fd3f7; --accent-fg:#04202b; --accent-soft:#10304a; --accent-2:#2ccdf5;
  --shadow:0 1px 2px rgba(0,0,0,.4),0 8px 24px rgba(0,0,0,.35);
}

/* ===== Base ===== */
*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{margin:0;background:var(--bg);color:var(--fg);font:17px/1.7 var(--font);-webkit-font-smoothing:antialiased}
img{max-width:100%;height:auto}
a{color:var(--accent);text-underline-offset:3px}
a:hover{text-decoration-thickness:2px}
:focus-visible{outline:3px solid var(--accent);outline-offset:2px;border-radius:4px}
h1,h2,h3,h4{line-height:1.25;color:var(--fg)}
h1{font:700 clamp(1.9rem,3.2vw,2.6rem)/1.15 var(--display);letter-spacing:-.01em;margin:.2rem 0 .6rem}
h2{font:700 1.55rem/1.25 var(--display);margin:2rem 0 .6rem}
h3{font-size:1.2rem;margin:1.6rem 0 .4rem}
h4{font-size:1.05rem;margin:1.3rem 0 .3rem}
p{margin:.8rem 0}
.lead{font-size:1.2rem;color:var(--muted);max-width:60ch}
.muted{color:var(--muted)}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.skip{position:absolute;left:-9999px}
.skip:focus{left:12px;top:12px;background:var(--bg);color:var(--fg);padding:8px 12px;z-index:200;border-radius:8px;box-shadow:var(--shadow)}

.btn,button{font:inherit;cursor:pointer}
.btn{background:var(--accent);color:var(--accent-fg);border:1px solid var(--accent);border-radius:999px;padding:.55rem 1.15rem;font-weight:600;text-decoration:none;display:inline-block;transition:transform .12s,box-shadow .12s}
.btn:hover{transform:translateY(-1px);box-shadow:var(--shadow)}
.btn.alt{background:transparent;color:var(--accent);border:1px solid var(--accent)}
.linklike{background:none;border:0;padding:0;color:var(--accent);text-decoration:underline;font:inherit;cursor:pointer}

/* ===== Header ===== */
.site-header{position:sticky;top:0;z-index:100;background:color-mix(in srgb,var(--bg) 88%,transparent);backdrop-filter:saturate(1.4) blur(10px);border-bottom:1px solid var(--line)}
.bar{max-width:var(--wrap);margin:0 auto;padding:10px 20px;display:flex;align-items:center;gap:16px}
.brand{display:flex;align-items:center;flex:none;gap:10px;text-decoration:none;color:var(--fg)}
.brand-mark{display:block;flex:none}
.brand-name{font:700 1.25rem/1 var(--display);letter-spacing:-.01em;white-space:nowrap}
.brand-name b{color:var(--accent)}
.primary{margin-left:auto}
.primary ul{list-style:none;margin:0;padding:0}
.primary>ul{display:flex;gap:2px;align-items:center}
.primary a,.sub-toggle{color:var(--fg);text-decoration:none;font:500 .95rem var(--font);padding:.5rem .7rem;white-space:nowrap;border-radius:8px;display:flex;align-items:center;gap:6px;background:none;border:0}
.primary a:hover,.sub-toggle:hover,.has-sub.open>.sub-toggle{background:var(--surface-2)}
.primary a[aria-current=page]{color:var(--accent);font-weight:700}
.sub-toggle svg{transition:transform .15s;opacity:.7}
.has-sub.open>.sub-toggle svg{transform:rotate(180deg)}
.has-sub{position:relative}
.sub{position:absolute;left:0;top:calc(100% + 6px);min-width:230px;background:var(--bg);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);padding:6px;display:none}
.sub a{padding:.45rem .7rem;border-radius:8px;font-weight:450}
/* Invisible bridge across the gap so the menu stays open while the pointer moves down to it */
.sub::before{content:"";position:absolute;left:0;right:0;top:-10px;height:10px}
/* Last menu (About) opens leftwards so it never runs off the right edge */
.primary>ul>.has-sub:last-child>.sub{left:auto;right:0}
@media (hover:hover) and (min-width:861px){
  .has-sub:hover>.sub,.has-sub:focus-within>.sub{display:block}
  .has-sub:hover>.sub-toggle svg{transform:rotate(180deg)}
}
.has-sub.open>.sub{display:block}
.theme-toggle,.nav-toggle{flex:none;width:40px;height:40px;border-radius:999px;border:1px solid var(--line);background:var(--surface);color:var(--fg);display:grid;place-items:center;padding:0}
.theme-toggle:hover,.nav-toggle:hover{background:var(--surface-2)}
.theme-toggle .i-sun{display:none}
.theme-toggle[data-mode=dark] .i-sun{display:block}
.theme-toggle[data-mode=dark] .i-moon{display:none}
.nav-toggle{display:none}
@media (max-width:860px){
  .nav-toggle{display:grid}
  .js .primary{display:none;position:absolute;left:0;right:0;top:100%;background:var(--bg);border-bottom:1px solid var(--line);box-shadow:var(--shadow);max-height:calc(100vh - 64px);overflow:auto;margin:0;padding:8px 12px}
  .js .primary.open{display:block}
  .primary>ul{flex-direction:column;align-items:stretch}
  .sub{position:static;box-shadow:none;border:0;border-left:2px solid var(--line);border-radius:0;margin:0 0 6px 14px;padding:2px 0 2px 6px;min-width:0}
  html:not(.js) .sub{display:block}
  .theme-toggle{margin-left:auto}
}

/* ===== Page layout (main + sidebar) ===== */
.layout{max-width:var(--wrap);margin:0 auto;padding:22px 20px 0;display:grid;grid-template-columns:minmax(0,1fr) 330px;gap:48px;align-items:start}
.layout.full{grid-template-columns:minmax(0,1fr)}
@media (max-width:1000px){.layout{grid-template-columns:minmax(0,1fr);gap:32px}}
.content{min-width:0}
.sidebar{display:grid;gap:18px;align-content:start}
.side-card{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:16px 16px 12px}
.side-card h2{font:700 1.1rem var(--display);margin:0 0 10px;padding-bottom:8px;border-bottom:2px solid var(--accent-2);display:inline-block}
.side-card p{margin:.3rem 0}
.side-card .btn{display:block;text-align:center}
.latest,.plain{list-style:none;margin:0;padding:0}
.latest li{padding:12px 0;border-top:1px solid var(--line)}
.latest li:first-child{border-top:0;padding-top:4px}
.latest a{text-decoration:none;color:var(--fg);display:block}
.latest img{width:100%;aspect-ratio:16/9;object-fit:cover;border-radius:10px;display:block;margin-bottom:8px;background:#05070f}
.latest .t{font-weight:650;line-height:1.35;display:block}
.latest a:hover .t{color:var(--accent);text-decoration:underline}
.latest p{font-size:.88rem;color:var(--muted);line-height:1.5;margin:.3rem 0 0}
.plain li{padding:.3rem 0}
.plain a{text-decoration:none}
.plain a:hover{text-decoration:underline}

/* ===== Footer ===== */
.site-footer{margin-top:56px;background:var(--surface);border-top:1px solid var(--line)}
.foot{max-width:var(--wrap);margin:0 auto;padding:24px 20px 40px;color:var(--muted);font-size:.88rem}

/* ===== Content ===== */
.crumbs{margin:.2rem 0 0;font-size:.9rem;font-weight:600}
.crumbs a{text-decoration:none}
.byline{font-size:.9rem;margin:.1rem 0 .6rem}
.byline a{color:inherit}
.hero{display:block;width:auto;max-width:100%;height:auto;max-height:480px;margin:.8rem 0 1.2rem;border-radius:var(--radius);box-shadow:var(--shadow)}
.hero-fig{margin:.8rem 0 1.2rem}
.hero-fig .hero{margin:0 0 .35rem}
.hero-fig figcaption{font-size:.8rem;color:var(--muted)}
.hero-fig figcaption .cap{display:block;font-size:.9rem;color:var(--fg);margin-bottom:.1rem}
.prose{max-width:74ch}
.prose h2{margin-top:2.2rem}
.prose img{display:block;border-radius:10px;margin:.6rem 0;background:#fff}
.prose ul,.prose ol{padding-left:1.4rem}
.prose li{margin:.25rem 0}
.prose blockquote{margin:1rem 0;padding:.2rem 1rem;border-left:4px solid var(--accent);background:var(--accent-soft);border-radius:0 8px 8px 0}
.related{border-top:1px solid var(--line);margin-top:2rem}

/* ===== Tables ===== */
.prose table{display:block;overflow-x:auto;font-size:.9rem;line-height:1.5}
table{border-collapse:collapse;width:100%}
td,th{padding:7px 10px;border-bottom:1px solid var(--line);text-align:left;vertical-align:top}
thead th{background:var(--surface)}

/* ===== Hub pages and the guides index ===== */
.hub{margin-top:2.4rem;border-top:1px solid var(--line)}
.cards-list{list-style:none;margin:1rem 0;padding:0;display:grid;grid-template-columns:repeat(auto-fill,minmax(min(100%,240px),1fr));gap:16px}
.cards-list li{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:12px 14px}
.cards-list a{text-decoration:none;color:var(--fg);display:block}
.cards-list img{width:100%;aspect-ratio:16/9;object-fit:cover;border-radius:8px;display:block;margin-bottom:8px;background:#05070f}
.cards-list .t{font-weight:650;line-height:1.35}
.cards-list a:hover .t{color:var(--accent);text-decoration:underline}
.cards-list p{font-size:.9rem;line-height:1.5;margin:.35rem 0 0}
.chips{list-style:none;margin:.4rem 0 1rem;padding:0;display:flex;flex-wrap:wrap;gap:8px}
.chips a{display:inline-block;padding:.25rem .75rem;border:1px solid var(--line);border-radius:999px;background:var(--surface);text-decoration:none;font-size:.95rem}
.chips a:hover{border-color:var(--accent);background:var(--accent-soft)}
.chips.big a{font-weight:600;padding:.4rem 1rem}
.list li{padding:.45rem 0;border-top:1px solid var(--line)}
.list li:first-child{border-top:0}

/* ===== Home ===== */
/* The photo is a dark night sky in both themes, so the text over it has fixed light colors. */
.home-hero{position:relative;margin:.4rem 0 1.4rem;overflow:hidden;border-radius:var(--radius);background:#05070f;box-shadow:var(--shadow);border-bottom:5px solid var(--accent-2)}
.home-hero img{display:block;width:100%;height:clamp(260px,36vw,400px);object-fit:cover;object-position:62% 45%}
.home-hero::before{content:"";position:absolute;inset:0;background:linear-gradient(90deg,rgba(4,8,20,.88) 0,rgba(4,8,20,.6) 42%,rgba(4,8,20,0) 72%);z-index:1;pointer-events:none}
.home-hero-text{position:absolute;z-index:2;left:0;top:0;bottom:0;max-width:min(560px,68%);padding:1.6rem 1.8rem;display:flex;flex-direction:column;justify-content:center}
.home-hero h1{color:#fff;margin:0 0 .5rem;font-size:clamp(2rem,4.4vw,3rem)}
.home-hero .lead{color:#dce8f5;margin:0;font-size:clamp(1rem,1.7vw,1.2rem);line-height:1.5}
.home-hero .hero-note{position:absolute;z-index:2;right:12px;bottom:8px;margin:0;font-size:.75rem;color:#c7d3e2}
.home-hero .hero-note a{color:inherit}
@media (max-width:640px){
  .home-hero img{height:auto;aspect-ratio:4/3}
  .home-hero::before{background:linear-gradient(0deg,rgba(4,8,20,.92) 0,rgba(4,8,20,.6) 50%,rgba(4,8,20,0) 78%)}
  .home-hero-text{max-width:100%;justify-content:flex-end;padding:1rem 1.1rem 1.2rem}
  .home-hero .hero-note{top:8px;bottom:auto}
}
.home-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,260px),1fr));gap:18px;margin:1rem 0 2rem}
.card{background:var(--surface);border:1px solid var(--line);border-top:4px solid var(--accent-2);border-radius:var(--radius);padding:14px 18px}
.card h2{margin:0 0 .5rem;font-size:1.25rem}
.card p{margin:.4rem 0}
.card .plain li{padding:.2rem 0;line-height:1.4}
.card .more{margin:.7rem 0 0;font-weight:600}
.home-intro{border-top:1px solid var(--line);padding-top:.6rem}

/* ===== Sources + consent ===== */
.sources{margin-top:1.6rem;font-size:.9rem}
.sources h2{font-size:1.1rem;margin-bottom:.3rem}
.sources ul{padding-left:1.2rem;margin:0}
.sources li{margin:.2rem 0;overflow-wrap:anywhere}
#consent{position:fixed;left:16px;right:16px;bottom:16px;max-width:760px;margin:0 auto;z-index:150;background:var(--bg);color:var(--fg);border:1px solid var(--line);border-radius:var(--radius);padding:14px 16px;display:flex;flex-wrap:wrap;gap:10px;align-items:center;justify-content:flex-end;box-shadow:var(--shadow)}
#consent p{margin:0;flex:1 1 300px;font-size:.92rem}
#consent button{background:var(--accent);color:var(--accent-fg);border:1px solid var(--accent);border-radius:999px;padding:.45rem 1.1rem;font-weight:600}
#consent button.alt{background:transparent;color:var(--accent)}
@media (prefers-reduced-motion:reduce){*{transition:none!important;scroll-behavior:auto!important}}
