/* ezrakarger.com — shared styles
   Layout: one centered column (max 60rem). The research page has a filter bar
   (type / area / year chips) above a single list grouped by type, with the
   year in a narrow left gutter on wide screens. */

:root {
  --bg: #fbfbf9;
  --bg-raised: #f1f2ee;
  --fg: #17191c;
  --muted: #595e66;
  --faint: #868c95;
  --rule: #e2e3de;
  --accent: #0e5c78;
  --accent-strong: #0a4257;
  --accent-soft: #e2eff3;
  --status: #8a5a00;
  --status-soft: #f7efd9;
  --shadow: 0 1px 2px rgba(23, 25, 28, .06), 0 12px 32px -12px rgba(23, 25, 28, .18);
  --font-display: "Schibsted Grotesk", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-body: "Hanken Grotesk", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --measure: 64ch;
  --gutter: clamp(1rem, 4vw, 2.5rem);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141618;
    --bg-raised: #1d2024;
    --fg: #e8e9e5;
    --muted: #a7acb4;
    --faint: #737982;
    --rule: #2a2e33;
    --accent: #7fc8e2;
    --accent-strong: #a9dced;
    --accent-soft: #15323d;
    --status: #e6b55c;
    --status-soft: #3a2d12;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px -12px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141618;
  --bg-raised: #1d2024;
  --fg: #e8e9e5;
  --muted: #a7acb4;
  --faint: #737982;
  --rule: #2a2e33;
  --accent: #7fc8e2;
  --accent-strong: #a9dced;
  --accent-soft: #15323d;
  --status: #e6b55c;
  --status-soft: #3a2d12;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px -12px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-feature-settings: "kern" 1;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .14em; text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); }
a:hover { color: var(--accent-strong); text-decoration-color: currentColor; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

img { max-width: 100%; height: auto; display: block; }
[hidden] { display: none !important; }

.wrap {
  max-width: 60rem;
  margin-inline: auto;
  padding-inline: var(--gutter);
  padding-bottom: 4rem;
}

/* ---------- masthead ---------- */
.masthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem 2rem;
  flex-wrap: wrap;
  padding-block: 1.6rem 1.1rem;
  border-bottom: 1px solid var(--rule);
}
.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.45rem;
  letter-spacing: -.015em;
  line-height: 1.2;
  margin: 0;
  color: var(--fg);
  text-decoration: none;
}
.brand a { color: inherit; text-decoration: none; }
.brand:hover, .brand a:hover { color: var(--fg); text-decoration: none; }
.nav { display: flex; gap: 1.6rem; flex-wrap: wrap; }
.nav a {
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  padding-block: .2rem;
  border-bottom: 2px solid transparent;
}
.nav a:hover { color: var(--fg); }
.nav a[aria-current="page"] { color: var(--fg); border-bottom-color: var(--accent); }

/* ---------- home ---------- */
.hero {
  display: grid;
  /* photo stays on the right down to ~36rem; the column shrinks with the page */
  grid-template-columns: minmax(0, 1fr) clamp(12rem, 34%, 20rem);
  gap: 2.5rem clamp(1.5rem, 5vw, 5rem);
  align-items: start;
  padding-block: 3rem 2rem;
}
.hero-text { min-width: 0; max-width: var(--measure); }
.roles {
  display: grid;
  gap: .3rem;
  margin: 0 0 1.6rem;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: .95rem;
  line-height: 1.45;
}
.roles strong { font-weight: 600; color: var(--fg); }
.roles span::before { content: "·"; margin-inline: .45em; color: var(--faint); }
.intro p { margin: 0 0 1.1em; }
.intro p:last-child { margin-bottom: 0; }

.portrait {
  margin: 0;
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--bg-raised);
}
.portrait img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }

/* ---------- research: head + filters ---------- */
.page-head { padding-block: 2.5rem 1.25rem; }
.page-head h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2rem, 1.5rem + 2vw, 2.75rem);
  letter-spacing: -.02em;
  line-height: 1.1;
  margin: 0 0 .5rem;
  text-wrap: balance;
}
.page-head p { margin: 0; color: var(--muted); max-width: var(--measure); }

