/* ==========================================================================
   Dr. Muntazar Mehdi, Academic Portfolio
   Modern editorial system: soft shell, pill navigation, gradient hero.
   Palette per brief: ivory / navy / charcoal / teal / brass / stone.
   ========================================================================== */

:root {
  --bg-page: #EDE9E0;
  --bg-shell: #F7F4EE;
  --color-heading: #172B3A;
  --color-navy-deep: #0F1C26;
  --color-body: #25313A;
  --color-action: #2B6663;
  --color-action-hover: #1F4D4A;
  --color-accent: #A88955;
  --color-accent-soft: rgba(168, 137, 85, 0.13);
  --color-border: #DDD7CC;
  --color-surface: #FFFFFF;

  --grad-hero: linear-gradient(168deg, #7FB3A4 0%, #A9CDBC 26%, #D6E4D2 55%, #F1EFE6 82%, var(--bg-shell) 100%);

  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --max-width: 1180px;
  --content-width: 680px;

  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2.5rem;
  --space-5: 4.5rem;
  --space-6: 7rem;

  --r-xl: 34px;
  --r-lg: 24px;
  --r-md: 16px;
  --r-sm: 10px;
  --r-pill: 999px;

  --shadow-soft: 0 1px 2px rgba(23, 43, 58, 0.04), 0 8px 28px rgba(23, 43, 58, 0.06);
  --shadow-lift: 0 2px 6px rgba(23, 43, 58, 0.06), 0 18px 44px rgba(23, 43, 58, 0.10);
  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
}

/* Reset */
* { box-sizing: border-box; }
html, body, h1, h2, h3, h4, p, figure, blockquote, dl, dd, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img { max-width: 100%; display: block; }
a { color: inherit; }
button { font: inherit; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

body {
  background: var(--bg-page);
  color: var(--color-body);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  padding: clamp(0px, 1.2vw, 18px);
}

/* Rounded page shell */
.page-shell {
  background: var(--bg-shell);
  border-radius: var(--r-xl);
  overflow: clip;
  box-shadow: var(--shadow-soft);
}
@media (max-width: 640px) {
  body { padding: 0; }
  .page-shell { border-radius: 0; }
}

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  color: var(--color-heading);
  line-height: 1.12;
  font-weight: 600;
  text-wrap: balance;
}
h1 { font-size: clamp(2.6rem, 6vw, 4.6rem); letter-spacing: -0.022em; }
h2 { font-size: clamp(1.7rem, 3.2vw, 2.6rem); margin-bottom: var(--space-3); letter-spacing: -0.012em; }
h3 { font-size: 1.22rem; margin-bottom: var(--space-1); letter-spacing: -0.005em; }

/* Italic serif second line, the signature display treatment */
.display-italic {
  display: block;
  font-style: italic;
  font-weight: 400;
  color: var(--color-heading);
}

p + p { margin-top: var(--space-2); }

.container {
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: clamp(var(--space-3), 4vw, var(--space-4));
}
.prose { max-width: var(--content-width); }

/* Skip link */
.skip-link {
  position: absolute;
  left: -999px; top: 0;
  background: var(--color-heading);
  color: #fff;
  padding: 0.75rem 1.25rem;
  z-index: 200;
  border-radius: var(--r-pill);
}
.skip-link:focus { left: var(--space-3); top: var(--space-3); }

a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--color-action);
  outline-offset: 3px;
}

/* ---------- Compact pill navigation ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  padding-top: var(--space-2);
  background: linear-gradient(to bottom, var(--bg-shell) 55%, rgba(247,244,238,0));
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding-block: 0.35rem;
}
.nav-identity { text-decoration: none; display: flex; align-items: baseline; gap: 0.5rem; }
.nav-identity .nav-name {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 600;
  color: var(--color-heading);
  font-size: 1.22rem;
  letter-spacing: -0.01em;
}
.nav-identity .nav-role { display: none; }

/* the pill itself */
.nav-links {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--color-border);
  border-radius: var(--r-pill);
  padding: 0.3rem;
  box-shadow: var(--shadow-soft);
  font-size: 0.875rem;
}
.nav-links a {
  text-decoration: none;
  padding: 0.5rem 0.85rem;
  border-radius: var(--r-pill);
  white-space: nowrap;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}
.nav-links a:hover { background: var(--color-accent-soft); color: var(--color-heading); }
.nav-links a[aria-current="page"] { background: var(--color-heading); color: #fff; }

.nav-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--color-heading);
  color: #fff;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.65rem 1.15rem;
  border-radius: var(--r-pill);
  transition: background-color 0.2s var(--ease);
}
.nav-cta:hover { background: var(--color-action); }

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  background: rgba(255,255,255,0.8);
  border: 1px solid var(--color-border);
  border-radius: var(--r-pill);
  cursor: pointer;
  color: var(--color-heading);
  box-shadow: var(--shadow-soft);
}
.nav-toggle svg { width: 18px; height: 18px; }

