/* ============================================================
   Personal Site // Shared Design System
   Type: Crete Round (display) + Space Grotesk (body)
   Accents: lavender (primary) // sage // peach
   ============================================================ */

:root {
  /* --- Colors --- */
  --bg: oklch(0.99 0.004 280);
  --surface: oklch(1 0 0);
  --surface-muted: oklch(0.975 0.004 280);
  --text: oklch(0.24 0.012 280);
  --muted: oklch(0.55 0.01 280);
  --faint: oklch(0.56 0.01 280);
  --border: oklch(0.92 0.006 280);
  --lavender: oklch(0.54 0.13 290);
  --lavender-bg: oklch(0.95 0.03 290);
  --sage: oklch(0.52 0.09 150);
  --sage-bg: oklch(0.95 0.03 150);
  --peach: oklch(0.545 0.13 45);
  --peach-bg: oklch(0.96 0.035 50);
  --sky: oklch(0.46 0.12 240);
  --sky-bg: oklch(0.95 0.03 240);
  --rose: oklch(0.5 0.13 10);
  --rose-bg: oklch(0.96 0.03 10);
  --gold: oklch(0.5 0.13 70);
  --gold-bg: oklch(0.96 0.04 70);
  --teal: oklch(0.48 0.1 185);
  --teal-bg: oklch(0.95 0.03 185);
  --violet: oklch(0.52 0.13 270);
  --violet-bg: oklch(0.95 0.03 270);
  --shadow:
    0 1px 2px oklch(0.5 0.02 280 / 0.04), 0 8px 24px oklch(0.5 0.02 280 / 0.06);
  --shadow-lift:
    0 2px 6px oklch(0.5 0.02 280 / 0.08), 0 18px 40px oklch(0.5 0.02 280 / 0.12);

  /* --- Shape --- */
  --radius: 12px;
  --radius-pill: 999px;

  /* --- Layout --- */
  --content: 720px;
  --content-wide: 1080px;
  --padding-x: 48px;
  --padding-x-mobile: 22px;
  --entry-label-width: 130px; /* .entry-list label column */

  /* --- Type scale --- */
  --text-meta: 13px; /* Badge (all tags/pills), course-number suffix, meta-label, dates, award-note, footer copy, collaborators */
  --text-body: 14px; /* body text, link-chip, arrow-link, nav links, buttons, news body text, announcement */
  --text-title: 17px; /* intro paragraphs, hero role/bio, entry titles (h3) */
  --text-heading: 22px; /* section headings (h2) */
  --text-h1: 40px; /* page title, home hero h1 */

  /* --- Spacing --- */
  --space-stack: 36px; /* .item-stack, .entry-list rows */
  --space-section: 64px; /* .block margin-top */
  --space-subsection: 44px; /* .page-head, .award-section margin */
  --space-tag-gap: 8px; /* below a tag/badge row, before the title or content that follows */
  --space-title-gap: 4px; /* below an entry title, before its subtitle/body */

  /* --- Icon size --- */
  --icon-size: 20px; /* announcement icon */

  /* --- Hover lift --- */
  --lift-subtle: translateY(-1px); /* badges, icon buttons */
  --lift-prominent: translateY(-2px); /* link-chip, buttons, banners */

  /* --- Interactive element radius --- */
  --radius-interactive: 9px; /* nav links (desktop + mobile menu) */

  /* --- Interactions --- */
  --transition: all 0.18s ease;
  --transition-colors: background 0.3s ease, color 0.3s ease;
}

/* Dark theme follows the visitor's device setting. */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: oklch(0.21 0.012 280);
    --surface: oklch(0.25 0.013 280);
    --surface-muted: oklch(0.23 0.012 280);
    --text: oklch(0.93 0.008 280);
    --muted: oklch(0.7 0.01 280);
    --faint: oklch(0.63 0.01 280);
    --border: oklch(0.32 0.012 280);
    --lavender: oklch(0.8 0.1 290);
    --lavender-bg: oklch(0.34 0.04 290);
    --sage: oklch(0.8 0.07 150);
    --sage-bg: oklch(0.34 0.035 150);
    --peach: oklch(0.84 0.08 50);
    --peach-bg: oklch(0.36 0.04 50);
    --sky: oklch(0.78 0.1 240);
    --sky-bg: oklch(0.33 0.04 240);
    --rose: oklch(0.8 0.1 10);
    --rose-bg: oklch(0.34 0.04 10);
    --gold: oklch(0.82 0.1 70);
    --gold-bg: oklch(0.35 0.04 70);
    --teal: oklch(0.78 0.09 185);
    --teal-bg: oklch(0.33 0.04 185);
    --violet: oklch(0.8 0.1 270);
    --violet-bg: oklch(0.33 0.04 270);
    --shadow: 0 1px 2px oklch(0 0 0 / 0.2), 0 8px 24px oklch(0 0 0 / 0.3);
    --shadow-lift: 0 2px 6px oklch(0 0 0 / 0.3), 0 18px 40px oklch(0 0 0 / 0.45);
  }
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  scroll-behavior: smooth;
}
body {
  font-family: "Space Grotesk", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: var(--transition-colors);
}
h1,
h2 {
  font-family: "Crete Round", serif;
  font-optical-sizing: auto;
  line-height: 1.15;
}
h3 {
  font-weight: 600;
  line-height: 1.3;
}
a {
  color: inherit;
}

