/* Cassini Field Observatory — PIA14909 Obsidian & Archival Vellum Design System */

:root {
  --bg: #090b0a;
  --bg-elev: #101412;
  --bg-inset: #151b18;
  --border: #232c27;
  --border-strong: #34413a;
  --fg: #ebe7dd;
  --fg-muted: #9aa49c;
  --fg-faint: #6c776f;
  --accent: #e2c87a;       /* Titan tholin gold (PIA14909) */
  --accent-dim: rgba(226, 200, 122, 0.14);
  --haze: #7eb8da;         /* Detached upper haze blue (PIA06122) */
  --haze-dim: rgba(126, 184, 218, 0.14);
  --sage: #8ec4a8;         /* Ice-sage telemetry */
  --warn: #e0915a;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  --font-serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --measure: 70ch;
  --wide: 1080px;
}

[data-theme="light"] {
  --bg: #f7f4ec;           /* Warm archival vellum */
  --bg-elev: #efeae0;
  --bg-inset: #e6dfd1;
  --border: #d5cdbd;
  --border-strong: #b9ae98;
  --fg: #181a17;
  --fg-muted: #4f5750;
  --fg-faint: #737b74;
  --accent: #8b6012;       /* Deep ochre gold (WCAG AAA on vellum) */
  --accent-dim: rgba(139, 96, 18, 0.10);
  --haze: #1e5c82;         /* Deep atmospheric blue */
  --haze-dim: rgba(30, 92, 130, 0.10);
  --sage: #256448;
  --warn: #a64b17;
  --shadow: 0 8px 24px rgba(24, 26, 23, 0.08);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  line-height: 1.68;
  text-rendering: optimizeLegibility;
}

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

a:hover {
  text-decoration: underline;
}

/* Telemetry top bar */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 0.72rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  white-space: nowrap;
}

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

.brand-mark {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.95rem;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.03em;
}

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

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--accent);
  text-decoration: none;
}

.theme-btn {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--fg-muted);
  border-radius: 4px;
  padding: 0.22rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  cursor: pointer;
  line-height: 1.2;
}

.theme-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* Main container */
.shell {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4.5rem;
}

.prose-shell {
  max-width: 820px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4.5rem;
}

/* Hero */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(240px, 0.85fr);
  gap: 2.5rem;
  align-items: center;
  padding: 1.5rem 0 2.5rem;
  border-bottom: 1px solid var(--border);
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--haze);
  margin: 0 0 0.75rem;
}

h1, h2, h3 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--fg);
}

.hero h1 {
  font-size: clamp(2.05rem, 3.8vw, 2.95rem);
  margin: 0 0 1rem;
}

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

.telemetry-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.35rem;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
  color: var(--fg-muted);
  padding-top: 0.8rem;
  border-top: 1px dashed var(--border);
}

.telemetry-strip strong {
  color: var(--accent);
  font-weight: 600;
}

.hero-emblem {
  display: flex;
  justify-content: center;
  align-items: center;
}

.hero-emblem svg {
  width: 100%;
  max-width: 340px;
  height: auto;
}

/* Section headings */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin: 2.8rem 0 1.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.section-head h2 {
  margin: 0;
  font-size: 1.38rem;
}

.section-head .meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--fg-faint);
}

/* Cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.35rem 1.45rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  transition: border-color 0.18s ease, transform 0.18s ease;
}

.card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.card-featured {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(240px, 0.9fr);
  gap: 1.75rem;
  align-items: center;
  border-color: color-mix(in srgb, var(--accent) 42%, var(--border));
  background: linear-gradient(135deg, var(--bg-elev), color-mix(in srgb, var(--bg-elev) 90%, var(--accent)));
}

.card-featured img {
  width: 100%;
  height: auto;
  border-radius: 6px;
  border: 1px solid var(--border);
  display: block;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

.pill {
  display: inline-block;
  padding: 0.12rem 0.48rem;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}

.pill-haze {
  background: var(--haze-dim);
  color: var(--haze);
  border-color: color-mix(in srgb, var(--haze) 30%, transparent);
}

.card h3 {
  margin: 0;
  font-size: 1.22rem;
}

.card h3 a {
  color: var(--fg);
}

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

.card p {
  margin: 0;
  color: var(--fg-muted);
  font-size: 0.95rem;
}

.card-stats {
  margin-top: auto;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-variant-numeric: tabular-nums;
  color: var(--sage);
}

/* Orbit log list */
.log-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--border);
}

