/* ============================================================
   Mohd Hafriz Nural Azhan — Research Portfolio
   Hand-written, no framework, no build step.
   ============================================================ */

/* ---------- tokens ---------- */
:root {
  --bg: #f7f5f0;
  --bg-alt: #f1eee7;
  --bg-elev: #fffdf8;
  --ink: #14171a;
  --ink-2: #3b4247;
  --muted: #5f666b;
  --faint: #666c71;
  --line: rgba(20, 23, 26, 0.13);
  --line-strong: rgba(20, 23, 26, 0.24);
  --accent: #0c5e5c;
  --accent-2: #0a4a48;
  --accent-soft: rgba(12, 94, 92, 0.08);
  --gold: #9c5c1c;
  --gold-soft: rgba(156, 92, 28, 0.1);
  --shadow: 0 1px 2px rgba(20, 23, 26, 0.05), 0 8px 24px -16px rgba(20, 23, 26, 0.25);

  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;

  --wrap: 1120px;
  --pad: clamp(1.25rem, 4vw, 2.5rem);
  --radius: 3px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

html[data-theme="dark"] {
  --bg: #0d1113;
  --bg-alt: #111619;
  --bg-elev: #141a1d;
  --ink: #ece9e1;
  --ink-2: #c2c7c7;
  --muted: #8e9598;
  --faint: #7e8688;
  --line: rgba(236, 233, 225, 0.14);
  --line-strong: rgba(236, 233, 225, 0.28);
  --accent: #6cc4bd;
  --accent-2: #8ed8d2;
  --accent-soft: rgba(108, 196, 189, 0.1);
  --gold: #d8a066;
  --gold-soft: rgba(216, 160, 102, 0.12);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px -20px rgba(0, 0, 0, 0.8);
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
h1, h2, h3, h4, p, ul, ol, figure, blockquote, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
strong { font-weight: 600; }
::selection { background: var(--accent); color: #fff; }
html[data-theme="dark"] ::selection { color: #07100f; }

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

.skip-link {
  position: fixed; top: -100px; left: 1rem; z-index: 200;
  background: var(--ink); color: var(--bg);
  padding: 0.7rem 1.1rem; border-radius: var(--radius);
  font-size: 0.85rem; font-weight: 500;
  transition: top 0.2s var(--ease);
}
.skip-link:focus { top: 1rem; }

/* ---------- layout ---------- */
.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--pad);
}
.section { padding-block: clamp(3.5rem, 8vw, 6.5rem); }
.section-alt {
  background: var(--bg-alt);
  border-block: 1px solid var(--line);
}

/* ---------- type helpers ---------- */
.eyebrow {
  display: flex; align-items: center; gap: 0.6rem;
  font-size: 0.7rem; font-weight: 500;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1.4rem;
}
.eyebrow .idx {
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  font-weight: 600;
}
.eyebrow .dot {
  width: 6px; height: 6px; border-radius: 50%;
  align-self: flex-start; margin-top: 0.42em;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  flex: none;
}

.section-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.85rem, 4.2vw, 2.9rem);
  line-height: 1.12;
  letter-spacing: -0.015em;
  max-width: 22ch;
  text-wrap: balance;
}
.section-intro {
  margin-top: 1.15rem;
  max-width: 60ch;
  color: var(--ink-2);
  font-size: 1.02rem;
}
.section-head { margin-bottom: clamp(2.2rem, 5vw, 3.6rem); }
.section-head-row {
  display: flex; align-items: flex-end;
  justify-content: space-between; gap: 2rem; flex-wrap: wrap;
}
.section-head-row .section-intro { margin-bottom: 0; }

