/* ============================================================
   aidokit scenario picker — interactive walkthrough styles
   Palette aligned with docs-site/assets/style.css
   (slate + blue accent, no webfonts)
   ============================================================ */

:root {
  --bg: #ffffff;
  --card-bg: #f8fafc;
  --card-border: #cbd5e1;
  --primary: #2563eb;
  --primary-bg-light: #eff6ff;
  --primary-dark: #1d4ed8;
  --text: #0f172a;
  --muted: #475569;
  --success: #047857;
  --danger: #b91c1c;
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 2px 4px rgba(15, 23, 42, 0.05);
  --shadow-hover: 0 4px 8px rgba(15, 23, 42, 0.08), 0 8px 16px rgba(15, 23, 42, 0.07);
}

/* 1. Global reset */
*, *::before, *::after { box-sizing: border-box; }
html, body, h1, h2, h3, h4, p, ol, ul, li, figure, blockquote {
  margin: 0;
  padding: 0;
}
body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

main#picker {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px 64px;
}

/* 2. Site header */
.site-header {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 16px;
  text-align: center;
}
.site-header h1 {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 16px 0 8px;
  color: var(--text);
}
.site-header .lede {
  font-size: 1.125rem;
  color: var(--muted);
  line-height: 1.55;
}
.site-home {
  display: inline-block;
  font-size: 0.875rem;
  color: var(--muted);
  text-align: left;
  float: left;
}
.site-home:hover { color: var(--primary); text-decoration: none; }

/* 3. Site footer */
.site-footer {
  text-align: center;
  padding: 32px;
  font-size: 0.875rem;
  color: var(--muted);
  border-top: 1px solid var(--card-border);
  margin-top: 48px;
}
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--primary); }

/* shared lede inside views */
.lede {
  font-size: 1.125rem;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 16px;
}

/* section spacing */
#question-view, #playbook-view { padding-top: 16px; }
#scenario-title, #playbook-title {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 8px 0 8px;
}

/* 4. Scenario list grid */
[hidden] { display: none !important; }
#scenario-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 16px;
}

/* 5. Scenario card */
.scenario-card {
  display: block;
  width: 100%;
  text-align: left;
  padding: 20px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  background: var(--card-bg);
  cursor: pointer;
  font-family: var(--font-sans);
  color: var(--text);
  box-shadow: var(--shadow);
  transition: box-shadow 120ms ease, border-color 120ms ease, transform 120ms ease;
}
.scenario-card:hover {
  box-shadow: var(--shadow-hover);
  border-color: var(--primary);
  transform: translateY(-1px);
}
.scenario-card:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.scenario-card .icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 8px;
  line-height: 1;
}
.scenario-card h3 {
  margin: 0 0 6px;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text);
}
.scenario-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.5;
}

/* 6. Progress chips */
#progress {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 24px 0;
}
#progress li {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.875rem;
  background: var(--card-bg);
  color: var(--muted);
  border: 1px solid var(--card-border);
  list-style: none;
}
#progress li.active {
  background: var(--primary-bg-light);
  color: var(--primary-dark);
  border-color: var(--primary);
  font-weight: 600;
}
#progress li.done {
  background: #ecfdf5;
  color: var(--success);
  border-color: var(--success);
}

/* 7. Question card */
#question-card {
  max-width: 600px;
  margin: 0 auto;
  padding: 32px;
  border: 1px solid var(--card-border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  background: var(--card-bg);
  box-shadow: var(--shadow);
}
#question-card h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 16px;
  color: var(--text);
}

/* 8. Option buttons */
.option-button {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  margin-bottom: 8px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  background: var(--bg);
  cursor: pointer;
  text-align: left;
  font-family: var(--font-sans);
  font-size: 1rem;
  color: var(--text);
  transition: border-color 100ms ease, background 100ms ease;
}
.option-button:hover {
  border-color: var(--primary);
  background: var(--primary-bg-light);
}
.option-button:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.option-button .option-hint {
  font-size: 0.875rem;
  color: var(--muted);
  margin-left: 16px;
  flex-shrink: 0;
}

