/* DiffCI site — one stylesheet, no external requests, no build step.
   Dark is the default. A viewer can switch to light with the masthead toggle; the choice is
   stored in localStorage and applied by a small inline script before first paint. */

:root {
  color-scheme: dark;

  /* surfaces + ink */
  --paper: #0c0e11;
  --surface: #14171b;
  --surface-2: #1a1e24;
  --surface-sunken: #08090b;
  --ink: #eeece6;
  --ink-2: #aaa69d;
  --ink-3: #78746c;
  --rule: #23272d;
  --rule-2: #363b43;

  /* brand */
  --accent: #4fd1a8;
  --accent-ink: #8ee7cc;
  --accent-bright: #7fe9c9;
  --accent-deep: #1f9c78;
  --accent-wash: #11302a;
  --accent-glow: rgb(79 209 168 / 0.22);
  --on-accent: #06110d;
  --accent-gradient: linear-gradient(135deg, var(--accent-bright), var(--accent-deep));

  /* a second, cooler hue for depth only — never carries data */
  --depth: #4f8fd1;

  /* data-viz slots — validated (dataviz skill, categorical slots 3 + 2) */
  --series-tests: #2fc98f;
  --series-setup: #f2743f;
  --series-neutral: #545a63; /* "no decision possible" segments; identity also carried by the legend */

  /* notice */
  --warn-wash: #241e0f;
  --warn-rule: #5b4b1f;
  --warn-ink: #e6d18f;

  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --measure: 40rem;
  --gutter: clamp(1.25rem, 5vw, 2rem);

  /* depth + motion */
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.35);
  --shadow-md: 0 1px 2px rgb(0 0 0 / 0.4), 0 10px 30px -12px rgb(0 0 0 / 0.6);
  --shadow-lg: 0 2px 6px rgb(0 0 0 / 0.45), 0 24px 56px -20px rgb(0 0 0 / 0.75);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

:root[data-theme="light"] {
  color-scheme: light;
  --paper: #faf8f4;
  --surface: #ffffff;
  --surface-2: #ffffff;
  --surface-sunken: #f1eee7;
  --ink: #171614;
  --ink-2: #56534c;
  --ink-3: #8a857b;
  --rule: #e6e1d7;
  --rule-2: #cec8ba;
  --accent: #146b5a;
  --accent-ink: #0f5648;
  --accent-bright: #17886f;
  --accent-deep: #0f5648;
  --accent-wash: #e8f2ee;
  --accent-glow: rgb(20 107 90 / 0.18);
  --on-accent: #ffffff;
  --depth: #3b6fb0;
  --series-tests: #1baf7a;
  --series-setup: #eb6834;
  --series-neutral: #b7b1a4;
  --warn-wash: #fdf4e0;
  --warn-rule: #e3ce97;
  --warn-ink: #6d5411;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.05);
  --shadow-md: 0 1px 2px rgb(0 0 0 / 0.06), 0 8px 24px -12px rgb(0 0 0 / 0.18);
  --shadow-lg: 0 2px 6px rgb(0 0 0 / 0.07), 0 20px 48px -20px rgb(0 0 0 / 0.3);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
  background: var(--paper);
}

body {
  margin: 0;
  background: var(--paper);
  background-image:
    radial-gradient(1100px 520px at 50% -10%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 62%),
    radial-gradient(900px 600px at 100% 12%, color-mix(in srgb, var(--depth) 6%, transparent), transparent 60%);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); color: var(--ink); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.wrap {
  width: 100%;
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.wrap-wide { max-width: 52rem; }

/* ---------------- masthead ---------------- */

.masthead {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--paper) 78%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--rule);
}

.masthead::after {
  /* a hairline of accent that fades out to the sides — the one flourish on the chrome */
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent 10%, color-mix(in srgb, var(--accent) 55%, transparent) 50%, transparent 90%);
  pointer-events: none;
}

.masthead .wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 3.6rem;
  max-width: 52rem;
}

