/* ---------- Tokens ---------- */
:root {
  --bg: #ffffff;
  --grid: transparent;
  --surface: #ffffff;
  --text: #16203a;
  --muted: #5d6579;
  --rule: #cfd4e2;
  --sketch: #2a3558;       /* pencil line on cards */
  --ink: #0e1733;          /* blackboard navy */
  --ink-2: #1b2660;
  --accent: #2f45c4;
  --accent-soft: #e4e8fb;
  --chalk: #ffffff;        /* single highlight on the board */
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --hand: "Caveat", "Segoe Print", "Bradley Hand", cursive;
  --maxw: 960px;
  --squiggle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 10' preserveAspectRatio='none'%3E%3Cpath d='M1 6 C 12 2, 22 9, 34 5 S 56 2, 68 6 S 88 8, 99 4' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E");
  --wave: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 800 10' preserveAspectRatio='none'%3E%3Cpath d='M2 6.5 C 80 3.5, 160 8, 290 5 S 500 2.5, 630 6 S 750 7.5, 798 4' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E");
  --sketch-radius: 18px 7px 16px 6px / 7px 16px 6px 18px;
  color-scheme: light;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 28px 28px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
}
a { color: var(--accent); text-decoration: none; transition: color .15s ease; }
a:hover { text-decoration: underline; text-decoration-style: wavy; text-decoration-thickness: 1px; text-underline-offset: 4px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0; letter-spacing: -.01em; }
p { margin: 0 0 1em; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* ---------- Header ---------- */
.site-header {
  background: color-mix(in srgb, var(--ink) 92%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  position: sticky; top: 0; z-index: 10;
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; min-height: 64px; flex-wrap: wrap;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--serif); font-size: 1.2rem; font-weight: 600; color: #fff;
}
.brand:hover { text-decoration: none; }
.brand .mark { width: 32px; height: 32px; border-radius: 4px; display: block; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
  position: relative; color: rgba(255, 255, 255, .75); font-size: .95rem; font-weight: 500;
  padding: 6px 12px;
}
.nav a:hover { color: #fff; text-decoration: none; }
.nav a[aria-current="page"] { color: #fff; }
.nav a[aria-current="page"]::after,
.nav a:hover::after {
  content: ""; position: absolute; left: 8px; right: 8px; bottom: 0; height: 7px;
  background: var(--chalk);
  -webkit-mask: var(--squiggle) center / 100% 100% no-repeat;
          mask: var(--squiggle) center / 100% 100% no-repeat;
}
.nav a:hover:not([aria-current="page"])::after { background: rgba(255, 255, 255, .45); }

/* ---------- Blackboard band ---------- */
.band {
  position: relative; overflow: hidden; color: #fff;
  background:
    radial-gradient(1100px 380px at 85% -10%, rgba(99, 102, 241, .22), transparent 60%),
    linear-gradient(135deg, var(--ink), var(--ink-2));
}
.band::before { /* chalk dust */
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.sketch {
  position: absolute; right: 2%; top: 6%; height: 88%; width: min(38%, 520px);
  pointer-events: none;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 35%);
          mask-image: linear-gradient(90deg, transparent 0%, #000 35%);
}
.sketch text { font-family: var(--hand); font-weight: 600; }
.band .wrap { position: relative; padding-top: 64px; padding-bottom: 64px; }
.band h1 { font-size: 2.8rem; max-width: 560px; }
.band:has(.hero) .sketch { opacity: .6; }
@media (max-width: 1050px) { .band:has(.hero) .sketch { opacity: .25; } }
.hero > div:last-child { max-width: 470px; }
.band .lede { color: rgba(255, 255, 255, .8); font-size: 1.08rem; margin: 10px 0 0; max-width: 560px; }
.eyebrow {
  display: inline-block; font-family: var(--hand); font-size: 1.65rem; font-weight: 600;
  line-height: 1; color: var(--chalk); margin-bottom: 8px;
}

/* Home hero */
.hero { display: grid; grid-template-columns: 230px 1fr; gap: 56px; align-items: center; }
.hero-photo { position: relative; transform: rotate(-3deg); }
.hero-photo img {
  display: block; width: 100%; height: auto; aspect-ratio: 4 / 5;
  object-fit: cover; object-position: 75% 30%;
  border: 10px solid #fbfaf4; border-bottom-width: 38px; border-radius: 2px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, .4);
}
.hero-photo::after { /* tape */
  content: ""; position: absolute; top: -12px; left: 50%; width: 96px; height: 26px;
  transform: translateX(-50%) rotate(4deg);
  background: rgba(255, 255, 255, .38);
  border-left: 1px dashed rgba(255, 255, 255, .4); border-right: 1px dashed rgba(255, 255, 255, .4);
}
.hero h1 { font-size: 3rem; }
.hero .role { color: rgba(255, 255, 255, .82); font-size: 1.1rem; margin: 6px 0 20px; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 26px; }
.pill {
  font-family: var(--hand); font-size: 1.2rem; font-weight: 600; line-height: 1.1;
  padding: 3px 12px 4px; color: #fff;
  border: 1.5px solid rgba(255, 255, 255, .5);
  border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
}

.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; font-size: .9rem; font-weight: 600;
  color: #fff; background: transparent; border: 1.5px solid rgba(255, 255, 255, .55);
  border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
  transition: transform .15s ease, background .15s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); background: rgba(255, 255, 255, .1); }
.btn svg { width: 16px; height: 16px; fill: currentColor; flex: none; }
.btn.primary { background: #fbfaf4; border-color: #fbfaf4; color: var(--ink); }
.btn.primary:hover { background: #fff; }
.btn.icon { padding: 9px 11px; }

/* ---------- Main ---------- */
main { padding: 56px 0 80px; }
.section-title {
  display: flex; align-items: center; gap: 14px;
  font-family: var(--hand); font-size: 2rem; font-weight: 600; line-height: 1;
  color: var(--text); margin: 0 0 22px;
}
.section-title::after {
  content: ""; flex: 1; height: 8px; background: var(--muted); opacity: .45;
  -webkit-mask: var(--wave) left center / 100% 8px no-repeat;
          mask: var(--wave) left center / 100% 8px no-repeat;
}

/* Home: about + contact */
.about { display: grid; grid-template-columns: 1fr 300px; gap: 44px; align-items: start; }
.about p { font-size: 1.04rem; }
.hl { /* highlighter stroke */
  font-weight: 600; color: var(--text); padding: 0 .15em; margin: 0 -.15em;
  background: linear-gradient(100deg, transparent 1%, var(--accent-soft) 3%, var(--accent-soft) 96%, transparent 99%) 0 85% / 100% 55% no-repeat;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}

.card {
  background: var(--surface); border: 1.5px solid var(--sketch);
  border-radius: var(--sketch-radius);
  box-shadow: 4px 5px 0 var(--accent-soft);
}
.contact-card { padding: 22px 24px; font-size: .94rem; }
.contact-card h3 { font-family: var(--hand); font-size: 1.7rem; font-weight: 600; line-height: 1; margin-bottom: 12px; }
.contact-card address { font-style: normal; color: var(--muted); line-height: 1.6; margin-bottom: 14px; }
.contact-card address strong { color: var(--text); }
.contact-card .mail { word-break: break-all; font-weight: 500; }

/* ---------- Research ---------- */
.papers { display: grid; gap: 26px; }
.paper { position: relative; padding: 26px 28px 22px; transition: transform .18s ease, box-shadow .18s ease; }
.paper:nth-child(even) { border-radius: 7px 18px 6px 16px / 16px 6px 18px 7px; }
.paper:hover { transform: translateY(-2px); box-shadow: 6px 8px 0 var(--accent-soft); }
.paper h3 { font-size: 1.35rem; margin-bottom: 6px; }
.paper .meta { color: var(--muted); font-size: .95rem; margin-bottom: 12px; }
.tags { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tag {
  display: inline-block; font-size: .74rem; font-weight: 600; letter-spacing: .02em;
  padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent);
}
.tag.muted {
  background: transparent; color: var(--muted); padding: 0 4px;
  font-family: var(--hand); font-size: 1.15rem; font-weight: 600; letter-spacing: 0;
}
details.abstract { margin-top: 14px; }
details.abstract summary {
  cursor: pointer; font-family: var(--hand); font-size: 1.35rem; font-weight: 600; color: var(--accent);
  list-style: none; display: inline-flex; align-items: center; gap: 8px; line-height: 1;
}
details.abstract summary::-webkit-details-marker { display: none; }
details.abstract summary::before {
  content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .15s ease;
}
details.abstract[open] summary::before { transform: rotate(45deg); }
details.abstract p { margin: 12px 0 0; font-size: .97rem; color: var(--text); text-align: justify; hyphens: auto; }

/* ---------- Teaching ---------- */
.course { padding: 24px 26px; margin-bottom: 28px; }
.course:nth-of-type(even) { border-radius: 7px 18px 6px 16px / 16px 6px 18px 7px; }
.course-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.course h3 { font-size: 1.3rem; }
.course .when {
  font-family: var(--hand); font-size: 1.3rem; font-weight: 600; line-height: 1;
  color: var(--accent);
}
.course .meta { color: var(--muted); font-size: .95rem; margin: 0; }
.sessions { list-style: none; margin: 16px 0 0; padding: 0; }
.sessions li {
  display: grid; grid-template-columns: 70px 1fr auto; gap: 12px; align-items: center;
  padding: 10px 0;
}
.sessions li + li { background: linear-gradient(var(--rule), var(--rule)) top / 100% 1px no-repeat; }
.sessions .num { font-family: var(--hand); font-size: 1.3rem; font-weight: 600; line-height: 1; color: var(--accent); }
.sessions .topic { font-weight: 500; }
.sessions .files { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .78rem; font-weight: 600; padding: 4px 10px;
  border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
  background: var(--accent-soft); color: var(--accent); white-space: nowrap;
  transition: transform .12s ease;
}
.chip.notes { background: transparent; box-shadow: inset 0 0 0 1.5px var(--accent-soft); }
.chip:hover { text-decoration: none; transform: translateY(-1px); }
.chip svg { width: 12px; height: 12px; fill: currentColor; }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color: rgba(255, 255, 255, .6); padding: 26px 0; font-size: .85rem; }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  .sketch .draw { stroke-dasharray: 900; stroke-dashoffset: 900; animation: draw 1.6s ease-out .2s forwards; }
  .sketch .draw.late { animation-delay: .7s; }
  @keyframes draw { to { stroke-dashoffset: 0; } }
}

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  body { font-size: 16px; }
  .wrap { padding: 0 16px; }
  .site-header .wrap { min-height: 56px; padding-top: 8px; padding-bottom: 8px; }
  .nav a { padding: 5px 10px; }
  .band .wrap { padding-top: 40px; padding-bottom: 44px; }
  .band h1, .hero h1 { font-size: 2.2rem; }
  .sketch { width: 75%; opacity: .4; }
  .hero { grid-template-columns: 1fr; gap: 32px; }
  .hero-photo { max-width: 190px; margin-left: 8px; }
  .about { grid-template-columns: 1fr; gap: 28px; }
  main { padding: 40px 0 56px; }
  .paper { padding: 22px 20px 18px; }
  .course { padding: 20px 18px; }
  .sessions li { grid-template-columns: 54px 1fr; }
  .sessions .files { grid-column: 2; justify-content: flex-start; }
}
