/* ============================================================
   Yousef Khajavigodellou — Academic Site
   Design system: "Data Atlas"
   Palette is derived from the Water–Energy–Food triad.
   ============================================================ */

/* ---------- 0. Fonts (self-hosted — no third-party requests) ---------- */
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2-variations");
}
@font-face {
  font-family: "Newsreader"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url("../fonts/newsreader-latin-wght-normal.woff2") format("woff2-variations");
}
@font-face {
  font-family: "Newsreader"; font-style: italic; font-weight: 200 800; font-display: swap;
  src: url("../fonts/newsreader-latin-wght-italic.woff2") format("woff2-variations");
}
@font-face {
  font-family: "JetBrains Mono"; font-style: normal; font-weight: 100 800; font-display: swap;
  src: url("../fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2-variations");
}

/* ---------- 1. Tokens ---------- */
:root {
  /* surfaces */
  --bg:          #050810;
  --bg-alt:      #080D18;
  --surface:     #0C1322;
  --surface-2:   #111A2C;
  --surface-3:   #16223A;

  --scheme: dark;

  /* lines */
  --line:        rgba(140, 175, 220, 0.17);
  --line-2:      rgba(140, 175, 220, 0.30);
  --line-3:      rgba(140, 175, 220, 0.46);

  /* text — tuned for contrast: body copy reads at AAA on the page background */
  --fg:          #F3F7FC;
  --fg-2:        #C9D4E4;
  --fg-3:        #97AAC4;
  --fg-4:        #6C819D;

  /* WEF triad + diplomacy */
  --water:       #3BD5F0;
  --water-dim:   rgba(59, 213, 240, 0.14);
  --energy:      #F7B24A;
  --energy-dim:  rgba(247, 178, 74, 0.14);
  --food:        #57E08E;
  --food-dim:    rgba(87, 224, 142, 0.14);
  --diplomacy:   #A98CFF;
  --dip-dim:     rgba(169, 140, 255, 0.14);
  --alert:       #FF6B85;
  --alert-dim:   rgba(255, 107, 133, 0.14);

  --accent:      var(--water);

  /* type */
  --font-display: "Newsreader", "Iowan Old Style", Georgia, serif;
  --font-ui:      "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono:    "JetBrains Mono", "SF Mono", ui-monospace, Menlo, monospace;

  /* metrics */
  --nav-h: 60px;
  --maxw: 1240px;
  --maxw-text: 74ch;
  --r-sm: 4px;
  --r:    8px;
  --r-lg: 14px;

  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 30px rgba(0,0,0,.35);
  --ease: cubic-bezier(.22,.61,.36,1);
}

/* ---------- Theme: Paper (light) ---------- */
:root[data-theme="light"] {
  --scheme: light;
  --bg:        #FBFCFE;
  --bg-alt:    #F2F5F9;
  --surface:   #FFFFFF;
  --surface-2: #F3F6FA;
  --surface-3: #E6EDF5;
  --line:      rgba(20, 45, 80, 0.17);
  --line-2:    rgba(20, 45, 80, 0.27);
  --line-3:    rgba(20, 45, 80, 0.42);
  --fg:        #091220;
  --fg-2:      #1E2D43;
  --fg-3:      #42556D;
  --fg-4:      #6B7D95;
  --water:     #076C8B;
  --water-dim: rgba(7, 108, 139, 0.10);
  --energy:    #9A5F0C;
  --energy-dim:rgba(154, 95, 12, 0.10);
  --food:      #116B3C;
  --food-dim:  rgba(17, 107, 60, 0.10);
  --diplomacy: #5735C4;
  --dip-dim:   rgba(87, 53, 196, 0.10);
  --alert:     #B0243C;
  --alert-dim: rgba(176, 36, 60, 0.10);
  --shadow: 0 1px 2px rgba(15,35,65,.07), 0 8px 24px rgba(15,35,65,.09);
}

/* ---------- Theme: Salt flat (warm light — the dried lakebed) ---------- */
:root[data-theme="salt"] {
  --scheme: light;
  --bg:        #F6F1E7;
  --bg-alt:    #EEE7DA;
  --surface:   #FBF8F2;
  --surface-2: #F1EADD;
  --surface-3: #E6DCC9;
  --line:      rgba(70, 50, 25, 0.17);
  --line-2:    rgba(70, 50, 25, 0.28);
  --line-3:    rgba(70, 50, 25, 0.44);
  --fg:        #1A1410;
  --fg-2:      #382D24;
  --fg-3:      #625546;
  --fg-4:      #877A69;
  --water:     #0E6674;
  --water-dim: rgba(14, 102, 116, 0.11);
  --energy:    #A24F14;
  --energy-dim:rgba(162, 79, 20, 0.11);
  --food:      #486E1C;
  --food-dim:  rgba(72, 110, 28, 0.11);
  --diplomacy: #6A3C8C;
  --dip-dim:   rgba(106, 60, 140, 0.11);
  --alert:     #AD3535;
  --alert-dim: rgba(173, 53, 53, 0.11);
  --shadow: 0 1px 2px rgba(60,40,20,.08), 0 8px 24px rgba(60,40,20,.10);
}

