:root {
  --nav-h: 54px;
  --bg: #fbfaf7;
  --surface: #ffffff;
  --surface-2: #f3f1ec;
  --text: #1d1f24;
  --muted: #5d6270;
  --faint: #8a8f9c;
  --border: #e4e1da;
  --accent: #3a5bd9;
  --accent-ink: #ffffff;
  --formation: #2f6fd6;
  --organization: #178a73;
  --utilization: #7b4bc4;
  --maintenance: #c27c0e;
  --evaluation: #c2410c;
  --app: #0e7490;
  --base: #5d6270;
  --shadow: 0 1px 2px rgba(20, 22, 30, .05), 0 4px 16px rgba(20, 22, 30, .04);
  --radius: 12px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111318;
    --surface: #181b22;
    --surface-2: #20242d;
    --text: #e8e9ec;
    --muted: #a3a8b5;
    --faint: #7c8190;
    --border: #2c313c;
    --accent: #8ea6ff;
    --accent-ink: #0d1020;
    --formation: #7fb0ff;
    --organization: #5fd0b5;
    --utilization: #c4a2ff;
    --maintenance: #f2b45a;
    --evaluation: #ff9a6b;
    --app: #5ccbe6;
    --base: #a3a8b5;
    --shadow: none;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #111318;
  --surface: #181b22;
  --surface-2: #20242d;
  --text: #e8e9ec;
  --muted: #a3a8b5;
  --faint: #7c8190;
  --border: #2c313c;
  --accent: #8ea6ff;
  --accent-ink: #0d1020;
  --formation: #7fb0ff;
  --organization: #5fd0b5;
  --utilization: #c4a2ff;
  --maintenance: #f2b45a;
  --evaluation: #ff9a6b;
  --app: #5ccbe6;
  --base: #a3a8b5;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1280px; margin: 0 auto; padding: 0 24px; }

/* hero */
.hero { border-bottom: 1px solid var(--border); background: var(--surface); padding: 36px 0 28px; }
.hero-top { display: flex; justify-content: space-between; align-items: center; }
.eyebrow { margin: 0; font-size: 12.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); font-weight: 600; }
.hero h1 { margin: 8px 0 10px; font-size: clamp(28px, 5vw, 42px); line-height: 1.12; letter-spacing: -.02em; }
.lede { margin: 0 0 18px; max-width: 860px; font-size: 17px; color: var(--muted); }
.lede b { color: var(--text); }
.stage-word { font-weight: 600; }
.s-formation { color: var(--formation); }
.s-organization { color: var(--organization); }
.s-utilization { color: var(--utilization); }
.s-maintenance { color: var(--maintenance); }
.stats { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-bottom: 18px; color: var(--muted); font-size: 14px; }
.stats b { color: var(--text); font-size: 20px; font-variant-numeric: tabular-nums; margin-right: 4px; }
.hero-links { display: flex; flex-wrap: wrap; gap: 8px; }
.btn {
  display: inline-block; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border);
  color: var(--text); background: var(--surface); font-size: 14px; font-weight: 500;
}
.btn:hover { text-decoration: none; border-color: var(--faint); }
button.btn { cursor: pointer; font-family: inherit; line-height: inherit; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.icon-btn {
  border: 1px solid var(--border); background: var(--surface); color: var(--muted); width: 34px; height: 34px;
  border-radius: 50%; cursor: pointer; font-size: 16px;
}

/* controls */
.controls { padding: 16px 0 10px; border-bottom: 1px solid var(--border); background: var(--bg); }
@media (min-width: 760px) and (min-height: 640px) {
  .controls {
    position: sticky; top: var(--nav-h); z-index: 5; background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: blur(8px);
  }
}
.search-row { display: flex; gap: 8px; }
#q, #sort {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 9px 12px;
}
#q { flex: 1; min-width: 0; }
#q:focus, #sort:focus { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 1px; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px 4px; margin-top: 12px; }
.tab {
  flex: none; border: 1px solid transparent; background: none; color: var(--muted); font: inherit; font-size: 14px;
  padding: 6px 10px; border-radius: 999px; cursor: pointer; white-space: nowrap;
}
.tab:hover { color: var(--text); background: var(--surface-2); }
.tab[aria-pressed="true"] { color: var(--text); background: var(--surface); border-color: var(--border); box-shadow: var(--shadow); font-weight: 600; }
.tab .n { color: var(--faint); font-weight: 400; font-size: 12px; margin-left: 4px; font-variant-numeric: tabular-nums; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chips:empty { display: none; }
.chip {
  border: 1px solid var(--border); background: var(--surface); color: var(--muted); font: inherit; font-size: 13px;
  padding: 3px 10px; border-radius: 999px; cursor: pointer;
}
.chip:hover { color: var(--text); border-color: var(--faint); }
.chip[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }
.chips.small .chip { font-size: 12.5px; padding: 2px 9px; }
.filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; }
.filter-row .chips { margin-top: 10px; }
.toggle { margin-top: 10px; display: inline-flex; gap: 6px; align-items: center; font-size: 13.5px; color: var(--muted); cursor: pointer; }
.link-btn { margin-top: 10px; background: none; border: 0; color: var(--accent); font: inherit; font-size: 13.5px; cursor: pointer; padding: 0; }

