/* AI Parameter Playground — shared stylesheet
   Design direction: spec section 23. Clean, modern, blue-accented, light
   neutral background, large readable type, rounded cards. Deliberately no
   dark mode: this is projected in bright rooms and read on student phones. */

:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --ink: #0f172a;
  --ink-soft: #475569;
  /* 4.76:1 on white. The lighter #74839a this used to be measured 3.84:1 and
     failed WCAG AA on every counter, caption and progress label. */
  --ink-faint: #64748b;
  --line: #dde5ef;
  --line-strong: #c3cfdf;

  /* #1d4ed8 gives 7.0:1 on white — safe for CTA text and links. */
  --accent: #1d4ed8;
  --accent-dark: #1739a8;
  --accent-soft: #eaf0ff;
  --accent-line: #b9ccf8;

  --ok: #15803d;
  --ok-soft: #e8f6ed;
  --warn: #b45309;
  --warn-soft: #fdf3e6;
  --danger: #b91c1c;
  --danger-soft: #fdecec;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 6px 20px rgba(15, 23, 42, .06);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --maxw: 1160px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  overflow-wrap: break-word;
}

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; font-weight: 700; letter-spacing: -.015em; }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.3rem); }
h2 { font-size: clamp(1.3rem, 1.1rem + .9vw, 1.65rem); }
h3 { font-size: 1.12rem; }
p  { margin: 0 0 1em; }
a  { color: var(--accent); }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }

/* ---------------------------------------------------------------- header */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 40;
}
.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 62px;
  flex-wrap: wrap;
  padding-block: 10px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -.01em;
}
.brand-mark {
  width: 30px; height: 30px;
  flex: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  display: grid; place-items: center;
  font-size: .78rem; font-weight: 700; letter-spacing: .02em;
}
.header-spacer { flex: 1 1 auto; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge-mock { background: var(--warn-soft); color: var(--warn); border-color: #f0d9b5; }
.badge-live { background: var(--ok-soft); color: var(--ok); border-color: #bfe3cc; }
.badge-soon { background: var(--surface-alt); color: var(--ink-faint); border-color: var(--line); }
.badge-active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }

.back-link {
  font-size: .92rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--ink-soft);
  display: inline-flex; align-items: center; gap: 6px;
}
.back-link:hover { color: var(--accent); }

/* ------------------------------------------------------------------ hero */

.hero { padding: 40px 0 26px; }
.hero p.lede {
  font-size: 1.08rem;
  color: var(--ink-soft);
  max-width: 62ch;
  margin-bottom: 0;
}
.eyebrow {
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}

/* ----------------------------------------------------------------- cards */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
}
.card + .card { margin-top: 18px; }
.card > :last-child { margin-bottom: 0; }

.section-title {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.section-hint { color: var(--ink-soft); font-size: .95rem; margin-bottom: 16px; }

/* module grid (landing) */

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
  padding-bottom: 40px;
}
.module {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: inherit;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
a.module:hover, a.module:focus-visible {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--accent-line);
}
.module[aria-disabled="true"] { opacity: .72; cursor: default; }
.module-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.module-num {
  font-family: var(--mono);
  font-size: .8rem;
  font-weight: 700;
  color: var(--ink-faint);
}
.module h3 { margin: 0; font-size: 1.1rem; }
.module p { margin: 0; font-size: .93rem; color: var(--ink-soft); }

/* ------------------------------------------------------------------ tabs */

.tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px;
  margin: 22px 0 20px;
  box-shadow: var(--shadow-sm);
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 1 0 auto;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-weight: 600;
  font-size: .96rem;
  padding: 10px 16px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  min-height: 44px;
}
.tab:hover { color: var(--ink); background: var(--surface-alt); }
.tab[aria-selected="true"] { background: var(--accent); color: #fff; }

.panel[hidden] { display: none; }

/* -------------------------------------------------------------- controls */

.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }

label, .label {
  display: block;
  font-weight: 700;
  font-size: .95rem;
  margin-bottom: 7px;
}
.label-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  margin-bottom: 7px;
}
.label-row .label { margin-bottom: 0; }

textarea, input[type="text"], input[type="number"], select {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 12px 13px;
  min-height: 46px;
}
textarea { min-height: 104px; resize: vertical; line-height: 1.5; }
textarea:focus, input:focus, select:focus, button:focus-visible, .tab:focus-visible,
a:focus-visible, .chip:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.counter { font-size: .84rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.counter.over { color: var(--danger); font-weight: 700; }

/* preset chips */

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: inherit;
  font-size: .9rem;
  font-weight: 600;
  padding: 9px 14px;
  /* 44px is the tap-target floor; chips are primary controls in several
     modules, so they must clear it here rather than per module. */
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
}
.chip:hover { border-color: var(--accent-line); color: var(--accent); background: var(--accent-soft); }
.chip[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-dark);
}

