:root {
  --page-bg: #0f0f0f;
  --surface: #171717;
  --text: #d4d4d4;
  --text-bright: #f0f0f0;
  --muted: #888;
  --accent: #7eb8da;
  --accent-strong: #5a9fc4;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);
  --radius: 4px;
}

:root[data-theme="light"],
body.theme-light {
  --page-bg: #fafafa;
  --surface: #ffffff;
  --text: #1a1a1a;
  --text-bright: #000;
  --muted: #666;
  --accent: #2980b9;
  --accent-strong: #1a6da0;
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.15);
}

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

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  background: var(--page-bg);
  line-height: 1.7;
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover,
a:focus-visible {
  text-decoration: underline;
}

h1,
h2,
h3 {
  font-family: 'Source Serif 4', Georgia, serif;
  margin: 0 0 0.5em;
  line-height: 1.25;
  color: var(--text-bright);
}

p {
  margin: 0 0 1em;
}

/* ------------------------------------------------------------------ */
/* Hero                                                               */
/* ------------------------------------------------------------------ */

header.hero {
  max-width: 960px;
  margin: 0 auto;
  padding: clamp(3rem, 6vw, 5rem) clamp(1.5rem, 4vw, 3rem) 2rem;
}

.hero__content {
  display: grid;
  gap: clamp(2rem, 4vw, 3rem);
  grid-template-columns: 1fr auto;
  align-items: start;
}

.eyebrow {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  color: var(--muted);
  margin-bottom: 1rem;
}

.hero h1 {
  font-size: clamp(2.4rem, 5vw, 3.2rem);
  margin-bottom: 0.3em;
}

.lead {
  font-size: clamp(1rem, 1.3vw, 1.1rem);
  color: var(--muted);
  margin-bottom: 2rem;
  max-width: 540px;
}

/* CTA buttons */

.cta-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 2rem;
  align-items: stretch;
}

.cta-stack {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  align-items: flex-start;
}

.cta-note {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  opacity: 0.7;
}

.cta-note[aria-hidden="true"] {
  visibility: hidden;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  background: var(--accent);
  color: #0f0f0f;
  border: none;
  transition: opacity 0.15s ease;
}

.btn:hover,
.btn:focus-visible {
  opacity: 0.85;
  text-decoration: none;
}

.btn.is-loading {
  background: var(--border-strong);
  color: var(--muted);
  cursor: wait;
}

.btn.is-loading:hover,
.btn.is-loading:focus-visible {
  opacity: 1;
}

.btn[aria-disabled="true"] {
  pointer-events: none;
}

.btn.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-strong);
}

.btn.ghost:hover,
.btn.ghost:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  opacity: 1;
}

/* Quick-links (email, signal, orcid) */

.quick-links {
  display: grid;
  gap: 0.6rem;
  margin: 0;
}

.quick-links div {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  font-size: 0.9rem;
}

.quick-links dt {
  min-width: 70px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 0.72rem;
}

.quick-links dd {
  margin: 0;
}

.mono {
  font-family: 'JetBrains Mono', 'Fira Mono', Menlo, Monaco, Consolas, monospace;
  letter-spacing: 0.02em;
  font-size: 0.88em;
}

/* Portrait */

.hero__portrait {
  margin: 0;
  text-align: center;
}

.hero__portrait img {
  width: clamp(180px, 22vw, 240px);
  aspect-ratio: 1;
  border-radius: var(--radius);
  object-fit: cover;
  border: 1px solid var(--border);
  filter: grayscale(15%);
}

.hero__portrait figcaption {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 0.75rem;
}

/* Nav */

.hero__nav {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
  margin-top: 1rem;
}

.hero__nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  padding: 0;
  margin: 0;
  justify-content: center;
}

.hero__nav a {
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.15s ease;
}

.hero__nav a:hover,
.hero__nav a:focus-visible {
  color: var(--accent);
  text-decoration: none;
}

/* ------------------------------------------------------------------ */
/* Main / Sections                                                    */
/* ------------------------------------------------------------------ */

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 clamp(1.5rem, 4vw, 3rem) clamp(4rem, 8vw, 6rem);
  display: grid;
  gap: 0;
}

.section {
  padding: clamp(2.5rem, 4vw, 3.5rem) 0;
  border-top: 1px solid var(--border);
}

.section:first-child {
  border-top: none;
}

.section__label {
  display: inline-block;
  padding: 0.25rem 0.7rem;
  border-radius: var(--radius);
  background: rgba(126, 184, 218, 0.1);
  color: var(--accent);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 1.25rem;
}