/* ---------- LAYOUT ---------- */
.wrap {
  max-width: var(--content);
  margin: 0 auto;
  padding: 0 var(--padding-x);
}
main {
  padding: 76px 0 64px;
}

/* page header (interior pages) */
.page-head {
  margin-bottom: var(--space-subsection);
}
.page-head h1 {
  font-size: var(--text-h1);
  font-weight: 600;
  margin-bottom: 14px;
}
.page-head p.intro {
  color: var(--muted);
  font-size: var(--text-title);
  max-width: 620px;
  text-wrap: pretty;
}
.page-head p.intro strong {
  color: var(--text);
  font-weight: 600;
}

.block {
  margin-top: var(--space-section);
}

/* ---------- ITEM STACK ---------- */
.item-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-stack);
}
/* ---------- TYPOGRAPHY HELPERS ---------- */
.meta-label,
.entry-label {
  font-size: var(--text-meta);
  font-weight: 700;
  color: var(--faint);
}
.body-text,
.entry-description {
  font-size: var(--text-body);
  color: var(--muted);
  line-height: 1.55;
}
.prose a {
  color: var(--lavender);
  font-weight: 600;
  text-decoration: none;
}
.prose a:hover {
  text-decoration: underline;
}

/* ---------- LINKS / BUTTONS ---------- */
.links-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.link-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  color: var(--text);
  font-size: var(--text-body);
  font-weight: 500;
  padding: 9px 15px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: var(--transition);
}
.link-chip:hover {
  box-shadow: var(--shadow);
  transform: var(--lift-prominent);
  border-color: transparent;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  cursor: pointer;
  font-size: var(--text-body);
  font-weight: 600;
  padding: 12px 22px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: var(--transition);
  font-family: "Space Grotesk";
}
.btn-ghost {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover {
  box-shadow: var(--shadow);
  transform: var(--lift-prominent);
}

/* ---------- BADGE ROWS (tag-row: Badge with color; link-badge-row: Badge with href) ---------- */
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: var(--space-tag-gap); }
.link-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

