/* =========================================================
   Man Bahadur Lama — MEAL portfolio
   Design language: "the evidence ledger"
   Ruled two-column measure, mineral paper, marigold accent.
   ========================================================= */

/* ---------- Tokens ---------- */
:root {
  /* Light (default) */
  --paper:        #E8EDE8;
  --paper-2:      #F5F8F4;
  --paper-3:      #FFFFFF;
  --ink:          #10201E;
  --ink-soft:     #3C514E;
  --ink-faint:    #6C817E;
  --rule:         rgba(16, 32, 30, 0.14);
  --rule-strong:  rgba(16, 32, 30, 0.30);
  --marigold:     #C9871A;
  --marigold-hi:  #E2A32C;
  --teal:         #1B6660;
  --teal-hi:      #2A8880;
  --madder:       #96342F;
  --shadow:       0 1px 2px rgba(16,32,30,.05), 0 12px 32px -18px rgba(16,32,30,.30);

  /* Type */
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans:  "Archivo", "Helvetica Neue", Arial, sans-serif;

  /* Measure & rhythm */
  --wrap: 1180px;
  --gut: clamp(1.25rem, 4vw, 3rem);
  --rail: 200px;
  --sec-y: clamp(4.5rem, 9vw, 8rem);

  --r-sm: 4px;
  --r-md: 10px;
  --r-lg: 20px;
  --r-pill: 999px;

  --ease: cubic-bezier(.22, .61, .36, 1);
}

[data-theme="dark"] {
  --paper:        #0D1918;
  --paper-2:      #142624;
  --paper-3:      #1A302D;
  --ink:          #E4EBE5;
  --ink-soft:     #A8BCB8;
  --ink-faint:    #7B918D;
  --rule:         rgba(228, 235, 229, 0.16);
  --rule-strong:  rgba(228, 235, 229, 0.34);
  --marigold:     #E9B455;
  --marigold-hi:  #F3C978;
  --teal:         #58B3A9;
  --teal-hi:      #7CCcc3;
  --madder:       #E08A80;
  --shadow:       0 1px 2px rgba(0,0,0,.3), 0 16px 40px -20px rgba(0,0,0,.7);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.7;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }

a { color: var(--teal); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--teal-hi); }

:focus-visible {
  outline: 2px solid var(--marigold-hi);
  outline-offset: 3px;
  border-radius: 2px;
}

