/* =========================================================
   Design tokens — light by default, dark via [data-theme]
   ========================================================= */
:root {
  --bg: #fbfcfc;
  --surface: #ffffff;
  --surface-2: #f1f5f6;
  --text: #15232b;
  --text-muted: #5b6b74;
  --border: #dde5e8;
  --accent: #0b6e8a;          /* deep water blue-teal */
  --accent-strong: #08566c;
  --accent-soft: #e2f1f5;
  --gold: #b8860b;
  --silver: #7a8590;
  --bronze: #a0623a;
  --water-grad: linear-gradient(135deg, #0b6e8a 0%, #2b9db8 55%, #8fd3df 100%);

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgb(16 40 50 / 6%), 0 4px 16px rgb(16 40 50 / 6%);
  --max: 960px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0d1519;
  --surface: #131e23;
  --surface-2: #1a272d;
  --text: #e4ecef;
  --text-muted: #93a4ab;
  --border: #25353c;
  --accent: #5cc0d8;
  --accent-strong: #86d4e6;
  --accent-soft: #15323b;
  --gold: #e3b341;
  --silver: #b5c0c8;
  --bronze: #d0895c;
  --water-grad: linear-gradient(135deg, #0a4a5c 0%, #136f86 55%, #3aa7bf 100%);
  --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 4px 16px rgb(0 0 0 / 25%);
  color-scheme: dark;
}

/* =========================================================
   Base
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

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

h1, h2, h3 { line-height: 1.25; letter-spacing: -0.02em; margin: 0 0 0.5em; }
h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); font-weight: 700; }
h2 { font-size: 1.35rem; font-weight: 650; }
h3 { font-size: 1.05rem; font-weight: 600; }
p { margin: 0 0 1em; }

code {
  font-size: 0.9em;
  background: var(--surface-2);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

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

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding-inline: 1.25rem; }
main.container { padding-block: 2.5rem 4rem; }

.muted { color: var(--text-muted); }
.block { display: block; }
.nowrap { white-space: nowrap; }
.tabular { font-variant-numeric: tabular-nums; }
.lead { font-size: 1.15rem; color: var(--text-muted); max-width: 60ch; }
.eyebrow {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.skip-link { position: absolute; left: -999px; top: 0; }
.skip-link:focus { left: 1rem; top: 1rem; z-index: 100; background: var(--surface); padding: 0.5rem 1rem; }

/* =========================================================
   Header & footer
   ========================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 60px; gap: 1rem; }

.brand { font-weight: 700; color: var(--text); text-decoration: none; letter-spacing: -0.01em; }
.brand:hover { color: var(--accent); }

.site-nav { display: flex; align-items: center; gap: 0.25rem; }
.site-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.93rem;
  font-weight: 500;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-sm);
}
.site-nav a:hover { color: var(--text); background: var(--surface-2); }
.site-nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }

.theme-toggle, .nav-toggle {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font: inherit;
}
.theme-toggle { width: 36px; height: 36px; display: grid; place-items: center; margin-left: 0.5rem; }
.theme-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

.nav-toggle { display: none; padding: 0.4rem 0.8rem; font-size: 0.9rem; }

@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    padding: 0.75rem 1.25rem 1rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
  }
  .site-nav.is-open { display: flex; }
  .site-nav a { padding: 0.6rem 0.75rem; }
  .theme-toggle { margin: 0.5rem 0 0; }
}

.site-footer { border-top: 1px solid var(--border); color: var(--text-muted); font-size: 0.88rem; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 1.5rem; padding-block: 1.5rem; }
.footer-inner p { margin: 0; }
.footer-links { display: flex; flex-wrap: wrap; gap: 1rem; }
.footer-links a { color: var(--text-muted); text-decoration: none; }
.footer-links a:hover { color: var(--accent); }

/* =========================================================
   Shared components
   ========================================================= */
.page-header { margin-bottom: 2rem; }

.pill-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.25rem; }
.pill {
  display: inline-block;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}
.pill:hover { border-color: var(--accent); color: var(--accent); }
.pill--accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.pill--accent:hover { background: var(--accent-strong); color: #fff; }
[data-theme="dark"] .pill--accent, [data-theme="dark"] .pill--accent:hover { color: #0d1519; }

.link-buttons { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.6rem; }
.btn-small {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  text-decoration: none;
}
.btn-small:hover { color: var(--accent); border-color: var(--accent); }

.filter-bar { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1.5rem; }
.filter-bar button {
  font: inherit;
  font-size: 0.85rem;
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
}
.filter-bar button:hover { color: var(--text); }
.filter-bar button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
[data-theme="dark"] .filter-bar button[aria-pressed="true"] { color: #0d1519; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.25rem; }
.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.card[hidden] { display: none; }

/* Whole card is clickable: the title link's ::after stretches over the card.
   Extra link buttons sit above it so they stay separately clickable. */
.card--link { position: relative; transition: transform 0.15s ease, border-color 0.15s ease; }
.card--link:hover { transform: translateY(-2px); border-color: var(--accent); }
.card-link { color: inherit; text-decoration: none; }
.card-link::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.card-link:focus-visible { outline: none; }
.card--link:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.card-arrow { color: var(--text-muted); font-weight: 400; transition: color 0.15s ease; }
.card--link:hover h3, .card--link:hover .card-arrow { color: var(--accent); }
.card--link .link-buttons { position: relative; z-index: 2; }
.card-media { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--surface-2); }
.card-media--4x3 { aspect-ratio: 4 / 3; }
.card-media--placeholder {
  display: grid;
  place-items: center;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
}
.card-media--water { background: var(--water-grad); }
.card-body { padding: 1rem 1.15rem 1.15rem; display: flex; flex-direction: column; flex: 1; }
.card-body p { font-size: 0.93rem; margin-bottom: 0.6rem; }
.card-body .link-buttons { margin-top: auto; padding-top: 0.4rem; }

.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 0.35rem; padding: 0; margin: 0 0 0.6rem; }
.tags li {
  font-size: 0.75rem;
  padding: 0.1rem 0.5rem;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent-strong);
}
.tags .tag-year { background: var(--surface-2); color: var(--text-muted); }

.empty-note {
  padding: 1.5rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  text-align: center;
}

/* =========================================================
   Home
   ========================================================= */
.hero { display: flex; gap: 2rem; align-items: center; padding-block: 1.5rem 2rem; }
.hero-photo { flex: 0 0 auto; }
.hero-photo img, .avatar-initials {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 4px var(--bg), 0 0 0 6px var(--accent-soft);
}
.avatar-initials {
  display: grid;
  place-items: center;
  font-size: 2.8rem;
  font-weight: 700;
  color: #fff;
  background: var(--water-grad);
}
.hero h1 { margin-bottom: 0.4rem; }

@media (max-width: 640px) {
  .hero { flex-direction: column; align-items: flex-start; gap: 1.25rem; }
  .hero-photo img, .avatar-initials { width: 110px; height: 110px; font-size: 2rem; }
}

.prose { max-width: 68ch; font-size: 1.05rem; }
.about { max-width: none; padding-bottom: 1rem; }
.home-section { margin-top: 3rem; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: 1rem; }
.section-head h2 { margin: 0; }
.more { font-size: 0.9rem; font-weight: 500; text-decoration: none; white-space: nowrap; }


/* =========================================================
   Publications
   ========================================================= */
.pub-year { margin-bottom: 2rem; }
.pub-year[hidden] { display: none; }
.pub-year h2 { font-size: 1rem; color: var(--text-muted); border-bottom: 1px solid var(--border); padding-bottom: 0.4rem; }

.pub-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.25rem; }
.pub {
  position: relative;
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 1rem;
  align-items: start;
  padding: 0.85rem 1rem;
  margin-inline: -1rem; /* keeps text aligned with headings; padding is only for the hover background */
  border-radius: var(--radius);
  transition: background-color 0.15s ease;
}