@media (max-width: 1080px) {
  .nav-links { font-size: 0.82rem; }
  .nav-links a { padding: 0.45rem 0.65rem; }
}
@media (max-width: 900px) {
  .nav-toggle { display: inline-flex; }
  .nav-desktop-cta { display: none; }
  .nav-links {
    display: none;
    order: 3;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    border-radius: var(--r-lg);
    padding: 0.5rem;
    gap: 0.1rem;
  }
  .nav-links.is-open { display: flex; }
  .nav-links a { display: block; padding: 0.75rem 1rem; border-radius: var(--r-md); }
  .nav { flex-wrap: wrap; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.95rem;
  text-decoration: none;
  padding: 0.85rem 1.6rem;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease),
              border-color 0.2s var(--ease), transform 0.2s var(--ease);
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn-primary { background: var(--color-navy-deep); color: #fff; box-shadow: var(--shadow-soft); }
.btn-primary:hover { background: var(--color-action); transform: translateY(-1px); }
.btn-secondary { background: rgba(255,255,255,0.7); color: var(--color-heading); border-color: var(--color-border); }
.btn-secondary:hover { border-color: var(--color-accent); color: var(--color-action); }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: var(--space-3); }

/* ---------- Pills & chips ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255,255,255,0.85);
  border: 1px solid var(--color-border);
  border-radius: var(--r-pill);
  padding: 0.45rem 0.95rem;
  font-size: 0.85rem;
  color: var(--color-body);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.pill-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--color-action);
  flex-shrink: 0;
}

/* ---------- Sections ---------- */
.section { padding-block: var(--space-5); }
.section + .section { padding-top: 0; }
.section-head { margin-bottom: var(--space-4); }
.section-label {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1rem;
  color: var(--color-accent);
  display: block;
  margin-bottom: 0.65rem;
}
.section-centered { text-align: center; }
.section-centered .prose { margin-inline: auto; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  margin-inline: clamp(0px, 1.4vw, 20px);
  margin-top: var(--space-2);
  border-radius: var(--r-xl);
  background: var(--grad-hero);
  overflow: hidden;
  padding: clamp(2rem, 4vw, 3.25rem) clamp(1.25rem, 3vw, 2.75rem) 0;
  text-align: center;
  isolation: isolate;
}
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--color-heading);
  background: rgba(255,255,255,0.72);
  border: 1px solid rgba(255,255,255,0.9);
  border-radius: var(--r-pill);
  padding: 0.4rem 0.95rem;
  margin-bottom: var(--space-3);
}
.hero h1 { position: relative; z-index: 2; }
.hero-stage {
  position: relative;
  margin-top: -0.32em;
  display: flex;
  justify-content: center;
  align-items: flex-end;
}
.hero-portrait-img {
  position: relative;
  z-index: 1;
  width: auto;
  height: clamp(300px, 40vw, 430px);
  object-fit: contain;
  object-position: bottom center;
  filter: grayscale(1) contrast(1.05);
  /* fade the lower edge into the gradient */
  -webkit-mask-image: linear-gradient(to bottom, #000 70%, rgba(0,0,0,0.6) 86%, transparent 99%);
  mask-image: linear-gradient(to bottom, #000 70%, rgba(0,0,0,0.6) 86%, transparent 99%);
}
.hero-float {
  position: absolute;
  z-index: 3;
  max-width: 240px;
  text-align: left;
}
.hero-float-left { left: 0; top: 30%; }
.hero-float-right { right: 0; top: 26%; font-size: 0.95rem; color: var(--color-body); }
.hero-float-cta { right: 6%; bottom: 22%; }
.hero-float-credit { left: 2%; bottom: 20%; display: flex; align-items: center; gap: 0.6rem; }
.hero-credit-text { font-size: 0.78rem; line-height: 1.35; color: var(--color-body); }
.hero-credit-text strong { color: var(--color-heading); }

@media (max-width: 900px) {
  .hero-stage { flex-direction: column; align-items: center; }
  .hero-float { position: static; max-width: none; text-align: center; margin-inline: auto; }
  .hero-float-right { margin-top: var(--space-2); }
  .hero-float-credit { justify-content: center; margin-top: var(--space-3); }
  .hero-float-cta { margin-top: var(--space-2); margin-bottom: var(--space-3); }
  .hero-portrait-img { width: min(70vw, 300px); }
}

/* ---------- Affiliation strip ---------- */
.affil-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: clamp(1rem, 4vw, 3rem);
  padding-block: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}
.affil-item {
  font-family: var(--font-serif);
  font-size: 0.98rem;
  color: var(--color-body);
  opacity: 0.55;
  white-space: nowrap;
}

/* ---------- Floating chip cluster ---------- */
.chip-stage { position: relative; padding-block: var(--space-4); }
.chip-float { position: absolute; z-index: 2; }
.chip-float .pill { font-size: 0.78rem; padding: 0.35rem 0.8rem; }
.chip-1 { left: 2%;  top: 6%; }
.chip-2 { left: 8%;  bottom: 12%; }
.chip-3 { right: 3%; top: 10%; }
.chip-4 { right: 9%; bottom: 8%; }
.chip-statement {
  max-width: 660px;
  margin-inline: auto;
  text-align: center;
  font-family: var(--font-serif);
  font-size: clamp(1.3rem, 2.6vw, 1.95rem);
  line-height: 1.34;
  color: var(--color-heading);
}
.chip-statement em { color: var(--color-action); }
@media (max-width: 860px) {
  .chip-float { display: none; }
}

/* ---------- Cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: var(--space-2); }
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--r-lg);
  padding: var(--space-3);
  text-decoration: none;
  display: block;
  box-shadow: var(--shadow-soft);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.card h3 { color: var(--color-heading); }
.card p { color: var(--color-body); font-size: 0.94rem; }
.card-index {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--color-accent);
  font-size: 0.9rem;
  display: block;
  margin-bottom: 0.4rem;
}

/* ---------- Timeline ---------- */
.timeline { border-left: 1px solid var(--color-border); padding-left: var(--space-3); }
.timeline-item { position: relative; padding-bottom: var(--space-4); }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
  content: "";
  position: absolute;
  left: calc(-1 * var(--space-3) - 4px);
  top: 0.4rem;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--color-action);
}
.timeline-dates { font-family: var(--font-serif); font-size: 0.9rem; color: var(--color-accent); font-style: italic; }
.timeline-item.is-unconfirmed .timeline-dates { color: var(--color-body); opacity: 0.6; }
.note-unconfirmed { font-size: 0.85rem; color: var(--color-body); opacity: 0.7; font-style: italic; }