.cat-desc { margin: 18px 0 0; color: var(--muted); max-width: 960px; }
.cat-desc:empty { display: none; }
.count { margin: 14px 0 10px; font-size: 13px; color: var(--faint); }

/* list */
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px 12px;
  box-shadow: var(--shadow); border-left: 3px solid var(--stage, var(--base));
}
.card-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.card-name { font-weight: 700; font-size: 16px; }
.card-meta { color: var(--faint); font-size: 13px; font-variant-numeric: tabular-nums; }
.venue { font-weight: 600; color: var(--muted); }
.card-title { margin: 3px 0 6px; font-size: 14.5px; }
.card-title a { color: var(--text); }
.card-title a:hover { color: var(--accent); }
.card-note { margin: 0 0 9px; color: var(--muted); font-size: 14px; }
.card-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tag {
  border: 0; font: inherit; font-size: 12px; padding: 2px 8px; border-radius: 6px; cursor: pointer;
  color: var(--c, var(--base)); background: color-mix(in srgb, var(--c, var(--base)) 12%, transparent);
}
.tag:hover { background: color-mix(in srgb, var(--c, var(--base)) 22%, transparent); }
.links { margin-left: auto; display: flex; gap: 12px; font-size: 13px; font-weight: 600; }
.empty { color: var(--muted); text-align: center; padding: 40px 0; }
mark { background: color-mix(in srgb, var(--maintenance) 30%, transparent); color: inherit; border-radius: 2px; }

.muted { color: var(--muted); font-size: 14px; }