.section h2 {
  font-size: clamp(1.6rem, 3vw, 2rem);
  margin-bottom: 1rem;
}

/* ------------------------------------------------------------------ */
/* Profile highlights                                                 */
/* ------------------------------------------------------------------ */

.highlights {
  display: grid;
  gap: 1.5rem;
  margin-top: 2rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.highlights article {
  padding: 1.25rem;
  border-left: 2px solid var(--accent);
}

.highlights h3 {
  font-size: 1rem;
  margin-bottom: 0.3rem;
}

.highlights article p {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0;
}

/* ------------------------------------------------------------------ */
/* Two-column grid & cards                                            */
/* ------------------------------------------------------------------ */

.grid.two-column {
  display: grid;
  gap: clamp(1.5rem, 3vw, 2rem);
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.icon-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.7rem;
}

.icon-list li {
  position: relative;
  padding-left: 1.4rem;
  color: var(--text);
  font-size: 0.95rem;
}

.icon-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.6rem;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.cards article {
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.cards ul {
  margin: 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 0.3rem;
  font-size: 0.95rem;
}

.project-cards article h3 {
  font-size: 1.05rem;
}

.project-cards article p {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0;
}

/* ------------------------------------------------------------------ */
/* Timeline (publications)                                            */
/* ------------------------------------------------------------------ */

.timeline {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
  display: grid;
  gap: 1.5rem;
  position: relative;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0.5rem;
  top: 0.4rem;
  bottom: 0.4rem;
  width: 1px;
  background: var(--border-strong);
}

.timeline li {
  padding-left: 2rem;
  position: relative;
}

.timeline li::before {
  content: '';
  position: absolute;
  left: 0.3rem;
  top: 0.45rem;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.timeline__meta {
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.08em;
  font-size: 0.8rem;
  margin-bottom: 0.25rem;
}

.timeline__body {
  color: var(--text);
  font-size: 0.95rem;
}

/* ------------------------------------------------------------------ */
/* Event grid (presentations)                                         */
/* ------------------------------------------------------------------ */

.event-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  margin-top: 1.5rem;
}

.event-grid article {
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  display: grid;
  gap: 0.5rem;
}

.event-grid article h3 {
  font-size: 0.95rem;
  margin-bottom: 0;
}

.event-grid__meta {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0;
}

/* ------------------------------------------------------------------ */
/* Footer                                                             */
/* ------------------------------------------------------------------ */

.footer {
  max-width: 960px;
  margin: 0 auto;
  border-top: 1px solid var(--border);
  padding: 2rem clamp(1.5rem, 4vw, 3rem);
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.footer__links {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

/* ------------------------------------------------------------------ */
/* Resume gate (PoW modal)                                            */
/* ------------------------------------------------------------------ */

.resume-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
}

.resume-gate__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
}

.resume-gate__panel {
  position: relative;
  max-width: min(400px, 90vw);
  margin: 15vh auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 2rem;
  color: var(--text);
}

.resume-gate__close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.resume-gate__close:hover {
  color: var(--text);
}

.resume-gate__lead {
  margin: 0.3rem 0 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.resume-gate__status {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.85rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  margin-bottom: 0.75rem;
  word-break: break-word;
}

.resume-gate__progress {
  width: 100%;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.resume-gate__meter {
  width: 0%;
  height: 100%;
  background: var(--accent);
  transition: width 0.2s ease;
}

.resume-gate__tip {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.resume-gate__action {
  background: var(--accent);
  color: #0f0f0f;
  border: none;
  border-radius: var(--radius);
  padding: 0.6rem 1.2rem;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}

/* ------------------------------------------------------------------ */
/* Light-theme overrides (beyond CSS-variable swaps)                  */
/* ------------------------------------------------------------------ */

:root[data-theme="light"] .section__label,
body.theme-light .section__label {
  background: rgba(41, 128, 185, 0.1);
}

:root[data-theme="light"] .resume-gate__backdrop,
body.theme-light .resume-gate__backdrop {
  background: rgba(0, 0, 0, 0.5);
}

:root[data-theme="light"] .resume-gate__status,
body.theme-light .resume-gate__status {
  background: rgba(0, 0, 0, 0.03);
}

/* ------------------------------------------------------------------ */
/* Responsive                                                         */
/* ------------------------------------------------------------------ */

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

  .hero__portrait {
    order: -1;
  }

  .hero__portrait img {
    width: 140px;
  }
}

@media (max-width: 520px) {
  .resume-gate__panel {
    margin: 10vh 1rem;
    padding: 1.5rem;
  }
}

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