.sub-title {
  font-family: var(--sans);
  font-size: 0.7rem; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted);
  margin: 2.6rem 0 1.1rem;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.72rem 1.15rem;
  background: var(--ink); color: var(--bg);
  border: 1px solid var(--ink); border-radius: var(--radius);
  font-size: 0.86rem; font-weight: 500; line-height: 1;
  transition: transform 0.2s var(--ease), background 0.2s, border-color 0.2s, color 0.2s;
}
.btn:hover { background: var(--accent); border-color: var(--accent); color: #fff; transform: translateY(-1px); }
html[data-theme="dark"] .btn:hover { color: #06100f; }
.btn span[aria-hidden] { transition: transform 0.2s var(--ease); }
.btn:hover span[aria-hidden] { transform: translateX(2px); }
.btn-ghost {
  background: transparent; color: var(--ink);
  border-color: var(--line-strong);
}
.btn-ghost:hover { background: transparent; color: var(--accent); border-color: var(--accent); }
.btn-sm { padding: 0.58rem 0.95rem; font-size: 0.8rem; }

.text-link {
  font-size: 0.87rem; font-weight: 500;
  color: var(--accent);
  border-bottom: 1px solid currentColor;
  padding-bottom: 2px;
  white-space: nowrap;
  transition: opacity 0.2s;
}
.text-link:hover { opacity: 0.7; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s, background 0.25s;
}
.site-header.is-scrolled { border-bottom-color: var(--line); }
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1.5rem;
  height: 72px;
}
.brand { display: flex; align-items: center; gap: 0.7rem; }
.brand-mark {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  font-family: var(--serif);
  font-size: 0.85rem; letter-spacing: 0.02em;
  color: var(--accent);
  flex: none;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-family: var(--serif); font-size: 1rem; letter-spacing: -0.01em; }
.brand-sub {
  font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.18em;
  color: var(--muted); margin-top: 2px;
}

.nav { display: flex; align-items: center; gap: 1.75rem; }
.nav a {
  font-size: 0.83rem; font-weight: 450; color: var(--ink-2);
  position: relative; padding-block: 0.3rem;
  transition: color 0.2s;
}
.nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px;
  height: 1px; background: var(--accent);
  transform: scaleX(0); transform-origin: left;
  transition: transform 0.25s var(--ease);
}
.nav a:hover, .nav a.is-active { color: var(--ink); }
.nav a:hover::after, .nav a.is-active::after { transform: scaleX(1); }

.header-actions { display: flex; align-items: center; gap: 0.75rem; }
.theme-toggle {
  display: grid; place-items: center;
  width: 36px; height: 36px; padding: 0;
  background: transparent; border: 1px solid var(--line);
  border-radius: var(--radius); cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.theme-toggle:hover { border-color: var(--line-strong); color: var(--accent); }
.theme-toggle svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.theme-toggle .icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

.menu-toggle {
  display: none;
  width: 36px; height: 36px; padding: 0;
  background: transparent; border: 1px solid var(--line);
  border-radius: var(--radius); cursor: pointer;
  position: relative;
}
.menu-toggle span {
  position: absolute; left: 9px; right: 9px; height: 1.5px;
  background: var(--ink); transition: transform 0.25s var(--ease), opacity 0.2s;
}
.menu-toggle span:first-child { top: 13px; }
.menu-toggle span:last-child { bottom: 13px; }
.menu-toggle[aria-expanded="true"] span:first-child { top: 17px; transform: rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:last-child { bottom: 17px; transform: rotate(-45deg); }

.mobile-nav { display: none; }

/* ---------- hero ---------- */
.hero {
  padding-top: clamp(3rem, 7vw, 5.5rem);
  padding-bottom: clamp(3rem, 6vw, 4.5rem);
  position: relative;
}
.hero::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, var(--line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--line) 1px, transparent 1px);
  background-size: 80px 80px;
  opacity: 0.28;
  mask-image: radial-gradient(ellipse 80% 70% at 70% 20%, #000 0%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 70% 20%, #000 0%, transparent 75%);
  pointer-events: none;
}
.hero-grid {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
}
.hero-name {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.9rem, 7.4vw, 4.9rem);
  line-height: 0.98;
  letter-spacing: -0.03em;
  margin-bottom: 1.1rem;
}
.hero-name em { font-style: italic; color: var(--accent); }
.hero-role {
  font-size: 0.78rem; font-weight: 500;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 1.4rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.5rem;
  max-width: 34rem;
}
.hero-lead {
  font-size: clamp(1.02rem, 1.5vw, 1.12rem);
  color: var(--ink-2);
  max-width: 46ch;
  line-height: 1.7;
}
.hero-lead strong { color: var(--ink); font-weight: 500; }
.hero-links {
  display: flex; flex-wrap: wrap; gap: 0.65rem;
  margin-top: 1.9rem;
}
.hero-meta {
  display: flex; align-items: center; flex-wrap: wrap; gap: 0.6rem;
  margin-top: 1.8rem;
  font-size: 0.78rem; color: var(--muted);
}
.hero-meta .sep { width: 14px; height: 1px; background: var(--line-strong); }

