/* =============================================================================
   rahulgaibamd.com — Shared Design System
   Tokens: verbatim from nbi-framework/src/styles/theme.css (authoritative source)
   Aesthetic: JACC/ESC editorial — authoritative, clinical, data-forward
   Per-page accent is overridden in each page's <head> <style> block.
============================================================================= */

/* ── 1. Design tokens ────────────────────────────────────────────────────── */
:root {
  /* Brand palette (exact from NBI theme.css) */
  --navy:        #002f5e;
  --navy-2:      #003d7a;
  --navy-3:      #001e40;
  --navy-soft:   #18304e;

  --green:       #16703a;
  --green-bg:    #e5f4ec;
  --green-bd:    #42b06a;

  --red:         #b01818;
  --red-bg:      #fdeaea;
  --red-bd:      #d94444;

  --amber:       #845200;
  --amber-bg:    #fff4df;
  --amber-bd:    #d99a28;

  --blue:        #0d3a80;
  --blue-bg:     #e7f0fc;
  --blue-bd:     #4278cc;

  --purple:      #5a2090;
  --purple-bg:   #f3ecfc;
  --purple-bd:   #9058cc;

  --teal:        #0a6060;
  --teal-bg:     #e0f4f4;
  --teal-bd:     #28a0a0;

  /* Surfaces & text */
  --bg:          #fbfcfe;
  --surface:     #ffffff;
  --surface-2:   #f4f7fb;
  --surface-3:   #e8edf4;
  --border:      #c4d0de;
  --border-soft: #dde4ed;
  --txt:         #18202e;
  --txt-2:       #38485e;
  --txt-3:       #657890;
  --txt-inv:     #ffffff;
  --line:        #7090b0;

  /* Typography */
  --font-serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --font-sans:  'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono:  'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;

  /* Fluid type scale (from NBI theme.css) */
  --fs-xs:      clamp(11px, 0.72rem + 0.05vw, 12px);
  --fs-sm:      clamp(12px, 0.78rem + 0.1vw, 13.5px);
  --fs-base:    clamp(14px, 0.86rem + 0.18vw, 16px);
  --fs-lg:      clamp(16px, 0.95rem + 0.3vw, 19px);
  --fs-xl:      clamp(20px, 1.1rem + 0.6vw, 26px);
  --fs-2xl:     clamp(26px, 1.4rem + 1.2vw, 38px);
  --fs-3xl:     clamp(32px, 1.6rem + 2.6vw, 60px);
  --fs-display: clamp(38px, 1.9rem + 4vw, 84px);

  /* Spacing */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px; --s9: 96px;

  /* Radii */
  --r-sm: 4px; --r: 8px; --r-lg: 14px; --r-xl: 22px;

  /* Shadows */
  --sh-sm: 0 1px 2px rgba(15,30,60,0.06);
  --sh:    0 2px 8px rgba(15,30,60,0.08), 0 1px 2px rgba(15,30,60,0.04);
  --sh-lg: 0 14px 40px rgba(0,24,64,0.14), 0 2px 6px rgba(0,24,64,0.06);
  --sh-xl: 0 24px 64px rgba(0,24,64,0.18), 0 4px 12px rgba(0,24,64,0.08);

  /* Layout */
  --container: 1180px;
  --nav-h:     60px;

  /* Per-page accent — overridden via <style> in each page's <head> */
  --accent:    var(--navy);
  --accent-bg: var(--surface-2);
  --accent-bd: var(--border);
}

