/* sok-kernel-bug-lifecycle companion site. Stage colours follow the paper's palette. */
:root {
  --bg: #fbfaf7;
  --bg-alt: #f2f0ea;
  --surface: #ffffff;
  --text: #1d1c1a;
  --muted: #5f5b53;
  --line: #dedad0;
  --accent: #9a1b2f;          /* UIC-ish crimson */
  --accent-ink: #ffffff;
  --link: #8a1729;
  --s1: #5b8fd1; --s2: #8d8d8d; --s3: #e0a432; --s4: #d17f8e; --s5: #c64a4a;
  --full: #2f7d4f; --part: #c08a1b; --none: #b8b2a6;
  --code-bg: #f4f1ea;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.04);
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151517; --bg-alt: #1b1b1e; --surface: #212125; --text: #ecebe7; --muted: #a6a29a;
    --line: #34343a; --accent: #e0566b; --accent-ink: #1a0b0e; --link: #f08a9a;
    --full: #5cc48a; --part: #e3b04f; --none: #5d5a55; --code-bg: #1a1a1d;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #151517; --bg-alt: #1b1b1e; --surface: #212125; --text: #ecebe7; --muted: #a6a29a;
  --line: #34343a; --accent: #e0566b; --accent-ink: #1a0b0e; --link: #f08a9a;
  --full: #5cc48a; --part: #e3b04f; --none: #5d5a55; --code-bg: #1a1a1d;
  --shadow: none; color-scheme: dark;
}