/* 9. Playbook steps */
#playbook-steps {
  padding-left: 24px;
  margin: 24px 0;
}
#playbook-steps li {
  margin-bottom: 24px;
}
#playbook-steps li > h3 {
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--text);
}
#playbook-steps li .note {
  background: var(--primary-bg-light);
  padding: 10px 12px;
  border-left: 3px solid var(--primary);
  font-size: 0.9375rem;
  margin: 8px 0;
  border-radius: 0 4px 4px 0;
  color: var(--text);
}

/* 10. Command block */
pre.cmd {
  position: relative;
  padding: 16px 48px 16px 16px;
  background: #0f172a;
  color: #e2e8f0;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  border-radius: var(--radius);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 8px 0;
  line-height: 1.55;
}

/* 11. Copy button (inside pre.cmd) */
pre.cmd .copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 8px;
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: background 100ms ease;
}
pre.cmd .copy-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* 12. Playbook links */
#playbook-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 24px;
}
#playbook-links a {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  background: var(--card-bg);
  color: var(--text);
  text-decoration: none;
  transition: border-color 100ms ease, background 100ms ease;
}
#playbook-links a:hover {
  border-color: var(--primary);
  background: var(--primary-bg-light);
  text-decoration: none;
}

/* 13. Actions */
.actions {
  display: flex;
  flex-direction: row;
  gap: 12px;
  margin-top: 32px;
  justify-content: flex-end;
}
.actions button {
  padding: 10px 20px;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  transition: background 100ms ease, border-color 100ms ease, color 100ms ease;
}
#copy-share {
  background: var(--primary);
  color: white;
  border: none;
}
#copy-share:hover {
  background: var(--primary-dark);
}
#restart {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--card-border);
}
#restart:hover {
  background: var(--card-bg);
  border-color: var(--muted);
}

/* 14. Back button */
.back-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 0.875rem;
  padding: 8px 0;
  cursor: pointer;
  font-family: var(--font-sans);
  margin-bottom: 8px;
}
.back-btn:hover { color: var(--primary); }

/* 15. Mobile */
@media (max-width: 720px) {
  #scenario-list {
    grid-template-columns: 1fr;
  }
  #question-card {
    max-width: 100%;
    padding: 20px;
  }
  .site-header {
    padding: 16px;
  }
  .site-header h1 { font-size: 1.75rem; }
  .actions {
    flex-direction: column;
  }
  .actions button {
    width: 100%;
  }
  .option-button {
    flex-direction: column;
    align-items: flex-start;
  }
  .option-button .option-hint {
    margin: 6px 0 0;
  }
}

/* 17. Multi-select chips + text input (schema v2) */
.question-prompt { margin: 0 0 8px; font-size: 1.25rem; font-weight: 700; }
.question-help { color: var(--muted); margin: 0 0 8px; font-size: 0.9375rem; }

.multi-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}
.chip {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  background: var(--bg);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  text-align: left;
  color: var(--text);
  transition: border-color 120ms ease, background 120ms ease;
}
.chip:hover { border-color: var(--primary); background: var(--primary-bg-light); }
.chip:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.chip[aria-pressed="true"] {
  border-color: var(--primary);
  background: var(--primary-bg-light);
  font-weight: 600;
}
.chip .chip-check { visibility: hidden; color: var(--primary); font-weight: 700; }
.chip[aria-pressed="true"] .chip-check { visibility: visible; }
.chip .chip-label { flex: 1; }
.chip .chip-hint { color: var(--muted); font-size: 0.8125rem; }

.multi-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 24px;
  gap: 16px;
}
.multi-counter { color: var(--muted); font-size: 0.875rem; margin: 0; }
.multi-counter.flash-error { color: var(--danger); animation: flash 0.6s ease; }
@keyframes flash {
  0%, 100% { transform: translateX(0); }
  30% { transform: translateX(-4px); }
  60% { transform: translateX(4px); }
}

.primary-btn {
  padding: 10px 20px;
  border-radius: var(--radius);
  border: none;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  transition: background 120ms ease;
}
.primary-btn:hover:not(:disabled) { background: var(--primary-dark); }
.primary-btn:disabled { opacity: 0.5; cursor: not-allowed; }

input[type="text"].text-q {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  margin-top: 16px;
}
input[type="text"].text-q:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-bg-light);
}