.wordmark {
  font-weight: 700;
  font-size: 1.04rem;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.wordmark::before {
  content: url("/assets/diffci-mark.svg");
  display: block;
  width: 1.25rem;
  height: 1.25rem;
  filter: drop-shadow(0 0 6px var(--accent-glow));
  transition: transform 0.3s var(--ease);
}

:root[data-theme="light"] .wordmark::before { content: url("/assets/diffci-mark-light.svg"); }

.wordmark:hover::before { transform: scale(1.06); }

.masthead nav {
  display: flex;
  gap: 1.5rem;
  margin-left: auto;
  font-size: 0.88rem;
}

.masthead nav a {
  color: var(--ink-2);
  text-decoration: none;
  padding-block: 0.25rem;
  position: relative;
  transition: color 0.15s ease;
}

.masthead nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--accent-gradient);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.22s var(--ease);
}

.masthead nav a:hover { color: var(--ink); }
.masthead nav a:hover::after { transform: scaleX(1); }

.theme-toggle {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  padding: 0;
  border: 1px solid var(--rule-2);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  color: var(--ink-2);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease, transform 0.2s var(--ease);
}

.theme-toggle:hover { color: var(--ink); border-color: var(--accent); background: var(--surface-2); }
.theme-toggle:active { transform: scale(0.94); }
.theme-toggle svg { width: 1rem; height: 1rem; display: block; }
.theme-toggle .icon-sun { display: block; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: block; }

@media (max-width: 34rem) {
  .masthead nav { display: none; }
  .theme-toggle { margin-left: auto; }
}

/* ---------------- type ---------------- */

h1 {
  font-size: clamp(2.2rem, 6.4vw, 3.3rem);
  line-height: 1.05;
  letter-spacing: -0.034em;
  font-weight: 680;
  margin: 0 0 1.1rem;
  text-wrap: balance;
}

h2 {
  font-size: clamp(1.32rem, 3vw, 1.55rem);
  line-height: 1.22;
  letter-spacing: -0.022em;
  font-weight: 650;
  margin: 0 0 1rem;
  text-wrap: balance;
}

h3 {
  font-size: 1.06rem;
  letter-spacing: -0.012em;
  font-weight: 660;
  margin: 0 0 0.55rem;
}

p { margin: 0 0 1.05rem; }

.lede {
  font-size: clamp(1.1rem, 2.4vw, 1.24rem);
  line-height: 1.5;
  color: var(--ink-2);
  margin-bottom: 1.35rem;
  text-wrap: pretty;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.85rem;
}

a { color: var(--accent-ink); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

strong { font-weight: 640; color: var(--ink); }

code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--surface-sunken);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 0.08em 0.34em;
  white-space: nowrap;
  color: var(--accent-ink);
}

ul, ol { margin: 0 0 1.05rem; padding-left: 1.15rem; }
li { margin-bottom: 0.5rem; padding-left: 0.15rem; }
li::marker { color: var(--accent); }

/* ---------------- section rhythm ---------------- */

main { padding-bottom: 5rem; counter-reset: sect; }

section { padding-block: clamp(2.75rem, 7vw, 4.25rem); }

section + section { border-top: 1px solid var(--rule); }

.numbered > .wrap > h2::before,
.numbered > h2::before {
  counter-increment: sect;
  content: counter(sect, decimal-leading-zero);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  color: var(--accent);
  display: block;
  width: max-content;
  margin-bottom: 0.8rem;
  font-weight: 500;
  /* short accent rule trailing the number */
  padding-right: 2.7rem;
  background: linear-gradient(90deg, currentColor, transparent) no-repeat right center / 2.2rem 1px;
}

/* ---------------- hero ---------------- */

