/* ==========================================================================
   João Neves — Personal Academic Website
   Light "technical" theme: monospace headings, navy/blue palette,
   bordered white container on a gray canvas.
   ========================================================================== */

:root {
  --canvas: #eef0f4;
  --paper: #ffffff;
  --paper-alt: #f7f8fa;
  --border: #d7dbe2;
  --border-soft: #e4e7ec;
  --ink: #16233f;
  --ink-body: #3a4a68;
  --ink-muted: #7583a0;
  --accent: #2f52c4;
  --accent-dark: #1d3a9e;
  --footer-bg: #131f38;
  --mono: "JetBrains Mono", "IBM Plex Mono", "Cascadia Mono", Consolas, "Courier New", monospace;
  --sans: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
  --container: 1400px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--canvas);
  color: var(--ink-body);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  padding: 28px 20px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --------------------------------------------------------------------------
   Container
   -------------------------------------------------------------------------- */

.container {
  max-width: var(--container);
  margin: 0 auto;
  background: var(--paper);
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(22, 35, 63, 0.05);
}

/* --------------------------------------------------------------------------
   Top bar
   -------------------------------------------------------------------------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px 24px;
  padding: 18px 32px;
  border-bottom: 1px solid var(--border);
}

.topbar .brand {
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--ink);
  text-transform: uppercase;
}

.topbar .brand a { color: var(--ink); }
.topbar .brand a:hover { text-decoration: none; color: var(--accent); }

.topbar nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 26px;
}

.topbar nav a {
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-body);
  padding-bottom: 3px;
  border-bottom: 1.5px solid transparent;
}

.topbar nav a:hover { color: var(--accent); text-decoration: none; }

.topbar nav a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* --------------------------------------------------------------------------
   Small typographic helpers
   -------------------------------------------------------------------------- */

.kicker {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
}

.section-label {
  display: flex;
  align-items: center;
  gap: 18px;
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 26px;
}

.section-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-soft);
}

/* --------------------------------------------------------------------------
   Page header block (Publications / Projects / Team / Contact)
   -------------------------------------------------------------------------- */

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px 32px;
  padding: 40px 32px 34px;
  border-bottom: 1px solid var(--border);
}

.page-header h1 {
  font-family: var(--mono);
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
  margin-top: 8px;
}

/* --------------------------------------------------------------------------
   Home — profile sidebar (photo + contacts) and main column
   -------------------------------------------------------------------------- */

.home-layout {
  display: grid;
  grid-template-columns: 288px 1fr;
}

.profile {
  padding: 40px 26px 44px;
  border-right: 1px solid var(--border);
  background: var(--paper-alt);
}

