/* ─── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ─── Design Tokens (OKLCH — perceptually uniform) ──────── */
:root {
  --bg:             oklch(98.5% 0    0);    /* neutral white */
  --text-primary:   oklch(17%  0    0);    /* neutral near-black */
  --text-secondary: oklch(42%  0    0);    /* neutral medium gray */
  --text-muted:     oklch(52%  0    0);    /* neutral light gray */
  --accent:         #06c;               /* Apple blue — links */
  --accent-bg:      #e8f1ff;            /* light blue hover fill */
  --accent-border:  #b3d4f5;            /* light blue border */
  --venue:          #0071e3;            /* Apple filled blue — badge */
  --star-bg:        transparent;
  --star-icon:      #e3b341;
  --star-text:      #ad7c10;
  --star-border:    color-mix(in srgb, var(--star-icon) 45%, transparent);
  --star-hover-bg:  color-mix(in srgb, var(--star-icon) 12%, transparent);
  --border:         oklch(88%  0    0);    /* neutral divider */
  --media-placeholder: oklch(97% 0 0);    /* light gray while media loads */

  /* Type scale — modular 1.25 ratio */
  --text-xs:    0.75rem;    /* 12px */
  --text-sm:    0.875rem;   /* 14px */
  --text-base:  1rem;       /* 16px — body minimum */
  --text-md:    1.125rem;  /* 18px */
  --text-lg:    1.25rem;   /* 20px */
  --text-xl:    clamp(1.5rem, 4vw, 1.875rem);
  --text-name:  clamp(1.5rem, 4vw, 2rem);

  /* Families */
  --serif: 'Lato', 'Helvetica Neue', Arial, sans-serif;
  --sans:  'Lato', 'Helvetica Neue', Arial, sans-serif;

  --max-width: 760px;
  --radius: 5px;
}

/* ─── Base ───────────────────────────────────────────────── */
html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  font-size: var(--text-base);
  font-optical-sizing: auto;
  line-height: 1.7;
  color: var(--text-primary);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

a:hover { text-decoration: underline; }

/* ─── Layout ─────────────────────────────────────────────── */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: clamp(40px, 8vw, 72px) clamp(20px, 5vw, 32px) 0;
}

/* ─── About ──────────────────────────────────────────────── */
.about {
  display: flex;
  gap: clamp(28px, 6vw, 52px);
  align-items: flex-start;
  margin-bottom: clamp(52px, 8vw, 80px);
}

.about__photo {
  flex-shrink: 0;
  width: clamp(108px, 20vw, 148px);
  height: clamp(108px, 20vw, 148px);
  border-radius: 50%;
  object-fit: cover;
  object-position: top center;
}

.about__content { flex: 1; }

.about__name {
  font-family: var(--serif);
  font-size: var(--text-name);
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.15;
  margin-bottom: 0.6em;
  display: flex;
  align-items: baseline;
  gap: 0.5em;
}

.about__role {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: 1em;
}

.about__bio {
  font-size: var(--text-base);
  color: var(--text-primary);
  max-width: 58ch;
  margin-bottom: 0.6em;
}

/* ─── Contact links ──────────────────────────────────────── */
.contact {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
}

.contact__link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.15s ease-out;
}

.contact__link:hover {
  color: var(--accent);
  text-decoration: none;
}

.contact__link svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.contact__link--static { cursor: default; }
.contact__link--static:hover { color: var(--text-secondary); }

/* ─── Section ─────────────────────────────────────────────── */
section { margin-bottom: clamp(44px, 8vw, 68px); }

.section-title {
  font-family: var(--serif);
  font-size: var(--text-lg);
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}

/* ─── Publications ───────────────────────────────────────── */
.pub-list { display: flex; flex-direction: column; gap: 2rem; }

.pub {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
}

.pub__thumb {
  flex-shrink: 0;
  width: 240px;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  object-fit: cover;
  background-color: var(--media-placeholder);
}

.pub__body { flex: 1; }