/* ---------- Theme: Zagros night (warm dark — the oak forests after sunset) ---------- */
:root[data-theme="zagros"] {
  --scheme: dark;
  --bg:        #0D0B09;
  --bg-alt:    #120F0C;
  --surface:   #181410;
  --surface-2: #201B16;
  --surface-3: #2A231D;
  --line:      rgba(215, 190, 150, 0.15);
  --line-2:    rgba(215, 190, 150, 0.27);
  --line-3:    rgba(215, 190, 150, 0.42);
  --fg:        #F2EBE0;
  --fg-2:      #D0C5B4;
  --fg-3:      #A19483;
  --fg-4:      #74695D;
  --water:     #5FCBD8;
  --water-dim: rgba(95, 203, 216, 0.14);
  --energy:    #F0A64A;
  --energy-dim:rgba(240, 166, 74, 0.14);
  --food:      #93D27C;
  --food-dim:  rgba(147, 210, 124, 0.14);
  --diplomacy: #C9A8FF;
  --dip-dim:   rgba(201, 168, 255, 0.14);
  --alert:     #FF7A7A;
  --alert-dim: rgba(255, 122, 122, 0.14);
  --shadow: 0 1px 2px rgba(0,0,0,.5), 0 8px 30px rgba(0,0,0,.45);
}

/* ---------- 2. Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 24px); }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "kern" 1, "liga" 1;
  overflow-x: hidden;
}

img, svg, canvas { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--water); outline-offset: 3px; border-radius: 2px; }

/* ---------- 3. Typography ---------- */
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 400; line-height: 1.16; letter-spacing: -0.015em; }
h1 { font-size: clamp(2.4rem, 5.6vw, 4.2rem); }
h2 { font-size: clamp(1.75rem, 3.4vw, 2.7rem); }
h3 { font-size: clamp(1.2rem, 2vw, 1.5rem); }
h4 { font-size: 1.05rem; font-family: var(--font-ui); font-weight: 600; letter-spacing: 0; }

p { color: var(--fg-2); }
strong { color: var(--fg); font-weight: 600; }
em { font-style: italic; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: .688rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--fg-3);
  display: flex; align-items: center; gap: .7em;
}
.eyebrow::before {
  content: ""; width: 22px; height: 1px; background: var(--line-3); flex: none;
}
.eyebrow--plain::before { display: none; }

.lede { font-size: clamp(1.06rem, 1.7vw, 1.3rem); line-height: 1.6; color: var(--fg-2); max-width: 62ch; }
.prose { max-width: var(--maxw-text); }
.prose p + p { margin-top: 1.1em; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.dim { color: var(--fg-3); }

::selection { background: var(--water); color: var(--bg); }

/* ---------- 4. Layout ---------- */
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(18px, 4vw, 40px); }
.wrap--narrow { max-width: 900px; }
.section { padding-block: clamp(64px, 9vw, 120px); }
.section--tight { padding-block: clamp(40px, 5vw, 64px); }
.section + .section { border-top: 1px solid var(--line); }
.section-head { display: flex; flex-direction: column; gap: 14px; margin-bottom: clamp(32px, 4vw, 52px); }
.section-head .lede { margin-top: 2px; }