.profile-photo {
  width: 100%;
  max-width: 176px;
  aspect-ratio: 4 / 5;
  border: 1px solid var(--border);
  background: linear-gradient(160deg, #dfe3ea 0%, #c9cfd9 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin: 0 auto 22px;
}

.profile-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

.profile-photo .initials {
  font-family: var(--mono);
  font-size: 3.4rem;
  font-weight: 700;
  color: #97a0b1;
  letter-spacing: 0.06em;
}

.profile h2 {
  font-family: var(--mono);
  font-size: 1.32rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.25;
}

.profile .role {
  font-size: 0.92rem;
  color: var(--ink-body);
  margin-top: 8px;
}

.profile .location {
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-top: 14px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.profile-links { list-style: none; margin-top: 8px; }

.profile-links li {
  padding: 5px 0;
  border-bottom: 1px solid var(--border-soft);
}

.profile-links li:last-child { border-bottom: none; }

.profile-links a {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--accent);
  word-break: break-word;
}

.home-content {
  padding: 44px 40px 56px;
  min-width: 0;
}

.home-content .section-label { margin-top: 52px; }
.home-content .section-label:first-child { margin-top: 0; }

.about h1 {
  font-family: var(--mono);
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
  margin-bottom: 18px;
}

.about .lead {
  font-size: 1.12rem;
  line-height: 1.65;
  color: var(--ink-body);
  margin-bottom: 1.1em;
}

.about p { color: var(--ink-body); margin-bottom: 1.1em; max-width: 62em; }
.about p:last-child { margin-bottom: 0; }

/* News list (home main column) — single column */

.news-list { display: grid; grid-template-columns: 1fr; gap: 14px; }

/* --------------------------------------------------------------------------
   Home — hero
   -------------------------------------------------------------------------- */

.hero {
  padding: 48px 32px 44px;
  border-bottom: 1px solid var(--border);
}

.hero h1 {
  font-family: var(--mono);
  font-size: 3.2rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.hero .subtitle {
  font-family: var(--mono);
  font-size: 0.82rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 14px 0 26px;
}

.hero-cols {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 48px;
}

.hero-lead {
  font-size: 1.12rem;
  line-height: 1.65;
  color: var(--ink-body);
}

.hero-abstract .abstract-label {
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.18em;
  color: var(--accent);
  margin-bottom: 10px;
}

.hero-abstract p { font-size: 0.95rem; color: var(--ink-body); }

/* --------------------------------------------------------------------------
   Home — two-column body (main + aside)
   -------------------------------------------------------------------------- */

.home-body {
  display: grid;
  grid-template-columns: 1fr 340px;
}

.home-main {
  padding: 40px 40px 48px 32px;
  border-right: 1px solid var(--border);
  min-width: 0;
}

.home-aside {
  padding: 40px 32px 48px;
  background: var(--paper-alt);
  min-width: 0;
}

.home-main .section-label { margin-top: 52px; }
.home-main .section-label:first-child { margin-top: 0; }

/* Publication teaser (home) */

.pub-teasers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 26px 34px;
}

.pub-teaser {
  border-left: 3px solid var(--accent);
  padding: 2px 0 2px 18px;
}

.pub-teaser .venue-line {
  font-size: 0.85rem;
  color: var(--ink-muted);
  margin-top: 4px;
}

.see-all {
  margin-top: 26px;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.pub-teaser .meta {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.pub-teaser h3 {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  margin: 4px 0 5px;
  line-height: 1.35;
}

.pub-teaser .authors { font-size: 0.88rem; color: var(--ink-muted); }

/* Current projects cards (home) */

.project-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}

.project-card {
  border-left: 3px solid var(--accent);
  padding: 4px 0 4px 18px;
}

.project-card .code {
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--ink);
}

.project-card h3 {
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--ink);
  margin: 3px 0 8px;
}

.project-card p { font-size: 0.87rem; color: var(--ink-muted); }

/* News (home) — list with the photo on the left */

.news-list { padding: 4px 0; }

.news-item {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  gap: 24px;
  align-items: center;
  padding: 18px 0;
}

.news-item + .news-item { border-top: 1px solid var(--border-soft); }

.news-photo {
  width: 118px;
  aspect-ratio: 16 / 10;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.news-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Conference and organisation marks sit inside the frame rather than filling it */
.news-photo.is-logo { padding: 9px 11px; }
.news-photo.is-logo img { width: 100%; height: 100%; object-fit: contain; }

/* Marks drawn in white for a dark background get one */
.news-photo.on-dark {
  background: var(--footer-bg);
  border-color: var(--footer-bg);
}

.news-photo:not(:has(img)) {
  border-style: dashed;
  border-color: var(--border);
  background:
    linear-gradient(135deg, var(--paper-alt) 25%, transparent 25%, transparent 50%, var(--paper-alt) 50%, var(--paper-alt) 75%, transparent 75%, transparent) 0 0 / 14px 14px,
    var(--paper);
}

.news-photo span {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.22em;
  color: var(--ink-muted);
  background: var(--paper);
  border: 1px solid var(--border-soft);
  padding: 3px 10px;
}

.news-text .date {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}

.news-text p:not(.date) {
  font-size: 1.03rem;
  line-height: 1.55;
  color: var(--ink);
}

/* Contact block (home aside) */

.aside-contact .field {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 18px 0 4px;
}

.aside-contact .value { font-size: 0.92rem; color: var(--ink-body); }
.aside-contact a { text-decoration: underline; text-underline-offset: 3px; }

/* --------------------------------------------------------------------------
   Content section (inner pages)
   -------------------------------------------------------------------------- */

.content {
  padding: 40px 32px 56px;
}

.content .section-label { margin-top: 52px; }
.content .section-label:first-child { margin-top: 0; }

/* --------------------------------------------------------------------------
   Publication statistics (js/stats.js)
   -------------------------------------------------------------------------- */

.pub-stats {
  position: relative;
  margin-bottom: 46px;
}

.stat-tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));   /* .n2/.n3 narrow it */
  gap: 1px;
  background: var(--border-soft);
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  overflow: hidden;
}

.stat-tiles.n2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stat-tiles.n3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.stat-tile {
  background: var(--paper);
  padding: 16px 18px 14px;
}

