/* ═══════════════════════════════════════════════════════════════════
   ODESYS design system — "Soft Slate"
   Phase 1 facelift: replaces app/css entirely. Zero JS changes — every
   selector below matches the DOM the legacy jQuery modules render and
   inject (see laravel/README.md). Token-based; light + dark themes.
   ═══════════════════════════════════════════════════════════════════ */

/* ————— typefaces (self-hosted variable fonts, OFL) ————— */
@font-face {
  font-family: 'Bricolage Grotesque';
  src: url('/theme/fonts/bricolage-grotesque-latin.woff2') format('woff2');
  font-weight: 200 800;
  font-display: swap;
}
@font-face {
  font-family: 'Instrument Sans';
  src: url('/theme/fonts/instrument-sans-latin.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
}

/* ————— tokens ————— */
:root {
  /* the canopy follows the theme: quiet light surface by day, the
     historic #000814-family navy by night */
  --canopy: #ffffff;
  --canopy-ink: #232936;
  --canopy-muted: #66707f;
  --canopy-line: #e3e8ef;

  --bg: #eef1f6;
  --card: #ffffff;
  --card-2: #f6f8fb;            /* inset wells on cards */
  --ink: #232936;
  --muted: #66707f;
  --line: #e3e8ef;

  /* calm violet drawn from the pool's lavender #bea1fd — action only */
  --accent: #6e5bd8;
  --accent-hover: #5c4ac4;
  --accent-ink: #5748bb;        /* link/text shade that passes on light */
  --accent-soft: #efecfb;
  --lavender: #bea1fd;          /* the pool's raw color — data highlights */

  --ok: #1f9d61;
  --err: #c2493d;
  --err-soft: #fbeae8;

  --shadow: 0 1px 2px rgba(35, 41, 54, 0.05), 0 12px 32px -20px rgba(35, 41, 54, 0.35);
  --shadow-sm: 0 1px 2px rgba(35, 41, 54, 0.06);
  --r-card: 16px;
  --r-ctl: 12px;

  /* 6-dot drag grip, used as a mask so it inherits theme colors */
  --grip: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 16"><g fill="black"><circle cx="3" cy="3" r="1.4"/><circle cx="7" cy="3" r="1.4"/><circle cx="3" cy="8" r="1.4"/><circle cx="7" cy="8" r="1.4"/><circle cx="3" cy="13" r="1.4"/><circle cx="7" cy="13" r="1.4"/></g></svg>');
  --icon-copy: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="12" height="12" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>');
  --icon-check: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6 9 17l-5-5"/></svg>');
  --icon-scale: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m16 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z"/><path d="m2 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z"/><path d="M7 21h10"/><path d="M12 3v18"/><path d="M3 7h2c2 0 5-1 7-2 2 1 5 2 7 2h2"/></svg>');

  --font: 'Instrument Sans', "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-display: 'Bricolage Grotesque', 'Instrument Sans', system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    /* deliberate elevation ladder: bg -> card -> well, real contrast steps */
    --canopy: #050a12; --canopy-ink: #ffffff; --canopy-muted: #aeb8c8; --canopy-line: transparent;
    --bg: #11151c; --card: #1a202b; --card-2: #242c3a;
    --ink: #e8ecf2; --muted: #94a0b3; --line: #2b3447;
    --accent: #8b7bf0; --accent-hover: #9a8cf4; --accent-ink: #b4a6fa; --accent-soft: #2a2545;
    --err: #e2695e; --err-soft: #392320;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  }
}
:root[data-theme="dark"] {
  --canopy: #050a12; --canopy-ink: #ffffff; --canopy-muted: #aeb8c8; --canopy-line: transparent;
  --bg: #11151c; --card: #1a202b; --card-2: #242c3a;
  --ink: #e8ecf2; --muted: #94a0b3; --line: #2b3447;
  --accent: #8b7bf0; --accent-hover: #9a8cf4; --accent-ink: #b4a6fa; --accent-soft: #2a2545;
  --err: #e2695e; --err-soft: #392320;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
}
:root[data-theme="light"] {
  --canopy: #ffffff; --canopy-ink: #232936; --canopy-muted: #66707f; --canopy-line: #e3e8ef;
  --bg: #eef1f6; --card: #ffffff; --card-2: #f6f8fb;
  --ink: #232936; --muted: #66707f; --line: #e3e8ef;
  --accent: #6e5bd8; --accent-hover: #5c4ac4; --accent-ink: #5748bb; --accent-soft: #efecfb;
  --err: #c2493d; --err-soft: #fbeae8;
  --shadow: 0 1px 2px rgba(35, 41, 54, 0.05), 0 12px 32px -20px rgba(35, 41, 54, 0.35);
  --shadow-sm: 0 1px 2px rgba(35, 41, 54, 0.06);
}

/* ————— reset & base ————— */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 var(--font);
  overflow-x: clip; /* the inline header full-bleed breakout uses 100vw */
}
img { max-width: 100%; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.2; text-wrap: balance; margin: 0 0 0.5em; letter-spacing: 0; }
p { margin: 0 0 1em; text-wrap: pretty; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* clearfix relic — floats are gone, keep it inert */
.btcf::after { content: ""; display: block; clear: both; }

/* ————— motion vocabulary —————
   Entrances only, 180–350ms, ease-out, ≤8px travel. Everything below
   is disabled wholesale by the prefers-reduced-motion block above. */
@keyframes rise-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes pop-in {
  0% { opacity: 0; transform: scale(0.6); }
  70% { transform: scale(1.08); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes chip-pulse {
  0% { transform: scale(1); }
  45% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

/* composed arrival on every page (new DOM = animation runs once) */
#projectBg { animation: rise-in 0.3s ease-out both; }
#main > section.content,
section.create-cta,
.analysis .panel { animation: rise-in 0.35s 0.04s ease-out both; }

/* elements the legacy JS creates mid-session enter the same way */
#content form ol li { animation: rise-in 0.22s ease-out; }
div.error { animation: rise-in 0.22s ease-out; }
#evaluation ul { animation: fade-in 0.28s ease-out; }
#project ul li a, #project ul li span { animation: fade-in 0.2s ease-out; }

/* the theme toggle cross-fades the big surfaces */
body, .top-header, section.content, section.create-cta, .panel {
  transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

/* homepage: steps and decision cards reveal as they scroll into view
   (scrubbed, subtle; progressive — older engines just show them) */
@supports (animation-timeline: view()) {
  .steps-grid .step, ul.public_decisions li {
    animation: rise-in linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 35%;
  }
}

/* ————— page frame —————
   ONE container geometry everywhere: header nav, step tabs and main
   content all use min(100% - 32px, 1020px), so every section shares
   the same left edge at every viewport. */
#wrapper { min-height: calc(100vh - 140px); }
#main { width: min(100% - 32px, 1020px); margin: 0 auto; padding: 0 0 48px; }

/* ————— canopy header (identity anchor) ————— */
.top-header {
  background: var(--canopy);
  color: var(--canopy-ink);
  border: none;
  border-bottom: 1px solid var(--canopy-line);
  margin: 0;
  padding: 16px 0;
}
.top-header .top-nav-section {
  font-size: 14px; display: flex; align-items: baseline; gap: 10px;
  width: min(100% - 32px, 1020px); margin: 0 auto;
  padding-right: 96px; /* keep clear of the theme toggle */
}
.top-header a {
  font-family: var(--font-display);
  color: var(--canopy-ink); font-weight: 800; letter-spacing: 0.12em;
  text-transform: uppercase; font-size: 14px; text-decoration: none;
  /* keep a real TEXT baseline (inline-flex would take its baseline from
     the empty logo mark and wreck the row's baseline alignment) */
  position: relative; padding-left: 27px;
}
/* the wordmark carries the slope-chart mark, out of baseline flow */
.top-header a::before, .hero-eyebrow::before {
  content: "";
  position: absolute; left: 0; top: 50%;
  width: 17px; height: 17px;
  transform: translateY(-52%);
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="none"><path d="M3 16 L10 10 L17 4" stroke="%236e5bd8" stroke-width="2.6" stroke-linecap="round" stroke-linejoin="round"/><circle cx="3" cy="16" r="2.4" fill="%23bea1fd"/><circle cx="17" cy="4" r="2.4" fill="%23ff7463"/></svg>') no-repeat center / contain;
}
.hero-eyebrow { position: relative; padding-left: 27px; }
.top-header a:hover { color: var(--accent-ink); }
.top-header .header-sub { color: var(--canopy-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* the headers rendered inline inside #main (about/terms/public) break
   out of the column so every page shows the SAME full-width bar */
#main .top-header {
  width: 100vw;
  margin: 0 0 20px calc(50% - 50vw);
}

/* ————— step tabs (JS swaps a<->span, keeps ids) ————— */
/* lives inside #main, which already IS the column */
#projectBg { width: 100%; margin: 20px 0; padding: 0; }
#project ul { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; }
#project ul li { display: flex; }
#project ul li a,
#project ul li span {
  display: inline-flex; align-items: center;
  font-size: 13px; font-weight: 700; line-height: 1;
  padding: 10px 16px; border-radius: 999px;
  background: var(--card); color: var(--muted);
  border: 1px solid var(--line);
  text-decoration: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
#project ul li a { color: var(--ink); }
#project ul li a:hover { color: var(--accent-ink); border-color: var(--muted); text-decoration: none; }
#project ul li a:active { transform: translateY(1px); }
#project ul li span.selected { background: var(--accent); border-color: var(--accent); color: #fff; }
#project ul li span.restricted { background: transparent; border-style: dashed; }
#bar { display: none; }

/* ————— cards & shared content shells ————— */
/* ONE elevated surface per view: cards get a hairline + a single soft
   shadow; everything inside separates with hairlines and spacing, never
   another shadowed box. */
section.content {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
  padding: 28px 32px;
  margin: 0 0 20px;
}
/* analysis & public report bring their own surfaces — the wrapping
   section becomes invisible so cards don't nest in cards */
section.content:has(.analysis-content) {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}
section.content > h1, .analysis-content h1 { font-size: 24px; font-weight: 800; }
section.content h2 { font-size: 18px; font-weight: 700; margin-top: 1.4em; }
section.content p, section.content li { color: var(--muted); max-width: 70ch; }
section.content p b, section.content p em { color: var(--ink); }
info { display: block; }

/* two-column workflow shell: #content main card + #sidebar helper */
section.content.btcf { display: flex; flex-wrap: wrap; gap: 36px; }
section.content.btcf > h1 { flex: 1 1 100%; margin-bottom: 4px; }
section.content.btcf #content { flex: 1 1 420px; min-width: 0; }
section.content.btcf #sidebar { flex: 1 1 260px; max-width: 340px; border-left: 1px solid var(--line); padding-left: 28px; }
section.content.btcf #sidebar h2 { margin-top: 0; font-size: 15px; }
section.content.btcf #sidebar p, section.content.btcf #sidebar li { font-size: 13.5px; }
@media (max-width: 860px) {
  section.content.btcf #sidebar { max-width: none; border-left: none; padding-left: 0; border-top: 1px solid var(--line); padding-top: 20px; }
}

/* ————— controls ————— */
input[type="text"], textarea, select {
  font: 15px/1.4 var(--font);
  color: var(--ink);
  background: var(--card-2);
  border: 2px solid transparent;
  border-radius: var(--r-ctl);
  padding: 12px 16px;
  width: 100%;
  transition: border-color 0.15s, background 0.15s;
}
input[type="text"]:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent); background: var(--card);
}
input[type="text"]::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.8; }
input[type="text"].error { border-color: var(--err); }
label { font-weight: 700; font-size: 14px; }

input[type="submit"], input[type="button"], button {
  font: 700 15px/1 var(--font);
  border: none; cursor: pointer;
  border-radius: 999px;
  padding: 13px 24px;
  background: var(--accent); color: #fff;
  box-shadow: var(--shadow-sm);
  transition: background 0.15s, transform 0.1s;
}
input[type="submit"]:hover, button:hover { background: var(--accent-hover); }
input[type="submit"]:active, button:active { transform: translateY(1px); }
input[type="text"][disabled], textarea[disabled] { opacity: 0.55; cursor: wait; }
input[type="button"].close, button.close {
  background: var(--card-2); color: var(--muted); box-shadow: none;
}
input[type="button"].close:hover { background: var(--line); color: var(--ink); }
input[type="checkbox"] { accent-color: var(--accent); width: 18px; height: 18px; }

/* validation errors (JS injects <div class="error"><p>…</p></div>) */
div.error {
  background: var(--err-soft); color: var(--err);
  border-radius: var(--r-ctl);
  padding: 10px 14px; margin-top: 10px;
  font-size: 13.5px; font-weight: 600;
  width: 100%;
}
div.error p { margin: 0; color: inherit; max-width: none; }

/* ————— homepage ————— */
/* Homepage container logic: narrative lives on the page ground in ONE
   column; surfaces are reserved for interactive elements (the create
   card, decision link cards). One left edge, one rhythm. */
section.hero {
  background: none;
  color: var(--ink);
  border: none;
  margin: 0;
  padding: clamp(40px, 6vw, 72px) 0 0;
}
.hero-grid {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 48px; align-items: center;
}
.hero-eyebrow {
  font: 700 11px/1 var(--mono);
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 18px;
}
.hero-main {
  font-family: var(--font-display);
  font-size: clamp(38px, 4.8vw, 56px);
  font-weight: 800; letter-spacing: -0.015em; line-height: 1.02;
  margin: 0 0 14px;
}
.hero-main em { font-style: normal; color: var(--accent-ink); }
.hero-paragraph { color: var(--muted); margin: 0; font-size: 15.5px; max-width: 42ch; }
.hero-visual { justify-self: end; width: 100%; max-width: 400px; }
.hero-visual svg { width: 100%; height: auto; display: block; }
/* the decorative plot only earns its place BESIDE the message — below
   the split point the hero is just the message */
@media (max-width: 1000px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-visual { display: none; }
  section.hero { padding: 40px 0 0; }
}
@media (max-width: 700px) {
  .eyebrow-sub { display: none; }
  section.hero { padding: 28px 0 0; }
  section.create-cta { margin-top: 26px; padding: 20px; }
  section.content.home-intro, .public-decisions-container section.content { margin: 48px 0; }
  .input-container input[type="submit"] { flex: 1 1 100%; }
}
@media (prefers-reduced-motion: no-preference) {
  .hero-copy > * { animation: hero-rise 0.5s ease-out backwards; }
  .hero-copy > *:nth-child(2) { animation-delay: 0.06s; }
  .hero-copy > *:nth-child(3) { animation-delay: 0.12s; }
  .hero-copy > *:nth-child(4) { animation-delay: 0.18s; }
  .hero-visual { animation: hero-rise 0.6s 0.15s ease-out backwards; }
  section.create-cta { animation: hero-rise 0.5s 0.22s ease-out backwards; }
  @keyframes hero-rise {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
  }
}

/* the prime CTA — a dedicated card between hero and content
   (.input-container also receives the JS-injected div.error / div.loading) */
section.create-cta {
  margin: 36px 0 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
  padding: 24px 32px;
}
.create-decision-form { margin: 0; text-align: left; }
.create-decision-form > label {
  display: block;
  font-family: var(--font-display);
  font-size: 17px; font-weight: 700;
  color: var(--ink);
  margin: 0 0 12px;
}
.input-container { display: flex; flex-wrap: wrap; gap: 10px; position: relative; }
.input-container input[type="text"] {
  flex: 1 1 280px;
  background: var(--card-2);
  border-color: var(--line);
  color: var(--ink);
  padding: 15px 18px;
  font-size: 16px;
}
.input-container input[type="text"]:focus { background: var(--card); border-color: var(--accent); }
.input-container input[type="submit"] { padding: 15px 28px; font-size: 16px; }
.checkbox-container { display: flex; align-items: center; gap: 9px; margin-top: 14px; }
.checkbox-container .checkbox-label { font-weight: 500; font-size: 13.5px; color: var(--muted); }

/* the explainer sits quietly on the page ground, steps as a 2x2 grid */
section.content.home-intro { background: none; border: none; box-shadow: none; padding: 0; margin: 72px 0; }
.home-intro > h2 {
  font-family: var(--font-display);
  font-size: 21px; font-weight: 700;
  color: var(--ink);
  margin: 0 0 10px;
}
.home-intro > p { font-size: 14.5px; }
.home-lede { max-width: 62ch; }
.steps-grid {
  list-style: none;
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 22px 40px; margin: 24px 0; padding: 0;
}
@media (max-width: 700px) { .steps-grid { grid-template-columns: 1fr; } }
.steps-grid .step { display: flex; gap: 16px; align-items: flex-start; }
.steps-grid .step-num {
  font: 600 13px/1.6 var(--mono);
  color: var(--muted);
  flex-shrink: 0;
  padding-top: 2px;
}
.steps-grid .step h3 { font-size: 15px; margin: 0 0 4px; }
.steps-grid .step p { font-size: 13.5px; margin: 0; }
.home-outro { border-top: 1px solid var(--line); padding-top: 16px; }

/* latest public decisions — title on the ground, cards are the links */
.public-decisions-container section.content {
  background: none; border: none; box-shadow: none; padding: 0; margin: 72px 0 24px;
}
.public-decisions-container section.content header h1 { font-size: 21px; margin-bottom: 14px; }
ul.public_decisions {
  list-style: none; margin: 8px 0 0; padding: 0;
  /* fixed playing-card columns, left-aligned */
  display: grid; grid-template-columns: repeat(auto-fill, 190px);
  justify-content: start; align-items: start; gap: 16px;
}
ul.public_decisions li a {
  display: flex; flex-direction: column; gap: 5px;
  /* every card is one playing-card rectangle regardless of factor count —
     the abacon bottom-anchors and shorter decisions just show white space */
  aspect-ratio: 5 / 7;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px; padding: 16px 16px 18px;
  background: var(--card);
  color: var(--ink); text-decoration: none;
  transition: border-color 0.15s, transform 0.15s ease, box-shadow 0.15s ease;
}
ul.public_decisions li a:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
ul.public_decisions li.featured a { border-color: var(--lavender); }
ul.public_decisions .date { font: 600 10.5px/1 var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
ul.public_decisions .decision-title {
  font-weight: 700; font-size: 15px; line-height: 1.25;
  /* reserve two lines so the header height is constant and every abacon
     bottom-anchors to the same baseline */
  min-height: 2.5em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
/* real miniature ABACON: one slope line per alternative, drawn from the
   decision's own weighted scores. One band per factor (height scales with
   --factors) so a richer decision draws a taller chart; capped at 8 bands
   (the size the card is tuned for) and bottom-anchored so all cards match. */
ul.public_decisions .mini-abacon {
  display: block; width: 100%;
  height: calc(var(--factors, 4) * 22px);
  max-height: 176px;
  /* centre the chart in the space below the title; fewer-factor decisions
     get equal white space above and below rather than sinking to the base */
  margin-block: auto;
}
ul.public_decisions .mini-abacon polyline {
  stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round;
  opacity: 0.92;
}
ul.public_decisions .mini-abacon-band {
  stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; opacity: 0.4;
}
ul.public_decisions li a:hover .mini-abacon polyline { opacity: 1; }
/* at-a-glance stats footer: alternatives · factors · evaluations */
ul.public_decisions .card-stats {
  display: flex; gap: 14px; align-items: center;
  padding-top: 12px; margin-top: 2px;
  border-top: 1px solid var(--line);
}
ul.public_decisions .card-stats .stat {
  display: inline-flex; align-items: center; gap: 5px;
  font: 700 12px/1 var(--mono); color: var(--muted);
}
ul.public_decisions .card-stats .stat svg {
  width: 14px; height: 14px; flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
  opacity: 0.85;
}

/* ————— alternatives & criteria lists ————— */
#content form > div { position: relative; display: flex; }
#content form > div input { padding-right: 52px; }
#content form ol { list-style: none; counter-reset: item; margin: 18px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
#content form ol li { position: relative; display: flex; align-items: center; counter-increment: item; }
#content form ol li::before {
  content: counter(item);
  font: 700 12px/1 var(--mono);
  color: var(--muted);
  min-width: 26px;
}
#content form ol li input { background: var(--card); border-color: var(--line); }
#content form ol li input:focus { border-color: var(--accent); }

/* injected + / – / drag controls */
span.add, span.remove {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700; line-height: 1;
  cursor: pointer; user-select: none;
  transition: background 0.15s, color 0.15s;
}
span.add { background: var(--accent); color: #fff; }
span.add:hover { background: var(--accent-hover); }
span.add:active { transform: translateY(-50%) scale(0.92); }
span.remove { background: transparent; color: var(--muted); right: 10px; }
span.remove:hover { background: var(--err-soft); color: var(--err); }
span.remove:active { transform: translateY(-50%) scale(0.92); }
/* drag handle: a proper 6-dot grip so it clearly reads as "grab me".
   Drawn as a mask so its color follows the theme + hover state. */
li .drag {
  position: absolute; right: 40px; top: 50%; transform: translateY(-50%);
  width: 30px; height: 40px; border-radius: 8px;
  cursor: grab;
  /* claim touches on the grip so the browser doesn't scroll instead of
     letting our pointer handler drag (the mobile "it just scrolls" bug) */
  touch-action: none;
  background-color: var(--muted);
  opacity: 0.55;
  transition: opacity 0.15s, background-color 0.15s;
  -webkit-mask: var(--grip) center / 10px 16px no-repeat;
  mask: var(--grip) center / 10px 16px no-repeat;
}
/* whole row invites interaction on hover; the grip lights up in accent */
#content form ol li:hover .drag { opacity: 1; background-color: var(--accent-ink); }
#content form ol li:hover { }
li .drag:hover { opacity: 1; background-color: var(--accent-ink); }
li.drag input { cursor: text; }

/* "drag to reorder" hint — shown only once the list has 2+ factors */
.reorder-hint {
  display: none;
  align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--muted);
  margin: 14px 0 0;
}
.reorder-hint::before {
  content: ""; width: 14px; height: 16px; flex-shrink: 0;
  background-color: var(--muted);
  -webkit-mask: var(--grip) center / 9px 14px no-repeat;
  mask: var(--grip) center / 9px 14px no-repeat;
}
#content form:has(ol li:nth-child(2)) .reorder-hint { display: inline-flex; }
/* lifted row while dragging: an absolutely-positioned ghost following the
   cursor (position/left/top/width set inline by criteria.js). The lifted
   "card" styling lives on the INPUT so the outline hugs the card exactly
   like every other row — not the full li (which includes the number
   gutter and would overhang to the left). */
ol li.dragging {
  z-index: 30;
  cursor: grabbing;
  list-style: none;
}
/* the floating ghost drops its number; the placeholder carries it so the
   drop slot shows the landing position (id-specific to beat the base
   counter-increment rule) */
#content form ol li.dragging { counter-increment: none; }
ol li.dragging::before { visibility: hidden; } /* keep the gutter space so the card stays aligned */
ol li.dragging input {
  pointer-events: none;
  border-color: var(--accent);
  box-shadow: 0 16px 34px -10px rgba(0, 0, 0, 0.45);
}
ol li.dragging .drag { cursor: grabbing; opacity: 1; background-color: var(--accent-ink); }
ol li.dragging input, ol li.dragging .drag, ol li.dragging .remove { user-select: none; }
li .drag:active { cursor: grabbing; }

/* the slot the dragged row will drop into: the number stays in the gutter
   (like every row) and the dashed box covers only the input area, drawn
   with ::after so it aligns with the real rows' input card */
ol li.drag-placeholder {
  display: flex; align-items: center;
  list-style: none;
}
ol li.drag-placeholder::before { color: var(--accent-ink); }
ol li.drag-placeholder::after {
  content: ""; flex: 1; align-self: stretch;
  border: 1px dashed var(--accent);
  border-radius: var(--r-ctl);
  background: var(--accent-soft);
}

/* designed empty state — collapses smoothly (grid-row 0fr) once the
   list gains items; no display toggle, so no layout snap */
/* NB: scoped under #content form to outrank `#content form > div`
   (the add-input row rule), which would otherwise force display:flex */
#content form > .empty-state {
  display: grid;
  grid-template-rows: 1fr;
  margin: 22px 0 4px;
  padding: 0;
  transition: grid-template-rows 0.3s ease, margin 0.3s ease, opacity 0.22s ease;
}
.empty-inner {
  overflow: hidden; min-height: 0;
  display: flex; align-items: center; gap: 16px;
  padding: 18px 20px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  transition: padding 0.3s ease, border-color 0.3s ease;
}
.empty-state svg { width: 44px; height: auto; flex-shrink: 0; opacity: 0.9; }
.empty-state p { margin: 0; font-size: 13.5px; color: var(--muted); max-width: 46ch; }
.empty-state p b { color: var(--ink); }
#content form:has(ol li) .empty-state {
  grid-template-rows: 0fr;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}
#content form:has(ol li) .empty-inner { padding-block: 0; border-color: transparent; }

/* why-is-Next-disabled microcopy — lives in the nav row beside the Next
   button so it reads as that button's explanation; the auto margin absorbs
   the row's free space so hint + Next stay glued to the right edge, and
   pages without a hint keep plain space-between. Only one "at least two"
   cue at a time: the empty state owns it while the list is empty, this
   hint takes over once the first item lands (and leaves when Next unlocks). */
#content-nav li.nav-hint {
  margin-left: auto; margin-right: 16px;
  font-size: 12.5px; color: var(--muted);
  text-align: right;
  opacity: 0; visibility: hidden;
  transition: opacity 0.22s ease, visibility 0.22s;
}
#content form:has(ol li) #content-nav:has(li.next.disabled) li.nav-hint {
  opacity: 1; visibility: visible;
}