/* ---------- Publications ---------- */
.pub-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: end;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--r-lg);
  padding: var(--space-3);
  margin-bottom: var(--space-3);
  box-shadow: var(--shadow-soft);
}
.pub-field { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; }
.pub-field label { font-weight: 600; color: var(--color-heading); }
.pub-field input, .pub-field select {
  font-family: var(--font-sans);
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--color-border);
  border-radius: var(--r-pill);
  background: var(--bg-shell);
  min-width: 180px;
  max-width: 100%;
}
@media (max-width: 480px) {
  .pub-field, .pub-field input, .pub-field select { width: 100%; min-width: 0; }
}
.pub-count { font-size: 0.9rem; color: var(--color-body); opacity: 0.75; margin-bottom: var(--space-3); }

.pub-list { counter-reset: pub; display: flex; flex-direction: column; gap: 0.75rem; }
.pub-row {
  counter-increment: pub;
  position: relative;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--r-lg);
  padding: var(--space-3) var(--space-3) var(--space-3) 3.6rem;
  box-shadow: var(--shadow-soft);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.pub-row:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.pub-row::before {
  content: counter(pub, decimal-leading-zero);
  position: absolute;
  left: var(--space-3); top: var(--space-3);
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--color-accent);
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}
.pub-row h3 { margin-bottom: 0.3rem; font-size: 1.12rem; }
.pub-row h3 a { text-decoration: none; color: var(--color-heading); }
.pub-row h3 a:hover { color: var(--color-action); }
.pub-meta { font-size: 0.92rem; color: var(--color-body); opacity: 0.85; font-family: var(--font-serif); }
.pub-theme-tag {
  display: inline-block;
  font-size: 0.72rem;
  color: var(--color-accent);
  background: var(--color-accent-soft);
  border-radius: var(--r-pill);
  padding: 0.18rem 0.65rem;
  margin-top: 0.6rem;
  margin-right: 0.35rem;
}
.pub-empty {
  text-align: center;
  padding: var(--space-5) var(--space-3);
  color: var(--color-body);
  opacity: 0.8;
  border: 1px dashed var(--color-border);
  border-radius: var(--r-lg);
  background: rgba(255,255,255,0.4);
}
.pub-detail-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-block: var(--space-2); }
.pub-detail-actions button, .pub-detail-actions a.btn { font-size: 0.85rem; padding: 0.6rem 1.1rem; }
.citation-box {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--r-md);
  padding: var(--space-2);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.85rem;
  white-space: pre-wrap;
}