/* 16. Print */
@media print {
  .actions,
  #progress,
  .back-btn,
  pre.cmd .copy-btn,
  .copy-btn,
  .site-home,
  .site-footer {
    display: none !important;
  }
  body { background: white; color: black; }
  pre.cmd {
    background: #f5f5f5 !important;
    color: #111 !important;
    border: 1px solid #ccc;
    white-space: pre-wrap;
  }
  .scenario-card, #question-card, #playbook-links a {
    box-shadow: none;
    border: 1px solid #ccc;
    background: white;
  }
}

/* Per-question contextual diagram */
.q-diagram {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--card-border);
}
.q-diagram > summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--muted);
  padding: 4px 0;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
.q-diagram > summary::-webkit-details-marker { display: none; }
.q-diagram > summary::before {
  content: "▸";
  display: inline-block;
  transition: transform 0.15s ease;
  font-size: 0.75rem;
}
.q-diagram[open] > summary::before { transform: rotate(90deg); }
.q-diagram .mermaid {
  margin: 12px 0 8px;
  overflow-x: auto;
  max-width: 100%;
}
.q-diagram .caption {
  font-size: 0.875rem;
  color: var(--muted);
  margin: 8px 0 0;
}

/* Path preview at top of question + playbook views */
.path-preview {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 0 0 24px;
}
.path-preview-title {
  margin: 0 0 12px;
  font-size: 0.9375rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.path-preview .mermaid {
  margin: 0;
  overflow-x: auto;
  max-width: 100%;
}

/* Current-step highlight inside the path preview SVG */
.path-current rect,
.path-current polygon,
.path-current circle,
.path-current ellipse {
  stroke-width: 3px !important;
  filter: drop-shadow(0 0 6px rgba(37, 99, 235, 0.45));
}
.path-current > rect,
.path-current > polygon { transition: filter 0.2s ease; }

/* Time chip on playbook step header */
#playbook-steps > li > .step-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.time-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--card-bg);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}

/* Step details (expandable) */
.step-details {
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
}
.step-details > summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--muted);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
.step-details > summary::-webkit-details-marker { display: none; }
.step-details > summary::before {
  content: "▸";
  font-size: 0.7rem;
  transition: transform 0.15s ease;
}
.step-details[open] > summary::before { transform: rotate(90deg); }
.step-details .details-why {
  margin: 12px 0 8px;
  font-size: 0.9375rem;
}
.step-details .step-mermaid {
  margin: 12px 0;
  overflow-x: auto;
}
.step-details .details-expected {
  margin: 8px 0;
  font-size: 0.875rem;
  font-style: italic;
  color: var(--muted);
}
.step-details .details-expected .label {
  font-style: normal;
  font-weight: 600;
  color: var(--text);
}
.step-details .details-links {
  margin: 8px 0 0;
  padding-left: 20px;
  font-size: 0.875rem;
}
.step-details .details-links li { margin: 4px 0; }

/* ---------- File-tree preview ---------- */
.file-tree-preview { margin-top: 32px; }
.file-tree-title { margin: 0 0 12px; font-size: 1rem; color: var(--muted); font-weight: 600; }
.file-tree {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.55;
  overflow-x: auto;
  white-space: pre;
  color: var(--text);
}
.file-tree code { font-family: inherit; }

/* ---------- Step-done checkboxes ---------- */
.step-done {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.8125rem; color: var(--muted);
  cursor: pointer; margin: 8px 0;
  user-select: none;
}
.step-done input[type="checkbox"] { cursor: pointer; }

#playbook-steps > li.step-done-checked > .step-header > h3 {
  text-decoration: line-through;
  color: var(--muted);
}
#playbook-steps > li.step-done-checked {
  opacity: 0.6;
}

/* ---------- Share-summary overlay ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.overlay[hidden] { display: none; }
.overlay-backdrop {
  position: absolute; inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
}
.overlay-card {
  position: relative;
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hover);
  max-width: 720px;
  width: 100%;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 24px 24px 20px;
}
.overlay-close {
  position: absolute; top: 12px; right: 12px;
  background: transparent; border: none; cursor: pointer;
  color: var(--muted); font-size: 1.25rem; line-height: 1;
  padding: 4px 8px;
}
.overlay-close:hover { color: var(--text); }
.overlay-card h3 { margin: 0 0 16px; padding-right: 32px; }
#share-text {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 0 0 16px;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.55;
  max-height: 50vh;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
