/* Right-Sized Governance Playground. Mobile first; system fonts only (no CDNs).
   AI Hub brand: DC green #007853, code black #242d39, yellow #e5bf21, mint #f0f8f3. */
:root {
  --brand-green: #007853;
  --brand-black: #242d39;
  --brand-yellow: #e5bf21;
  --brand-mint: #f0f8f3;

  --bg: var(--brand-mint);
  --surface: #ffffff;
  --surface-2: #eef4f0;
  --text: var(--brand-black);
  --muted: #56606c;
  --border: #d3ddd7;
  --accent: var(--brand-green);
  --accent-strong: #00603f;
  --accent-text: #ffffff;
  --focus: var(--brand-black);
  --head-font: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", system-ui, sans-serif;

  /* Each bucket: ink (text), line (border and count pill), on (text on the pill), bg (tint) */
  --do: #00603f;    --do-line: var(--brand-green);  --do-on: #ffffff;            --do-bg: #e4f2ea;
  --light: #6b5600; --light-line: var(--brand-yellow); --light-on: var(--brand-black); --light-bg: #fcf5d9;
  --not: #4f5966;   --not-line: #8a939d;            --not-on: #ffffff;           --not-bg: #edf0f2;
  --spec: var(--brand-black); --spec-line: var(--brand-black); --spec-on: var(--brand-yellow); --spec-bg: #e4e7eb;

  --flash: #fbeeb0;
  --new: #b3261e;
  --radius: 10px;
  --gutter: 16px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121820;
    --surface: #1b232d;
    --surface-2: #24303b;
    --text: #eef3f0;
    --muted: #a3adb8;
    --border: #34404c;
    --accent: #2fbf8a;
    --accent-strong: #5fd3a5;
    --accent-text: #08170f;
    --focus: var(--brand-yellow);

    --do: #5fd3a5;    --do-line: #2fbf8a;             --do-on: #08170f;            --do-bg: #133027;
    --light: #f0d45a; --light-line: var(--brand-yellow); --light-on: var(--brand-black); --light-bg: #342c10;
    --not: #a8b1bb;   --not-line: #6b7580;            --not-on: #10151b;           --not-bg: #232b35;
    --spec: #ffffff;  --spec-line: #eef3f0;           --spec-on: var(--brand-black); --spec-bg: #2b3644;

    --flash: #4a3f12;
    --new: #ff8a80;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 12px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  padding-bottom: 130px; /* room for the fixed status bar on phones */
}
h1, h2, h3, h4 { line-height: 1.2; margin: 0; }
h1, h2 { font-family: var(--head-font); font-weight: 700; letter-spacing: .01em; }
h1 { text-transform: uppercase; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.05rem; margin-bottom: 10px; }
h3 { font-size: 1rem; }
p { margin: 0; }
.muted { color: var(--muted); }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.page { max-width: 1500px; margin: 0 auto; padding: 16px var(--gutter) 24px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 8px 14px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn.ghost { background: transparent; }
.btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }

/* Header */
.brand-topbar {
  height: 6px;
  background: linear-gradient(to right, var(--brand-green) 0 40%, var(--brand-black) 40% 72%, var(--brand-yellow) 72% 100%);
}
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.brand img { height: 26px; width: auto; display: block; }
.brand span { font-size: .78rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.gate-box .brand { margin: 0; }
.top { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.top-actions .btn { min-height: 40px; padding: 6px 14px; font-size: .92rem; }
.subtitle { color: var(--muted); margin-top: 4px; }
.top-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Use-case selector: one row of chips (swipe on phones), description as a plain line */
.usecases { margin-bottom: 16px; }
.preset-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; margin: 0 -2px; scrollbar-width: none; }
.preset {
  flex: none; display: inline-flex; align-items: center; min-height: 40px; padding: 6px 14px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text);
  font: inherit; font-size: .92rem; font-weight: 600; white-space: nowrap; cursor: pointer;
}
.preset:hover { border-color: var(--accent); }
.preset[aria-checked="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.preset-desc { margin-top: 6px; max-width: 80ch; font-size: .9rem; color: var(--muted); }

/* Layout: controls stack above results on phones */
.layout { display: grid; gap: 18px; }
.controls-panel, .results-panel { min-width: 0; }

/* Controls */
.controls { display: grid; }
.control { border: 0; margin: 0; padding: 9px 0; border-bottom: 1px solid var(--border); min-width: 0; }
.control:last-child { border-bottom: 0; }
.control legend { font-weight: 600; font-size: .9rem; padding: 0; margin-bottom: 6px; }
.opts { display: flex; flex-wrap: wrap; gap: 4px; }
.opt { position: relative; }
.opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.opt label {
  display: inline-flex; align-items: center; min-height: 32px; padding: 3px 10px;
  border: 1px solid var(--border); border-radius: 999px; background: transparent; color: var(--muted);
  cursor: pointer; font-size: .84rem;
}
.opt input:checked + label { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.opt input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 2px; }
.from-start { font-size: .78rem; color: var(--muted); margin-top: 4px; }
.from-start:empty { display: none; }
.control.dirty .from-start { color: var(--text); font-weight: 600; }

.chips-block { margin-top: 14px; }
.mini-h { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  min-height: 32px; padding: 3px 11px; border-radius: 999px;
  border: 1px dashed var(--accent); background: transparent; color: var(--accent);
  font: inherit; font-size: .84rem; font-weight: 600; cursor: pointer;
}
.chip:hover { background: var(--do-bg); border-style: solid; }
.panel-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.panel-actions .btn { min-height: 36px; padding: 4px 12px; font-size: .85rem; }

/* Status: meter + banner. Fixed to the bottom on phones so changes are visible while scrolling controls. */
.status {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: var(--surface); border-top: 1px solid var(--border);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, .12);
  padding: 8px var(--gutter) calc(8px + env(safe-area-inset-bottom));
  display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; align-items: center;
}
.status .meter, .demo-bar { grid-column: 1 / -1; }
.demo-bar {
  display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; border-radius: 8px;
  background: var(--spec-line); color: var(--spec-on);
}
.demo-label { flex: 1; min-width: 0; font-size: .85rem; font-weight: 600; }
.btn.small { min-height: 36px; padding: 4px 12px; font-size: .85rem; }
.status-jump { font-size: .85rem; font-weight: 600; white-space: nowrap; }
.meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.meter-cell {
  position: relative; display: flex; flex-direction: column; align-items: center;
  padding: 2px; border-radius: 6px; background: var(--bucket-bg); color: var(--bucket);
  border-bottom: 3px solid var(--bucket-line);
}
.meter-count { font-size: 1.1rem; font-weight: 800; line-height: 1.1; }
.meter-label { font-size: .7rem; font-weight: 600; text-align: center; }
.meter-delta { font-size: .68rem; font-weight: 700; min-height: 1.2em; color: var(--text); }
.banner { font-size: .88rem; line-height: 1.35; }
.banner-more summary { display: inline; cursor: pointer; color: var(--accent); font-weight: 600; margin-left: 4px; }
.banner-more ul { margin: 6px 0 0; padding-left: 1.1em; max-height: 35vh; overflow-y: auto; display: grid; gap: 3px; }