.grid { display: grid; gap: clamp(16px, 2vw, 24px); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.stack { display: flex; flex-direction: column; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

/* ---------- 5. Navigation ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 90; height: var(--nav-h);
  display: flex; align-items: center;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border-bottom: 1px solid transparent;
  transition: border-color .3s var(--ease), background .3s var(--ease);
}
.nav.is-stuck { border-bottom-color: var(--line); }
.nav__inner { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(18px, 4vw, 40px); display: flex; align-items: center; gap: 20px; }

.brand { display: flex; align-items: center; gap: 10px; flex: none; }
.brand__mark { width: 26px; height: 26px; flex: none; }
.brand__name { font-family: var(--font-display); font-size: 1.02rem; letter-spacing: -.01em; white-space: nowrap; }
.brand__name b { font-weight: 600; }

.nav__links { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.nav__links a {
  font-size: .82rem; color: var(--fg-3); padding: 7px 11px; border-radius: var(--r-sm);
  transition: color .18s var(--ease), background .18s var(--ease); white-space: nowrap;
}
.nav__links a:hover { color: var(--fg); background: var(--surface-2); }
.nav__links a[aria-current="page"] { color: var(--fg); }
.nav__links a[aria-current="page"]::after {
  content: ""; display: block; height: 1px; margin-top: 4px; background: var(--water);
}

.nav__tools { display: flex; align-items: center; gap: 6px; flex: none; }
.icon-btn {
  width: 34px; height: 34px; display: grid; place-items: center;
  background: transparent; border: 1px solid var(--line); border-radius: var(--r-sm);
  color: var(--fg-3); cursor: pointer; transition: all .18s var(--ease);
}
.icon-btn:hover { color: var(--fg); border-color: var(--line-3); background: var(--surface-2); }
.nav__burger { display: none; }

.nav__drawer {
  position: fixed; inset: var(--nav-h) 0 0 0; z-index: 89;
  background: var(--bg); padding: 24px clamp(18px,4vw,40px) 40px;
  display: none; flex-direction: column; gap: 2px; overflow-y: auto;
}
.nav__drawer.is-open { display: flex; }
.nav__drawer a { padding: 13px 4px; font-size: 1.05rem; border-bottom: 1px solid var(--line); color: var(--fg-2); }
.nav__drawer a:hover { color: var(--fg); }

@media (max-width: 1240px) {
  .nav__links { display: none; }
  .nav__burger { display: grid; }
}

/* ---------- 6. Buttons & chips ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 17px; border-radius: var(--r);
  font-size: .86rem; font-weight: 500; letter-spacing: .01em;
  border: 1px solid var(--line-2); background: var(--surface-2); color: var(--fg);
  cursor: pointer; transition: all .2s var(--ease);
}
.btn:hover { border-color: var(--line-3); background: var(--surface-3); transform: translateY(-1px); }
.btn--primary { background: var(--water); border-color: var(--water); color: #04121A; font-weight: 600; }
.btn--primary:hover { background: color-mix(in srgb, var(--water) 88%, white); border-color: transparent; }
.btn--ghost { background: transparent; }
.btn--sm { padding: 6px 12px; font-size: .78rem; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 100px;
  font-family: var(--font-mono); font-size: .66rem; letter-spacing: .07em; text-transform: uppercase;
  border: 1px solid var(--line-2); color: var(--fg-3); background: var(--surface-2); white-space: nowrap;
}
.chip--water      { color: var(--water); border-color: color-mix(in srgb, var(--water) 36%, transparent); background: var(--water-dim); }
.chip--energy     { color: var(--energy); border-color: color-mix(in srgb, var(--energy) 36%, transparent); background: var(--energy-dim); }
.chip--food       { color: var(--food); border-color: color-mix(in srgb, var(--food) 36%, transparent); background: var(--food-dim); }
.chip--diplomacy  { color: var(--diplomacy); border-color: color-mix(in srgb, var(--diplomacy) 36%, transparent); background: var(--dip-dim); }
.chip--alert      { color: var(--alert); border-color: color-mix(in srgb, var(--alert) 36%, transparent); background: var(--alert-dim); }
.chip__dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex: none; }

/* ---------- 7. Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: clamp(20px, 2.4vw, 28px); position: relative; overflow: hidden;
  transition: border-color .24s var(--ease), transform .24s var(--ease), background .24s var(--ease);
}
.card--link:hover { border-color: var(--line-3); transform: translateY(-2px); background: var(--surface-2); }
.card__rule { position: absolute; inset: 0 0 auto 0; height: 2px; background: var(--accent); opacity: .8; }
.card h3 { margin-bottom: 8px; }
.card p { font-size: .93rem; }
.card__meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }

/* stat tiles */
.stat { border: 1px solid var(--line); border-radius: var(--r); padding: 18px 18px 16px; background: var(--surface); }
.stat__val { font-family: var(--font-display); font-size: clamp(1.9rem, 3.4vw, 2.6rem); line-height: 1; color: var(--fg); }
.stat__val sup { font-size: .42em; vertical-align: super; color: var(--fg-3); font-family: var(--font-mono); }
.stat__label { font-family: var(--font-mono); font-size: .66rem; letter-spacing: .13em; text-transform: uppercase; color: var(--fg-3); margin-top: 9px; }
.stat__note { font-size: .78rem; color: var(--fg-4); margin-top: 5px; line-height: 1.4; }

/* ---------- 8. Hero / atlas canvas ---------- */
.hero { position: relative; min-height: 100svh; display: flex; align-items: center; isolation: isolate; }
.hero__canvas { position: absolute; inset: 0; z-index: -2; }
.hero__canvas canvas { width: 100%; height: 100%; }
.hero__veil {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(88% 88% at 4% 50%, var(--bg) 0%,
      color-mix(in srgb, var(--bg) 66%, transparent) 40%, transparent 76%),
    linear-gradient(to bottom, var(--bg) 0%,
      color-mix(in srgb, var(--bg) 52%, transparent) 15%,
      transparent 36%, transparent 60%,
      color-mix(in srgb, var(--bg) 40%, transparent) 79%,
      color-mix(in srgb, var(--bg) 86%, transparent) 93%,
      var(--bg) 100%);
}
.hero__inner { padding-top: calc(var(--nav-h) + 40px); padding-bottom: 60px; width: 100%; }
.hero__name { margin: 16px 0 0; }
.hero__name span { display: block; color: var(--fg-3); font-size: .46em; letter-spacing: .01em; }
.hero__role {
  margin-top: 22px; font-family: var(--font-mono); font-size: .8rem; letter-spacing: .04em;
  color: var(--fg-2); line-height: 1.9;
}
.hero__role b { color: var(--fg); font-weight: 500; }
.hero__cta { margin-top: 34px; display: flex; flex-wrap: wrap; gap: 10px; }
.hero__scroll {
  position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%);
  font-family: var(--font-mono); font-size: .64rem; letter-spacing: .2em; text-transform: uppercase; color: var(--fg-4);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.hero__scroll::after { content: ""; width: 1px; height: 26px; background: linear-gradient(var(--line-3), transparent); }

/* ---------- 9. Atlas ---------- */
.atlas { position: relative; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; background: var(--bg-alt); }
.atlas__stage { position: relative; width: 100%; aspect-ratio: 16 / 9; min-height: 420px; }
.atlas__stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; }
.atlas__hint {
  position: absolute; left: 14px; bottom: 12px; font-family: var(--font-mono);
  font-size: .64rem; letter-spacing: .1em; text-transform: uppercase; color: var(--fg-4); pointer-events: none;
}
.atlas__legend {
  position: absolute; left: 14px; top: 14px; display: flex; flex-direction: column; gap: 7px;
  background: color-mix(in srgb, var(--bg) 72%, transparent); backdrop-filter: blur(8px);
  border: 1px solid var(--line); border-radius: var(--r); padding: 11px 13px; pointer-events: none;
}
.atlas__legend b { font-family: var(--font-mono); font-size: .62rem; letter-spacing: .14em; text-transform: uppercase; color: var(--fg-3); font-weight: 400; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: .74rem; color: var(--fg-2); }
.legend-item i { width: 8px; height: 8px; border-radius: 50%; flex: none; }

.atlas__zoom { position: absolute; right: 14px; bottom: 12px; display: flex; gap: 6px; }

.atlas__tip {
  position: absolute; pointer-events: none; z-index: 5; opacity: 0; transform: translate(-50%, -140%);
  background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--r);
  padding: 7px 11px; font-size: .78rem; white-space: nowrap; box-shadow: var(--shadow);
  transition: opacity .12s linear;
}
.atlas__tip.is-on { opacity: 1; }
.atlas__tip b { display: block; font-weight: 600; }
.atlas__tip span { font-family: var(--font-mono); font-size: .68rem; color: var(--fg-3); }

