/* =========================================================
   david-i-schwartz.github.io — one stylesheet, phone first.
   Colours and fonts live in :root. Change them there.
   ========================================================= */

:root {
  --bg: #FBF8F1;          /* warm paper */
  --panel: #F2EDE1;
  --line: #DED6C4;
  --ink: #1F1B16;
  --ink-soft: #5F5648;
  --muted: #72685A;        /* 5.2:1 on paper, 4.7:1 on panels (was #8A8070, 3.7:1) */
  --accent: #0E6B6B;      /* deep teal */
  --accent-dark: #0A4F4F;
  --accent-soft: #D9ECEA;
  --amber: #C7811A;
  --on-accent: #FFFFFF;    /* text on teal buttons */
  --on-amber: #1F1B16;     /* text on the amber skip link */
  --f-serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --f-sans: 'Source Sans 3', 'Helvetica Neue', Arial, sans-serif;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171A;
    --panel: #1E2126;
    --line: #2E333A;
    --ink: #EDE8DF;
    --ink-soft: #B8B0A2;
    --muted: #8E887C;
    --accent: #5FC2BE;
    --accent-dark: #8BD8D4;
    --accent-soft: #163B3B;
    --amber: #E6A446;
    --on-accent: #15171A;  /* dark text on the light teal used in dark mode (8.5:1; white was 2.1:1) */
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
/* Jump links: land below the sticky header instead of under it */
[id] { scroll-margin-top: 5rem; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  overflow-wrap: break-word;   /* long web addresses wrap instead of widening the page */
  /* footer stays at the bottom of the window on short pages */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1 0 auto; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-dark); }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; }
h1, h2, h3 { font-family: var(--f-serif); font-weight: 600; line-height: 1.15; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 5vw, 3rem); }
h2 { font-size: clamp(1.5rem, 3.4vw, 2rem); margin: 2.4rem 0 0.9rem; }
h3 { font-size: 1.2rem; margin: 1.6rem 0 0.6rem; color: var(--ink-soft); }
p { margin: 0 0 1em; }
[hidden] { display: none !important; }
.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.skip { position: absolute; left: -9999px; top: 0; z-index: 30; background: var(--amber); color: var(--on-amber); padding: 10px 14px; }
.skip:focus { left: 10px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.soft { color: var(--muted); }
.nowrap { white-space: nowrap; }
.count { font: 600 0.8rem var(--f-sans); color: var(--muted); vertical-align: middle; margin-left: 6px; }

/* ---------- Header ---------- */
.top { position: sticky; top: 0; z-index: 10; background: var(--bg); border-bottom: 1px solid var(--line); }
.top__inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 16px; min-height: 60px; }
.brand { font-family: var(--f-serif); font-weight: 700; font-size: 1.35rem; color: var(--ink); text-decoration: none; padding: 10px 0; }
.brand:hover { color: var(--accent); }
.menu-btn { display: none; font: 600 1rem var(--f-sans); background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: 0 16px; min-height: 40px; cursor: pointer; }
.js .menu-btn { display: block; }
.nav { flex-basis: 100%; }
.nav ul { list-style: none; margin: 0; padding: 0 0 12px; display: flex; flex-wrap: wrap; gap: 0 18px; }
.nav a { display: inline-block; padding: 8px 0; font-weight: 600; text-decoration: none; color: var(--ink-soft); }
.nav a:hover { color: var(--accent); }
.nav a[aria-current="page"] { color: var(--accent); box-shadow: inset 0 -3px 0 var(--accent); }
.js .nav { display: none; }
.js .nav.is-open { display: block; }
.js .nav.is-open ul { flex-direction: column; padding-bottom: 16px; }
.js .nav.is-open a { display: block; font-size: 1.25rem; padding: 10px 0; border-bottom: 1px solid var(--line); box-shadow: none; }
@media (min-width: 860px) {
  .js .menu-btn { display: none; }
  .js .nav, .nav { display: block; flex-basis: auto; }
  .nav ul { padding: 0; justify-content: flex-end; }
}

/* ---------- Hero (home) ---------- */
.hero { padding: 40px 0 20px; }
/* Photo with titles beside it at every width; name, tagline and links below on phones,
   to the right of the photo (under the titles) on wider screens. */
