:root {
  /* Aliased to the Figma token ramp in tokens.css (loaded before this file) */
  --primary: var(--color-indigo-600);
  --primary-dark: var(--color-indigo-800);
  --accent: var(--color-teal-500);
  --accent-dark: var(--color-teal-700);
  --text: var(--color-indigo-950);
  --muted: var(--color-gray-500);
  --bg: var(--color-neutral-50);
  --surface: var(--color-white);
  --border: var(--color-gray-200);
  --success: var(--color-green-600);
  --danger: var(--color-red-600);
  --radius: 14px;
  /* Emphasized-but-still-muted text (darker than --muted on light backgrounds);
     dark-mode values below flip that to lighter-than---muted, since "more
     emphasis" means moving away from the surface color in both directions. */
  --muted-strong: #4b5563;
  --muted-strongest: #374151;
  /* Link color: kept separate from --primary so link legibility can be tuned
     without touching every other use of --primary (borders, chip fills, etc). */
  --link: var(--primary);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --text: #ede9fe;
    --muted: #a5adc5;
    --bg: #14121f;
    --surface: #1d1a2e;
    --border: #322d4f;
    --muted-strong: #c4c8d4;
    --muted-strongest: #ede9fe;
    --link: #a5b4fc;
  }
}
:root[data-theme="dark"] {
  --text: #ede9fe;
  --muted: #a5adc5;
  --bg: #14121f;
  --surface: #1d1a2e;
  --border: #322d4f;
  --muted-strong: #c4c8d4;
  --muted-strongest: #ede9fe;
  --link: #a5b4fc;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Open Sans', 'Segoe UI', sans-serif;
  line-height: 1.5;
}

a { color: var(--link); }

.topbar {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.topbar-left { min-width: 0; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.15rem; }
.gh-link { font-size: 11px; white-space: nowrap; text-decoration: none; font-weight: 500; }
.gh-link:hover { text-decoration: underline; }
.topbar-inner .gh-link { align-self: flex-end; }
.topbar-intro { max-width: 66.67%; margin: 4px 0 0; padding: 0; color: var(--muted-strong); font-size: 12px; }
.topbar-inner .example-picker { flex-basis: 100%; margin-top: 10px; }

.layout {
  max-width: 960px;
  margin: 0 auto;
  padding: 28px 20px 60px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.card h2 { margin: 0 0 12px; font-size: 1.1rem; }

.example-picker { display: flex; gap: 8px; flex-wrap: wrap; margin: 0; }
.example-btn {
  font: inherit;
  font-weight: 600;
  font-size: 0.78rem;
  padding: 6px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  text-align: left;
}
.example-btn:hover { border-color: var(--primary); }
.example-btn.active { border-color: var(--primary); background: rgba(79,70,229,0.08); color: var(--link); }

.pipeline-details { margin-top: 0; }
.pipeline-details summary {
  cursor: pointer;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--muted-strongest);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.pipeline-details summary::-webkit-details-marker { display: none; }
.pipeline-details summary::before {
  content: "";
  order: 1;
  width: 5px;
  height: 5px;
  flex-shrink: 0;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
}
.pipeline-details[open] summary::before { transform: rotate(45deg); }
.pipeline-subline { margin: 10px 0 0; line-height: 1.5; }
.pipeline-step { margin-top: 28px; }
.pipeline-step h3 { font-size: 0.85rem; margin: 0 0 12px; color: var(--muted); }
.code-out {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  font-size: 0.78rem;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 260px;
  overflow-y: auto;
}

.preview-frame-wrap {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  padding: 16px;
}
.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.preview-header h2 { margin: 0; font-size: 0.9rem; font-weight: 700; }
#previewFrame {
  width: 100%;
  height: 200px;
  border: none;
  background: #fff;
  display: block;
  overflow: hidden;
}
#previewFrame[hidden] { display: none; }
.preview-empty {
  color: var(--muted);
  text-align: center;
  padding: 60px 20px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  margin: 0;
}

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