/* inspector panel */
.inspector {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(390px, 88%); z-index: 6;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  backdrop-filter: blur(18px) saturate(150%);
  border-left: 1px solid var(--line-2); padding: 22px 22px 26px; overflow-y: auto;
  transform: translateX(101%); transition: transform .34s var(--ease);
}
.inspector.is-open { transform: none; }
.inspector__close { position: absolute; top: 14px; right: 14px; }
.inspector h3 { padding-right: 40px; margin-bottom: 4px; }
.inspector__sub { font-family: var(--font-mono); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--fg-3); }
.inspector__block { margin-top: 22px; }
.inspector__block > b {
  display: block; font-family: var(--font-mono); font-size: .62rem; letter-spacing: .15em;
  text-transform: uppercase; color: var(--fg-4); margin-bottom: 9px; font-weight: 400;
}
.riparians { display: flex; flex-wrap: wrap; gap: 5px; }

.kv { display: grid; grid-template-columns: 1fr auto; gap: 7px 12px; font-size: .84rem; }
.kv dt { color: var(--fg-3); }
.kv dd { font-family: var(--font-mono); color: var(--fg); font-variant-numeric: tabular-nums; }

.pending {
  font-size: .78rem; color: var(--fg-4); font-style: italic;
  border-left: 2px solid var(--line-2); padding-left: 10px; line-height: 1.55;
}