/* ---------- Forms ---------- */
.form-field { margin-bottom: var(--space-2); display: flex; flex-direction: column; gap: 0.35rem; }
.form-field label { font-weight: 600; font-size: 0.9rem; }
.form-field input, .form-field select, .form-field textarea {
  font-family: var(--font-sans);
  padding: 0.75rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--r-md);
  background: var(--color-surface);
}
.form-status { font-size: 0.9rem; margin-top: var(--space-2); }
.form-status.error { color: #A33; }
.form-status.success { color: var(--color-action); }

.contact-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--r-lg);
  padding: var(--space-3);
  box-shadow: var(--shadow-soft);
  margin-bottom: var(--space-2);
}
.contact-card .label {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--color-accent);
  font-size: 0.95rem;
  display: block;
  margin-bottom: 0.2rem;
}
.copy-btn {
  font-size: 0.78rem;
  background: var(--bg-shell);
  border: 1px solid var(--color-border);
  border-radius: var(--r-pill);
  padding: 0.25rem 0.75rem;
  margin-left: 0.6rem;
  cursor: pointer;
}
.copy-btn:hover { border-color: var(--color-accent); }

/* ---------- Big CTA panel ---------- */
.cta-panel {
  background: var(--color-navy-deep);
  color: rgba(247,244,238,0.85);
  border-radius: var(--r-xl);
  padding: clamp(2rem, 5vw, 3.5rem);
  text-align: center;
  margin-block: var(--space-4);
}
.cta-panel h2 { color: #fff; }
.cta-panel p { max-width: 520px; margin-inline: auto; }
.cta-panel .btn-row { justify-content: center; }
.cta-panel .btn-primary { background: var(--color-action); }
.cta-panel .btn-primary:hover { background: #fff; color: var(--color-navy-deep); }
.cta-panel .btn-secondary {
  background: transparent;
  color: rgba(247,244,238,0.9);
  border-color: rgba(247,244,238,0.3);
}
.cta-panel .btn-secondary:hover { border-color: #fff; color: #fff; }

/* ---------- Inline links ---------- */
main p a, .prose a, .pub-empty a {
  text-decoration: underline;
  text-decoration-color: var(--color-border);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.2s var(--ease), color 0.2s var(--ease);
}
main p a:hover, .prose a:hover, .pub-empty a:hover {
  color: var(--color-action);
  text-decoration-color: var(--color-accent);
}

/* ---------- Biography layout ---------- */
.bio-grid {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: start;
}
@media (max-width: 820px) {
  .bio-grid { grid-template-columns: 1fr; }
  .bio-grid .bio-media { max-width: 320px; }
}
.bio-media img { border-radius: var(--r-lg); box-shadow: var(--shadow-soft); }
.lede::first-letter {
  font-family: var(--font-serif);
  font-size: 3.4em;
  font-weight: 600;
  float: left;
  line-height: 0.82;
  padding-right: 0.09em;
  padding-top: 0.05em;
  color: var(--color-heading);
}

/* ---------- Media ---------- */
.media-rounded { border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-soft); }
.figure-caption { font-size: 0.82rem; color: var(--color-body); opacity: 0.65; margin-top: 0.6rem; font-style: italic; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--color-navy-deep);
  color: rgba(247, 244, 238, 0.78);
  padding-block: var(--space-4);
  font-size: 0.9rem;
  margin-top: var(--space-5);
}
.footer-grid { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-3); }
.footer-grid strong { color: #fff; font-family: var(--font-serif); font-style: italic; font-size: 1.15rem; }
.footer-grid a { color: rgba(247, 244, 238, 0.72); }
.footer-nav { display: flex; flex-wrap: wrap; gap: 0.4rem; align-self: flex-start; }
.footer-nav a {
  text-decoration: none;
  padding: 0.35rem 0.75rem;
  border-radius: var(--r-pill);
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}
.footer-nav a:hover { background: rgba(255,255,255,0.09); color: #fff; }

/* ---------- Utility ---------- */
.text-muted { opacity: 0.7; }
.mt-1 { margin-top: var(--space-1); } .mt-2 { margin-top: var(--space-2); } .mt-3 { margin-top: var(--space-3); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0; padding: 0; margin: -1px;
}

/* ==========================================================================
   MOTION & DEPTH LAYER
   Every effect below is disabled wholesale by the reduced-motion block
   at the top of this file, and again defensively at the end of this one.
   ========================================================================== */

/* ---------- Scroll progress ---------- */
.scroll-progress {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: 100%;
  transform: scaleX(0);
  transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--color-action), var(--color-accent));
  z-index: 100;
  pointer-events: none;
}