/* prev / next navigation */
#content-nav {
  list-style: none; display: flex; justify-content: space-between; align-items: center;
  margin: 26px 0 0; padding: 18px 0 0; border-top: 1px solid var(--line);
  flex: 1 1 100%;
}
#content-nav li a, #content-nav li span, #content-nav li input.button {
  display: inline-flex; align-items: center; gap: 6px;
  font-weight: 700; font-size: 14px;
  padding: 11px 20px; border-radius: 999px;
  text-decoration: none;
}
#content-nav li.next a { background: var(--accent); color: #fff; }
#content-nav li.next a:hover { background: var(--accent-hover); }
#content-nav li.prev a { background: var(--card-2); color: var(--ink); }
#content-nav li.prev a:hover { background: var(--line); }
#content-nav li span { background: transparent; color: var(--muted); border: 1px dashed var(--line); }
#content-nav li.prev.disabled span { border: none; }
#content-nav .doors { display: none; }

/* ————— evaluation ————— */
.evaluation-container { display: flex; flex-wrap: wrap; gap: 32px; }
.evaluation-container #content { flex: 1 1 440px; min-width: 0; }
.evaluation-container #sidebar { flex: 1 1 220px; max-width: 300px; }
.evaluation-container #info-help { flex: 1 1 100%; border-top: 1px solid var(--line); padding-top: 20px; }
.evaluation-container #info-help h2 { margin-top: 0; }
.evaluation-container #info-help h3 { font-size: 14.5px; margin: 1.2em 0 0.3em; }
.evaluation-container #info-help p { font-size: 13.5px; }
section.content h1 em { font-style: normal; color: var(--accent-ink); }