* { 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 var(--sans); -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 2px; }
code { font: .88em var(--mono); background: var(--code-bg); padding: .1em .35em; border-radius: 4px; }
h1, h2, h3 { font-family: var(--serif); line-height: 1.2; margin: 0; }
h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); margin-bottom: .5rem; }
h3 { font-size: 1.15rem; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.wrap.narrow { max-width: 820px; }
.muted { color: var(--muted); }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav { display: flex; align-items: center; gap: 20px; height: 56px; }
.brand { font: 600 1rem var(--serif); color: var(--text); text-decoration: none; white-space: nowrap; }
.navlinks { display: flex; gap: 18px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.navlinks::-webkit-scrollbar { display: none; }
.navlinks a { color: var(--muted); text-decoration: none; font-size: .9rem; white-space: nowrap; }
.navlinks a:hover { color: var(--text); }
.theme-toggle {
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; cursor: pointer; flex: none;
}

/* ---------- hero ---------- */
.hero { padding: 64px 0 48px; text-align: center; border-bottom: 1px solid var(--line); }
.venue {
  display: inline-block; margin: 0 0 18px; padding: 4px 12px; border-radius: 999px;
  font-size: .8rem; font-weight: 600; letter-spacing: .02em;
  color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
}
.hero h1 { font-size: clamp(1.75rem, 4.4vw, 2.9rem); font-weight: 700; letter-spacing: -.01em; }
.authors { margin: 22px 0 4px; font-size: 1.08rem; }
.authors span { white-space: nowrap; }
.affils { margin: 0; color: var(--muted); font-size: .95rem; }
.buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 28px 0 40px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 999px;
  background: var(--surface); color: var(--text); border: 1px solid var(--line);
  text-decoration: none; font-weight: 500; font-size: .93rem; box-shadow: var(--shadow);
  transition: border-color .15s, transform .15s;
}
.btn:hover { border-color: var(--accent); transform: translateY(-1px); }
.btn svg { width: 17px; height: 17px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.stats {
  list-style: none; margin: 0 auto; padding: 0; max-width: 1000px;
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px;
  background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
}
.stats li { background: var(--surface); padding: 18px 12px; }
.stats b { display: block; font: 700 1.6rem var(--serif); color: var(--accent); }
.stats span { display: block; font-size: .82rem; color: var(--muted); line-height: 1.35; margin-top: 4px; }

/* ---------- sections ---------- */
.block { padding: 64px 0; }
.block.alt { background: var(--bg-alt); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.lede { color: var(--muted); font-size: 1.05rem; max-width: 760px; margin: 0 0 28px; }
.sub { margin: 40px 0 12px; }
#abstract p { text-align: justify; hyphens: auto; }

/* pipeline */
.pipeline { list-style: none; padding: 0; margin: 0 0 10px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; counter-reset: s; }
.st {
  position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 14px 14px 14px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow);
  border-top: 5px solid var(--c);
}
.st b { font-family: var(--serif); font-size: 1.02rem; display: block; }
.st small { color: var(--muted); font-size: .85rem; }
.st .lvl {
  align-self: flex-start; font: 600 .75rem var(--mono); padding: 2px 8px; border-radius: 6px;
  background: color-mix(in srgb, var(--c) 22%, transparent); color: var(--text);
}
.st:not(:last-child)::after {
  content: ""; position: absolute; right: -9px; top: 50%; width: 8px; height: 8px;
  border-top: 2px solid var(--muted); border-right: 2px solid var(--muted); transform: translate(0,-50%) rotate(45deg);
}
.s1 { --c: var(--s1); } .s2 { --c: var(--s2); } .s3 { --c: var(--s3); } .s4 { --c: var(--s4); } .s5 { --c: var(--s5); }
.legend { color: var(--muted); font-size: .85rem; margin: 10px 0 28px; }
.tag {
  display: inline-block; font: 600 .72rem var(--mono); padding: 1px 6px; border-radius: 5px;
  background: color-mix(in srgb, var(--c) 25%, transparent); white-space: nowrap;
}

/* tables */
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.table-scroll.tall { max-height: 640px; overflow-y: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data caption { caption-side: bottom; text-align: left; padding: 10px 14px; color: var(--muted); font-size: .82rem; }
table.data th, table.data td { padding: 9px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
table.data thead th {
  font-weight: 600; font-size: .8rem; letter-spacing: .02em; color: var(--muted);
  background: var(--surface); position: sticky; top: 0; z-index: 1; white-space: nowrap;
}
table.data tbody tr:last-child td { border-bottom: 0; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
.matrix td:nth-child(n+3), .matrix th:nth-child(n+3) { text-align: center; }
.mk { font-size: 1.1rem; line-height: 1; }
.mk.full { color: var(--full); } .mk.part { color: var(--part); } .mk.none { color: var(--none); }
.bench td:not(:first-child), .bench th { text-align: center; }
.bench thead th:first-child { text-align: left; }
.bench td { font-variant-numeric: tabular-nums; }
.bench tr.group td { background: var(--bg-alt); font-style: italic; color: var(--muted); font-size: .82rem; text-align: left; }
.bench td.hi { font-weight: 700; color: var(--accent); }

/* cards */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px;
  box-shadow: var(--shadow); position: relative;
}
.card h3 { margin-bottom: 6px; }
.card p { margin: 0; color: var(--muted); font-size: .93rem; }
.cid { font: 600 .78rem var(--mono); color: var(--accent); display: block; margin-bottom: 6px; }
.cards.art { grid-template-columns: repeat(4, 1fr); }
.card.link { text-decoration: none; color: inherit; transition: border-color .15s, transform .15s; }
.card.link:hover { border-color: var(--accent); transform: translateY(-2px); }
.card.link h3 span { color: var(--accent); }

/* figures & findings */
.figs { display: grid; grid-template-columns: 1.25fr 1fr; gap: 20px; align-items: start; }
.fig { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.fig img { width: 100%; height: auto; display: block; background: #fff; border-radius: 6px; padding: 8px; }
.fig figcaption { font-size: .86rem; color: var(--muted); margin-top: 10px; }
.findings { margin: 0; padding: 0; list-style: none; counter-reset: f; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.findings li {
  counter-increment: f; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent);
  border-radius: 8px; padding: 12px 14px 12px 46px; position: relative; font-size: .93rem;
}
.findings li::before {
  content: counter(f); position: absolute; left: 14px; top: 12px;
  font: 700 .95rem var(--serif); color: var(--accent);
}
.callout {
  background: color-mix(in srgb, var(--accent) 8%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 10px; padding: 14px 18px; margin-bottom: 20px; font-size: .96rem;
}

/* systems explorer */
.controls { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; margin-bottom: 14px; }
.controls input[type="search"] {
  flex: 1 1 280px; padding: 10px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: inherit;
}
.controls input[type="search"]:focus { outline: 2px solid color-mix(in srgb, var(--accent) 50%, transparent); outline-offset: 1px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 999px;
  padding: 5px 12px; font: 500 .82rem var(--sans); cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.check { font-size: .88rem; display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.count { color: var(--muted); font-size: .85rem; }
.dl { font-size: .85rem; margin-left: auto; color: var(--muted); }
.systems th[data-sort] { cursor: pointer; user-select: none; }
.systems th[data-sort]::after { content: " ↕"; opacity: .35; }
.systems th[aria-sort="ascending"]::after { content: " ↑"; opacity: 1; }
.systems th[aria-sort="descending"]::after { content: " ↓"; opacity: 1; }
.systems .sname { font-weight: 600; white-space: nowrap; }
.systems .ptitle { display: block; color: var(--muted); font-size: .82rem; margin-top: 2px; }
.systems .ptitle a { color: inherit; }
.systems .llm { color: var(--accent); margin-left: 4px; }
.pill {
  display: inline-block; font-size: .74rem; padding: 1px 7px; border-radius: 5px; margin: 1px 3px 1px 0;
  background: var(--bg-alt); border: 1px solid var(--line); white-space: nowrap;
}
.pill.k { font-family: var(--mono); }
.glossary { margin-top: 14px; font-size: .88rem; color: var(--muted); }
.glossary summary { cursor: pointer; color: var(--text); }
.glossary dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px 16px; margin: 10px 0; }
.glossary dt { font-family: var(--mono); color: var(--text); display: inline; }
.glossary dd { display: inline; margin: 0 0 0 6px; }

/* citation */
.bib { position: relative; }
.bib pre {
  margin: 0; padding: 18px 20px; overflow-x: auto; background: var(--code-bg); border: 1px solid var(--line);
  border-radius: 10px; font: .84rem/1.6 var(--mono);
}
.copy {
  position: absolute; top: 10px; right: 10px; border: 1px solid var(--line); background: var(--surface);
  color: var(--text); border-radius: 6px; padding: 4px 10px; font: 500 .8rem var(--sans); cursor: pointer;
}
.note { color: var(--muted); font-size: .88rem; margin-top: 22px; }
.foot { padding: 28px 0 40px; color: var(--muted); font-size: .86rem; text-align: center; }
.foot a { color: inherit; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
  .cards, .cards.art { grid-template-columns: repeat(2, 1fr); }
  .figs, .findings { grid-template-columns: 1fr; }
  .pipeline { grid-template-columns: 1fr; gap: 14px; }
  .st { flex-direction: row; align-items: center; border-top-width: 1px; border-left: 5px solid var(--c); }
  .st .lvl { align-self: center; min-width: 46px; text-align: center; }
  .st:not(:last-child)::after { right: auto; left: 50%; top: auto; bottom: -11px; transform: translateX(-50%) rotate(135deg); }
}
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .navlinks { display: none; }
  .nav { justify-content: space-between; }
  .hero { padding: 40px 0 32px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stats li:last-child { grid-column: span 2; }
  .cards, .cards.art { grid-template-columns: 1fr; }
  .block { padding: 44px 0; }
  .dl { margin-left: 0; }
  #abstract p { text-align: left; }
}
.systems td:nth-child(2) { white-space: nowrap; }