/* ---------- ENTRY HELPERS (publications, research, teaching) ---------- */
.arrow-link {
  font-size: var(--text-body);
  font-weight: 600;
  color: var(--lavender);
  text-decoration: none;
  display: inline-flex;
  gap: 6px;
  transition: gap 0.18s ease;
}
.arrow-link:hover {
  gap: 10px;
}
.award-note {
  font-size: var(--text-meta);
  font-weight: 600;
  color: var(--peach);
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
/* ---------- PAGE TRANSITIONS ---------- */
@view-transition {
  navigation: auto;
}

@media (prefers-reduced-motion: no-preference) {
  ::view-transition-old(root) {
    animation: vt-fade-out 0.22s ease both;
  }
  ::view-transition-new(root) {
    animation: vt-fade-up 0.36s cubic-bezier(0.22, 1, 0.36, 1) both;
  }
}
@keyframes vt-fade-out {
  to {
    opacity: 0;
  }
}
@keyframes vt-fade-up {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@supports not (view-transition-name: none) {
  @media (prefers-reduced-motion: no-preference) {
    main {
      animation: vt-fade-up 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
    }
  }
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 760px) {
  .wrap {
    padding-left: var(--padding-x-mobile);
    padding-right: var(--padding-x-mobile);
  }
  .page-head h1 {
    font-size: 32px;
  }
}

/* ============================================================
   Components and pages. These were scoped <style> blocks in the
   Svelte components; selectors are nested under each component's
   root class so they don't leak.
   ============================================================ */

/* ---------- NAV ---------- */
nav.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in oklch, var(--bg) 80%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: var(--transition-colors);
  view-transition-name: site-nav;
}
.nav-inner {
  max-width: var(--content-wide);
  margin: 0 auto;
  padding: 15px var(--padding-x);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.brand {
  font-weight: 600;
  font-size: var(--text-title);
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
  white-space: nowrap;
}
/* .nav-links is a popover (opened by .hamburger on narrow screens). On wide
   screens it's shown as a plain row, so the browser's default popover styles
   (hidden, fixed, centered, bordered) are reset here. */
.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  position: static;
  inset: auto;
  width: auto;
  height: auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  overflow: visible;
}
.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: var(--text-body);
  font-weight: 500;
  padding: 7px 12px;
  border-radius: var(--radius-interactive);
  transition: var(--transition);
  white-space: nowrap;
}
.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
  background: var(--lavender-bg);
}
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  padding: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: var(--transition);
}
.hamburger:hover {
  box-shadow: var(--shadow);
  transform: var(--lift-subtle);
}
.hamburger span {
  display: block;
  height: 2px;
  border-radius: 2px;
  background: var(--text);
  transition: all 0.22s ease;
  transform-origin: center;
}
/* Hamburger turns into an X while the menu is open. */
.site-nav:has(.nav-links:popover-open) .hamburger span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.site-nav:has(.nav-links:popover-open) .hamburger span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.site-nav:has(.nav-links:popover-open) .hamburger span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 900px) {
  .nav-inner {
    padding-left: var(--padding-x-mobile);
    padding-right: var(--padding-x-mobile);
  }
  .hamburger {
    display: flex;
  }
  /* The open menu sits just below the nav bar, whose height is 67px:
     15px padding top and bottom, the 36px hamburger, and a 1px border. */
  .nav-links {
    position: fixed;
    inset: 67px 0 auto 0;
    flex-direction: column;
    gap: 4px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 12px var(--padding-x-mobile) 16px;
    backdrop-filter: blur(12px);
  }
  .nav-links:not(:popover-open) {
    display: none;
  }
  .nav-links a {
    padding: 10px 12px;
  }
}

/* ---------- FOOTER ---------- */
footer.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 88px;
  padding: 36px 0;
}
.footer-inner {
  max-width: var(--content-wide);
  margin: 0 auto;
  padding: 0 var(--padding-x);
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}
.footer-inner .copy {
  color: var(--faint);
  font-size: var(--text-meta);
}
.footer-links {
  display: flex;
  gap: 16px;
}
.footer-links a {
  color: var(--muted);
  font-size: var(--text-meta);
  text-decoration: none;
  transition: color 0.18s;
}
.footer-links a:hover {
  color: var(--text);
}

@media (max-width: 760px) {
  .footer-inner {
    padding-left: var(--padding-x-mobile);
    padding-right: var(--padding-x-mobile);
  }
}

/* ---------- BADGE ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--text-meta);
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  text-decoration: none;
}
a.badge {
  transition: all 0.16s ease;
}
a.badge:hover {
  box-shadow: var(--shadow);
  transform: var(--lift-subtle);
  border-color: transparent;
}
.badge-neutral {
  color: var(--muted);
  background: var(--surface-muted);
  border: 1px solid var(--border);
}
a.badge-neutral:hover {
  color: var(--text);
}
.badge-lav {
  background: var(--lavender-bg);
  color: var(--lavender);
}
.badge-sage {
  background: var(--sage-bg);
  color: var(--sage);
}
.badge-peach {
  background: var(--peach-bg);
  color: var(--peach);
}
.badge-sky {
  background: var(--sky-bg);
  color: var(--sky);
}
.badge-rose {
  background: var(--rose-bg);
  color: var(--rose);
}
.badge-gold {
  background: var(--gold-bg);
  color: var(--gold);
}
.badge-teal {
  background: var(--teal-bg);
  color: var(--teal);
}
.badge-violet {
  background: var(--violet-bg);
  color: var(--violet);
}

/* ---------- SECTION HEADER ---------- */
.sec-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}
.sec-head .emoji {
  font-size: var(--text-heading);
}
.sec-head h2 {
  font-size: var(--text-heading);
  font-weight: 600;
}

/* ---------- ENTRY LIST / ROW / LABEL ---------- */
.entry-list {
  display: grid;
  grid-template-columns: var(--entry-label-width) 1fr;
  row-gap: var(--space-stack);
}
.entry-list.bordered {
  row-gap: 0;
}
.entry-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: subgrid;
  column-gap: 20px;
  align-items: start;
}
/* CV rows are divided by borders instead of gaps. .cv-row-single is a
   department-service timeline row. */