.hero-figure { margin: 0; }
.viz {
  width: 100%; height: auto;
  overflow: visible;
}
.viz .viz-grid { stroke: var(--line); stroke-width: 1; }
.viz .viz-axis { stroke: var(--line-strong); stroke-width: 1; }
.viz .viz-hull { fill: var(--accent); fill-opacity: 0.05; stroke: var(--accent); stroke-width: 1; stroke-dasharray: 4 4; opacity: 0.55; }
.viz .viz-point { fill: var(--accent); opacity: 0; animation: pointIn 0.5s var(--ease) forwards; }
.viz .viz-point.p2 { fill: var(--gold); }
.viz .viz-point.p3 { fill: var(--ink-2); }
.viz .viz-link { stroke: var(--gold); stroke-width: 1.2; stroke-dasharray: 3 3; opacity: 0.9; }
.viz .viz-x { stroke: var(--gold); stroke-width: 1.4; }
.viz .viz-centroid { fill: none; stroke: var(--ink); stroke-width: 1.3; }
.viz .viz-centroid-dot { fill: var(--ink); }
.viz .viz-label {
  font-family: var(--sans); font-size: 8px; letter-spacing: 0.1em;
  fill: var(--muted); text-transform: uppercase;
}
@keyframes pointIn { from { opacity: 0; transform: scale(0.4); } to { opacity: 0.85; transform: scale(1); } }
.viz .viz-point { transform-box: fill-box; transform-origin: center; }
.hero-figure figcaption {
  margin-top: 1rem;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.55;
  padding-left: 0.9rem;
  border-left: 1px solid var(--line-strong);
  max-width: 40ch;
}
.fig-label {
  color: var(--accent); font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  margin-right: 0.35rem;
}

/* ---------- metrics ---------- */
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  margin-top: clamp(2.5rem, 6vw, 4rem);
  padding-top: 1.8rem;
  gap: 1.5rem;
}
.metric { position: relative; padding-right: 1rem; }
.metric + .metric { padding-left: 1.6rem; }
.metric + .metric::before {
  content: ""; position: absolute; left: 0; top: 0.2rem; bottom: 0.2rem;
  width: 1px; background: var(--line);
}
.metric dt {
  font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--muted); margin-bottom: 0.45rem;
}
.metric dd {
  font-family: var(--serif);
  font-size: clamp(1.9rem, 3.4vw, 2.6rem);
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  display: flex; align-items: baseline;
}
.metric dd .plus { font-size: 0.6em; color: var(--accent); margin-left: 2px; }
.metric .metric-sub {
  font-family: var(--sans);
  font-size: 0.75rem; color: var(--muted);
  margin-top: 0.35rem; line-height: 1.4;
  display: block; letter-spacing: 0;
}

/* ---------- themes ---------- */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}
.theme-card {
  padding: clamp(1.5rem, 3vw, 2.2rem);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  position: relative;
  transition: background 0.3s var(--ease);
}
.theme-card:hover { background: var(--bg-elev); }
.theme-num {
  font-family: var(--serif);
  font-size: 0.8rem;
  color: var(--accent);
  letter-spacing: 0.05em;
}
.theme-card h3 {
  font-family: var(--serif);
  font-size: clamp(1.3rem, 2vw, 1.6rem);
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0.55rem 0 0.7rem;
}
.theme-card p { color: var(--ink-2); font-size: 0.92rem; max-width: 42ch; }

.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 1.2rem; }
.tags li {
  font-size: 0.66rem; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 0.24rem 0.5rem;
  line-height: 1.2;
}

/* ---------- doctorate ---------- */
.doctorate {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}
.thesis-label {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--accent); margin-bottom: 0.9rem;
}
.thesis {
  font-family: var(--serif);
  font-size: clamp(1.45rem, 2.8vw, 2rem);
  line-height: 1.25;
  letter-spacing: -0.015em;
  font-weight: 400;
  margin-bottom: 1.6rem;
  padding-left: 1.4rem;
  border-left: 2px solid var(--accent);
  text-wrap: balance;
}
.doctorate-main p:not(.thesis):not(.thesis-label) {
  color: var(--ink-2);
  font-size: 0.98rem;
  max-width: 58ch;
  margin-bottom: 1rem;
}
.thesis-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}
.thesis-meta span {
  display: block;
  font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.13em;
  color: var(--muted); margin-bottom: 0.35rem;
}
.thesis-meta p { font-size: 0.82rem; line-height: 1.45; color: var(--ink); }