/* ── 2. Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.6;
  color: var(--txt);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--navy-2); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; }

/* ── 3. Typography ────────────────────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -0.015em;
  color: var(--txt);
}
h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); font-family: var(--font-serif); }

.eyebrow {
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}
.mono  { font-family: var(--font-mono); }
.serif { font-family: var(--font-serif); }
.muted { color: var(--txt-3); }
p { line-height: 1.65; }

/* ── 4. Layout ────────────────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 48px);
}
section { padding: clamp(56px, 9vw, 104px) 0; position: relative; }

/* ── 5. Section label (vertical bar + uppercase + horizontal rule) ─────────── */
.sec-label {
  display: flex;
  align-items: center;
  gap: var(--s3);
  margin-bottom: var(--s6);
}
.sec-label .bar {
  width: 4px; height: 18px;
  background: var(--accent);
  border-radius: 2px;
  flex-shrink: 0;
}
.sec-label .text {
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--accent);
  white-space: nowrap;
  font-family: var(--font-sans);
}
.sec-label .rule { flex: 1; height: 1px; background: var(--border); }

/* ── 6. Navigation ────────────────────────────────────────────────────────── */
.site-nav {
  position: sticky;
  top: 0; z-index: 100;
  height: var(--nav-h);
  background: rgba(251,252,254,0.93);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-soft);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-h);
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 48px);
}
.nav-logo {
  font-family: var(--font-serif);
  font-size: var(--fs-base);
  font-weight: 700;
  color: var(--navy-3);
  letter-spacing: -0.01em;
}
.nav-logo:hover { text-decoration: none; color: var(--navy-2); }

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--s6);
  list-style: none;
}
.nav-links a {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--txt-2);
  letter-spacing: 0.02em;
  transition: color 0.15s;
}
.nav-links a:hover { color: var(--navy); text-decoration: none; }
.nav-links a[aria-current="page"] { color: var(--accent); font-weight: 600; }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 4px;
}
.nav-toggle span {
  display: block; width: 22px; height: 2px;
  background: var(--navy); border-radius: 1px;
  transition: transform 0.2s, opacity 0.2s;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 640px) {
  .nav-toggle { display: flex; }
  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-h); left: 0; right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    gap: 0;
    padding: var(--s3) 0;
    box-shadow: var(--sh-lg);
  }
  .nav-links.open { display: flex; }
  .nav-links a {
    display: block;
    padding: var(--s3) clamp(16px, 4vw, 48px);
    font-size: var(--fs-base);
  }
}

/* ── 7. Buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  padding: 10px 20px;
  border-radius: var(--r);
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  text-decoration: none !important;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: var(--txt-inv); box-shadow: var(--sh-sm); }
.btn-primary:hover { box-shadow: var(--sh); filter: brightness(1.08); }
.btn-ghost {
  background: var(--surface);
  color: var(--txt-2);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface-2); border-color: var(--line); color: var(--txt); }
.btn-sm { padding: 7px 14px; font-size: var(--fs-xs); }
.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--accent-bd);
}
.btn-outline:hover { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }
.btn[aria-disabled="true"] { opacity: 0.5; pointer-events: none; }

/* ── 8. Index hero ────────────────────────────────────────────────────────── */
.hero {
  min-height: calc(90vh - var(--nav-h));
  display: flex;
  align-items: center;
  padding: clamp(64px, 10vw, 120px) 0;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(at 4% 8%, rgba(0,47,94,0.05) 0, transparent 55%),
    radial-gradient(at 96% 92%, rgba(13,58,128,0.035) 0, transparent 55%);
  pointer-events: none;
}
.hero-inner {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--s8);
  align-items: center;
}
.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--txt-3);
  margin-bottom: var(--s4);
}
.hero h1 {
  font-size: var(--fs-display);
  line-height: 1.02;
  color: var(--navy-3);
  margin-bottom: var(--s5);
}
.hero-sub {
  font-family: var(--font-serif);
  font-size: var(--fs-lg);
  color: var(--txt-2);
  line-height: 1.5;
  max-width: 520px;
  margin-bottom: var(--s6);
}
.hero-actions { display: flex; gap: var(--s3); flex-wrap: wrap; }
.hero-ident {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  align-self: flex-start;
  padding-top: 12px;
}
.ident-chip {
  display: flex;
  align-items: center;
  gap: var(--s2);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--txt-3);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-sm);
  padding: 6px 10px;
  white-space: nowrap;
}
.ident-chip .dot {
  width: 6px; height: 6px; border-radius: 50%;
  flex-shrink: 0;
}
@media (max-width: 780px) {
  .hero-inner { grid-template-columns: 1fr; gap: var(--s6); }
  .hero-ident { flex-direction: row; flex-wrap: wrap; }
}

