/* ==========================================================================
   Step-through physiology scenes (components/neuro-steps.js)

   Tabs for a set of scenes, the drawing (a live SVG, so it stays sharp),
   and under it the step's part, count, heading and explanation, Back,
   Replay and Next, chips to jump to a part, and the note with sources.
   ========================================================================== */

.nsteps {
  margin: 1.25rem 0;
  max-width: 920px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md, 16px);
  background: var(--surface-1);
  color: var(--text-color);
  overflow: hidden;
}
.nsteps:focus { outline: none; }
.nsteps:focus-visible { outline: 2px solid var(--accent-color); outline-offset: 2px; }

.nsteps-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.5rem 0.5rem 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.nsteps-tabs::-webkit-scrollbar { display: none; }
.nsteps-tab {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 40px;
  padding: 0.4rem 0.85rem 0.4rem 0.45rem;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}
.nsteps-tab:hover { background: var(--surface-2); color: var(--text-color); }
.nsteps-tab[aria-selected="true"] { border-color: var(--border-color); background: var(--surface-2); color: var(--text-color); }
.nsteps-tab-n {
  display: inline-grid;
  place-items: center;
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 50%;
  background: var(--surface-3, var(--surface-2));
  font-size: 0.75rem;
}
.nsteps-tab[aria-selected="true"] .nsteps-tab-n { background: var(--accent-color); color: #fff; }

/* the drawing: the scene's own light colors in both themes, like a figure */
.nsteps-stage {
  position: relative;
  margin: 0.5rem 0.5rem 0;
  aspect-ratio: 1920 / 932;
  border-radius: 12px;
  overflow: hidden;
  background: #f1f1f7;
  cursor: pointer;
}
.nsteps-svg { display: block; width: 100%; height: 100%; }
.nsteps-svg .k-band { display: none; }
/* the scene kit's text styles, kept to the drawing */
.nsteps-svg text { font-family: Inter, "DejaVu Sans", sans-serif; }
.nsteps-svg .tnum { font-feature-settings: "tnum" 1; }
.nsteps-svg .k-ion-label { fill: #fff; font-weight: 700; paint-order: stroke; stroke: rgba(20, 10, 30, .28); stroke-width: 2.2px; stroke-linejoin: round; }
.nsteps-svg .halo { paint-order: stroke; stroke: #fff; stroke-width: 7px; stroke-linejoin: round; }
.nsteps-svg .halo-ecf { paint-order: stroke; stroke: #e6f2fc; stroke-width: 7px; stroke-linejoin: round; }
.nsteps-svg .halo-cyto { paint-order: stroke; stroke: #fdf0e1; stroke-width: 7px; stroke-linejoin: round; }
.nsteps-svg .caps { letter-spacing: .12em; text-transform: uppercase; }
/* the hand-drawn style (kit.js sketch mode): white paper, Caveat lettering in ink */
.nsteps.is-sketch .nsteps-stage { background: #fff; }
.nsteps-svg.is-sketch text { font-family: Caveat, "Segoe Print", "Bradley Hand", cursive; }
.nsteps-svg.is-sketch .k-ion-label { fill: #292332; stroke: none; font-weight: 700; }
.nsteps-svg.is-sketch .halo, .nsteps-svg.is-sketch .halo-ecf, .nsteps-svg.is-sketch .halo-cyto { stroke-width: 8px; }

.nsteps-panel { padding: 0.85rem 1rem 0.9rem; }
.nsteps-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.25rem 1rem; align-items: baseline; }
.nsteps-chapter { color: var(--accent-color); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }
.nsteps-count { color: var(--text-secondary); font-size: 0.82rem; font-variant-numeric: tabular-nums; }
.nsteps-bar { height: 4px; margin: 0.45rem 0 0.7rem; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.nsteps-bar-fill { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--accent-color); transition: width 200ms ease; }
.nsteps-words { min-height: 4.9rem; }
.nsteps-key { margin: 0; font-size: 1.08rem; font-weight: 700; line-height: 1.4; }
.nsteps-text { margin: 0.3rem 0 0; color: var(--text-secondary); font-size: 0.95rem; line-height: 1.6; }
.nsteps-words sup, .nsteps-words sub, .nsteps-chapter sup, .nsteps-chapter sub, .nsteps-chip sup, .nsteps-tab sup { font-size: 0.68em; line-height: 0; }

.nsteps-nav { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-top: 0.8rem; }
.nsteps-btn {
  min-height: 40px;
  padding: 0.35rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: var(--surface-1);
  color: var(--text-color);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 650;
  cursor: pointer;
}
.nsteps-btn:hover:not(:disabled) { background: var(--surface-2); }
.nsteps-btn:disabled { opacity: 0.45; cursor: default; }
.nsteps-next { margin-left: auto; min-width: 7.5rem; border-color: transparent; background: var(--accent-color); color: #fff; }
.nsteps-next:hover:not(:disabled) { background: var(--accent-color); filter: brightness(1.08); }
body.dark .nsteps-next { color: #1d1726; }

.nsteps-chapters { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.8rem; }
.nsteps-chip {
  min-height: 32px;
  padding: 0.2rem 0.7rem;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}
.nsteps-chip:hover { background: var(--surface-2); color: var(--text-color); }
.nsteps-chip.is-current { border-color: color-mix(in srgb, var(--accent-color) 55%, var(--border-color)); color: var(--text-color); background: var(--surface-2); }

.nsteps-tab:focus-visible, .nsteps-btn:focus-visible, .nsteps-chip:focus-visible { outline: 2px solid var(--accent-color); outline-offset: 2px; }

.nsteps-note { padding: 0.65rem 1rem 0.85rem; border-top: 1px solid var(--border-color); color: var(--text-secondary); font-size: 0.82rem; line-height: 1.55; }
.nsteps-sources a { color: var(--accent-color); }

@media (max-width: 600px) {
  .nsteps-panel { padding: 0.75rem 0.8rem 0.8rem; }
  .nsteps-btn { padding: 0.35rem 0.8rem; }
  .nsteps-again { order: 3; }
  .nsteps-next { min-width: 6rem; }
}
@media (prefers-reduced-motion: reduce) {
  .nsteps-bar-fill { transition: none; }
}

/* Full screen: the drawing as large as the screen allows, the step under it,
   or beside it on a phone turned sideways. */
.nsteps-full {
  position: absolute;
  right: 0.55rem;
  top: 0.55rem;
  min-height: 32px;
  padding: 0.2rem 0.75rem;
  border: 1px solid rgba(35, 29, 46, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #231d2e;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 650;
  cursor: pointer;
  opacity: 0.85;
}
.nsteps-full:hover, .nsteps-full:focus-visible { opacity: 1; }
.nsteps-full:focus-visible { outline: 2px solid var(--accent-color); outline-offset: 2px; }
html.nsteps-open { overflow: hidden; }
.nsteps.is-full {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  max-width: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: var(--bg-color, var(--surface-1));
  overflow: auto;
}
.nsteps.is-full .nsteps-tabs { grid-row: 1; }
.nsteps.is-full .nsteps-stage { grid-row: 2; aspect-ratio: auto; min-height: 0; margin: 0.5rem; }
.nsteps.is-full .nsteps-panel { grid-row: 3; width: 100%; max-width: 980px; margin: 0 auto; }
.nsteps.is-full .nsteps-note { display: none; }
.nsteps:fullscreen { width: 100%; height: 100%; }
@media (orientation: landscape) and (max-height: 560px) {
  .nsteps.is-full { grid-template-columns: minmax(0, 1fr) minmax(220px, 32%); grid-template-rows: auto minmax(0, 1fr); }
  .nsteps.is-full .nsteps-tabs { grid-column: 1 / -1; }
  .nsteps.is-full .nsteps-stage { grid-row: 2; grid-column: 1; margin: 0.4rem 0 0.4rem 0.4rem; }
  .nsteps.is-full .nsteps-panel { grid-row: 2; grid-column: 2; overflow: auto; padding: 0.5rem 0.7rem; }
  .nsteps.is-full .nsteps-chapters { display: none; }
  .nsteps.is-full .nsteps-words { min-height: 0; }
  .nsteps.is-full .nsteps-key { font-size: 0.98rem; }
  .nsteps.is-full .nsteps-text { font-size: 0.86rem; line-height: 1.5; }
  .nsteps.is-full .nsteps-again { display: none; }
}
@media (max-width: 600px) {
  .nsteps-full { font-size: 0.72rem; padding: 0.15rem 0.6rem; min-height: 28px; right: 0.4rem; top: 0.4rem; }
}
.nsteps-turn { display: none; margin: 0 0.6rem; color: var(--text-secondary); font-size: 0.82rem; text-align: center; }
@media (orientation: portrait) and (max-width: 600px) {
  .nsteps.is-full .nsteps-turn { display: block; grid-row: 3; }
  .nsteps.is-full .nsteps-panel { grid-row: 4; }
  .nsteps.is-full { grid-template-rows: auto minmax(0, 1fr) auto auto; }
}