#evaluation ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
#evaluation ul li {
  position: relative;
  background: var(--card-2);
  border-radius: 14px;
  padding: 16px 18px 14px;
  border: 2px solid transparent;
  transition: border-color 0.2s;
}
#evaluation ul li h3 { font-size: 15px; font-weight: 700; margin: 0 0 10px; display: flex; align-items: baseline; gap: 10px; }
/* NB: no per-row "saved" tick — every slider holds a valid rating
   (neutral 50 by default), so a check on some rows but not others would
   wrongly imply the untouched ones are incomplete. The value chip is the
   state; changes are persisted silently. */
#evaluation ul li > div { display: flex; flex-wrap: wrap; align-items: center; }
#evaluation .worst, #evaluation .neutral, #evaluation .best {
  font: 700 10.5px/1 var(--mono);
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted);
  margin-top: 9px;
}
#evaluation .worst { order: 2; }
#evaluation .neutral { order: 3; flex: 1; text-align: center; }
#evaluation .best { order: 4; }

/* native range slider (server-rendered) — the track fill follows the
   --fill custom property, updated live by evaluation.js */
#evaluation .grade-range {
  order: 1; flex: 1 1 100%;
  -webkit-appearance: none; appearance: none;
  height: 8px; border-radius: 999px;
  background: linear-gradient(to right, var(--accent) var(--fill, 50%), var(--line) var(--fill, 50%));
  margin: 12px 0 4px;
  cursor: pointer;
}
#evaluation .grade-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 28px; height: 28px; border-radius: 999px;
  background: var(--card);
  border: 3px solid var(--accent);
  box-shadow: var(--shadow-sm);
  cursor: grab;
}
#evaluation .grade-range::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 999px;
  background: var(--card);
  border: 3px solid var(--accent);
  cursor: grab;
}
#evaluation .grade-range:active::-webkit-slider-thumb { cursor: grabbing; transform: scale(1.1); }
#evaluation .grade-range:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