/* top navigation */
.topnav {
  position: sticky; top: 0; z-index: 20; height: var(--nav-h);
  background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topnav-inner { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { font-weight: 700; color: var(--text); white-space: nowrap; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.topnav-links { display: flex; align-items: center; gap: 4px; }
.topnav-links a, .nav-btn {
  color: var(--muted); font: inherit; font-size: 14.5px; font-weight: 500; padding: 6px 11px; border-radius: 8px;
  background: none; border: 0; cursor: pointer; white-space: nowrap;
}
.topnav-links a:hover, .nav-btn:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.topnav-links a[aria-current="page"] { color: var(--text); background: var(--surface-2); font-weight: 600; }
.topnav-links .icon-btn { margin-left: 6px; width: 32px; height: 32px; }
:target { scroll-margin-top: calc(var(--nav-h) + 16px); }
section[id], article[id], h3[id] { scroll-margin-top: calc(var(--nav-h) + 16px); }

/* list page header */
.page-head { border-bottom: 1px solid var(--border); background: var(--surface); padding: 26px 0 8px; }
.page-head h1 { margin: 0 0 8px; font-size: clamp(26px, 4vw, 34px); letter-spacing: -.02em; }
.page-head .lede { font-size: 15.5px; }

/* survey hero */
.survey-hero { padding: 44px 0 30px; }
.pretitle { margin: 12px 0 0; font-size: clamp(17px, 2.2vw, 22px); color: var(--muted); font-weight: 500; letter-spacing: -.005em; }
.survey-hero h1 { margin: 4px 0 18px; font-size: clamp(32px, 5.4vw, 52px); }
.authors { margin: 0; max-width: 980px; font-size: 14.5px; color: var(--text); }
.affil { margin: 4px 0 18px; font-size: 13.5px; color: var(--faint); }
.authors sup, .affil sup { color: var(--accent); font-weight: 600; }
.question {
  max-width: 860px; margin: 0 0 20px; padding: 12px 16px; border-left: 3px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 7%, transparent); border-radius: 0 10px 10px 0;
  font-size: 16.5px; font-style: italic; color: var(--text);
}
.kpis { list-style: none; padding: 0; margin: 24px 0 0; display: flex; flex-wrap: wrap; gap: 10px; }
.kpis li {
  display: flex; align-items: baseline; gap: 6px; padding: 8px 14px; border: 1px solid var(--border);
  border-radius: 12px; background: var(--bg);
}
.kpis b { font-size: 22px; font-variant-numeric: tabular-nums; }
.kpis span { color: var(--muted); font-size: 13.5px; }

/* overview layout */
.doc-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 48px; padding-top: 28px; }
.toc { position: sticky; top: calc(var(--nav-h) + 20px); align-self: start; max-height: calc(100vh - var(--nav-h) - 40px); overflow: auto; font-size: 14px; }
.toc-title { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); font-weight: 600; }
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc ol ol { margin: 2px 0 6px 12px; font-size: 13px; }
.toc a { display: block; padding: 3px 10px; border-left: 2px solid transparent; color: var(--muted); }
.toc a:hover { color: var(--text); text-decoration: none; }
.toc a.active { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }
.toc-cta { display: inline-block; margin-top: 14px; padding: 6px 12px !important; border: 1px solid var(--border) !important; border-radius: 999px; font-weight: 600; color: var(--accent) !important; }

.doc { min-width: 0; max-width: 960px; padding-bottom: 24px; }
.doc section { padding: 8px 0 34px; border-bottom: 1px solid var(--border); margin-bottom: 30px; }
.doc section:last-child { border-bottom: 0; }
.doc h2 { margin: 0 0 14px; font-size: 28px; letter-spacing: -.02em; line-height: 1.2; }
.doc h3 { margin: 30px 0 10px; font-size: 20px; letter-spacing: -.01em; }
.doc h4 { margin: 0 0 6px; font-size: 15.5px; }
.doc p, .doc li { font-size: 15.5px; line-height: 1.65; }
.doc p { margin: 0 0 14px; }
.note { color: var(--muted); font-size: 14.5px !important; }
.more { margin-top: 18px !important; font-weight: 600; }