/* ── 9. Project cards grid ────────────────────────────────────────────────── */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--s5);
}
@media (max-width: 720px) { .projects-grid { grid-template-columns: 1fr; } }

.project-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.project-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--sh);
  border-color: var(--border);
}
.card-accent-bar { height: 4px; background: var(--card-accent, var(--navy)); }
.card-body {
  padding: var(--s6);
  flex: 1;
  display: flex;
  flex-direction: column;
}
.card-eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--card-accent, var(--navy));
  margin-bottom: var(--s3);
  opacity: 0.85;
}
.card-body h3 { margin-bottom: var(--s3); }
.card-body > p {
  color: var(--txt-2);
  font-size: var(--fs-sm);
  line-height: 1.65;
  flex: 1;
  margin-bottom: var(--s5);
}
.card-stats {
  display: flex;
  gap: var(--s2);
  flex-wrap: wrap;
  margin-bottom: var(--s5);
}
.card-stat {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--txt-3);
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-sm);
  padding: 3px 8px;
}
.card-actions { display: flex; gap: var(--s2); flex-wrap: wrap; margin-top: auto; }

/* ── 10. Academic record section ──────────────────────────────────────────── */
.record-list { display: flex; flex-direction: column; gap: var(--s4); }
.record-item {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  padding: var(--s5) var(--s6);
  display: grid;
  grid-template-columns: 3px 1fr auto;
  gap: 0 var(--s5);
  align-items: start;
  transition: border-color 0.15s;
}
.record-item:hover { border-color: var(--border); }
.record-bar {
  grid-row: 1 / -1;
  width: 3px;
  align-self: stretch;
  min-height: 48px;
  border-radius: 2px;
  background: var(--item-accent, var(--navy));
}
.record-content h4 {
  font-size: var(--fs-base);
  font-weight: 600;
  margin-bottom: var(--s2);
  line-height: 1.4;
}
.record-meta {
  font-size: var(--fs-xs);
  color: var(--txt-3);
  font-family: var(--font-mono);
  line-height: 1.8;
}
.record-meta a { color: var(--txt-3); }
.record-meta a:hover { color: var(--navy-2); text-decoration: underline; }

.status-tag {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 99px;
  white-space: nowrap;
  align-self: start;
  margin-top: 2px;
}
.status-pub  { background: var(--green-bg);  color: var(--green);  border: 1px solid var(--green-bd); }
.status-sub  { background: var(--blue-bg);   color: var(--blue);   border: 1px solid var(--blue-bd); }
.status-prep { background: var(--amber-bg);  color: var(--amber);  border: 1px solid var(--amber-bd); }

@media (max-width: 600px) {
  .record-item { grid-template-columns: 3px 1fr; }
  .status-tag  { grid-column: 2; }
  .record-bar  { grid-row: 1 / 3; }
}

/* ── 11. Credentials grid ─────────────────────────────────────────────────── */
.cred-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s4);
}
@media (max-width: 860px) { .cred-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px) { .cred-grid { grid-template-columns: 1fr; } }

.cred-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  padding: var(--s5);
  display: flex;
  flex-direction: column;
  gap: var(--s2);
}
.cred-label {
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--txt-3);
  font-family: var(--font-sans);
}
.cred-value {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--txt);
  font-family: var(--font-serif);
  line-height: 1.4;
}
.cred-sub {
  font-size: var(--fs-xs);
  color: var(--txt-3);
  font-family: var(--font-mono);
}
a.cred-sub:hover { color: var(--navy-2); text-decoration: underline; }