::selection { background: var(--marigold-hi); color: #10201E; }

/* ---------- Typography scale ---------- */
h1, h2, h3, h4 { margin: 0; font-weight: 400; }

.display {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(3rem, 8.5vw, 6.75rem);
  line-height: 0.94;
  letter-spacing: -0.025em;
}

.h2 {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(1.9rem, 3.6vw, 2.85rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.h3 {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 1.1875rem;
  line-height: 1.35;
  letter-spacing: -0.005em;
}

.meta {
  font-family: var(--sans);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.5;
  color: var(--ink-faint);
  letter-spacing: 0.005em;
}

.lede {
  font-size: clamp(1.125rem, 1.7vw, 1.375rem);
  line-height: 1.62;
  color: var(--ink-soft);
  max-width: 34em;
}

p { margin: 0 0 1.1em; max-width: 68ch; }
p:last-child { margin-bottom: 0; }

.num {
  font-family: var(--sans);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* ---------- Layout ---------- */
.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gut);
}

.section { padding-block: var(--sec-y); position: relative; }
section[id], main[id] { scroll-margin-top: 5.5rem; }
.section + .section { border-top: 1px solid var(--rule); }

/* Ruled two-column measure: the spine of the whole page */
.ruled {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  gap: clamp(1.25rem, 3vw, 3rem);
}
@media (max-width: 780px) {
  .ruled { grid-template-columns: 1fr; gap: 1rem; }
}

.rail-head {
  font-family: var(--sans);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink-faint);
  padding-top: 0.55rem;
  border-top: 2px solid var(--ink);
  align-self: start;
  position: sticky;
  top: 5.5rem;
}
@media (max-width: 780px) { .rail-head { position: static; } }

.skip-link {
  position: absolute;
  left: 1rem; top: -100px;
  z-index: 200;
  background: var(--ink);
  color: var(--paper);
  padding: .65rem 1.1rem;
  border-radius: var(--r-md);
  font-family: var(--sans);
  font-size: .875rem;
  transition: top .18s var(--ease);
}
.skip-link:focus { top: 1rem; color: var(--paper); }

/* ---------- Progress + nav ---------- */
.progress {
  position: fixed; inset: 0 auto auto 0;
  height: 2px; width: 0%;
  background: var(--marigold-hi);
  z-index: 120;
  transition: width .1s linear;
}

.site-nav {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: saturate(150%) blur(14px);
  -webkit-backdrop-filter: saturate(150%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .25s var(--ease), background .25s var(--ease);
}
.site-nav[data-stuck="true"] { border-bottom-color: var(--rule); }

/* Browsers without backdrop-filter get a solid bar rather than ghosted text. */
@supports not ((backdrop-filter: blur(2px)) or (-webkit-backdrop-filter: blur(2px))) {
  .site-nav { background: var(--paper); }
}

.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
  height: 4.25rem;
}

.brand {
  font-family: var(--serif);
  font-size: 1.3125rem;
  font-weight: 500;
  letter-spacing: -0.015em;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex; align-items: baseline; gap: .5rem;
}
.brand .brand-mark {
  width: 9px; height: 9px; border-radius: 2px;
  background: var(--marigold-hi);
  display: inline-block;
  transform: translateY(-1px);
}

.brand-short { display: none; }
@media (max-width: 600px) {
  .brand-full { display: none; }
  .brand-short { display: inline; }
}

.nav-links { display: flex; align-items: center; gap: .25rem; }
@media (max-width: 900px) { .nav-links { display: none; } }

.nav-link {
  font-family: var(--sans);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: none;
  padding: .45rem .7rem;
  border-radius: var(--r-pill);
  position: relative;
  transition: color .18s var(--ease), background .18s var(--ease);
}
.nav-link:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 6%, transparent); }
.nav-link[aria-current="true"] { color: var(--ink); }
.nav-link[aria-current="true"]::after {
  content: ""; position: absolute;
  left: .7rem; right: .7rem; bottom: .12rem;
  height: 2px; border-radius: 2px;
  background: var(--marigold-hi);
}

.nav-tools { display: flex; align-items: center; gap: .4rem; }

.icon-btn {
  width: 2.35rem; height: 2.35rem;
  display: grid; place-items: center;
  border-radius: var(--r-pill);
  color: var(--ink-soft);
  border: 1px solid transparent;
  transition: background .18s var(--ease), color .18s var(--ease), border-color .18s var(--ease);
}
.icon-btn:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }

.menu-btn { display: none; }
@media (max-width: 900px) { .menu-btn { display: grid; } }

.mobile-nav {
  display: none;
  flex-direction: column;
  padding: .5rem 0 1.25rem;
  border-top: 1px solid var(--rule);
}
.mobile-nav[data-open="true"] { display: flex; }
.mobile-nav a {
  font-family: var(--sans); font-size: 1rem; font-weight: 500;
  color: var(--ink); text-decoration: none;
  padding: .8rem .25rem;
  border-bottom: 1px solid var(--rule);
}
.mobile-nav a:last-child { border-bottom: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .55rem;
  font-family: var(--sans); font-size: .9375rem; font-weight: 500;
  padding: .8rem 1.35rem;
  border-radius: var(--r-pill);
  text-decoration: none;
  border: 1px solid transparent;
  transition: transform .18s var(--ease), background .18s var(--ease),
              color .18s var(--ease), border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.btn svg { width: 17px; height: 17px; flex: none; }
.btn:active { transform: translateY(1px); }

.btn-solid { background: var(--ink); color: var(--paper); }
.btn-solid:hover { background: var(--teal); color: #fff; box-shadow: var(--shadow); }
[data-theme="dark"] .btn-solid { background: var(--marigold); color: #10201E; }
[data-theme="dark"] .btn-solid:hover { background: var(--marigold-hi); color: #10201E; }

.btn-line { border-color: var(--rule-strong); color: var(--ink); }
.btn-line:hover { border-color: var(--ink); background: color-mix(in srgb, var(--ink) 5%, transparent); color: var(--ink); }

/* ---------- Hero ---------- */
.hero {
  padding-block: clamp(3rem, 8vw, 6.5rem) clamp(3rem, 6vw, 5rem);
  position: relative;
  overflow: hidden;
}

/* faint measurement grid — the instrument motif */
.hero::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, var(--rule) 1px, transparent 1px);
  background-size: 84px 100%;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.55), transparent 78%);
  -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,.55), transparent 78%);
  pointer-events: none;
  opacity: .8;
}

