/* ============================================================
   galaxy.css — Galaxy / Uiverse.io components, retuned to consume
   the site's existing token system (--skin-accent, --surf, --nm-*,
   --r-*, --f-*, --gold, --blue, --blue-2) plus three decorative
   tokens declared in style.css (--wc-ease, --wc-r-outer, --wc-r-inner).

   Every component auto-tints on skin flip because --skin-accent
   swaps from lime (Commoner) to magenta (Wizard) via factions.css.

   All source components MIT-licensed via Uiverse.io. Attribution
   noted per block.
   ============================================================ */


/* ============================================================
   COMMONER-FRIENDLY (skin-neutral, uses --skin-accent)
   ============================================================ */

/* --- 1. Neuomorphic double-bezel button ------------------
   From Uiverse.io by AKAspidey01 — jolly-tiger-60 (MIT) */
.wc-nm-btn {
  cursor: pointer;
  background: linear-gradient(145deg, var(--surf-2), var(--surf));
  box-shadow: var(--nm-out-sm);
  padding: 6px;
  border-radius: var(--wc-r-outer);
  border: none;
  transition: box-shadow 0.4s var(--wc-ease), transform 0.2s var(--wc-ease);
}
.wc-nm-btn__core {
  border-radius: var(--wc-r-inner);
  background: linear-gradient(145deg, var(--surf), var(--surf-2));
  box-shadow: var(--nm-in-sm);
  color: var(--tx);
  font: 500 12px/1 var(--f-body);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 12px 20px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.wc-nm-btn:hover { box-shadow: var(--nm-out-sm), var(--skin-glow); }
.wc-nm-btn:hover .wc-nm-btn__core { color: var(--skin-accent); }
.wc-nm-btn:active { transform: translateY(1px) scale(0.99); }

/* Toggled state (aria-pressed='true'). Used by #demoBtn to show that demo
   mode is active. Inverts the button to an inset well so it reads as
   "depressed / locked on" rather than a fresh idle CTA. */
.wc-nm-btn[aria-pressed='true'] { box-shadow: var(--nm-in-sm), var(--skin-glow); }
.wc-nm-btn[aria-pressed='true'] .wc-nm-btn__core {
  box-shadow: var(--nm-in-sm);
  color: var(--skin-accent);
}


/* --- 2. Orbit loader ------------------
   From Uiverse.io by G4b413l — big-bulldog-8 (MIT) */
.wc-orbit {
  --uib-size: 22px;
  --uib-speed: 1.4s;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--uib-size);
  width: var(--uib-size);
  animation: wc-orbit-rot calc(var(--uib-speed) * 1.667) infinite linear;
  color: var(--skin-accent);
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--skin-accent) 55%, transparent));
}
.wc-orbit::before,
.wc-orbit::after {
  content: '';
  position: absolute;
  height: 60%;
  width: 60%;
  border-radius: 50%;
  background: currentColor;
  will-change: transform;
}
.wc-orbit::before { animation: wc-orbit var(--uib-speed) linear infinite; }
.wc-orbit::after  { animation: wc-orbit var(--uib-speed) linear calc(var(--uib-speed) / -2) infinite; }
@keyframes wc-orbit-rot { to { transform: rotate(360deg); } }
@keyframes wc-orbit {
   0% { transform: translate(calc(var(--uib-size) *  0.5)) scale(0.73); opacity: 0.65; }
  25% { transform: translate(0) scale(0.47); opacity: 0.30; }
  50% { transform: translate(calc(var(--uib-size) * -0.5)) scale(0.73); opacity: 0.65; }
  75% { transform: translate(0) scale(1); opacity: 1; }
 100% { transform: translate(calc(var(--uib-size) *  0.5)) scale(0.73); opacity: 0.65; }
}


/* --- 3. Tooltip with dashed underline ------------------
   From Uiverse.io by G4b413l — dry-turtle-84 (MIT) */
.wc-tip {
  position: relative;
  display: inline-block;
  cursor: help;
  border-bottom: 1px dashed var(--skin-accent);
  color: var(--tx);
  font-variant-numeric: tabular-nums;
}
/* Bare variant: the trigger is a graphic (the base diamond), so the dashed
   underline has nothing to underline and the help cursor is misleading. */
.wc-tip--bare {
  border-bottom: 0;
  cursor: default;
  display: inline-flex;
  align-items: center;
}
.wc-tip__body {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  /* Wraps rather than truncates, and never wider than the viewport at 390px. */
  width: max-content;
  max-width: min(240px, calc(100vw - 32px));
  padding: 10px 14px;
  border-radius: var(--r-tile);
  background: var(--surf-2);
  color: var(--tx);
  font: 400 12px/1.4 var(--f-body);
  text-align: left;
  box-shadow: var(--nm-out-sm), var(--skin-glow);
  transition: opacity 0.24s var(--wc-ease), transform 0.24s var(--wc-ease);
  z-index: 40;
  pointer-events: none;
}
.wc-tip__body::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  border: 6px solid transparent;
  border-top-color: var(--surf-2);
  transform: translateX(-50%);
}
/* Hover and keyboard focus both open it. :focus-within covers the case where the
   trigger itself is the focusable element and the case where a control inside it
   takes focus, so a keyboard user never loses access to the explanation. */
