/* ==========================================================================
   Glowmigos — Shared components: buttons, switches, bulbs, fixtures
   ========================================================================== */

/* --------------------------------------------------------------------------
   Buttons — modelled on lighting hardware, not generic pills.
   -------------------------------------------------------------------------- */
.btn {
  --btn-glow: 0;
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.6em;
  min-block-size: 3rem; padding: 0.85rem 1.55rem;
  font-family: var(--f-display); font-weight: 800;
  font-size: var(--fs-small); letter-spacing: var(--tr-wide); text-transform: uppercase;
  text-decoration: none; white-space: nowrap;
  border-radius: var(--r-md);
  transition: transform var(--d-fast) var(--e-out), box-shadow var(--d-mid) var(--e-out),
              background-color var(--d-mid) var(--e-out), color var(--d-mid) var(--e-out);
}
.btn:active { transform: translateY(1px) scale(0.99); }

/* Primary — the switch you actually want to flip. */
.btn--primary {
  color: #2A1A00;
  background: linear-gradient(180deg, var(--c-sun), var(--c-gold));
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.55) inset,
    0 -2px 0 rgba(140, 90, 0, 0.35) inset,
    0 10px 26px -12px rgba(255, 181, 17, calc(0.5 + var(--btn-glow) * 0.5)),
    0 0 calc(0px + var(--btn-glow) * 46px) rgba(255, 213, 42, calc(var(--btn-glow) * 0.55));
}
.btn--primary:hover { --btn-glow: 1; transform: translateY(-2px); }

/* Secondary — an unlit fixture that lights on approach. */
.btn--ghost {
  color: var(--t-bright);
  border: 1.5px solid var(--hairline-strong);
  background: rgba(10, 37, 96, 0.5);
}
.btn--ghost:hover {
  color: var(--c-cyan);
  border-color: rgba(69, 231, 247, 0.7);
  box-shadow: 0 0 0 1px rgba(69, 231, 247, 0.18), 0 10px 30px -16px rgba(69, 231, 247, 0.9);
  transform: translateY(-2px);
}

/* Compact nav CTA. */
.btn--sm { min-block-size: 2.5rem; padding: 0.55rem 1.05rem; font-size: var(--fs-eyebrow); }

.btn--wide { inline-size: 100%; }

/* --------------------------------------------------------------------------
   The hero switch — START THE LIGHT SHOW.
   A physical rocker: face, bezel, indicator lamp.
   -------------------------------------------------------------------------- */
.showbtn {
  position: relative;
  display: inline-flex; align-items: center; gap: 0.9rem;
  padding: 0.6rem 1.6rem 0.6rem 0.65rem;
  border-radius: var(--r-lg);
  background: linear-gradient(178deg, #16305F, #08183C);
  border: 2px solid rgba(255, 181, 17, 0.45);
  box-shadow: 0 18px 40px -24px #000, inset 0 1px 0 rgba(255, 255, 255, 0.08),
              0 0 26px -14px rgba(255, 181, 17, 0.9);
  transition: box-shadow var(--d-mid) var(--e-out), transform var(--d-fast) var(--e-out);
}
.showbtn:hover { transform: translateY(-2px); }
.showbtn:hover, .showbtn[aria-pressed="true"] {
  box-shadow: 0 18px 44px -22px rgba(255, 181, 17, 0.75),
              inset 0 1px 0 rgba(255, 255, 255, 0.12),
              0 0 0 1px rgba(255, 181, 17, 0.35);
}
/* The rocker paddle */
.showbtn__rocker {
  position: relative; inline-size: 2.9rem; block-size: 3.35rem; flex: none;
  border-radius: 10px;
  background: linear-gradient(180deg, #F3F0E6, #C9C4B4);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.22);
  overflow: hidden;
}
.showbtn__rocker::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.32), transparent 46%);
  transition: transform var(--d-mid) var(--e-pop);
  transform-origin: top;
}
.showbtn[aria-pressed="true"] .showbtn__rocker::after { transform: translateY(100%) scaleY(-1); }
/* Indicator lamp inside the paddle */
.showbtn__lamp {
  position: absolute; inset-inline: 0.7rem; inset-block-end: 0.5rem;
  block-size: 0.4rem; border-radius: var(--r-pill);
  background: #6F6A5C;
  transition: background var(--d-mid) var(--e-out), box-shadow var(--d-mid) var(--e-out);
}
.showbtn[aria-pressed="true"] .showbtn__lamp {
  background: var(--c-sun);
  box-shadow: 0 0 12px 2px rgba(255, 213, 42, 0.9);
}
.showbtn__label {
  display: grid; gap: 0.12rem; text-align: start;
  font-family: var(--f-display); font-weight: 800;
  letter-spacing: var(--tr-wide); text-transform: uppercase;
  color: var(--t-bright); font-size: clamp(0.8rem, 0.74rem + 0.24vw, 0.95rem);
}
.showbtn__hint {
  font-size: 0.66rem; font-weight: 600; letter-spacing: var(--tr-wide);
  color: var(--t-dim);
}
.showbtn[aria-pressed="true"] .showbtn__hint { color: var(--c-gold); }