.hero-grid {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, .95fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: end;
}
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; align-items: start; gap: 2.25rem; }
}

.status {
  display: inline-flex; align-items: center; gap: .55rem;
  font-family: var(--sans); font-size: .8125rem; font-weight: 500;
  color: var(--ink-soft);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-pill);
  padding: .38rem .85rem .38rem .7rem;
  margin-bottom: clamp(1.25rem, 3vw, 2rem);
  background: color-mix(in srgb, var(--paper-3) 55%, transparent);
}
.status .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--teal-hi);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal-hi) 22%, transparent);
}

.hero h1 { margin-bottom: 1.4rem; }
.hero h1 .surname { display: block; color: var(--ink); }
.hero h1 .given { display: block; }

.hero-role {
  font-family: var(--sans);
  font-size: clamp(.9375rem, 1.4vw, 1.0625rem);
  font-weight: 600;
  letter-spacing: .002em;
  color: var(--ink);
  border-top: 2px solid var(--ink);
  padding-top: .8rem;
  max-width: 30rem;
  margin-bottom: 1.25rem;
}
.hero-role span { display: block; font-weight: 400; color: var(--ink-faint); }

.hero-lede { margin-bottom: 2rem; }

.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; }

.portrait-frame {
  position: relative;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--paper-2);
  box-shadow: var(--shadow);
  aspect-ratio: 1 / 1;
  max-width: 340px;
  justify-self: end;
  width: 100%;
}
@media (max-width: 900px) {
  .hero-side { order: -1; margin-bottom: .25rem; }
  .portrait-frame { justify-self: start; max-width: 136px; border-radius: var(--r-md); }
}
@media (max-width: 520px) {
  .hero-actions .btn { flex: 1 1 auto; justify-content: center; }
}
.portrait-frame img { width: 100%; height: 100%; object-fit: cover; }

.portrait-cap {
  font-family: var(--sans); font-size: .75rem; font-weight: 500;
  color: var(--ink-faint);
  margin-top: .7rem;
  text-align: right;
  max-width: 340px;
  justify-self: end;
  width: 100%;
}
@media (max-width: 900px) { .portrait-cap { display: none; } }

.hero-side { display: flex; flex-direction: column; }

/* ---------- Career axis (the signature element) ---------- */
.axis-section { padding-block: clamp(3rem, 6vw, 5rem) clamp(2.5rem, 4vw, 3.5rem); }
.axis-section + .section { padding-top: clamp(2.5rem, 4vw, 3.5rem); }

.axis-head {
  display: flex; flex-wrap: wrap; align-items: baseline;
  justify-content: space-between; gap: 1rem;
  margin-bottom: 1.75rem;
}

.axis-hint {
  font-family: var(--sans); font-size: .8125rem; color: var(--ink-faint);
}

.axis {
  position: relative;
  padding-bottom: 2.1rem;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 2rem;
}

.axis-track {
  display: flex;
  gap: 3px;
  height: 74px;
  align-items: stretch;
}
@media (max-width: 780px) { .axis-track { height: 60px; gap: 2px; } }