.hero {
  padding-top: clamp(3.25rem, 9vw, 6rem);
  padding-bottom: clamp(2.5rem, 6vw, 3.75rem);
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.hero::before {
  /* dot grid, masked so it fades toward the edges */
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(var(--rule-2) 1px, transparent 1.2px);
  background-size: 22px 22px;
  background-position: -1px -1px;
  -webkit-mask-image: radial-gradient(70% 80% at 30% 20%, #000 20%, transparent 100%);
  mask-image: radial-gradient(70% 80% at 30% 20%, #000 20%, transparent 100%);
  opacity: 0.7;
  z-index: -1;
}

.hero::after {
  /* aurora: accent glow top-left, cooler glow bottom-right, both fading into the page */
  content: "";
  position: absolute;
  inset: -20% -10% 0;
  background:
    radial-gradient(560px 380px at 18% 18%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
    radial-gradient(640px 420px at 88% 70%, color-mix(in srgb, var(--depth) 14%, transparent), transparent 70%),
    linear-gradient(180deg, transparent 55%, var(--paper) 100%);
  pointer-events: none;
  z-index: -1;
}

.hero .wrap { position: relative; }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(16rem, 0.65fr);
  gap: clamp(2rem, 6vw, 5rem);
  align-items: center;
}

.hero h1 {
  background: linear-gradient(180deg, var(--ink) 0%, color-mix(in srgb, var(--ink) 72%, var(--ink-2)) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  /* background-clip: text paints nothing outside the line box, so give descenders room */
  padding-bottom: 0.12em;
  margin-bottom: calc(1.1rem - 0.12em);
}

.hero-claim {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-ink);
  background: color-mix(in srgb, var(--accent-wash) 80%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 38%, transparent);
  border-radius: 100px;
  padding: 0.34rem 0.85rem 0.34rem 0.7rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 0 24px -6px var(--accent-glow);
}

.hero-claim::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2.4s ease-out infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); }
  70% { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.9rem 1.4rem;
  margin: 1.7rem 0 0;
}

.button-secondary {
  color: var(--accent-ink);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid var(--rule-2);
  padding-block: 0.2rem;
  transition: border-color 0.15s ease;
}

.button-secondary:hover { border-bottom-color: var(--accent-ink); }

.hero-note {
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--ink-2);
  border-left: 2px solid var(--accent);
  padding-left: 1rem;
  margin: 1.9rem 0 0;
  max-width: 34rem;
}

.hero-route {
  margin: 0;
  padding: 1.15rem;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--rule));
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(8px);
}

.hero-route figcaption { display: grid; gap: 0.1rem; margin-bottom: 0.35rem; }
.hero-route figcaption span { font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }
.hero-route figcaption b { font-size: 1rem; letter-spacing: -0.02em; color: var(--ink); }
.hero-route svg { display: block; width: 100%; height: auto; }
.route-links { fill: none; stroke: var(--rule-2); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.route-jobs rect { fill: color-mix(in srgb, var(--ink-3) 42%, var(--surface)); }
.route-trace { fill: none; stroke: var(--accent); stroke-width: 12; stroke-linecap: round; stroke-linejoin: round; }
.route-selected rect { fill: var(--accent); }
.route-proof { fill: var(--surface); stroke: var(--accent); stroke-width: 9; }
.route-core { fill: var(--accent); }
.hero-route > p { display: flex; align-items: center; gap: 0.45rem; margin: 0.2rem 0 0; color: var(--ink-2); font-size: 0.75rem; line-height: 1.35; }
.hero-route > p i { width: 0.55rem; height: 0.55rem; border-radius: 2px; background: var(--accent); display: inline-block; flex: 0 0 auto; }
.hero-route > p span { color: var(--accent); }

@media (max-width: 44rem) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-route { max-width: 30rem; }
}