.algorithm-panel {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.4rem, 3vw, 1.9rem);
  box-shadow: var(--shadow);
}
.panel-title {
  font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.15em;
  color: var(--muted); margin-bottom: 1.1rem;
}
.algo-list { display: flex; flex-direction: column; gap: 0; }
.algo-list li {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
}
.algo-list li:last-child { border-bottom: 0; }
.algo-name { font-family: var(--serif); font-size: 1rem; }
.algo-note { font-size: 0.7rem; color: var(--muted); text-align: right; }
.algo-list .is-proposed {
  background: var(--accent-soft);
  margin-inline: -0.9rem;
  padding-inline: 0.9rem;
  border-bottom-color: transparent;
}
.algo-list .is-proposed .algo-name { color: var(--accent); font-weight: 500; }
.algo-list .is-proposed .algo-note { color: var(--accent); }
.panel-foot {
  margin-top: 1.1rem; padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-size: 0.76rem; color: var(--muted); line-height: 1.55;
}

/* ---------- publications ---------- */
.pub-list { border-top: 1px solid var(--line); }
.pub {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr) auto;
  gap: 1.5rem;
  padding: 1.6rem 0;
  border-bottom: 1px solid var(--line);
  transition: background 0.25s;
}
.pub-year {
  font-family: var(--serif);
  font-size: 0.95rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  padding-top: 0.22rem;
}
.pub-body h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.08rem, 1.8vw, 1.28rem);
  line-height: 1.35;
  letter-spacing: -0.008em;
  margin-bottom: 0.45rem;
  max-width: 58ch;
  text-wrap: pretty;
}
.pub-authors { font-size: 0.82rem; color: var(--ink-2); margin-bottom: 0.25rem; }
.pub-authors strong { color: var(--ink); font-weight: 600; }
.pub-venue { font-size: 0.82rem; color: var(--muted); font-style: italic; }
.pub-links { margin-top: 0.5rem; font-size: 0.78rem; }
.pub-links a { color: var(--accent); border-bottom: 1px solid transparent; }
.pub-links a:hover { border-bottom-color: var(--accent); }
.pub-type {
  font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 0.22rem 0.45rem;
  height: fit-content;
  white-space: nowrap;
  margin-top: 0.25rem;
}

