/* Vega's Workshop — Observatory Notebook Stylesheet */

:root {
  --bg: #070b14;
  --bg-elev: #0c1322;
  --bg-card: #10192c;
  --bg-card-hover: #142038;
  --bg-code: #0a101d;
  --border: #1d2c48;
  --border-strong: #2c4166;
  --fg: #e5edf8;
  --fg-muted: #93a7c6;
  --fg-dim: #667a9b;
  --accent: #7ec8ff;       /* Vega A0V starlight blue */
  --accent-bright: #b8e2ff;
  --accent-soft: rgba(126, 200, 255, 0.12);
  --gold: #f4be64;         /* Numerical highlight */
  --teal: #5eead4;
  --coral: #fb7185;
  --radius: 12px;
  --radius-sm: 7px;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "Space Grotesk", "Inter", -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, monospace;
  --measure: 76ch;
  --shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.45);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse 90% 45% at 50% -10%, rgba(76, 148, 255, 0.13), transparent 70%),
    radial-gradient(ellipse 50% 35% at 88% 8%, rgba(244, 190, 100, 0.05), transparent 60%),
    var(--bg);
}

a {
  color: var(--accent);
  text-decoration: none;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--accent-bright);
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ==================== Top Navigation ==================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(7, 11, 20, 0.82);
  border-bottom: 1px solid rgba(29, 44, 72, 0.75);
}

.site-header-inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0.8rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--fg);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand:hover {
  color: var(--accent-bright);
  text-decoration: none;
}

.brand-star {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.brand-sub {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--fg-dim);
  margin-left: 0.15rem;
  display: inline-block;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.4rem;
  font-size: 0.92rem;
}

.site-nav a {
  color: var(--fg-muted);
  font-weight: 500;
  transition: color 0.15s ease;
}

.site-nav a:hover,
.site-nav a.active {
  color: var(--fg);
  text-decoration: none;
}

.site-nav a.active {
  color: var(--accent);
}

/* ==================== Main Container ==================== */

.container {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4.5rem;
  flex: 1;
}

.container-narrow {
  max-width: 860px;
}

/* ==================== Home Hero ==================== */

.hero {
  position: relative;
  padding: 2.4rem 0 2.6rem;
  margin-bottom: 2.4rem;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2rem;
  align-items: center;
}

.hero-kicker {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin: 0 0 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.hero-kicker::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 4.4vw, 3.1rem);
  line-height: 1.12;
  letter-spacing: -0.025em;
  margin: 0 0 1rem;
  color: #f4f8ff;
}

.hero-lead {
  font-size: 1.08rem;
  color: var(--fg-muted);
  max-width: 62ch;
  margin: 0 0 1.4rem;
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1.6rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--fg-dim);
}

.hero-stats strong {
  color: var(--fg);
  font-weight: 600;
}

.hero-emblem {
  width: 170px;
  height: 170px;
  opacity: 0.95;
  flex-shrink: 0;
}

/* ==================== Section Headers ==================== */

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 1.4rem;
}

.section-head h2 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0;
  color: #f0f6ff;
}

.section-head-link {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--fg-muted);
}

/* ==================== Exploration Cards ==================== */

.exp-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.6rem;
  margin-bottom: 3.4rem;
}

.exp-card {
  display: grid;
  grid-template-columns: 380px 1fr;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.exp-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  background: var(--bg-card-hover);
}

.exp-card-media {
  position: relative;
  background: #0a0f1c;
  overflow: hidden;
  border-right: 1px solid var(--border);
  min-height: 235px;
  padding: 0.55rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.exp-card-media img {
  width: 100%;
  height: 100%;
  max-height: 270px;
  object-fit: contain;
  object-position: center;
  border-radius: 6px;
  transition: transform 0.35s ease;
}

.exp-card:hover .exp-card-media img {
  transform: scale(1.025);
}

.exp-card-body {
  padding: 1.55rem 1.75rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.9rem;
}

.exp-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--fg-dim);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.18rem 0.58rem;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid rgba(126, 200, 255, 0.22);
  color: var(--accent-bright);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  text-decoration: none;
  white-space: nowrap;
}

.pill:hover {
  background: rgba(126, 200, 255, 0.2);
  text-decoration: none;
}

.pill-gold {
  background: rgba(244, 190, 100, 0.11);
  border-color: rgba(244, 190, 100, 0.28);
  color: var(--gold);
}

.pill-muted {
  background: rgba(147, 167, 198, 0.08);
  border-color: rgba(147, 167, 198, 0.18);
  color: var(--fg-muted);
}

.exp-card h3 {
  font-family: var(--font-display);
  font-size: 1.38rem;
  line-height: 1.25;
  letter-spacing: -0.015em;
  margin: 0.15rem 0 0.45rem;
}

.exp-card h3 a {
  color: #f3f8ff;
  text-decoration: none;
}

.exp-card h3 a:hover {
  color: var(--accent-bright);
}

.exp-card-excerpt {
  color: var(--fg-muted);
  font-size: 0.95rem;
  line-height: 1.62;
  margin: 0;
}

.exp-card-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(29, 44, 72, 0.65);
  font-size: 0.84rem;
}