/* ---------------- stat band ---------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: 12px;
  overflow: hidden;
  margin: 2.4rem 0 0;
  box-shadow: var(--shadow-md);
}

.stat {
  position: relative;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  padding: 1.2rem 1.2rem 1.15rem;
  transition: background-color 0.2s ease;
}

.stat::before {
  content: "";
  position: absolute;
  left: 1.2rem;
  right: 1.2rem;
  top: 0;
  height: 2px;
  border-radius: 0 0 2px 2px;
  background: var(--accent-gradient);
  opacity: 0.85;
}

.stat:hover { background: var(--surface-2); }

.stat b {
  display: block;
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  margin-bottom: 0.35rem;
  color: var(--accent-ink);
}

.stat span {
  display: block;
  font-size: 0.82rem;
  color: var(--ink-2);
  line-height: 1.35;
}

/* ---------------- steps ---------------- */

.steps { counter-reset: step; list-style: none; padding: 0; margin: 1.75rem 0 0; }

.steps li {
  counter-increment: step;
  position: relative;
  padding-left: 2.7rem;
  padding-bottom: 1.5rem;
  margin: 0;
}

.steps li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 0.85rem;
  top: 2rem;
  bottom: 0.25rem;
  width: 1px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 50%, transparent), var(--rule));
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 1.7rem;
  height: 1.7rem;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--on-accent);
  background: var(--accent-gradient);
  border-radius: 50%;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent), 0 4px 12px -4px var(--accent-glow);
}

.steps b {
  display: block;
  font-weight: 660;
  margin-bottom: 0.2rem;
  letter-spacing: -0.01em;
}

.steps p { margin: 0; color: var(--ink-2); font-size: 0.96rem; }

/* ---------------- install ---------------- */

.install-grid {
  display: grid;
  gap: 1.1rem;
  margin-top: 1.75rem;
}

@media (min-width: 48rem) {
  .install-grid { grid-template-columns: 1fr 1fr; }
  .install-panel-wide { grid-column: 1 / -1; }
}

.install-panel {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 1.35rem 1.45rem;
  box-shadow: var(--shadow-sm);
}

.install-panel .kicker {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.install-panel p {
  color: var(--ink-2);
  font-size: 0.96rem;
}

.install-panel pre {
  margin: 1rem 0;
  font-size: 0.78rem;
}

.install-panel pre code {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  white-space: pre;
}

.install-panel .fine {
  color: var(--ink-3);
  font-size: 0.84rem;
  line-height: 1.5;
  margin-bottom: 0;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.9rem 1.4rem;
  margin-top: 1.1rem;
}

/* ---------------- report card ---------------- */

.report {
  position: relative;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--rule-2);
  border-radius: 14px;
  overflow: hidden;
  margin: 1.75rem 0 1.25rem;
  box-shadow: var(--shadow-lg), 0 0 0 1px color-mix(in srgb, var(--accent) 10%, transparent);
}

.report::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.9;
}

.report-label {
  background: repeating-linear-gradient(-45deg, var(--warn-wash) 0 10px, color-mix(in srgb, var(--warn-wash) 80%, var(--warn-rule)) 10px 20px);
  border-bottom: 1px solid var(--warn-rule);
  color: var(--warn-ink);
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 0.55rem 1.15rem;
}

.report-body { padding: 1.15rem 1.15rem 1.05rem; }

.report-head {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-3);
  border-bottom: 1px dashed var(--rule-2);
  padding-bottom: 0.7rem;
  margin-bottom: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.report-head::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

.report-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.75rem;
  align-items: baseline;
  padding: 0.42rem 0;
  font-size: 0.92rem;
  border-bottom: 1px solid color-mix(in srgb, var(--rule) 60%, transparent);
}

.report-row:last-child { border-bottom: 0; }

