/* Pilot styles for the upgraded neuron lesson. Uses the site's existing variables. */
.viz {
  margin: 2rem 0;
  border: 1px solid var(--rule);
  background: #0f0e0d;
  padding: 0.75rem;
}
.viz svg { display: block; width: 100%; height: auto; }
.viz figcaption { padding: 0 0.25rem 0.25rem; }
.viz-wide { margin-left: 0; margin-right: 0; }

/* Diagram */
.nd-label { font-family: var(--font-chrome); font-size: 17px; fill: #E8E4DC; }
.nd-sub { font-family: var(--font-chrome); font-size: 13px; fill: #8E8A82; }
.nd-lead { stroke: #8E8A82; stroke-width: 1.2; fill: none; }
.nd-dot { fill: #E8E4DC; }
.part-key {
  list-style: none;
  padding: 0;
  margin: 0.9rem 0 0.2rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 0.35rem 1.25rem;
  font-family: var(--font-body);
  font-size: var(--size-small);
  color: var(--muted);
}
.part-key b { color: var(--paper); font-weight: 600; }

/* Controls shared by animation and 3D */
.viz-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 0.6rem 0 0.4rem;
}
.viz-btn {
  font-family: var(--font-chrome);
  font-size: var(--size-small);
  letter-spacing: 0.04em;
  background: transparent;
  color: var(--paper);
  border: 1px solid var(--rule);
  padding: 0.5rem 0.85rem;
  min-height: 44px;
  min-width: 44px;
  cursor: pointer;
  border-radius: 2px;
}
.viz-btn:hover { border-color: var(--dust); color: var(--dust); }
.viz-btn[aria-pressed="true"] { border-color: var(--paper); background: rgba(232,228,220,0.08); }
.viz-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.step-readout {
  margin: 0.4rem 0 0;
  min-height: 4.6em;
  font-family: var(--font-body);
  font-size: var(--size-small);
  line-height: 1.45;
  color: var(--muted);
}
.step-readout strong { color: var(--paper); font-weight: 600; display: block; font-family: var(--font-chrome); letter-spacing: 0.04em; }
.step-dots { display: flex; gap: 6px; margin: 0.35rem 0 0; flex-wrap: wrap; }
.step-dot {
  width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--rule); background: transparent; color: var(--muted);
  font-family: var(--font-chrome); font-size: 12px; cursor: pointer; padding: 0;
}
.step-dot.is-on { border-color: var(--dust); color: var(--bg); background: var(--dust); }
.step-dot:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.an-label { font-family: var(--font-chrome); font-size: 15px; fill: #8E8A82; }
.an-label-strong { font-family: var(--font-chrome); font-size: 15px; fill: #E8E4DC; }
.an-axis { font-family: var(--font-chrome); font-size: 12px; fill: #8E8A82; }

/* 3D */
.n3d-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: radial-gradient(ellipse at 50% 40%, #1b1916 0%, #0b0b0b 75%);
  overflow: hidden;
  touch-action: none;
}
@media (max-width: 640px) { .n3d-stage { aspect-ratio: 4 / 5; } }
.n3d-stage canvas { display: block; width: 100%; height: 100%; outline: none; }
.n3d-stage canvas:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.n3d-tag {
  position: absolute;
  transform: translate(-50%, -130%);
  pointer-events: none;
  font-family: var(--font-chrome);
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--bg);
  background: var(--paper);
  padding: 3px 8px;
  border-radius: 2px;
  white-space: nowrap;
  display: none;
}
.n3d-tag::after {
  content: ""; position: absolute; left: 50%; bottom: -5px; margin-left: -5px;
  border: 5px solid transparent; border-bottom: 0; border-top-color: var(--paper);
}
.n3d-hint {
  position: absolute; left: 0.75rem; bottom: 0.6rem; right: 0.75rem;
  font-family: var(--font-chrome); font-size: 12px; color: var(--muted); pointer-events: none;
}
.n3d-loading {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-chrome); font-size: var(--size-small); color: var(--muted);
}
.n3d-info {
  margin: 0.6rem 0 0;
  padding: 0.75rem 0.9rem;
  border-left: 2px solid var(--dust);
  background: rgba(232,228,220,0.03);
  min-height: 5.5em;
}
.n3d-info h3 { font-size: 1.2rem; margin: 0 0 0.3rem; }
.n3d-info p { margin: 0; color: var(--muted); font-family: var(--font-body); font-size: var(--size-small); line-height: 1.5; }
.n3d-parts { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.6rem 0 0; }
.n3d-parts .viz-btn { font-size: 0.8rem; padding: 0.4rem 0.65rem; min-height: 40px; }

.check { margin: 2.25rem 0 0; max-width: 38rem; }
.check details { border-bottom: 1px solid var(--rule); padding: 0.6rem 0; }
.check summary { cursor: pointer; color: var(--paper); font-family: var(--font-body); font-size: var(--size-body); }
.check details p { color: var(--muted); margin: 0.5rem 0 0.2rem; }
.check summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.prose ul.plain { margin: 0.75rem 0 0 1.1rem; color: var(--muted); }
.prose ul.plain li { margin: 0.35rem 0; }
.prose h3 { margin: 1.6rem 0 0.4rem; font-size: 1.3rem; }
@media (prefers-reduced-motion: reduce) {
  .viz * { transition: none !important; }
}
/* The longer glossary would be clipped if sticky, so let it scroll with the page in this lesson. */
.page-article .sidenotes.long { position: static; }
.an-dark { font-family: var(--font-chrome); font-size: 15px; fill: #2b251c; }
.an-dark-sm { font-family: var(--font-chrome); font-size: 12px; fill: #3d3528; }
.diagram-hint { display: none; }
@media (max-width: 640px) {
  .diagram-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .diagram-scroll svg { min-width: 720px; }
  .diagram-hint { display: block; margin: 0.35rem 0 0; font-family: var(--font-chrome); font-size: var(--size-label); color: var(--muted); }
}
.diagram-scroll:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
/* Animation: stacked panels on narrow screens */
#ap-anim { position: relative; }
.ap-stack { display: none; }
#ap-anim.is-narrow > svg { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
#ap-anim.is-narrow .ap-stack { display: block; }
.ap-stack svg { display: block; width: 100%; height: auto; margin: 0 0 0.5rem; }
#ap-anim.is-narrow .an-top { font-size: 27px; }
.diagram-video { margin: 0.2rem 0 0.4rem; font-family: var(--font-chrome); font-size: var(--size-small); }
.diagram-video a { color: var(--paper); text-decoration: underline; text-underline-offset: 3px; }
.step-readout sup { font-size: 0.7em; }
/* Let the article column shrink on phones so wide figures scroll inside their own box instead of widening the page. */
.page-article .article-col { min-width: 0; }
/* Listen to this article: same rules as assets/verse-popup.css so lesson pages match the article player without loading that file. */
.listen-article {
  margin: 0 0 1.75rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--rule);
  background: var(--bg-band);
  max-width: 42rem;
}
.listen-article-label {
  display: block;
  margin: 0 0 0.45rem;
  font-family: var(--font-chrome);
  font-size: var(--size-small);
  letter-spacing: 0.04em;
  color: var(--dust);
}
.listen-article audio { display: block; width: 100%; height: 40px; color-scheme: dark; }
.listen-article-meta { margin: 0.4rem 0 0; font-size: 0.8rem; color: var(--muted); }
/* 3D neuron: loading indicator and fallback */
#n3d-stage .n3d-loading { z-index: 2; padding: 1rem; text-align: center; }
.n3d-load { display: flex; flex-direction: column; align-items: center; gap: 0.6rem; }
.n3d-bar { display: block; width: 11rem; max-width: 60vw; height: 3px; background: rgba(232,228,220,0.12); border-radius: 2px; overflow: hidden; }
.n3d-bar span { display: block; height: 100%; width: 4%; background: var(--dust); transition: width 0.2s linear; }
#n3d-stage .n3d-loading.n3d-failed { color: var(--paper); line-height: 1.5; }
@media (prefers-reduced-motion: reduce) { .n3d-bar span { transition: none; } }