.exp-card-files {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.read-more {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--accent);
}

/* ==================== Teaser Shelf (Home) ==================== */

.shelf-box {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.75rem;
}

.shelf-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.95rem;
}

.shelf-list li {
  padding-left: 1.1rem;
  position: relative;
  color: var(--fg-muted);
  font-size: 0.94rem;
}

.shelf-list li::before {
  content: "✦";
  position: absolute;
  left: 0;
  top: 0.05rem;
  color: var(--gold);
  font-size: 0.72rem;
}

.shelf-list strong {
  color: var(--fg);
}

/* ==================== Article Layout ==================== */

.breadcrumb {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--fg-dim);
  margin-bottom: 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.breadcrumb a {
  color: var(--fg-muted);
}

.article-header {
  padding-bottom: 1.8rem;
  margin-bottom: 2.2rem;
  border-bottom: 1px solid var(--border);
}

.article-header h1 {
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 3.6vw, 2.65rem);
  line-height: 1.16;
  letter-spacing: -0.025em;
  margin: 0 0 1.1rem;
  color: #f4f8ff;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1.1rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--fg-muted);
  margin-bottom: 1rem;
}

.article-resources {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.6rem;
}

.article-resources-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--fg-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-right: 0.25rem;
}

.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 3rem;
  align-items: start;
}

.article-body {
  min-width: 0;
}

/* Sticky Table of Contents */
.toc {
  position: sticky;
  top: 5.2rem;
  padding: 1rem 1.1rem;
  background: rgba(12, 19, 34, 0.65);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
}

.toc-title {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-dim);
  margin: 0 0 0.7rem;
}

.toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.toc li.toc-h3 {
  padding-left: 0.85rem;
  font-size: 0.78rem;
}

.toc a {
  color: var(--fg-muted);
  line-height: 1.38;
  display: block;
}

.toc a:hover {
  color: var(--accent);
  text-decoration: none;
}

/* ==================== Prose Typography ==================== */

.prose > p,
.prose > ul,
.prose > ol,
.prose > blockquote {
  max-width: var(--measure);
}

.prose h2 {
  font-family: var(--font-display);
  font-size: 1.52rem;
  line-height: 1.28;
  letter-spacing: -0.015em;
  color: #f2f7ff;
  margin: 2.6rem 0 0.95rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid rgba(29, 44, 72, 0.8);
  scroll-margin-top: 5rem;
}

.prose h3 {
  font-family: var(--font-display);
  font-size: 1.18rem;
  line-height: 1.35;
  color: var(--accent-bright);
  margin: 1.9rem 0 0.65rem;
  scroll-margin-top: 5rem;
}

.prose h4 {
  font-size: 1rem;
  color: var(--fg);
  margin: 1.4rem 0 0.5rem;
}

.heading-anchor {
  color: var(--fg-dim);
  font-weight: 400;
  margin-left: 0.4rem;
  opacity: 0;
  transition: opacity 0.15s ease;
  text-decoration: none;
}

.prose h2:hover .heading-anchor,
.prose h3:hover .heading-anchor {
  opacity: 0.75;
}

.prose p {
  margin: 0 0 1.1rem;
  color: #dce6f5;
}

.prose strong {
  color: #f6faff;
  font-weight: 600;
}

.prose ul, .prose ol {
  margin: 0 0 1.2rem;
  padding-left: 1.55rem;
}

.prose li {
  margin-bottom: 0.48rem;
  color: #dce6f5;
}

.prose li > ul,
.prose li > ol {
  margin-top: 0.45rem;
  margin-bottom: 0.35rem;
}

.prose hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2.3rem 0;
}

.prose blockquote {
  margin: 1.4rem 0;
  padding: 0.9rem 1.2rem;
  border-left: 3px solid var(--accent);
  background: rgba(126, 200, 255, 0.06);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--fg-muted);
}

.prose blockquote p:last-child {
  margin-bottom: 0;
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: rgba(126, 200, 255, 0.09);
  border: 1px solid rgba(126, 200, 255, 0.14);
  border-radius: 5px;
  padding: 0.1em 0.38em;
  color: #cfe8ff;
}

.prose a code {
  color: var(--accent);
  border-color: rgba(126, 200, 255, 0.28);
  transition: background 0.15s ease, color 0.15s ease;
}

.prose a:hover code {
  color: var(--accent-bright);
  background: rgba(126, 200, 255, 0.18);
}

/* Display math */
.math-display {
  margin: 1.35rem 0;
  padding: 0.7rem 1rem;
  overflow-x: auto;
  overflow-y: hidden;
  background: rgba(12, 19, 34, 0.45);
  border: 1px solid rgba(29, 44, 72, 0.55);
  border-radius: var(--radius-sm);
  text-align: center;
}

.katex-display {
  margin: 0.25rem 0 !important;
}

/* ==================== Tables ==================== */

.table-wrap {
  margin: 1.5rem 0 1.8rem;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
}

.prose th,
.prose td {
  padding: 0.62rem 0.85rem;
  border-bottom: 1px solid rgba(29, 44, 72, 0.72);
  vertical-align: top;
}