/* ---------- projects ---------- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.project-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.4rem, 2.6vw, 1.9rem);
  display: flex; flex-direction: column;
  transition: border-color 0.25s, transform 0.25s var(--ease), box-shadow 0.25s;
}
.project-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.project-card-wide { grid-column: span 2; }
.project-top {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; flex-wrap: nowrap;
  align-items: baseline;
  margin-bottom: 0.7rem;
}
.project-card h3 { flex: 1 1 auto; min-width: 0; }
.project-card .status { flex: 0 0 auto; }
.project-num {
  flex: 0 0 auto;
  font-family: var(--serif);
  font-size: 0.82rem;
  line-height: 1;
  color: var(--accent);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}
.project-card h3 {
  font-family: var(--serif);
  font-size: clamp(1.2rem, 2vw, 1.45rem);
  font-weight: 500;
  letter-spacing: -0.01em;
}
.project-card p { font-size: 0.88rem; color: var(--ink-2); max-width: 60ch; }
.project-card .tags { margin-top: auto; padding-top: 1.2rem; }
.status {
  font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.09em;
  padding: 0.26rem 0.5rem; border-radius: 2px;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
  background: var(--bg);
}
.status-live { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, transparent); background: var(--accent-soft); }
.status-pilot { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 35%, transparent); background: var(--gold-soft); }
.status-award { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 35%, transparent); background: var(--gold-soft); }

.project-card-wide {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  column-gap: clamp(1.5rem, 4vw, 3rem);
  align-items: start;
}
.project-card-wide .project-top,
.project-card-wide > p,
.project-card-wide .tags { grid-column: 1; }
.project-card-wide .tags { align-self: end; }
.project-spec {
  grid-column: 2;
  grid-row: 1 / span 3;
  border-left: 1px solid var(--line);
  padding-left: clamp(1.2rem, 3vw, 1.8rem);
  align-self: stretch;
}
.project-spec div { padding: 0.55rem 0; border-bottom: 1px solid var(--line); }
.project-spec div:first-child { padding-top: 0; }
.project-spec div:last-child { border-bottom: 0; }
.project-spec dt {
  font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.11em;
  color: var(--faint); margin-bottom: 0.15rem;
}
.project-spec dd { font-size: 0.8rem; color: var(--ink-2); line-height: 1.4; }

/* ---------- awards ---------- */
.award-list { border-top: 1px solid var(--line); }
.award-list li {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr);
  gap: 1.5rem;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--line);
  align-items: baseline;
}
.award-year {
  font-family: var(--serif);
  font-size: 0.95rem; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.award-title {
  font-size: 0.94rem; line-height: 1.5;
  display: flex; align-items: baseline; gap: 0.55rem;
  flex-wrap: wrap;
}
.award-event { font-size: 0.78rem; color: var(--muted); margin-top: 0.2rem; }
.medal {
  width: 7px; height: 7px; border-radius: 50%;
  flex: none; display: inline-block;
  transform: translateY(-1px);
}
.medal-gold { background: #c08a2e; box-shadow: 0 0 0 3px rgba(192, 138, 46, 0.14); }
.medal-silver { background: #8e979c; box-shadow: 0 0 0 3px rgba(142, 151, 156, 0.14); }
.medal-bronze { background: #a4693f; box-shadow: 0 0 0 3px rgba(164, 105, 63, 0.14); }
.medal-paper { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- about ---------- */
.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: clamp(2.5rem, 6vw, 5rem);
  align-items: start;
}
.about-lead {
  font-family: var(--serif);
  font-size: clamp(1.2rem, 2.1vw, 1.45rem);
  line-height: 1.5;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-bottom: 1.2rem;
}
.about-copy > p:not(.about-lead) { color: var(--ink-2); font-size: 0.95rem; max-width: 56ch; }

.edu-list { border-top: 1px solid var(--line); }
.edu-list li { padding: 1.1rem 0; border-bottom: 1px solid var(--line); }
.edu-degree { font-size: 0.92rem; font-weight: 500; }
.edu-school { font-size: 0.8rem; color: var(--muted); margin-top: 0.15rem; }
.edu-thesis { font-size: 0.8rem; color: var(--ink-2); margin-top: 0.35rem; font-style: italic; max-width: 55ch; }

.about-side { display: flex; flex-direction: column; gap: 1.9rem; }
.side-block h3 {
  font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--muted); margin-bottom: 0.8rem;
  padding-bottom: 0.6rem; border-bottom: 1px solid var(--line);
}
.plain-list li {
  font-size: 0.83rem; color: var(--ink-2);
  padding: 0.45rem 0;
  display: grid; grid-template-columns: 5.5rem minmax(0, 1fr);
  gap: 0.8rem;
  line-height: 1.45;
}
.plain-list li span {
  font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--faint); padding-top: 0.12rem;
}
.profile-list li {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; padding: 0.42rem 0;
  font-size: 0.85rem;
  border-bottom: 1px dotted var(--line);
}
.profile-list li:last-child { border-bottom: 0; }
.profile-list a { color: var(--ink); transition: color 0.2s; }
.profile-list a:hover { color: var(--accent); }
.profile-id { font-size: 0.7rem; color: var(--faint); white-space: nowrap; }

/* ---------- contact ---------- */
.contact {
  padding-block: clamp(3.5rem, 8vw, 6rem);
  border-top: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}
.contact::after {
  content: "";
  position: absolute; right: -8%; top: 50%; transform: translateY(-50%);
  width: 380px; height: 380px; border-radius: 50%;
  background: radial-gradient(circle, var(--accent-soft) 0%, transparent 68%);
  pointer-events: none;
}
.contact-inner {
  position: relative; z-index: 1;
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 2.5rem; flex-wrap: wrap;
}
.contact-title {
  font-family: var(--serif);
  font-size: clamp(1.9rem, 4.4vw, 3rem);
  font-weight: 400; line-height: 1.1;
  letter-spacing: -0.02em;
  max-width: 18ch;
  text-wrap: balance;
}
.contact-copy { margin-top: 1rem; color: var(--ink-2); font-size: 0.92rem; max-width: 44ch; }
.contact-mail {
  font-family: var(--serif);
  font-size: clamp(1.15rem, 2.6vw, 1.7rem);
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 0.3rem;
  display: inline-flex; align-items: center; gap: 0.6rem;
  transition: color 0.25s, border-color 0.25s, gap 0.25s var(--ease);
}
.contact-mail:hover { color: var(--accent); border-color: var(--accent); gap: 1rem; }

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding-top: 2.5rem;
  background: var(--bg);
}
.footer-inner {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 2rem; flex-wrap: wrap;
  padding-bottom: 2rem;
}
.footer-name { font-family: var(--serif); font-size: 1.02rem; }
.footer-note { font-size: 0.75rem; color: var(--muted); margin-top: 0.2rem; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 1.4rem; }
.footer-nav a { font-size: 0.78rem; color: var(--muted); transition: color 0.2s; }
.footer-nav a:hover { color: var(--accent); }
.footer-base {
  display: flex; justify-content: space-between; gap: 1rem;
  padding-top: 1.1rem; padding-bottom: 1.6rem;
  border-top: 1px solid var(--line);
  font-size: 0.7rem; color: var(--faint);
}

/* ---------- reveal ---------- */
html.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
html.js .reveal.is-visible { opacity: 1; transform: none; }
html:not(.js) .reveal { opacity: 1; transform: none; }

/* ---------- publications page ---------- */
[hidden] { display: none !important; }

.page-head {
  padding-top: clamp(2.4rem, 5vw, 3.6rem);
  padding-bottom: clamp(2rem, 4vw, 3rem);
  border-bottom: 1px solid var(--line);
}
.back-link { display: inline-block; color: var(--muted); border-bottom-color: transparent; }
.back-link:hover { color: var(--accent); border-bottom-color: currentColor; }
.eyebrow-spaced { margin-top: 1.7rem; }
.page-title {
  font-family: var(--serif);
  font-size: clamp(2.4rem, 6vw, 3.8rem);
  font-weight: 400; line-height: 1;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
}
.page-title em { font-style: italic; color: var(--accent); }
.page-intro { max-width: 62ch; color: var(--ink-2); font-size: 0.98rem; }

.pub-tools {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  padding-block: 1.5rem;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 72px;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 40;
}
.filters { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.filter {
  background: transparent; border: 1px solid var(--line);
  border-radius: 2px; padding: 0.4rem 0.7rem;
  font-size: 0.75rem; color: var(--muted);
  cursor: pointer; transition: all 0.2s;
  display: inline-flex; align-items: center; gap: 0.4rem;
}
.filter:hover { border-color: var(--line-strong); color: var(--ink); }
.filter[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.filter .count { font-size: 0.62rem; color: var(--faint); font-variant-numeric: tabular-nums; }
.filter[aria-pressed="true"] .count { color: inherit; opacity: 0.7; }
.search-wrap { position: relative; min-width: 210px; }
.search-wrap svg {
  position: absolute; left: 0.7rem; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px; stroke: var(--muted); fill: none; stroke-width: 1.7;
  pointer-events: none;
}
#pub-search {
  width: 100%; padding: 0.5rem 0.7rem 0.5rem 2rem;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 2px;
  font-size: 0.8rem; color: var(--ink);
  font-family: var(--sans);
}
#pub-search:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }

.pub-group { padding-top: 2.5rem; }
.pub-group-title {
  display: flex; align-items: baseline; gap: 0.8rem;
  font-family: var(--serif); font-weight: 400;
  font-size: 1.5rem; letter-spacing: -0.01em;
  margin-bottom: 1.2rem;
}
.pub-group-title .count {
  font-size: 0.68rem; font-family: var(--sans); color: var(--muted);
  letter-spacing: 0.1em; text-transform: uppercase;
}
.pub-empty { padding: 3rem 0; color: var(--muted); font-size: 0.9rem; }
.pub-count {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--faint);
  padding-top: 1.2rem;
}
.pub-footnote {
  margin-top: 3rem; padding: 1.4rem 0 3.5rem;
  border-top: 1px solid var(--line);
  font-size: 0.78rem; color: var(--muted); max-width: 70ch;
}
.pub-footnote a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; text-decoration-color: var(--line-strong); }
.pub-footnote a:hover { text-decoration-color: currentColor; }
.pub-item {
  display: grid;
  grid-template-columns: 4rem minmax(0, 1fr);
  gap: 1.4rem;
  padding: 1.4rem 0;
  border-bottom: 1px solid var(--line);
}
.pub-item .yr {
  font-family: var(--serif); color: var(--muted); font-size: 0.9rem;
  font-variant-numeric: tabular-nums; padding-top: 0.2rem;
}
.pub-item h3 {
  font-family: var(--serif); font-weight: 500;
  font-size: 1.08rem; line-height: 1.4;
  margin-bottom: 0.4rem; max-width: 62ch;
}
.pub-item .authors { font-size: 0.82rem; color: var(--ink-2); }
.pub-item .authors b { font-weight: 600; color: var(--ink); }
.pub-item .venue { font-size: 0.8rem; color: var(--muted); font-style: italic; margin-top: 0.15rem; }
.pub-item .links { margin-top: 0.4rem; font-size: 0.78rem; display: flex; gap: 1rem; flex-wrap: wrap; }
.pub-item .links a { color: var(--accent); }
.pub-item .links a:hover { text-decoration: underline; text-underline-offset: 2px; }
.pub-item .links .tag {
  font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--gold);
}