.axis-seg {
  position: relative;
  flex: 0 0 auto;
  border-radius: var(--r-sm);
  background: color-mix(in srgb, var(--teal) 22%, var(--paper-2));
  border: 1px solid transparent;
  overflow: hidden;
  transition: background .22s var(--ease), transform .22s var(--ease), border-color .22s var(--ease);
  transform-origin: bottom;
  display: flex; align-items: flex-end;
  padding: .4rem;
  min-width: 14px;
}
.axis-seg:hover { background: color-mix(in srgb, var(--teal) 40%, var(--paper-2)); }
[data-theme="dark"] .axis-seg { background: color-mix(in srgb, var(--teal) 30%, var(--paper-2)); }
[data-theme="dark"] .axis-seg:hover { background: color-mix(in srgb, var(--teal) 48%, var(--paper-2)); }
.axis-seg[aria-selected="true"] {
  background: var(--marigold-hi);
  border-color: var(--marigold);
}
.axis-seg[data-current="true"]::after {
  content: "";
  position: absolute; top: 6px; right: 6px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--madder);
}
.axis-seg .seg-label {
  font-family: var(--sans); font-size: .6875rem; font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  opacity: 0;
  transition: opacity .2s var(--ease);
}
.axis-seg[aria-selected="true"] .seg-label { opacity: 1; color: #10201E; }
@media (max-width: 900px) { .axis-seg .seg-label { display: none; } }

.axis-scale {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 1.6rem;
}
.axis-scale span {
  position: absolute;
  top: .35rem;
  font-family: var(--sans); font-variant-numeric: tabular-nums;
  font-size: .75rem; color: var(--ink-faint);
  transform: translateX(-50%);
  padding-top: .35rem;
  border-top: 1px solid var(--rule-strong);
}
.axis-scale span:first-child { transform: none; }
.axis-scale span:last-child { transform: translateX(-100%); }

.axis-detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: start;
}
@media (max-width: 860px) { .axis-detail { grid-template-columns: 1fr; gap: 1.5rem; } }

.axis-detail .org {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(1.5rem, 3vw, 2.15rem);
  line-height: 1.15; letter-spacing: -0.02em;
  margin-bottom: .3rem;
}
.axis-detail .role-title {
  font-family: var(--sans); font-weight: 600; font-size: 1rem;
  margin-bottom: .55rem;
}
.axis-detail .dates {
  font-family: var(--sans); font-variant-numeric: tabular-nums;
  font-size: .8125rem; color: var(--ink-faint);
  margin-bottom: 1.1rem;
}

.scale-facts { list-style: none; margin: 0; padding: 0; }
.scale-facts li {
  display: grid; grid-template-columns: 1fr auto; gap: 1rem;
  padding: .6rem 0;
  border-bottom: 1px solid var(--rule);
  font-family: var(--sans); font-size: .875rem;
}
.scale-facts li:first-child { border-top: 1px solid var(--rule); }
.scale-facts .k { color: var(--ink-faint); }
.scale-facts .v { font-variant-numeric: tabular-nums; font-weight: 600; }

/* ---------- Stat ledger ---------- */
.ledger {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 2px solid var(--ink);
}
@media (max-width: 780px) { .ledger { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.ledger div {
  padding: 1.25rem 1.1rem 1.35rem 0;
  border-bottom: 1px solid var(--rule);
}
.ledger div + div { padding-left: 1.1rem; border-left: 1px solid var(--rule); }
@media (max-width: 780px) {
  .ledger div:nth-child(odd) { padding-left: 0; border-left: 0; }
}

.ledger .figure {
  font-family: var(--sans);
  font-variant-numeric: tabular-nums;
  font-size: clamp(1.5rem, 2.9vw, 2.15rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1;
  display: block;
  white-space: nowrap;
  margin-bottom: .5rem;
}
.ledger .figure em { font-style: normal; color: var(--marigold); }
.ledger .cap { font-family: var(--sans); font-size: .8125rem; color: var(--ink-faint); line-height: 1.45; display: block; }

.footnote {
  font-family: var(--sans); font-size: .75rem; color: var(--ink-faint);
  margin-top: .9rem;
}

/* ---------- About ---------- */
.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}
@media (max-width: 900px) { .about-grid { grid-template-columns: 1fr; } }

.pull {
  border-left: 3px solid var(--marigold-hi);
  padding-left: 1.15rem;
  margin: 1.75rem 0;
  font-size: 1.1875rem;
  line-height: 1.55;
  font-style: italic;
  color: var(--ink);
  max-width: 32ch;
}

.card {
  background: var(--paper-3);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: clamp(1.25rem, 2.5vw, 1.75rem);
}
[data-theme="dark"] .card { background: var(--paper-2); }

.edu { list-style: none; margin: 0; padding: 0; }
.edu li { padding: .85rem 0; border-bottom: 1px solid var(--rule); }
.edu li:last-child { border-bottom: 0; padding-bottom: 0; }
.edu li:first-child { padding-top: 0; }
.edu .deg { font-family: var(--sans); font-weight: 600; font-size: .9375rem; display: block; }
.edu .inst { font-family: var(--sans); font-size: .8125rem; color: var(--ink-faint); display: block; margin-top: .15rem; }
.edu .yr {
  font-family: var(--sans); font-variant-numeric: tabular-nums;
  font-size: .75rem; font-weight: 600; color: var(--marigold);
}

.lang-row {
  display: flex; flex-wrap: wrap; gap: .4rem; margin-top: 1.1rem;
}

.chip {
  font-family: var(--sans); font-size: .8125rem; font-weight: 500;
  padding: .32rem .75rem;
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-pill);
  color: var(--ink-soft);
  background: transparent;
}

/* ---------- Experience ---------- */
.exp { list-style: none; margin: 0; padding: 0; }

.exp-item { border-top: 1px solid var(--rule); }
.exp-item:last-child { border-bottom: 1px solid var(--rule); }

.exp-btn {
  width: 100%;
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 1fr) 1.75rem;
  gap: clamp(1rem, 3vw, 2.5rem);
  align-items: baseline;
  text-align: left;
  padding: 1.5rem 0;
  transition: background .2s var(--ease);
}
@media (max-width: 780px) {
  .exp-btn { grid-template-columns: minmax(0, 1fr) 1.5rem; gap: .75rem; }
  .exp-btn .exp-when { grid-column: 1 / -1; }
}
.exp-btn:hover .exp-org { color: var(--teal); }