/* Whole card is clickable: the title link's ::after stretches over the card */
.pub--link:hover { background: var(--surface-2); }
.pub-link { color: inherit; text-decoration: none; }
.pub-link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.pub-link:focus-visible { outline: none; }
.pub--link:focus-within { outline: 2px solid var(--accent); outline-offset: -2px; }
.pub-arrow { color: var(--text-muted); font-weight: 400; transition: color 0.15s ease; }
.pub--link:hover .pub-title, .pub--link:hover .pub-arrow { color: var(--accent); }
.pub[hidden] { display: none; }
.pub p { margin: 0; }
.pub-title { font-weight: 600; }
.pub-authors, .pub-venue { font-size: 0.92rem; color: var(--text-muted); }
.pub-authors strong { color: var(--text); }
.pub-venue { font-style: italic; }

.pub-type {
  justify-self: start;
  margin-top: 0.15rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text-muted);
}
.pub-type--journal { background: var(--accent-soft); color: var(--accent-strong); }
.pub-type--conference { background: color-mix(in srgb, var(--gold) 16%, transparent); color: var(--gold); }
.pub-type--patent { background: color-mix(in srgb, var(--bronze) 16%, transparent); color: var(--bronze); }

@media (max-width: 560px) {
  .pub { grid-template-columns: 1fr; gap: 0.35rem; }
}