.entry-list.bordered > .entry-row,
.cv-row-single {
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}
.entry-list.bordered > .entry-row:last-child,
.cv-row-single:last-child {
  border-bottom: 0;
}
.entry-row-label {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding-top: 2px;
  min-width: 0;
}
.entry-row-content {
  min-width: 0;
}

@media (max-width: 600px) {
  .entry-list {
    grid-template-columns: 1fr;
  }
  .entry-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

/* ---------- ENTRY TITLE / SUBTITLE / DESCRIPTION ---------- */
.entry-title {
  font-size: var(--text-title);
  font-weight: 600;
  margin-bottom: var(--space-title-gap);
}
.entry-subtitle {
  font-size: var(--text-body);
  font-weight: 600;
  color: var(--lavender);
  margin-bottom: 6px;
}

/* ---------- NEWS ITEM ---------- */
.news-what {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.news-what .what {
  font-size: var(--text-body);
  line-height: 1.55;
}
.news-what .what strong {
  font-weight: 600;
}

/* ---------- PERSON LIST ---------- */
.person-list {
  display: flex;
  align-items: baseline;
  font-size: var(--text-body);
  color: var(--muted);
}
.person-list.labeled {
  gap: 7px;
  font-size: var(--text-meta);
}
.person-list .me {
  color: var(--text);
  font-weight: 700;
}
.person-list .mentee {
  font-style: italic;
}

/* ---------- VENUE LABEL ---------- */
.venue-sep {
  padding: 0 5px;
}

/* ---------- HOME PAGE ---------- */
.hero {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 8px;
}
.hero .headshot {
  width: 132px;
  height: 132px;
  border-radius: 50%;
  overflow: hidden;
  border: 4px solid var(--surface);
  box-shadow: var(--shadow-lift);
  margin-bottom: 26px;
}
.hero .headshot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hero h1 {
  font-size: var(--text-h1);
  font-weight: 600;
  margin-bottom: 6px;
}
.hero .role {
  color: var(--lavender);
  font-size: var(--text-title);
  margin-bottom: 22px;
}
.hero .bio {
  color: var(--muted);
  font-size: var(--text-title);
  max-width: 560px;
  text-wrap: pretty;
}
.hero .links-row {
  justify-content: center;
  margin-top: 28px;
}
.long-bio {
  font-size: var(--text-body);
  line-height: 1.7;
  text-wrap: pretty;
}
.long-bio strong {
  font-weight: 600;
}
.announcement {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--lavender-bg);
  border: 1px solid var(--lavender);
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: var(--text-body);
  color: var(--text);
  line-height: 1.5;
  transition: var(--transition);
  margin-bottom: 24px;
}
.announcement:hover {
  box-shadow: var(--shadow);
  transform: var(--lift-prominent);
}
.announcement .ann-icon {
  font-size: var(--icon-size);
  flex-shrink: 0;
  margin-top: 1px;
}
.section-more {
  margin-top: 18px;
}
.photo-credit {
  text-align: left;
  font-style: italic;
  color: var(--faint);
  font-size: var(--text-meta);
  margin-top: var(--space-section);
}

/* ---------- AWARDS PAGE ---------- */
.award-section {
  margin-bottom: var(--space-subsection);
}

/* ---------- PUBLICATIONS PAGE ---------- */
.pub-wrap {
  max-width: 880px;
}
.pub-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

/* ---------- RESEARCH PAGE ---------- */
.research-row .collaborators,
.research-row .description {
  margin-bottom: 10px;
}

/* ---------- TEACHING PAGE ---------- */
.course-number {
  font-size: var(--text-meta);
  font-weight: 600;
  color: var(--faint);
}

/* ---------- CV PAGE ---------- */
.pdf-link-line {
  font-size: var(--text-title);
  color: var(--muted);
}
.pdf-link {
  color: var(--lavender);
  font-weight: 600;
  text-decoration: none;
}
.pdf-link-footer {
  margin-top: 44px;
}
.cv-extra {
  margin-bottom: 4px;
}
.cv-extra em {
  color: var(--text);
  font-style: normal;
  font-weight: 600;
}
.timeline {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
  padding-left: 22px;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--border);
}
.timeline.single::before {
  display: none;
}
.timeline-node {
  position: relative;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: var(--text-body);
}
.timeline-node::before {
  content: "";
  position: absolute;
  left: -19px;
  top: 6px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--lavender);
}
.timeline-role {
  font-weight: 600;
}

/* ---------- 404 PAGE ---------- */
.home-link {
  margin-top: 8px;
}
