:root {
  --orange: #f47c44;      /* Phi Adajar's orange: rules, hovers, accents */
  --orange-dark: #bd4d17; /* same hue, dark enough to read as text */
  --orange-tint: #fbeee4;
  --bg: #fbf8f2;          /* warm cream page background */
  --text: #1f2328;
  --muted: #5b6470;
  --border: #e5dfd5;
  --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Roboto", "Segoe UI", "Helvetica Neue", "Lucida Grande", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.65 var(--sans); }
a { color: var(--orange-dark); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--orange-dark); outline-offset: 2px; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 22px; }

/* Top bar */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.site-header .wrap { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 54px; }
.brand { font: 600 1.02rem var(--sans); color: var(--text); white-space: nowrap; }
.brand:hover { color: var(--orange-dark); text-decoration: none; }
.site-header nav { display: flex; gap: 28px; }
.site-header nav a { position: relative; color: var(--muted); font-size: .92rem; }
.site-header nav a:hover, .site-header nav a.is-active { color: var(--text); text-decoration: none; }

/* Hand-drawn circle around the selected menu item */
.scribble {
  position: absolute; top: -8px; left: -13px;
  width: calc(100% + 26px); height: calc(100% + 16px);
  overflow: visible; pointer-events: none;
}
.scribble path {
  fill: none; stroke: var(--orange); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 1; stroke-dashoffset: 1; opacity: 0;
}
.site-header nav a.is-active .scribble path,
.site-header nav a:focus-visible .scribble path {
  stroke-dashoffset: 0; opacity: 1;
  transition: stroke-dashoffset .45s ease-out;
}
@media (hover: hover) {
  .site-header nav a:hover .scribble path {
    stroke-dashoffset: 0; opacity: 1;
    transition: stroke-dashoffset .45s ease-out;
  }
}

/* Two columns: photo on the left, stays in place while the page scrolls */
main.wrap {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  column-gap: 52px;
  align-items: start;
}
.side { position: sticky; top: 78px; margin-top: 24px; }
.portrait { margin: 0; }
.portrait img {
  display: block; width: 100%; max-width: 200px; height: auto;
  aspect-ratio: 1; border-radius: 50%; object-fit: cover;
  background: #6c7a62;
}
h1 { margin: 16px 0 0; font: 600 1.5rem/1.15 var(--sans); }
.position { margin: 6px 0 0; color: var(--muted); font-size: .95rem; line-height: 1.4; }
.actions { display: flex; flex-direction: column; gap: 8px; width: 165px; margin-top: 18px; }
.actions a {
  display: flex; align-items: center; gap: 9px;
  padding: 5px 14px;
  border: 1px solid #d8d0c3; border-radius: 999px;
  color: var(--muted); font-size: .9rem; line-height: 1.4;
}
.actions a:hover, .actions a.copied { border-color: var(--orange); color: var(--orange-dark); text-decoration: none; }
.icon { width: 15px; height: 15px; flex: none; }

/* Blocks */
.content section { margin-top: 44px; scroll-margin-top: 72px; }
.content section:first-child { margin-top: 24px; }
#about p { margin: 0 0 14px; text-align: justify; }
#about p:last-child { margin-bottom: 0; }
h2 {
  margin: 0 0 18px; padding-bottom: 13px;
  /* Hand-drawn line under each heading; the color is the stroke value (%23 stands for #) */
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 8' preserveAspectRatio='none'%3E%3Cpath d='M1 4.3C50 3.2 95 5 150 4.2S250 2.9 305 3.8 410 5.1 465 4.1 555 3.1 599 4' fill='none' stroke='%23f47c44' stroke-width='1.8' stroke-linecap='round' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E") left bottom / 100% 8px no-repeat;
  font: 600 1.35rem/1.2 var(--sans);
}

/* Paper boxes */
.paper {
  padding: 18px 20px; margin-bottom: 14px;
  border: 1px solid var(--border); border-radius: 8px;
}
.paper:last-child { margin-bottom: 0; }
.paper h3 { margin: 0; font-size: 1.02rem; font-weight: 600; line-height: 1.35; }
.coauthors, .venue { margin: 5px 0 0; color: var(--muted); font-size: .87rem; }
.lang { color: var(--muted); font-size: .84rem; font-weight: 400; white-space: nowrap; }
.tags { margin: 8px 0 0; }
.tag {
  display: inline-block; padding: 1px 10px;
  border-radius: 999px;
  background: var(--orange-tint); color: var(--orange-dark);
  font-size: .78rem; font-weight: 500;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip {
  padding: 3px 14px;
  border: 1px solid #d8d0c3; border-radius: 999px;
  background: none; color: var(--muted);
  font: .82rem/1.5 var(--sans);
  cursor: pointer;
}
.chip:hover { border-color: var(--orange); color: var(--orange-dark); text-decoration: none; }
.chip[aria-expanded="true"] { background: var(--orange-dark); border-color: var(--orange-dark); color: #fff; }
.abstract {
  margin-top: 12px; padding: 12px 15px;
  border-radius: 6px;
  background: var(--orange-tint);
  font-size: .9rem; line-height: 1.6;
}
.abstract[hidden] { display: none; }

/* Talks */
.talks { margin: 0; }
.talks div { display: grid; grid-template-columns: 3.2rem minmax(0, 1fr); margin-bottom: 12px; }
.talks div:last-child { margin-bottom: 0; }
.talks dd { margin: 0; color: var(--muted); text-align: justify; }

footer { margin-top: 64px; padding: 20px 0 28px; border-top: 1px solid var(--border); color: var(--muted); font-size: .85rem; }
footer p { margin: 0 0 4px; }

/* Phones: photo at the top left next to the name, then everything in one column */
@media (max-width: 760px) {
  .site-header nav a[href="#about"] { display: none; } /* About is already at the top on phones */
  main.wrap { display: block; }
  .side {
    position: static;
    display: grid; grid-template-columns: 104px minmax(0, 1fr);
    column-gap: 18px; align-items: center;
  }
  .side .actions { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; gap: 6px; width: auto; margin-top: 16px; }
  .side .actions a { gap: 6px; padding: 4px 10px; font-size: .84rem; }
  .icon { width: 13px; height: 13px; }
  h1 { margin-top: 0; }
  .paper { padding: 15px 16px; }
  .content section { margin-top: 38px; }
  .content section:first-child { margin-top: 28px; }
  .talks dd { text-align: left; }
}
@media (max-width: 480px) {
  body { font-size: 16px; }
  .brand { display: none; }
  .site-header nav { flex: 1; justify-content: space-between; gap: 12px; }
  .scribble { left: -9px; width: calc(100% + 18px); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .scribble path { transition: none !important; }
}
