/* The case-study pages: /case-studies and /case-studies/<run>.
   Self-contained on purpose, so these pages do not load the landing page's CSS.
   Status rules live here too: a failed or qualified run must not look like a win. */

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/fonts/jetbrains-mono-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

html, body { margin: 0; padding: 0; background: #0c100d; }
a { color: #4ad688; text-decoration: none; }
a:hover { color: #7ce8ab; }

.cs-page {
  background: #0c100d;
  color: #eef4ee;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- nav and footer ---------- */
.cs-nav { border-bottom: 1px solid #1d2921; }
.cs-nav-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 16px 20px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.cs-wordmark { color: #eef4ee; font-weight: 700; font-size: 15px; }
.cs-wordmark span { color: #4ad688; }
.cs-wordmark:hover { color: #eef4ee; }
.cs-spacer { flex: 1; }
.cs-navlink { font-size: 13px; color: #8fa393; }
.cs-navlink:hover { color: #eef4ee; }
.cs-navlink--current { color: #eef4ee; }
.cs-navlink--gh { display: inline-flex; align-items: center; gap: 7px; }
.cs-navbadge {
  border: 1px solid #2a3c30;
  border-radius: 3px;
  padding: 2px 5px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}
.cs-footer { border-top: 1px solid #1d2921; }
.cs-footer-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 18px 20px;
  box-sizing: border-box;
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 12px;
  color: #728476;
}
.cs-footer a { color: #728476; }
.cs-footer a:hover { color: #4ad688; }

/* ---------- layout ---------- */
.cs-main {
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding: 40px 20px 72px;
  box-sizing: border-box;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 40px;
}
.cs-main--index { gap: 28px; }
.cs-header { display: flex; flex-direction: column; gap: 16px; }
.cs-main--index .cs-header { gap: 12px; }
.cs-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
  color: #728476;
}
.cs-badge {
  border: 1px solid #2a3c30;
  border-radius: 3px;
  padding: 3px 6px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  color: #8fa393;
}
h1.cs-title {
  margin: 0;
  font-size: clamp(22px, 3.4vw, 34px);
  line-height: 1.25;
  font-weight: 700;
  overflow-wrap: anywhere;
  text-wrap: pretty;
  max-width: 30ch;
}
.cs-main--index h1.cs-title { max-width: none; }
.cs-lede { margin: 0; color: #8fa393; font-size: 14px; max-width: 62ch; text-wrap: pretty; }
.cs-statusline { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cs-statusnote { font-size: 13px; color: #8fa393; }
.cs-section { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.cs-section h2 { margin: 0; font-size: 14px; font-weight: 700; color: #eef4ee; }
.cs-text { margin: 0; color: #cfdcd1; font-size: 14px; max-width: 70ch; text-wrap: pretty; }

/* ---------- status labels: the rules that keep a failure from reading as a win ---------- */
.cs-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid;
  border-radius: 3px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.04em;
}
.cs-label--small { padding: 3px 6px; font-size: 10px; letter-spacing: 0; }
.cs-label--library { border-color: #4ad688; color: #4ad688; }
.cs-label--regressed { background: #e8654d; border-color: #e8654d; color: #0c100d; }
.cs-label--caveated { border-color: #e8654d; color: #e8654d; }
.cs-label--fixture { border-color: #2a3c30; color: #8fa393; }

/* ---------- result cards ---------- */
.cs-results { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.cs-card {
  border: 1px solid #1d2921;
  border-radius: 6px;
  background: #0a0e0b;
  padding: 22px 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.cs-card--regression { border-color: #e8654d; }
.cs-card-kicker { font-size: 11px; color: #728476; letter-spacing: 0.04em; }
.cs-card--regression .cs-card-kicker { color: #e8654d; font-weight: 700; }
.cs-figure {
  font-size: clamp(34px, 5vw, 52px);
  line-height: 1.05;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.cs-figure--library { color: #4ad688; }
.cs-figure--regressed, .cs-figure--caveated { color: #eef4ee; }
.cs-figure--fixture { color: #8fa393; }
.cs-figure--slower { color: #e8654d; }
.cs-card-scope { font-size: 13px; color: #8fa393; text-wrap: pretty; }
.cs-card--regression .cs-card-scope { color: #eef4ee; }
.cs-cursor {
  display: inline-block;
  width: 0.08em;
  height: 0.8em;
  background: #4ad688;
  margin-left: 0.12em;
  vertical-align: -0.05em;
  animation: csBlink 1s steps(1) infinite;
}

/* ---------- before and after ---------- */
.cs-beforeafter { display: flex; flex-direction: column; gap: 18px; }
.cs-beforeafter h2 { margin: 0; font-size: 14px; font-weight: 700; }
.cs-sectionhead { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.cs-sectionnote { font-size: 12px; color: #728476; }
.cs-chartgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: 12px;
  align-items: stretch;
}
.cs-viz {
  border: 1px solid #1d2921;
  border-radius: 6px;
  background: #0a0e0b;
  height: 280px;
  overflow: hidden;
  min-width: 0;
}
.cs-viz stats-viz { display: block; height: 280px; }
.cs-groups { display: flex; flex-direction: column; gap: 12px; justify-content: center; min-width: 0; }
.cs-group {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  border: 1px solid #1d2921;
  border-radius: 6px;
  padding: 16px 18px;
  background: #0a0e0b;
}
.cs-group-head { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: #8fa393; }
.cs-group-pct { color: #eef4ee; font-weight: 700; }
.cs-barrow {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  font-size: 12px;
}
.cs-barname { color: #728476; }
.cs-barval { color: #8fa393; white-space: nowrap; }
.cs-barval--after { color: #eef4ee; font-weight: 700; }
.cs-bartrack { height: 14px; width: 100%; }
.cs-bar { height: 14px; border-radius: 2px; transform-origin: left; }
.cs-bar--before { background: #2a3c30; width: 100%; animation: csBarGrow 1s cubic-bezier(.2, .7, .2, 1) .5s both; }
.cs-bar--after { animation: csBarGrow 1.4s cubic-bezier(.2, .7, .2, 1) .8s both; }
.cs-bar--green { background: #4ad688; }
.cs-bar--muted { background: #8fa393; }

/* ---------- experiments ---------- */
.cs-experiments { display: flex; flex-direction: column; gap: 12px; }
.cs-experiments h2 { margin: 0; font-size: 14px; font-weight: 700; }
.cs-expgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 10px; }
.cs-exp {
  border: 1px solid #1d2921;
  border-radius: 6px;
  padding: 14px 16px;
  background: #0a0e0b;
  transition: border-color .2s, transform .2s;
}
.cs-exp:hover { transform: translateY(-2px); }
.cs-exp--kept:hover { border-color: #4ad688; }
.cs-exp--discarded:hover { border-color: #e8654d; }
.cs-exp--failed:hover { border-color: #8fa393; }
.cs-exp-count { font-size: 26px; font-weight: 700; line-height: 1.1; }
.cs-exp--kept .cs-exp-count { color: #4ad688; }
.cs-exp--discarded .cs-exp-count { color: #e8654d; }
.cs-exp--failed .cs-exp-count { color: #8fa393; }
.cs-exp-name { font-size: 12px; color: #8fa393; }
.cs-note { margin: 0; font-size: 13px; color: #cfdcd1; max-width: 70ch; text-wrap: pretty; }
.cs-note b { color: #e8654d; font-weight: 700; }

/* ---------- measured ---------- */
.cs-dl {
  margin: 0;
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 6px 20px;
  font-size: 13px;
}
.cs-dl dt { color: #728476; }
.cs-dl dd { margin: 0; color: #cfdcd1; }
.cs-dl code { font-family: inherit; }

/* ---------- limits and links ---------- */
.cs-limits {
  border: 1px solid #e8654d;
  border-radius: 6px;
  padding: 18px 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  background: #0a0e0b;
}
.cs-limits h2 { margin: 0; font-size: 12px; font-weight: 700; color: #e8654d; letter-spacing: 0.04em; }
.cs-limits p { margin: 0; font-size: 14px; color: #eef4ee; max-width: 70ch; text-wrap: pretty; }
.cs-links { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.cs-btn {
  font-size: 14px;
  border-radius: 4px;
  transition: transform .2s, box-shadow .2s, background .2s, border-color .2s;
}
.cs-btn:hover { transform: translateY(-2px); }
.cs-btn--primary { background: #4ad688; color: #0c100d; font-weight: 700; padding: 12px 20px; }
.cs-btn--primary:hover { background: #7ce8ab; color: #0c100d; box-shadow: 0 0 28px rgba(74, 214, 136, 0.35); }
.cs-btn--ghost { border: 1px solid #2a3c30; color: #cfdcd1; padding: 11px 18px; }
.cs-btn--ghost:hover { border-color: #4ad688; color: #eef4ee; }
.cs-link-quiet { font-size: 13px; color: #8fa393; overflow-wrap: anywhere; }
.cs-link-quiet:hover { color: #eef4ee; }

/* ---------- index ---------- */
.cs-key {
  display: flex;
  gap: 10px 18px;
  flex-wrap: wrap;
  font-size: 12px;
  color: #8fa393;
  align-items: center;
}
.cs-key-item { display: inline-flex; align-items: center; gap: 8px; }
.cs-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid #1d2921;
  display: flex;
  flex-direction: column;
}
.cs-list > li { border-bottom: 1px solid #1d2921; }
.cs-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 20px;
  padding: 18px 14px;
  margin: 0 -14px;
  border-radius: 6px;
  color: #eef4ee;
  align-items: center;
  transition: background .2s, transform .2s;
}
.cs-row:hover { color: #eef4ee; background: #0f1410; transform: translateX(4px); }
.cs-row-left { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cs-row-name { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cs-row-target { font-weight: 700; overflow-wrap: anywhere; }
.cs-row-sub { font-size: 12px; color: #8fa393; }
.cs-row-right { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; }
.cs-row-figure { font-size: 22px; font-weight: 700; }
.cs-row-figure--library { color: #4ad688; }
.cs-row-figure--regressed, .cs-row-figure--caveated { color: #eef4ee; }
.cs-row-figure--fixture { color: #8fa393; }
.cs-row-slower { font-size: 22px; font-weight: 700; color: #e8654d; }
.cs-row-condition { font-size: 13px; font-weight: 700; color: #e8654d; }
.cs-row .cs-badge { min-width: 30px; box-sizing: border-box; text-align: center; }

@media (max-width: 640px) {
  .cs-row { grid-template-columns: minmax(0, 1fr); margin: 0; padding: 18px 0; }
  .cs-row:hover { transform: none; }
  .cs-row-right { align-items: flex-start; text-align: left; }
}

/* ---------- motion: an enhancement, and all of it off for reduced motion ---------- */
@keyframes csFadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes csBarGrow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes csGlowRed { 0% { box-shadow: 0 0 0 0 rgba(232, 101, 77, 0.55); } 100% { box-shadow: 0 0 0 14px rgba(232, 101, 77, 0); } }
@keyframes csGlowGreen { 0% { box-shadow: 0 0 0 0 rgba(74, 214, 136, 0.45); } 100% { box-shadow: 0 0 0 14px rgba(74, 214, 136, 0); } }
@keyframes csBlink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }

.cs-fade { animation: csFadeUp .7s cubic-bezier(.2, .7, .2, 1) both; }
.cs-d120 { animation-delay: 120ms; }
.cs-d220 { animation-delay: 220ms; }
.cs-d240 { animation-delay: 240ms; }
.cs-d300 { animation-delay: 300ms; }
.cs-d360 { animation-delay: 360ms; }
.cs-d380 { animation-delay: 380ms; }
.cs-d440 { animation-delay: 440ms; }
.cs-d460 { animation-delay: 460ms; }
.cs-d520 { animation-delay: 520ms; }
.cs-d540 { animation-delay: 540ms; }
.cs-d600 { animation-delay: 600ms; }
.cs-d620 { animation-delay: 620ms; }
.cs-d680 { animation-delay: 680ms; }
.cs-label--library:not(.cs-label--small) { animation: csGlowGreen 1.4s ease-out .5s 2; }
.cs-label--regressed:not(.cs-label--small) { animation: csGlowRed 1.4s ease-out .5s 3; }
.cs-card--regression { animation: csGlowRed 1.6s ease-out 1s 2; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- bar widths: the security policy forbids style attributes, so each
   width is a class. Generated by scripts/build-case-pages.mjs from cases.js. ---------- */
/* bars:start */
.cs-w-4856 { width: 48.56%; }
.cs-w-3019 { width: 30.19%; }
.cs-w-7490 { width: 74.9%; }
.cs-w-4290 { width: 42.9%; }
.cs-w-910 { width: 9.1%; }
.cs-w-747 { width: 7.47%; }
.cs-w-4600 { width: 46%; }
/* bars:end */
