/* ============================================================
   HCSteps - the shared step player's layout (js/hc-steps.js).
   v2.59.0 (moved out of css/brain-3d.css when "Inside a muscle"
   became the second step-through figure)

   The player sits inside a page's own dark stage frame. Desktop: the
   stage on the left, the panel (Play/Pause, step buttons, caption) on
   the right, a "not to scale" caption across the bottom. Below 1000px
   the panel drops under the stage; below 640px the step buttons go
   two-up and the caption stays under the scene.

   THEMING - a page sets these on .hcsp-root (or an ancestor) to give
   the player its own palette; the defaults are the brain's night
   stage, which every figure in the family shares in spirit. Every text
   pair here is checked for WCAG AA by the page's test suite.
   ============================================================ */
.hcsp-root {
  --sp-line: rgba(185, 174, 242, .16);
  --sp-text: #F3F1FC;
  --sp-text-2: #C9C3EA;
  --sp-text-3: #A49CCF;
  --sp-acc: #B9AEF2;              /* step numbers, the "Step n of N" kicker */
  --sp-ink: #0E0B26;              /* text on the current step's number disc */
  --sp-ease: cubic-bezier(.25, 1, .5, 1);
  --sp-grid: rgba(185, 174, 242, .05);
  --sp-glass: rgba(14, 11, 38, .6);
  --sp-tog-hover: rgba(123, 107, 208, .3);
  --sp-tog-hover-line: rgba(185, 174, 242, .4);
  --sp-tog-on: rgba(123, 107, 208, .38);
  --sp-tog-on-line: rgba(185, 174, 242, .55);
  --sp-n-line: rgba(185, 174, 242, .45);
  --sp-cur: rgba(123, 107, 208, .26);
  --sp-cur-line: rgba(185, 174, 242, .62);
  --sp-hi: #FFE3A6;               /* Play button + caption link */
  --sp-hi-line: rgba(255, 200, 100, .5);
  --sp-hi-bg: rgba(255, 200, 100, .1);
  --sp-hi-bg-2: rgba(255, 200, 100, .2);
  --sp-hi-line-2: rgba(255, 200, 100, .75);
  --sp-hi-ul: rgba(255, 227, 166, .45);
  --sp-rule: linear-gradient(#9A8CE0, #FFC864 55%, #4FCAD8);
  --sp-h: clamp(460px, 40vw, 560px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  grid-template-areas: "stage side" "cap cap";
  align-items: stretch;
}

/* ---------- stage ---------- */
.hcsp-stage {
  grid-area: stage;
  position: relative;
  height: var(--sp-h);
  min-width: 0;
  overflow: hidden;
  border-radius: 28px 0 0 0;
}
/* faint survey grid - CSS only, sits behind the model */
.hcsp-stage::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--sp-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--sp-grid) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(65% 65% at 50% 50%, #000 30%, transparent 75%);
          mask-image: radial-gradient(65% 65% at 50% 50%, #000 30%, transparent 75%);
  pointer-events: none;
}
.hcsp-gl, .hcsp-2d { position: absolute; inset: 0; }
.hcsp-gl { opacity: 0; touch-action: pan-y; transition: opacity .9s var(--sp-ease); }
.hcsp-root[data-mode="3d"] .hcsp-gl { opacity: 1; }
.hcsp-root[data-mode="3d"] .hcsp-2d { opacity: 0; visibility: hidden; }
.hcsp-root[data-mode="2d"] .hcsp-gl { visibility: hidden; }
.hcsp-gl > canvas { display: block; touch-action: pan-y; -webkit-tap-highlight-color: transparent; }
.hcsp-2d { display: flex; align-items: center; justify-content: center; padding: 1.5rem 1rem; transition: opacity .6s var(--sp-ease); }

/* the view switch (HCViewSwitch, styled below) sits in the stage's top-right corner */
.hcsp-toggle { position: absolute; top: 1rem; right: 1rem; z-index: 3; }
.hcsp-root {
  --vs-glass: var(--sp-glass);
  --vs-line: var(--sp-line);
  --vs-text: var(--sp-text-2);
  --vs-text-hover: var(--sp-text);
  --vs-hover: var(--sp-tog-hover);
  --vs-on: var(--sp-acc);
  --vs-on-ink: var(--sp-ink);
}

/* ---------- side panel: controls + caption ---------- */
.hcsp-side {
  grid-area: side;
  display: flex; flex-direction: column; gap: 1.6rem;
  padding: 2rem 2rem 1.6rem 1.6rem;
  border-left: 1px solid var(--sp-line);
  min-width: 0;
}
.hcsp-ctrl { display: flex; flex-direction: column; gap: .85rem; }
.hcsp-play {
  align-self: flex-start;
  display: inline-flex; align-items: center; gap: .6rem;
  min-height: 44px; padding: 0 1.15rem 0 .95rem;
  border-radius: 999px;
  border: 1px solid var(--sp-hi-line);
  background: var(--sp-hi-bg);
  color: var(--sp-hi);
  font: 600 .84rem/1 'Inter', system-ui, sans-serif;
  letter-spacing: .01em;
  cursor: pointer;
  transition: background .35s var(--sp-ease), border-color .35s var(--sp-ease), transform .35s var(--sp-ease);
}
.hcsp-play:hover { background: var(--sp-hi-bg-2); border-color: var(--sp-hi-line-2); }
.hcsp-play:active { transform: translateY(1px); }
.hcsp-play-ic { width: 12px; height: 12px; display: inline-block; flex: none; }
.hcsp-play[data-state="paused"] .hcsp-play-ic { width: 0; height: 0; border-left: 10px solid currentColor; border-top: 6px solid transparent; border-bottom: 6px solid transparent; margin-left: 2px; }
.hcsp-play[data-state="playing"] .hcsp-play-ic { width: 11px; border-left: 3.5px solid currentColor; border-right: 3.5px solid currentColor; }
.hcsp-steps { display: grid; grid-template-columns: 1fr; gap: .45rem; }
.hcsp-step {
  display: flex; align-items: center; gap: .7rem;
  min-height: 44px; padding: .45rem .8rem .45rem .55rem;
  border-radius: 12px;
  border: 1px solid var(--sp-line);
  background: rgba(255, 255, 255, .03);
  color: var(--sp-text-2);
  font: 500 .86rem/1.25 'Inter', system-ui, sans-serif;
  text-align: left;
  cursor: pointer;
  transition: background .35s var(--sp-ease), border-color .35s var(--sp-ease), color .35s var(--sp-ease), transform .35s var(--sp-ease);
}
.hcsp-step:hover { background: rgba(255, 255, 255, .07); color: var(--sp-text); transform: translateY(-1px); }
.hcsp-step-n {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  font: 600 .74rem/1 var(--c-mono, ui-monospace, monospace);
  border: 1px solid var(--sp-n-line);
  color: var(--sp-acc);
}
.hcsp-step[aria-current="step"] { color: var(--sp-text); background: var(--sp-cur); border-color: var(--sp-cur-line); }
.hcsp-step[aria-current="step"] .hcsp-step-n { background: var(--sp-acc); border-color: transparent; color: var(--sp-ink); }
.hcsp-step:focus-visible, .hcsp-play:focus-visible, .hcsp-cap-a:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.hcsp-root .hcsp-cap { position: relative; padding-left: 1.1rem; min-height: 10.5rem; }
.hcsp-root .hcsp-cap::before {
  content: ""; position: absolute; left: 0; top: .3rem; bottom: .3rem; width: 3px; border-radius: 3px;
  background: var(--sp-rule);
}
.hcsp-root .hcsp-cap .hcsp-cap-k {
  margin: 0 0 .35rem;
  font-family: var(--c-mono, ui-monospace, monospace);
  font-size: .74rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: var(--sp-acc);
}
.hcsp-root .hcsp-cap .hcsp-cap-h {
  margin: 0 0 .5rem;
  font-family: 'Fraunces', Georgia, serif;
  font-size: clamp(1.5rem, 2.2vw, 1.9rem); font-weight: 650; letter-spacing: -.02em; line-height: 1.12;
  color: var(--sp-text);
}
.hcsp-root .hcsp-cap .hcsp-cap-t, body.dark .hcsp-root .hcsp-cap .hcsp-cap-t { margin: 0; font-size: .92rem; line-height: 1.7; color: var(--sp-text-2) !important; }
.hcsp-root .hcsp-cap .hcsp-cap-a {
  display: inline-flex; align-items: center; gap: .25rem;
  min-height: 44px; margin-top: .25rem;
  font-size: .88rem; font-weight: 600;
  color: var(--sp-hi);
  text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--sp-hi-ul);
}
.hcsp-root .hcsp-cap .hcsp-cap-a:hover { text-decoration-color: currentColor; }

/* ---------- variants (optional, v2.60.0): a two-way segmented choice ---------- */
.hcsp-vars { display: flex; flex-direction: column; gap: .5rem; margin-top: .35rem; }
.hcsp-vars-l {
  font-family: var(--c-mono, ui-monospace, monospace);
  font-size: .74rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: var(--sp-text-3);
}
.hcsp-vars-seg {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
  padding: 3px; gap: 3px;
  border: 1px solid var(--sp-line); border-radius: 12px;
  background: rgba(255, 255, 255, .03);
}
.hcsp-var {
  min-height: 44px; padding: 0 .9rem;
  border: 1px solid transparent; border-radius: 9px;
  background: transparent; color: var(--sp-text-2);
  font: 600 .86rem/1 'Inter', system-ui, sans-serif;
  cursor: pointer;
  transition: background .35s var(--sp-ease), color .35s var(--sp-ease), border-color .35s var(--sp-ease);
}
.hcsp-var:hover { color: var(--sp-text); background: rgba(255, 255, 255, .05); }
.hcsp-var[aria-pressed="true"] { color: var(--sp-ink); background: var(--sp-acc); border-color: transparent; }
.hcsp-var:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.hcsp-root .hcsp-cap .hcsp-cap-v {
  margin: .7rem 0 0; padding-top: .7rem;
  border-top: 1px solid var(--sp-line);
  font-size: .86rem; line-height: 1.6;
  color: var(--sp-text-2);
}

/* ============================================================
   VIEW SWITCH (v2.60.1) - HCViewSwitch in js/hc-steps.js. One "3D | 2D"
   segmented switch for every 3D stage: the step player (toggle slot
   above), the brain map (.br3d-toggle) and the Calm Space. Both options
   always show; the current one is filled. Each option is a full 44px
   target; the fill sits --vs-in inside it (transparent border +
   padding-box background), so the CHECKED option carries the fill as
   its own background colour - a painted contrast check reads the real
   pair at every moment, mid-animation included: fill and ink change
   at once (no colour transition on a change). A copy of the fill
   (::before) then starts over the option just left - covering its
   label - and slides under the new label into place, so the pill
   travels across; never on first paint, never under reduced motion.
   Only hover fades (cubic-bezier .25,1,.5,1, like the slide).
   Theme from any ancestor: --vs-glass --vs-line --vs-text
   --vs-text-hover --vs-hover --vs-on --vs-on-ink --vs-focus. The
   fallbacks are the brain's night stage. All stages are dark in both
   site themes, so the switch needs no body.dark rules.
   ============================================================ */
.hcvs {
  --vs-in: 4px;
  --vs-ease: cubic-bezier(.25, 1, .5, 1);
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--vs-line, rgba(185, 174, 242, .16));
  border-radius: 999px;
  background: var(--vs-glass, rgba(14, 11, 38, .6));
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  box-shadow: 0 12px 28px -16px rgba(0, 0, 0, .7);
  isolation: isolate;
}
.hcvs-opt {
  position: relative;
  box-sizing: border-box;
  min-width: 52px; min-height: 44px;
  margin: 0; padding: 0 .8rem;
  border: var(--vs-in) solid transparent;
  border-radius: 999px;
  background-color: transparent;
  background-clip: padding-box;
  color: var(--vs-text, #C9C3EA);
  font: 600 .76rem/1 var(--c-mono, 'Space Grotesk', 'Inter', system-ui, sans-serif);
  letter-spacing: .1em; text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: none;   /* overrides dark.css's sitewide "body *" colour fade: a label must never sit mid-fade on the wrong ground */
}
.hcvs-opt:hover {
  color: var(--vs-text-hover, #F3F1FC); background-color: var(--vs-hover, rgba(123, 107, 208, .3));
  transition: color .3s var(--vs-ease), background-color .3s var(--vs-ease);
}
.hcvs-opt[aria-checked="true"], .hcvs-opt[aria-checked="true"]:hover {
  color: var(--vs-on-ink, #0E0B26);
  background-color: var(--vs-on, #B9AEF2);
  cursor: default;
  transition: none;   /* fill + ink change at once (AA at every frame); the ::before below does the travelling */
}
/* label layers: the travelling fill (z 1) passes OVER the label it leaves
   (z 0) and UNDER the label it arrives at (z 2) */
.hcvs-l { position: relative; z-index: 0; pointer-events: none; transition: none; }
.hcvs-opt[aria-checked="true"] .hcvs-l { z-index: 2; }
.hcvs-opt:focus-visible { outline: 2px solid var(--vs-focus, #fff); outline-offset: -2px; }
/* the travelling fill */
.hcvs-opt::before {
  content: ""; position: absolute; inset: 0; z-index: 1;
  border-radius: inherit;
  background: var(--vs-on, #B9AEF2);
  opacity: 0;
  pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
  .hcvs.is-moved .hcvs-opt:first-child[aria-checked="true"]::before { animation: hcvs-from-r .5s var(--vs-ease); }
  .hcvs.is-moved .hcvs-opt:last-child[aria-checked="true"]::before { animation: hcvs-from-l .5s var(--vs-ease); }
}
@keyframes hcvs-from-l { from { opacity: 1; transform: translateX(calc(-100% - 2 * var(--vs-in))); } to { opacity: 1; transform: none; } }
@keyframes hcvs-from-r { from { opacity: 1; transform: translateX(calc(100% + 2 * var(--vs-in))); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .hcvs-opt:hover { transition: none; }   /* and the slide above never applies */
}
@media (forced-colors: active) {
  .hcvs-opt[aria-checked="true"] { border-color: Highlight; }
}

.hcsp-foot {
  grid-area: cap;
  margin: 0;
  padding: 1rem 2rem 1.3rem;
  border-top: 1px solid var(--sp-line);
  font-size: .8rem; line-height: 1.6;
  color: var(--sp-text-3);
}

/* ---------- tablet & phone ---------- */
@media (max-width: 999px) {
  .hcsp-root { grid-template-columns: 1fr; grid-template-areas: "stage" "side" "cap"; }
  .hcsp-stage { --sp-h: clamp(440px, 62vw, 540px); border-radius: 28px 28px 0 0; }
  .hcsp-side { border-left: 0; border-top: 1px solid var(--sp-line); padding: 1.5rem; display: grid; grid-template-columns: 1fr 1fr; align-items: start; gap: 1.5rem 2rem; }
  .hcsp-foot { padding: 1rem 1.5rem 1.2rem; }
  .hcsp-root .hcsp-cap { min-height: 0; }
}
@media (max-width: 640px) {
  .hcsp-stage { --sp-h: min(114vw, 450px); border-radius: 22px 22px 0 0; }
  .hcsp-side { grid-template-columns: 1fr; padding: 1.25rem; }
  .hcsp-toggle { top: .75rem; right: .75rem; }
  .hcsp-2d { padding: 1.25rem .75rem; }
  .hcsp-steps { grid-template-columns: 1fr 1fr; }
  .hcsp-step { font-size: .82rem; padding-right: .6rem; }
  .hcsp-root .hcsp-cap .hcsp-cap-h { font-size: 1.45rem; }
}
@media (prefers-reduced-motion: reduce) {
  .hcsp-gl, .hcsp-2d, .hcsp-step, .hcsp-play, .hcsp-var { transition: none; animation: none; }
  .hcsp-step:hover { transform: none; }
}
