/* ==========================================================================
   dadams.io: a terminal-flavored theme
   Order: tokens > base > layout > components > pages > utilities.
   Light/dark keys off html[data-bs-theme], set in _includes/head.html
   before first paint. Terminal surfaces (.term, pre, statusline) stay
   dark in both themes, the way a terminal window would.
   ========================================================================== */

/* ---------- 1. Tokens ---------- */
:root {
  --font-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --nav-h: 3.75rem;
  --radius: 10px;
  --radius-sm: 6px;

  /* light: paper and ink */
  --bg: #f5f7fa;
  --bg-elev: #ffffff;
  --bg-sunk: #eaeef4;
  --border: #d8dee9;
  --border-strong: #b6c0d0;
  --text: #1f2633;
  --text-strong: #0d1117;
  --muted: #4c566a;
  --faint: #5f697c;
  --accent: #0b6aa2;          /* Arch blue (#1793d1), deepened for contrast on paper */
  --accent-strong: #08507a;
  --accent-soft: rgba(23, 147, 209, 0.12);
  --on-accent: #ffffff;
  --green: #2f7d32;
  --yellow: #8a6100;
  --red: #b3261e;
  --purple: #7b4f9d;
  --cyan: #0e7490;
  --dot: rgba(76, 86, 106, 0.16);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 8px 24px rgba(16, 24, 40, 0.07);

  /* terminal surfaces (Nord-ish) */
  --term-bg: #151a21;
  --term-bar: #1d232c;
  --term-border: #2b323d;
  --term-text: #d8dee9;
  --term-dim: #8a96aa;
  --term-green: #a3be8c;
  --term-blue: #4fb0e5;
  --term-yellow: #ebcb8b;
  --term-red: #d57780;
  --term-purple: #b48ead;
  --term-cyan: #88c0d0;

  color-scheme: light;
}

[data-bs-theme="dark"] {
  --bg: #0e1116;
  --bg-elev: #151a21;
  --bg-sunk: #0a0d11;
  --border: #262d37;
  --border-strong: #3a4350;
  --text: #d8dee9;
  --text-strong: #eceff4;
  --muted: #a3adbf;
  --faint: #8792a6;
  --accent: #3aa8e0;
  --accent-strong: #74c3ee;
  --accent-soft: rgba(23, 147, 209, 0.16);
  --on-accent: #0b0e12;
  --green: #a3be8c;
  --yellow: #ebcb8b;
  --red: #e07a84;
  --purple: #c6a0c0;
  --cyan: #88c0d0;
  --dot: rgba(216, 222, 233, 0.07);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 30px rgba(0, 0, 0, 0.35);
  --term-bg: #11151b;
  --term-bar: #181d25;
  --term-border: #29303b;
  color-scheme: dark;
}

/* Bootstrap bridge: make its components read our tokens */
:root,
[data-bs-theme] {
  --bs-body-font-family: var(--font-sans);
  --bs-font-monospace: var(--font-mono);
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--text);
  --bs-emphasis-color: var(--text-strong);
  --bs-secondary-color: var(--muted);
  --bs-tertiary-bg: var(--bg-sunk);
  --bs-border-color: var(--border);
  --bs-heading-color: var(--text-strong);
  --bs-code-color: var(--text-strong);
}

/* ---------- 2. Base ---------- */
html { scroll-padding-top: calc(var(--nav-h) + 1rem); }