.st-label {
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 0;
}

.st-value {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 1.72rem;
  font-weight: 600;
  line-height: 1.15;
  color: var(--ink);
  margin: 6px 0 0;
}

.st-spark { margin-left: auto; align-self: flex-end; flex: none; }

.st-sub {
  font-size: 0.78rem;
  color: var(--ink-muted);
  margin: 3px 0 0;
}

.st-sub b { color: var(--accent-dark); font-weight: 600; }

.stat-charts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px;
  margin-top: 26px;
}

.stat-charts.one { grid-template-columns: minmax(0, 520px); }

.sc-cap {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 4px;
}

.sc-cap span { color: var(--ink-muted); letter-spacing: 0.1em; }

.sc-fig { margin: 0; }
.sc-plot svg { display: block; width: 100%; height: auto; }

.sc-tick {
  font-family: var(--mono);
  font-size: 8.5px;
  fill: var(--ink-muted);
}

.sc-val {
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 700;
  fill: var(--ink);
}

.sc-bar { transition: fill 0.12s ease; }
.sc-bar:hover { fill: var(--footer-bg); }

/* hover readout — the axis is sparse on purpose, this carries the rest */
.sc-tip {
  position: absolute;
  transform: translate(-50%, -100%);
  pointer-events: none;
  z-index: 4;
  background: var(--footer-bg);
  color: #fff;
  font-size: 0.74rem;
  white-space: nowrap;
  padding: 5px 9px;
  border-radius: 3px;
}

.sc-tip b { font-family: var(--mono); font-weight: 700; margin-right: 5px; }

@media (max-width: 820px) {
  .stat-tiles,
  .stat-tiles.n3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-charts { grid-template-columns: minmax(0, 1fr); gap: 22px; }
}

@media (max-width: 460px) {
  .stat-tiles,
  .stat-tiles.n2,
  .stat-tiles.n3 { grid-template-columns: minmax(0, 1fr); }
  .st-value { font-size: 1.5rem; }
}

/* SVG text scales with the viewBox, so it needs stepping up as the chart
   narrows or the axis becomes unreadable on a phone. */
@media (max-width: 720px) {
  .sc-tick { font-size: 11px; }
  .sc-val { font-size: 12px; }
}

/* --------------------------------------------------------------------------
   Publications page
   -------------------------------------------------------------------------- */

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 0;
  margin-bottom: 8px;
}

.filters button {
  background: none;
  border: none;
  border-bottom: 1.5px solid transparent;
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-body);
  padding: 4px 0 5px;
  margin-right: 18px;
  cursor: pointer;
  transition: color 0.15s ease;
}

.filters .divider {
  color: var(--border);
  margin-right: 18px;
  user-select: none;
}

.filters button:hover { color: var(--accent); }
.filters button.active { color: var(--accent); border-bottom-color: var(--accent); }

.pub-count {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 6px;
}

.pub-year-group { margin-top: 44px; }
.pub-year-group:first-child { margin-top: 24px; }

/* Year rendered as a filled rectangle followed by the rule line */
.pub-year-group .year-label {
  font-size: 1rem;
  letter-spacing: 0.18em;
  margin-bottom: 4px;
  gap: 18px;
}

.year-chip,
.label-chip {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  padding: 5px 18px;
  border-radius: 4px;
  font-family: var(--mono);
  font-weight: 700;
  letter-spacing: 0.18em;
}

.pub-item {
  display: grid;
  grid-template-columns: 168px 1fr 15%;
  gap: 26px;
  padding: 26px 0;
  border-bottom: 1px solid var(--border-soft);
  align-items: center;
}

.pub-item:last-child { border-bottom: none; }

.pub-thumb {
  width: 168px;
  aspect-ratio: 4 / 3;
  border: 1px dashed var(--border);
  background:
    linear-gradient(135deg, var(--paper-alt) 25%, transparent 25%, transparent 50%, var(--paper-alt) 50%, var(--paper-alt) 75%, transparent 75%, transparent) 0 0 / 14px 14px,
    var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* A teaser figure is only useful whole, so show all of it — and let the frame
   take the figure's own shape instead of letterboxing it into a fixed 4:3 box.
   The images are pre-trimmed of their white margins. */
.pub-thumb.has-fig {
  aspect-ratio: auto;
  width: auto;                 /* hug tall, narrow figures instead of padding them */
  max-width: 168px;
  height: auto;
  max-height: 176px;
  justify-self: start;
  border: 1px solid var(--border-soft);
  border-radius: 3px;
  background: var(--paper);
  padding: 0;
}

.pub-thumb img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 174px;
  object-fit: contain;
  display: block;
}

