:root {
  --bg: #fbfaf7; --bg-alt: #f2f0ea; --surface: #ffffff; --text: #1c1f23; --muted: #5d6670;
  --line: #e2ded5; --accent: #0f766e; --accent-soft: #d6efec; --spam: #c2410c; --ham: #15803d;
  --setosa: #0f766e; --versicolor: #b45309; --virginica: #6d28d9;
  --radius: 14px; --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111416; --bg-alt: #171b1e; --surface: #1d2226; --text: #e9ecee; --muted: #9aa5ae;
    --line: #2c3338; --accent: #2dd4bf; --accent-soft: #123b37; --spam: #fb923c; --ham: #4ade80;
    --setosa: #2dd4bf; --versicolor: #fbbf24; --virginica: #a78bfa; --shadow: none;
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 64px; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

.top { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.nav { display: flex; align-items: center; justify-content: space-between; height: 58px; }
.brand { font-weight: 800; font-size: 19px; color: var(--text); text-decoration: none; letter-spacing: -.02em; }
.brand span { color: var(--accent); }
nav { display: flex; gap: 18px; align-items: center; }
nav a { color: var(--muted); text-decoration: none; font-weight: 500; font-size: 15px; }
nav a:hover { color: var(--text); }
nav .gh { color: var(--accent); }

.hero { padding: 72px 0 56px; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: 12.5px; font-weight: 700; color: var(--accent); margin: 0 0 10px; }
h1 { font-size: clamp(32px, 5vw, 52px); line-height: 1.08; letter-spacing: -.03em; margin: 0 0 16px; max-width: 820px; }
.lede { font-size: 18px; color: var(--muted); max-width: 680px; margin: 0 0 36px; }
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.card { display: flex; flex-direction: column; gap: 6px; padding: 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--text); box-shadow: var(--shadow); transition: transform .15s, border-color .15s; }
.card:hover { transform: translateY(-2px); border-color: var(--accent); }
.card .tag { font-size: 13px; color: var(--muted); }
.card b { font-size: 19px; }
.card .stat { font-weight: 700; color: var(--accent); }

.project { padding: 72px 0; border-top: 1px solid var(--line); }
.project.alt { background: var(--bg-alt); }
.phead { display: flex; justify-content: space-between; gap: 32px; align-items: flex-end; }
.phead h2 { font-size: clamp(28px, 3.6vw, 38px); letter-spacing: -.02em; margin: 0 0 10px; }
.phead p { color: var(--muted); max-width: 640px; margin: 0; }
.links { display: flex; gap: 10px; flex-shrink: 0; }
.btn { display: inline-block; padding: 10px 16px; border-radius: 10px; background: var(--accent); color: #fff; font-weight: 600; text-decoration: none; border: 1px solid var(--accent); font-size: 15px; cursor: pointer; font-family: inherit; }
@media (prefers-color-scheme: dark) { .btn { color: #06201d; } }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.small { padding: 8px 12px; font-size: 14px; }

.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 28px 0; }
.metrics div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.metrics b { display: block; font-size: 26px; letter-spacing: -.02em; }
.metrics span { color: var(--muted); font-size: 14px; }

.demo { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 24px; box-shadow: var(--shadow); }
.demo h3 { margin: 0 0 16px; font-size: 20px; }
.demo-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 28px; }
.presets { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; font-size: 14px; color: var(--muted); }
.presets button { border: 1px solid var(--line); background: var(--bg); color: var(--text); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 14px; cursor: pointer; }
.presets button:hover { border-color: var(--accent); color: var(--accent); }
.sliders label { display: grid; grid-template-columns: 150px 1fr 64px; align-items: center; gap: 12px; margin: 10px 0; font-size: 15px; }
.sliders output { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
input[type=range] { width: 100%; accent-color: var(--accent); }
textarea { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 12px; font: inherit; background: var(--bg); color: var(--text); resize: vertical; }
textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
.result { border-left: 1px solid var(--line); padding-left: 28px; }
.label { margin: 0 0 4px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.big { font-size: 38px; font-weight: 800; letter-spacing: -.02em; margin: 0 0 12px; line-height: 1.1; }
.big small { font-size: 16px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.note { color: var(--muted); font-size: 14px; margin: 8px 0 14px; }
.note.small { font-size: 13px; margin: 18px 0 0; }
.bars .row { display: grid; grid-template-columns: 90px 1fr 40px; gap: 10px; align-items: center; font-size: 14px; margin: 5px 0; }
.bars .track { height: 10px; background: var(--bg-alt); border-radius: 99px; overflow: hidden; }
.bars .fill { height: 100%; border-radius: 99px; transition: width .3s; }
#iris-plot { width: 100%; max-width: 380px; margin-top: 12px; }
#iris-plot text { fill: var(--muted); font-size: 10px; }
#iris-plot .axis { stroke: var(--line); }
.meter { height: 12px; background: var(--bg-alt); border-radius: 99px; overflow: hidden; }
.meter div { height: 100%; width: 0; border-radius: 99px; transition: width .3s, background .3s; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips span { font-size: 13px; padding: 3px 10px; border-radius: 99px; border: 1px solid var(--line); }
.chips .s { color: var(--spam); border-color: currentColor; }
.chips .h { color: var(--ham); border-color: currentColor; }

.media { margin: 28px 0 20px; }
video { width: 100%; border-radius: var(--radius); border: 1px solid var(--line); background: #000; aspect-ratio: 16 / 9; display: block; }
.gallery { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
figure { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
figure img { width: 100%; height: 150px; object-fit: contain; background: #fff; display: block; }
figcaption { font-size: 13px; color: var(--muted); padding: 8px 10px; }

footer { border-top: 1px solid var(--line); padding: 28px 0 40px; color: var(--muted); font-size: 14px; }

@media (max-width: 860px) {
  .cards, .metrics { grid-template-columns: 1fr 1fr; }
  .phead { flex-direction: column; align-items: flex-start; }
  .demo-grid { grid-template-columns: 1fr; }
  .result { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 20px; }
  .gallery { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .cards { grid-template-columns: 1fr; }
  nav a:not(.gh) { display: none; }
  .sliders label { grid-template-columns: 1fr 56px; }
  .sliders label span { grid-column: 1 / -1; }
  .demo { padding: 16px; }
}

/* separate project pages */
nav a.on { color: var(--text); font-weight: 700; }
.project.page { border-top: 0; padding-top: 32px; }
.crumb { margin: 0 0 18px; font-size: 14px; }
.crumb a { text-decoration: none; }
.card .desc { color: var(--muted); font-size: 14.5px; }
.card .go { margin-top: auto; padding-top: 8px; font-size: 14px; font-weight: 600; color: var(--accent); }
.pager { border-top: 1px solid var(--line); padding: 28px 0; }
.pager .wrap { display: flex; justify-content: space-between; gap: 16px; }
.pager a { display: flex; flex-direction: column; text-decoration: none; color: var(--text); padding: 14px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); flex: 1; max-width: 360px; }
.pager a:hover { border-color: var(--accent); }
.pager a.next { text-align: right; margin-left: auto; }
.pager span { font-size: 13px; color: var(--muted); }
@media (max-width: 640px) {
  nav { gap: 12px; }
  nav a:not(.gh) { display: inline; font-size: 14px; }
  .pager .wrap { flex-direction: column; }
  .pager a { max-width: none; }
  .pager a.next { text-align: left; margin-left: 0; }
}
