/* Concepts page specific styles */
.concepts-main {
  max-width: 900px;
  margin: 0 auto;
  padding: 120px 24px 80px;
}

.concepts-main h1 {
  font-family: var(--mono);
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 500;
  margin-bottom: 16px;
}

.concepts-main > p.intro {
  color: var(--text-muted);
  font-size: var(--text-lead);
  margin-bottom: 48px;
  max-width: 600px;
}

/* Visualization container */
#viz-root {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: clip; /* clip avoids creating a scroll container; safer for WCAG 1.4.12 text-spacing overrides */
  margin-bottom: 48px;
}

/* Section nav buttons */
.section-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.section-btn {
  font-family: var(--mono);
  font-size: var(--text-xs);
  padding: 10px 16px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.3s ease;
  border-radius: 4px;
}

.section-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

.section-btn.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

/* Viz content area */
.viz-content {
  padding: 24px;
  min-height: 450px;
}

/* Zoom button sits on the content's own edges, level with the heading */
.viz-content > .zoom-btn {
  top: 24px;
  right: 24px;
}

.viz-content h2 {
  color: var(--text); /* one heading style for every section */
  padding-right: 52px; /* room for the zoom button */
  font-family: var(--mono);
  font-size: var(--text-sm);
  font-weight: 500;
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}

.viz-content .desc {
  color: var(--text-muted);
  font-size: var(--text-sm);
  margin-bottom: 20px;
}

/* Key insight box */
.key-insight-box {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 20px 24px;
  margin-top: 24px;
  text-align: center;
}

.key-insight-box .label {
  font-family: var(--mono);
  font-size: var(--text-xs);
  color: var(--accent);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.key-insight-box p {
  color: var(--text);
  font-size: var(--text-sm);
  margin: 0;
}

/* SVG interactive focus indicator */
g[role="button"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

g[role="button"]:focus-visible rect {
  stroke: var(--accent) !important;
  stroke-width: 3 !important;
}

/* Status text */
.status-text {
  font-family: var(--mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-align: center;
  margin-top: 16px;
}

/* Step controls — each diagram plays through once, then the reader steps */
.step-controls {
  margin-top: 16px;
}

.step-controls .status-text {
  font-size: var(--text-sm);
  color: var(--text);
  min-height: 3.2em; /* keeps the controls still as captions change length */
  line-height: 1.6;
  max-width: 56ch;
  margin: 0 auto 12px;
}

.step-buttons {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: var(--text-xs);
}

.step-buttons button {
  font: inherit;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 6px 12px;
  cursor: pointer;
}

.step-buttons button:hover:not(:disabled),
.step-buttons button:focus-visible {
  color: var(--text);
  border-color: var(--text);
}

.step-buttons button:disabled {
  opacity: 0.35;
  cursor: default;
}

.step-count {
  color: var(--text-muted);
  min-width: 3.5em;
  text-align: center;
}

.viz-note {
  font-family: var(--mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  max-width: 60ch;
  margin: 20px auto 0;
  line-height: 1.6;
}

.noscript-summary {
  max-width: 64ch;
  margin: 0 auto;
  padding-left: 20px;
  line-height: 1.7;
}
.noscript-summary li { margin-bottom: 12px; }

.step-buttons button { white-space: nowrap; }

@media (max-width: 600px) {
  /* Six sections in two short columns, so the diagram starts on screen
     instead of below a wall of buttons */
  .section-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 12px;
  }
  .section-btn {
    padding: 8px 10px;
    text-align: left;
    line-height: 1.3;
  }
  .viz-content { padding: 16px; min-height: 0; }
  .viz-content > .zoom-btn { top: 16px; right: 16px; }

  /* The diagrams keep their 650-wide viewBox; let the height follow the
     width instead of reserving 340px around a shrunken drawing. */
  .viz-content svg { height: auto; }
  .step-controls .status-text { font-size: var(--text-xs); min-height: 4.8em; }
  .step-buttons { gap: 6px; }
  .step-buttons button { padding: 6px 9px; }
}
