/* Design system: see DESIGN.md. Structure after jonbarron.info,
   typographic restraint after pascalmichaillat.org. */

:root {
  color-scheme: light dark;
  --bg: #faf8f4;
  --ink: #211d18;
  --muted: #6f675c;
  --faint: #6e665b; /* WCAG AA >= 4.5:1 against --bg */
  --rule: #e4ddd1;
  --accent: #8d3b1b;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
}

/* dark palette: system preference (unless light forced), or forced via toggle */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #181512;
    --ink: #e8e2d7;
    --muted: #a1988a;
    --faint: #948b7e; /* WCAG AA >= 4.5:1 against --bg */
    --rule: #302b24;
    --accent: #d4906a;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #181512;
  --ink: #e8e2d7;
  --muted: #a1988a;
  --faint: #948b7e;
  --rule: #302b24;
  --accent: #d4906a;
}

:root[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; }

html {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0 auto;
  max-width: 44rem;
  padding: 3.5rem 1.35rem 2rem;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  text-underline-offset: 2px;
}
a:hover { text-decoration-color: var(--accent); }

h1 {
  font-size: 2.15rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0 0 0.4rem;
  line-height: 1.15;
}

h2 {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 1.4rem;
}

section {
  border-top: 1px solid var(--rule);
  padding-top: 1.6rem;
  margin-top: 2.4rem;
}

p { margin: 0 0 1rem; }

/* ---------- skip link ---------- */

.skip-link {
  position: absolute;
  left: -9999px;
  font-family: var(--mono);
  font-size: 0.74rem;
  background: var(--bg);
  padding: 0.4rem 0.6rem;
}
.skip-link:focus {
  left: 1rem;
  top: 1rem;
  z-index: 1;
}

/* ---------- site navigation ---------- */

.sitenav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.15rem;
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.02em;
  margin-bottom: 3.2rem;
}
.sitenav a {
  color: var(--muted);
  text-decoration: none;
}
.sitenav a:hover { color: var(--accent); }
.sitenav a.active {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--faint);
  text-underline-offset: 4px;
}
.sitenav a.home {
  color: var(--ink);
  margin-right: auto;
}
.sitenav .theme-toggle {
  font: inherit;
  background: none;
  border: 0;
  padding: 0;
  color: var(--muted);
  cursor: pointer;
  line-height: inherit;
}
.sitenav .theme-toggle:hover { color: var(--accent); }

/* ---------- subpage header ---------- */

.pagehead { margin-bottom: 2.2rem; }
.pagehead h1 { font-size: 1.7rem; }
.pagehead .tagline { font-size: 0.95rem; margin: 0; }

/* ---------- header ---------- */

.masthead {
  display: flex;
  gap: 1.75rem;
  align-items: flex-start;
  justify-content: space-between;
}

.masthead .intro { max-width: 33rem; }

.tagline {
  color: var(--muted);
  font-style: italic;
  font-size: 1.05rem;
  margin-bottom: 1.1rem;
}

.linkrow {
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.02em;
  color: var(--faint);
  margin: 1.2rem 0 0;
}
.linkrow a { white-space: nowrap; }

.bio { margin-top: 1.5rem; }
.bio p { font-size: 0.98rem; }

/* ---------- news ---------- */

.news { margin: 0; }
.news > div {
  display: grid;
  grid-template-columns: 5.2rem 1fr;
  gap: 0 1.1rem;
  margin-bottom: 0.65rem;
}
.news dt {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--faint);
  padding-top: 0.3rem;
  white-space: nowrap;
}
.news dd { margin: 0; font-size: 0.95rem; }
.news dd p { margin: 0; }

details.more-news { margin-top: 0.9rem; }
details.more-news > summary {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
  margin-bottom: 1rem;
}
details.more-news > summary::before { content: "+ "; }
details.more-news[open] > summary::before { content: "− "; }
details.more-news > summary::-webkit-details-marker { display: none; }

/* ---------- publications ---------- */

.year {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--faint);
  margin: 1.7rem 0 0.9rem;
}
.year:first-of-type { margin-top: 0; }

.pub { margin-bottom: 1.35rem; }
.pub .title {
  font-size: 1.04rem;
  font-weight: 600;
  line-height: 1.35;
  margin: 0;
}
.pub .title a { color: inherit; }
.pub .authors {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0.1rem 0 0;
}
.pub .authors .me { color: var(--ink); font-weight: 500; }
.pub .where {
  font-size: 0.9rem;
  font-style: italic;
  color: var(--muted);
  margin: 0.05rem 0 0;
}
.pub .where .reflink {
  font-family: var(--mono);
  font-style: normal;
  font-size: 0.72rem;
  margin-left: 0.45rem;
}
.pub .cite { margin-top: 0.15rem; }
.pub .cite > summary {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--faint);
  cursor: pointer;
  list-style: none;
}
.pub .cite > summary::before { content: "+ "; }
.pub .cite[open] > summary::before { content: "− "; }
.pub .cite > summary::-webkit-details-marker { display: none; }
.pub .cite p {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0.3rem 0 0;
}

/* ---------- generic entry lists (talks, teaching, experience) ---------- */

.entry {
  display: grid;
  grid-template-columns: 5.2rem 1fr;
  gap: 0 1.1rem;
  margin-bottom: 1.05rem;
}
.entry .when {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--faint);
  padding-top: 0.3rem;
  white-space: nowrap;
}
.entry .what { font-size: 0.98rem; }
.entry .what .head { font-weight: 600; }
.entry .what .sub {
  display: block;
  font-size: 0.9rem;
  color: var(--muted);
}
.entry .what .detail { font-size: 0.9rem; color: var(--muted); }
.entry .what .detail ul { margin: 0.35rem 0 0; padding-left: 1.1rem; }
.entry .what .detail li { margin-bottom: 0.15rem; }

.plain { list-style: none; margin: 0; padding: 0; }
.plain li { font-size: 0.95rem; margin-bottom: 0.45rem; }

/* ---------- footer ---------- */

footer {
  max-width: 44rem;
  margin: 0 auto;
  padding: 0 1.35rem 3rem;
}
footer p {
  border-top: 1px solid var(--rule);
  padding-top: 1.2rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--faint);
}
footer a { color: inherit; }

/* ---------- small screens ---------- */

@media (max-width: 34rem) {
  body { padding-top: 2.2rem; }
  .news > div, .entry { grid-template-columns: 1fr; }
  .news dt, .entry .when { padding-top: 0; }
}