/* filter bar */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 20px; }
.filters input[type="search"], .filters select {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 8px 12px; font-size: .85rem; color: var(--fg); min-width: 0;
}
.filters input[type="search"] { flex: 1 1 220px; }
.filters input::placeholder { color: var(--fg-4); }
.toggle {
  padding: 6px 12px; border-radius: 100px; border: 1px solid var(--line);
  background: transparent; color: var(--fg-3); font-size: .78rem; cursor: pointer;
  transition: all .18s var(--ease);
}
.toggle:hover { color: var(--fg); border-color: var(--line-2); }
.toggle[aria-pressed="true"] { color: var(--bg); background: var(--fg); border-color: var(--fg); font-weight: 500; }

/* ---------- 10. Publication list ---------- */
.pub {
  display: grid; grid-template-columns: 62px 1fr; gap: 0 20px;
  padding: 22px 0; border-bottom: 1px solid var(--line);
}
.pub__year { font-family: var(--font-mono); font-size: .8rem; color: var(--fg-4); padding-top: 3px; font-variant-numeric: tabular-nums; }
.pub__title { font-family: var(--font-display); font-size: 1.16rem; line-height: 1.34; color: var(--fg); }
.pub__authors { font-size: .86rem; color: var(--fg-2); margin-top: 7px; }
.pub__authors .me { color: var(--fg); font-weight: 600; }
.pub__venue { font-size: .86rem; color: var(--fg-3); margin-top: 3px; }
.pub__venue i { font-style: italic; color: var(--fg-2); }
.pub__links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; align-items: center; }
.tlink {
  font-family: var(--font-mono); font-size: .68rem; letter-spacing: .06em; text-transform: uppercase;
  color: var(--fg-3); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 4px 8px;
  transition: all .18s var(--ease); cursor: pointer; background: transparent;
}
.tlink:hover { color: var(--water); border-color: color-mix(in srgb, var(--water) 46%, transparent); background: var(--water-dim); }

/* ---------- 11. Timeline (CV) ---------- */
.tl { position: relative; padding-left: 26px; }
.tl::before { content: ""; position: absolute; left: 4px; top: 6px; bottom: 6px; width: 1px; background: var(--line-2); }
.tl__item { position: relative; padding-bottom: 26px; }
.tl__item::before {
  content: ""; position: absolute; left: -26px; top: 7px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--bg); border: 1.5px solid var(--line-3);
}
.tl__item--now::before { background: var(--water); border-color: var(--water); box-shadow: 0 0 0 4px var(--water-dim); }
.tl__when { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .08em; color: var(--fg-4); }
.tl__what { font-size: 1rem; font-weight: 600; color: var(--fg); margin-top: 3px; }
.tl__where { font-size: .88rem; color: var(--fg-2); margin-top: 2px; }
.tl__note { font-size: .82rem; color: var(--fg-3); margin-top: 5px; }

/* two-column CV rows */
.cvrow { display: grid; grid-template-columns: 110px 1fr; gap: 6px 22px; padding: 13px 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.cvrow:last-child { border-bottom: 0; }
.cvrow__when { font-family: var(--font-mono); font-size: .74rem; color: var(--fg-4); letter-spacing: .04em; }
.cvrow__what { color: var(--fg-2); font-size: .94rem; }
.cvrow__what b { color: var(--fg); font-weight: 600; }

/* ---------- 12. Misc ---------- */
.marquee-rule { height: 1px; background: linear-gradient(90deg, transparent, var(--line-3) 20%, var(--line-3) 80%, transparent); }

.note {
  border: 1px dashed var(--line-2); border-radius: var(--r); padding: 14px 16px;
  font-size: .85rem; color: var(--fg-3); background: var(--surface);
}
.note b { color: var(--fg-2); }

.footer { border-top: 1px solid var(--line); background: var(--bg-alt); padding-block: 52px 36px; }
.footer__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 32px; }
.footer h5 { font-family: var(--font-mono); font-size: .64rem; letter-spacing: .16em; text-transform: uppercase; color: var(--fg-4); font-weight: 400; margin-bottom: 12px; }
.footer a { display: block; font-size: .87rem; color: var(--fg-3); padding: 3px 0; transition: color .18s var(--ease); }
.footer a:hover { color: var(--water); }
.footer__base { margin-top: 40px; padding-top: 22px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; font-size: .78rem; color: var(--fg-4); }

/* scroll reveal */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }

/* skip link */
.skip { position: absolute; left: -9999px; top: 0; z-index: 200; padding: 10px 16px; background: var(--water); color: #04121A; border-radius: 0 0 var(--r) 0; font-weight: 600; }
.skip:focus { left: 0; }

/* search overlay */
.omni { position: fixed; inset: 0; z-index: 120; display: none; padding-top: 12vh; background: rgba(2,5,12,.72); backdrop-filter: blur(6px); }
.omni.is-open { display: block; }
.omni__box { width: min(640px, 92vw); margin-inline: auto; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; }
.omni__box input { width: 100%; border: 0; background: transparent; padding: 17px 20px; font-size: 1rem; border-bottom: 1px solid var(--line); }
.omni__box input:focus { outline: none; }
.omni__results { max-height: 52vh; overflow-y: auto; }
.omni__results a { display: block; padding: 11px 20px; border-bottom: 1px solid var(--line); }
.omni__results a:hover, .omni__results a.is-sel { background: var(--surface-2); }
.omni__results b { display: block; font-size: .92rem; color: var(--fg); font-weight: 500; }
.omni__results span { font-size: .76rem; color: var(--fg-4); font-family: var(--font-mono); }
.omni__empty { padding: 26px 20px; color: var(--fg-4); font-size: .88rem; text-align: center; }

/* ---------- 13. Responsive ---------- */
@media (max-width: 720px) {
  .pub { grid-template-columns: 1fr; gap: 6px; }
  .pub__year { padding-top: 0; }
  .cvrow { grid-template-columns: 1fr; }
  .atlas__stage { aspect-ratio: 5 / 3; min-height: 250px; }
  .inspector { width: 100%; }
  .atlas__legend { display: none; }
}

@media (max-width: 560px) {
  /* the nav must never overflow: Contact lives in the drawer at this width */
  .nav__tools .btn { display: none; }
  .brand__name { font-size: .92rem; }
  .nav__inner { gap: 10px; }
  .atlas__hint { display: none; }
  .atlas__zoom { right: 10px; bottom: 10px; }
  .hero__name { font-size: clamp(2.1rem, 11vw, 3rem); }
}

/* ---------- 14. Print (CV) ---------- */
@media print {
  .nav, .footer, .hero__canvas, .atlas, .no-print, .hero__scroll { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  * { color: #000 !important; border-color: #ccc !important; }
  a { text-decoration: none; }
  .section { padding-block: 12pt; page-break-inside: avoid; }
}

/* ============================================================
   15. Photography layer — the "personal academic site" half
   ============================================================ */

/* ---- hero: portrait beside the name, atlas behind both ---- */
.hero__grid {
  display: grid; grid-template-columns: minmax(0,1fr) 330px;
  gap: clamp(28px, 5vw, 70px); align-items: center; width: 100%;
}
.hero__photo { position: relative; }
.hero__photo img {
  width: 100%; aspect-ratio: 4/5; object-fit: cover;
  border-radius: var(--r-lg); border: 1px solid var(--line-2);
  box-shadow: 0 24px 60px rgba(0,0,0,.45), 0 2px 8px rgba(0,0,0,.3);
}
:root[data-theme="light"] .hero__photo img,
:root[data-theme="salt"] .hero__photo img { box-shadow: 0 20px 48px rgba(15,35,65,.16); }
.hero__photo::before {
  content: ""; position: absolute; inset: -1px -1px auto -1px; height: 3px;
  background: linear-gradient(90deg, var(--water), var(--diplomacy));
  border-radius: var(--r-lg) var(--r-lg) 0 0; z-index: 1;
}
.hero__caption {
  margin-top: 12px; font-family: var(--font-mono); font-size: .66rem;
  letter-spacing: .1em; text-transform: uppercase; color: var(--fg-4); text-align: center;
}
.hero__photo--round { display: none; }

@media (max-width: 900px) {
  .hero__grid { grid-template-columns: 1fr; gap: 0; }
  .hero__photo { order: -1; margin-bottom: 22px; }
  .hero__photo img { width: 112px; height: 112px; aspect-ratio: 1; border-radius: 50%; }
  .hero__photo::before { display: none; }   /* the accent bar belongs to the framed card only */
  .hero__caption { display: none; }
}

/* ---- image + text band ---- */
.band { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: clamp(24px, 4vw, 56px); align-items: center; }
.band--flip > *:first-child { order: 2; }
.band__img { position: relative; border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--line); }
.band__img img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
.band__img figcaption {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 26px 18px 12px;
  background: linear-gradient(transparent, rgba(3,6,12,.82));
  font-size: .76rem; color: rgba(233,239,248,.88);
}

/* ---- captioned figure ---- */
.figure { margin: 0; }
.figure img { width: 100%; border-radius: var(--r-lg); border: 1px solid var(--line); display: block; }
.figure figcaption { margin-top: 10px; font-size: .8rem; color: var(--fg-3); line-height: 1.5; }

/* ---- gallery grid ---- */
.gal {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  grid-auto-rows: 190px; gap: clamp(10px, 1.4vw, 16px);
}
.gal__item {
  position: relative; margin: 0; padding: 0; border: 0; background: none;
  border-radius: var(--r); overflow: hidden; cursor: zoom-in; display: block;
  height: 100%;
}
/* the lead photograph gets four tiles' worth of space; one more wide tile
   partway down keeps the grid from reading as a contact sheet */
.gal__item:first-child { grid-column: span 2; grid-row: span 2; }
.gal__item:nth-child(7) { grid-column: span 2; }
@media (max-width: 700px) {
  .gal { grid-auto-rows: auto; }
  .gal__item { aspect-ratio: 3/2; height: auto; }
  .gal__item:first-child, .gal__item:nth-child(7) { grid-column: span 1; grid-row: span 1; }
}
.gal__item img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .5s var(--ease), filter .35s var(--ease);
  filter: saturate(.94);
}
.gal__item:hover img { transform: scale(1.035); filter: saturate(1.06); }
.gal__cap {
  position: absolute; inset: auto 0 0 0; padding: 30px 14px 11px; text-align: left;
  background: linear-gradient(transparent, rgba(3,6,12,.86));
  opacity: 0; transform: translateY(6px);
  transition: opacity .3s var(--ease), transform .3s var(--ease);
}
.gal__item:hover .gal__cap, .gal__item:focus-visible .gal__cap { opacity: 1; transform: none; }
.gal__cap b { display: block; font-weight: 500; font-size: .84rem; color: #EAF1FA; }
.gal__cap span { font-family: var(--font-mono); font-size: .64rem; letter-spacing: .1em; text-transform: uppercase; color: rgba(190,208,230,.8); }

/* ---- lightbox ---- */
.lb { position: fixed; inset: 0; z-index: 150; display: none; background: rgba(2,4,9,.94); }
.lb.is-open { display: grid; grid-template-rows: 1fr auto; }
.lb__stage { display: grid; place-items: center; padding: 3vh 4vw 0; min-height: 0; }
.lb__stage img { max-width: 100%; max-height: 82vh; object-fit: contain; border-radius: var(--r); }
.lb__bar { display: flex; align-items: center; justify-content: center; gap: 18px; padding: 16px 20px 24px; }
.lb__meta { text-align: center; max-width: 60ch; }
.lb__meta b { display: block; font-size: .95rem; color: #EAF1FA; font-weight: 500; }
.lb__meta span { font-family: var(--font-mono); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: #7E93AE; }
.lb__nav {
  position: fixed; top: 50%; transform: translateY(-50%);
  width: 46px; height: 46px; display: grid; place-items: center; font-size: 1.4rem;
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.14);
  border-radius: 50%; color: #EAF1FA; cursor: pointer; transition: background .2s;
}
.lb__nav:hover { background: rgba(255,255,255,.16); }
.lb__prev { left: 14px; } .lb__next { right: 14px; }
.lb__close { position: fixed; top: 14px; right: 14px; }

/* ---- strip of small photos ---- */
.strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.strip img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--r); border: 1px solid var(--line); }

/* photo inside a card — bleeds to the card edges */
.card__img { margin: calc(-1 * clamp(20px, 2.4vw, 28px)) calc(-1 * clamp(20px, 2.4vw, 28px)) 18px; overflow: hidden; }
.card__img img { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; }

/* ============================================================
   16. Theme picker, generative backdrops, map coordinates
   ============================================================ */

/* ---- theme picker ---- */
.themer { position: relative; }
.themer__pop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 95; min-width: 196px;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r);
  box-shadow: var(--shadow); padding: 6px; display: none;
}
.themer__pop.is-open { display: block; }
.themer__opt {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 8px 10px; border: 0; background: transparent; border-radius: var(--r-sm);
  font-size: .84rem; color: var(--fg-2); cursor: pointer;
}
.themer__opt:hover { background: var(--surface-2); color: var(--fg); }
.themer__opt[aria-checked="true"] { color: var(--fg); font-weight: 500; }
.themer__opt[aria-checked="true"]::after { content: "✓"; margin-left: auto; font-size: .8rem; color: var(--water); }
.swatch {
  width: 18px; height: 18px; border-radius: 50%; flex: none; border: 1px solid rgba(128,128,128,.35);
  background: conic-gradient(var(--sw-a) 0 50%, var(--sw-b) 50% 100%);
}