/* ── 12. Footer ───────────────────────────────────────────────────────────── */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border-soft);
  padding: var(--s8) 0 var(--s7);
}
.footer-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s6);
  flex-wrap: wrap;
  margin-bottom: var(--s6);
}
.footer-name {
  display: block;
  font-family: var(--font-serif);
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--navy);
  margin-bottom: var(--s2);
}
.footer-role {
  font-size: var(--fs-xs);
  color: var(--txt-3);
  font-family: var(--font-mono);
}
.footer-links {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
}
.footer-links a { font-size: var(--fs-sm); color: var(--txt-3); }
.footer-links a:hover { color: var(--navy); text-decoration: none; }
.footer-copy {
  font-size: var(--fs-xs);
  color: var(--txt-3);
  font-family: var(--font-mono);
  padding-top: var(--s5);
  border-top: 1px solid var(--border-soft);
}

/* ── 13. Project hero (detail pages) ─────────────────────────────────────── */
.project-hero {
  padding: clamp(56px, 8vw, 96px) 0;
  border-bottom: 1px solid var(--border-soft);
  position: relative;
  overflow: hidden;
}
.project-hero::before {
  content: '';
  position: absolute;
  right: -100px; top: -120px;
  width: 500px; height: 500px;
  border-radius: 50%;
  background: var(--accent-bg);
  opacity: 0.45;
  pointer-events: none;
}
.project-hero-inner {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: var(--s8);
  align-items: center;
  position: relative;
  z-index: 1;
}
.project-type-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-bg);
  border: 1px solid var(--accent-bd);
  border-radius: 99px;
  padding: 5px 12px;
  margin-bottom: var(--s5);
}
.project-hero-text h1 {
  font-size: var(--fs-3xl);
  line-height: 1.1;
  color: var(--navy-3);
  margin-bottom: var(--s4);
}
.lead {
  font-family: var(--font-serif);
  font-size: var(--fs-lg);
  line-height: 1.55;
  color: var(--txt-2);
  margin-bottom: var(--s6);
  max-width: 560px;
}
.project-hero-fig {
  display: flex;
  align-items: center;
  justify-content: center;
}
@media (max-width: 860px) {
  .project-hero-inner { grid-template-columns: 1fr; gap: var(--s6); }
  .project-hero-fig { display: none; }
}

/* ── 14. Content sections (detail pages) ─────────────────────────────────── */
.content-sec {
  padding: clamp(48px, 7vw, 88px) 0;
  border-bottom: 1px solid var(--border-soft);
}
.content-sec:last-of-type { border-bottom: none; }

.prose {
  font-family: var(--font-serif);
  font-size: var(--fs-base);
  line-height: 1.72;
  color: var(--txt-2);
  max-width: 680px;
}
.prose p + p { margin-top: var(--s4); }
.prose a { color: var(--accent); }
.prose a:hover { text-decoration: underline; }
.prose strong { color: var(--txt); font-weight: 600; }

/* Two-col content layout */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s7);
  align-items: start;
}
@media (max-width: 720px) { .two-col { grid-template-columns: 1fr; gap: var(--s6); } }

/* ── 15. Metric cards ─────────────────────────────────────────────────────── */
.metric-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--s4);
  margin-top: var(--s5);
}
.metric-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  padding: var(--s5);
  position: relative;
  overflow: hidden;
}
.metric-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent);
}
.metric-label {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--txt-3);
  margin-bottom: var(--s2);
}
.metric-value {
  font-family: var(--font-serif);
  font-size: var(--fs-xl);
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
  margin-bottom: var(--s2);
}
.metric-desc { font-size: var(--fs-xs); color: var(--txt-3); line-height: 1.55; }

/* ── 16. Feature list ─────────────────────────────────────────────────────── */
.feature-list { list-style: none; display: flex; flex-direction: column; gap: var(--s5); }
.feature-list li { display: flex; gap: var(--s4); align-items: flex-start; }
.feat-icon {
  width: 38px; height: 38px;
  border-radius: var(--r);
  background: var(--accent-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--accent);
  font-size: 18px;
  font-style: normal;
}
.feat-text h4 { font-size: var(--fs-base); margin-bottom: 4px; }
.feat-text p  { font-size: var(--fs-sm); color: var(--txt-2); line-height: 1.6; }