/* live value chip (rendered by theme/enhance.js, reads the slider state) */
.slider-value {
  font: 700 12px/1 var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--accent-ink);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 4px 9px;
  min-width: 34px; text-align: center;
}
.slider-value.pulse { animation: chip-pulse 0.18s ease-out; }



/* evaluation sidebar factor list */
#sidebar ul.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
#sidebar ul.steps h1 { font-size: 13px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
#sidebar ul.steps li a, #sidebar ul.steps li div.current {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 600;
  padding: 9px 14px; border-radius: 999px;
  color: var(--ink); text-decoration: none;
}
#sidebar ul.steps li a { background: var(--card-2); }
#sidebar ul.steps li a:hover { background: var(--line); }
#sidebar ul.steps li.saved a::before, #sidebar ul.steps li.saved div.current::before { content: "✓"; color: var(--ok); font-weight: 800; }
#sidebar ul.steps li.disabled div.current { color: var(--muted); border: 1px dashed var(--line); }
/* current state must win over disabled (a factor can be both mid-evaluation) */
#sidebar ul.steps li.current a, #sidebar ul.steps li.current div.current { background: var(--accent); color: #fff; border: none; }
#sidebar ul.steps li.current.saved a::before, #sidebar ul.steps li.current div.current::before { color: #fff; }

