/* "Cosmos & Emergence" theme foundation — shared by every page.
   Design tokens, fonts, the cosmic backdrop, the "← Home" back-link, header,
   footer, and the image lightbox. Listing pages link this directly; the reading
   pages (/words) pull it in via article.css's @import. */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

/* Theme tokens. DARK is the default — first-time visitors, no-JS, and the base
   `:root` all get dark. LIGHT is opt-in via <html data-theme="light">, set by the
   toggle button (theme.js) and the inline bootstrap in each page's <head>, and
   persisted to localStorage. Keep both palettes in sync with index.html. */
:root {
  color-scheme: dark;
  --bg: #070b18;
  --bg-deep: #04060e;
  --text: #e9edfb;
  --muted: #99a4c6;
  --card: rgba(255, 255, 255, 0.045);
  --card-solid: #0e1428;
  --line: rgba(150, 170, 255, 0.13);
  --line-strong: rgba(150, 170, 255, 0.24);
  --violet: #a78bfa;
  --indigo: #818cf8;
  --cyan: #22d3ee;
  --pink: #f472b6;
  --amber: #fbbf24;
  --green: #34d399;
  --aurora: linear-gradient(100deg, #a78bfa, #22d3ee 52%, #f472b6);
  --star: rgba(170, 190, 255, 0.5);
  --glow-a: rgba(124, 58, 237, 0.32);
  --glow-b: rgba(34, 211, 238, 0.22);
  --glow-c: rgba(236, 72, 153, 0.2);
  --red: #fb7185;
  --blue: #60a5fa;
  --lime: #a3e635;
  --orange: #fb923c;
  --accent: var(--indigo);
}
:root[data-theme='light'] {
  color-scheme: light;
  --bg: #f5f6fc;
  --bg-deep: #e9ecfa;
  --text: #141a2e;
  --muted: #5a6483;
  --card: rgba(255, 255, 255, 0.66);
  --card-solid: #ffffff;
  --line: rgba(82, 92, 160, 0.16);
  --line-strong: rgba(82, 92, 160, 0.3);
  --violet: #7c3aed;
  --indigo: #4f46e5;
  --cyan: #0891b2;
  --pink: #db2777;
  --amber: #d97706;
  --green: #059669;
  --aurora: linear-gradient(100deg, #7c3aed, #0891b2 52%, #db2777);
  --star: rgba(99, 102, 241, 0.55);
  --glow-a: rgba(124, 58, 237, 0.18);
  --glow-b: rgba(8, 145, 178, 0.15);
  --glow-c: rgba(219, 39, 119, 0.13);
  --red: #dc2626;
  --blue: #2563eb;
  --lime: #65a30d;
  --orange: #ea580c;
}

* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100vh;
  padding: 44px 24px 64px;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
/* cosmic backdrop — identical to the homepage; markup injected by bg.js */
.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: radial-gradient(1200px 720px at 50% -18%, var(--bg-deep), var(--bg) 62%);
}
.bg .glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(72px);
}
.g1 { width: 520px; height: 520px; left: -160px; top: -120px; background: radial-gradient(circle, var(--glow-a), transparent 70%); }
.g2 { width: 560px; height: 560px; right: -190px; top: 180px; background: radial-gradient(circle, var(--glow-b), transparent 70%); }
.g3 { width: 620px; height: 480px; left: 26%; bottom: -240px; background: radial-gradient(circle, var(--glow-c), transparent 70%); }
.constellation { position: absolute; inset: 0; width: 100%; height: 100%; }
.constellation .orbit { fill: none; stroke: var(--star); stroke-width: 1; opacity: 0.35; }
.constellation line { stroke: var(--star); stroke-width: 1; opacity: 0.28; }
.constellation circle { fill: var(--star); }
.constellation .tw { animation: tw 4.5s ease-in-out infinite; }
@keyframes tw { 0%, 100% { opacity: 0.25; } 50% { opacity: 0.95; } }

.wrap {
  max-width: 820px;
  margin: 0 auto;
}
.home {
  display: inline-block;
  margin-bottom: 24px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  color: color-mix(in srgb, var(--cyan) 72%, var(--text));
  text-decoration: none;
}
.home:hover {
  text-decoration: underline;
}
header {
  margin-bottom: 26px;
}
h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: clamp(1.9rem, 4vw, 2.3rem);
  line-height: 1.1;
  letter-spacing: -0.015em;
  margin: 0 0 10px;
  background: var(--aurora);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.lede {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--muted);
  margin: 0;
  max-width: 64ch;
}
footer {
  margin-top: 44px;
  text-align: center;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.74rem;
  color: var(--muted);
}
footer a {
  color: color-mix(in srgb, var(--cyan) 70%, var(--text));
  text-decoration: none;
}
footer a:hover {
  text-decoration: underline;
}

/* ---- image lightbox (art / races / backpacking) ---- */
.lb {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: rgba(4, 6, 14, 0.92);
  cursor: zoom-out;
}
.lb.open {
  display: flex;
}
.lb img {
  max-width: 100%;
  max-height: 84vh;
  border-radius: 10px;
  box-shadow: 0 30px 80px -28px rgba(0, 0, 0, 0.85);
}
.lb figcaption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 16px;
  text-align: center;
  color: #cbd5e1;
  font-size: 0.85rem;
  padding: 0 24px;
}
.lb button {
  position: absolute;
  background: rgba(255, 255, 255, 0.1);
  border: 0;
  color: #fff;
  width: 46px;
  height: 46px;
  border-radius: 9999px;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}
.lb button:hover {
  background: rgba(255, 255, 255, 0.22);
}
.lb .close {
  top: 18px;
  right: 18px;
}
.lb .prev {
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
}
.lb .next {
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
}
@media (max-width: 560px) {
  .lb .prev,
  .lb .next {
    top: auto;
    bottom: 18px;
    transform: none;
  }
  .lb .prev {
    left: 18px;
  }
  .lb .next {
    right: 18px;
  }
}

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