:root {
  --ink: #17202a;
  --muted: #56616c;
  --accent: #8a1538;
  --accent-dark: #68102a;
  --line: #dfe3e7;
  --soft: #f5f7f8;
  --paper: #ffffff;
  --serif: Georgia, "Times New Roman", serif;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.68;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--accent-dark);
  text-decoration-thickness: .08em;
  text-underline-offset: .18em;
}

a:hover, a:focus { color: var(--accent); }

main.content a:not(.button) { text-decoration-line: underline; }

.navbar {
  min-height: 4.25rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.97) !important;
  backdrop-filter: blur(8px);
}

.navbar-brand {
  color: var(--ink) !important;
  font-family: var(--serif);
  font-weight: 700;
  letter-spacing: -.01em;
}

.navbar-nav .nav-link {
  color: #313b45 !important;
  font-size: .93rem;
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link:focus,
.navbar-nav .nav-link.active { color: var(--accent) !important; }

.dropdown-menu {
  border: 1px solid var(--line);
  border-radius: .2rem;
  box-shadow: 0 .75rem 2.25rem rgba(20,30,40,.09);
}

#quarto-content { min-height: calc(100vh - 10rem); }

main.content {
  width: 100%;
  min-width: 0;
  max-width: 73rem;
  margin-inline: auto;
  padding: 4.5rem 1.5rem 5rem;
}

h1, h2, h3 {
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 700;
  line-height: 1.18;
}

h1 {
  margin: 0 0 1.15rem;
  font-size: clamp(2.55rem, 7vw, 4.7rem);
  letter-spacing: -.045em;
}

.quarto-title h1.title {
  font-size: clamp(2.35rem, 5vw, 3.75rem);
  letter-spacing: -.035em;
}

.quarto-title-meta { display: none; }

h2 {
  margin-top: 4.25rem;
  padding-bottom: .55rem;
  border-bottom: 1px solid var(--line);
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  letter-spacing: -.02em;
}

h3 {
  margin-top: 0;
  font-size: 1.25rem;
}

.home-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(15rem, 20rem);
  gap: clamp(2rem, 7vw, 6rem);
  align-items: center;
  padding: 1.1rem 0 2.25rem;
}

.home-copy { max-width: 48rem; }

.home-copy h1 {
  font-size: clamp(2.8rem, 5vw, 4rem);
  white-space: nowrap;
}