/* --------------------------------------------------------------------------
   Toggle switch — used by Glow Mode and the Glow Board channels.
   -------------------------------------------------------------------------- */
.switch {
  display: flex; align-items: center; gap: 0.75rem;
  min-block-size: 44px; padding: 0.4rem 0.2rem;
  text-align: start; inline-size: 100%;
  color: var(--t-muted);
  transition: color var(--d-mid) var(--e-out);
}
.switch[aria-pressed="true"] { color: var(--t-bright); }
.switch__track {
  position: relative; flex: none;
  inline-size: 2.9rem; block-size: 1.6rem;
  border-radius: var(--r-pill);
  background: #0A1938;
  border: 1px solid rgba(137, 176, 255, 0.24);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.6);
  transition: background var(--d-mid) var(--e-out), border-color var(--d-mid) var(--e-out),
              box-shadow var(--d-mid) var(--e-out);
}
.switch__knob {
  position: absolute; inset-block-start: 50%; inset-inline-start: 0.18rem;
  inline-size: 1.15rem; block-size: 1.15rem; border-radius: 50%;
  background: linear-gradient(180deg, #E8EDF7, #A9B6CE);
  transform: translateY(-50%);
  transition: transform var(--d-mid) var(--e-pop), background var(--d-mid) var(--e-out);
}
.switch[aria-pressed="true"] .switch__track {
  background: color-mix(in srgb, var(--sw-color, var(--c-gold)) 26%, #0A1938);
  border-color: color-mix(in srgb, var(--sw-color, var(--c-gold)) 65%, transparent);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.4),
              0 0 18px -2px color-mix(in srgb, var(--sw-color, var(--c-gold)) 70%, transparent);
}
.switch[aria-pressed="true"] .switch__knob {
  transform: translate(1.28rem, -50%);
  background: linear-gradient(180deg, #FFFFFF, var(--sw-color, var(--c-gold)));
}
.switch__text { display: grid; gap: 0.1rem; min-inline-size: 0; }
.switch__name {
  font-family: var(--f-display); font-weight: 800; font-size: var(--fs-micro);
  letter-spacing: var(--tr-wide); text-transform: uppercase; color: inherit;
}
.switch__state { font-size: 0.68rem; font-weight: 600; letter-spacing: 0.1em; color: var(--t-dim); }
.switch[aria-pressed="true"] .switch__state { color: var(--sw-color, var(--c-gold)); }

/* --------------------------------------------------------------------------
   Bulb — the atom of the whole design system.
   -------------------------------------------------------------------------- */
.bulb {
  --bulb-color: var(--l-warm);
  position: relative; display: inline-block;
  inline-size: 0.55rem; block-size: 0.55rem; border-radius: 50%; flex: none;
  background: #1B2C50;
  transition: background var(--d-mid) var(--e-out), box-shadow var(--d-mid) var(--e-out);
}
.bulb.is-lit,
:where([data-glow="on"], [data-show="on"]) .bulb {
  background: var(--bulb-color);
  box-shadow: 0 0 10px 1px color-mix(in srgb, var(--bulb-color) 70%, transparent);
}

/* Bulb bullet list — replaces generic ticks/checkmarks. */
.bulb-list { display: grid; gap: 0.85rem; }
.bulb-list li { display: flex; align-items: flex-start; gap: 0.85rem; }
.bulb-list .bulb { margin-block-start: 0.6em; }

/* --------------------------------------------------------------------------
   Chips — scene selectors. Each carries its own light colour.
   -------------------------------------------------------------------------- */
.chip {
  display: inline-flex; align-items: center; gap: 0.5rem;
  min-block-size: 44px; padding: 0.5rem 0.95rem;
  border-radius: var(--r-pill);
  border: 1px solid var(--hairline);
  background: rgba(6, 21, 50, 0.75);
  color: var(--t-muted);
  font-size: var(--fs-micro); font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: color var(--d-fast) var(--e-out), border-color var(--d-fast) var(--e-out),
              box-shadow var(--d-fast) var(--e-out), background-color var(--d-fast) var(--e-out);
}
.chip__dots { display: inline-flex; gap: 3px; }
.chip__dot { inline-size: 6px; block-size: 6px; border-radius: 50%; background: currentColor; opacity: 0.5; }
.chip:hover { color: var(--t-bright); border-color: var(--hairline-strong); }
.chip[aria-selected="true"], .chip.is-active {
  color: var(--t-bright);
  background: rgba(16, 48, 122, 0.85);
  border-color: color-mix(in srgb, var(--chip-color, var(--c-gold)) 60%, transparent);
  box-shadow: 0 0 20px -6px color-mix(in srgb, var(--chip-color, var(--c-gold)) 90%, transparent);
}
.chip[aria-selected="true"] .chip__dot, .chip.is-active .chip__dot { opacity: 1; }

/* --------------------------------------------------------------------------
   Glow-lit headings — an illuminated underline that the Light Show switches on.
   -------------------------------------------------------------------------- */
.lit-line { position: relative; display: inline-block; }
.lit-line::after {
  content: ""; position: absolute; inset-inline: 0; inset-block-end: -0.14em;
  block-size: 0.1em; border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--c-gold), var(--c-sun) 45%, var(--c-cyan));
  transform: scaleX(var(--lit, 0)); transform-origin: left;
  transition: transform var(--d-slow) var(--e-out), box-shadow var(--d-slow) var(--e-out);
  box-shadow: 0 0 calc(var(--lit) * 22px) rgba(255, 213, 42, calc(var(--lit) * 0.75));
}
.is-underlit .lit-line { --lit: 1; }