/* slider */

.slider-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 6px;
}
.temp-value {
  font-family: var(--mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.temp-band {
  font-size: .86rem; font-weight: 700;
  padding: 4px 11px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-dark);
  border: 1px solid var(--accent-line);
}
.scale-ends {
  display: flex; justify-content: space-between;
  font-size: .84rem; color: var(--ink-faint); font-weight: 600;
  margin-bottom: 2px;
}

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%;
  background: transparent;
  margin: 8px 0 4px;
  /* wide hit target for phones */
  padding: 12px 0;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 8px; border-radius: 999px;
  background: linear-gradient(90deg, #bfd3f7, #1d4ed8);
}
input[type="range"]::-moz-range-track {
  height: 8px; border-radius: 999px;
  background: linear-gradient(90deg, #bfd3f7, #1d4ed8);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 28px; height: 28px; margin-top: -10px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent);
  box-shadow: 0 1px 4px rgba(15, 23, 42, .28);
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent);
  box-shadow: 0 1px 4px rgba(15, 23, 42, .28);
  cursor: pointer;
}
.ticks {
  display: flex; justify-content: space-between;
  font-family: var(--mono); font-size: .76rem; color: var(--ink-faint);
}

.band-legend {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 6px 14px;
  font-size: .85rem;
  color: var(--ink-soft);
}
.band-legend div { display: flex; gap: 8px; }
.band-legend code {
  font-family: var(--mono);
  color: var(--ink);
  font-weight: 700;
  white-space: nowrap;
}

/* buttons */

.actions { display: flex; flex-wrap: wrap; gap: 10px; }
/* Selector is .btn, not button.btn, on purpose: button.btn would be (0,1,1)
   and its `border` shorthand would beat the (0,1,0) .btn-secondary/.btn-ghost
   border-color below, leaving both variants with an invisible border. */
.btn {
  font: inherit;
  font-weight: 700;
  font-size: .98rem;
  padding: 13px 20px;
  min-height: 48px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-dark); }
.btn-secondary { background: var(--surface); color: var(--accent); border-color: var(--accent-line); }
.btn-secondary:hover:not(:disabled) { background: var(--accent-soft); }
.btn-ghost { background: transparent; color: var(--ink-soft); border-color: var(--line-strong); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-alt); color: var(--ink); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.spinner {
  width: 15px; height: 15px; flex: none;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2.4s; }
  a.module:hover { transform: none; }
}

/* ------------------------------------------------------------- responses */

.status-line {
  display: flex; align-items: center; gap: 9px;
  font-size: .95rem; font-weight: 600; color: var(--ink-soft);
  margin-bottom: 14px;
}
.status-line[hidden] { display: none; }

.alert {
  border-radius: var(--radius-sm);
  padding: 13px 15px;
  font-size: .95rem;
  border: 1px solid;
  margin-bottom: 14px;
}
.alert-error { background: var(--danger-soft); border-color: #f0c2c2; color: #8f1616; }
.alert-info  { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-dark); }
.alert-note  { background: var(--surface-alt); border-color: var(--line); color: var(--ink-soft); }
.alert[hidden] { display: none; }

.responses { display: grid; gap: 14px; }
.response {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  overflow: hidden;
}
.response-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  padding: 9px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  font-size: .84rem; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink-faint);
}
.response-head .t {
  font-family: var(--mono);
  text-transform: none; letter-spacing: 0;
  color: var(--accent);
}
.response-body {
  padding: 14px;
  white-space: pre-wrap;
  font-size: .98rem;
  line-height: 1.6;
}
.response-body.code { font-family: var(--mono); font-size: .88rem; }
.response.skeleton .response-body { color: var(--ink-faint); font-style: italic; }

/* --------------------------------------------------------- compare grid */

.compare-cols {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}
@media (min-width: 900px) {
  .compare-cols { grid-template-columns: repeat(3, 1fr); align-items: start; }
}
.compare-col {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.compare-col-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--accent-soft);
}
.compare-col-head .t {
  font-family: var(--mono); font-size: 1.15rem; font-weight: 700; color: var(--accent-dark);
}
.compare-col-head .verdict {
  font-size: .82rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--ink-soft);
}
.compare-col-body { padding: 12px; display: grid; gap: 10px; }
.compare-out {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--surface-alt);
  font-size: .94rem;
  white-space: pre-wrap;
}
.compare-temp-inputs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
}