.badge {
  display: block;
  width: fit-content;
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.badge__accent {
  color: #9d565d;
  font-weight: 400;
  letter-spacing: 0.01em;
}

.pub__title {
  font-size: var(--text-base);
  font-weight: 400;
  line-height: 1.45;
  margin-bottom: 0.3rem;
  color: var(--text-primary);
}

.pub__authors {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: 0.6rem;
}

.pub__authors strong {
  font-weight: 700;
}

.pub__authors a {
  color: inherit;
  text-decoration: none;
}

.pub__authors a:hover { text-decoration: underline; }

.pub__author-mark {
  margin-left: 0.08em;
  font-size: 0.8em;
  line-height: 0;
  vertical-align: super;
}

.award__desc a { color: inherit; text-decoration: none; }
.award__desc a:hover { text-decoration: underline; }

.pill-links { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

.pill {
  font-size: var(--text-xs);
  font-weight: 400;
  color: var(--accent);
  text-decoration: none;
  padding: 2px 9px;
  border: 1px solid var(--accent-border);
  border-radius: 9999px;
  transition: background-color 0.15s ease-out;
}

.pill:hover {
  background-color: var(--accent-bg);
  text-decoration: none;
}

.badge-link { display: inline-flex; align-items: center; color: var(--accent); text-decoration: none; }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.gh-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 9999px;
  border: 1px solid var(--star-border);
  padding: 2px 8px;
  color: var(--text-secondary);
  background-color: var(--star-bg);
  font-size: var(--text-xs);
  font-weight: 400;
  line-height: 1.7;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  transition: background-color 0.15s ease-out;
}

.gh-badge__icon {
  width: 1.1em;
  height: 1.1em;
  flex-shrink: 0;
  color: var(--star-icon);
  fill: currentColor;
  opacity: 0.82;
}

.gh-badge__count {
  min-width: 0;
  color: var(--star-text);
  font-weight: 400;
  text-align: right;
}

.badge-link:hover {
  text-decoration: none;
}

.badge-link:hover .gh-badge {
  background-color: var(--star-hover-bg);
}

.badge-link:hover .gh-badge__icon {
  opacity: 1;
}

/* ─── Books ──────────────────────────────────────────────── */
.book-list { display: flex; flex-direction: column; gap: 2rem; }

.book {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
}

.book__thumb {
  flex-shrink: 0;
  width: 240px;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  object-fit: cover;
}

.book__body { flex: 1; }

.book__title {
  font-size: var(--text-base);
  font-weight: 400;
  margin-bottom: 0.25rem;
  color: var(--text-primary);
}

.book__desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  max-width: 54ch;
  margin-bottom: 0.6rem;
}

/* ─── Experience ─────────────────────────────────────────── */
.exp-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.exp-card {
  display: flex;
  gap: 0.875rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.exp-card__icon {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background-color: var(--accent-bg);
  padding: 8px;
}

.exp-card__body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.exp-card__role {
  font-size: var(--text-base);
  color: var(--text-primary);
  margin: 0;
}

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

.exp-card__role a:hover { text-decoration: underline; }

.exp-card__mentor {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin: 0;
}

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

.exp-card__mentor a:hover { text-decoration: underline; }
.exp-card__period {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin: 0;
}

/* ─── Motion ─────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ─── Awards ─────────────────────────────────────────────── */
.award {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.5rem 0;
}
.award__left { flex: 1; min-width: 0; }
.award__name { font-size: var(--text-base); color: var(--text-primary); font-weight: 400; margin: 0 0 0.15rem; }
.award__desc { font-size: var(--text-sm); color: var(--text-secondary); margin: 0; }
.award__year { font-size: var(--text-sm); color: var(--text-secondary); white-space: nowrap; flex-shrink: 0; }

/* ─── Footer ─────────────────────────────────────────────── */
.site-footer {
  margin-top: 6rem;
  padding-top: 0.75rem;
  padding-bottom: 1rem;
  border-top: 1px solid var(--border);
  font-size: var(--text-sm);
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-footer p {
  padding: 0;
}

.site-footer a {
  color: var(--accent);
  text-decoration: none;
  text-underline-offset: 2px;
}

.site-footer a:hover { text-decoration: underline; }

[data-theme="dark"] {
  --bg:             #1e1e1e;
  --text-primary:   oklch(96%  0     0);    /* near-white */
  --text-secondary: oklch(80%  0     0);    /* medium gray */
  --text-muted:     oklch(68%  0     0);    /* dimmer gray */
  --accent:         #2997ff;            /* Apple dark blue — brighter on dark bg */
  --accent-bg:      #123a66;            /* dark blue hover fill */
  --accent-border:  #1a4a8a;            /* mid blue border */
  --venue:          #2997ff;            /* Apple dark blue — badge */
  --star-bg:        transparent;
  --star-icon:      #f2cc60;
  --star-text:      #f2cc60;
  --star-border:    color-mix(in srgb, var(--star-icon) 50%, transparent);
  --star-hover-bg:  color-mix(in srgb, var(--star-icon) 16%, transparent);
  --border:         oklch(36%  0     0);    /* neutral separator */
  --media-placeholder: oklch(24% 0 0);    /* dark gray while media loads */
}

[data-theme="dark"] .pub__thumb,
[data-theme="dark"] .book__thumb,
[data-theme="dark"] .exp-card__icon {
  filter: brightness(0.82);
}

[data-theme="dark"] .badge__accent {
  color: oklch(82% 0.035 12);
}

/* ─── Theme toggle ───────────────────────────────────────── */
.theme-toggle {
  margin-left: auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  transition: background-color 0.15s ease-out, color 0.15s ease-out, border-color 0.15s ease-out;
}

.theme-toggle:hover {
  background-color: var(--accent-bg);
  color: var(--accent);
  border-color: var(--accent-border);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.theme-toggle svg { width: 18px; height: 18px; }

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 560px) {
  .about {
    flex-direction: column;
    align-items: center;
    gap: 1.0em;
  }

  .about__content { width: 100%; }
  .about__name { justify-content: center; }

  .about__bio { max-width: none; }
  .contact { justify-content: center; }

  .pub, .book { flex-direction: column; }

  .pub__thumb, .book__thumb {
    width: 100%;
    aspect-ratio: 16 / 9;
    height: auto;
  }

  .exp-grid { grid-template-columns: 1fr; }
}
