/* Layout: one reading column (~48rem) — name, bio and portrait up top, then quiet sections;
   the Arena ranks are the only place the display face is set large. */
:root {
  --bg: #fbfcfd;
  --surface: #eff3f8;
  --fg: #151a22;
  --muted: #5a6474;
  --line: #dfe4eb;
  --accent: #1d4f91;
  --bar: #2b61ab;
  --matte: #ffffff;

  --font-display: "Newsreader", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-body: "IBM Plex Sans", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1218;
    --surface: #161d27;
    --fg: #e3e8ef;
    --muted: #9aa5b5;
    --line: #27303c;
    --accent: #8db6ef;
    --bar: #6e9ee2;
    --matte: #f3f5f8;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0e1218;
  --surface: #161d27;
  --fg: #e3e8ef;
  --muted: #9aa5b5;
  --line: #27303c;
  --accent: #8db6ef;
  --bar: #6e9ee2;
  --matte: #f3f5f8;
  color-scheme: dark;
}

*, *::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: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; }

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

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.page {
  max-width: 48rem;
  margin: 0 auto;
  padding-block: 3.5rem 2.5rem;
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
}

/* ---------- Shared type ---------- */
.eyebrow, .meta {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

section { margin-top: 3.5rem; }

h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.6rem;
  line-height: 1.2;
  margin: 0 0 1.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  text-wrap: balance;
}
h2 .aside {
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 400;
}

/* ---------- Intro ---------- */
.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 11rem;
  gap: 2.5rem;
  align-items: start;
}
.intro-text { min-width: 0; }

.name {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2.4rem, 6vw, 3.1rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin: 0;
}

.role {
  margin: 0.6rem 0 1.5rem;
  font-size: 1.05rem;
  color: var(--muted);
}

.bio p { margin: 0 0 1rem; max-width: 38rem; }

.contact {
  list-style: none;
  padding: 0;
  margin: 1.4rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.4rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.portrait img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 480 / 497;
  border-radius: 4px;
  background: var(--surface);
}

/* ---------- Shipped models ---------- */
.feature {
  background: var(--surface);
  border-radius: 6px;
  padding: 1.5rem 1.5rem 1.4rem;
}
.feature-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1rem;
}
.feature h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.4rem;
  line-height: 1.25;
  margin: 0;
}
.feature h3 a { color: var(--fg); text-decoration: none; }
.feature h3 a:hover { color: var(--accent); }
.feature p { max-width: 38rem; margin: 0.6rem 0 1.1rem; }

.ranks {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}
.ranks li {
  background: var(--bg);
  padding: 0.85rem 1rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}
.rank {
  font-family: var(--font-display);
  font-size: 2.6rem;
  line-height: 1;
  color: var(--accent);
  font-variant-numeric: lining-nums tabular-nums;
}
.rank .hash { font-size: 0.55em; vertical-align: 0.6em; margin-right: 0.04em; }
.cat { font-size: 0.85rem; line-height: 1.35; }

.lc { margin-top: 2.25rem; }
.lc-caption { margin: 0 0 0.6rem; font-size: 0.925rem; color: var(--muted); }

.lc-row {
  display: grid;
  grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: stretch;
  border-top: 1px solid var(--line);
}
.lc-row.lc-head { border-top: 0; }
.lc-head .lc-track { padding-bottom: 0.4rem; }

.lc-name { min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; padding: 0.7rem 0; }
.lc-name a { font-weight: 500; }

.lc-track {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: center;
  min-height: 1.75rem;
  background:
    linear-gradient(to right, var(--line) 1px, transparent 1px) 0 0 / calc(100% / 3) 100% repeat-x;
  box-shadow: inset -1px 0 0 var(--line);
}
.lc-head .lc-track span {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding-left: 0.55rem;
  line-height: 1.3;
}
.lc-bar {
  grid-row: 1;
  height: 0.6rem;
  margin-inline: 0.55rem;
  border-radius: 0.3rem;
  background: var(--bar);
}
.lc-bar.pre { grid-column: 1 / 2; }
.lc-bar.mid-post { grid-column: 2 / 4; }
.lc-bar.post { grid-column: 3 / 4; }

/* ---------- Experience ---------- */
.timeline { list-style: none; padding: 0; margin: 0; display: grid; gap: 1.6rem; }
.job {
  display: grid;
  grid-template-columns: 10rem minmax(0, 1fr);
  gap: 1.25rem;
}
.when {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
  padding-top: 0.15rem;
  font-variant-numeric: tabular-nums;
}
.job h3 { font-size: 1.05rem; font-weight: 600; line-height: 1.35; margin: 0; }
.job .title { margin: 0.1rem 0 0; color: var(--muted); }
.job .desc { margin: 0.4rem 0 0; max-width: 38rem; }

/* ---------- Publications ---------- */
.pubs { list-style: none; padding: 0; margin: 0; display: grid; gap: 2.1rem; }
.pub {
  display: grid;
  grid-template-columns: 12.5rem minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}
.thumb {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  max-width: 100%;
  background: var(--matte);
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}
.thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 0.4rem;
  transition: opacity 0.25s ease;
}
.thumb .alt { opacity: 0; }
.thumb.swap:hover .alt, .thumb.swap:focus-visible .alt { opacity: 1; }
.thumb.swap:hover .main, .thumb.swap:focus-visible .main { opacity: 0; }

.pub-body { min-width: 0; }
.venue { margin: 0 0 0.3rem; }
.venue .tag { color: var(--accent); }
.pub h3 {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.35;
  margin: 0 0 0.3rem;
  text-wrap: balance;
}
.pub h3 a { color: var(--fg); text-decoration: none; }
.pub h3 a:hover { color: var(--accent); }
.authors { margin: 0; font-size: 0.9rem; color: var(--muted); }
.authors strong { color: var(--fg); font-weight: 600; }
.pub .desc { margin: 0.5rem 0; font-size: 0.925rem; max-width: 36rem; }
.links {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1.1rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

/* ---------- Patents, service ---------- */
.plain { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.9rem; }
.plain li { display: flex; flex-direction: column; gap: 0.15rem; }
.plain p { margin: 0; }
.service { margin: 0; max-width: 38rem; }

/* ---------- Footer ---------- */
footer {
  margin-top: 4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
}

/* ---------- Narrow screens ---------- */
@media (max-width: 640px) {
  .page { padding-block: 2.25rem 2rem; }
  .intro { grid-template-columns: 1fr; gap: 1.25rem; }
  .portrait { order: -1; width: 7.5rem; }
  section { margin-top: 2.75rem; }
  .feature { padding: 1.2rem 1.1rem; }
  .ranks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lc-row { grid-template-columns: 1fr; gap: 0.35rem; }
  .lc-row:not(.lc-head) { padding-bottom: 0.7rem; }
  .lc-name { padding: 0.7rem 0 0; }
  .lc-head > span:first-child { display: none; }
  .lc-head .lc-track span { font-size: 0.62rem; padding-left: 0.4rem; letter-spacing: 0.05em; }
  .job { grid-template-columns: 1fr; gap: 0.2rem; }
  .pub { grid-template-columns: 1fr; gap: 0.8rem; }
  .thumb { aspect-ratio: 16 / 9; }
}

@media (prefers-reduced-motion: reduce) {
  .thumb img { transition: none; }
}