body {
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 { color: var(--text-strong); line-height: 1.25; }

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
}
a:hover { color: var(--accent-strong); text-decoration-color: currentColor; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
::selection { background: color-mix(in srgb, var(--accent) 28%, transparent); }

code, kbd, pre, samp, .mono { font-family: var(--font-mono); }

kbd {
  display: inline-block;
  font-size: 0.78em;
  line-height: 1.4;
  padding: 0.05em 0.45em;
  color: var(--text);
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  box-shadow: none;
}

.lead { font-size: 1.15rem; font-weight: 400; line-height: 1.65; color: var(--text); }
.t-dim { color: var(--faint); }

.skip-link {
  position: absolute;
  left: 0.75rem;
  top: -4rem;
  z-index: 2000;
  padding: 0.5rem 0.9rem;
  font-family: var(--font-mono);
  color: var(--on-accent);
  background: var(--accent);
  border-radius: var(--radius-sm);
  text-decoration: none;
}
.skip-link:focus { top: 0.75rem; color: var(--on-accent); }

.cursor {
  display: inline-block;
  width: 0.6em;
  height: 1.1em;
  margin-left: 0.15em;
  vertical-align: text-bottom;
  background: currentColor;
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------- 3. Layout ---------- */
/* Gutter-safe container padding: must be >= half the widest row gutter (g-lg-5) */
.container-xl { padding-inline: 1rem; }
@media (min-width: 992px) { .container-xl { padding-inline: 1.5rem; } }

.site-main {
  position: relative;
  isolation: isolate;
  min-height: 60vh;
  padding-top: var(--nav-h);
}
/* dot grid + a faint Arch-blue glow behind the top of every page */
.site-main::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 38rem;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(42rem 22rem at 88% 0%, var(--accent-soft), transparent 70%),
    radial-gradient(var(--dot) 1px, transparent 1.5px) 0 0 / 22px 22px;
  -webkit-mask-image: linear-gradient(180deg, #000 25%, transparent);
  mask-image: linear-gradient(180deg, #000 25%, transparent);
}

.section { padding-block: clamp(2.5rem, 5vw, 4rem); }
.section + .section { border-top: 1px dashed var(--border); }
.section-head { margin-bottom: 1.5rem; }
.section-head h2 {
  margin: 0;
  font-family: var(--font-mono);
  font-size: clamp(1.45rem, 2.6vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.section-head-split { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 0.5rem 1rem; }
.section-intro { color: var(--muted); max-width: 46rem; margin-bottom: 1.5rem; }

/* the "$ command" line above headings */
.cmd {
  margin: 0 0 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.cmd .ps1 { margin-right: 0.6ch; font-weight: 700; color: var(--green); }

/* ---------- 4. Navigation ---------- */
.site-nav {
  min-height: var(--nav-h);
  padding-block: 0.5rem;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}

.prompt-brand {
  display: inline-block;
  margin-right: 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.98rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.prompt-brand:hover { color: var(--text-strong); }
.pb-br, .pb-at { color: var(--faint); }
.pb-user { font-weight: 700; color: var(--green); }
.pb-host { font-weight: 700; color: var(--accent); }
.pb-dir { color: var(--text); }
.pb-sigil { margin-left: 0.1ch; color: var(--text); }
.prompt-brand .cursor { width: 0.55em; height: 1.05em; margin-left: 0.35ch; color: var(--accent); }

.site-nav .nav-link {
  position: relative;
  padding: 0.35rem 0.65rem;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
}
.site-nav .nav-link:hover,
.site-nav .nav-link:focus-visible { color: var(--text-strong); background: var(--bg-sunk); }
.site-nav .nav-link.active { color: var(--accent); font-weight: 700; }
.site-nav .nav-link.active::after {
  content: "";
  position: absolute;
  left: 0.65rem;
  right: 0.65rem;
  bottom: -0.1rem;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}
.ext-arrow { margin-left: 0.2ch; font-size: 0.85em; color: var(--faint); }

.nav-tools { display: flex; align-items: center; gap: 0.5rem; margin-left: auto; }
@media (min-width: 992px) { .nav-tools { margin-left: 0.75rem; } }

.theme-cycle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
  background: var(--bg-sunk);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.theme-cycle:hover { color: var(--text-strong); border-color: var(--border-strong); }
.theme-cycle-label { min-width: 4.2ch; text-align: left; }

.site-nav .navbar-toggler {
  padding: 0.55rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.site-nav .navbar-toggler:focus { box-shadow: 0 0 0 3px var(--accent-soft); }
.toggler-bars,
.toggler-bars::before,
.toggler-bars::after {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
}
.toggler-bars { position: relative; }
.toggler-bars::before,
.toggler-bars::after { content: ""; position: absolute; left: 0; }
.toggler-bars::before { top: -6px; }
.toggler-bars::after { top: 6px; }

@media (max-width: 991.98px) {
  .site-nav { transition: transform 0.3s ease; }
  .site-nav.navbar-hidden { transform: translateY(-100%); }
  .site-nav .navbar-collapse {
    margin-top: 0.6rem;
    padding-top: 0.5rem;
    border-top: 1px dashed var(--border);
  }
  .site-nav .nav-link.active::after { display: none; }
  .site-nav .nav-link.active::before { content: "❯ "; }
  .nav-external { padding-top: 0.35rem; margin-top: 0.35rem; border-top: 1px dashed var(--border); }
}
@media (max-width: 420px) {
  .prompt-brand { font-size: 0.9rem; margin-right: 0.5rem; }
  .theme-cycle-label { display: none; }
}

/* ---------- 5. Buttons ---------- */
.btn-accent,
.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.1rem;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.btn-accent { color: var(--on-accent); background: var(--accent); border: 1px solid var(--accent); }
.btn-accent:hover,
.btn-accent:focus-visible { color: var(--on-accent); background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-ghost { color: var(--text); background: transparent; border: 1px solid var(--border-strong); }
.btn-ghost:hover,
.btn-ghost:focus-visible { color: var(--accent); background: var(--accent-soft); border-color: var(--accent); }
.btn-accent:active,
.btn-ghost:active { transform: translateY(1px); }

.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.5rem; }

/* ---------- 6. Terminal window ---------- */
.term {
  margin: 0;
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  line-height: 1.6;
  color: var(--term-text);
  background: var(--term-bg);
  border: 1px solid var(--term-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.term-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.9rem;
  background: var(--term-bar);
  border-bottom: 1px solid var(--term-border);
}
.term-dots { display: inline-flex; gap: 6px; flex: none; }
.term-dots i { width: 11px; height: 11px; border-radius: 50%; background: var(--term-red); }
.term-dots i:nth-child(2) { background: var(--term-yellow); }
.term-dots i:nth-child(3) { background: var(--term-green); }
.term-title {
  flex: 1;
  margin-right: 45px; /* optically center against the dots */
  overflow: hidden;
  font-size: 0.76rem;
  color: var(--term-dim);
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.term-body { padding: 1rem 1.1rem 1.1rem; }
.term-line { margin: 0 0 0.5rem; overflow-wrap: anywhere; }
.term-line:last-child { margin-bottom: 0; }
.t-prompt { font-weight: 700; color: var(--term-green); }
.t-err { color: var(--term-red); }
.term .t-dim { color: var(--term-dim); }
.term a { color: var(--term-blue); text-decoration-color: color-mix(in srgb, var(--term-blue) 45%, transparent); }
.term a:hover { color: var(--term-cyan); }
.term .cursor { color: var(--term-text); height: 1em; }
.term kbd { color: var(--term-text); background: var(--term-bar); border-color: var(--term-border); }

/* fastfetch profile */
.fetch {
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
  margin: 0.85rem 0 1rem;
}
.fetch-logo {
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border: 1px solid var(--term-border);
  border-radius: 6px;
}
.fetch-head { margin: 0; font-weight: 700; }
.t-user { color: var(--term-green); }
.t-host { color: var(--term-blue); }
.fetch-rule { margin: 0 0 0.3rem; color: var(--term-dim); }
.fetch dl { margin: 0; }
.fetch dl > div { display: grid; grid-template-columns: 5.6rem minmax(0, 1fr); gap: 0.5rem; }
.fetch dt { font-weight: 700; color: var(--term-blue); }
.fetch dt::after { content: ":"; color: var(--term-dim); }
.fetch dd { margin: 0; }
.fetch-colors { display: flex; margin: 0.8rem 0 0; }
.fetch-colors span { width: 1.5rem; height: 0.85rem; }
.fetch-colors span:nth-child(1) { background: #3b4252; }
.fetch-colors span:nth-child(2) { background: #bf616a; }
.fetch-colors span:nth-child(3) { background: #a3be8c; }
.fetch-colors span:nth-child(4) { background: #ebcb8b; }
.fetch-colors span:nth-child(5) { background: #5e81ac; }
.fetch-colors span:nth-child(6) { background: #b48ead; }
.fetch-colors span:nth-child(7) { background: #88c0d0; }
.fetch-colors span:nth-child(8) { background: #e5e9f0; }
@media (max-width: 575.98px) {
  .term { font-size: 0.8rem; }
  .fetch { grid-template-columns: 1fr; gap: 0.9rem; }
  .fetch-logo { width: 6.5rem; }
  .fetch dl > div { grid-template-columns: 5rem minmax(0, 1fr); }
}

/* key/value output (finger, toml) */
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.2rem 1rem; margin: 0; }
.kv > div { display: contents; }
.kv dt { font-weight: 500; color: var(--term-blue); }
.kv dt::after { content: ":"; color: var(--term-dim); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.kv-toml dt::after { content: " ="; }
.kv-toml dd a { color: var(--term-green); text-decoration: none; }
.kv-toml dd a:hover { color: var(--term-yellow); text-decoration: underline; }
.toml-section { margin: 1rem 0 0.25rem; font-weight: 700; color: var(--term-purple); }
.toml-section:first-child { margin-top: 0; }

/* ---------- 7. Cards and lists ---------- */
.dir-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.dir-grid-3 { grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
.dir-grid-1 { grid-template-columns: 1fr; }
@media (max-width: 575.98px) { .dir-grid { grid-template-columns: 1fr; } }

.dir-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1.1rem 2.5rem 1.15rem 1.2rem;
  color: var(--text);
  text-decoration: none;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.dir-card::after {
  content: "→";
  position: absolute;
  top: 1rem;
  right: 1.1rem;
  font-family: var(--font-mono);
  color: var(--faint);
  transition: transform 0.15s ease, color 0.15s ease;
}
.dir-card:hover { color: var(--text); border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-2px); }
.dir-card:hover::after { color: var(--accent); transform: translateX(3px); }
.dir-perm { font-family: var(--font-mono); font-size: 0.72rem; color: var(--faint); }
.dir-path { font-family: var(--font-mono); font-size: 0.85rem; font-weight: 500; color: var(--accent); }
.dir-path i { width: 1.15em; margin-right: 0.3rem; }
.dir-title { font-size: 1.1rem; font-weight: 600; color: var(--text-strong); }
.dir-desc { font-size: 0.95rem; line-height: 1.5; color: var(--muted); }

.arrow-list { margin: 0; padding: 0; list-style: none; }
.arrow-list li { position: relative; margin-bottom: 0.7rem; padding-left: 1.5rem; }
.arrow-list li::before { content: "→"; position: absolute; left: 0; font-family: var(--font-mono); color: var(--green); }

.panel {
  padding: clamp(1.25rem, 3vw, 2.25rem);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.feature-img {
  display: block;
  width: 100%;
  max-width: 30rem;
  height: auto;
  margin-inline: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* home: current work */
.now-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1rem; }
.now-card {
  padding: 1.1rem 1.2rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius);
}
.now-card:nth-child(2) { border-top-color: var(--green); }
.now-card:nth-child(3) { border-top-color: var(--yellow); }
.now-card:nth-child(4) { border-top-color: var(--purple); }
.now-kind { margin: 0 0 0.45rem; font-family: var(--font-mono); font-size: 0.76rem; color: var(--faint); }
.now-kind::before { content: "## "; color: var(--accent); }
.now-title { margin: 0 0 0.45rem; font-size: 1.02rem; font-weight: 600; line-height: 1.4; }
.now-title a { color: var(--text-strong); text-decoration: none; }
.now-title a:hover { color: var(--accent); text-decoration: underline; }
.now-meta { margin: 0; font-size: 0.9rem; color: var(--muted); }
.now-foot { margin: 1.25rem 0 0; font-family: var(--font-mono); font-size: 0.85rem; color: var(--muted); }

.chip-list { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.35rem 0 0; padding: 0; list-style: none; }
.chip {
  display: inline-block;
  padding: 0.18rem 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
}
.chip:hover { color: var(--accent); border-color: var(--accent); }

/* post lists (home + blog index) */
.post-list { margin: 0; padding: 0; list-style: none; }
.post-item {
  display: grid;
  grid-template-columns: 7.25rem minmax(0, 1fr);
  gap: 1.25rem;
  padding: 1.1rem 0;
  border-bottom: 1px dashed var(--border);
}
.post-item:first-child { border-top: 1px dashed var(--border); }
.post-date { padding-top: 0.2rem; font-family: var(--font-mono); font-size: 0.85rem; color: var(--faint); }
.post-item-title { margin: 0 0 0.3rem; font-size: 1.12rem; font-weight: 600; line-height: 1.35; }
.post-item-title a { color: var(--text-strong); text-decoration: none; }
.post-item-title a:hover { color: var(--accent); text-decoration: underline; }
.post-item-desc { margin: 0; font-size: 0.97rem; line-height: 1.55; color: var(--muted); }
@media (max-width: 575.98px) { .post-item { grid-template-columns: 1fr; gap: 0.2rem; } }

.more-link { display: inline-block; margin-top: 1.25rem; font-family: var(--font-mono); font-size: 0.9rem; font-weight: 500; text-decoration: none; }
.more-link:hover { text-decoration: underline; }

.tag-list { display: flex; flex-wrap: wrap; gap: 0.25rem 0.8rem; margin: 0.5rem 0 0; padding: 0; list-style: none; }
.tag { font-family: var(--font-mono); font-size: 0.78rem; color: var(--purple); }

.year-head { margin: 2.25rem 0 0.75rem; font-family: var(--font-mono); font-size: 1.15rem; font-weight: 700; }
.year-head:first-child { margin-top: 0; }

/* ---------- 8. Page heroes ---------- */
.hero { padding-block: clamp(2.5rem, 6vw, 4.75rem) clamp(2rem, 4vw, 3rem); }
.hero-title {
  margin: 0 0 0.9rem;
  font-family: var(--font-mono);
  font-size: clamp(2.1rem, 4vw, 2.85rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.035em;
}
.hero-tags { margin-bottom: 1.25rem; font-family: var(--font-mono); font-size: 0.85rem; color: var(--muted); }
.hero-tags span { margin-inline: 0.4ch; color: var(--accent); }

.page-hero { padding-block: clamp(2.5rem, 5vw, 4rem) clamp(1.5rem, 3vw, 2.5rem); }
.page-hero h1 {
  margin-bottom: 1rem;
  font-family: var(--font-mono);
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.035em;
}
.page-hero .lead { max-width: 46rem; }
.page-hero-tight { padding-bottom: 1rem; }

/* ---------- 9. Research ---------- */
.docstring {
  margin: 1rem 0 1.25rem;
  padding: 1rem 1.25rem;
  font-family: var(--font-mono);
  font-size: clamp(0.92rem, 1.5vw, 1.05rem);
  line-height: 1.65;
  color: var(--term-text);
  background: var(--term-bg);
  border: 1px solid var(--term-border);
  border-left: 3px solid var(--term-green);
  border-radius: var(--radius-sm);
}
.ds-def { margin: 0; }
.py-kw { color: var(--term-purple); }
.py-fn { color: var(--term-blue); }
.ds-body { margin: 0.2rem 0 0; padding-left: 4ch; color: var(--term-green); }
.ds-body p { margin: 0; }
.ds-q { color: var(--term-dim); }

.focus-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
@media (max-width: 767.98px) { .focus-grid { grid-template-columns: 1fr; } }
.focus-card { padding: 1.2rem 1.3rem; background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); }
.focus-path { margin: 0 0 0.4rem; font-family: var(--font-mono); font-size: 0.85rem; font-weight: 500; color: var(--accent); }
.focus-card h3 { margin-bottom: 0.4rem; font-size: 1.1rem; font-weight: 600; }
.focus-card p:last-child { margin: 0; color: var(--muted); }

.pub-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 1.5rem; margin-bottom: 1rem; }
.grep-box {
  display: flex;
  flex: 1 1 22rem;
  align-items: center;
  gap: 0.6rem;
  min-width: 0; /* shrink below the input's intrinsic width on 320px phones */
  max-width: 36rem;
  margin: 0;
  padding: 0.5rem 0.75rem;
  font-family: var(--font-mono);
  color: var(--term-text);
  background: var(--term-bg);
  border: 1px solid var(--term-border);
  border-radius: var(--radius-sm);
  cursor: text;
}
.grep-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.grep-prompt { font-size: 0.88rem; font-weight: 700; color: var(--term-green); white-space: nowrap; }
.grep-box input {
  flex: 1;
  min-width: 0;
  padding: 0;
  font: inherit;
  font-size: 0.95rem;
  color: var(--term-text);
  background: transparent;
  border: 0;
  outline: 0;
}
.grep-box input::placeholder { color: var(--term-dim); }
.grep-box input::-webkit-search-cancel-button { filter: invert(0.7); }
.grep-hint { color: var(--term-dim); background: var(--term-bar); border-color: var(--term-border); }
.grep-echo { color: var(--text-strong); }
.pub-count { margin: 0; font-family: var(--font-mono); font-size: 0.85rem; color: var(--muted); }

.pub-jump { display: flex; flex-wrap: wrap; gap: 0.35rem 1.1rem; margin-bottom: 1.25rem; font-family: var(--font-mono); font-size: 0.82rem; }
.pub-jump a { color: var(--muted); text-decoration: none; }
.pub-jump a::before { content: "#"; color: var(--accent); }
.pub-jump a:hover { color: var(--accent); }

.pub-section { margin-top: 2.25rem; }
.pub-heading {
  margin-bottom: 0.25rem;
  padding-bottom: 0.5rem;
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
}
.pub-heading::before { content: "## "; color: var(--accent); }
.pub-list { margin: 0; padding: 0; list-style: none; }
.pub {
  display: grid;
  grid-template-columns: 5.25rem minmax(0, 1fr);
  gap: 1rem;
  padding: 0.9rem 0;
  border-bottom: 1px dashed var(--border);
}
.pub-year { padding-top: 0.15rem; font-family: var(--font-mono); font-size: 0.85rem; color: var(--faint); }
.pub-title { margin: 0 0 0.25rem; font-size: 1.02rem; font-weight: 600; line-height: 1.4; color: var(--text-strong); }
.pub-title a { color: inherit; text-decoration: none; }
.pub-title a:hover { color: var(--accent); text-decoration: underline; }
.pub-title a::after { content: " ↗"; font-family: var(--font-mono); font-size: 0.8em; color: var(--faint); }
.pub-authors { margin: 0 0 0.15rem; font-size: 0.93rem; color: var(--muted); }
.pub-authors strong { font-weight: 600; color: var(--text); }
.pub-venue { margin: 0; font-size: 0.93rem; color: var(--muted); }
.pub-venue em { color: var(--text); }
.pub-doi { margin-left: 0.35rem; font-family: var(--font-mono); font-size: 0.74rem; color: var(--faint); overflow-wrap: anywhere; }
.pub[hidden], .pub-section[hidden] { display: none; }
.pub-empty { margin-top: 1.5rem; font-family: var(--font-mono); color: var(--red); }
@media (max-width: 575.98px) { .pub { grid-template-columns: 1fr; gap: 0.15rem; } }

.badge-tag {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  line-height: 1.6;
  color: var(--accent);
  white-space: nowrap;
  vertical-align: 0.08em;
  border: 1px solid currentColor;
  border-radius: 4px;
}
.badge-forthcoming { color: var(--green); }
.badge-under-review { color: var(--yellow); }
.badge-book, .badge-edited-textbook, .badge-textbook-chapter { color: var(--purple); }
.badge-public-scholarship { color: var(--cyan); }

/* ---------- 10. Teaching ---------- */
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 1.25rem; }
.course-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.course-card:hover { border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-3px); }
.course-card:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.course-card .stretched-link:focus-visible { outline: none; }
.course-img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-bottom: 1px solid var(--border); }
.course-body { display: flex; flex: 1; flex-direction: column; padding: 1rem 1.15rem 1.15rem; }
.course-code {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0 0 0.3rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
}
.course-level { font-size: 0.74rem; font-weight: 500; color: var(--faint); }
.course-title { margin: 0 0 0.4rem; font-size: 1.15rem; font-weight: 600; }
.course-title a { color: var(--text-strong); text-decoration: none; }
.course-blurb { flex: 1; margin-bottom: 0.6rem; font-size: 0.93rem; line-height: 1.5; color: var(--muted); }
.course-cta { margin: 0; font-family: var(--font-mono); font-size: 0.82rem; color: var(--accent); }

/* ---------- 11. CV timeline (git log --graph) ---------- */
.timeline { position: relative; margin: 0; padding: 0; list-style: none; }
.tl-item { position: relative; padding: 0 0 1.6rem 2rem; }
.tl-item::before {
  content: "";
  position: absolute;
  top: 0.6rem;
  bottom: -0.6rem;
  left: 0.44rem;
  width: 2px;
  background: var(--border-strong);
}
.tl-item:last-child::before { display: none; }
.tl-item::after {
  content: "";
  position: absolute;
  top: 0.3rem;
  left: 0;
  width: 0.95rem;
  height: 0.95rem;
  background: var(--bg);
  border: 2px solid var(--accent);
  border-radius: 50%;
}
.tl-item:first-child::after { background: var(--accent); }
.tl-when { margin: 0 0 0.15rem; font-family: var(--font-mono); font-size: 0.82rem; color: var(--yellow); }
.timeline-head .tl-item:first-child .tl-when::after { content: " (HEAD -> main)"; color: var(--cyan); }
.tl-what { margin: 0 0 0.1rem; font-size: 1.1rem; font-weight: 600; }
.tl-where { margin: 0; color: var(--muted); }

/* ---------- 12. Contact ---------- */
.calendly-frame {
  overflow: hidden;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.calendly-frame noscript p { margin: 0; padding: 1.25rem; color: #1f2633; }

/* ---------- 13. Blog posts ---------- */
.post { padding-block: clamp(2rem, 4vw, 3rem) 1rem; }
.post-head,
.post-body,
.post-foot { max-width: 44rem; margin-inline: auto; }
.post-head { margin-bottom: 2rem; padding-bottom: 1.5rem; border-bottom: 1px dashed var(--border); }
.post-path { margin-bottom: 1.25rem; font-family: var(--font-mono); font-size: 0.84rem; color: var(--faint); overflow-wrap: anywhere; }
.post-path a { color: var(--accent); text-decoration: none; }
.post-path a:hover { text-decoration: underline; }
.post-path span[aria-hidden] { margin-inline: 0.15ch; }
.post-path-file { color: var(--text); }
.post-title { margin-bottom: 0.75rem; font-size: clamp(1.8rem, 4.2vw, 2.55rem); font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; }
.post-meta { margin: 0; font-family: var(--font-mono); font-size: 0.85rem; color: var(--muted); }
.post-meta .sep { margin-inline: 0.5rem; color: var(--faint); }

.prose { font-size: 1.08rem; line-height: 1.75; }
.prose p, .prose ul, .prose ol { margin-bottom: 1.25rem; }
.prose li { margin-bottom: 0.4rem; }
.prose li::marker { color: var(--accent); }
.prose h2 { margin: 2.5rem 0 1rem; font-family: var(--font-mono); font-size: 1.4rem; font-weight: 700; letter-spacing: -0.02em; }
.prose h2::before { content: "## "; color: var(--accent); }
.prose h3 { margin: 2rem 0 0.75rem; font-size: 1.2rem; font-weight: 600; }
.prose h3::before { content: "### "; font-family: var(--font-mono); font-size: 0.9em; color: var(--accent); }
.prose h4 { margin: 1.75rem 0 0.6rem; font-size: 1.05rem; font-weight: 600; }
.prose blockquote {
  margin: 1.75rem 0;
  padding: 0.25rem 0 0.25rem 1.25rem;
  font-style: italic;
  color: var(--muted);
  border-left: 3px solid var(--green);
}
.prose blockquote p:last-child { margin-bottom: 0; }
.prose img { max-width: 100%; height: auto; border-radius: var(--radius-sm); }
.prose figure { margin: 2rem auto; }
.prose figcaption { margin-top: 0.6rem; font-size: 0.9rem; line-height: 1.5; text-align: center; color: var(--muted) !important; } /* beats inline colors in older posts */
.prose hr { margin: 2.5rem 0; border: 0; border-top: 1px dashed var(--border-strong); opacity: 1; }
.prose table { width: 100%; margin-bottom: 1.5rem; font-size: 0.95rem; border-collapse: collapse; }
.prose th, .prose td { padding: 0.5rem 0.6rem; text-align: left; border-bottom: 1px solid var(--border); }
.prose th { font-family: var(--font-mono); font-size: 0.85rem; }
.prose a { overflow-wrap: anywhere; }

:not(pre) > code {
  padding: 0.1em 0.38em;
  font-size: 0.86em;
  color: var(--text-strong);
  background: var(--bg-sunk);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.post-foot { padding-top: 1.5rem; border-top: 1px dashed var(--border); }
.post-share { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.1rem; margin-bottom: 1.5rem; font-family: var(--font-mono); font-size: 0.85rem; }
.post-share a { text-decoration: none; }
.post-share a:hover { text-decoration: underline; }
.cmd-label { color: var(--faint); }
.copy-link { padding: 0; font: inherit; color: var(--accent); background: none; border: 0; }
.copy-link:hover { text-decoration: underline; }
.post-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.pager-link {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.9rem 1rem;
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.pager-link:hover { color: var(--text); border-color: var(--accent); }
.pager-next { grid-column: 2; text-align: right; }
.pager-label { font-family: var(--font-mono); font-size: 0.78rem; color: var(--faint); }
.pager-title { font-weight: 600; line-height: 1.35; }
@media (max-width: 575.98px) {
  .post-pager { grid-template-columns: 1fr; }
  .pager-next { grid-column: 1; }
}

/* code blocks: always terminal-dark */
pre {
  margin: 0;
  padding: 1rem 1.15rem;
  overflow-x: auto;
  font-size: 0.86rem;
  line-height: 1.6;
  color: var(--term-text);
  background: var(--term-bg);
  border: 1px solid var(--term-border);
  border-radius: var(--radius-sm);
}
pre code { padding: 0; color: inherit; background: none; border: 0; font-size: inherit; }
div.highlighter-rouge { margin: 1.5rem 0; overflow: hidden; border: 1px solid var(--term-border); border-radius: var(--radius-sm); }
div.highlighter-rouge pre { border: 0; border-radius: 0; }
.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.3rem 0.5rem 0.3rem 0.9rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--term-dim);
  background: var(--term-bar);
  border-bottom: 1px solid var(--term-border);
}
.code-copy {
  padding: 0.1rem 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--term-dim);
  background: transparent;
  border: 1px solid var(--term-border);
  border-radius: 4px;
}
.code-copy:hover { color: var(--term-text); border-color: var(--term-dim); }

/* rouge syntax highlighting (Nord) */
.highlight .c, .highlight .c1, .highlight .cm, .highlight .cs, .highlight .ch, .highlight .cd, .highlight .cpf { color: #8391a8; font-style: italic; }
.highlight .cp { color: #5e81ac; }
.highlight .k, .highlight .kd, .highlight .kn, .highlight .kp, .highlight .kr, .highlight .kt, .highlight .kc { color: #81a1c1; }
.highlight .o, .highlight .ow { color: #81a1c1; }
.highlight .nb, .highlight .bp, .highlight .nf, .highlight .fm { color: #88c0d0; }
.highlight .nc, .highlight .nn, .highlight .na { color: #8fbcbb; }
.highlight .nv, .highlight .vi, .highlight .vg, .highlight .vc, .highlight .nl { color: #ebcb8b; }
.highlight .nd { color: #d08770; }
.highlight .ne, .highlight .err, .highlight .gd { color: #bf616a; }
.highlight .nt { color: #81a1c1; }
.highlight .s, .highlight .s1, .highlight .s2, .highlight .sb, .highlight .sc, .highlight .sd, .highlight .se, .highlight .sh, .highlight .si, .highlight .sx, .highlight .sr, .highlight .ss, .highlight .dl, .highlight .sa, .highlight .gi { color: #a3be8c; }
.highlight .m, .highlight .mi, .highlight .mf, .highlight .mh, .highlight .mo, .highlight .mb, .highlight .il { color: #b48ead; }
.highlight .p, .highlight .pi { color: #d8dee9; }
.highlight .gh, .highlight .gu { font-weight: 700; color: #88c0d0; }
.highlight .ge { font-style: italic; }
.highlight .gs { font-weight: 700; }

/* ---------- 14. Footer, statusline, back-to-top, help ---------- */
.site-footer { margin-top: 3rem; padding: 2rem 0 1.5rem; border-top: 1px solid var(--border); }
.social-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.4rem; margin: 0 0 1.25rem; padding: 0; list-style: none; }
.social-row a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.6rem;
  height: 2.6rem;
  font-size: 1.1rem;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
}
.social-row a:hover { color: var(--accent); background: var(--bg-elev); border-color: var(--border); }

.statusline {
  display: flex;
  flex-wrap: wrap;
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  line-height: 1.4;
  color: var(--term-dim);
  background: var(--term-bg);
  border: 1px solid var(--term-border);
  border-radius: var(--radius-sm);
}
.sl-mode { padding: 0.35rem 0.8rem; font-weight: 700; color: #11151b; background: var(--term-green); }
.sl-seg { padding: 0.35rem 0.8rem; color: var(--term-text); border-right: 1px solid var(--term-border); }
.sl-dim { color: var(--term-dim); }
.sl-fill { flex: 1; }
a.sl-seg { color: var(--term-blue); text-decoration: none; border-right: 0; border-left: 1px solid var(--term-border); }
a.sl-seg:hover { color: var(--term-cyan); text-decoration: underline; }
.sl-help { font: inherit; color: var(--term-dim); background: none; border: 0; border-left: 1px solid var(--term-border); }
.sl-help:hover { color: var(--term-text); }
.sl-help kbd { font-size: 0.9em; color: var(--term-text); background: var(--term-bar); border-color: var(--term-border); }
@media (max-width: 767.98px) {
  .statusline { font-size: 0.72rem; }
  .sl-dim, .sl-help, .sl-fill { display: none; }
  .sl-seg { flex: 1 1 auto; }
}

.back-to-top {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 1020;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  color: var(--text);
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s, color 0.15s, border-color 0.15s;
}
.back-to-top.is-visible { opacity: 1; visibility: visible; transform: none; }
.back-to-top:hover { color: var(--accent); border-color: var(--accent); }

.kbd-help { width: 100%; max-width: min(34rem, calc(100% - 2rem)); padding: 0; background: transparent; border: 0; }
.kbd-help::backdrop { background: rgba(8, 10, 14, 0.6); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.kbd-help .term-title { margin-right: 0; }
.term-close { padding: 0 0.25rem; font-size: 1.3rem; line-height: 1; color: var(--term-dim); background: none; border: 0; }
.term-close:hover { color: var(--term-text); }
.kbd-list { display: grid; grid-template-columns: auto 1fr; gap: 0.5rem 1.25rem; margin: 0; }
.kbd-list dt { font-weight: 400; white-space: nowrap; }
.kbd-list dd { margin: 0; }

/* ---------- 15. 404 ---------- */
.notfound .term { max-width: 42rem; }
.ls-out a { margin-right: 1.2ch; font-weight: 700; text-decoration: none; }
.ls-out a:hover { text-decoration: underline; }

/* ---------- 16. Motion and print ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

@media print {
  .site-nav, .site-footer, .back-to-top, .hero-actions, .pub-toolbar, .pub-jump, .kbd-help, .code-head { display: none !important; }
  .site-main { padding-top: 0; }
  .site-main::before { display: none; }
  body { color: #000; background: #fff; }
  .term, pre, .docstring, .grep-box { color: #000 !important; background: #fff !important; border-color: #999 !important; box-shadow: none; }
  a { color: #000; text-decoration: none; }
  .pub-title a::after { content: ""; }
  .section + .section { border-top: 0; }
}