.eyebrow {
  margin: 0 0 1rem;
  color: var(--accent);
  font-size: .82rem;
  font-weight: 750;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.research-line {
  margin: 0 0 1.35rem;
  color: #303b45;
  font-family: var(--serif);
  font-size: clamp(1.15rem, 2.2vw, 1.43rem);
  line-height: 1.52;
}

.research-line span { color: var(--accent); }

.home-photo img {
  display: block;
  width: 100%;
  aspect-ratio: 461 / 408;
  object-fit: cover;
  border-radius: .35rem;
  box-shadow: 1.15rem 1.15rem 0 var(--soft);
}

.button-row, .profile-links {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  align-items: center;
}

.button-row { margin: 1.65rem 0 1.1rem; }

.button {
  display: inline-block;
  padding: .56rem .9rem;
  border: 1px solid #b8c0c7;
  border-radius: .2rem;
  color: var(--ink);
  font-size: .92rem;
  font-weight: 650;
  text-decoration: none;
}

.button:hover, .button:focus {
  border-color: var(--accent);
  color: var(--accent);
}

.button-primary {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

.button-primary:hover, .button-primary:focus {
  border-color: var(--accent-dark);
  color: #fff;
  background: var(--accent-dark);
}

.profile-links { gap: .55rem 1.1rem; }
.profile-links a { font-size: .9rem; font-weight: 650; }

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.research-item,
.implementation,
.teaching-card,
.timeline-item,
.hockey-note {
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  padding: 1.15rem 1.3rem;
  margin: 1rem 0;
  background: #fff;
}

.research-item h3,
.implementation h4,
.teaching-card h3,
.timeline-item h3 { margin-bottom: .35rem; }

.authors {
  margin: .2rem 0;
  color: #394550;
  font-size: .95rem;
}

.status-line,
.publication-venue {
  margin: .2rem 0 .8rem;
  color: var(--accent-dark);
  font-size: .88rem;
  font-weight: 750;
}

.link-note {
  margin: .7rem 0 0;
  color: var(--muted);
  font-size: .88rem;
}

.publication-entry {
  padding: 1rem 0 1.15rem;
  border-bottom: 1px solid var(--line);
}

.publication-entry h3 {
  margin-bottom: .35rem;
  font-size: 1.18rem;
}

.registry-pill {
  display: inline-block;
  margin-left: .3rem;
  padding: .15rem .48rem;
  border: 1px solid #c8cfd5;
  border-radius: 999px;
  color: #46515c;
  background: var(--soft);
  font-family: var(--sans);
  font-size: .72rem;
  font-weight: 750;
  letter-spacing: .025em;
  vertical-align: .14rem;
}

.implementation pre {
  max-width: 100%;
  overflow-x: auto;
  margin-bottom: .2rem;
  border: 1px solid var(--line);
  border-radius: .2rem;
  background: #f7f8f9;
}

.teaching-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.teaching-card { margin: 0; }

.timeline { border-left: 1px solid #c8cfd5; padding-left: 1.2rem; }
.timeline-item { position: relative; margin: 0 0 1rem; }
.timeline-item::before {
  content: "";
  position: absolute;
  left: -1.59rem;
  top: 1.4rem;
  width: .65rem;
  height: .65rem;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: #fff;
}

.hockey-note { max-width: 46rem; background: var(--soft); }

.video-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.1rem;
  margin-top: 2rem;
}

.video-card {
  overflow: hidden;
  border: 1px solid var(--line);
  background: #fff;
}

.video-card > p,
.video-card > h3 { margin-left: 1rem; margin-right: 1rem; }
.video-card > p:last-child { margin-bottom: 1.1rem; }
.video-card h3 { font-size: 1.08rem; }
.video-card img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--soft);
}

.feature-card {
  padding: 1.35rem 1.4rem;
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent);
  background: #fff;
}

.feature-card p:last-child { margin-bottom: 0; }

.cv-page-intro {
  width: min(100%, 72rem);
  margin: 0 auto 1rem;
}

.cv-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  margin-top: 1rem;
}

.cv-viewer-shell {
  width: min(100%, 72rem);
  min-height: 48rem;
  margin: 0 auto;
  border: 1px solid var(--line);
  background: var(--soft);
}

.cv-viewer-status {
  margin: 0;
  padding: 2rem;
  color: var(--muted);
}

.cv-viewer {
  display: block;
  width: 100%;
  height: calc(100vh - 14rem);
  min-height: 48rem;
  border: 0;
  background: #fff;
}

.video-feature {
  display: grid;
  grid-template-columns: minmax(16rem, .8fr) minmax(0, 1.2fr);
  gap: 1.75rem;
  align-items: center;
  padding: 1.25rem;
  background: var(--soft);
  border: 1px solid var(--line);
}

.video-thumb img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.video-copy p:last-child { margin-bottom: 0; }

.nav-footer {
  border-top: 1px solid var(--line);
  background: var(--soft);
  color: var(--muted);
  font-size: .87rem;
}

@media (max-width: 900px) {
  main.content { padding-top: 3rem; }
  .home-intro { grid-template-columns: minmax(0, 1fr) 15rem; gap: 2.5rem; }
  .feature-grid { grid-template-columns: 1fr; }
  .video-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  main.content { padding: 2.25rem 1.1rem 4rem; }
  .home-intro { grid-template-columns: 1fr; }
  .home-copy { order: 2; }
  .home-copy h1 { white-space: normal; }
  .home-photo { order: 1; width: min(16rem, 76vw); }
  .home-photo img { box-shadow: .7rem .7rem 0 var(--soft); }
  .video-feature { grid-template-columns: 1fr; padding: .9rem; }
  .video-grid, .teaching-grid { grid-template-columns: 1fr; }
  .cv-viewer-shell, .cv-viewer { min-height: 36rem; }
  .cv-viewer { height: 72vh; }
  h2 { margin-top: 3.2rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
