/* Astronomy Learning Universe — shared styles */
:root {
  --bg: #04060f;
  --bg-2: #0a1024;
  --panel: rgba(14, 22, 48, 0.72);
  --panel-solid: #0e1630;
  --line: rgba(140, 170, 255, 0.18);
  --text: #e8ecff;
  --muted: #9aa6cc;
  --accent: #ffb547;      /* sun gold */
  --accent-2: #6fd3ff;    /* nebula cyan */
  --danger: #ff6b6b;
  --ok: #5fe3a1;
  --radius: 14px;
  --max: 1180px;
  --font-head: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Animated starfield sits behind every page */
#starfield {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  z-index: -2;
  background: radial-gradient(ellipse at 70% 20%, #16204a 0%, var(--bg) 60%);
}
.nebula-glow {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(40vw 30vw at 85% 10%, rgba(111, 211, 255, 0.10), transparent 70%),
    radial-gradient(35vw 30vw at 10% 90%, rgba(255, 120, 200, 0.08), transparent 70%);
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

h1, h2, h3 { font-family: var(--font-head); line-height: 1.15; letter-spacing: -0.01em; margin: 0 0 0.5em; }
h1 { font-size: clamp(2.2rem, 6vw, 4.2rem); }
h2 { font-size: clamp(1.6rem, 3.5vw, 2.4rem); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 20px; }
section { padding: 64px 0; }

/* Header / nav */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(4, 6, 15, 0.78);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-family: var(--font-head); font-weight: 700; font-size: 1.05rem; }
.brand:hover { text-decoration: none; }
.brand svg { width: 30px; height: 30px; }
.nav ul { list-style: none; display: flex; gap: 6px; margin: 0; padding: 0; }
.nav a.link { color: var(--muted); padding: 8px 12px; border-radius: 8px; font-size: 0.95rem; }
.nav a.link:hover, .nav a.link.active { color: var(--text); background: rgba(255,255,255,0.06); text-decoration: none; }
.menu-btn { display: none; background: none; border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 6px 10px; font-size: 1.1rem; cursor: pointer; }

@media (max-width: 860px) {
  .menu-btn { display: block; }
  .nav ul {
    display: none; position: absolute; top: 64px; left: 0; right: 0;
    flex-direction: column; background: var(--panel-solid); padding: 12px 20px; border-bottom: 1px solid var(--line);
  }
  .nav ul.open { display: flex; }
}

/* Hero */
.hero { min-height: 82vh; display: flex; align-items: center; position: relative; padding: 80px 0; }
.hero .eyebrow { color: var(--accent); font-family: var(--font-head); text-transform: uppercase; letter-spacing: 0.18em; font-size: 0.85rem; margin-bottom: 14px; }
.hero h1 span { background: linear-gradient(90deg, var(--accent), #ff7ac8 50%, var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { font-size: 1.2rem; color: var(--muted); max-width: 640px; }
.hero-img {
  position: absolute; right: -4%; top: 50%; transform: translateY(-50%);
  width: min(46vw, 560px); aspect-ratio: 1; border-radius: 50%;
  object-fit: cover; opacity: 0.55; z-index: -1;
  mask-image: radial-gradient(circle, #000 45%, transparent 70%);
  -webkit-mask-image: radial-gradient(circle, #000 45%, transparent 70%);
}
@media (max-width: 860px) { .hero-img { width: 90vw; right: -30%; opacity: 0.3; } }

.btns { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
.btn {
  display: inline-block; padding: 12px 22px; border-radius: 999px;
  font-weight: 600; font-family: var(--font-head);
  background: var(--accent); color: #1a1000; border: 1px solid var(--accent);
}
.btn:hover { text-decoration: none; filter: brightness(1.1); }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line); }

/* Cards and grids */
.grid { display: grid; gap: 20px; }
.grid.c2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.c3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid.c4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; backdrop-filter: blur(6px);
}
a.card { color: var(--text); display: block; transition: transform .2s, border-color .2s; }
a.card:hover { transform: translateY(-3px); border-color: var(--accent-2); text-decoration: none; }
.card .icon { font-size: 1.8rem; margin-bottom: 8px; }
.card p { color: var(--muted); margin: 0; }
.tag { display: inline-block; font-size: 0.75rem; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }

.section-head { margin-bottom: 28px; max-width: 760px; }
.section-head p { color: var(--muted); }

/* Embeds */
.embed {
  position: relative; width: 100%; aspect-ratio: 16 / 9; min-height: 420px;
  border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: #000;
}
.embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
@media (max-width: 600px) { .embed { aspect-ratio: 3 / 4; } }

/* Tables */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); }
table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-family: var(--font-head); color: var(--muted); font-weight: 600; background: rgba(255,255,255,0.03); position: sticky; top: 0; }
tbody tr:hover { background: rgba(111, 211, 255, 0.06); }
.num { font-variant-numeric: tabular-nums; text-align: right; }

/* APOD */
.apod { display: grid; grid-template-columns: 1.2fr 1fr; gap: 28px; align-items: start; }
.apod img, .apod iframe { width: 100%; border-radius: var(--radius); border: 1px solid var(--line); }
.apod iframe { aspect-ratio: 16/9; }
@media (max-width: 860px) { .apod { grid-template-columns: 1fr; } }
.credit { font-size: 0.8rem; color: var(--muted); }

/* Gallery */
.gallery { columns: 4 240px; column-gap: 16px; }
.gallery figure {
  break-inside: avoid; margin: 0 0 16px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden; cursor: zoom-in;
}
.gallery figcaption { padding: 10px 12px; font-size: 0.85rem; color: var(--muted); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.chip {
  background: transparent; color: var(--muted); border: 1px solid var(--line);
  padding: 7px 14px; border-radius: 999px; cursor: pointer; font: inherit; font-size: 0.9rem;
}
.chip.active, .chip:hover { color: var(--text); border-color: var(--accent-2); background: rgba(111,211,255,0.08); }

.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,0.92); display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px; flex-direction: column; }
.lightbox.open { display: flex; }
.lightbox img { max-height: 80vh; border-radius: 10px; }
.lightbox p { max-width: 800px; color: var(--muted); font-size: 0.9rem; margin-top: 14px; text-align: center; }

/* Forms / calculator */
label { display: block; font-size: 0.9rem; color: var(--muted); margin: 12px 0 4px; }
input, select {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: rgba(0,0,0,0.35); color: var(--text); font: inherit;
}
input[type=range] { padding: 0; accent-color: var(--accent); }
.result { font-family: var(--font-head); font-size: 1.6rem; color: var(--accent); }
.stat { text-align: center; }
.stat .big { font-family: var(--font-head); font-size: 2.2rem; color: var(--accent); line-height: 1.1; }
.stat .lbl { color: var(--muted); font-size: 0.85rem; }

.notice { border-left: 3px solid var(--accent); padding: 12px 16px; background: rgba(255,181,71,0.07); border-radius: 0 10px 10px 0; color: var(--muted); font-size: 0.92rem; }
.loading { color: var(--muted); font-style: italic; }

/* Moon */
.moon { width: 140px; height: 140px; margin: 0 auto 10px; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 36px 0; color: var(--muted); font-size: 0.88rem; margin-top: 40px; background: rgba(4,6,15,0.7); }
.site-footer .cols { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 20px; }

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