.pub-thumb span {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  color: var(--ink-muted);
  background: var(--paper);
  border: 1px solid var(--border-soft);
  padding: 3px 10px;
}

.pub-item h3 {
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.4;
}

.pub-item .authors {
  font-size: 0.88rem;
  color: var(--ink-muted);
  margin-top: 4px;
}

.pub-item .venue {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-top: 6px;
}

.pub-item .venue .type { color: var(--ink-muted); }

.pub-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.pub-links a {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  padding: 3px 12px;
  border-radius: 4px;
  border: 1px solid transparent;
  transition: filter 0.15s ease;
}

.pub-links a:hover { text-decoration: none; filter: brightness(0.92); }

/* Subtle color variants (F. Moreno style pills) */
.pub-links .btn-pdf {
  color: #a83a50;
  background: rgba(202, 71, 98, 0.09);
  border-color: rgba(202, 71, 98, 0.25);
}

.pub-links .btn-web {
  color: var(--accent-dark);
  background: rgba(47, 82, 196, 0.08);
  border-color: rgba(47, 82, 196, 0.25);
}

.pub-links .btn-git {
  color: #1f7a4d;
  background: rgba(36, 138, 87, 0.09);
  border-color: rgba(36, 138, 87, 0.25);
}

.pub-rank {
  grid-column: 3;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 6px;
  align-self: stretch;
  border-left: 1px solid var(--border);
  padding-left: 22px;
}

.pub-rank .stat {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--ink-body);
  white-space: nowrap;
}

.pub-item .badge {
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-dark);
  background: rgba(47, 82, 196, 0.06);
  border: 1px solid rgba(47, 82, 196, 0.28);
  padding: 3px 9px;
  border-radius: 2px;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Projects page
   -------------------------------------------------------------------------- */

.project-item {
  border-left: 3px solid var(--accent);
  padding: 6px 0 6px 22px;
  margin-bottom: 44px;
}

.project-item:last-child { margin-bottom: 0; }

.project-head {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
}

.project-item h3 {
  font-family: var(--mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
  min-width: 0;
}

.project-logo {
  width: 108px;
  height: 72px;
  flex: none;
  border: 1px dashed var(--border);
  background:
    linear-gradient(135deg, var(--paper-alt) 25%, transparent 25%, transparent 50%, var(--paper-alt) 50%, var(--paper-alt) 75%, transparent 75%, transparent) 0 0 / 14px 14px,
    var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Once a real icon is in place, drop the dashed "empty slot" treatment. */
.project-logo:has(img) {
  border: 1px solid var(--border-soft);
  background: var(--paper);
  padding: 8px;
}

.project-logo img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }

.project-logo span {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  color: var(--ink-muted);
  background: var(--paper);
  border: 1px solid var(--border-soft);
  padding: 3px 10px;
}

.project-item .specs {
  display: grid;
  gap: 7px;
  margin-bottom: 16px;
}

.project-item .spec {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 18px;
  align-items: baseline;
}

.project-item .spec-label {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.project-item .spec-value {
  font-size: 0.92rem;
  color: var(--ink-body);
}

.project-item .spec-value.mono {
  font-family: var(--mono);
  font-size: 0.84rem;
  color: var(--accent-dark);
}

.project-item p {
  font-size: 0.95rem;
  color: var(--ink-body);
  text-align: justify;
  max-width: 70ch;
}

/* --------------------------------------------------------------------------
   Team page
   -------------------------------------------------------------------------- */

.team-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px 56px;
  margin-bottom: 8px;
}

.member {
  border-left: 3px solid var(--accent);
  padding: 2px 0 2px 18px;
}

.member .name-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
}

.member h3 {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--ink);
  display: inline;
}