.exp-when {
  font-family: var(--sans); font-variant-numeric: tabular-nums;
  font-size: .8125rem; font-weight: 500; color: var(--ink-faint);
  padding-top: .3rem;
}

.exp-org {
  font-family: var(--serif);
  font-size: clamp(1.3rem, 2.4vw, 1.75rem);
  font-weight: 400; line-height: 1.2; letter-spacing: -0.02em;
  display: block;
  transition: color .2s var(--ease);
}
.exp-title {
  font-family: var(--sans); font-size: .9375rem; font-weight: 500;
  color: var(--ink-soft); display: block; margin-top: .3rem;
}

.exp-toggle {
  justify-self: end; align-self: center;
  width: 1.75rem; height: 1.75rem;
  border-radius: 50%;
  border: 1px solid var(--rule-strong);
  display: grid; place-items: center;
  color: var(--ink-soft);
  transition: transform .28s var(--ease), background .2s var(--ease), color .2s var(--ease);
}
.exp-toggle svg { width: 14px; height: 14px; }
.exp-btn[aria-expanded="true"] .exp-toggle {
  transform: rotate(45deg);
  background: var(--marigold-hi);
  border-color: var(--marigold-hi);
  color: #10201E;
}

.exp-panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .34s var(--ease);
}
.exp-panel[data-open="true"] { grid-template-rows: 1fr; }
.exp-panel > div { overflow: hidden; }
.exp-body {
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 1fr);
  gap: clamp(1rem, 3vw, 2.5rem);
  padding-bottom: 2rem;
}
@media (max-width: 780px) { .exp-body { grid-template-columns: 1fr; } }

.exp-scale {
  font-family: var(--sans); font-size: .8125rem; color: var(--ink-soft);
  border-left: 2px solid var(--marigold-hi);
  padding: .1rem 0 .1rem .8rem;
  margin-bottom: 1.1rem;
}

.tasks { margin: 0; padding: 0; list-style: none; }
.tasks li {
  position: relative;
  padding-left: 1.35rem;
  margin-bottom: .7rem;
  max-width: 66ch;
}
.tasks li::before {
  content: "";
  position: absolute; left: 0; top: .72em;
  width: 7px; height: 1px;
  background: var(--rule-strong);
}
.tasks li:last-child { margin-bottom: 0; }

.prog-tags { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: 1rem; }
.prog-tags .chip { font-size: .75rem; padding: .22rem .6rem; }

/* ---------- Capabilities ---------- */
.cap-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  overflow: hidden;
}

@media (max-width: 720px) { .cap-grid { grid-template-columns: 1fr; } }