.wc-tip:hover .wc-tip__body,
.wc-tip:focus .wc-tip__body,
.wc-tip:focus-within .wc-tip__body,
.wc-tip.is-open .wc-tip__body {
  visibility: visible;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}


/* --- 9. Disclosure (native details/summary) ------------------
   Chevron/plate treatment adapted from Uiverse.io by Galahhad — smart-fly-45
   (MIT). Rebuilt on <details>/<summary> so open state, keyboard operation and
   the expanded/collapsed announcement come from the platform rather than from
   ARIA we would have to maintain by hand. */
.wc-disc { position: relative; }
.wc-disc__summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  /* 48px minimum target with a visible text label, not an icon-only hit area. */
  min-height: 48px;
  padding: 0 14px;
  background: linear-gradient(145deg, var(--surf-2), var(--surf));
  box-shadow: var(--nm-out-sm);
  color: var(--tx);
  font: 500 12px/1 var(--f-body);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  list-style: none;
  user-select: none;
  border-radius: var(--wc-r-outer);
  transition: box-shadow 0.2s var(--wc-ease), color 0.2s var(--wc-ease);
}
.wc-disc__summary::-webkit-details-marker { display: none; }
.wc-disc__summary::marker { content: ''; }
.wc-disc__summary:hover { color: var(--skin-accent); }
.wc-disc__chev {
  font-size: 12px;
  line-height: 1;
  transition: transform 0.18s var(--wc-ease);
}
.wc-disc[open] > .wc-disc__summary { box-shadow: var(--nm-in-sm), var(--skin-glow); color: var(--skin-accent); }
.wc-disc[open] > .wc-disc__summary .wc-disc__chev { transform: rotate(180deg); }
.wc-disc__panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 70;
  width: 250px;
  max-width: calc(100vw - 24px);
  display: grid;
  gap: 14px;
  padding: 14px;
  border-radius: var(--r-tile);
  background: var(--surf-2);
  box-shadow: var(--nm-out), var(--skin-glow);
}

/* --- 10. Segmented radio set (density / motion) ------------------
   Segment plate treatment adapted from Uiverse.io by adamgiebl — nice-fish-27
   (MIT). Backed by real radio inputs; the visible box is a sibling span so the
   native focus and checked states drive every visual, and the control is
   operable with arrow keys out of the box. */
.wc-set { border: 0; padding: 0; margin: 0; min-width: 0; }
.wc-set__legend {
  padding: 0;
  font: 700 9px/1 var(--f-body);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--mut);
  margin-bottom: 6px;
}
.wc-set__note {
  font: 500 10.5px/1.35 var(--f-body);
  color: var(--fnt);
  margin-bottom: 8px;
}
.wc-set__opts { display: grid; grid-auto-flow: column; gap: 4px; }
.wc-opt { position: relative; display: block; min-width: 0; }
.wc-opt input {
  position: absolute;
  opacity: 0;
  width: 1px; height: 1px; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
}
.wc-opt__box {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 8px;
  border-radius: 9px;
  background: var(--surf-in);
  box-shadow: var(--nm-in-sm);
  color: var(--mut);
  font: 700 10px/1 var(--f-body);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.16s var(--wc-ease), box-shadow 0.16s var(--wc-ease);
}
.wc-opt input:hover + .wc-opt__box { color: var(--tx); }
/* Checked state is weight + inset well + accent, never accent alone. */
.wc-opt input:checked + .wc-opt__box {
  color: var(--skin-accent);
  box-shadow: var(--nm-in-sm), inset 0 0 0 1px var(--skin-accent);
}
.wc-opt input:focus-visible + .wc-opt__box {
  outline: 2px solid var(--skin-accent);
  outline-offset: 2px;
}



/* ============================================================
   WIZARD-INTENDED (uses --blue as the chromatic-aberration counter)
   ============================================================ */

/* --- 4. Chromatic-aberration button ------------------
   From Uiverse.io by 212004ALJI — fat-eagle-24 (MIT) */