/* ---------- Nav auto-hide ---------- */
.site-header {
  transition: transform 0.45s var(--ease);
  will-change: transform;
}
.site-header.is-hidden { transform: translateY(-115%); }

/* ---------- Hero aurora ---------- */
.hero-aurora {
  position: absolute;
  inset: -30%;
  z-index: 0;
  pointer-events: none;
  filter: blur(70px);
  opacity: 0.38;
}
.aurora-blob {
  position: absolute;
  border-radius: 50%;
  mix-blend-mode: soft-light;
}
.aurora-1 {
  width: 46%; height: 46%;
  left: 6%; top: 12%;
  background: radial-gradient(circle, #2B6663 0%, transparent 70%);
  animation: drift-a 22s ease-in-out infinite alternate;
}
.aurora-2 {
  width: 40%; height: 40%;
  right: 8%; top: 22%;
  background: radial-gradient(circle, #A88955 0%, transparent 72%);
  opacity: 0.55;
  animation: drift-b 27s ease-in-out infinite alternate;
}
.aurora-3 {
  width: 52%; height: 44%;
  left: 28%; bottom: 4%;
  background: radial-gradient(circle, #FFFFFF 0%, transparent 68%);
  animation: drift-c 19s ease-in-out infinite alternate;
}
@keyframes drift-a { to { transform: translate3d(9%, -7%, 0) scale(1.14); } }
@keyframes drift-b { to { transform: translate3d(-11%, 8%, 0) scale(1.08); } }
@keyframes drift-c { to { transform: translate3d(5%, -5%, 0) scale(0.92); } }

/* ---------- Hero staged entrance ---------- */
.word-mask { display: inline-block; overflow: hidden; vertical-align: bottom; padding-bottom: 0.06em; }
.word {
  display: inline-block;
  transform: translateY(105%);
  animation: word-rise 0.95s var(--ease) forwards;
}
@keyframes word-rise { to { transform: translateY(0); } }

.hero-eyebrow,
.hero-float,
.hero-portrait-img { opacity: 0; animation: soft-in 0.9s var(--ease) forwards; }
@keyframes soft-in { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

.hero-eyebrow      { animation-delay: 0.05s; }
.hero-portrait-img { animation-delay: 0.55s; animation-name: portrait-in; }
@keyframes portrait-in {
  from { opacity: 0; transform: translateY(26px) scale(0.975); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.hero-float-left   { animation-delay: 0.85s; }
.hero-float-right  { animation-delay: 0.95s; }
.hero-float-credit { animation-delay: 1.05s; }
.hero-float-cta    { animation-delay: 1.15s; }

/* Portrait parallax hook (JS sets --py) */
.hero-portrait-img { will-change: transform; }
.hero-parallax { transform: translateY(var(--py, 0px)); }

/* ---------- Scroll reveal ---------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
  transition-delay: calc(var(--i, 0) * 70ms);
}
[data-reveal].is-visible { opacity: 1; transform: none; }

/* ---------- Affiliation marquee ---------- */
.marquee {
  position: relative;
  overflow: hidden;
  padding-block: var(--space-4);
  border-bottom: 1px solid var(--color-border);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.marquee-track {
  display: flex;
  width: max-content;
  gap: clamp(1.5rem, 4vw, 3.5rem);
  animation: marquee 38s linear infinite;
}
.marquee:hover .marquee-track { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(-50%); } }
.affil-item {
  font-family: var(--font-serif);
  font-size: 1rem;
  color: var(--color-body);
  opacity: 0.5;
  white-space: nowrap;
  transition: opacity 0.3s var(--ease), color 0.3s var(--ease);
}
.affil-item:hover { opacity: 1; color: var(--color-action); }

/* ---------- Card sheen + refined hover ---------- */
.card {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(135deg, rgba(43,102,99,0.07), rgba(168,137,85,0.07));
  opacity: 0;
  transition: opacity 0.35s var(--ease);
}
.card:hover::after { opacity: 1; }
.card::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 2px;
  background: linear-gradient(90deg, var(--color-action), var(--color-accent));
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 0.45s var(--ease);
}
.card:hover::before { transform: scaleX(1); }

/* ---------- Publication row hover ---------- */
.pub-row { overflow: hidden; }
.pub-row::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(43,102,99,0.05), transparent 60%);
  opacity: 0;
  transition: opacity 0.35s var(--ease);
  pointer-events: none;
}
.pub-row:hover::after { opacity: 1; }

/* ---------- Magnetic buttons ---------- */
[data-magnetic] { will-change: transform; transition: transform 0.35s var(--ease); }

/* ---------- Statement emphasis shimmer ---------- */
.chip-statement em {
  font-style: italic;
  background: linear-gradient(100deg, var(--color-action) 0%, var(--color-accent) 50%, var(--color-action) 100%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 7s ease-in-out infinite;
}
@keyframes shimmer { 0%,100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }

/* Floating chips bob gently */
.chip-float { animation: bob 7s ease-in-out infinite; }
.chip-2 { animation-delay: -1.8s; }
.chip-3 { animation-delay: -3.4s; }
.chip-4 { animation-delay: -5.1s; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }

/* ---------- CTA panel glow ---------- */
.cta-panel { position: relative; overflow: hidden; isolation: isolate; }
.cta-panel::before {
  content: "";
  position: absolute;
  width: 60%; aspect-ratio: 1;
  left: 50%; top: 100%;
  translate: -50% -50%;
  background: radial-gradient(circle, rgba(43,102,99,0.55) 0%, transparent 68%);
  filter: blur(40px);
  z-index: -1;
  animation: glow-pulse 9s ease-in-out infinite;
}
@keyframes glow-pulse { 0%,100% { opacity: 0.55; } 50% { opacity: 0.95; } }

/* ---------- Reduced motion: hard stop ---------- */
@media (prefers-reduced-motion: reduce) {
  .word { transform: none; animation: none; }
  .hero-eyebrow, .hero-float, .hero-portrait-img { opacity: 1; animation: none; transform: none; }
  .hero-parallax { transform: none !important; }
  .aurora-blob, .chip-float, .chip-statement em, .cta-panel::before { animation: none; }
  .marquee-track { animation: none; justify-content: center; flex-wrap: wrap; width: 100%; }
  .marquee { -webkit-mask-image: none; mask-image: none; }
  [data-reveal] { opacity: 1; transform: none; transition: none; }
  .site-header.is-hidden { transform: none; }
  .scroll-progress { display: none; }
}

/* ==========================================================================
   MOBILE OPTIMIZATION
   Sits last so it wins on specificity ties. Targets real handset widths
   rather than only preventing horizontal overflow.
   ========================================================================== */

/* Notch / gesture-bar safe areas + no grey tap flash on iOS */
:root {
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}
* { -webkit-tap-highlight-color: rgba(43, 102, 99, 0.12); }

/* iOS zooms the page when a focused input is under 16px */
@media (max-width: 860px) {
  input, select, textarea { font-size: 16px; }
}

@media (max-width: 860px) {
  /* Tighter, more usable type scale on handsets */
  h1 { font-size: clamp(2rem, 8.6vw, 3rem); line-height: 1.08; }
  h2 { font-size: clamp(1.45rem, 5.6vw, 1.95rem); }
  h3 { font-size: 1.1rem; }
  body { font-size: 1rem; }

  .section { padding-block: var(--space-4); }
  .container { padding-inline: max(1.15rem, var(--safe-l)) max(1.15rem, var(--safe-r)); }

  /* Hero: compress so the whole pitch fits without endless scrolling */
  .hero {
    margin-inline: 0;
    border-radius: 0 0 var(--r-xl) var(--r-xl);
    padding: 1.5rem 1.15rem 0;
  }
  .hero-eyebrow { font-size: 0.78rem; padding: 0.35rem 0.8rem; margin-bottom: var(--space-2); }
  .hero-stage { gap: 0.75rem; margin-top: 0.25rem; }
  .hero-portrait-img { height: clamp(210px, 46vw, 280px); }
  .hero-float-right { font-size: 0.95rem; max-width: 34ch; }
  .hero-float-credit { margin-top: var(--space-2); }

  /* Reachable, full-width primary action */
  .hero-float-cta { width: 100%; margin-top: var(--space-3); margin-bottom: var(--space-3); }
  .hero-float-cta .btn { width: 100%; justify-content: center; }

  /* Order for thumb flow: pitch and action before the portrait */
  .hero-stage { display: flex; flex-direction: column; }
  .hero-float-left   { order: 1; }
  .hero-float-right  { order: 2; }
  .hero-float-cta    { order: 3; }
  .hero-portrait-img, .hero-stage > picture { order: 4; }
  .hero-float-credit { order: 5; }

  /* Single-column cards read better than cramped two-ups */
  .grid { grid-template-columns: 1fr; gap: 0.85rem; }
  .card { padding: 1.15rem; }

  .cta-panel { padding: 1.75rem 1.25rem; border-radius: var(--r-lg); }
  .cta-panel .btn-row { flex-direction: column; }
  .cta-panel .btn { width: 100%; justify-content: center; }

  .chip-statement { font-size: 1.15rem; }
  .chip-stage { padding-block: var(--space-3); }

  .pub-row { padding: 1.1rem 1.1rem 1.1rem 1.1rem; }
  .pub-row::before { position: static; display: block; margin-bottom: 0.3rem; }
  .pub-toolbar { padding: 1.1rem; border-radius: var(--r-lg); }

  .bio-grid { gap: 1.25rem; }
  .bio-grid .bio-media { max-width: 100%; }

  .timeline { padding-left: 1.1rem; }

  /* Comfortable tap targets */
  .footer-nav { gap: 0.15rem; }
  .footer-nav a { padding: 0.7rem 0.9rem; min-height: 44px; display: flex; align-items: center; }
  .nav-identity { min-height: 44px; display: flex; align-items: center; }
  .card, .pub-row { min-height: 44px; }
  .copy-btn { min-height: 40px; padding-inline: 0.9rem; }

  .footer-grid { flex-direction: column; gap: var(--space-2); }
  .site-footer { padding-inline: 0; }
}

@media (max-width: 400px) {
  h1 { font-size: clamp(1.8rem, 8.4vw, 2.3rem); }
  .hero-portrait-img { height: 195px; }
  .hero-eyebrow { font-size: 0.74rem; }
  .btn { padding: 0.8rem 1.2rem; font-size: 0.9rem; }
}

/* Touch devices: no hover-dependent affordances, and drop the expensive
   blurred aurora + parallax that cost battery and jank on mobile GPUs. */
@media (hover: none) {
  .card:hover { transform: none; }
  .card:hover::before { transform: scaleX(0); }
  .marquee:hover .marquee-track { animation-play-state: running; }
}
@media (max-width: 860px) {
  .hero-aurora { filter: blur(48px); opacity: 0.3; }
  .aurora-blob { animation: none; }
  .cta-panel::before { animation: none; }
  .hero-parallax { transform: none !important; }
}

/* Standalone links (the only thing in their paragraph) act as controls,
   so give them a real tap area. Links inline within sentences keep their
   natural size, per the WCAG 2.5.8 inline exception. */
@media (max-width: 860px) {
  p > a:only-child,
  .site-footer a {
    display: inline-block;
    padding-block: 0.55rem;
    min-height: 40px;
  }
}

/* Contact email links are primary actions on this page, not prose */
@media (max-width: 860px) {
  .contact-card a {
    display: inline-block;
    padding-block: 0.6rem;
    min-height: 44px;
    font-size: 1.02rem;
  }
  .contact-card { padding: 1.1rem; }
}

@media (max-width: 860px) {
  .hero-float-left { margin-top: 0.35rem; }
  .hero-stage > picture { display: block; margin-top: -0.25rem; }
}

/* ==========================================================================
   CONTENT COMPONENTS (resume-driven pages)
   ========================================================================== */

/* Role rows: date column + body, used for service, teaching, training */
.role-list { display: flex; flex-direction: column; }
.role-row {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: var(--space-3);
  padding-block: 1.1rem;
  border-bottom: 1px solid var(--color-border);
}
.role-row:first-child { border-top: 1px solid var(--color-border); }
.role-dates {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--color-accent);
  font-size: 0.93rem;
  padding-top: 0.1rem;
}
.role-body h3 { font-size: 1.05rem; margin-bottom: 0.2rem; }
.role-body p { font-size: 0.94rem; color: var(--color-body); opacity: 0.85; }
.role-link { margin-top: 0.3rem; font-size: 0.85rem !important; }

/* Event rows: richer, used for talks & events */
.event-list { display: flex; flex-direction: column; gap: 0.7rem; }
.event-row {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: var(--space-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--r-md);
  padding: 1.1rem 1.3rem;
  box-shadow: var(--shadow-soft);
}
.event-date { font-family: var(--font-serif); font-style: italic; color: var(--color-accent); font-size: 0.92rem; }
.event-body h3 { font-size: 1.04rem; margin-bottom: 0.25rem; line-height: 1.3; }
.event-meta { font-size: 0.9rem; color: var(--color-body); opacity: 0.85; }
.event-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.55rem; }
.event-tag {
  font-size: 0.72rem;
  padding: 0.18rem 0.65rem;
  border-radius: var(--r-pill);
  background: var(--color-accent-soft);
  color: #7A6238;
}
.event-tag.is-award { background: rgba(43,102,99,0.12); color: var(--color-action); }
.event-link { font-size: 0.85rem; margin-top: 0.45rem; display: inline-block; }

/* Group headers with counts */
.group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.4rem; }
.group-count {
  font-size: 0.8rem;
  color: var(--color-body);
  background: rgba(255,255,255,0.8);
  border: 1px solid var(--color-border);
  border-radius: var(--r-pill);
  padding: 0.2rem 0.7rem;
}
.group-intro { color: var(--color-body); opacity: 0.8; margin-bottom: var(--space-3); max-width: 62ch; }

/* Jump chips */
.jump-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: var(--space-3);
}
.jump-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  text-decoration: none;
  font-size: 0.85rem;
  padding: 0.5rem 0.95rem;
  border-radius: var(--r-pill);
  background: rgba(255,255,255,0.85);
  border: 1px solid var(--color-border);
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
  white-space: nowrap;
}
.jump-chip span { font-size: 0.75rem; opacity: 0.6; }
.jump-chip:hover { border-color: var(--color-accent); color: var(--color-action); }
.anchor-target { scroll-margin-top: 90px; }