.member .tag {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.member p { font-size: 0.9rem; color: var(--ink-body); margin-top: 4px; }
.member .note { font-size: 0.82rem; color: var(--ink-muted); }

/* Current members: circular headshot beside the text.
   Drop a file at assets/team/<slug>.jpg to replace the initials placeholder. */

.member.with-photo {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.avatar {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--paper-alt);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.avatar::before {
  content: attr(data-initials);
  font-family: var(--mono);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
  border-radius: 50%;
  background: var(--paper-alt);
}

.member-body { min-width: 0; }

/* --------------------------------------------------------------------------
   Contact page
   -------------------------------------------------------------------------- */

.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px 64px;
}

.contact-block .field {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 22px 0 5px;
}

.contact-block .field:first-child { margin-top: 0; }

.contact-block .value { font-size: 0.97rem; color: var(--ink-body); }
.contact-block .value a { text-decoration: underline; text-underline-offset: 3px; }

.contact-note {
  margin-top: 48px;
  padding: 24px 28px;
  background: var(--paper-alt);
  border: 1px solid var(--border-soft);
  border-left: 3px solid var(--accent);
  font-size: 0.95rem;
  color: var(--ink-body);
  max-width: 56em;
}

.links-list { list-style: none; }

.links-list li {
  padding: 5px 0;
  border-bottom: 1px solid var(--border-soft);
}

.links-list li:first-child { padding-top: 2px; }
.links-list li:last-child { border-bottom: none; }

.links-list a {
  font-family: var(--mono);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

footer {
  background: var(--footer-bg);
  color: #aeb8d0;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 24px;
  padding: 18px 32px;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

footer .right { color: #8e9ab8; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 980px) {
  /* The rank column is fixed and its badges no longer force the page wider
     than the screen — they wrap instead. */
  .pub-item { grid-template-columns: 150px minmax(0, 1fr) 136px; gap: 20px; }
  .pub-thumb { width: 150px; }
  .pub-thumb.has-fig { max-width: 150px; }
  .pub-rank { padding-left: 16px; }
  .pub-rank .stat { white-space: normal; }

  .home-body { grid-template-columns: 1fr; }
  .home-main { border-right: none; border-bottom: 1px solid var(--border); }
  .hero-cols { grid-template-columns: 1fr; gap: 26px; }

  .home-layout { grid-template-columns: 1fr; }

  .profile {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .news-list { grid-template-columns: 1fr; }
}

/* Tablet only: photo top left, name and affiliation stacked underneath it,
   the ID links alongside. Below 720px everything goes back to one column. */
@media (min-width: 721px) and (max-width: 980px) {
  .profile {
    display: grid;
    grid-template-columns: 216px minmax(0, 1fr);
    column-gap: 34px;
    align-items: start;
  }

  .profile-photo { grid-column: 1; grid-row: 1; margin: 0 auto 20px; }
  .profile h2 { grid-column: 1; grid-row: 2; }
  .profile .role { grid-column: 1; grid-row: 3; }
  .profile .location { grid-column: 1; grid-row: 4; border-bottom: none; padding-bottom: 0; }
  .profile-links { grid-column: 2; grid-row: 1 / 5; margin-top: 0; }
}

@media (max-width: 720px) {
  body { padding: 0; }
  .container { border-left: none; border-right: none; }

  .topbar { padding: 16px 20px; }
  .topbar nav { gap: 6px 18px; }

  .hero { padding: 36px 20px; }
  .hero h1 { font-size: 2.2rem; }

  .page-header { padding: 32px 20px 26px; }
  .page-header h1 { font-size: 2rem; }

  .content { padding: 32px 20px 44px; }
  .home-main { padding: 32px 20px; }
  .home-aside { padding: 32px 20px 44px; }

  .pub-teasers { grid-template-columns: 1fr; }

  .profile {
    grid-template-columns: 1fr;
    padding: 32px 20px;
  }

  /* News zig-zag collapses to a single column */
  .news-item { grid-template-columns: 92px minmax(0, 1fr); gap: 14px; padding: 15px 0; }
  .news-photo { width: 92px; }

  .profile-photo { grid-row: auto; max-width: 240px; }

  .home-content { padding: 32px 20px 44px; }
  .about h1 { font-size: 1.9rem; }
  .team-grid { grid-template-columns: 1fr; gap: 24px; }
  .member.with-photo { grid-template-columns: 60px minmax(0, 1fr); gap: 14px; }
  .avatar { width: 60px; height: 60px; }
  .avatar::before { font-size: 0.92rem; }
  .contact-grid { grid-template-columns: 1fr; }

  .pub-item {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 20px 0;
  }

  .pub-thumb { width: 200px; }

  .pub-rank {
    grid-column: 1;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
    border-left: none;
    padding-left: 0;
    gap: 4px 16px;
  }

  .project-item h3 { font-size: 1.25rem; }
  .project-head { gap: 14px; margin-bottom: 16px; }
  .project-logo { width: 88px; height: 58px; }
  .project-item .spec { grid-template-columns: 1fr; gap: 1px; }

  footer { padding: 16px 20px; flex-direction: column; }
}

/* --------------------------------------------------------------------------
   Visitor map (home) — choropleth fed by tools/umami_countries.py
   -------------------------------------------------------------------------- */

.visitor-map { margin-top: 52px; }

.vm-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 28px;
  align-items: center;
}

.vm-wrap svg { display: block; width: 100%; height: auto; }

.vm-c { transition: fill 0.12s ease; }
.vm-c:hover { fill: var(--footer-bg); }

.vm-top {
  list-style: none;
  margin: 0;
  font-size: 0.86rem;
  color: var(--ink-body);
}

.vm-top li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border-soft);
}

.vm-top li:last-child { border-bottom: 0; }
.vm-top b { margin-left: auto; font-family: var(--mono); font-size: 0.8rem; color: var(--ink); }

.vm-dot { width: 10px; height: 10px; border-radius: 2px; flex: none; }

.vm-empty {
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--ink-muted);
}