.report-row .val {
  font-family: var(--mono);
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.tag {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.07em;
  border: 1px solid var(--rule-2);
  border-radius: 4px;
  padding: 0.12em 0.45em;
  color: var(--ink-2);
  white-space: nowrap;
  background: color-mix(in srgb, var(--surface-sunken) 50%, transparent);
}

.tag-measured {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  color: var(--accent-ink);
  background: color-mix(in srgb, var(--accent-wash) 70%, transparent);
}
.tag-estimated { border-color: var(--warn-rule); color: var(--warn-ink); background: color-mix(in srgb, var(--warn-wash) 70%, transparent); }

/* ---------------- chart ---------------- */

figure { margin: 1.75rem 0 1.25rem; }

figcaption { font-size: 0.85rem; color: var(--ink-3); margin-top: 0.9rem; line-height: 1.5; }

.chart {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 1.25rem 1.2rem 1rem;
  box-shadow: var(--shadow-sm);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.82rem;
  color: var(--ink-2);
  margin-bottom: 1.35rem;
}

.legend span { display: inline-flex; align-items: center; gap: 0.42rem; }

.swatch {
  width: 0.72rem;
  height: 0.72rem;
  border-radius: 3px;
  display: inline-block;
}

.swatch-setup { background: var(--series-setup); }
.swatch-tests { background: var(--series-tests); }
.swatch-neutral { background: var(--series-neutral); }

.bar-group + .bar-group { margin-top: 1.5rem; }

.bar-group > h3 {
  font-size: 0.86rem;
  font-family: var(--mono);
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ink-2);
  margin-bottom: 0.7rem;
}

.bar-row {
  display: grid;
  grid-template-columns: 4.4rem 1fr 6.8rem;
  gap: 0.7rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

.bar-row .rowlabel {
  font-size: 0.79rem;
  color: var(--ink-2);
  text-align: right;
}

.bar-track { display: flex; gap: 2px; align-items: center; min-width: 0; }

.seg {
  /* flex-shrink MUST stay 0: shrinking resolves each row against a different
     base, which silently destroys the shared horizontal scale between the two
     repositories - the entire point of the chart. */
  flex: 0 0 auto;
  height: 1.4rem;
  border-radius: 2px;
  min-width: 2px;
  transition: filter 0.15s ease;
}

.bar-track:hover .seg { filter: brightness(1.12); }

.bar-track .seg:last-of-type {
  border-top-right-radius: 4px;
  border-bottom-right-radius: 4px;
}

.bar-track .seg:first-of-type {
  border-top-left-radius: 4px;
  border-bottom-left-radius: 4px;
}

.seg-setup { background: var(--series-setup); }
.seg-tests { background: var(--series-tests); }

.bar-value {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.bar-value em { font-style: normal; color: var(--accent-ink); font-weight: 600; }

/* ---------------- cards ---------------- */

.cards { display: grid; gap: 1.1rem; margin-top: 1.75rem; }

@media (min-width: 46rem) {
  .cards { grid-template-columns: 1fr 1fr; }
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 1.5rem 1.55rem;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease, transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.card::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 70%, transparent), transparent 45%, transparent 55%, color-mix(in srgb, var(--depth) 45%, transparent));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.25s var(--ease);
  pointer-events: none;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg), 0 0 40px -16px var(--accent-glow);
}

.card:hover::before { opacity: 1; }

.card > h3 { letter-spacing: -0.015em; }

.card .kicker {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.figures {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr));
  gap: 0.9rem 1.2rem;
  margin: 1.1rem 0;
  padding: 0.95rem 0;
  border-block: 1px solid var(--rule);
}

.figures div b {
  display: block;
  font-family: var(--sans);
  font-size: 1.18rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--accent-ink);
}

.figures div span {
  display: block;
  font-size: 0.78rem;
  color: var(--ink-3);
  line-height: 1.3;
}

.card p { color: var(--ink-2); font-size: 0.96rem; }

.card .more { margin-bottom: 0; font-size: 0.92rem; margin-top: auto; padding-top: 0.25rem; }
.card .more a { font-weight: 600; text-decoration: none; }
.card .more a:hover { text-decoration: underline; }

/* ---------------- limits list ---------------- */

.limits { list-style: none; padding: 0; margin: 1.5rem 0 0; }

.limits li {
  padding: 1rem 0 1rem 1.6rem;
  border-top: 1px solid var(--rule);
  position: relative;
  margin: 0;
  color: var(--ink-2);
  font-size: 0.97rem;
}

