/* Open Codes, WANG-AXIS Lab
   Layout idea: an index. Each research area (or year) is a row with its name
   in a narrow left column and its project cards to the right. */

:root {
  color-scheme: light;

  --bg: #f4f7f8;
  --surface: #ffffff;
  --ink: #14232b;
  --muted: #566873;
  --line: #d8e1e6;
  --accent: #158cba;        /* the lab site's link blue */
  --accent-ink: #0b6488;    /* same hue, dark enough for text */
  --accent-soft: #e4f2f8;

  --ok: #17704a;
  --ok-soft: #e0f2e9;
  --warn: #8a5700;
  --warn-soft: #fbefd6;
  --idle: #566873;
  --idle-soft: #e9eef1;

  --font-display: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-body: "Source Sans 3", "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono: "Source Code Pro", Menlo, Consolas, "Courier New", monospace;

  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 35, 43, 0.06), 0 6px 20px rgba(20, 35, 43, 0.05);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--accent-ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.2; margin: 0; text-wrap: balance; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

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

.skip {
  position: absolute; left: 16px; top: -48px; z-index: 20;
  background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 6px;
}
.skip:focus { top: 12px; color: #fff; }

.mono { font-family: var(--font-mono); font-size: 0.88em; }

/* ---------- Header and footer ---------- */

.site-header {
  position: sticky; top: 0; z-index: 10;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header__inner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 4px 24px; min-height: 60px; padding-top: 8px; padding-bottom: 8px;
}
.brand { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; font-size: 18px; }
.brand a { text-decoration: none; }
.brand__link { color: var(--muted); }
.brand__sep { color: var(--line); }
.brand__here { color: var(--ink); font-weight: 700; }
.site-nav { display: flex; gap: 22px; font-size: 16px; }
.site-nav a { color: var(--muted); text-decoration: none; }
.site-nav a:hover, .brand a:hover { color: var(--accent-ink); }

.site-footer { margin-top: 88px; border-top: 1px solid var(--line); background: var(--surface); }
.site-footer__inner {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 32px;
  padding-top: 24px; padding-bottom: 28px; font-size: 15px; color: var(--muted);
}
.site-footer p { margin: 0; display: flex; flex-wrap: wrap; gap: 6px 22px; }
/* Contact for corrections, at the bottom right; the extra bottom space keeps it clear of the floating button. */
.site-footer p.site-footer__contact { display: block; margin-left: auto; text-align: right; }
.site-footer { padding-bottom: 64px; }

/* ---------- Home: intro and toolbar ---------- */

.intro { padding: 56px 0 28px; }
.intro h1 { font-size: clamp(36px, 5vw, 50px); letter-spacing: -0.01em; }
.intro__lede { max-width: 62ch; margin: 14px 0 0; font-size: 19px; color: var(--muted); }

.toolbar {
  display: none; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px 24px; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}

/* The toolbar needs the script, so it only shows when the script has run. */
.js .toolbar { display: flex; }

.segmented { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.segmented__label { margin-right: 8px; font-size: 15px; color: var(--muted); }
.segmented button {
  font: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
  padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
}
.segmented button:hover { border-color: var(--accent); color: var(--accent-ink); }
.segmented button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }

.search { position: relative; flex: 0 1 300px; min-width: 200px; }
.search svg {
  position: absolute; left: 12px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%);
  fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round;
}
.search input {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink);
  padding: 8px 12px 8px 38px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
}
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }

/* ---------- Home: overview of years or research areas ---------- */