/* ── 17. NBI 2×2 matrix ───────────────────────────────────────────────────── */
.matrix-fig {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  overflow: hidden;
  max-width: 400px;
  box-shadow: var(--sh);
}
.matrix-caption {
  padding: var(--s3) var(--s4);
  font-size: var(--fs-xs);
  color: var(--txt-3);
  font-family: var(--font-mono);
  border-top: 1px solid var(--border-soft);
  text-align: center;
}
.matrix-grid {
  display: grid;
  grid-template-columns: 80px 1fr 1fr;
  grid-template-rows: 44px 1fr 1fr;
  gap: 1px;
  background: var(--border-soft);
}
.matrix-grid > * { background: var(--surface); }
.mh {
  background: var(--navy) !important;
  color: var(--txt-inv);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: center;
  padding: 4px 8px;
  line-height: 1.3;
}
.ml {
  background: var(--navy-soft) !important;
  color: rgba(255,255,255,0.85);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  text-align: center;
  padding: 8px 6px;
  line-height: 1.35;
  letter-spacing: 0.04em;
}
.mc {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px; padding: 14px 10px; text-align: center;
}
.mc-letter { font-family: var(--font-mono); font-size: 22px; font-weight: 800; line-height: 1; }
.mc-name   { font-family: var(--font-sans); font-size: 10px; font-weight: 500; line-height: 1.35; }
.cell-b  { background: var(--green-bg) !important; color: var(--green); }
.cell-ir { background: var(--amber-bg) !important; color: var(--amber); }
.cell-h  { background: var(--red-bg)   !important; color: var(--red);   }
.cell-ar { background: var(--blue-bg)  !important; color: var(--blue);  }

/* ── 18. Metrics table (NBI page) ─────────────────────────────────────────── */
.metrics-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
.metrics-table thead th {
  background: var(--navy);
  color: var(--txt-inv);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: var(--s3) var(--s4);
  text-align: left;
}
.metrics-table tbody tr { border-bottom: 1px solid var(--border-soft); }
.metrics-table tbody tr:hover { background: var(--surface-2); }
.metrics-table td { padding: var(--s3) var(--s4); vertical-align: middle; }
.metrics-table td:first-child {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: var(--fs-sm);
  color: var(--accent);
  white-space: nowrap;
}
.metrics-table .formula-cell {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--txt-2);
  white-space: nowrap;
}
.metrics-table .desc-cell { color: var(--txt-2); font-size: var(--fs-sm); line-height: 1.5; }

/* ── 19. Scroll reveal ────────────────────────────────────────────────────── */
/* Visible without JS — JS class enables animation */
.reveal { opacity: 1; transform: none; }
.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.js .reveal.visible { opacity: 1; transform: none; }

.js .reveal-stagger > * {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.42s ease, transform 0.42s ease;
}
.js .reveal-stagger.visible > * { opacity: 1; transform: none; }
.js .reveal-stagger.visible > *:nth-child(1) { transition-delay: 0ms;   }
.js .reveal-stagger.visible > *:nth-child(2) { transition-delay: 90ms;  }
.js .reveal-stagger.visible > *:nth-child(3) { transition-delay: 180ms; }
.js .reveal-stagger.visible > *:nth-child(4) { transition-delay: 270ms; }