/* ————— analysis & public report ————— */
.analysis { display: flex; flex-direction: column; gap: 16px; margin-top: 8px; }

/* result headline — the one big statement on the page */
.analysis-head { padding: 8px 4px 4px; }
.analysis-eyebrow {
  font: 700 11px/1 var(--mono); letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 12px;
}
.analysis-verdict {
  font-family: var(--font-display);
  font-size: clamp(26px, 3.6vw, 36px); font-weight: 800; letter-spacing: -0.02em;
  line-height: 1.05; margin: 0 0 10px;
}
.analysis-verdict .win { color: var(--accent-ink); }
.analysis-lede { color: var(--muted); font-size: 15.5px; margin: 0; max-width: 60ch; }
.analysis-lede b { color: var(--ink); font-weight: 600; }

/* each section is its own quiet card — no card-in-card inside */
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
  padding: 22px 26px;
}
.panel-title { font-family: var(--font-display); font-size: 18px; font-weight: 700; margin: 0 0 14px; }
.panel-sub { color: var(--muted); font-size: 13.5px; margin: -6px 0 16px; max-width: 62ch; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 6px; }
.panel-head .panel-title { margin: 0; }
.panel-head-title { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* robustness pill — a glanceable "can I trust this?" chip beside the title.
   Green = the winner holds across weightings; amber = it depends on them.
   The full explanation is the title/aria tooltip on hover or focus. */
.robustness {
  position: relative;
  display: inline-flex; align-items: center; gap: 6px; cursor: help;
  padding: 3px 10px 3px 8px; border-radius: 999px;
  font: 600 11.5px/1 var(--font); color: var(--muted);
  background: var(--card-2); border: 1px solid var(--line);
}
.robustness[hidden] { display: none; }

/* custom popover — replaces the native title tooltip (dead on touch, slow on
   desktop). Shows on hover, keyboard focus, or tap (JS toggles .open). */
.robustness-tip {
  /* fixed (not absolute) so it can NEVER widen the page: an out-of-flow box
     anchored to the viewport doesn't add to the document's scroll width the
     way an absolute box hanging off the right-edge pill does. JS sets top/left
     from the pill's rect and clamps them inside the viewport. */
  position: fixed; top: 0; left: 0; z-index: 40;
  /* width caps to the screen; JS clamps `left` so it never runs off the edge */
  width: max-content; max-width: min(300px, calc(100vw - 28px));
  padding: 10px 12px; border-radius: 10px;
  background: var(--card); color: var(--ink);
  border: 1px solid var(--line); box-shadow: var(--shadow);
  font: 400 12.5px/1.45 var(--font); text-align: left; white-space: normal;
  letter-spacing: 0; text-transform: none;
  opacity: 0; visibility: hidden; transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
  pointer-events: none;
}
.robustness-tip b { font-weight: 700; }
.robustness:hover .robustness-tip,
.robustness:focus-visible .robustness-tip,
.robustness.open .robustness-tip {
  opacity: 1; visibility: visible; transform: none;
}
.robustness-dot { width: 7px; height: 7px; border-radius: 999px; background: var(--muted); flex: 0 0 auto; }
/* stack both state labels in ONE grid cell so the pill always sizes to the
   widest ("Sensitive") and never reflows when the state flips mid-drag */
.robustness-label { display: inline-grid; justify-items: center; }
.robustness-label .rl { grid-area: 1 / 1; visibility: hidden; white-space: nowrap; }
.robustness.is-robust .rl-robust { visibility: visible; }
.robustness.is-sensitive .rl-sensitive { visibility: visible; }
.robustness.is-robust { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.robustness.is-robust .robustness-dot { background: var(--ok); }
.robustness.is-sensitive { color: #b8791f; border-color: color-mix(in srgb, #d69329 40%, transparent); }
.robustness.is-sensitive .robustness-dot { background: #d69329; }
:root[data-theme="dark"] .robustness.is-sensitive { color: #e0a54a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .robustness.is-sensitive { color: #e0a54a; } }

/* the weights control lives WITH the chart it changes: a labelled 3-way mode
   selector (ODESYS decay / equal / custom point-budget) as a segmented control */
.weights-field { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.weights-field-label {
  display: inline-flex; align-items: center; gap: 6px;
  font: 700 11px/1 var(--mono); letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--muted); white-space: nowrap;
}
.weights-icon {
  width: 15px; height: 15px; display: inline-block; background-color: var(--muted);
  -webkit-mask: var(--icon-scale) center / contain no-repeat; mask: var(--icon-scale) center / contain no-repeat;
}
.weight-modes {
  display: inline-flex; align-items: center; gap: 2px;
  background: var(--card-2); border-radius: 999px; padding: 3px;
}
.weight-mode {
  font: 600 12.5px/1 var(--font); color: var(--muted);
  background: transparent; border: 0; border-radius: 999px;
  padding: 8px 14px; cursor: pointer; white-space: nowrap;
  box-shadow: none; transition: color 0.15s, background 0.15s;
}
.weight-mode:hover { color: var(--ink); }
.weight-mode.is-active {
  color: #fff; background: var(--accent);
}

/* custom mode: split-100-points panel, sits full-width under the panel head */
.weights-custom {
  margin: 4px 0 8px; padding: 16px 18px;
  background: var(--card-2); border-radius: var(--r-ctl);
}
.weights-custom[hidden] { display: none; }
.weights-custom-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  flex-wrap: wrap; margin-bottom: 12px;
}
.weights-custom-hint { margin: 0; font-size: 13px; color: var(--muted); }
.weights-custom-hint b { color: var(--ink); font-weight: 700; }
.weights-reset {
  font: 600 12px/1 var(--font); color: var(--accent-ink);
  background: transparent; border: 0; padding: 4px 2px; cursor: pointer; box-shadow: none;
}
.weights-reset:hover { color: var(--accent-hover); text-decoration: underline; }

.weight-slider-row {
  display: grid; grid-template-columns: minmax(90px, 26%) 1fr auto;
  align-items: center; gap: 12px 14px; padding: 5px 0;
}
.weight-slider-label {
  font-weight: 600; font-size: 13.5px; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.weight-slider {
  -webkit-appearance: none; appearance: none;
  height: 6px; border-radius: 999px; width: 100%; cursor: pointer;
  background: linear-gradient(to right, var(--accent) var(--fill, 50%), var(--line) var(--fill, 50%));
}
.weight-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 20px; height: 20px; border-radius: 999px;
  background: var(--card); border: 3px solid var(--accent);
  box-shadow: var(--shadow-sm); cursor: grab;
}
.weight-slider::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 999px;
  background: var(--card); border: 3px solid var(--accent); cursor: grab;
}
.weight-slider:active::-webkit-slider-thumb { cursor: grabbing; transform: scale(1.1); }
.weight-slider:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.weight-slider-pts {
  font: 700 12.5px/1 var(--mono); font-variant-numeric: tabular-nums;
  color: var(--muted); min-width: 6ch; text-align: right;
}

.chart-note { color: var(--muted); font-size: 13px; margin: 14px 0 0; max-width: 68ch; }

/* share links — a clean list, no boxes-in-boxes */
.share-list { display: flex; flex-direction: column; gap: 10px; }
.share-row { display: flex; align-items: center; gap: 10px; }
.share-tag {
  flex: 0 0 auto; min-width: 44px; text-align: center;
  font: 700 10.5px/1 var(--mono); letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted); background: var(--card-2); border-radius: 999px; padding: 6px 10px;
}
.share-tag.edit { color: var(--accent-ink); background: var(--accent-soft); }
.share-row .input-copy {
  flex: 1 1 auto; min-width: 0;
  font: 500 12.5px/1.4 var(--mono); color: var(--muted);
  background: var(--card-2); border: 1px solid transparent; border-radius: var(--r-ctl);
  padding: 10px 12px; text-overflow: ellipsis;
}
.share-row .input-copy:focus { border-color: var(--accent); color: var(--ink); background: var(--card); }
.copy-btn {
  flex: 0 0 auto; width: 38px; height: 38px; padding: 0;
  background: var(--card-2); border: 1px solid var(--line); border-radius: 10px;
  cursor: pointer; box-shadow: none;
  background-image: none;
  -webkit-mask: none;
  position: relative;
}
.copy-btn::before {
  content: ""; position: absolute; inset: 0;
  background-color: var(--muted);
  -webkit-mask: var(--icon-copy) center / 16px no-repeat; mask: var(--icon-copy) center / 16px no-repeat;
  transition: background-color 0.15s;
}
.copy-btn:hover { background: var(--card-2); }
.copy-btn:hover::before { background-color: var(--accent-ink); }
.copy-btn.copied::before {
  background-color: var(--ok);
  -webkit-mask: var(--icon-check) center / 17px no-repeat; mask: var(--icon-check) center / 17px no-repeat;
}

/* further-info: a lightweight FAQ grid, not a wall */
.further-info { margin-top: 8px; }
.further-info .faq { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px 32px; }
.further-info .faq h3 { font-size: 14.5px; margin: 8px 0 4px; }
.further-info .faq p { font-size: 13.5px; color: var(--muted); margin: 0; }

/* ————— charts (dependency-free, theme-native) ————— */
.chart { margin: 10px 0 4px; color: var(--ink); }

/* Total scores — horizontal bars, ranked, winner emphasized */
/* one shared column grid for the whole chart: rows are subgrids so the
   rank / name / track / value columns line up across every row. Without
   this each row sized its own `auto` value column, and the winner's wider
   "100.0" label squeezed its track — so the 100% bar rendered shorter than
   the tracks below it. */
.bar-chart {
  display: grid;
  grid-template-columns: 20px minmax(64px, 22%) 1fr auto;
  align-items: center;
  gap: 10px 14px;
}
.bar-row {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: subgrid;
  align-items: center;
}
.bar-rank { font: 700 12px/1 var(--mono); color: var(--muted); text-align: center; }
.bar-name { font-weight: 600; font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 20px; border-radius: 7px; background: var(--card-2); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 7px; transition: width 0.65s cubic-bezier(0.22, 1, 0.36, 1); }
.bar-value { font: 700 13px/1 var(--mono); font-variant-numeric: tabular-nums; color: var(--muted); min-width: 3ch; text-align: right; }
/* the winner reads first: full-ink name/value, taller bar, a rank chip */
.bar-row.winner .bar-name, .bar-row.winner .bar-value { color: var(--ink); }
.bar-row.winner .bar-name { font-weight: 700; }
.bar-row.winner .bar-track { height: 26px; }
.bar-row.winner .bar-rank {
  color: #fff; background: var(--accent);
  border-radius: 999px; width: 20px; height: 20px; line-height: 20px; justify-self: center;
}

/* ABACON slope chart — HTML factor labels + inline SVG plot */
.abacon { display: flex; gap: 10px; overflow-x: auto; }
.abacon-labels { flex: 0 0 132px; display: flex; flex-direction: column; }
.abacon-label {
  display: flex; flex-direction: column; align-items: flex-end; justify-content: center; gap: 5px;
  overflow: hidden;
}
.abacon-label-title {
  font: 600 13px/1.2 var(--font); color: var(--ink);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* weight bar: shows each factor's priority weight; flattens to full when
   "equal weights" is on — the visible cause behind the toggle */
.abacon-weight { width: 46px; height: 4px; border-radius: 999px; background: var(--card-2); overflow: hidden; }
.abacon-weight-bar { display: block; height: 100%; border-radius: 999px; background: var(--lavender); transition: width 0.4s cubic-bezier(0.22,1,0.36,1); }
.abacon-plot { position: relative; flex: 1 1 auto; min-width: 240px; }
.abacon-svg { display: block; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-grid.faint { stroke: var(--line); opacity: 0.5; stroke-dasharray: 2 5; }
.chart-axis { fill: var(--muted); font: 600 10px/1 var(--mono); }
.chart-neutral { stroke: var(--muted); stroke-width: 1; opacity: 0.55; stroke-dasharray: 3 3; }
.chart-neutral-label { fill: var(--muted); font: 600 9px/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; }
.chart-dot { transition: r 0.15s ease; cursor: pointer; }

/* hover tooltip on data points */
.chart-tooltip {
  position: absolute; z-index: 5;
  transform: translate(10px, -50%);
  font: 700 11px/1 var(--mono); font-variant-numeric: tabular-nums;
  color: var(--ink); background: var(--card);
  border: 1.5px solid var(--line); border-radius: 8px;
  padding: 4px 8px; box-shadow: var(--shadow-sm);
  pointer-events: none; white-space: nowrap;
  opacity: 0; transition: opacity 0.12s ease;
}
.chart-tooltip.show { opacity: 1; }

/* abacon legend — toggle chips above the chart */
.abacon-legend { margin-bottom: 14px; }
.abacon-legend ul.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; }
.abacon-legend ul.legend li {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 700;
  border: 1px solid var(--line);
  border-radius: 999px; padding: 7px 14px 7px 9px;
  cursor: pointer; user-select: none;
  transition: opacity 0.15s, border-color 0.15s;
}
.abacon-legend ul.legend li:hover { border-color: var(--muted); }
.abacon-legend ul.legend li:active { transform: scale(0.97); }
.abacon-legend ul.legend li.disabled { opacity: 0.4; }
.abacon-legend ul.legend .color { width: 14px; height: 14px; border-radius: 999px; display: inline-block; }

/* ————— edit / delete / sharing pages ————— */
#editDecision, #deleteDecision { display: flex; flex-direction: column; gap: 12px; max-width: 480px; }
#editDecision textarea { min-height: 110px; resize: vertical; }
#editDecision input[type="button"], #deleteDecision input[type="button"] { align-self: flex-start; }
#editDecision input[type="submit"], #deleteDecision input[type="submit"] { align-self: flex-end; margin-top: -47px; }
#heading { max-width: 1020px; margin: 0 auto 16px; padding: 0 16px; }

/* ————— error page ————— */
section.error {
  background: var(--card); border-radius: var(--r-card); box-shadow: var(--shadow);
  padding: 40px 32px; text-align: center;
}
section.error h1 { font-size: 26px; }
section.error .error-message { color: var(--muted); margin-bottom: 16px; }
section.error .back { font-size: 14px; color: var(--muted); }

/* ————— footer ————— */
.layout-footer { padding: 24px 16px 40px; }
.layout-footer-box { max-width: 1020px; margin: 0 auto; }
.footer-links { list-style: none; display: flex; justify-content: center; gap: 6px; margin: 0; padding: 0; font-size: 13px; color: var(--muted); }
.footer-links a { color: var(--muted); font-weight: 600; }
.footer-links a:hover { color: var(--accent-ink); }
/* theme toggle — lives on the navy canopy, top right of every page;
   defaults to the OS scheme until clicked (see theme/theme.js) */
#theme-toggle {
  position: absolute; top: 13px; z-index: 50;
  /* hug the shared content column: same right edge as the container */
  right: max(16px, calc(50vw - 510px));
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: none;
  font: 600 12px/1 var(--font);
  color: var(--muted);
  padding: 8px 14px; border-radius: 999px;
  cursor: pointer;
}
#theme-toggle:hover { border-color: var(--muted); color: var(--ink); background: var(--card); }
#theme-toggle:active { transform: scale(0.96); }
.copy-btn:active { transform: scale(0.94); }
@media (max-width: 640px) {
  #theme-toggle { top: 17px; right: 20px; }
}

/* ————— small screens ————— */
@media (max-width: 560px) {
  /* the four step pills: equal 2x2 grid instead of ragged wrapping */
  #project ul { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  #project ul li { display: flex; }
  #project ul li a,
  #project ul li span {
    flex: 1; justify-content: center;
    font-size: 12.5px; padding: 11px 8px;
    white-space: nowrap;
  }
}
@media (max-width: 640px) {
  #main { width: min(100% - 20px, 1020px); padding: 0 0 40px; }
  section.content { padding: 22px 18px; }
  .panel { padding: 18px 16px; }
  .abacon-labels { flex-basis: 82px; }
  .bar-chart { grid-template-columns: 18px minmax(52px, 28%) 1fr auto; gap: 10px 10px; }
  #evaluation .grade-range::-webkit-slider-thumb { width: 32px; height: 32px; }
  #evaluation .grade-range::-moz-range-thumb { width: 26px; height: 26px; }
  .top-header .header-sub { font-size: 13px; }
}