/* --------------------------------------------------------------------------
   Party strobe on the un-thrown switch.
   Two pops per 2.4s cycle — roughly 0.8 Hz, far below the 3 Hz photosensitivity
   threshold. It stops on its own the moment aria-pressed flips to true.
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  .showbtn[aria-pressed="false"] { animation: showbtn-strobe 2.4s var(--e-inout) infinite; }

  @keyframes showbtn-strobe {
    0%, 58%, 100% {
      border-color: rgba(255, 181, 17, 0.45);
      box-shadow: 0 18px 40px -24px #000, inset 0 1px 0 rgba(255, 255, 255, 0.08),
                  0 0 26px -14px rgba(255, 181, 17, 0.9);
    }
    66% {
      border-color: #FFD52A;
      box-shadow: 0 18px 40px -22px #000, inset 0 1px 0 rgba(255, 255, 255, 0.18),
                  0 0 34px -4px rgba(255, 213, 42, 0.75), 0 0 0 3px rgba(255, 213, 42, 0.16);
    }
    74% {
      border-color: rgba(255, 181, 17, 0.5);
      box-shadow: 0 18px 40px -24px #000, inset 0 1px 0 rgba(255, 255, 255, 0.08),
                  0 0 26px -14px rgba(255, 181, 17, 0.9);
    }
    84% {
      border-color: #FFE9A0;
      box-shadow: 0 18px 40px -22px #000, inset 0 1px 0 rgba(255, 255, 255, 0.22),
                  0 0 40px -2px rgba(255, 233, 160, 0.8), 0 0 0 4px rgba(255, 213, 42, 0.2);
    }
  }

  /* The indicator lamp ticks along with it, like a fixture waiting to be told. */
  .showbtn[aria-pressed="false"] .showbtn__lamp {
    animation: showbtn-lamp 2.4s var(--e-inout) infinite;
  }
  @keyframes showbtn-lamp {
    0%, 58%, 74%, 100% { background: #6F6A5C; box-shadow: none; }
    66%, 84%           { background: var(--c-sun); box-shadow: 0 0 12px 2px rgba(255, 213, 42, 0.9); }
  }
}