.hero__inner { display: grid; gap: 16px 18px; align-items: center; grid-template-columns: 112px minmax(0, 1fr); grid-template-areas: "photo aff" "text text"; }
.hero__inner--nophoto { grid-template-columns: minmax(0, 1fr); grid-template-areas: "aff" "text"; }
.hero__photo { grid-area: photo; width: 112px; height: 112px; border-radius: 50%; object-fit: cover; border: 4px solid var(--panel); box-shadow: 0 2px 12px rgba(0,0,0,.08); }
.hero__aff { grid-area: aff; list-style: none; margin: 0; padding: 0; font-size: 0.92rem; line-height: 1.35; color: var(--ink-soft); }
.hero__aff li + li { margin-top: 5px; }
.hero__aff a { color: var(--accent); font-weight: 600; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.hero__aff a:hover { color: var(--accent-dark); }
.hero__role { font-weight: 600; color: var(--ink); }
.hero__text { grid-area: text; }
.hero__text h1 { margin-top: 0; }
.hero__kicker { margin: 0 0 6px; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.85rem; }
.lede { font-family: var(--f-serif); font-size: 1.2rem; color: var(--ink-soft); margin: 0.6rem 0 1rem; }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-block; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; font-weight: 600; font-size: 0.95rem; color: var(--ink-soft); background: var(--panel); }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip--solid { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.chip--solid:hover { background: var(--accent-dark); color: var(--on-accent); }
@media (min-width: 700px) {
  .hero__inner { grid-template-columns: 220px minmax(0, 1fr); grid-template-areas: "photo aff" "photo text"; align-content: center; row-gap: 12px; }
  .hero__inner--nophoto { grid-template-columns: minmax(0, 1fr); grid-template-areas: "aff" "text"; }
  .hero__photo { width: 220px; height: 220px; }
  .hero__aff { align-self: end; font-size: 1rem; }
  .hero__text { align-self: start; }
}
.home__bio { padding: 12px 20px 8px; }
.home__block { padding: 8px 20px 0; }
.home__two { display: grid; gap: 24px; }
@media (min-width: 820px) { .home__two { grid-template-columns: 1fr 1fr; gap: 40px; } }
.block__head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.more { font-weight: 600; white-space: nowrap; }

/* ---------- Page scaffolding ---------- */
.page { padding: 36px 20px 60px; }
.page__head { margin-bottom: 1.4rem; }
.jump { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 0.8rem; font-size: 0.95rem; }
.jump a { font-weight: 600; text-decoration: none; padding: 4px 0; border-bottom: 1px dotted var(--line); }
.crumb { margin: 0 0 1rem; font-size: 0.95rem; }
.crumb a { text-decoration: none; font-weight: 600; }

.prose { max-width: 70ch; }
.prose > *:first-child { margin-top: 0; }
.prose h2 { font-size: 1.5rem; margin-top: 1.8rem; }
.prose h3 { margin-top: 1.4rem; }
.prose img { border-radius: var(--radius); margin: 1rem 0; }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose blockquote { margin: 1rem 0; padding: 0.2rem 0 0.2rem 1rem; border-left: 3px solid var(--accent-soft); color: var(--ink-soft); }
.prose code { font-size: 0.92em; background: var(--panel); padding: 1px 5px; border-radius: 4px; }
.prose pre { background: var(--panel); padding: 14px; border-radius: var(--radius); overflow: auto; }
.prose table { border-collapse: collapse; width: 100%; }
.prose td, .prose th { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }

/* ---------- Cards ---------- */
.cards { list-style: none; margin: 0 0 1.5rem; padding: 0; display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.cards--tight { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: transform .12s ease, box-shadow .12s ease; }
.card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.08); }
.card--archived { opacity: 0.88; }
.card__link { display: block; color: inherit; text-decoration: none; height: 100%; }
.card__img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.card__img--blank { display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font: 700 2.6rem var(--f-serif); }
.cards--tight .card__img { aspect-ratio: 16 / 8; }
.card__body { padding: 12px 14px 14px; }
.card__title { font-size: 1.1rem; margin: 0 0 2px; color: var(--ink); }
.card__meta { margin: 0 0 6px; font-size: 0.85rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.card__sum { margin: 0; font-size: 0.95rem; color: var(--ink-soft); }

/* ---------- Project page ---------- */
.project__meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0.6rem 0 0; color: var(--ink-soft); }
.tag { display: inline-block; font-size: 0.8rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-dark); }
.tag--archived { background: var(--panel); color: var(--muted); border: 1px solid var(--line); }
.tag--soft { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.project__hero { border-radius: var(--radius); margin: 0 0 1.4rem; max-height: 520px; object-fit: cover; width: 100%; }
.project__grid { display: grid; gap: 28px; }
@media (min-width: 860px) { .project__grid { grid-template-columns: minmax(0, 1fr) 260px; } }
.project__side h2 { font-size: 1rem; margin: 0 0 0.5rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-family: var(--f-sans); }
.side-links { list-style: none; margin: 0 0 1.2rem; padding: 0; }
.side-links li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.gallery { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.gallery img { aspect-ratio: 1; object-fit: cover; border-radius: 8px; }

/* ---------- Videos ---------- */
.videos { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); margin-bottom: 1.5rem; }
.video { margin: 0; }
.video__frame { position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden; border-radius: var(--radius); background: #000; }
.video__frame img { width: 100%; height: 100%; object-fit: cover; }
.video__play { position: absolute; inset: 0; display: grid; place-items: center; }
.video__play svg { width: 64px; height: 64px; background: rgba(0,0,0,.55); border-radius: 50%; padding: 16px; }
.video__frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video figcaption { margin-top: 6px; font-weight: 600; }
.video__date { font-weight: 400; color: var(--muted); }

/* ---------- Lists, tables ---------- */
.list { list-style: none; margin: 0 0 1.2rem; padding: 0; }
.list li { padding: 7px 0; border-bottom: 1px solid var(--line); }
.list--tight li { padding: 4px 0; border-bottom: 0; }
.list__year { display: inline-block; min-width: 4.6em; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
/* Date-range lists (service): fixed date column, wrapped lines line up with the text */
.list--dated li { display: grid; grid-template-columns: 7.6em minmax(0, 1fr); align-items: start; }
.list--dated .list__year { min-width: 0; padding-right: 0.6em; }
/* Year lists (news, awards): wrapped lines line up with the text, not under the year */
.list--hang li { display: flow-root; padding-left: 4.6em; }
.list--hang .list__year { float: left; min-width: 4.6em; margin-left: -4.6em; padding-right: 0.5em; box-sizing: border-box; }
.bullets { margin: 0 0 1rem; padding-left: 1.2rem; }
.bullets li { margin-bottom: 0.5rem; }
/* Publication and press lists: [number] [year] [Link] [citation] columns, so wrapped
   citation lines start under the first word. Phones: citation on its own line below. */
.pubs { margin: 0 0 1.5rem; padding-left: 0; list-style: none; }
.pubs li { display: grid; grid-template-columns: 2.4em 3.4em 3em minmax(0, 1fr); align-items: baseline; padding: 5px 0; border-bottom: 1px solid var(--line); }
.pubs__num { text-align: right; padding-right: 0.5em; font-variant-numeric: tabular-nums; }
.pubs__year { font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.pubs__link { font-weight: 600; }
@media (max-width: 600px) {
  .pubs li { grid-template-columns: 2.4em 3.4em minmax(0, 1fr); }
  .pubs__cite { grid-column: 2 / -1; }
}
.award__link { font-weight: 600; white-space: nowrap; }
.tbl { border-collapse: collapse; width: 100%; margin: 0 0 1.4rem; font-size: 0.97rem; }
.tbl th { text-align: left; font-weight: 600; color: var(--muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; }
.tbl td, .tbl th { padding: 7px 10px 7px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl--narrow { max-width: 520px; }
/* Phones: wide tables scroll sideways inside themselves instead of widening the page */
@media (max-width: 640px) {
  .tbl { display: block; overflow-x: auto; }
  .tbl td.nowrap:last-child { white-space: normal; }  /* term lists wrap; course codes and years stay whole */
}
.dev { margin: 0 0 1.4rem; }
.dev__row { padding: 8px 0; border-bottom: 1px solid var(--line); }
.dev dt { font-weight: 600; }
.dev dd { margin: 2px 0 0; color: var(--ink-soft); }
.fold { margin: 0 0 1.6rem; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; background: var(--panel); }
.fold summary { font-weight: 600; cursor: pointer; }
.btn { display: inline-block; padding: 9px 16px; border-radius: 8px; background: var(--accent); color: var(--on-accent); text-decoration: none; font-weight: 600; border: 1px solid var(--accent); cursor: pointer; font: 600 1rem var(--f-sans); }
.btn:hover { background: var(--accent-dark); color: var(--on-accent); }
.btn--ghost { background: transparent; color: var(--accent); margin-left: 8px; }
.cv__actions { margin: 0.4rem 0 0; }
/* ORCID iD as ORCID recommends showing it (green iD icon + full URL), and its QR code */
.orcid-id { font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.orcid-id img, .orcid-icon { display: inline-block; width: 1em; height: 1em; vertical-align: -0.125em; margin-inline-end: 0.35em; }
.cv__orcid { margin: 0 0 0.6rem; }
.cv .page__head::after { content: ""; display: table; clear: both; }
.cv__qr { display: none; }
@media (min-width: 700px) { .cv__qr { display: block; float: right; width: 96px; height: 96px; margin: 0 0 0.75rem 1.25rem; } }
@media print { .cv__qr { display: block; float: right; width: 0.85in; height: 0.85in; margin: 0 0 0.1in 0.2in; } }

/* ---------- Blog ---------- */
.posts { list-style: none; margin: 0; padding: 0; }
.posts__item { border-bottom: 1px solid var(--line); }
.posts__link { display: grid; gap: 16px; padding: 18px 0; color: inherit; text-decoration: none; }
.posts__link:hover .posts__title { color: var(--accent); }
.posts__img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; }
@media (min-width: 700px) { .posts__link { grid-template-columns: 220px 1fr; align-items: start; } .posts__link:not(:has(img)) { grid-template-columns: 1fr; } }
.posts__date { margin: 0 0 4px; font-size: 0.85rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.posts__title { font-size: 1.4rem; margin: 0 0 6px; }
.posts__sum { margin: 0; color: var(--ink-soft); }
.post .prose { font-family: var(--f-serif); font-size: 1.12rem; line-height: 1.7; }
.post__also { margin-top: 1.6rem; }
.post__nav { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--line); font-weight: 600; }

/* ---------- Footer ---------- */
.foot { margin-top: 40px; border-top: 1px solid var(--line); background: var(--panel); color: var(--ink-soft); font-size: 0.95rem; }
.foot__inner { padding: 28px 20px 32px; display: grid; gap: 18px; }
.foot__links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.foot__links a { font-weight: 600; text-decoration: none; }
.foot__small { margin: 0; color: var(--muted); font-size: 0.85rem; }
@media (min-width: 820px) { .foot__inner { grid-template-columns: 1fr 1fr; } .foot__small { grid-column: 1 / -1; } }

/* ---------- Long lists: first few shown, the rest behind "Show all" (site.js) ---------- */
@media screen { .is-folded { display: none !important; } }
.more-btn { display: inline-block; margin: -0.5rem 0 1.6rem; padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--accent); font: 600 0.9rem var(--f-sans); cursor: pointer; }
.more-btn:hover, .more-btn:focus-visible { border-color: var(--accent); }
.cv__actions .btn--ghost:first-child { margin-left: 0; }
.page h4 { font: 600 0.95rem var(--f-sans); color: var(--muted); margin: 1.2rem 0 0.4rem; text-transform: uppercase; letter-spacing: 0.04em; }

/* ---------- Print (CV page) ---------- */
@media print {
  .more-btn, .js-expand-all { display: none !important; }
  .top, .foot, .jump, .cv__actions, .skip, .crumb { display: none !important; }
  body { background: #fff; color: #000; font-size: 10.5pt; display: block; min-height: 0; }
  .page { padding: 0; }
  a { color: inherit; text-decoration: none; }
  h2, h3 { break-after: avoid; page-break-after: avoid; }
  .tbl { display: table; }
  /* keep single rows whole, but let long tables continue onto the next page (headers repeat) */
  .tbl tr, .pubs li, .list li { break-inside: avoid; page-break-inside: avoid; }
}
