:root {
  --accent: #1e4d6f;
  --accent-hover: #2a6890;
  --text: #1a1a1a;
  --muted: #666;
  --border: #e5e5e5;
  --bg: #ffffff;
  --card-bg: #fafafa;
  --max-width: 780px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
}

nav {
  border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: saturate(180%) blur(8px);
  z-index: 10;
}
nav .inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
nav .brand {
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  font-size: 1.05rem;
  white-space: nowrap;
}
nav ul {
  display: flex;
  gap: 1.5rem;
  list-style: none;
  flex-wrap: wrap;
}
nav a {
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.15s;
}
nav a:hover, nav a.active {
  color: var(--accent);
}

main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3rem 2rem 5rem;
}

main.wide {
  max-width: 1100px;
}

h1 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  color: var(--accent);
  letter-spacing: -0.01em;
}
h2 {
  font-size: 1.4rem;
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
  color: var(--accent);
  letter-spacing: -0.005em;
}
h3 {
  font-size: 1.08rem;
  margin: 1.25rem 0 0.4rem;
}

p {
  margin-bottom: 1rem;
}

ul, ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}
ul li, ol li {
  margin-bottom: 0.3rem;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(30, 77, 111, 0.35);
  text-underline-offset: 2px;
}
a:hover {
  text-decoration-color: currentColor;
}

.job, .publication {
  margin-bottom: 1.75rem;
}
.job-header {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.15rem;
}
.job-title {
  font-weight: 600;
  font-size: 1.05rem;
}
.job-dates {
  color: var(--muted);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}
.job-org {
  color: var(--muted);
  font-style: italic;
  margin-bottom: 0.5rem;
}
.job ul {
  padding-left: 1.25rem;
}
.job ul li {
  margin-bottom: 0.25rem;
}
.job ul ul {
  margin-top: 0.3rem;
  margin-bottom: 0.5rem;
}

.highlight {
  background: linear-gradient(transparent 60%, rgba(30, 77, 111, 0.15) 60%);
  font-weight: 500;
  padding: 0 0.1em;
}

.badge {
  display: inline-block;
  font-size: 0.72rem;
  padding: 0.15rem 0.5rem;
  background: var(--accent);
  color: white;
  border-radius: 3px;
  margin-right: 0.4rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  vertical-align: middle;
}
.badge.muted {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.pub-title {
  font-weight: 500;
}
.pub-meta {
  color: var(--muted);
  font-size: 0.92rem;
  margin-top: 0.2rem;
}

footer {
  border-top: 1px solid var(--border);
  padding: 2rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 3rem;
}
footer a {
  color: var(--muted);
  margin: 0 0.4rem;
}

/* Hero on home */
.hero {
  margin-bottom: 3rem;
}
.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}
.hero .tagline {
  font-size: 1.15rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
}
.hero p {
  font-size: 1.02rem;
}
.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.1rem;
  margin-top: 1.25rem;
  font-size: 0.95rem;
}
.contact-links a {
  color: var(--accent);
}

.section-lead {
  color: var(--muted);
  font-size: 1rem;
  margin-bottom: 2rem;
}

/* Talks grid */
.talks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}
.talk-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
  display: flex;
  flex-direction: column;
}
.talk-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}
.talk-card .talk-img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  background: linear-gradient(135deg, #1e4d6f 0%, #2a6890 100%);
}

/* Multi-image gallery (used inside .talk-card) */
.talk-gallery {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: linear-gradient(135deg, #1e4d6f 0%, #2a6890 100%);
}
.talk-gallery-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  height: 100%;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.talk-gallery-track::-webkit-scrollbar { display: none; }
.talk-gallery-track > img,
.talk-gallery-track > video {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  object-fit: cover;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: block;
  background: #000;
}

/* Image count badge (top-right of the gallery) */
.talk-gallery-count {
  position: absolute;
  top: 0.55rem;
  right: 0.6rem;
  background: rgba(0, 0, 0, 0.55);
  color: white;
  font-size: 0.72rem;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  z-index: 2;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

/* Dot indicators */
.talk-gallery-dots {
  position: absolute;
  bottom: 0.55rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.35rem;
  z-index: 2;
}
.talk-gallery-dots button {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.55);
  padding: 0;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}
.talk-gallery-dots button[aria-current="true"] {
  background: white;
  transform: scale(1.3);
}

/* Prev / next arrows (desktop hover only) */
.talk-gallery-prev,
.talk-gallery-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.45);
  color: white;
  cursor: pointer;
  font-size: 1.15rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
  z-index: 2;
  padding: 0;
}
.talk-card:hover .talk-gallery-prev,
.talk-card:hover .talk-gallery-next,
.talk-gallery-prev:focus-visible,
.talk-gallery-next:focus-visible {
  opacity: 1;
}
.talk-gallery-prev { left: 0.5rem; }
.talk-gallery-next { right: 0.5rem; }
.talk-gallery-prev:hover,
.talk-gallery-next:hover {
  background: rgba(0, 0, 0, 0.72);
}

/* Hide nav when only one image */
.talk-gallery.single-image .talk-gallery-dots,
.talk-gallery.single-image .talk-gallery-prev,
.talk-gallery.single-image .talk-gallery-next,
.talk-gallery.single-image .talk-gallery-count {
  display: none;
}

/* Touch devices: hide arrows (swipe is the primary interaction) */
@media (hover: none) {
  .talk-gallery-prev, .talk-gallery-next { display: none; }
}
.talk-card-body {
  padding: 1.25rem 1.25rem 1.4rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.talk-card .type-tag {
  display: inline-block;
  font-size: 0.68rem;
  padding: 0.15rem 0.55rem;
  border-radius: 3px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-bottom: 0.55rem;
  align-self: flex-start;
  color: white;
}
.talk-card .type-tag.talk { background: var(--accent); }
.talk-card .type-tag.judge { background: #b8703a; }

.talk-card h3 {
  margin: 0 0 0.3rem 0;
  color: var(--accent);
  font-size: 1.05rem;
  line-height: 1.35;
}
.talk-card .venue {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
  font-variant-numeric: tabular-nums;
}
.talk-card .desc {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text);
}
.talk-card .talk-links {
  margin-top: 0.9rem;
  font-size: 0.85rem;
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
}
.talk-card .talk-links a {
  color: var(--accent);
}

/* Publication highlights */
.pub-highlight {
  background: var(--card-bg);
  border-left: 3px solid var(--accent);
  padding: 1rem 1.25rem;
  border-radius: 0 6px 6px 0;
  margin-bottom: 1rem;
}
.pub-highlight .pub-title {
  font-weight: 600;
}

/* Skills */
.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.5rem 0 1rem;
}
.skill-tag {
  font-size: 0.85rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  padding: 0.2rem 0.65rem;
  border-radius: 4px;
  color: var(--text);
}

/* Responsive */
@media (max-width: 720px) {
  body { font-size: 16px; }
  nav { padding: 0.75rem 1rem; }
  nav ul { gap: 1rem; }
  nav a { font-size: 0.88rem; }
  main { padding: 2rem 1.25rem 4rem; }
  h1 { font-size: 1.7rem; }
  .hero h1 { font-size: 2rem; }
  h2 { font-size: 1.25rem; }
}