/* --------------------------------------------------------------------------
   Once the show is live the switch joins the party: the gold "click me"
   strobe hands off to a colour cycle through the brand palette.

   Six colours over 4.2s is one change every 700ms (~1.4 Hz) — deliberately
   under the 3 Hz photosensitivity threshold, and it cycles hue rather than
   slamming luminance, so it reads as a party light and not a warning strobe.
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  .showbtn[aria-pressed="true"] {
    animation: showbtn-party 4.2s steps(1, end) infinite;
  }
  .showbtn[aria-pressed="true"] .showbtn__lamp {
    animation: showbtn-lamp-party 4.2s steps(1, end) infinite;
  }

  @keyframes showbtn-party {
    0%     { border-color: #FF3B30; box-shadow: 0 18px 40px -22px #000, inset 0 1px 0 rgba(255,255,255,.16), 0 0 34px -6px rgba(255, 59, 48, .85); }
    16.66% { border-color: #FFB511; box-shadow: 0 18px 40px -22px #000, inset 0 1px 0 rgba(255,255,255,.16), 0 0 34px -6px rgba(255, 181, 17, .85); }
    33.33% { border-color: #57D927; box-shadow: 0 18px 40px -22px #000, inset 0 1px 0 rgba(255,255,255,.16), 0 0 34px -6px rgba(87, 217, 39, .85); }
    50%    { border-color: #09BCEB; box-shadow: 0 18px 40px -22px #000, inset 0 1px 0 rgba(255,255,255,.16), 0 0 34px -6px rgba(9, 188, 235, .85); }
    66.66% { border-color: #F139B7; box-shadow: 0 18px 40px -22px #000, inset 0 1px 0 rgba(255,255,255,.16), 0 0 34px -6px rgba(241, 57, 183, .85); }
    83.33% { border-color: #FF6B16; box-shadow: 0 18px 40px -22px #000, inset 0 1px 0 rgba(255,255,255,.16), 0 0 34px -6px rgba(255, 107, 22, .85); }
  }

  @keyframes showbtn-lamp-party {
    0%     { background: #FF3B30; box-shadow: 0 0 12px 2px rgba(255, 59, 48, .95); }
    16.66% { background: #FFB511; box-shadow: 0 0 12px 2px rgba(255, 181, 17, .95); }
    33.33% { background: #57D927; box-shadow: 0 0 12px 2px rgba(87, 217, 39, .95); }
    50%    { background: #09BCEB; box-shadow: 0 0 12px 2px rgba(9, 188, 235, .95); }
    66.66% { background: #F139B7; box-shadow: 0 0 12px 2px rgba(241, 57, 183, .95); }
    83.33% { background: #FF6B16; box-shadow: 0 0 12px 2px rgba(255, 107, 22, .95); }
  }
}

/* --------------------------------------------------------------------------
   The party emoji.
   It lives outside .showbtn__label so the JS text swap cannot clobber it, and
   it is aria-hidden so the accessible name stays "Start party mode" rather
   than "Start party mode party popper".
   -------------------------------------------------------------------------- */
.showbtn__emoji {
  flex: none;
  font-size: 1.35rem; line-height: 1;
  margin-inline-start: -0.15rem;
  transform-origin: 50% 85%;
}

@media (prefers-reduced-motion: no-preference) {
  /* Waiting: a small nudge on the same 2.4s beat as the switch strobe. */
  .showbtn[aria-pressed="false"] .showbtn__emoji {
    animation: emoji-nudge 2.4s var(--e-inout) infinite;
  }
  @keyframes emoji-nudge {
    0%, 58%, 100% { transform: rotate(0deg) scale(1); }
    66%           { transform: rotate(-12deg) scale(1.12); }
    74%           { transform: rotate(6deg) scale(1.04); }
    84%           { transform: rotate(-6deg) scale(1.1); }
  }

  /* Live: a looser celebration, running with the colour cycle. */
  .showbtn.is-partying .showbtn__emoji {
    animation: emoji-party 1.1s var(--e-pop) infinite;
  }
  @keyframes emoji-party {
    0%   { transform: translateY(0) rotate(-10deg) scale(1); }
    30%  { transform: translateY(-6px) rotate(9deg) scale(1.18); }
    55%  { transform: translateY(0) rotate(-6deg) scale(1.02); }
    80%  { transform: translateY(-3px) rotate(5deg) scale(1.1); }
    100% { transform: translateY(0) rotate(-10deg) scale(1); }
  }
}