/* ---------- 404 ---------- */
.notfound {
  min-height: 62vh; display: grid; place-items: center;
  text-align: center; padding-block: 4rem;
}
.notfound .code {
  font-family: var(--serif); font-size: clamp(4rem, 14vw, 9rem);
  line-height: 1; color: var(--accent); opacity: 0.9;
}
.notfound h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(1.6rem, 4vw, 2.3rem); margin: 0.6rem 0 0.8rem; }
.notfound p { color: var(--muted); margin-bottom: 1.6rem; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; gap: 2.5rem; }
  .hero-figure { max-width: 460px; }
  .doctorate { grid-template-columns: 1fr; }
  .about-grid { grid-template-columns: 1fr; }
  .nav { display: none; }
  .menu-toggle { display: block; }
  .mobile-nav {
    display: flex; flex-direction: column;
    position: absolute; top: 72px; left: 0; right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    padding: 0 var(--pad) 1.2rem;
    gap: 0;
    max-height: 0; overflow: hidden; opacity: 0;
    transition: max-height 0.3s var(--ease), opacity 0.2s;
    pointer-events: none;
  }
  .mobile-nav.is-open { max-height: 420px; opacity: 1; pointer-events: auto; }
  .mobile-nav a {
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--line);
    font-size: 0.92rem;
  }
  .mobile-nav a:last-child { border-bottom: 0; color: var(--accent); }
  .pub-tools { top: 72px; }
}