.limits li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--accent);
}

.limits li:last-child { border-bottom: 1px solid var(--rule); }

.limits strong { color: var(--ink); }

/* ---------------- tables ---------------- */

.table-scroll {
  overflow-x: auto;
  margin: 1.4rem 0;
  border: 1px solid var(--rule);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  background: var(--surface);
}

table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }

th, td {
  text-align: left;
  padding: 0.72rem 1rem;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
  transition: background-color 0.15s ease;
}

tbody tr:hover td { background: color-mix(in srgb, var(--accent-wash) 55%, transparent); }

thead th, tr:first-child th {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
  white-space: nowrap;
  background: var(--surface-sunken);
}

tr:last-child td, tr:last-child th { border-bottom: 0; }

td.num, th.num {
  text-align: right;
  font-family: var(--mono);
  font-size: 0.86rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* key/value tables inside cards */
.kv th, .kv tr:first-child th {
  background: var(--surface-sunken);
  color: var(--ink-2);
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.86rem;
  white-space: normal;
  min-width: 8rem;
}
.kv td:first-child { color: var(--ink-2); }

/* ---------------- notes ---------------- */

.callout {
  border-left: 3px solid var(--accent);
  background: color-mix(in srgb, var(--accent-wash) 70%, transparent);
  border-radius: 0 10px 10px 0;
  padding: 0.95rem 1.15rem;
  margin: 1.5rem 0;
  color: var(--ink-2);
  font-size: 0.95rem;
}

.callout p:last-child { margin-bottom: 0; }

.todo {
  background: var(--warn-wash);
  border: 1px dashed var(--warn-rule);
  color: var(--warn-ink);
  border-radius: 10px;
  padding: 1rem 1.15rem;
  margin: 1.5rem 0;
  font-size: 0.9rem;
}

.todo b {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 0.35rem;
}

.disclaimer {
  border: 1px solid var(--rule);
  background: var(--surface);
  border-radius: 12px;
  padding: 1.05rem 1.2rem;
  font-size: 0.92rem;
  color: var(--ink-2);
  margin: 0 0 2rem;
}

.disclaimer strong { color: var(--ink); }

/* ---------------- cta ---------------- */

.cta { margin-top: 2rem; }

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  background: var(--accent-gradient);
  color: var(--on-accent);
  border-radius: 10px;
  padding: 0.85rem 1.5rem;
  font-weight: 660;
  font-size: 0.97rem;
  text-decoration: none;
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--accent-bright) 55%, transparent) inset,
    0 10px 28px -10px var(--accent-glow),
    var(--shadow-md);
  transition: filter 0.18s ease, transform 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

.button:hover {
  filter: brightness(1.07);
  transform: translateY(-2px);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--accent-bright) 65%, transparent) inset,
    0 16px 36px -12px var(--accent-glow),
    var(--shadow-lg);
}

.button:active { transform: translateY(0); }

/* Post-install report lookup (site/welcome.html) - a single labeled input matching the .button style,
   no separate form framework, consistent with the rest of the site's "one stylesheet, no build step". */
.report-lookup {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1.1rem 0 0.5rem;
}
.report-lookup input {
  flex: 1 1 16rem;
  min-width: 0;
  font: inherit;
  font-family: var(--mono);
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--surface-sunken);
  border: 1px solid var(--rule-2);
  border-radius: 10px;
  padding: 0.82rem 1rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.report-lookup input::placeholder { color: var(--ink-3); }
.report-lookup input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
.report-lookup .button {
  border: none;
  cursor: pointer;
  font: inherit;
  font-weight: 660;
  font-size: 0.97rem;
}

.cta-note {
  font-size: 0.85rem;
  color: var(--ink-3);
  margin: 0.85rem 0 0;
  max-width: 30rem;
  line-height: 1.5;
}

/* ---------------- article pages ---------------- */

article { padding-block: clamp(2.5rem, 7vw, 3.75rem); }

article h2 {
  margin-top: 2.75rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--rule);
}