/* ---- generative backdrops (drawn by assets/js/backdrops.js) ---- */
.backdrop {
  position: fixed; inset: 0; z-index: -1; pointer-events: none; width: 100%; height: 100%;
}
body.has-backdrop main > .section { background: transparent; }
body.has-backdrop .card, body.has-backdrop .stat, body.has-backdrop .cvrow__what { position: relative; }

/* ---- atlas: coordinate readout ---- */
.atlas__coords {
  position: absolute; right: 14px; top: 14px; font-family: var(--font-mono); font-size: .68rem;
  letter-spacing: .06em; color: var(--fg-3); background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(8px); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 6px 9px; pointer-events: none; font-variant-numeric: tabular-nums; min-width: 152px; text-align: right;
}
.atlas__coords b { color: var(--fg); font-weight: 500; }
@media (max-width: 560px) { .atlas__coords { display: none; } }

/* ---- empty-state page (Methods for now) ---- */
.holding { min-height: calc(100svh - var(--nav-h)); display: grid; place-items: center; text-align: center; padding-block: 80px; }
.holding h2 { max-width: 16ch; margin-inline: auto; }
.holding .lede { text-align: center; margin: 18px auto 0; }

/* ============================================================
   17. Introduction block, scroll cue, footer
   ============================================================ */

