/* CAST Lab site. Palette from the leaf logo: #64C37D, #C2FB3B, #231F20. */
:root {
  --paper: #F3F6F1;
  --sheet: #FFFFFF;
  --ink: #231F20;
  --ink-2: #4A5249;
  --muted: #6E776D;
  --rule: #D6DFD3;
  --rule-soft: #E6ECE3;
  --leaf: #64C37D;
  --leaf-deep: #1F7A4A;
  --leaf-wash: #E4F4E8;
  --lime: #C2FB3B;
  --land: #DCE7D6;
  --link: var(--leaf-deep);
  --focus: #1F7A4A;
  --sans: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --wrap: 1120px;
  --gutter: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #121613; --sheet: #1A1F1B; --ink: #ECF1EA; --ink-2: #C4CDC2; --muted: #93A091;
    --rule: #2C352E; --rule-soft: #232B25; --leaf-deep: #7FD497; --leaf-wash: #1C2A20; --land: #1F2A22;
    --link: #8FDCA4; --focus: #C2FB3B; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #121613; --sheet: #1A1F1B; --ink: #ECF1EA; --ink-2: #C4CDC2; --muted: #93A091;
  --rule: #2C352E; --rule-soft: #232B25; --leaf-deep: #7FD497; --leaf-wash: #1C2A20; --land: #1F2A22;
  --link: #8FDCA4; --focus: #C2FB3B; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--serif); font-size: 1.0625rem; line-height: 1.55;
  font-optical-sizing: auto; -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
[hidden] { display: none !important; }
a { color: var(--link); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.15em; text-decoration-color: color-mix(in srgb, var(--link) 45%, transparent); }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 2px; }
h1, h2, h3, h4 { font-family: var(--sans); font-weight: 600; line-height: 1.1; letter-spacing: -0.015em; margin: 0 0 0.5em; color: var(--ink); }
h1 { font-size: clamp(2rem, 1.2rem + 3vw, 3.4rem); font-weight: 700; }
h2 { font-size: clamp(1.4rem, 1.1rem + 1.2vw, 1.9rem); }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }
.mono { font-family: var(--mono); font-size: 0.92em; }
.sep { display: inline-block; width: 1px; height: 0.9em; background: var(--rule); margin: 0 0.6em; vertical-align: -0.1em; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--paper); padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }
.plain { list-style: none; padding: 0; margin: 0 0 1em; }
.plain li { padding: 0.2em 0; }

