/* Site layout and components. Every color, font and shape comes from the
   style profile in tokens.css (Style Lab); change the look there, not here. */

:root {
  --shadow: 0 1px 2px rgb(0 0 0 / calc(0.06 * var(--shadow-strength))),
            0 10px 28px rgb(0 0 0 / calc(0.10 * var(--shadow-strength)));
  --shadow-hover: 0 2px 4px rgb(0 0 0 / calc(0.07 * var(--shadow-strength))),
                  0 16px 40px rgb(0 0 0 / calc(0.13 * var(--shadow-strength)));
  --page: 1200px;       /* layout width; prose stays at --measure */
  --gutter: 24px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--base-size);
  line-height: var(--line-height);
  -webkit-font-smoothing: antialiased;
}
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-text); }
strong { color: var(--heading); }
h1, h2, h3 {
  font-family: var(--font-heading); color: var(--heading);
  font-weight: var(--heading-weight); letter-spacing: var(--heading-tracking); line-height: 1.2;
}
code { font-family: var(--font-mono); font-size: .88em; background: var(--code-bg); color: var(--code-text); padding: .12em .38em; border-radius: calc(var(--radius) * .4); }

.wrap { width: 100%; max-width: var(--page); margin: 0 auto; padding: 0 var(--gutter); }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.brand { font-family: var(--font-heading); font-weight: var(--heading-weight); letter-spacing: var(--heading-tracking); font-size: 1.2rem; color: var(--heading); text-decoration: none; }
.brand::before { content: ""; display: inline-block; width: .55em; height: .55em; border-radius: 50%; background: var(--accent-2); margin-right: .5em; vertical-align: .05em; }
.brand:hover { color: var(--heading); }
nav { display: flex; gap: 4px; flex-wrap: wrap; }
nav a { color: var(--muted); text-decoration: none; font-size: .95rem; font-weight: 500; padding: 7px 14px; border-radius: 999px; }
nav a:hover { color: var(--heading); background: var(--surface-2); }
nav a[aria-current="page"] { color: var(--on-accent); background: var(--accent); }

main.wrap { padding-top: 48px; padding-bottom: 64px; }
.footer { color: var(--muted); font-size: .85rem; padding-top: 24px; padding-bottom: 40px; }
.footer::before { content: ""; display: block; height: 1px; background: var(--border); margin-bottom: 24px; }

/* about */
.hero { display: flex; gap: 36px; align-items: center; }
.portrait {
  flex: none; width: 168px; height: 168px; border-radius: 50%;
  background: linear-gradient(150deg, color-mix(in srgb, var(--accent) 35%, var(--surface-2)), var(--surface-2));
  border: 4px solid var(--bg); box-shadow: var(--shadow), 0 0 0 3px var(--accent-2);
  display: grid; place-items: center; overflow: hidden;
  font-family: var(--font-heading); font-weight: var(--heading-weight); font-size: 3rem; color: var(--accent-text);
}
.portrait img { width: 100%; height: 100%; object-fit: cover; }
.hero h1 { font-size: clamp(2.3rem, 5vw, 3.3rem); line-height: 1.08; margin: 0 0 .25em; }
.headline { margin: 0 0 18px; color: var(--muted); font-size: 1.15rem; max-width: 36em; }
.icon-links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.icon-links a {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; min-width: 40px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  color: var(--muted); text-decoration: none; font-size: .9rem;
}
.icon-links a:hover { color: var(--accent-text); border-color: var(--accent); }
.icon-links svg { width: 18px; height: 18px; fill: currentColor; flex: none; }
.icon-links svg[fill="none"] { fill: none; }
.icon-links svg circle[fill="currentColor"] { fill: currentColor; }

.about-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 56px; margin-top: 44px; align-items: start; }
.prose { max-width: var(--measure); }
.prose h2 { font-size: 1.6rem; margin: 1.8em 0 .5em; }
.prose p { margin: 0 0 1em; }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 1.2em; }
.prose li { margin: .3em 0; }
.prose li::marker { color: var(--accent-text); }
.prose img { max-width: 100%; border-radius: var(--radius); }
.about { font-size: 1.05rem; }
.about p:first-child { margin-top: 0; }

.news {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px 24px;
}
.news h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .12em; color: var(--accent-text); margin: 0 0 8px; }
.news ul { list-style: none; margin: 0; padding: 0; }
.news li { display: flex; flex-direction: column; gap: 2px; padding: 12px 0; border-bottom: 1px solid var(--border); font-size: .95rem; line-height: 1.55; }
.news li:last-child { border-bottom: 0; padding-bottom: 0; }
.news .date { color: var(--muted); font-size: .82rem; font-weight: 600; font-variant-numeric: tabular-nums; }

