/*
 * Et Astra — v3 · Modern minimal with celestial imagery
 * NASA images are public domain (copyright-free).
 */

/* ── Fonts ────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Space+Grotesk:wght@400;500;600;700&display=swap');

/* ── Tokens ───────────────────────────────────────────── */
:root {
  --void:      #060610;
  --surface:   #0c0c1a;
  --surface-2: #12122a;
  --line:      rgba(255,255,255,.05);
  --muted:     #5a5a72;
  --text:      #a8a6b8;
  --light:     #dddbe8;
  --accent:    #8b9cf7;           /* soft periwinkle */
  --accent-lo: rgba(139,156,247,.08);

  --ff-head:   'Space Grotesk', sans-serif;
  --ff-body:   'Inter', sans-serif;
  --fs:        clamp(0.8rem, 0.76rem + 0.2vw, 0.9rem);
  --lh:        1.65;
  --measure:   54ch;

  --sp-xs: .35rem;  --sp-s: .75rem;  --sp-m: 1.75rem;
  --sp-l: 3.5rem;   --sp-xl: 7rem;

  --radius: 8px;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

/* ── Reset ────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html {
  font-size: var(--fs);
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--ff-body);
  font-weight: 300;
  line-height: var(--lh);
  letter-spacing: .01em;
  color: var(--text);
  background: var(--void);
}

::selection { background: var(--accent-lo); color: var(--light); }

/* ── Typography ───────────────────────────────────────── */
h1, h2, h3 {
  font-family: var(--ff-head);
  font-weight: 600;
  line-height: 1.2;
  color: var(--light);
  text-align: center;
}

h1 { font-size: clamp(1.6rem, 1.2rem + 2vw, 2.8rem); font-weight: 700; }
h2 { font-size: clamp(1.1rem, 0.9rem + 0.8vw, 1.5rem); }
h3 { font-size: 0.95rem; }

p + p { margin-top: var(--sp-s); }

a {
  color: var(--accent);
  text-decoration: none;
  transition: opacity .25s var(--ease);
}
a:hover { opacity: .65; }

small { font-size: .72rem; color: var(--muted); }

/* ── Hero with celestial background ──────────────────── */
.ea-hero,
body > section:first-of-type {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 70vh;
  padding: var(--sp-xl) var(--sp-s);
  overflow: hidden;
}

/* NASA public domain: Hubble Deep Field */
.ea-hero::before,
body > section:first-of-type::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    url('https://images-assets.nasa.gov/image/PIA17563/PIA17563~small.jpg') center/cover no-repeat;
  opacity: 0.12;
  pointer-events: none;
  z-index: 0;
}

/* subtle gradient overlay on hero */
.ea-hero::after,
body > section:first-of-type::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    var(--void) 0%,
    transparent 30%,
    transparent 70%,
    var(--void) 100%
  );
  pointer-events: none;
  z-index: 1;
}

.ea-hero > *,
body > section:first-of-type > * {
  position: relative;
  z-index: 2;
}

.ea-hero h1,
body > section:first-of-type h1 {
  margin-bottom: var(--sp-s);
}

.ea-hero p,
body > section:first-of-type > p:first-of-type {
  max-width: 40ch;
  margin-inline: auto;
  color: var(--muted);
}

/* ── Layout ───────────────────────────────────────────── */
body {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
}

section, article {
  width: min(var(--measure), 90vw);
  margin-inline: auto;
  padding-block: var(--sp-l);
  text-align: center;
}

/* ── Header / Nav ─────────────────────────────────────── */
header {
  position: sticky;
  top: 0;
  z-index: 90;
  width: 100%;
  backdrop-filter: blur(20px) saturate(120%);
  -webkit-backdrop-filter: blur(20px) saturate(120%);
  background: rgba(6,6,16,.85);
  border-bottom: 1px solid var(--line);
}

nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-m);
  padding: var(--sp-s) var(--sp-m);
  max-width: 640px;
  margin-inline: auto;
}

nav ul {
  display: flex;
  gap: var(--sp-m);
  list-style: none;
}

nav a,
nav li a {
  font-family: var(--ff-head);
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  transition: color .25s var(--ease);
}
nav a:hover { color: var(--light); opacity: 1; }