/* ---- header ---- */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--rule-soft); }
.top-row { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--sans); font-weight: 700; font-size: 1.25rem; letter-spacing: -0.01em; }
.brand-lab { font-weight: 400; color: var(--ink-2); }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a { font-family: var(--sans); font-weight: 500; font-size: 0.98rem; color: var(--ink-2); text-decoration: none; padding: 8px 12px; border-radius: 6px; }
.nav a:hover { color: var(--ink); background: var(--rule-soft); }
.nav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--leaf); border-radius: 0; }
.theme { background: none; border: 0; color: var(--ink-2); padding: 8px; margin-left: 6px; cursor: pointer; border-radius: 6px; display: inline-flex; }
.theme:hover { background: var(--rule-soft); color: var(--ink); }
.theme .moon { display: none; }
:root[data-theme="dark"] .theme .moon { display: block; } :root[data-theme="dark"] .theme .sun { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .theme .moon { display: block; } :root:not([data-theme="light"]) .theme .sun { display: none; } }
/* language menu */
.lang { position: relative; margin-left: 6px; }
.lang summary { list-style: none; display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border-radius: 6px; cursor: pointer; font-family: var(--sans); font-weight: 500; font-size: 0.85rem; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.02em; }
.lang summary::-webkit-details-marker { display: none; }
.lang summary:hover, .lang[open] summary { background: var(--rule-soft); color: var(--ink); }
.lang ul { position: absolute; right: 0; top: calc(100% + 6px); margin: 0; padding: 6px; list-style: none; background: var(--sheet); border: 1px solid var(--rule); border-radius: 8px; box-shadow: 0 10px 30px -12px rgba(20, 33, 43, .3); min-width: 170px; z-index: 30; }
.lang li a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; font-family: var(--sans); font-size: 0.95rem; color: var(--ink); text-decoration: none; }
.lang li a:hover { background: var(--rule-soft); }
.lang li a[aria-current="true"] { font-weight: 600; }
.lang li a[aria-current="true"]::after { content: ""; margin-left: auto; width: 6px; height: 6px; border-radius: 50%; background: var(--leaf); }
.flag { width: 20px; height: 14px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0,0,0,.08); flex: none; }
.nav-toggle { display: none; background: none; border: 0; width: 44px; height: 44px; padding: 10px; cursor: pointer; flex-direction: column; justify-content: center; gap: 6px; }
.nav-toggle span { display: block; height: 2px; background: var(--ink); transition: transform .2s; }
@media (max-width: 760px) {
  .nav-toggle { display: flex; }
  .nav { display: none; position: absolute; left: 0; right: 0; top: 64px; flex-direction: column; align-items: stretch; background: var(--paper); border-bottom: 1px solid var(--rule); padding: 8px var(--gutter) 16px; }
  .nav.open { display: flex; }
  .nav a { padding: 12px 8px; font-size: 1.1rem; }
  .nav a[aria-current="page"] { box-shadow: inset 3px 0 0 var(--leaf); padding-left: 12px; }
  .lang { margin: 6px 0 0; }
  .lang ul { position: static; box-shadow: none; border: 0; padding: 0 0 0 8px; }
  .theme { align-self: flex-start; }
  .nav-toggle[aria-expanded="true"] span:first-child { transform: translateY(4px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span:last-child { transform: translateY(-4px) rotate(-45deg); }
}

/* ---- hero ---- */
.hero { padding: clamp(40px, 7vw, 96px) 0 clamp(32px, 5vw, 72px); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: clamp(24px, 5vw, 72px); align-items: center; }
.hero-id { font-family: var(--sans); font-weight: 500; font-size: 1.02rem; color: var(--leaf-deep); margin: 0 0 14px; padding-left: 14px; border-left: 2px solid var(--leaf); line-height: 1.3; }
.hero h1 { max-width: 14ch; margin-bottom: 0.5em; }
.lede { font-size: clamp(1.1rem, 1rem + 0.5vw, 1.3rem); line-height: 1.5; color: var(--ink-2); max-width: 58ch; }
.hero-links { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 1.5em; }
.btn { font-family: var(--sans); font-weight: 600; font-size: 0.98rem; text-decoration: none; padding: 11px 18px; border-radius: 999px; background: var(--ink); color: var(--paper); border: 1.5px solid var(--ink); }
.btn:hover { background: var(--leaf-deep); border-color: var(--leaf-deep); color: #fff; }
.btn-quiet { background: transparent; color: var(--ink); }
.btn-quiet:hover { background: var(--leaf-wash); color: var(--ink); border-color: var(--leaf-deep); }
.frame { margin: 0; }
.frame svg { width: 100%; height: auto; display: block; border-radius: 6px; box-shadow: 0 1px 0 rgba(0,0,0,.06), 0 18px 40px -24px rgba(20, 40, 25, .45); }
.seg { fill: transparent; stroke: rgba(255, 255, 255, 0.55); stroke-width: 0.8; }
.seg-s { fill: var(--lime); fill-opacity: 0.42; stroke: #FFFFFF; stroke-width: 1.8; transform-origin: center; transform-box: fill-box; animation: draw .5s cubic-bezier(.2,.7,.2,1) both; animation-delay: calc(var(--d, 0s) + .3s); }
@keyframes draw { from { transform: scale(0.2); fill-opacity: 0; } to { transform: scale(1); fill-opacity: 0.42; } }
@media (prefers-reduced-motion: reduce) { .seg-s { animation: none; } }
.frame figcaption { font-size: 0.88rem; color: var(--muted); margin-top: 10px; font-family: var(--sans); }
@media (max-width: 860px) { .hero-grid { grid-template-columns: 1fr; } .frame { max-width: 520px; } }

/* ---- bands (label column + body column) ---- */
.band { padding: clamp(36px, 5vw, 64px) 0; border-top: 1px solid var(--rule-soft); }
.band-alt { background: var(--sheet); }
.band-grid { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(0, 3fr); gap: 24px clamp(24px, 4vw, 64px); }
.band-head h2 { position: sticky; top: 80px; }
.band-head p { font-family: var(--sans); font-size: 0.95rem; margin-top: 0.4em; }
.band-body > :first-child { margin-top: 0; }
@media (max-width: 760px) { .band-grid { grid-template-columns: 1fr; gap: 8px; } .band-head h2 { position: static; } }
.prose { max-width: 66ch; }
.prose p { margin-bottom: 1em; }
.sub { font-size: 1rem; margin: 1.8em 0 0.6em; color: var(--ink-2); }
.page-head { padding: clamp(32px, 6vw, 72px) 0 clamp(20px, 3vw, 36px); }
.page-head h1 { max-width: 20ch; }
.crumb { font-family: var(--sans); font-size: 0.9rem; margin-bottom: 0.4em; }
.crumb a { color: var(--muted); }

.areas { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 32px; margin: 1.5em 0 0; }
.areas dt { font-family: var(--sans); font-weight: 600; font-size: 1.05rem; margin-bottom: 0.3em; }
.areas dd { margin: 0; color: var(--ink-2); font-size: 0.98rem; }
@media (max-width: 600px) { .areas { grid-template-columns: 1fr; } }

.figures { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; }
.figures div { border-left: 2px solid var(--leaf); padding-left: 14px; }
.figures b { display: block; font-family: var(--sans); font-weight: 700; font-size: clamp(1.8rem, 1.4rem + 1.5vw, 2.6rem); line-height: 1; letter-spacing: -0.02em; }
.figures span { display: block; font-size: 0.92rem; color: var(--muted); margin-top: 6px; }
@media (max-width: 700px) { .figures { grid-template-columns: repeat(2, 1fr); } }

.group-fact { margin: 1.6em 0 0; max-width: 66ch; font-size: 0.98rem; color: var(--ink-2); }
.lines { max-width: 62ch; font-size: 1rem; }
.lines th { font-weight: 500; font-size: 0.78rem; letter-spacing: 0.01em; padding-bottom: 10px; border-bottom: 1px solid var(--rule); }
.lines td { padding: 10px 0; border-bottom: 1px solid var(--rule-soft); color: var(--ink); line-height: 1.35; }
.lines td.n, .lines th.n { width: 6.5em; text-align: right; font-family: var(--sans); font-variant-numeric: tabular-nums; color: var(--ink-2); }
.lines tbody tr:last-child td { border-bottom: 1px solid var(--rule); }
@media (max-width: 480px) { .lines td.n, .lines th.n { width: 4.5em; } }
.roster { list-style: none; padding: 0; margin: 0; columns: 2; column-gap: 32px; font-size: 0.98rem; }
.roster li { break-inside: avoid; padding: 6px 0; border-bottom: 1px solid var(--rule-soft); }
.roster li a { font-family: var(--sans); font-size: 0.85rem; margin-left: 6px; }
@media (max-width: 640px) { .roster { columns: 1; } }

/* ---- people ---- */
.people-strip, .people-grid { list-style: none; padding: 0; margin: 0; display: grid; gap: 20px; }
.people-strip { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.people-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 28px 20px; }
.people-strip a, .person { display: block; text-decoration: none; color: var(--ink); }
.people-strip img, .person img, .ph { width: 100%; aspect-ratio: 1; object-fit: cover; object-position: 50% 30%; border-radius: 4px; background: var(--land); border: 1px solid var(--rule-soft); }
.ph { display: grid; place-items: center; font-family: var(--sans); font-weight: 700; font-size: 2.6rem; color: var(--leaf-deep); }
.ph.big { width: 240px; }
.pn { display: block; font-family: var(--sans); font-weight: 600; margin-top: 10px; line-height: 1.2; }
.pr { display: block; font-size: 0.88rem; color: var(--muted); margin-top: 2px; font-family: var(--sans); }
.founder { display: inline-block; font-family: var(--sans); font-size: 0.74rem; font-weight: 600; color: var(--leaf-deep); border: 1px solid color-mix(in srgb, var(--leaf-deep) 45%, transparent); border-radius: 999px; padding: 1px 8px; margin-top: 6px; }
p.founder { margin: -0.4em 0 0.8em; }
.pi { font-size: 0.9rem; color: var(--ink-2); margin-top: 6px; }
.people-strip a:hover .pn, .person:hover .pn { color: var(--leaf-deep); }
.member-grid { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 32px; align-items: start; }
.member-photo img { width: 240px; aspect-ratio: 1; object-fit: cover; object-position: 50% 30%; border-radius: 6px; border: 1px solid var(--rule); }
.ids { list-style: none; padding: 0; margin: 0.5em 0 0; font-family: var(--sans); font-size: 0.95rem; display: flex; flex-wrap: wrap; gap: 6px 20px; }
@media (max-width: 640px) { .member-grid { grid-template-columns: 1fr; } .member-photo img, .ph.big { width: 160px; } }

/* ---- publications ---- */
.pubs { list-style: none; padding: 0; margin: 0; }
.pub { display: grid; grid-template-columns: minmax(0, 1fr) 190px; gap: 8px 28px; padding: 18px 0; border-top: 1px solid var(--rule-soft); }
.pubs > li:first-child, .year-mark + .pub { border-top: 0; }
.pub-title { font-family: var(--serif); font-weight: 500; font-size: 1.15rem; line-height: 1.3; margin: 0 0 4px; letter-spacing: 0; }
.pub-title a { color: var(--ink); text-decoration: none; }
.pub-title a:hover { color: var(--leaf-deep); text-decoration: underline; }
.pub-authors { font-size: 0.95rem; color: var(--ink-2); margin: 0 0 2px; }
.au-m { color: var(--ink); font-weight: 600; text-decoration: none; }
.au-m:hover { color: var(--leaf-deep); }
.pub-cite { font-size: 0.95rem; color: var(--muted); margin: 0; }
.pub-side { font-family: var(--sans); font-size: 0.82rem; color: var(--muted); display: flex; flex-direction: column; gap: 4px; align-items: flex-start; padding-top: 4px; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--rule); color: var(--ink-2); }
.tag-article { border-color: color-mix(in srgb, var(--leaf-deep) 50%, var(--rule)); color: var(--leaf-deep); }
.cites { color: var(--ink-2); }
.doi { font-family: var(--mono); font-size: 0.78rem; word-break: break-all; }
.bib summary { cursor: pointer; color: var(--muted); list-style: none; }
.bib summary::-webkit-details-marker { display: none; }
.bib summary:hover { color: var(--ink); }
.bib pre { font-family: var(--mono); font-size: 0.74rem; line-height: 1.4; white-space: pre-wrap; background: var(--paper); border: 1px solid var(--rule-soft); padding: 8px; border-radius: 4px; max-width: 100%; margin: 6px 0 0; }
.pubs.compact .pub-side .bib, .pubs.compact .pub-side .doi { display: none; }
.year-mark { padding: 28px 0 8px; }
.year-mark span { font-family: var(--sans); font-weight: 700; font-size: 1.35rem; color: var(--ink); border-bottom: 2px solid var(--leaf); padding-bottom: 2px; }
.year-mark:first-child { padding-top: 0; }
@media (max-width: 700px) { .pub { grid-template-columns: 1fr; } .pub-side { flex-direction: row; flex-wrap: wrap; gap: 6px 14px; } .bib pre { max-width: 100%; } }
.filters { display: grid; grid-template-columns: 2fr 1fr 1fr 0.8fr auto; gap: 12px; align-items: end; margin-bottom: 28px; font-family: var(--sans); font-size: 0.9rem; }
.filters label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); }
.filters input, .filters select { font: inherit; font-size: 0.98rem; line-height: 1.2; color: var(--ink); background: var(--sheet); border: 1px solid var(--rule); border-radius: 6px; height: 42px; padding: 0 12px; min-width: 0; appearance: none; -webkit-appearance: none; }
.filters input:hover, .filters select:hover { border-color: var(--muted); }
.filters input:focus-visible, .filters select:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; border-color: var(--focus); }
.filters input[type="search"]::-webkit-search-decoration, .filters input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }
.filters select { padding-right: 36px; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 6l4.5 4.5L12.5 6' fill='none' stroke='%236E776D' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 14px; }
.filters select option, .filters select optgroup { background: var(--sheet); color: var(--ink); font-family: var(--sans); }
.filters output { color: var(--muted); padding-bottom: 9px; white-space: nowrap; }
.empty { font-family: var(--sans); color: var(--muted); padding: 24px 0; }
@media (max-width: 760px) { .filters { grid-template-columns: 1fr 1fr; } .filters label:first-child { grid-column: 1 / -1; } }

/* ---- software / tables ---- */
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th { text-align: left; font-family: var(--sans); font-weight: 600; font-size: 0.82rem; color: var(--muted); padding: 0 18px 8px 0; border-bottom: 1px solid var(--rule); }
td { padding: 9px 18px 9px 0; border-bottom: 1px solid var(--rule-soft); vertical-align: top; }
th.n, td.n { text-align: right; white-space: nowrap; }
th:last-child, td:last-child { padding-right: 0; }
td.links { white-space: nowrap; }
td.links a { margin-right: 10px; font-family: var(--sans); font-size: 0.88rem; }
.pkgs td:first-child { white-space: nowrap; }
.pkgs .mono { font-weight: 500; }
.install { font-family: var(--mono); font-size: 0.82rem; background: var(--leaf-wash); color: var(--ink); border-radius: 4px; padding: 8px 10px; display: inline-block; margin-top: 0.5em; }
.releases { list-style: none; padding: 0; margin: 0; font-size: 0.95rem; }
.releases li { padding: 5px 0; border-bottom: 1px solid var(--rule-soft); }
.releases time { font-family: var(--sans); color: var(--muted); font-size: 0.85rem; display: inline-block; width: 4.5em; }
.releases span { color: var(--ink-2); }
.courses td.mono { width: 7em; }
@media (max-width: 640px) {
  table.wide thead { display: none; }
  table.wide tr { display: flex; flex-wrap: wrap; gap: 2px 18px; padding: 10px 0; border-bottom: 1px solid var(--rule-soft); }
  table.wide td { border: 0; padding: 0; }
  table.wide td:nth-child(2) { flex: 1 0 100%; }
  table.wide td.n { text-align: left; }
  table.wide td[data-label]::before { content: attr(data-label) " "; color: var(--muted); font-family: var(--sans); font-size: 0.8rem; }
}

/* ---- projects ---- */
.proj-list { list-style: none; padding: 0; margin: 0; }
.proj-list li { padding: 18px 0; border-top: 1px solid var(--rule-soft); }
.proj-list li:first-child { border-top: 0; padding-top: 0; }
.proj-list h3 { font-family: var(--sans); font-size: 1.12rem; margin-bottom: 0.3em; }
.proj-list p { max-width: 70ch; }
.src { display: inline-block; font-family: var(--sans); font-size: 0.78rem; border: 1px solid var(--rule); border-radius: 999px; padding: 1px 8px; margin-left: 4px; }
.sup { list-style: none; padding: 0; margin: 0; font-size: 0.95rem; }
.sup li { padding: 6px 0; border-bottom: 1px solid var(--rule-soft); }
.sup-level { font-family: var(--sans); font-size: 0.8rem; color: var(--leaf-deep); border: 1px solid color-mix(in srgb, var(--leaf-deep) 40%, transparent); border-radius: 999px; padding: 0 7px; margin-right: 6px; }

/* ---- footer ---- */
.foot { border-top: 1px solid var(--rule); padding: 40px 0 56px; margin-top: 24px; font-size: 0.92rem; color: var(--ink-2); }
.foot-grid { display: grid; grid-template-columns: 1.2fr 1.4fr 1.6fr; gap: 32px; }
.foot-id { display: flex; gap: 14px; align-items: flex-start; }
.foot-id p { margin: 0; line-height: 1.4; }
.foot-addr { font-style: normal; line-height: 1.6; }
.foot-meta { margin: 0; font-family: var(--sans); font-size: 0.86rem; color: var(--muted); line-height: 1.6; }
.stale { color: #B0700B; }
@media (max-width: 760px) { .foot-grid { grid-template-columns: 1fr; gap: 20px; } }