/* page headings */
.page-title { font-size: clamp(2.1rem, 5vw, 3.1rem); line-height: 1.08; margin: 0 0 .3em; }
.lede { color: var(--muted); font-size: 1.15rem; margin: 0 0 32px; max-width: 36em; }

/* project tiles */
.tiles { display: grid; gap: 24px; }
.tile {
  display: grid; grid-template-columns: 340px 1fr; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); color: inherit; text-decoration: none;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: var(--accent); color: inherit; }
.tile-body { padding: 28px 32px; align-self: center; }
.tile h2 { margin: 0 0 8px; font-size: 1.6rem; }
.tile p { margin: 0 0 14px; color: var(--text); }
.more { color: var(--accent-text); font-weight: 600; font-size: .95rem; }

.thumb {
  --thumb-bg: var(--surface-2);
  background: var(--thumb-bg); color: var(--accent);
  display: grid; place-items: center; min-height: 200px; position: relative;
}
.thumb::after { content: ""; position: absolute; right: 18px; top: 18px; width: 12px; height: 12px; border-radius: 50%; background: var(--accent-2); }
.thumb svg { width: 50%; max-width: 140px; height: auto; }
.banner .thumb { border-radius: var(--radius); min-height: 240px; margin: 8px 0 28px; border: 1px solid var(--border); }
.banner .thumb svg { max-width: 180px; }

/* badges */
.badges { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 24px; }
.badge {
  display: inline-block; padding: 6px 15px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--heading); text-decoration: none; font-size: .88rem; font-weight: 600;
}
.badge:hover { border-color: var(--accent); color: var(--accent-text); }
.badge.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.badge.primary:hover { filter: brightness(1.08); color: var(--on-accent); }

.project { max-width: 900px; }
.back { display: inline-block; margin-bottom: 16px; color: var(--muted); text-decoration: none; font-size: .95rem; }
.back:hover { color: var(--accent-text); }

/* research */
.papers { display: grid; gap: 20px; }
.paper {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 26px 30px;
}
.paper-meta { display: flex; gap: 10px; align-items: center; font-size: .85rem; color: var(--muted); }
.venue { color: var(--accent-text); font-weight: 600; text-transform: uppercase; letter-spacing: .1em; font-size: .76rem; }
.paper h2 { font-size: 1.4rem; margin: 6px 0 4px; }
.authors { margin: 0 0 10px; color: var(--muted); }
.paper > p:not(.authors) { margin: 0 0 16px; max-width: var(--measure); }
.paper .badges { margin: 0; }