.cap {
  background: var(--paper);
  padding: clamp(1.35rem, 2.6vw, 1.9rem);
}
.cap h3 { margin-bottom: .35rem; display: flex; align-items: center; gap: .6rem; }
.cap h3 svg { width: 18px; height: 18px; color: var(--teal); flex: none; }
.cap p { font-size: .9375rem; color: var(--ink-soft); margin-bottom: .9rem; }
.cap ul { margin: 0; padding: 0; list-style: none; }
.cap li {
  font-family: var(--sans); font-size: .8125rem; color: var(--ink-soft);
  padding: .38rem 0; border-top: 1px solid var(--rule);
}

.tools {
  display: flex; flex-wrap: wrap; gap: .5rem;
  margin-top: 1.75rem;
}
.tool {
  font-family: var(--sans); font-size: .875rem; font-weight: 500;
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-md);
  padding: .5rem .9rem;
  display: inline-flex; align-items: center; gap: .5rem;
  transition: border-color .2s var(--ease), color .2s var(--ease);
}
.tool:hover { border-color: var(--marigold); color: var(--marigold); }
.tool span { width: 6px; height: 6px; border-radius: 50%; background: var(--teal); }

/* ---------- Work / engagements ---------- */
.filters { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: 1.9rem; }
.filter {
  font-family: var(--sans); font-size: .875rem; font-weight: 500;
  padding: .45rem 1rem;
  border-radius: var(--r-pill);
  border: 1px solid var(--rule-strong);
  color: var(--ink-soft);
  transition: all .2s var(--ease);
}
.filter:hover { border-color: var(--ink); color: var(--ink); }
.filter[aria-pressed="true"] {
  background: var(--ink); color: var(--paper); border-color: var(--ink);
}
[data-theme="dark"] .filter[aria-pressed="true"] { background: var(--marigold); color: #10201E; border-color: var(--marigold); }

.work-list { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); }

.work-item {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr) auto;
  gap: clamp(.85rem, 2.5vw, 2rem);
  align-items: baseline;
  padding: 1.15rem 0;
  border-bottom: 1px solid var(--rule);
}
@media (max-width: 700px) {
  .work-item { grid-template-columns: 3.5rem minmax(0, 1fr); }
  .work-item .work-kind { grid-column: 2; justify-self: start; }
}

.work-year {
  font-family: var(--sans); font-variant-numeric: tabular-nums;
  font-size: .875rem; font-weight: 600; color: var(--marigold);
}
.work-name { font-size: 1.0625rem; line-height: 1.45; }
.work-name em { font-style: normal; display: block; font-family: var(--sans); font-size: .8125rem; color: var(--ink-faint); margin-top: .2rem; }
.work-kind {
  font-family: var(--sans); font-size: .75rem; font-weight: 500;
  color: var(--ink-soft);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-pill);
  padding: .2rem .65rem;
  white-space: nowrap;
}

.work-item[hidden] { display: none; }

/* ---------- Two-column ruled lists (training / affiliations) ---------- */
.duo {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: clamp(1.75rem, 4vw, 3.5rem);
}