.wc-glitch,
.wc-glitch::after {
  padding: 12px 32px;
  font: 700 14px/1 var(--f-title);
  letter-spacing: 0.12em;
  border: none;
  border-radius: 6px;
  color: var(--tx);
  background: transparent;
  position: relative;
  cursor: pointer;
}
.wc-glitch {
  border: 1px solid color-mix(in srgb, var(--blue) 40%, transparent);
  transition: border-color 0.2s var(--wc-ease), box-shadow 0.2s var(--wc-ease);
}
.wc-glitch::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  clip-path: inset(50% 50% 50% 50%);
  display: block;
  pointer-events: none;
}
.wc-glitch:hover {
  border-color: var(--blue);
  box-shadow: 0 6px 24px -8px var(--blue);
  text-shadow: -1px -1px 0 var(--blue), 1px 1px 0 var(--skin-accent);
}
.wc-glitch:hover::after {
  animation: wc-glitch 0.9s steps(2, end);
  text-shadow: -3px -3px 0 var(--blue), 3px 3px 0 var(--skin-accent);
}
@keyframes wc-glitch {
   0% { clip-path: inset(50% 50% 50% 50%); transform: translate(0, -8px); }
  15% { clip-path: inset(31% 0 40% 0); transform: translate(-8px, 8px); }
  30% { clip-path: inset(39% 0 15% 0); transform: translate(8px, 0); }
  45% { clip-path: inset(45% 0 40% 0); transform: translate(-8px, 8px); }
  60% { clip-path: inset(14% 0 61% 0); transform: translate(8px, -8px); }
  85% { clip-path: inset(39% 0 15% 0); transform: translate(-4px, 4px); }
 100% { clip-path: inset(50% 50% 50% 50%); transform: translate(0); }
}


/* --- 5. Chromatic-frame card (dual static conic borders) ------------------
   Inspiration from Uiverse.io by AmIt-DasIT — quick-frog-32 (MIT).

   The source counter-rotates both conic gradients on a 6s loop. That is a ~0.17 Hz
   ambient cycle with no state behind it, sitting in the band where a slow loop stops
   reading as motion and starts reading as a throb — and Board II spends its one
   decorative channel on the static dither. So the gradients are frozen at the angles
   the animation passed through: the chromatic edge survives, the loop does not. */
.wc-frame {
  position: relative;
  border-radius: var(--r-card);
  padding: 2px;
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.4s var(--wc-ease);
}
.wc-frame::before,
.wc-frame::after {
  content: "";
  position: absolute;
  inset: -60%;
  z-index: -1;
  background: conic-gradient(from 0deg,
    transparent 0deg,
    transparent 260deg,
    var(--skin-accent) 320deg,
    transparent 360deg);
}
.wc-frame::after {
  background: conic-gradient(from 180deg,
    transparent 0deg,
    transparent 260deg,
    var(--blue) 320deg,
    transparent 360deg);
}
.wc-frame__inner {
  background: linear-gradient(180deg, var(--surf-2), var(--surf));
  border-radius: calc(var(--r-card) - 2px);
  padding: 20px;
  color: var(--tx);
  position: relative;
}
.wc-frame__eyebrow {
  font: 700 11px/1 var(--f-title);
  letter-spacing: 0.14em;
  color: var(--blue-2);
  margin-bottom: 12px;
}
.wc-frame__eyebrow::first-letter,
.wc-frame__eyebrow::last-letter { color: var(--skin-accent); }
.wc-frame:hover { transform: translateY(-2px); }



/* ============================================================
   Reduced-motion safety net for all animated snippets above.
   base.css already applies a global 0.01ms clamp, but keeping
   explicit fallbacks so the intent is discoverable per component.
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .wc-nm-btn,
  .wc-nm-btn__core,
  .wc-tip__body,
  .wc-glitch,
  .wc-frame { transition: none; animation: none; }
  .wc-glitch:hover::after { animation: none; }
  .wc-glitch:hover { text-shadow: none; }
  .wc-orbit,
  .wc-orbit::before,
  .wc-orbit::after { animation: none; }
  .wc-orbit { border: 2px solid var(--skin-accent); border-radius: 50%; }
  /* The chevron still rotates: it is a sub-120ms state indicator on a control the
     user just operated, not ambient decoration, and losing it would leave the
     disclosure's open state resting on layout alone. */
  .wc-disc__chev { transition-duration: 0.1s; }
}

/* Motion setting Off removes even the chevron rotation. The [open] attribute and
   the panel itself still carry the state, so nothing is lost but the tween. */
[data-motion='off'] .wc-disc__chev,
[data-motion='off'] .wc-tip__body,
[data-motion='off'] .wc-opt__box,
[data-motion='off'] .wc-nm-btn,
[data-motion='off'] .wc-nm-btn__core { transition: none; }
[data-motion='off'] .wc-orbit,
[data-motion='off'] .wc-orbit::before,
[data-motion='off'] .wc-orbit::after { animation: none; }
[data-motion='off'] .wc-orbit { border: 2px solid var(--skin-accent); border-radius: 50%; }
[data-motion='off'] .wc-glitch:hover::after { animation: none; }

/* --- 8. Ambient title treatment (Wizard-only) ------------------
   The predecessor here was a periodic chromatic-split "glitch" on the brand
   title. It is removed rather than retuned: it was an autonomous ~0.14 Hz loop
   with no state behind it, it chromatically offset a T1 element, and Board II
   allows exactly one decorative texture channel — bounded, static and masked
   away from numerals. What remains is that static channel. */
[data-skin='wizard'] .brand-title { position: relative; }

/* Frame wrapper must not collapse the feature card in the stretch grid. */
.wc-frame > .feature-card { height: 100%; }

/* Orbit loader sits inline with loading copy. */
.gd-load { display: inline-flex; align-items: center; gap: .5rem; }
