:root {
  --ink: #3a3532;
  --muted: #6b625d;
  --paper: #f7f6f5;
  --panel: #f4f1ee;
  --accent: #8b5e34; /* warm bronze */
  --accent-2: #7c3e0a;
  --ink-on-dark: #fafaf9;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
  min-height: 100vh;
  display: flex; flex-direction: column;
}

.container { width: min(1120px, 92vw); margin: 0 auto; }

/* Header */
header {
  position: relative;
  color: var(--ink-on-dark);
  background: linear-gradient(90deg, rgba(139,94,52,0.92), rgba(124,62,10,0.92));
  padding: 4rem 0 3rem;
  /* IMPORTANT: allow dropdown to overflow header */
  overflow: visible;
}

header h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.8rem, 2.8vw + 1rem, 3rem);
  letter-spacing: 0.2px;
}

header p.lead {
  margin-top: 0.75rem;
  font-size: clamp(1rem, 1.1vw + .9rem, 1.25rem);
  opacity: .95;
}

.chipbar { display: flex; flex-wrap: wrap; gap: .5rem .75rem; margin-top: 1.25rem; }
.chip { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.3); padding: .35rem .6rem; border-radius: 999px; font-size: .875rem; }

nav.quick { margin-top: 1.25rem; display: flex; gap: 1rem; flex-wrap: wrap; }
nav.quick a { color: #fff; text-decoration: none; border-bottom: 1px dashed rgba(255,255,255,.6);} 
nav.quick a:hover { border-bottom-style: solid; }

/* Main layout */
main { flex: 1; padding: 2.25rem 0 3.5rem; }
section { background: var(--panel); border: 1px solid #e5ded8; border-radius: 12px; padding: 1.5rem; margin: 1.25rem 0 1.75rem; }
section > h2 { font-family: Georgia, serif; font-size: 1.35rem; color: #443f3b; margin-bottom: .75rem; }
section > h3 { font-family: Georgia, serif; font-size: 1.1rem; color: #4a4641; margin: 1rem 0 .5rem; }

.callout { background: #fff; border: 1px solid #eadfdb; border-left: 4px solid var(--accent); padding: .75rem 1rem; border-radius: 8px; margin: .75rem 0; }
.grid { display: grid; gap: 1rem; }
@media (min-width: 880px){ .grid-cols-2 { grid-template-columns: 1fr 1fr; } }

.kbd { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; background: #fff; border: 1px solid #e7e1dc; padding: .1rem .35rem; border-radius: 4px; }

/* Visuals */
.viz-panel { background: #0f172a; color: #cbd5e1; border-radius: 12px; border: 1px solid #1f2937; padding: 1rem; }
.viz-panel h3 { color: #e2e8f0; }
canvas { width: 100%; height: 100%; }

/* Cards */
.cards { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card { background: #fff; border: 1px solid #e9e2dc; border-radius: 10px; padding: 1rem; }
.card .k { font-weight: 600; color: var(--accent-2); }

/* Footer */
footer { color: var(--ink-on-dark); background: #3f3a36; text-align: center; padding: 1rem 0; }

/* MathJax */
mjx-container { font-size: 1.02em; }


/* =======================
   MAIN NAV + DROPDOWN FIX
   ======================= */

/* Nav bar container */
.main-nav {
  display: flex;
  gap: 20px;
  align-items: center;
  padding: 15px 0;
  margin: 20px 0 40px 0;
  border-bottom: 1px solid #ddd;

  position: relative;
  /* allow dropdown to extend outside nav */
  overflow: visible;
}

.main-nav > a {
  color: #333;
  text-decoration: none;
  padding: 10px 16px;
  transition: color 0.3s;
}
.main-nav > a:hover { color: #4a90e2; }

/* Dropdown wrapper */
.nav-dropdown {
  position: relative;
  display: inline-block;
  overflow: visible; /* avoid clipping panel */
  z-index: 10;       /* stacking context above header content */
}

/* Trigger */
.nav-dropdown-btn {
  background-color: transparent;
  color: #333;
  padding: 10px 16px;
  font-size: 16px;
  border: none;
  cursor: pointer;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  transition: color 0.3s;
}
.nav-dropdown-btn:hover { color: #4a90e2; }
.nav-dropdown-btn::after {
  content: " \25BE"; /* ▼ correct arrow (fixes â–¼ artifact) */
  font-size: 0.8em;
  margin-left: 6px;
}

/* Panel: visibility/opacity/transform instead of display:none */
.nav-dropdown-content {
  position: absolute;
  top: 100%;
  left: 0;
  background-color: #fff;
  min-width: 300px;
  border-radius: 6px;
  border: 1px solid #e7e1dc;
  box-shadow: 0 10px 24px rgba(0,0,0,0.12);
  z-index: 9999;
  margin-top: 6px;

  /* Hidden by default without breaking hover bridge */
  visibility: hidden;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .12s ease, transform .12s ease, visibility 0s linear .12s;

  /* Make sure it can grow; fixes “only one item visible” */
  max-height: none;
  overflow: visible;

  display: block; /* neutralize inherited flex/grid oddities */
}

/* Show on hover or keyboard focus */
.nav-dropdown:hover > .nav-dropdown-content,
.nav-dropdown:focus-within > .nav-dropdown-content,
.nav-dropdown-content:hover {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0s;
}

/* Items */
.nav-dropdown-content a {
  color: #333;
  padding: 12px 16px;
  text-decoration: none;
  display: block;
  border-bottom: 1px solid #eee;
  transition: background-color 0.18s ease;
  white-space: normal; /* wrap titles/desc nicely */
}
.nav-dropdown-content a:last-child { border-bottom: none; }
.nav-dropdown-content a:hover { background-color: #f7f6f5; }

.nav-dropdown-content .article-title {
  font-weight: 600;
  color: #2a2a2a;
}
.nav-dropdown-content .article-desc {
  font-size: 0.9em;
  color: #666;
  margin-top: 4px;
}

/* Keep trigger colored when open */
.nav-dropdown:hover .nav-dropdown-btn,
.nav-dropdown:focus-within .nav-dropdown-btn { color: #4a90e2; }

/* Guardrail: ensure dropdown rises above surrounding layout */
.nav-dropdown .nav-dropdown-content { z-index: 9999; }


/* === Mass–Redshift Infographic (revision per requests) === */
/* - Images on the right, rounded PNGs, no dark background or borders */
.cosmo-infographic .intro {
  color: var(--muted);
  font-size: .95rem;
  margin-bottom: .75rem;
}

.cosmo-rail { display: grid; gap: 1rem; }

.cosmo-card{
  display: grid;
  grid-template-columns: 1fr 320px; /* text | image */
  gap: 1rem;
  align-items: center;
  background: #fff;
  border: 1px solid #eadfdb;
  border-radius: 14px;
  padding: 1rem;
}

.cosmo-tag{
  display:inline-flex; gap:.5ch; align-items:center;
  background:#faf8f6; border:1px solid #efe5df;
  border-radius:999px; padding:.25rem .6rem;
  font-size:.85rem; color:#6b5f58;
}

.cosmo-title{ font-weight:700; font-size:1.1rem; margin:.4rem 0 .6rem; color:var(--ink); }
.cosmo-meta{ display:flex; flex-wrap:wrap; gap:.5rem; margin-bottom:.5rem; }
.cosmo-chip{
  background:#f9f6f3; border:1px solid #efe4de;
  border-radius:999px; padding:.25rem .55rem;
  font-size:.8rem; color:#7a6e66;
}

.cosmo-stats{ display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.6rem; }
.cosmo-row{
  display:flex; flex-direction:column;
  background:#fcfbfa; border:1px solid #eee5df;
  border-radius:10px; padding:.55rem .65rem;
}
.cosmo-row b{ font-size:.85rem; color:#4a4641; }
.cosmo-row .mono{
  font-family:ui-monospace,Menlo,Consolas,monospace;
  color:#6b625d; font-size:.92rem; margin-top:.15rem; word-break:break-word;
}

.cosmo-img{
  width:300px; height:300px; border-radius:50%;
  background: transparent; /* no black fill */
  border: none;            /* no border */
  overflow:hidden; display:grid; place-items:center;
}
.cosmo-img img{ width:100%; height:100%; object-fit:contain; display:block; }

.cosmo-foot{ margin-top:.35rem; color:#7a6e66; font-size:.78rem; }

/* Responsive */
@media (max-width: 720px){
  .cosmo-card{ grid-template-columns: 1fr; }
  .cosmo-stats{ grid-template-columns: 1fr; }
}


/* ===== Book Promo ===== */
.book-promo {
  --bg: #0e0e0e;
  --fg: #eae7dc;
  --muted: #b9b6ad;
  --accent: #d3b673;
  --accent-ink: #0b0b0b;

  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  align-items: stretch;
  background:
    radial-gradient(1200px 600px at 10% 10%, rgba(211,182,115,0.08), transparent 60%),
    radial-gradient(800px 500px at 90% 0%, rgba(211,182,115,0.06), transparent 60%),
    var(--bg);
  color: var(--fg);
  padding: 1.25rem;
  border-radius: 1.25rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.book-promo__media {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: 0.75rem;
  background: #1a1a1a;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,0.45);
}

.book-promo__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.book-promo__content {
  display: grid;
  gap: 0.75rem;
  align-content: start;
}

.book-promo__title {
  font-size: clamp(1.4rem, 2.5vw + 1rem, 2.1rem);
  line-height: 1.15;
  margin: 0;
  letter-spacing: 0.02em;
}

.book-promo__author {
  margin: 0;
  color: var(--muted);
  font-size: 0.975rem;
}

.book-promo__blurb {
  margin: 0.25rem 0 0.5rem;
  color: #e8e6e0;
  max-width: 65ch;
  font-size: 1rem;
}

.book-promo__cta {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
}

.btn {
  appearance: none;
  border: 0;
  padding: 0.8rem 1.1rem;
  border-radius: 999px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  line-height: 1;
  transition: transform 120ms ease, box-shadow 120ms ease, background-color 120ms ease, color 120ms ease;
  will-change: transform;
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn--primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 6px 18px rgba(211, 182, 115, 0.35);
}
.btn--primary:hover { transform: translateY(-1px); }

.btn--ghost {
  background: transparent;
  color: var(--fg);
  border: 1px solid rgba(234, 231, 220, 0.25);
}

/* Layout for larger screens. */
@media (min-width: 860px) {
  .book-promo {
    grid-template-columns: minmax(260px, 340px) 1fr;
    padding: 1.75rem;
    gap: 1.5rem;
  }
  .book-promo__blurb { font-size: 1.05rem; }
}