.stack { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.stack li {
  padding: .8rem 0;
  border-bottom: 1px solid var(--rule);
  display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 1rem;
  align-items: baseline;
}
.stack .t { font-family: var(--sans); font-size: .9375rem; }
.stack .y {
  font-family: var(--sans); font-variant-numeric: tabular-nums;
  font-size: .8125rem; color: var(--ink-faint); white-space: nowrap;
}

.affil { display: grid; gap: 1rem; }
.affil .card { display: grid; gap: .5rem; }
.affil .role-badge {
  font-family: var(--sans); font-size: .75rem; font-weight: 600;
  color: #10201E; background: var(--marigold-hi);
  border-radius: var(--r-pill); padding: .2rem .7rem;
  justify-self: start;
}

/* ---------- Recommendations ---------- */
.rec-intro {
  font-family: var(--sans);
  font-size: .9375rem;
  color: var(--ink-faint);
  margin: 0 0 2rem;
}

/* Three columns divided by hairlines, in keeping with the ledger. */
.rec-wall {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: 1fr auto;
  gap: 0;
  border-top: 1px solid var(--rule-strong);
}

.rec {
  margin: 0;
  padding: 2rem clamp(1.25rem, 2.2vw, 2rem);
  border-right: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

/* Subgrid lines up every quote's attribution rule at the same height,
   even when a name wraps to two lines. */
@supports (grid-template-rows: subgrid) {
  .rec {
    grid-row: span 2;
    display: grid;
    grid-template-rows: subgrid;
  }
}
.rec:first-child { padding-left: 0; }
.rec:last-child  { padding-right: 0; border-right: 0; }

.rec blockquote { margin: 0; flex: 1; }
.rec blockquote p {
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.62;
  font-weight: 300;
  letter-spacing: -0.008em;
  margin: 0;
  text-wrap: pretty;
}
.rec blockquote p::before { content: "\201C"; color: var(--marigold); }
.rec blockquote p::after  { content: "\201D"; color: var(--marigold); }

.rec figcaption {
  display: flex; align-items: center; gap: .85rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
}

.avatar {
  width: 52px; height: 52px; border-radius: 50%;
  object-fit: cover; flex: none;
  border: 1px solid var(--rule);
}
.avatar-mono {
  width: 52px; height: 52px; border-radius: 50%;
  display: grid; place-items: center; flex: none;
  background: var(--teal); color: #fff;
  font-family: var(--sans); font-weight: 600; font-size: 1rem;
}
.rec .who  { font-family: var(--sans); font-weight: 600; font-size: .9375rem; display: block; }
.rec .what { font-family: var(--sans); font-size: .8125rem; color: var(--ink-faint); display: block; margin-top: .15rem; }

/* Two up, then stacked. Dividers move from vertical to horizontal. */
@media (max-width: 1000px) {
  .rec-wall { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rec:nth-child(2n) { padding-right: 0; border-right: 0; }
  .rec:nth-child(2n+1) { padding-left: 0; }
  .rec:nth-child(n+3) { border-top: 1px solid var(--rule); }
}
@media (max-width: 660px) {
  .rec-wall { grid-template-columns: 1fr; }
  .rec {
    padding: 1.75rem 0;
    border-right: 0;
    border-top: 1px solid var(--rule);
  }
  .rec:first-child { border-top: 0; padding-top: 1.5rem; }
}

/* ---------- Contact ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}
@media (max-width: 900px) { .contact-grid { grid-template-columns: 1fr; } }

.contact-list { list-style: none; margin: 1.5rem 0 0; padding: 0; border-top: 1px solid var(--rule); }
.contact-list li {
  display: flex; align-items: center; gap: .9rem;
  padding: .95rem 0;
  border-bottom: 1px solid var(--rule);
}
.contact-list svg { width: 18px; height: 18px; color: var(--teal); flex: none; }
.contact-list .lbl { font-family: var(--sans); font-size: .75rem; color: var(--ink-faint); display: block; }
.contact-list .val { font-family: var(--sans); font-size: .9375rem; word-break: break-word; }
.contact-list .val a { color: var(--ink); text-decoration: none; }
.contact-list .val a:hover { color: var(--teal); text-decoration: underline; }

.copy-btn {
  margin-left: auto;
  font-family: var(--sans); font-size: .75rem; font-weight: 500;
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-pill);
  padding: .3rem .7rem;
  color: var(--ink-soft);
  white-space: nowrap;
  transition: all .2s var(--ease);
}
.copy-btn:hover { border-color: var(--ink); color: var(--ink); }
.copy-btn[data-done="true"] { background: var(--teal); border-color: var(--teal); color: #fff; }

.form-grid { display: grid; gap: 1.15rem; }
.field { display: grid; gap: .4rem; }
.field label { font-family: var(--sans); font-size: .8125rem; font-weight: 500; color: var(--ink-soft); }
.field input, .field textarea, .field select {
  background: var(--paper-3);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-md);
  padding: .8rem .9rem;
  font-family: var(--sans); font-size: .9375rem;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
  width: 100%;
}
[data-theme="dark"] .field input,
[data-theme="dark"] .field textarea,
[data-theme="dark"] .field select { background: var(--paper-2); }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 18%, transparent);
}
.field textarea { resize: vertical; min-height: 130px; }
.field .err { font-family: var(--sans); font-size: .75rem; color: var(--madder); min-height: 1em; }
.field[data-invalid="true"] input,
.field[data-invalid="true"] textarea { border-color: var(--madder); }

.hp { position: absolute; left: -9999px; opacity: 0; height: 0; }

.form-note { font-family: var(--sans); font-size: .75rem; color: var(--ink-faint); }

.form-status {
  font-family: var(--sans); font-size: .875rem;
  border-radius: var(--r-md);
  padding: .85rem 1rem;
  display: none;
  gap: .6rem; align-items: center;
}
.form-status[data-show="ok"] { display: flex; background: color-mix(in srgb, var(--teal) 15%, transparent); color: var(--teal); }
.form-status[data-show="err"] { display: flex; background: color-mix(in srgb, var(--madder) 14%, transparent); color: var(--madder); }
.form-status svg { width: 17px; height: 17px; flex: none; }

.spinner {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--rule);
  padding-block: 3rem 2.5rem;
}
.footer-inner {
  display: flex; flex-wrap: wrap; gap: 1rem;
  justify-content: space-between; align-items: center;
}
.footer p { font-family: var(--sans); font-size: .8125rem; color: var(--ink-faint); margin: 0; }
.footer-links { display: flex; gap: 1.1rem; }
.footer-links a { font-family: var(--sans); font-size: .8125rem; color: var(--ink-soft); text-decoration: none; }
.footer-links a:hover { color: var(--ink); text-decoration: underline; }

.to-top {
  position: fixed; right: 1.25rem; bottom: 1.25rem;
  width: 2.75rem; height: 2.75rem;
  border-radius: 50%;
  background: var(--ink); color: var(--paper);
  display: grid; place-items: center;
  box-shadow: var(--shadow);
  opacity: 0; visibility: hidden;
  transform: translateY(8px);
  transition: opacity .25s var(--ease), transform .25s var(--ease), visibility .25s;
  z-index: 90;
}
.to-top[data-show="true"] { opacity: 1; visibility: visible; transform: none; }
.to-top svg { width: 18px; height: 18px; }
[data-theme="dark"] .to-top { background: var(--marigold); color: #10201E; }

/* ---------- One orchestrated entrance ---------- */
@media (prefers-reduced-motion: no-preference) {
  .enter { opacity: 0; transform: translateY(14px); }
  body[data-ready="true"] .enter {
    opacity: 1; transform: none;
    transition: opacity .7s var(--ease), transform .7s var(--ease);
  }
  body[data-ready="true"] .enter:nth-child(1) { transition-delay: .05s; }
  body[data-ready="true"] .enter:nth-child(2) { transition-delay: .13s; }
  body[data-ready="true"] .enter:nth-child(3) { transition-delay: .21s; }
  body[data-ready="true"] .enter:nth-child(4) { transition-delay: .29s; }
  body[data-ready="true"] .enter:nth-child(5) { transition-delay: .37s; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}

/* ---------- 404 ---------- */
.oops { min-height: 70vh; display: grid; align-content: center; }

/* ---------- Print ---------- */
@media print {
  /* Screen-only furniture: navigation, controls, forms, decoration. */
  .site-nav, .to-top, .progress, .hero::before,
  .rec-picker, .filters, .contact-form-wrap, .axis,
  .hero-actions, .axis-hint, .status-pill,
  .theme-btn, .copy-btn, .skip-link, .exp-toggle { display: none !important; }

  body { background: #fff; color: #000; font-size: 10.5pt; line-height: 1.45; }
  .section { padding-block: 1rem; border-top: 1px solid #ccc; }

  /* Every experience entry prints open. */
  .exp-panel { grid-template-rows: 1fr !important; }
  .exp-panel > div { overflow: visible !important; }

  /* Don't split an entry across a page break. */
  .exp-item, .work-item, .card, .rec, figure { break-inside: avoid; }
  h1, h2, h3, .exp-org, .rail-head { break-after: avoid; }

  /* Ink economy: no filled blocks or heavy tints. */
  .card, .ledger > div { background: #fff !important; box-shadow: none !important; }
  .figure em { color: #000 !important; }

  /* Spell out destinations that a printed page can't click. */
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 8.5pt; color: #555; word-break: break-all; }
  a[href^="mailto"]::after { content: ""; }

  @page { margin: 14mm; }
}