@media (max-width: 760px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.6rem 1rem; }
  .metric { padding-right: 0; }
  .metric + .metric { padding-left: 0; }
  .metric + .metric::before { display: none; }
  .metric:nth-child(even) { padding-left: 1.3rem; border-left: 1px solid var(--line); }
  .theme-grid { grid-template-columns: 1fr; }
  .project-grid { grid-template-columns: 1fr; }
  .project-card-wide { grid-column: span 1; display: flex; }
  .project-spec {
    grid-column: auto; grid-row: auto;
    border-left: 0; padding-left: 0;
    margin-top: 1.2rem; border-top: 1px solid var(--line); padding-top: 0.4rem;
  }
  .project-top { flex-wrap: wrap; }
  .thesis-meta { grid-template-columns: 1fr; gap: 1rem; }
  .pub { grid-template-columns: 3.4rem minmax(0, 1fr); gap: 1rem; }
  .pub-type { grid-column: 2; justify-self: start; margin-top: -0.4rem; }
  .pub-item { grid-template-columns: 3rem minmax(0, 1fr); gap: 0.9rem; }
  .award-list li { grid-template-columns: 3.4rem minmax(0, 1fr); gap: 1rem; }
  .contact-inner { align-items: flex-start; }
  .footer-inner { flex-direction: column; gap: 1.2rem; }
  .footer-base { flex-direction: column; gap: 0.4rem; }
  .header-actions .btn-sm { display: none; }
  .pub-tools { position: static; }
}

@media (max-width: 420px) {
  .brand-text { display: none; }
  .hero-meta { flex-direction: column; align-items: flex-start; gap: 0.3rem; }
  .hero-meta .sep { display: none; }
}

/* ---------- motion / print ---------- */
@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;
  }
  .reveal { opacity: 1; transform: none; }
  .viz .viz-point { opacity: 0.85; }
}

@media print {
  .site-header, .contact, .site-footer, .hero-links, .theme-toggle, .mobile-nav { display: none; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .section, .hero { padding-block: 1rem; }
  .reveal { opacity: 1; transform: none; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 8pt; color: #555; }
  .project-card, .algorithm-panel { box-shadow: none; break-inside: avoid; }
}