@media (prefers-color-scheme: dark) {
  .brand img { background: #fff; padding: 3px 6px; border-radius: 4px; height: 30px; }
}

/* Bucket colours */
.b-do { --bucket: var(--do); --bucket-line: var(--do-line); --bucket-on: var(--do-on); --bucket-bg: var(--do-bg); }
.b-light { --bucket: var(--light); --bucket-line: var(--light-line); --bucket-on: var(--light-on); --bucket-bg: var(--light-bg); }
.b-not { --bucket: var(--not); --bucket-line: var(--not-line); --bucket-on: var(--not-on); --bucket-bg: var(--not-bg); }
.b-spec { --bucket: var(--spec); --bucket-line: var(--spec-line); --bucket-on: var(--spec-on); --bucket-bg: var(--spec-bg); }

/* Results */
.buckets { display: grid; gap: 14px; }
.bucket { border-top: 3px solid var(--bucket-line); padding: 8px 0 0; min-width: 0; }
.bucket h3 { color: var(--bucket); display: flex; align-items: center; gap: 8px; }
.count { font-size: .8rem; font-weight: 700; background: var(--bucket-line); color: var(--bucket-on); border-radius: 999px; padding: 1px 8px; }
.compare .bucket h3 { margin-bottom: 8px; }
.bucket h3 { margin-bottom: 8px; }
.items { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.item { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.item summary { list-style: none; cursor: pointer; padding: 9px 32px 9px 12px; min-height: 40px; position: relative; }
.item summary::-webkit-details-marker { display: none; }
.item summary::after { content: "+"; position: absolute; right: 12px; top: 9px; color: var(--muted); font-weight: 700; }
.item details[open] summary::after { content: "\2212"; }
.item-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.item-title { font-size: .95rem; font-weight: 600; }
.item-body { padding: 0 12px 10px; display: grid; gap: 6px; font-size: .9rem; }
.lbl { display: block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
/* "Possibly not needed" stays visible but quiet: small tags that open to full width. */
.b-not .items { display: flex; flex-wrap: wrap; gap: 6px; }
.b-not .item { border-radius: 999px; background: var(--surface); }
.b-not .item summary { padding: 4px 12px; min-height: 32px; }
.b-not .item summary::after { content: none; }
.b-not .item-title { font-size: .85rem; font-weight: 500; color: var(--not); }
.b-not .item:has(details[open]) { flex-basis: 100%; border-radius: 8px; background: var(--surface); }
.empty { color: var(--muted); font-size: .9rem; padding: 4px 2px; }

.badge { font-size: .72rem; font-weight: 700; border-radius: 999px; padding: 2px 8px; border: 1px solid currentColor; }
.badge.was { color: var(--muted); }
.badge.new { color: var(--new); }
.badge.upd { color: var(--do); }
.badge.drop { color: var(--new); text-decoration: line-through; }
.item.has-badge { border-color: var(--bucket-line); }
.item.flash { animation: flash 4s ease-out; }
@keyframes flash {
  0%, 35% { background: var(--flash); box-shadow: 0 0 0 3px var(--focus); }
  100% { background: var(--surface); box-shadow: 0 0 0 0 transparent; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .item.flash { animation: none; box-shadow: 0 0 0 3px var(--focus); }
}

/* Compare */
.compare-sum { font-weight: 600; margin-bottom: 10px; }
.compare-grid { display: grid; gap: 14px; }
.compare-col { display: grid; gap: 10px; align-content: start; min-width: 0; }
.compare-h { font-size: .95rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.compare .bucket { padding-top: 6px; }
.compare .item { padding: 6px 10px; }
.compare .item-title { font-size: .9rem; font-weight: 600; }

/* Resources inside an item */
.res ul { margin: 2px 0 0; padding-left: 1.1em; display: grid; gap: 4px; }
.res a { font-weight: 600; }
.res-note { color: var(--muted); font-size: .85rem; }

/* Guide me */
.guide-sheet { max-width: 680px; }
.guide-body { margin-top: 12px; }
.guide-step { display: grid; gap: 12px; }
.guide-step h3 { font-size: 1.15rem; }
.guide-count { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.guide-step progress { width: 100%; height: 6px; accent-color: var(--accent); }
.guide-q { border: 0; margin: 0; padding: 0; display: grid; gap: 12px; min-width: 0; }
.guide-q legend { font-family: var(--head-font); font-size: 1.35rem; font-weight: 700; line-height: 1.2; padding: 0; margin-bottom: 12px; }
.guide-why { background: var(--surface-2); border-left: 4px solid var(--brand-yellow); border-radius: 6px; padding: 10px 12px; }
.guide-opts { display: grid; gap: 8px; }
.guide-opt { position: relative; }
.guide-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.guide-opt label {
  display: grid; gap: 2px; padding: 12px 14px; border: 2px solid var(--border); border-radius: var(--radius);
  background: var(--surface); cursor: pointer;
}
.guide-opt label span { font-size: .9rem; color: var(--muted); }
.guide-opt input:checked + label { border-color: var(--accent); background: var(--do-bg); }
.guide-opt input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 2px; }
.guide-nav { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; margin-top: 4px; }
.guide-bucket { border-top: 4px solid var(--bucket-line, var(--border)); padding-top: 10px; display: grid; gap: 8px; }
.guide-bucket h4 { font-size: 1.05rem; color: var(--bucket, var(--text)); }
.guide-items { margin: 0; padding-left: 1.3em; display: grid; gap: 12px; }
.guide-items li { display: grid; gap: 4px; font-size: .92rem; }
.guide-items li > strong { font-size: 1rem; }
.guide-tags { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.guide-tags li { border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; font-size: .85rem; color: var(--not); }
.guide-qa { margin: 0; padding-left: 1.3em; display: grid; gap: 6px; font-size: .92rem; }
.guide-answer { font-weight: 700; }
.guide-disclaimer { font-size: .82rem; }

/* Challenges */
.challenges { display: grid; gap: 14px; margin-top: 12px; }
.challenge { border-top: 1px solid var(--border); padding-top: 12px; display: grid; gap: 8px; justify-items: start; align-content: start; }
.challenge details { font-size: .92rem; color: var(--muted); }
.challenge summary { cursor: pointer; font-weight: 600; color: var(--accent); min-height: 32px; }

.foot { margin-top: 18px; font-size: .8rem; color: var(--muted); display: grid; gap: 6px; text-align: center; }

/* Overlays: handoff card and challenges */
.overlay-open { overflow: hidden; }
.overlay {
  position: fixed; inset: 0; z-index: 50; background: rgba(10, 14, 20, .55);
  overflow-y: auto; padding: 12px;
}
.sheet {
  max-width: 780px; margin: 0 auto; background: var(--surface); color: var(--text);
  border-radius: var(--radius); padding: 18px var(--gutter);
}
.sheet-top { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card-note { font-size: .85rem; margin: 8px 0 14px; }
.card-fields { display: grid; gap: 12px; }
.card-field label { display: block; font-weight: 700; font-size: .9rem; margin-bottom: 4px; }
.card-field input, .card-field textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px;
}
.card-field textarea { min-height: 4.5em; resize: vertical; field-sizing: content; }
.card-meta { font-size: .85rem; color: var(--muted); }
.print-value { display: none; }
.card-foot { margin-top: 16px; font-size: .82rem; color: var(--muted); }

/* Passcode gate */
.gate { display: flex; flex-direction: column; min-height: 100vh; padding: 0 var(--gutter); background: linear-gradient(150deg, var(--bg), var(--surface)); }
.gate-box {
  width: 100%; max-width: 420px; margin: 12vh auto 24px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 24px 20px; display: grid; gap: 12px;
}
.gate-box form { display: grid; gap: 10px; }
.gate-box label { font-weight: 600; }
.gate-box input {
  font: inherit; font-size: 1.15rem; padding: 10px 12px; min-height: 48px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); color: var(--text);
}
.gate-error { color: var(--new); font-weight: 600; }
.gate-ended { font-size: 1.15rem; font-weight: 700; }
.gate-footer { text-align: center; color: var(--muted); font-size: .85rem; margin-top: auto; padding: 16px 0; }

/* Tablet and up */
@media (min-width: 640px) {
  .preset-row { flex-wrap: wrap; overflow: visible; }
  .top { flex-direction: row; justify-content: space-between; align-items: flex-start; }
  .compare-grid { grid-template-columns: 1fr 1fr; }
  .challenges { grid-template-columns: 1fr 1fr; }
}

/* Laptop / projector: controls left, results right, status sticks to the top of results */
@media (min-width: 1000px) {
  body { padding-bottom: 0; }
  h1 { font-size: 1.6rem; }
  .layout { grid-template-columns: minmax(340px, 4fr) 6fr; align-items: start; }
  .status {
    position: sticky; top: 0; left: auto; right: auto; bottom: auto; z-index: 5;
    margin: 0 0 12px; padding: 6px 0; box-shadow: none; border: 0; background: var(--bg);
    grid-template-columns: 1fr;
  }
  .status-jump, .status .meter { display: none; }
  .banner { font-size: .92rem; padding: 8px 12px; background: var(--surface); border-left: 3px solid var(--accent); border-radius: 6px; }
  .buckets { grid-template-columns: 1fr 1fr; align-items: start; gap: 18px 22px; }
  .layout { gap: 32px; }
}
@media (min-width: 1400px) {
  body { font-size: 17px; }
}

/* Print: only the handoff card */
@media print {
  :root { --surface: #fff; --text: #000; --muted: #444; --border: #999; }
  body { background: #fff; padding: 0; }
  body.overlay-open { overflow: visible; }
  .page, .status, #challenges { display: none !important; }
  .overlay { position: static; background: none; padding: 0; overflow: visible; }
  .sheet { max-width: none; padding: 0; border-radius: 0; }
  .card-actions, .card-note, .sheet-top .btn, .guide-nav { display: none !important; }
  .res a::after { content: " (" attr(href) ")"; font-weight: 400; font-size: .8em; word-break: break-all; }
  .guide-bucket, .guide-items li { break-inside: avoid; }
  .card-field input, .card-field textarea { display: none; }
  .print-value { display: block; white-space: pre-wrap; border-left: 3px solid #999; padding: 2px 0 2px 10px; }
  .card-field { break-inside: avoid; }
}

/* The gate page has side padding; let its brand stripe run edge to edge. */
.gate-topbar { margin: 0 calc(-1 * var(--gutter)); }

/* Keep the phone status bar out of the way while a panel is open. */
.overlay-open .status { visibility: hidden; }
.guide-step h3:focus { outline: none; }

/* "Select all that apply" (data question) */
.legend-note { font-weight: 400; font-size: .82rem; color: var(--muted); }
.opt input[type="checkbox"] + label::before { content: "\25A2"; margin-right: 6px; font-weight: 700; }
.opt input[type="checkbox"]:checked + label::before { content: "\2713"; }

.guide-sample { font-size: .9rem; color: var(--muted); }


/* Home screen: one link, two activities */
.home { max-width: 760px; margin: 0 auto; padding: 24px var(--gutter) 40px; display: grid; gap: 18px; }
.home h1 { font-size: 1.6rem; }
.home-cards { display: grid; gap: 14px; }
.home-card {
  display: grid; gap: 6px; padding: 20px; border-radius: var(--radius); text-decoration: none;
  background: var(--surface); color: var(--text); border: 2px solid var(--border);
}
.home-card:hover, .home-card:focus-visible { border-color: var(--accent); }
.home-card h2 { margin: 0; font-size: 1.35rem; color: var(--accent); }
.home-card p { color: var(--muted); }
.home-card .go { font-weight: 700; color: var(--accent); }
@media (min-width: 640px) { .home-cards { grid-template-columns: 1fr 1fr; } }