article h2.no-rule { border-top: 0; padding-top: 0; margin-top: 1.75rem; }

.backlink {
  font-size: 0.86rem;
  color: var(--ink-2);
  text-decoration: none;
  display: inline-block;
  margin-bottom: 1.75rem;
  transition: color 0.15s ease;
}

.backlink:hover { color: var(--accent-ink); }

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 1rem;
  color: var(--ink-3);
  font-size: 0.82rem;
}

.breadcrumbs a { color: var(--ink-2); text-decoration: none; }
.breadcrumbs a:hover { color: var(--accent-ink); text-decoration: underline; }

.article-meta {
  margin: 0.75rem 0 1.5rem;
  color: var(--ink-3);
  font-size: 0.86rem;
}

.related-guides {
  margin-top: 2.75rem;
  padding: 1.2rem 1.35rem;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--surface);
}

.related-guides h2 { border: 0; margin: 0 0 0.65rem; padding: 0; font-size: 1.05rem; }
.related-guides ul { margin-bottom: 0; }

pre {
  font-family: var(--mono);
  font-size: 0.83rem;
  line-height: 1.7;
  color: var(--ink);
  background: var(--surface-sunken);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 0.95rem 1.05rem;
  overflow-x: auto;
  margin: 1.25rem 0;
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--ink) 4%, transparent);
}

/* ---------------- footer ---------------- */

footer {
  border-top: 1px solid var(--rule);
  background: linear-gradient(180deg, var(--surface), var(--paper));
  padding-block: 2.75rem 3.75rem;
  font-size: 0.88rem;
  color: var(--ink-2);
}

footer .wrap { max-width: 52rem; }

footer nav { display: flex; flex-wrap: wrap; gap: 0.9rem 1.4rem; margin: 0.9rem 0; }

footer a { color: var(--ink-2); text-decoration: none; transition: color 0.15s ease; }
footer a:hover { color: var(--accent-ink); text-decoration: underline; }

footer .fine { color: var(--ink-3); font-size: 0.82rem; margin-bottom: 0; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  .card:hover, .button:hover { transform: none; }
  .wordmark:hover::before { transform: none; }
}

/* Scrollbar — keeps the page chrome consistent with the palette */
html { scrollbar-color: var(--rule-2) var(--paper); scrollbar-width: thin; }

::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: var(--paper); }
::-webkit-scrollbar-thumb {
  background: var(--rule-2);
  border-radius: 8px;
  border: 3px solid var(--paper);
}
::-webkit-scrollbar-thumb:hover { background: var(--ink-3); }

/* Gentle entrance for the hero — disabled for reduced-motion users */
@media (prefers-reduced-motion: no-preference) {
  .hero .wrap { animation: rise 0.7s var(--ease) both; }
  @keyframes rise {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
  }
}

/* Narrow screens: the three-column bar row leaves the track too short to read.
   Stack it - label and value on one line, the bar full width beneath. */
@media (max-width: 34rem) {
  .bar-row {
    grid-template-columns: 1fr auto;
    grid-template-areas: "label value" "track track";
    row-gap: 0.3rem;
    margin-bottom: 0.9rem;
  }
  .bar-row .rowlabel { grid-area: label; text-align: left; }
  .bar-value { grid-area: value; }
  .bar-track { grid-area: track; }
}

/* ---------------- open study ---------------- */

.toc {
  list-style: none;
  padding: 0.9rem 1.1rem;
  margin: 1.25rem 0 0;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--surface);
  font-size: 0.9rem;
  columns: 2;
  column-gap: 1.5rem;
}

.toc li { break-inside: avoid; margin: 0.2rem 0; }
.toc a { text-decoration: none; color: var(--accent-ink); }
.toc a:hover { text-decoration: underline; }

pre.cite {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.82rem;
}

figure .diverging, figure .study-chart { width: 100%; height: auto; display: block; }

@media (max-width: 40rem) {
  .toc { columns: 1; }
}