.overview {
  position: sticky; top: 60px; z-index: 5;
  margin: 0 -24px; padding: 10px 24px;
  background: rgba(244, 247, 248, 0.94); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.overview[hidden] { display: none; }
/* While the overview is pinned, group headings stick below it. */
.has-overview .group__head { top: 156px; }

/* Year dial: a scale with a tick per year and finer ticks between, read against a
   needle that steps from tick to tick as the page scrolls, like the hand of a stopwatch.
   The whole scale is a control: click a year or a tick to jump, or drag the needle. */
.dial { position: relative; height: 60px; margin: 0 34px; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; }
.dial--dragging, .dial--dragging * { cursor: grabbing !important; }
.dial__line { position: absolute; left: -34px; right: -34px; top: 20px; height: 1px; background: var(--line); }
.dial__tick { position: absolute; top: 15px; width: 1px; height: 6px; background: #a9b9c2; transform: translateX(-0.5px); pointer-events: none; }
.dial__tick--year { top: 9px; height: 12px; width: 2px; background: var(--ink); transform: translateX(-1px); }
.dial__tick--empty { background: #a9b9c2; }
.dial__year {
  position: absolute; top: 29px; transform: translateX(-50%);
  font: inherit; font-size: 15px; font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums;
  padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink);
  cursor: pointer; white-space: nowrap;
}
.dial__year:hover { border-color: var(--accent); color: var(--accent-ink); }
.dial__year[aria-current="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.dial__year--empty { border-color: transparent; background: none; font-weight: 400; color: #9aaab3; cursor: default; }
.dial__year--empty:hover { border-color: transparent; color: #9aaab3; }
.dial__count {
  position: absolute; right: -8px; top: -8px; min-width: 17px; height: 17px; padding: 0 4px;
  display: inline-flex; align-items: center; justify-content: center; border-radius: 999px;
  background: var(--idle-soft); color: var(--muted); border: 1px solid var(--line);
  font-size: 11px; font-weight: 600; line-height: 1;
}
.dial__year:hover .dial__count { border-color: var(--accent); color: var(--accent-ink); }
.dial__year[aria-current="true"] .dial__count { background: var(--surface); border-color: var(--ink); color: var(--ink); }
/* The needle has a round handle so that it reads as something to grab. */
.dial__needle {
  position: absolute; top: 3px; width: 2px; height: 20px; background: #d1432f; transform: translateX(-1px);
  border-radius: 1px; cursor: grab;
}
.dial__needle::before {
  content: ""; position: absolute; left: -6px; top: -4px; width: 14px; height: 14px; border-radius: 50%;
  background: #d1432f; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(20, 35, 43, 0.35);
}
/* A wider invisible area around the needle makes it easy to catch. */
.dial__needle::after { content: ""; position: absolute; left: -16px; right: -16px; top: -6px; bottom: -6px; }
.dial:hover .dial__needle::before, .dial--dragging .dial__needle::before { transform: scale(1.15); }

/* Research areas: one button per area. */
.overview__areas { display: flex; flex-wrap: wrap; gap: 8px; }
.overview .chip[aria-current="true"] { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 600; }
.overview .chip[aria-current="true"] .chip__count { color: #fff; opacity: 0.8; }

/* ---------- Home: author filter ---------- */

.author-bar { padding: 14px 0 16px; border-bottom: 1px solid var(--line); }
.author-bar[hidden] { display: none; }
.author-bar__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 12px; }
.author-bar__label { font-size: 14.5px; color: var(--muted); }
.author-bar__find {
  flex: 0 1 220px; min-width: 160px; font: inherit; font-size: 15px; color: var(--ink);
  padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
}
.author-bar__find::placeholder { color: var(--muted); }
.author-bar__find:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.author-bar__list { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
/* Initial letter in front of the names that start with it. */
.author-bar__letter {
  margin-left: 8px; font-family: var(--font-display); font-size: 15px; font-weight: 600; color: var(--accent-ink);
}
.author-bar__pair { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.author-bar__none[hidden] { display: none; }
.author-bar__none { margin: 10px 0 0; font-size: 15px; color: var(--muted); }
.chip {
  display: inline-flex; align-items: baseline; gap: 7px; cursor: pointer;
  font: inherit; font-size: 15px; line-height: 1.3; padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
.chip:hover { border-color: var(--accent); color: var(--accent-ink); }
.chip__count { font-size: 12.5px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.chip[aria-pressed="true"] .chip__count { color: var(--accent-ink); }

/* ---------- Home: groups and cards ---------- */

.group {
  display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 20px 40px;
  padding: 36px 0; border-bottom: 1px solid var(--line);
}
.group:last-child { border-bottom: 0; }
.group__head { align-self: start; position: sticky; top: 84px; }
.group__head h2 { font-size: 24px; }
.group--year .group__head h2 { font-size: 40px; font-variant-numeric: lining-nums tabular-nums; }
.group__desc { margin: 10px 0 0; font-size: 15.5px; line-height: 1.5; color: var(--muted); }
.group__count {
  margin: 12px 0 0; font-size: 13px; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--muted);
}

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 24px; }

.card {
  position: relative; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; transition: box-shadow 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}
.card:hover, .card:focus-within { border-color: #b9cbd4; box-shadow: var(--shadow); transform: translateY(-2px); }

.card__media {
  text-decoration: none;
  display: flex; align-items: center; justify-content: center;
  aspect-ratio: 16 / 9; padding: 14px; background: #fff; border-bottom: 1px solid var(--line);
}
/* The figure is fitted inside the 16:9 frame whatever its own shape. */
.card__media { position: relative; }
.card__media img { position: absolute; inset: 14px; width: calc(100% - 28px); height: calc(100% - 28px); margin: 0; object-fit: contain; }
/* Projects without a figure show their short name on a tinted panel. */
.card__media:has(.card__noimg) { background: var(--accent-soft); }
.card__noimg { font-family: var(--font-display); font-weight: 600; font-size: 26px; line-height: 1.2; text-align: center; color: var(--accent-ink); text-wrap: balance; }

/* Short project name, shown as a label on the figure. */
.card__badge {
  position: absolute; left: 12px; top: 12px; z-index: 1;
  font-size: 14px; font-weight: 600; line-height: 1; letter-spacing: 0.02em;
  padding: 6px 10px; border-radius: 6px; background: var(--ink); color: #fff;
  pointer-events: none;   /* clicks go through to the card link underneath */
}
.card .card__badge mark { color: var(--ink); }

.card__body { flex: 1; padding: 18px 20px 6px; }
.card__venue {
  margin: 0 0 6px; font-size: 13px; font-weight: 600; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--accent-ink);
}
.card__title { font-size: 20px; line-height: 1.3; }
.card__title a { color: var(--ink); text-decoration: none; }
/* The whole card is the link target; the GitHub link below sits above it. */
.card__title a::after { content: ""; position: absolute; inset: 0; }
.card:hover .card__title a { color: var(--accent-ink); }
/* Search matches. Visible text is marked in place; matches in text the card does not
   show are listed in this box under the title. */
.card mark { background: #ffdf80; color: inherit; border-radius: 3px; padding: 0 1px; }
.card__match {
  display: grid; gap: 6px; margin: 10px 0 2px; padding: 9px 11px; border-radius: 7px;
  background: var(--accent-soft); color: var(--ink);
}
.card__match-row { margin: 0; font-size: 15px; line-height: 1.45; }
.card__match-label {
  display: block; font-size: 12px; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--accent-ink);
}
.card__match-names { font-size: 16px; font-weight: 600; }

/* A hairline separates the title (and any search matches) from the summary. */
.card__summary {
  margin: 12px 0 0; padding-top: 12px; border-top: 1px solid var(--line);
  font-size: 16px; line-height: 1.5; color: var(--muted);
}

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 0; padding: 0; list-style: none; }
.tags li {
  font-size: 13px; line-height: 1.3; padding: 3px 9px; border-radius: 999px;
  background: var(--bg); border: 1px solid var(--line); color: var(--muted);
}

.card__foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 16px; padding: 12px 20px; border-top: 1px solid var(--line);
}
.card__code {
  position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 6px;
  font-size: 15px; font-weight: 600; text-decoration: none;
}
.card__code svg, .btn svg {
  width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}

.status {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13.5px; font-weight: 600; padding: 3px 10px 3px 9px; border-radius: 999px;
  background: var(--idle-soft); color: var(--idle);
}
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status--released { background: var(--ok-soft); color: var(--ok); }
.status--partial { background: var(--warn-soft); color: var(--warn); }

.no-results { padding: 48px 0; color: var(--muted); }

/* ---------- Project page ---------- */

.project__head { padding: 40px 0 30px; border-bottom: 1px solid var(--line); }
.project__venue {
  margin: 0 0 8px; font-size: 14px; font-weight: 600; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--accent-ink);
}
.project__head h1 { font-size: clamp(38px, 6vw, 56px); letter-spacing: -0.01em; }
.project__full {
  max-width: 34em; margin: 10px 0 0; font-family: var(--font-display); font-weight: 600;
  font-size: clamp(19px, 2.4vw, 23px); line-height: 1.35; color: var(--ink); text-wrap: balance;
}
.project__authors { max-width: 70ch; margin: 12px 0 0; font-size: 16px; color: var(--muted); }
.project__authors a, .project__authors span { white-space: nowrap; }
.project__authors a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.project__authors a:hover { color: var(--accent-ink); text-decoration-color: currentColor; }

/* Dot that marks current and former lab members in author lists. */
.member-mark {
  display: inline-block; width: 6px; height: 6px; margin-left: 3px; border-radius: 50%;
  background: var(--accent); vertical-align: 0.55em;
}
.project__legend { margin: 8px 0 0; font-size: 14.5px; color: var(--muted); }
.project__legend .member-mark { margin: 0 5px 0 0; vertical-align: 0.15em; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 16px; font-weight: 600; text-decoration: none;
  padding: 9px 18px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
.btn:hover { border-color: var(--accent); color: var(--accent-ink); }
.btn--primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn--primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); color: #fff; }

.project__grid {
  display: grid; grid-template-columns: minmax(0, 1fr) 296px; gap: 36px 48px; padding-top: 32px;
}
.project__main { display: grid; grid-template-columns: minmax(0, 1fr); gap: 36px; min-width: 0; }

.method { margin: 0; }
.method a { display: block; padding: 20px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.method img { width: 100%; }
.method figcaption { max-width: 70ch; margin-top: 10px; font-size: 15px; line-height: 1.5; color: var(--muted); }

.prose { max-width: 68ch; }
.prose h2, .cite h2 { font-size: 24px; }
.prose h2 { margin: 34px 0 12px; }
.prose h2:first-child { margin-top: 0; }
.prose p { margin: 0 0 14px; }
.prose ul { margin: 0; padding-left: 20px; }
.prose li { margin-bottom: 6px; }
.prose code {
  font-family: var(--font-mono); font-size: 0.88em;
  padding: 1px 5px; border-radius: 4px; background: var(--idle-soft);
}

.cite__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.copy {
  font: inherit; font-size: 14.5px; font-weight: 600; cursor: pointer;
  padding: 5px 12px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--accent-ink);
}
.copy:hover { border-color: var(--accent); }
.cite pre {
  margin: 0; padding: 16px 18px; overflow-x: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  font-family: var(--font-mono); font-size: 13.5px; line-height: 1.6;
}

.facts {
  align-self: start; position: sticky; top: 84px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 20px;
}
.facts dl { margin: 0; }
.facts dl > div { padding: 14px 0; border-bottom: 1px solid var(--line); }
.facts dl > div:last-child { border-bottom: 0; }
.facts dt {
  margin-bottom: 4px; font-size: 12.5px; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--muted);
}
.facts dd { margin: 0; font-size: 16px; overflow-wrap: anywhere; }
.facts__note { display: block; margin-top: 5px; font-size: 14.5px; line-height: 1.45; color: var(--muted); }
.facts__links { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.facts .tags { margin-top: 4px; }

/* Floating button on project pages. */
.back-fab {
  position: fixed; right: 24px; bottom: 24px; z-index: 20;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 18px 11px 14px; border-radius: 999px;
  background: var(--ink); color: #fff; font-size: 16px; font-weight: 600; text-decoration: none;
  box-shadow: 0 6px 20px rgba(20, 35, 43, 0.28);
}
.back-fab:hover { background: var(--accent-ink); color: #fff; }
.back-fab[hidden] { display: none; }
button.back-fab { font-family: inherit; border: 0; cursor: pointer; }
.back-fab svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.pager {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 28px;
  margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 16px;
}
.pager a { text-decoration: none; font-weight: 600; }
.pager__links { display: flex; flex-wrap: wrap; gap: 8px 28px; }

/* ---------- Small screens ---------- */

@media (max-width: 860px) {
  .group { grid-template-columns: 1fr; padding: 28px 0; }
  .group__head, .facts { position: static; }
  .group__desc { max-width: 60ch; }
  .project__grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  body { font-size: 16px; }
  .wrap { padding: 0 16px; }
  .intro { padding-top: 36px; }
  .project__head { padding-top: 28px; }
  .back-fab { right: 16px; bottom: 16px; }
  .site-footer { padding-bottom: 56px; }
  .site-nav { gap: 16px; font-size: 15px; }
  .brand { font-size: 16px; gap: 2px 7px; }
  .search { flex-basis: 100%; }
  .cards { grid-template-columns: 1fr; }
  .overview { margin: 0 -16px; padding: 8px 16px; top: 78px; }
  .overview__areas { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
  .overview__areas .chip { flex: none; }
  .dial { margin: 0 20px; height: 52px; }
  .dial__line { left: -20px; right: -20px; }
  .dial__year { font-size: 13px; padding: 2px 3px; border-color: transparent; background: none; }
  .dial__count { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .card { transition: none; }
  .card:hover, .card:focus-within { transform: none; }
}