/* ── Cards ────────────────────────────────────────────── */
.ea-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--sp-s);
  text-align: left;
}

.ea-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--sp-m);
  transition: border-color .25s var(--ease), transform .25s var(--ease);
}
.ea-card:hover {
  border-color: rgba(139,156,247,.15);
  transform: translateY(-2px);
}
.ea-card h3 { text-align: left; margin-bottom: var(--sp-xs); }

/* ── Buttons ──────────────────────────────────────────── */
.ea-btn {
  display: inline-block;
  font-family: var(--ff-head);
  font-size: .68rem;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: .55em 1.6em;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  color: var(--accent);
  background: transparent;
  cursor: pointer;
  transition: background .25s var(--ease), color .25s var(--ease);
}
.ea-btn:hover { background: var(--accent); color: var(--void); opacity: 1; }

/* ── Celestial section dividers ──────────────────────── */
hr, .ea-divider {
  border: none;
  height: 1px;
  width: 3rem;
  margin: var(--sp-l) auto;
  background: var(--line);
}

/* Star divider variant with NASA nebula background */
.ea-star-divider {
  width: min(var(--measure), 90vw);
  height: 120px;
  margin: var(--sp-l) auto;
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}
.ea-star-divider::before {
  content: '';
  position: absolute;
  inset: 0;
  /* NASA public domain: Carina Nebula from JWST */
  background:
    url('https://images-assets.nasa.gov/image/PIA23128/PIA23128~small.jpg') center/cover no-repeat;
  opacity: 0.15;
}

/* ── Section celestial accents ───────────────────────── */
/* Second section gets a subtle nebula glow */
body > section:nth-of-type(2) {
  position: relative;
}
body > section:nth-of-type(2)::before {
  content: '';
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  width: 300px;
  height: 300px;
  /* NASA public domain: Pillars of Creation tint */
  background: radial-gradient(
    ellipse at center,
    rgba(139,156,247,.04) 0%,
    transparent 70%
  );
  pointer-events: none;
  z-index: -1;
}

/* ── Images ───────────────────────────────────────────── */
img {
  border-radius: var(--radius);
  opacity: 0.9;
  transition: opacity .25s var(--ease);
  margin: var(--sp-s) 0;
}
img:hover { opacity: 1; }

/* ── Lists ────────────────────────────────────────────── */
ol, ul {
  text-align: left;
  padding-left: 1.5em;
  margin: var(--sp-s) auto;
  max-width: var(--measure);
}

li {
  margin-bottom: var(--sp-xs);
}

dl {
  text-align: left;
  margin: var(--sp-m) auto;
  max-width: var(--measure);
}

dt {
  font-family: var(--ff-head);
  font-weight: 500;
  color: var(--light);
  margin-top: var(--sp-s);
  font-size: 0.85rem;
}

dd {
  margin-left: 1em;
  color: var(--muted);
  margin-bottom: var(--sp-xs);
}

/* ── Inline styles override helpers ──────────────────── */
/* Neutralize inline styles from HTML for consistent look */
[style*="color"] { color: var(--text) !important; }
[style*="background-color"] { background-color: transparent !important; }
[style*="font-family"] { font-family: var(--ff-body) !important; }
[style*="font-size"]:not(title) { font-size: inherit !important; }
h1[style] { color: var(--light) !important; font-size: clamp(1.6rem, 1.2rem + 2vw, 2.8rem) !important; }

/* ── Footer ───────────────────────────────────────────── */
footer,
body > hr ~ * {
  width: 100%;
  text-align: center;
  padding: var(--sp-l) var(--sp-s) var(--sp-m);
  font-size: .68rem;
  color: var(--muted);
  letter-spacing: .04em;
}

/* ── Abbreviations ────────────────────────────────────── */
abbr[title] {
  text-decoration: underline dotted var(--muted);
  text-underline-offset: 2px;
  cursor: help;
}

/* ── Animations ───────────────────────────────────────── */
.ea-fade {
  animation: fadeIn .6s var(--ease) both;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 600px) {
  nav { flex-wrap: wrap; gap: var(--sp-s); }
  nav ul { gap: var(--sp-s); flex-wrap: wrap; justify-content: center; }
  .ea-hero,
  body > section:first-of-type { min-height: 50vh; }
  .ea-grid { grid-template-columns: 1fr; }
}
