/* Comfortaa, SIL Open Font License, https://fonts.google.com/specimen/Comfortaa */
@font-face {
  font-family: "Comfortaa";
  src: url("fonts/Comfortaa-latin.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

/* Caveat, SIL Open Font License, https://fonts.google.com/specimen/Caveat */
@font-face {
  font-family: "Caveat";
  src: url("fonts/Caveat-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

/* Neutrals follow Anthropic's brand palette: ivory background, slate text. */
:root {
  --bg: #faf9f5;        /* ivory light */
  --fg: #141413;        /* slate dark */
  --muted: #5e5d59;     /* slate light */
  --rule: #e8e6dc;      /* ivory dark */
  --accent: #0072bb;        /* French blue: links, active nav */
  --accent-hover: #005a94;  /* darker French blue on hover */
  --lilac: #86608e;         /* French lilac: highlights */
  --hl: rgba(231, 172, 207, 0.5);   /* wash behind my name in author lists */
  --card: #f0eee6;      /* ivory medium */
  --max: 780px;         /* content width, every page */
  /* Type scale, every page */
  --fs-body: 16px;
  --fs-small: 0.9rem;   /* dates, notes, footnotes */
  --fs-lead: 1.15rem;   /* paper titles, timeline roles */
  --fs-h3: 1.6rem;
  --fs-h2: 2.1rem;
  --fs-h1: 3rem;
}

/* Dark theme: Anthropic's slate/ivory neutrals inverted, with lifted accents. Off by default; toggled on the page. */
:root[data-theme="dark"] {
  --bg: #141413;        /* slate dark */
  --fg: #faf9f5;        /* ivory light */
  --muted: #b0aea5;     /* cloud medium */
  --rule: #3d3d3a;      /* slate medium */
  --card: #1f1f1d;
  --accent: #0072bb;        /* French blue, same as light */
  --accent-hover: #005a94;
  --lilac: #86608e;         /* French lilac, same as light */
  --hl: rgba(252, 142, 172, 0.3);   /* flamingo pink */
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  transition: background-color 0.2s ease, color 0.2s ease;
  font-family: "Comfortaa", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: var(--fs-body);
  line-height: 1.6;
}
/* Every link draws its underline with a background gradient so it can animate.
   Plain links draw a line in from the left on hover. Links with a standing
   underline keep it and it thickens on hover. */
a {
  color: var(--accent); text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 1px; background-repeat: no-repeat; background-position: 0 100%;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
  transition: background-size 0.25s ease, color 0.15s ease;
}
a:hover { color: var(--accent-hover); background-size: 100% 1px; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
/* Standing underline: the line thickens on hover, same color. */
a.ul, ul.pubs .ptitle a, dl.contact dd a { background-size: 100% 1px; }
a.ul:hover, ul.pubs .ptitle a:hover, dl.contact dd a:hover { background-size: 100% 2px; }
.socials a, .logo, a.button, a.chip { background-image: none; }
/* Inline pill buttons for blog / code / tweet links, same size as the text around them */
a.chip {
  display: inline-block; padding: 0 9px; margin: 0 1px; line-height: 1.35;
  border: 1px solid currentColor; border-radius: 5px;
  transition: background-color 0.18s ease, color 0.15s ease, transform 0.18s ease;
}
a.chip:hover { background-color: color-mix(in srgb, currentColor 12%, transparent); transform: translateY(-1px); }
a.chip + a.chip { margin-left: 4px; }
img { max-width: 100%; height: auto; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 20px; }

header.site { position: sticky; top: 0; z-index: 10; background: var(--bg); transition: box-shadow 0.2s ease; }
header.site.scrolled { box-shadow: 0 1px 0 var(--rule); }
header.site .wrap {
  max-width: none; padding: 18px 28px;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px 24px;
}
.logo .sig { display: block; height: 34px; width: 123px; background: var(--fg);
  -webkit-mask: url("images/signature.png") center / contain no-repeat; mask: url("images/signature.png") center / contain no-repeat;
  transition: background-color 0.2s ease; }
.logo:hover .sig { background: var(--lilac); }
nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 22px; flex-wrap: wrap; }
nav a { color: var(--fg); display: inline-flex; align-items: center; gap: 5px; }
nav .home-icon { position: relative; top: -1px; }
nav a[aria-current="page"] { color: var(--accent); }
nav a:hover { text-decoration: none; color: var(--accent); }

main { padding: 40px 0 80px; }
h1, h2, h3 { font-family: "Caveat", cursive; font-weight: 400; line-height: 1.15; }
h1 { font-size: var(--fs-h1); margin: 0 0 20px; }
h2 { font-size: var(--fs-h2); margin: 44px 0 12px; }
h3 { font-size: var(--fs-h3); margin: 26px 0 6px; }
p { margin: 0 0 16px; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-small); }

/* Home page */
main.home .block { margin-top: 72px; }
main.home .block h2 { margin-top: 0; }
.intro { display: flex; gap: 40px; align-items: center; flex-wrap: wrap; }
.intro .text { flex: 1 1 340px; }
.intro img.headshot { width: 300px; max-width: 100%; aspect-ratio: 690 / 738; object-fit: cover; flex: none; border-radius: 12px; }
.intro h1 { margin: 20px 0 32px; }
.socials { text-align: center; margin: 36px 0 20px; }
.socials ul { list-style: none; margin: 0; padding: 0; display: flex; justify-content: center; gap: 22px; }
.socials img { width: 56px; height: 56px; display: block; }
.socials a { display: block; border-radius: 50%; transition: transform 0.18s ease, box-shadow 0.18s ease; }
.socials a:hover { transform: translateY(-3px); box-shadow: 0 6px 14px rgba(0, 0, 0, 0.25); }
.socials a:hover img { opacity: 1; }
.socials .label { margin-top: 14px; font-weight: 700; }
a.ptitle { color: var(--lilac); }
a.ptitle:hover { color: var(--lilac); }
ul.selected { list-style: none; padding: 0; margin: 0; }
ul.selected li { padding: 7px 0; }
ul.talks { list-style: none; padding: 0; margin: 0; }
ul.talks li { display: flex; gap: 24px; padding: 8px 0; align-items: baseline; }
ul.talks .when { flex: 0 0 110px; font-size: var(--fs-small); font-variant-numeric: tabular-nums; }

ul.tl { list-style: none; padding: 0; margin: 0; }
ul.tl li { display: grid; grid-template-columns: 64px 1fr; gap: 0 24px; padding: 22px 0; border-bottom: 1px solid var(--rule); }
ul.tl li:last-child { border-bottom: 0; }
ul.tl .side { display: flex; flex-direction: column; align-items: center; }
ul.tl .logo { width: 64px; height: 64px; object-fit: contain; display: block; }
ul.tl .body > div { line-height: 1.7; }
ul.tl .role { font-size: var(--fs-lead); }
ul.tl .role u { text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
ul.tl .where { color: var(--muted); }
ul.tl .sub { margin-top: 16px; font-size: var(--fs-small); }
ul.tl .sub .role { font-size: 1rem; }
ul.tl .stem { flex: 1; width: 2px; background: var(--muted); margin: 24px 0 8px; position: relative; }
ul.tl .stem::before, ul.tl .stem::after { content: ""; position: absolute; left: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
ul.tl .stem::before { top: -4px; }
ul.tl .stem::after { bottom: -4px; }
strong.lead { color: var(--lilac); font-weight: 700; }
ul.prs { list-style: square; padding-left: 22px; margin: 0 0 16px; }
ul.prs li { padding: 3px 0; }

dl.contact { margin: 0; }
dl.contact div { padding: 9px 0; }
dl.contact dt, dl.contact dd { display: inline; margin: 0; }
dl.contact dt { font-weight: 700; }
dl.contact dt::after { content: ": "; white-space: pre; }

figure { margin: 20px 0; }
figure img { border-radius: 10px; display: block; }
figcaption { font-size: var(--fs-small); color: var(--muted); margin-top: 8px; }

/* Papers page */
.legend { font-size: 0.8rem; color: var(--muted); margin: 0 0 6px; }
.legend .caret { color: var(--accent); font-weight: 700; }
.legend .gap { display: inline-block; width: 10px; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.legend .dot { vertical-align: middle; position: relative; top: -1px; margin-right: 5px; }
ul.pubs .ptitle { position: relative; }
ul.pubs .ptitle .dot { position: absolute; left: -18px; top: 0.7em; }
.filters a[aria-pressed="true"] { font-weight: 700; }
ul.pubs li.hide, h2.year.hide { display: none; }
.copy-link {
  position: absolute; left: 0; top: 0; padding: 0; border: 0; background: none; color: var(--accent); cursor: pointer;
  opacity: 0; transition: opacity 0.15s ease;
}
.copy-link svg { width: 15px; height: 15px; display: block; }
ul.pubs li:hover .copy-link, .copy-link:focus-visible { opacity: 0.85; }
.copy-link:hover { opacity: 1 !important; }
@media (hover: none) { .copy-link { opacity: 0.6; } }
.center { text-align: center; }
.back-top { margin-top: 88px; }
a.button { display: inline-block; padding: 8px 18px; border: 1.5px solid var(--muted); border-radius: 4px; color: var(--fg); }
a.button:hover { text-decoration: none; background: var(--card); }
h2.year { text-decoration: underline; text-underline-offset: 6px; margin: 40px 0 10px; scroll-margin-top: 84px; }
ul.pubs { list-style: none; padding: 0; margin: 0; line-height: 1.6; }
ul.pubs li { padding: 10px 6px 14px; margin: 0 -6px; border-radius: 6px; scroll-margin-top: 84px; transition: background-color 0.6s ease; }
ul.pubs li.flash { background-color: var(--hl); transition: none; }
ul.pubs .ptitle { font-size: var(--fs-lead); line-height: 1.4; margin-bottom: 4px; }
ul.pubs .caret { margin-left: 0; color: var(--accent); }
ul.pubs .me { font-weight: 700; background: var(--hl); border-radius: 3px; padding: 0 3px; }
ul.pubs .venue { color: var(--lilac); }
ul.pubs .meta a.chip { color: var(--lilac); }
ul.pubs .note { color: var(--muted); font-size: var(--fs-small); margin-top: 2px; }

/* Waving hand: one gentle wave on load, then still */
.wave { display: inline-block; transform-origin: 70% 70%; }
@keyframes wave { 0%, 100% { transform: rotate(0); } 15% { transform: rotate(14deg); } 30% { transform: rotate(-8deg); } 45% { transform: rotate(14deg); } 60% { transform: rotate(-4deg); } 75% { transform: rotate(10deg); } }
@media (prefers-reduced-motion: no-preference) { .wave { animation: wave 1.6s ease-in-out 0.3s 1; } }

/* Reveal on scroll: fast, small, once */
.reveal { opacity: 0; transform: translateY(10px); }
.reveal.in { opacity: 1; transform: none; transition: opacity 0.45s ease-out, transform 0.45s ease-out; }

/* Timeline footer and 404 */
.updated { font-family: "Caveat", cursive; font-size: 1.1rem; color: var(--muted); margin: 88px 0 0; }
main.notfound { padding-top: 72px; }

/* Print: papers as a plain list, no chrome */
@media print {
  header.site, .socials, .back-top, .center, .legend, .filters, .jump, .updated, .copy-link { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  a { color: #000 !important; text-decoration: none !important; background: none !important; }
  a.chip, ul.pubs .venue { color: #000 !important; }
  a.chip { border: 0; padding: 0; }
  a.chip::before { content: "["; } a.chip::after { content: "]"; }
  ul.pubs .me { background: none; text-decoration: underline; }
  .reveal { opacity: 1; transform: none; }
  main { padding: 0; }
}

/* Year jump row on the papers page */
.jump { font-size: 0.8rem; color: var(--muted); margin: 0 0 6px; }
.filters { margin-bottom: 22px; }
.jump .sep { margin: 0 2px; }

/* Timeline durations, computed by script.js */
ul.tl .dur { color: var(--muted); font-size: var(--fs-small); font-weight: 400; margin-left: 6px; }

/* Copied confirmation */
.copy-email { position: relative; }
.copy-email .toast, .copy-link .toast {
  position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%) translateY(4px);
  background: var(--fg); color: var(--bg); font-size: var(--fs-small); line-height: 1; padding: 6px 9px; border-radius: 5px;
  white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity 0.15s ease, transform 0.15s ease;
}
.copy-email.copied .toast, .copy-link.copied .toast { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Reading progress hairline, papers page only */
.progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: var(--accent); z-index: 20; }


/* Dark-only image tweaks: the Anthropic mark and the social icons are black-on-transparent */
:root[data-theme="dark"] img[src$="anthropic.png"], :root[data-theme="dark"] .socials img { filter: invert(1); }

/* Theme switch, bottom right: the knob sits on the active mode's icon */
.theme-toggle {
  position: fixed; right: 20px; bottom: 20px; z-index: 15;
  width: 64px; height: 32px; border-radius: 999px; border: 1px solid var(--rule);
  background: var(--card); color: var(--muted); cursor: pointer; padding: 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}
/* Track shows the mode you can switch to, faintly; the knob carries the current mode's icon. */
.theme-toggle > svg { position: absolute; top: 7px; width: 16px; height: 16px; opacity: 0.6; }
.theme-toggle > .sun { left: 8px; }
.theme-toggle > .moon { right: 8px; display: block; }
.theme-toggle .knob {
  position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--fg); color: var(--bg); transition: transform 0.22s ease;
  display: flex; align-items: center; justify-content: center;
}
.theme-toggle .knob svg { width: 14px; height: 14px; display: none; }
.theme-toggle .knob .sun { display: block; }
:root[data-theme="dark"] .theme-toggle .knob { transform: translateX(32px); }
:root[data-theme="dark"] .theme-toggle .knob .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .knob .moon { display: block; }
:root[data-theme="dark"] .theme-toggle > .sun { display: block; }
.theme-toggle:hover .knob { transform: translateX(2px); }
:root[data-theme="dark"] .theme-toggle:hover .knob { transform: translateX(30px); }
@media print { .theme-toggle { display: none !important; } }