/* ---- introduction (the portrait's own place) ---- */
.intro { border-top: 0 !important; }
.intro__grid { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: clamp(28px, 5vw, 72px); align-items: center; }
.intro__photo { margin: 0; }
.intro__photo img {
  width: 100%; aspect-ratio: 4/5; object-fit: cover; display: block;
  border-radius: var(--r-lg); border: 1px solid var(--line-2); box-shadow: var(--shadow);
}
.intro__photo figcaption { margin-top: 10px; font-size: .66rem; letter-spacing: .12em; text-transform: uppercase; color: var(--fg-4); text-align: center; }
.intro__lede { font-family: var(--font-display); font-size: clamp(1.45rem, 2.6vw, 2.1rem); line-height: 1.3; color: var(--fg); margin-top: 14px; max-width: 26ch; }
.intro__body { margin-top: 18px; max-width: 62ch; }
.intro__facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 28px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.intro__facts dt { font-family: var(--font-mono); font-size: .64rem; letter-spacing: .14em; text-transform: uppercase; color: var(--fg-4); }
.intro__facts dd { font-size: .92rem; color: var(--fg-2); margin-top: 3px; }
@media (max-width: 860px) {
  .intro__grid { grid-template-columns: 1fr; }
  .intro__photo { max-width: 300px; }
}

/* ---- scroll cue ---- */
.hero__scroll { gap: 6px; }
.hero__scroll::after { display: none; }
.hero__scroll svg { animation: cue 2.2s var(--ease) infinite; }
@keyframes cue { 0%, 100% { transform: translateY(0); opacity: .5; } 50% { transform: translateY(5px); opacity: 1; } }

/* ---- footer ---- */
.footer { position: relative; overflow: hidden; padding-block: 0 34px; }
.footer__bar { height: 3px; background: linear-gradient(90deg, var(--water) 0 25%, var(--energy) 25% 50%, var(--food) 50% 75%, var(--diplomacy) 75% 100%); }
.footer__top { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 32px; align-items: end; padding: 46px 0 34px; border-bottom: 1px solid var(--line); }
.footer__ident { display: flex; align-items: flex-start; gap: 14px; }
.footer__ident .brand__mark { width: 34px; height: 34px; margin-top: 3px; color: var(--fg-2); }
.footer__name { font-family: var(--font-display); font-size: 1.35rem; color: var(--fg); line-height: 1.15; }
.footer__line { font-size: .84rem; color: var(--fg-3); margin-top: 4px; }
.footer__geo { font-family: var(--font-mono); font-size: .68rem; letter-spacing: .08em; color: var(--fg-4); margin-top: 8px; font-variant-numeric: tabular-nums; }
.footer__world { width: min(360px, 40vw); opacity: .34; display: block; }
:root[data-theme="light"] .footer__world, :root[data-theme="salt"] .footer__world { opacity: .5; }
.footer__grid { padding-top: 32px; }
.footer__base { flex-direction: column; align-items: flex-start; gap: 6px; }
.footer__base .mono { font-size: .7rem; color: var(--fg-4); }
@media (max-width: 720px) { .footer__top { grid-template-columns: 1fr; } .footer__world { width: 100%; max-width: 360px; } }

/* ---- citations: small, muted, at the point of the claim ---- */
.cite { font-size: .76rem; line-height: 1.6; color: var(--fg-3); margin-top: 14px; max-width: 80ch; }
.cite a { color: var(--fg-2); border-bottom: 1px solid var(--line-2); }
.cite a:hover { color: var(--water); border-color: var(--water); }
.cite i { font-style: italic; }

/* ---- justified body text, as in a typeset document ---- */
.prose p, .intro__lede, .lede, .card p, .fw__plain, .pub__abs, .holding .lede {
  text-align: justify; text-align-last: left; text-justify: inter-word;
  hyphens: auto; -webkit-hyphens: auto; hyphenate-limit-chars: 7 3 3;
}
.holding .lede { text-align-last: center; }