.filters {
  display: grid;
  gap: .55rem;
  padding: .9rem 0 1rem;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.filter-row { display: flex; align-items: baseline; gap: .75rem; }
.filter-label {
  flex: 0 0 3.2rem;
  font-size: .9rem;
  font-weight: 500;
  color: var(--muted);
}
.chips { display: flex; flex-wrap: wrap; gap: .35rem .4rem; }
.chip {
  font: inherit;
  font-size: .86rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: .3rem .75rem;
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.chip:hover { color: var(--fg); border-color: var(--faint); }
.chip[aria-pressed="true"] { color: var(--bg); background: var(--fg); border-color: var(--fg); }
@media (prefers-reduced-motion: reduce) { .chip { transition: none; } }

/* ---------- research: list ---------- */
.type-section { padding-top: 2.25rem; }
.type-section h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: -.015em;
  line-height: 1.15;
  margin: 0 0 1rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--rule);
}
/* entries are numbered 1..K across all visible sections; hidden entries don't count */
#papers-main { counter-reset: paper; }
.papers { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.2rem; }
.paper {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr);
  gap: 0 .5rem;
  min-width: 0;
}
.paper:not([hidden]) { counter-increment: paper; }
.paper-num {
  color: var(--faint);
  font-size: .9rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  line-height: 1.6;
  padding-top: .05rem;
  text-align: right;
  padding-right: .35rem;
}
.paper-num::before { content: counter(paper) "."; }
.paper-body { min-width: 0; }
.paper-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem .6rem; }
.paper-title {
  font-weight: 600;
  font-size: 1.07rem;
  line-height: 1.38;
  color: var(--fg);
  text-decoration: none;
}
a.paper-title:hover { color: var(--accent-strong); text-decoration: underline; text-decoration-color: currentColor; }
.source {
  display: inline-flex; align-items: center;
  font-size: .7rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-soft);
  padding: .1rem .5rem; border-radius: 999px; text-decoration: none; white-space: nowrap;
  transform: translateY(-.1em);
}
.source:hover { color: var(--bg); background: var(--accent); text-decoration: none; }
.paper-authors { color: var(--muted); font-size: .95rem; margin-top: .12rem; }
.paper-authors a { color: var(--muted); text-decoration-color: color-mix(in srgb, var(--muted) 40%, transparent); }
.paper-authors a:hover { color: var(--accent-strong); }
.paper-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem .6rem; margin-top: .22rem; font-size: .9rem; }
.year { color: var(--faint); font-weight: 500; font-variant-numeric: tabular-nums; }
.venue { font-style: italic; color: var(--accent-strong); }
.cite { color: var(--muted); }
.status {
  font-style: normal; font-size: .7rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--status); background: var(--status-soft); padding: .08rem .5rem; border-radius: 999px; white-space: nowrap;
}

.empty { color: var(--muted); padding-top: 2rem; }
.link-button {
  font: inherit; color: var(--accent); background: none; border: 0; padding: 0; cursor: pointer;
  text-decoration: underline; text-underline-offset: .14em;
}

/* ---------- responsive ---------- */
@media (max-width: 44rem) {
  body { font-size: 1rem; }
  .hero { padding-block: 2rem 1.5rem; }
  .roles span { display: block; }
  .roles span::before { content: none; }
  .masthead { padding-block: 1.25rem .9rem; }
  .nav { gap: 1.2rem; }
  .page-head { padding-block: 2rem 1rem; }
  .filter-row { flex-direction: column; gap: .3rem; }
  .filter-label { flex-basis: auto; }
  .paper { grid-template-columns: 2rem minmax(0, 1fr); gap: 0 .35rem; }
}
/* phones: stack, with the photo below the bio */
@media (max-width: 36rem) {
  .hero { grid-template-columns: 1fr; gap: 2rem; }
  .portrait { max-width: 18rem; }
}