/* resume */
.resume-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 24px; }
.resume-head .page-title { margin: 0; }
.resume-pdf { width: 100%; height: 82vh; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.resume-placeholder {
  border: 2px dashed var(--border); border-radius: var(--radius); padding: 56px 24px;
  text-align: center; color: var(--muted); background: var(--surface);
}

/* TODO markers (draft only) */
mark.todo { background: color-mix(in srgb, var(--warning) 22%, transparent); color: var(--heading); border-radius: 4px; padding: 0 .25em; font-weight: 600; }
.todo-note { background: color-mix(in srgb, var(--warning) 16%, transparent); color: var(--heading); padding: 10px 14px; border-radius: calc(var(--radius) * .5); font-size: .9rem; }

/* tablets */
@media (max-width: 900px) {
  .about-grid { grid-template-columns: 1fr; gap: 32px; }
  .tile { grid-template-columns: 240px 1fr; }
}
/* phones */
@media (max-width: 640px) {
  :root { --gutter: 16px; }
  body { font-size: 16px; }
  main.wrap { padding-top: 28px; }
  .topbar-inner { justify-content: center; }
  .brand { width: 100%; text-align: center; }
  nav { justify-content: center; }
  nav a { padding: 6px 11px; }
  .hero { flex-direction: column; text-align: center; gap: 20px; }
  .portrait { width: 128px; height: 128px; font-size: 2.4rem; }
  .icon-links { justify-content: center; }
  .icon-links a span { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tile { grid-template-columns: 1fr; }
  .tile-body { padding: 22px 22px; }
  .thumb { min-height: 150px; }
  .paper { padding: 22px 20px; }
}

/* Forced light mode (2026-11-21): base.html sets data-theme="light". */
:root[data-theme="light"] { color-scheme: light; }

/* ---------------------------------------------------------------
   One-page site (2026-11-21): intro, publications, contact.     */
.intro {
  display: grid; grid-template-columns: minmax(0, 1fr) 380px;
  grid-template-areas: "text photo"; gap: 56px; align-items: start;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  padding: 48px 0;
}
.intro-text { grid-area: text; }
.intro-photo { grid-area: photo; margin: 0; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.intro-photo img {
  width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; display: block;
  border-radius: calc(var(--radius) * 1.4); box-shadow: var(--shadow);
}
.intro h1 { font-size: clamp(2.6rem, 6vw, 4rem); line-height: 1.02; margin: 0 0 .3em; }
.roles { margin: 0 0 26px; display: flex; flex-direction: column; gap: 2px; }
.roles span { font-size: 1.15rem; color: var(--heading); font-weight: 500; }
.roles span + span { color: var(--muted); font-weight: 400; }
.bio { font-size: 1.06rem; max-width: 40em; }
.bio p:last-child { margin-bottom: 0; }
.todo-link { border-style: dashed !important; border-color: var(--warning) !important; opacity: .7; }

.pubs, .contact { padding: 44px 0 8px; }
.pubs h2, .contact h2 { font-size: 1.6rem; margin: 0 0 20px; }
.pub-list { list-style: none; margin: 0; padding: 0; }
.pub { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 16px; padding: 16px 0; }
.pub + .pub { border-top: 1px solid var(--border); }
.pub-year { color: var(--accent-text); font-weight: 600; font-variant-numeric: tabular-nums; padding-top: 1px; }
.pub-title { font-weight: 600; font-size: 1.08rem; color: var(--heading); text-decoration: none; }
.pub-title:hover { color: var(--accent-text); text-decoration: underline; }
.pub-authors, .pub-venue { margin: 4px 0 0; color: var(--muted); font-size: .96rem; }
.pub-authors strong { color: var(--text); }
.pubs { border-bottom: 1px solid var(--border); padding-bottom: 36px; }
.contact p { margin: 0; font-size: 1.06rem; }

@media (max-width: 760px) {
  .intro { grid-template-columns: 1fr; grid-template-areas: "photo" "text"; gap: 28px; padding: 32px 0; }
  .intro-photo img { max-width: 260px; }
  .intro-text { text-align: left; }
  .pub { grid-template-columns: 1fr; gap: 2px; }
}

/* news (2026-11-21) */
.pub-more { margin: 16px 0 0; color: var(--muted); font-size: .95rem; }

.news-list { padding: 44px 0 36px; border-bottom: 1px solid var(--border); }
.news-list h2 { font-size: 1.6rem; margin: 0 0 16px; }
.dated-list { list-style: none; margin: 0; padding: 0; }
.dated-list li { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 16px; padding: 7px 0; }
.dated-when { color: var(--accent-text); font-weight: 600; font-variant-numeric: tabular-nums; }
@media (max-width: 760px) {
  .dated-list li { grid-template-columns: 1fr; gap: 0; padding: 8px 0; }
}
.dated-list a { font-style: italic; }

/* Decorations ported from Style Lab's site-decor.css (Adam's picks, 2026-11-21):
   "shapes" around the headshot and the top colour "band". Colours come only
   from the profile tokens. */
body { overflow-x: clip; position: relative; }   /* the shapes may poke past the edge */

/* shapes: an aqua circle and a tilted outlined square around the headshot */
.intro-photo { position: relative; isolation: isolate; }
.intro-photo::before, .intro-photo::after { content: ""; position: absolute; z-index: -1; pointer-events: none; }
.intro-photo::before {   /* a solid circle peeking out top-right */
  top: -46px; right: -52px; width: 190px; height: 190px; border-radius: 50%;
  background: color-mix(in srgb, var(--accent-2) 45%, var(--bg));
}
.intro-photo::after {    /* an outlined square, tilted, bottom-left */
  left: -38px; top: 62%; width: 110px; height: 110px; border-radius: 14px; transform: rotate(18deg);
  border: 3px solid color-mix(in srgb, var(--accent) 40%, var(--bg));
}

/* band: a colour strip across the top of the page */
body { border-top: 6px solid; border-image: linear-gradient(90deg, var(--accent), var(--accent-2)) 1; }
@media (max-width: 760px) {
  /* keep the shapes hugging the photo: the photo block is photo-sized, centred */
  .intro-photo { width: 280px; max-width: 100%; margin-inline: auto; }
  .intro-photo img { max-width: 100%; }
  .intro-photo::before { top: -30px; right: -34px; width: 130px; height: 130px; }
  .intro-photo::after { left: -26px; width: 78px; height: 78px; border-radius: 11px; }
}