/* figures: the survey's figures are drawn on white, so keep a white card in dark mode too */
.fig { margin: 20px 0 22px; padding: 14px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); }
.fig img { display: block; width: 100%; height: auto; }
.fig figcaption { margin-top: 10px; color: #5d6270; font-size: 13.5px; text-align: center; line-height: 1.5; }

/* cards */
.cards { display: grid; gap: 12px; margin: 14px 0 18px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card-x {
  position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow);
}
.card-x p { font-size: 14.5px !important; line-height: 1.6 !important; margin: 0 0 8px !important; }
.card-x p:last-child { margin-bottom: 0 !important; }
.card-x h3 { margin: 0 0 8px; font-size: 16px; }
.card-x .num {
  float: left; margin: 0 10px 2px 0; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 13px;
}
.card-x.accent { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.card-x .eg, .doc .eg { color: var(--faint); font-size: 13px !important; }
.card-x ul { margin: 0; padding-left: 18px; }
.card-x li { font-size: 14px; margin: 4px 0; line-height: 1.5; }
.card-x li .eg { display: block; }
.card-x .q { color: var(--text); font-weight: 600; }
.kicker { font-size: 12px !important; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.form-traj { border-top: 3px solid #0e9f87; }
.form-sem { border-top: 3px solid var(--formation); }
.form-proc { border-top: 3px solid #d08a17; }
.form-traj .kicker, .form-traj h4 { color: #0e9f87; }
.form-sem .kicker, .form-sem h4 { color: var(--formation); }
.form-proc .kicker, .form-proc h4 { color: #c27c0e; }
.dims .sym {
  font: italic 700 26px/1 Georgia, "Times New Roman", serif; color: var(--accent); margin-bottom: 4px !important;
}

.definition {
  margin: 4px 0 16px; padding: 16px 20px; border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
}
.definition p { margin: 0 !important; font-size: 17px !important; line-height: 1.6 !important; }
.formula {
  margin: 10px 0 16px !important; padding: 12px 16px; text-align: center; border-radius: 10px;
  background: var(--surface-2); font: 17px/1.9 Georgia, "Times New Roman", serif !important; overflow-x: auto;
}
.formula sub { font-size: 70%; }
.callout {
  margin: 18px 0; padding: 14px 18px; border-radius: var(--radius);
  background: color-mix(in srgb, var(--maintenance) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--maintenance) 40%, var(--border));
}
.callout p { margin: 0 !important; }

/* tables */
.table-wrap { overflow-x: auto; margin: 14px 0 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.5; }
.tbl th, .tbl td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.tbl thead th { background: var(--surface-2); font-size: 13px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl td .eg { display: block; margin-top: 3px; font-size: 12.5px; }
.tbl.apps { min-width: 860px; }
.tbl.claims td:first-child { width: 22%; }

/* lifecycle stages */
.stage {
  margin: 26px 0 0; padding: 20px 22px 8px; border: 1px solid var(--border); border-left: 4px solid var(--stage);
  border-radius: var(--radius); background: var(--surface);
}
.stage-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px 16px; margin-bottom: 10px; }
.stage-head h3 { margin: 0; color: var(--stage); font-size: 22px; }
.stage-link { font-weight: 600; font-size: 14px; }
.stage .fig { margin: 14px 0; }
.takeaways { margin: 18px 0 8px !important; text-transform: uppercase; letter-spacing: .05em; font-size: 12.5px !important; color: var(--faint); }
.findings { margin: 0 0 14px; padding-left: 20px; }
.findings li { margin: 0 0 9px; }

/* conclusions and problems */
.conclusions { counter-reset: c; list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 10px; }
.conclusions li {
  counter-increment: c; position: relative; padding: 12px 16px 12px 54px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface);
}
.conclusions li::before {
  content: counter(c); position: absolute; left: 14px; top: 12px; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; background: var(--text); color: var(--bg); font-weight: 700; font-size: 14px;
}
.conclusions h4 { margin: 2px 0 4px; }
.conclusions p { margin: 0 !important; font-size: 14.5px !important; color: var(--muted); }
.group { font-size: 15px !important; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); margin-top: 22px !important; }
.problems h4 { margin-top: 2px; }
.cite-box .bibtex { margin-top: 4px; }
.end-cta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }

@media (max-width: 1100px) {
  .doc-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .toc { display: none; }
  .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .cols-2, .cols-3, .cols-4 { grid-template-columns: minmax(0, 1fr); }
  .brand { font-size: 14px; }
  .topnav-links a, .nav-btn { padding: 6px 7px; font-size: 13.5px; }
  .stage { padding: 16px 14px 6px; }
}
@media (max-width: 520px) {
  .brand { display: none; }
  .topnav-inner { justify-content: center; }
}
.footer { border-top: 1px solid var(--border); padding: 18px 16px 40px; color: var(--faint); font-size: 13px; }
.footer .link-btn { margin: 0; font-size: 13px; }

/* BibTeX dialog */
#bibtex-dialog {
  width: min(720px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--border); border-radius: 14px;
  background: var(--surface); color: var(--text); box-shadow: 0 24px 64px rgba(10, 12, 18, .28);
}
#bibtex-dialog::backdrop { background: rgba(10, 12, 18, .5); backdrop-filter: blur(2px); }
.dialog-inner { padding: 18px 20px 16px; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.dialog-head h2 { margin: 0; font-size: 18px; }
.dialog-inner .muted { margin: 6px 0 0; }
.bibtex {
  margin: 12px 0 14px; padding: 12px 14px; max-height: 55vh; overflow: auto;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  font: 12.5px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.dialog-actions { display: flex; justify-content: flex-end; align-items: center; gap: 12px; }
.copy-status { color: var(--organization); font-size: 13px; }

@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .hero { padding: 24px 0 20px; }
  .lede { font-size: 15.5px; }
  .search-row { flex-direction: column; }
  .links { margin-left: 0; width: 100%; }
}