/* ── 20. Utilities ────────────────────────────────────────────────────────── */
.flex         { display: flex; }
.flex-wrap    { flex-wrap: wrap; }
.items-center { align-items: center; }
.gap-2 { gap: var(--s2); } .gap-3 { gap: var(--s3); }
.gap-4 { gap: var(--s4); } .gap-5 { gap: var(--s5); }
.mt-4  { margin-top: var(--s4); } .mt-5 { margin-top: var(--s5); }
.mt-6  { margin-top: var(--s6); } .mt-7 { margin-top: var(--s7); }
.text-center { text-align: center; }
.surface-bg  { background: var(--surface); }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ── 21. Focus ────────────────────────────────────────────────────────────── */
:focus-visible {
  outline: 3px solid var(--blue-bd);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* ── 22. Skip link ────────────────────────────────────────────────────────── */
.skip-link {
  position: absolute; left: -10000px; top: 8px;
  background: var(--navy); color: white;
  padding: 8px 14px; border-radius: var(--r);
  z-index: 200; font-size: var(--fs-sm);
}
.skip-link:focus { left: 8px; }

/* ── 23. CV timeline (Experience & Education sections) ───────────────────── */
.cv-timeline {
  display: flex;
  flex-direction: column;
  position: relative;
}
/* Vertical rail */
.cv-timeline::before {
  content: '';
  position: absolute;
  left: 128px;
  top: 28px;
  bottom: 28px;
  width: 1px;
  background: var(--border-soft);
}

.cv-entry {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 0 var(--s6);
  padding: var(--s6) 0;
  border-bottom: 1px solid var(--border-soft);
  position: relative;
}
.cv-entry:last-child { border-bottom: none; }

/* Timeline node dot */
.cv-entry::after {
  content: '';
  position: absolute;
  left: 122px;
  top: 30px;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--accent);
  border: 2.5px solid var(--bg);
  z-index: 1;
}

.cv-date {
  text-align: right;
  padding-top: 3px;
}
.cv-date-range {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--txt-3);
  line-height: 1.6;
  display: block;
}
.cv-date-current {
  display: inline-block;
  margin-top: var(--s1);
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-bg);
  border: 1px solid var(--accent-bd);
  border-radius: 99px;
  padding: 2px 7px;
}

.cv-role {
  font-family: var(--font-serif);
  font-size: var(--fs-xl);
  font-weight: 700;
  color: var(--txt);
  line-height: 1.2;
  margin-bottom: var(--s2);
}
.cv-org {
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--txt-2);
  margin-bottom: var(--s1);
  font-family: var(--font-sans);
}
.cv-loc {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--txt-3);
  margin-bottom: var(--s4);
}
.cv-body {
  font-size: var(--fs-sm);
  color: var(--txt-2);
  line-height: 1.65;
  max-width: 600px;
}
.cv-body p + p { margin-top: var(--s2); }
.cv-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  margin-top: var(--s4);
}
.cv-tag {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--txt-3);
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-sm);
  padding: 2px 8px;
}

/* Education variant — degree pill instead of current badge */
.cv-degree {
  font-family: var(--font-serif);
  font-size: var(--fs-xl);
  font-weight: 700;
  color: var(--txt);
  line-height: 1.2;
  margin-bottom: var(--s2);
}
.cv-credential {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-bg);
  border: 1px solid var(--accent-bd);
  border-radius: var(--r-sm);
  padding: 3px 10px;
  margin-top: var(--s3);
}

@media (max-width: 600px) {
  .cv-timeline::before { display: none; }
  .cv-entry::after     { display: none; }
  .cv-entry { grid-template-columns: 1fr; gap: var(--s2); }
  .cv-date  { text-align: left; }
}

/* ── 24. Contact section ──────────────────────────────────────────────────── */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s7);
  align-items: start;
}
@media (max-width: 720px) { .contact-grid { grid-template-columns: 1fr; gap: var(--s6); } }

.contact-links-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s3);
  margin-top: var(--s5);
}
@media (max-width: 400px) { .contact-links-grid { grid-template-columns: 1fr; } }

.contact-link-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  padding: var(--s4) var(--s5);
  display: flex;
  flex-direction: column;
  gap: var(--s1);
  transition: border-color 0.15s, box-shadow 0.15s;
  text-decoration: none !important;
}
.contact-link-card:hover {
  border-color: var(--accent-bd);
  box-shadow: var(--sh-sm);
}
.contact-link-label {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--txt-3);
}
.contact-link-value {
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--txt);
  word-break: break-all;
}

/* ── 25. Reduced motion ───────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .js .reveal,
  .js .reveal-stagger > * {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}