/* Stats strip (derived counts only) */
.stats-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-2);
}
.stat {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--r-lg);
  padding: 1.3rem 1.2rem;
  box-shadow: var(--shadow-soft);
}
.stat-value {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4vw, 2.7rem);
  color: var(--color-heading);
  line-height: 1;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.stat-label { font-size: 0.86rem; color: var(--color-body); opacity: 0.8; margin-top: 0.45rem; }

/* Education cards with thesis */
.edu-thesis {
  margin-top: 0.6rem;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--color-body);
  border-left: 2px solid var(--color-accent);
  padding-left: 0.8rem;
}
.edu-meta { font-size: 0.86rem; opacity: 0.75; margin-top: 0.2rem; }

/* Two-up info panels */
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--space-2); }
.lang-list { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.lang-pill {
  display: inline-flex; gap: 0.4rem; align-items: baseline;
  padding: 0.45rem 0.9rem; border-radius: var(--r-pill);
  background: var(--color-surface); border: 1px solid var(--color-border); font-size: 0.9rem;
}
.lang-pill small { opacity: 0.6; font-size: 0.75rem; }

.theme-pubs { margin-top: 0.8rem; display: flex; flex-direction: column; gap: 0.4rem; }
.theme-pubs li { font-size: 0.86rem; line-height: 1.4; padding-left: 0.9rem; position: relative; }
.theme-pubs li::before { content: ""; position: absolute; left: 0; top: 0.55em; width: 5px; height: 5px; border-radius: 50%; background: var(--color-accent); }
.theme-pubs a { text-decoration: none; }
.theme-pubs a:hover { color: var(--color-action); text-decoration: underline; }
.theme-count { font-size: 0.8rem; color: var(--color-action); font-weight: 500; margin-top: 0.6rem; display: block; }

.pub-type-tag {
  display: inline-block; font-size: 0.72rem; color: var(--color-action);
  background: rgba(43,102,99,0.1); border-radius: var(--r-pill);
  padding: 0.18rem 0.65rem; margin-top: 0.6rem; margin-right: 0.35rem;
}
.pub-row h3 a em, .pub-meta em { font-style: italic; }

@media (max-width: 860px) {
  .role-row, .event-row { grid-template-columns: 1fr; gap: 0.3rem; }
  .event-row { padding: 1rem 1.05rem; }
  .stats-strip { grid-template-columns: repeat(2, 1fr); gap: 0.7rem; }
  .stat { padding: 1rem; }
  .jump-nav { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 0.4rem; margin-inline: -1.15rem; padding-inline: 1.15rem; scrollbar-width: none; }
  .jump-nav::-webkit-scrollbar { display: none; }
  .jump-chip { min-height: 44px; }
}
.marquee-caption {
  text-align: center;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.88rem;
  color: var(--color-accent);
  margin-top: var(--space-4);
  margin-bottom: -1.2rem;
}
.pub-detail-title { font-size: clamp(1.7rem, 3.4vw, 2.6rem); line-height: 1.18; }
.mb-crumb { font-size: 0.88rem; margin-bottom: var(--space-2); }
a.pub-theme-tag { text-decoration: none; }
a.pub-theme-tag:hover { background: rgba(168,137,85,0.24); }
.intro-split { display: grid; grid-template-columns: 1.3fr 0.7fr; gap: var(--space-4); align-items: start; }
.intro-split figure img { max-height: 380px; width: 100%; object-fit: cover; object-position: top; }
@media (max-width: 860px) {
  .intro-split { grid-template-columns: 1fr; gap: var(--space-3); }
  .intro-split figure img { max-height: 300px; }
}
/* Buttons never inherit the prose-link underline */
a.btn, .prose a.btn, main p a.btn { text-decoration: none; }

/* Grid children default to min-width:auto, which lets a non-wrapping
   child (the horizontally scrolling jump chips) force the whole track
   wider than the viewport. Allow tracks to shrink. */
.intro-split > *, .info-grid > *, .bio-grid > *, .grid > *,
.role-row > *, .event-row > *, .stats-strip > * { min-width: 0; }
.event-body h3, .role-body h3, .pub-row h3 { overflow-wrap: anywhere; }