.vm-empty code {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--accent-dark);
  overflow-wrap: anywhere;
}

.vm-foot {
  margin-top: 12px;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.vm-foot strong { color: var(--ink); }

@media (max-width: 900px) {
  .vm-wrap { grid-template-columns: 1fr; gap: 16px; }
}

/* --------------------------------------------------------------------------
   Citation trends — the unlisted citations.html page (js/trends.js)
   -------------------------------------------------------------------------- */

.tr-stamp {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 4px;
}

.tr-fig { margin: 0 0 46px; }
.tr-fig:last-child { margin-bottom: 0; }

.tr-cap {
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

.tr-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  margin-top: 10px;
}

.tr-key {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--ink-body);
}

.tr-sw { width: 18px; height: 10px; flex: none; }
.tr-sw.solid { border-top: 2px solid var(--accent); height: 2px; }
.tr-sw.dash {
  height: 2px;
  background: repeating-linear-gradient(to right, #93a5de 0 6px, transparent 6px 11px);
}
.tr-sw.band { background: rgba(47, 82, 196, 0.16); border: 1px solid rgba(47, 82, 196, 0.32); }
.tr-sw.mark {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: var(--paper);
}

.tr-plot { position: relative; margin-top: 12px; }
.tr-plot svg { display: block; width: 100%; height: auto; }

.tr-tick {
  font-family: var(--mono);
  font-size: 10px;
  fill: var(--ink-muted);
}

.tr-val {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  fill: var(--ink);
}

/* crosshair readout */
.tr-tip {
  position: absolute;
  top: 4px;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 14px;
  white-space: nowrap;
  background: var(--footer-bg);
  color: #fff;
  font-size: 0.76rem;
  padding: 6px 11px;
  border-radius: 3px;
}

.tr-tip[hidden] { display: none; }
.tr-tip b { font-family: var(--mono); }
.tr-tip span { color: #aebbd8; }
.tr-tip em { font-style: normal; font-weight: 600; color: #fff; margin-left: 6px; }

.tr-note {
  font-size: 0.86rem;
  line-height: 1.62;
  color: var(--ink-body);
  max-width: 78ch;
  margin-top: 14px;
}

.tr-note b { color: var(--ink); font-weight: 600; }

.tr-method {
  font-size: 0.82rem;
  line-height: 1.66;
  color: var(--ink-muted);
  max-width: 78ch;
  margin-top: 46px;
  padding-top: 22px;
  border-top: 1px solid var(--border-soft);
}

.tr-method code,
.tr-none code { font-family: var(--mono); font-size: 0.78rem; color: var(--accent-dark); }

.tr-none { color: var(--ink-muted); }

@media (max-width: 720px) {
  .tr-fig { margin-bottom: 36px; }
  .tr-tip { font-size: 0.72rem; gap: 10px; padding: 5px 8px; }

  /* A twelve-year axis cannot shrink to phone width and stay readable, so the
     plot keeps a working width and scrolls sideways inside its own box. */
  .tr-plot { overflow-x: auto; }
  .tr-plot svg { min-width: 660px; }
  .tr-tick { font-size: 13px; }
  .tr-val { font-size: 14px; }
}

.tr-wait {
  font-size: 0.86rem;
  color: var(--ink-muted);
  background: var(--paper-alt);
  border: 1px dashed var(--border);
  border-radius: 4px;
  padding: 26px 22px;
  text-align: center;
}