/* =========================================================
   Career timeline
   ========================================================= */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before {
  content: "";
  position: absolute;
  left: 9.5rem;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 2px;
  background: linear-gradient(var(--accent), var(--border));
}
.timeline-item { display: grid; grid-template-columns: 8.5rem 1fr; gap: 2.5rem; position: relative; padding-bottom: 2rem; }
.timeline-item::before {
  content: "";
  position: absolute;
  left: calc(9.5rem - 6px);
  top: 0.45rem;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--accent);
}
.timeline-item--education::before { border-color: var(--gold); }
.timeline-date { text-align: right; font-size: 0.9rem; font-weight: 600; color: var(--text-muted); padding-top: 0.15rem; font-variant-numeric: tabular-nums; }
.timeline-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow);
}
.timeline-card h2 { font-size: 1.1rem; margin-bottom: 0.15rem; }
.timeline-card p:last-child, .timeline-card ul:last-child { margin-bottom: 0; }
.timeline-card ul { padding-left: 1.2rem; font-size: 0.95rem; }
.timeline-org { color: var(--text-muted); font-size: 0.93rem; }
.timeline-kind { float: right; font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); }
.timeline-item--education .timeline-kind { color: var(--gold); }

.career-layout { display: grid; grid-template-columns: minmax(0, 1fr) 15rem; gap: 2.5rem; align-items: start; }
.career-aside { position: sticky; top: 80px; display: flex; flex-direction: column; gap: 1.25rem; }
.career-aside .pill { text-align: center; }
.certs {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow);
}
.certs h2 {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.75rem;
}
.certs ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.75rem; font-size: 0.93rem; }
.certs li { padding-left: 0.9rem; border-left: 2px solid var(--accent-soft); line-height: 1.45; }

@media (max-width: 900px) {
  .career-layout { grid-template-columns: 1fr; }
  .career-aside { position: static; order: -1; }
  .career-aside .pill { align-self: flex-start; }
}

@media (max-width: 640px) {
  .timeline::before { left: 6px; }
  .timeline-item { grid-template-columns: 1fr; gap: 0.4rem; padding-left: 2rem; }
  .timeline-item::before { left: 0; }
  .timeline-date { text-align: left; }
}

/* =========================================================
   Beyond Work
   ========================================================= */
.bw-section { margin-bottom: 3.5rem; }

.pano-grid { display: grid; gap: 1.5rem; }
.pano { margin: 0; }
.pano-viewer {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 70vh;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--water-grad);
}
.pano figcaption { display: flex; flex-direction: column; gap: 0.1rem; margin-top: 0.6rem; font-size: 0.93rem; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin: 0 0 1.5rem; }
.stats div { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; text-align: center; }
.stats dt { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.stats dd { margin: 0.2rem 0 0; font-size: 1.8rem; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .stats { grid-template-columns: repeat(2, 1fr); } }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.results { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
.results th, .results td { padding: 0.7rem 1rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.results th { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); background: var(--surface-2); }
.results tbody tr:last-child td { border-bottom: 0; }
.results tbody tr:hover { background: var(--surface-2); }
.results .block { font-size: 0.85rem; }

/* Event level badges (national / state) and short notes in the results table */
.level {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.45rem;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  vertical-align: 0.1em;
  white-space: nowrap;
}
.level--national { background: color-mix(in srgb, var(--gold) 18%, transparent); color: var(--gold); }
.level--state { background: var(--accent-soft); color: var(--accent-strong); }
.race-note { font-style: italic; color: var(--accent); }

.place {
  display: inline-grid;
  place-items: center;
  min-width: 1.7rem;
  height: 1.7rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.place--1 { background: var(--gold); color: #fff; }
.place--2 { background: var(--silver); color: #fff; }
.place--3 { background: var(--bronze); color: #fff; }
[data-theme="dark"] .place--1, [data-theme="dark"] .place--2, [data-theme="dark"] .place--3 { color: #0d1519; }