/* -------------------------------------------------------- diversity meter */

.meter-box {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  padding: 15px;
}
.meter-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap; margin-bottom: 10px;
}
.meter-verdict { font-size: 1.05rem; font-weight: 700; }
.meter-verdict.low { color: var(--ok); }
.meter-verdict.medium { color: var(--warn); }
.meter-verdict.high { color: var(--accent); }
.meter-bar {
  height: 12px;
  border-radius: 999px;
  background: #e3e9f2;
  overflow: hidden;
}
.meter-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width .35s ease;
}
.meter-foot {
  display: flex; justify-content: space-between;
  font-size: .8rem; color: var(--ink-faint); margin-top: 7px;
}
.meter-note { font-size: .84rem; color: var(--ink-faint); margin: 9px 0 0; font-style: italic; }

/* ----------------------------------------------------------- guided lab */

.progress-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 14px;
}
.progress-label { font-size: .88rem; font-weight: 700; color: var(--ink-faint); letter-spacing: .05em; text-transform: uppercase; }
.progress-track { height: 6px; border-radius: 999px; background: #e3e9f2; flex: 1 1 160px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 999px; transition: width .3s ease; }

ol.steps { margin: 0 0 16px; padding-left: 22px; }
ol.steps li { margin-bottom: 6px; }

.quiz { display: grid; gap: 9px; margin: 14px 0; }
.quiz-option {
  display: flex; align-items: center; gap: 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 13px 15px;
  min-height: 48px;
  cursor: pointer;
  background: var(--surface);
  font-weight: 600;
}
.quiz-option:hover { border-color: var(--accent-line); background: var(--accent-soft); }
.quiz-option input { accent-color: var(--accent); width: 19px; height: 19px; flex: none; }
.quiz-option.chosen { border-color: var(--accent); background: var(--accent-soft); }

.reveal {
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 15px 17px;
  margin-top: 14px;
}
.reveal h4 { margin-top: 0; }
.reveal[hidden] { display: none; }

.nav-row { display: flex; justify-content: space-between; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

/* concept flow */

.flow { display: grid; gap: 0; justify-items: center; margin: 10px 0 4px; }
.flow-step {
  width: 100%;
  max-width: 420px;
  text-align: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 11px 14px;
  font-weight: 600;
  font-size: .95rem;
}
.flow-step.accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.flow-arrow { color: var(--line-strong); font-size: 1.15rem; line-height: 1; padding: 5px 0; }

.takeaway {
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  margin-top: 16px;
}
.takeaway p:last-child { margin-bottom: 0; }
.takeaway strong { color: var(--accent-dark); }

/* ------------------------------------------------------------- scenarios */

.scenario { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px; margin-bottom: 14px; background: var(--surface-alt); }
.scenario h3 { margin-bottom: 10px; }
.scenario .choices { display: flex; flex-wrap: wrap; gap: 8px; }

/* ----------------------------------------------------------------- notes */

.notes-grid { display: grid; gap: 14px; }
details.notes { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 0; box-shadow: var(--shadow-sm); }
details.notes > summary {
  padding: 16px 20px;
  cursor: pointer;
  font-weight: 700;
  list-style: none;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
details.notes > summary::-webkit-details-marker { display: none; }
details.notes > summary::after { content: "▾"; color: var(--ink-faint); }
details.notes[open] > summary::after { content: "▴"; }
details.notes > .notes-body { padding: 0 20px 20px; }

/* ---------------------------------------------------------- group banner */

.group-banner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.group {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 13px 15px;
  background: var(--surface-alt);
}
.group h4 { margin: 0 0 4px; font-size: .95rem; }
.group code { font-family: var(--mono); font-weight: 700; color: var(--accent-dark); }

/* ---------------------------------------------------------------- footer */

.site-footer {
  margin-top: 46px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 24px 0 34px;
  font-size: .88rem;
  color: var(--ink-faint);
}
.site-footer p { margin: 0 0 .6em; max-width: 84ch; }
.site-footer p:last-child { margin-bottom: 0; }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

main { padding-bottom: 10px; }

@media (max-width: 460px) {
  body { font-size: 16px; }
  .card { padding: 16px; }
  .actions button.btn { flex: 1 1 100%; }
}