.prose thead th {
  background: #0f182a;
  color: var(--accent-bright);
  font-weight: 600;
  font-size: 0.82rem;
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}

.prose tbody tr:last-child td {
  border-bottom: 0;
}

.prose tbody tr:hover {
  background: rgba(126, 200, 255, 0.045);
}

/* ==================== Code Blocks ==================== */

.code-block {
  position: relative;
  margin: 1.4rem 0 1.7rem;
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.code-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.9rem;
  background: #0e1626;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--fg-dim);
}

.code-block pre {
  margin: 0;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  line-height: 1.58;
  color: #dce7f7;
}

.code-block pre code {
  background: none;
  border: 0;
  padding: 0;
  font-size: inherit;
  color: inherit;
}

.copy-btn {
  background: rgba(126, 200, 255, 0.1);
  color: var(--accent-bright);
  border: 1px solid rgba(126, 200, 255, 0.22);
  border-radius: 5px;
  padding: 0.18rem 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  cursor: pointer;
  transition: background 0.15s ease;
}

.copy-btn:hover {
  background: rgba(126, 200, 255, 0.22);
}

/* Lightweight Syntax Highlighting */
.tok-kw { color: #7ec8ff; font-weight: 500; }
.tok-ty { color: #5eead4; }
.tok-str { color: #a5e887; }
.tok-num { color: #f4be64; }
.tok-cm { color: #617494; font-style: italic; }
.tok-pp { color: #c084fc; }

/* ==================== Figures & Auto Gallery ==================== */

.figure-card {
  margin: 1.8rem 0 2.1rem;
  background: #0a0f1c;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.figure-card-img-wrap {
  position: relative;
  cursor: zoom-in;
  background: #070b14;
  padding: 0.4rem;
}

.figure-card-img-wrap img {
  width: 100%;
  border-radius: 6px;
}

.figure-card figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.1rem;
  background: #0d1526;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--fg-muted);
}

.figure-card-actions {
  display: flex;
  gap: 0.75rem;
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.figure-gallery {
  margin: 0 0 2.2rem;
  display: grid;
  gap: 1.5rem;
}

/* ==================== Lightbox ==================== */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(4, 7, 14, 0.94);
  backdrop-filter: blur(8px);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.lightbox.open {
  display: flex;
}

.lightbox-img {
  max-width: 96vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.7);
  background: #070b14;
}

.lightbox-bar {
  margin-top: 0.9rem;
  display: flex;
  align-items: center;
  gap: 1.2rem;
  font-size: 0.86rem;
  color: var(--fg-muted);
}

.lightbox-close {
  position: fixed;
  top: 1rem;
  right: 1.25rem;
  background: rgba(16, 25, 44, 0.9);
  color: var(--fg);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  width: 38px;
  height: 38px;
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==================== Source Code Viewer Page ==================== */

.src-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.55;
}

.src-table td {
  padding: 0 0.85rem;
  vertical-align: top;
  border: 0;
}

.src-table td.ln {
  width: 1%;
  min-width: 3.4rem;
  text-align: right;
  color: var(--fg-dim);
  user-select: none;
  border-right: 1px solid rgba(29, 44, 72, 0.7);
  padding-right: 0.75rem;
}

.src-table td.code-line {
  white-space: pre;
  color: #dce7f7;
}

/* ==================== Prev / Next Navigation ==================== */

.article-nav {
  margin-top: 3.2rem;
  padding-top: 1.8rem;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.article-nav a {
  display: block;
  padding: 1rem 1.2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.article-nav a:hover {
  border-color: var(--border-strong);
  background: var(--bg-card-hover);
}

.article-nav-dir {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--fg-dim);
  margin-bottom: 0.25rem;
}

.article-nav-title {
  color: var(--fg);
  font-weight: 500;
  font-size: 0.94rem;
}

.article-nav .next-link {
  text-align: right;
}

/* ==================== Footer ==================== */

.site-footer {
  border-top: 1px solid var(--border);
  background: rgba(7, 11, 20, 0.7);
  padding: 1.6rem 1.5rem;
  font-size: 0.84rem;
  color: var(--fg-dim);
}

.site-footer-inner {
  max-width: 1140px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.site-footer-links {
  display: flex;
  gap: 1.2rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

/* ==================== Responsive ==================== */

@media (max-width: 980px) {
  .article-layout {
    grid-template-columns: 1fr;
  }
  .toc {
    position: static;
    order: -1;
    margin-bottom: 1.5rem;
  }
  .exp-card {
    grid-template-columns: 1fr;
  }
  .exp-card-media {
    border-right: 0;
    border-bottom: 1px solid var(--border);
    max-height: 290px;
  }
}

@media (max-width: 680px) {
  .hero {
    grid-template-columns: 1fr;
    padding: 1.6rem 0 2rem;
  }
  .hero-emblem {
    display: none;
  }
  .site-header-inner {
    padding: 0.7rem 1rem;
  }
  .brand-sub {
    display: none;
  }
  .container {
    padding: 1.6rem 1rem 3.5rem;
  }
  .article-nav {
    grid-template-columns: 1fr;
  }
}
