/* ============================
   assets/custom.css (Indigo + Sage + robust dark mode)
   Works with BOTH:
   - html[data-bs-theme="dark"]  (Bootstrap 5.3 / newer Quarto)
   - html.quarto-dark            (older Quarto)
   ============================ */

/* ----------------------------
   Small, high-signal tweaks
   ---------------------------- */
.hero-subtitle { font-size: 1.05rem; opacity: 0.9; }
.inline-meta { opacity: 0.9; }

.paper-title { font-weight: 650; }
.paper-authors { opacity: 0.9; }
.paper-status { font-size: 0.9rem; opacity: 0.95; }
.paper-abstract { opacity: 0.95; }

.hero-columns{ --bs-gutter-x: 4rem; }
.hero-columns .hero-subtitle{ margin-top: 0.35rem; }

.btn { border-radius: 999px; }


/* ----------------------------
   Theme tokens
   IMPORTANT: set LIGHT defaults in :root,
   then override for dark selectors
   ---------------------------- */
:root{
  --maxw: 920px;

  /* Indigo + Sage (light defaults) */
  --accent: #4338CA;                 /* indigo */
  --accent-rgb: 67, 56, 202;

  --accent-sage: #86A789;            /* sage */
  --accent-sage-rgb: 134, 167, 137;

  /* Light neutrals */
  --text: #0F172A;
  --muted: #475569;
  --rule: rgba(15, 23, 42, 0.12);
  --bg: #F8FAFC;

  --surface-1: rgba(15, 23, 42, 0.03);
  --surface-2: rgba(15, 23, 42, 0.06);

  color-scheme: light;
}

/* Dark overrides — cover BOTH Quarto mechanisms */
html[data-bs-theme="dark"],
body[data-bs-theme="dark"],
html.quarto-dark,
body.quarto-dark{
  --accent: #A5B4FC;                 /* indigo tint */
  --accent-rgb: 165, 180, 252;

  --accent-sage: #A7D1B3;            /* sage tint */
  --accent-sage-rgb: 167, 209, 179;

  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.74);
  --rule: rgba(255, 255, 255, 0.14);
  --bg: #0B1020;

  --surface-1: rgba(255, 255, 255, 0.05);
  --surface-2: rgba(255, 255, 255, 0.08);

  color-scheme: dark;

  /* Helps Bootstrap components follow our colors even if dark CSS loads oddly */
  --bs-body-bg: #0B1020;
  --bs-body-color: rgba(255, 255, 255, 0.92);
  --bs-border-color: rgba(255, 255, 255, 0.14);
  --bs-secondary-color: rgba(255, 255, 255, 0.74);
}

/* Apply background on BOTH html + body */
html, body{
  background-color: var(--bg) !important;
  color: var(--text);
}


/* ----------------------------
   Base typography
   ---------------------------- */
body{
  font-family: "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.65;
  font-size: 1.03rem;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* Headings = serif */
h1, h2, h3, h4, h5{
  font-family: "Source Serif 4", ui-serif, Georgia, "Times New Roman", serif;
  letter-spacing: -0.01em;
  color: var(--text);
}

h1{ font-size: 2.1rem; line-height: 1.15; margin-top: 0.4rem; }
h2{ font-size: 1.55rem; line-height: 1.25; margin-top: 2.1rem; }
h3{ font-size: 1.22rem; line-height: 1.35; margin-top: 1.6rem; }

h2{
  padding-bottom: .45rem;
  border-bottom: 1px solid var(--rule);
}

/* Links */
a{
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
a:hover{ text-decoration-thickness: 2px; }

/* Code typography */
code, pre, kbd, samp{
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.92em;
}


/* ----------------------------
   Rhythm
   ---------------------------- */
p{ margin: 0.6rem 0 1rem 0; }
ul, ol{ margin: 0.2rem 0 1rem 1.2rem; }
li{ margin: 0.25rem 0; }
section{ scroll-margin-top: 80px; }

blockquote{
  border-left: 3px solid rgba(var(--accent-rgb), 0.35);
  padding-left: 1rem;
  color: var(--muted);
}


/* ----------------------------
   Badges / tables / navbar
   ---------------------------- */
.badge-status{
  display: inline-block;
  padding: .18rem .55rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-size: .82rem;
  color: var(--muted);
  background: var(--surface-1);
  vertical-align: middle;
  margin-left: .4rem;
}

.badge-rr{
  border-color: rgba(var(--accent-rgb), 0.45);
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.10);
}

/* Sage badge (and alias .badge-gold if you used it before) */
.badge-sage,
.badge-gold{
  border-color: rgba(var(--accent-sage-rgb), 0.45);
  color: rgba(var(--accent-sage-rgb), 1);
  background: rgba(var(--accent-sage-rgb), 0.10);
}

caption, .figure-caption{
  color: var(--muted);
  font-size: .92rem;
}

table{ font-size: .98rem; }

.navbar{
  border-bottom: 1px solid var(--rule);
}

/* If any cards look white in dark mode, force a dark surface */
html[data-bs-theme="dark"] .card,
html.quarto-dark .card{
  background-color: rgba(255, 255, 255, 0.04);
  border-color: var(--rule);
}

/* ----------------------------
   PDF embeds
   ---------------------------- */
.pdf-wrap{
  max-width: 1200px;
  margin: 0 auto;
}

.pdf-frame{
  width: 100%;
  height: calc(100vh - 220px);
  min-height: 900px;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--bg);
}