.log-item {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 1rem;
  padding: 0.95rem 0;
  border-bottom: 1px solid var(--border);
  align-items: baseline;
}

.log-date {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  color: var(--fg-faint);
}

.log-title {
  font-family: var(--font-serif);
  font-size: 1.08rem;
  font-weight: 600;
  color: var(--fg);
}

.log-summary {
  margin: 0.25rem 0 0;
  font-size: 0.92rem;
  color: var(--fg-muted);
}

/* Article / Exploration Typography */
.article-header {
  padding-bottom: 1.6rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}

.article-header h1 {
  font-size: clamp(1.85rem, 3.2vw, 2.5rem);
  margin: 0.4rem 0 0.8rem;
}

.article-dek {
  font-size: 1.08rem;
  color: var(--fg-muted);
  margin: 0 0 1.1rem;
  max-width: 64ch;
}

.article-body h2 {
  font-size: 1.42rem;
  margin: 2.3rem 0 0.75rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--border);
}

.article-body h3 {
  font-size: 1.12rem;
  margin: 1.65rem 0 0.5rem;
  color: var(--accent);
}

.article-body p,
.article-body ul,
.article-body ol {
  max-width: var(--measure);
  margin: 0 0 1.05rem;
}

.article-body li {
  margin-bottom: 0.42rem;
}

.article-body blockquote {
  margin: 1.4rem 0;
  padding: 0.85rem 1.2rem;
  border-left: 3px solid var(--accent);
  background: var(--bg-elev);
  color: var(--fg-muted);
  max-width: var(--measure);
  border-radius: 0 6px 6px 0;
}

.article-body code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: var(--bg-inset);
  padding: 0.12em 0.36em;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.article-body pre {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.15rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.55;
  margin: 1.2rem 0 1.5rem;
}

.article-body pre code {
  background: transparent;
  padding: 0;
  border: 0;
}

/* Booktabs tables (rules-only, Bringhurst / Cassini style) */
.table-wrap {
  overflow-x: auto;
  margin: 1.35rem 0 1.65rem;
}

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

thead th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  color: var(--fg-muted);
  padding: 0.55rem 0.7rem;
  border-top: 2px solid var(--border-strong);
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}

tbody td {
  padding: 0.52rem 0.7rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

tbody tr:last-child td {
  border-bottom: 2px solid var(--border-strong);
}

.num {
  text-align: right;
  font-family: var(--font-mono);
}

/* Scientific Figures & Plates */
.figure {
  margin: 1.85rem 0 2.1rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  box-shadow: var(--shadow);
}

.figure img,
.figure svg {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
}

.figure figcaption {
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
  font-size: 0.84rem;
  color: var(--fg-muted);
  line-height: 1.55;
}

.figure figcaption strong {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Equation display */
.eq-block {
  margin: 1.2rem 0 1.4rem;
  padding: 0.9rem 1.15rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-left: 3px solid var(--haze);
  border-radius: 0 6px 6px 0;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  overflow-x: auto;
  color: var(--fg);
}

/* Callout */
.callout {
  margin: 1.45rem 0;
  padding: 1rem 1.2rem;
  background: var(--bg-elev);
  border: 1px solid color-mix(in srgb, var(--haze) 40%, var(--border));
  border-radius: 6px;
  max-width: var(--measure);
}

.callout-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--haze);
  margin: 0 0 0.4rem;
}

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

/* Question cards */
.q-list {
  display: grid;
  gap: 1rem;
}

.q-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.15rem 1.3rem;
}

.q-card h3 {
  margin: 0.25rem 0 0.5rem;
  font-size: 1.12rem;
}

.q-card p {
  margin: 0;
  color: var(--fg-muted);
  font-size: 0.94rem;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.8rem 1.5rem 2.5rem;
  color: var(--fg-faint);
  font-family: var(--font-mono);
  font-size: 0.76rem;
}

.footer-inner {
  max-width: var(--wide);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.8rem 1.5rem;
}

.footer-links {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

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

@media (max-width: 780px) {
  .hero,
  .card-featured,
  .card-grid {
    grid-template-columns: 1fr;
  }
  .log-item {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }
}
