*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg: #0a0a0c;
  --surface: #12121a;
  --border: #2a2a36;
  --text: #e8e8ed;
  --muted: #8b8b9a;
  --accent: #6ee7a8;
  --accent-dim: #3d9a6a;
  /** 0–1: scroll progress through hero transition (set by JS). */
  --hero-scroll: 0;
  --spotify-green: #1db954;
  --spotify-green-hover: #1ed760;
  --music-bar-bg: #121212;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@property --rainbow-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

html {
  scroll-behavior: smooth;
}

html,
body {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 15px;
  line-height: 1.5;
}

.video-source {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.page {
  position: relative;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

.hero-fixed {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  /* Let wheel/touch reach the scrolling document; only .controls-bar opts back in. */
  pointer-events: none;
}

.hero-fixed .player {
  flex: 1;
  min-height: 0;
}

/* Fixed overlay terminal; close with red dot to reveal video */
.terminal-stage {
  position: fixed;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(0.75rem, 3vw, 2rem);
  background: rgba(8, 8, 12, 0.72);
  backdrop-filter: blur(6px);
  pointer-events: auto;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.terminal-stage--dragging {
  cursor: grabbing;
}

.terminal-stage--dragging .terminal-titlebar {
  cursor: grabbing;
}

.terminal-stage--hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.terminal-shell {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.75rem;
  /* --tw-max-w is set by JS; % is relative to .terminal-stage (fixed, full viewport). */
  width: min(100%, var(--tw-max-w, 40rem));
  max-width: min(100%, var(--tw-max-w, 40rem));
  transition:
    transform 0.45s ease,
    width 0.55s ease,
    max-width 0.55s ease;
}

.terminal-window {
  position: relative;
  left: auto;
  top: auto;
  width: 100%;
  max-width: 100%;
  /* Flex child: allow inner .terminal-body to scroll instead of growing the window without bound. */
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(110, 231, 168, 0.06);
  overflow: hidden;
  background: #0d1117;
  transition:
    opacity 0.45s ease,
    transform 0.45s ease,
    box-shadow 0.55s ease;
}

.terminal-window--grown {
  box-shadow: 0 22px 56px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(110, 231, 168, 0.1);
}

.terminal-stage--closing {
  opacity: 0;
  pointer-events: none;
  backdrop-filter: blur(2px);
}

.terminal-stage--closing .terminal-shell {
  transform: scale(0.97);
}

.terminal-titlebar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.85rem;
  background: #161b22;
  border-bottom: 1px solid var(--border);
  font-size: 0.72rem;
  color: var(--muted);
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.terminal-window-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.terminal-dot {
  width: 12px;
  height: 12px;
  padding: 0;
  border: none;
  border-radius: 50%;
  cursor: default;
  flex-shrink: 0;
}

.terminal-dot--close {
  background: #ff5f57;
  cursor: pointer;
}

.terminal-dot--close:hover {
  filter: brightness(1.08);
}

.terminal-dot--minimize {
  background: #febc2e;
}

.terminal-dot--zoom {
  background: #28c840;
}

.terminal-title {
  flex: 1;
  text-align: center;
  margin-right: 52px;
}

.terminal-body {
  padding: clamp(1rem, 3vw, 1.35rem);
  min-height: 0;
  max-height: min(72vh, 38rem);
  /* overflow-y: auto makes overflow-x compute to auto; long nowrap lines then get a horizontal scrollbar strip under the text. */
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.terminal-line {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.35em;
  min-width: 0;
  font-size: clamp(0.8rem, 2.2vw, 0.95rem);
  line-height: 1.45;
  word-break: break-word;
}

/* Resume intro after clear from line 1+: hide empty primary row so prompts don't duplicate. */
.terminal-body > .terminal-line.terminal-line--first-hidden {
  display: none;
}

.terminal-stage .terminal-typed {
  white-space: nowrap;
  flex: 0 0 auto;
}

.terminal-inline-link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  font: inherit;
  font-size: inherit;
  letter-spacing: inherit;
  cursor: pointer;
}

.terminal-inline-link:hover {
  color: #8eedb8;
}

.terminal-dock {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(13, 17, 23, 0.92);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.terminal-dock-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.5rem;
  margin-bottom: 0.55rem;
}

.terminal-dock-cmd {
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--accent-dim);
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}

.terminal-dock-cmd:hover {
  border-color: var(--accent-dim);
  color: var(--accent);
}

.terminal-dock-cmd--clear {
  color: #f0a8a8;
  border-color: rgba(240, 168, 168, 0.45);
  background: rgba(80, 30, 30, 0.35);
}

.terminal-dock-cmd--clear:hover {
  color: #fecaca;
  border-color: rgba(254, 202, 202, 0.55);
  background: rgba(100, 40, 40, 0.45);
}

.terminal-dock-input-line {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
}

.terminal-dock-prompt {
  flex-shrink: 0;
  color: var(--accent-dim);
  font-size: 0.85rem;
}

.terminal-dock-input {
  flex: 1;
  min-width: 0;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #0a0e14;
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
}

.terminal-dock-input:focus {
  outline: 1px solid var(--accent-dim);
  outline-offset: 1px;
}

.terminal-line--exp .terminal-prompt {
  align-self: flex-start;
  margin-top: 0.1em;
}

.terminal-exp-skills {
  color: var(--muted);
}

.terminal-stage .terminal-cursor {
  flex-shrink: 0;
  line-height: 1;
}

.terminal-line-secondary {
  margin-top: 0;
  padding-top: 0;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  border-top: 1px solid transparent;
  transition:
    max-height 0.55s ease,
    opacity 0.45s ease,
    margin-top 0.45s ease,
    padding-top 0.45s ease,
    border-color 0.45s ease;
}

/* Let content grow; .terminal-body is the only scroll container (do not clip here). */
.terminal-line-rest.terminal-line-secondary.terminal-line-rest--visible {
  margin-top: 0.65rem;
  padding-top: 0.75rem;
  max-height: min(300vh, 200rem);
  overflow: visible;
  opacity: 1;
  border-top-color: rgba(42, 42, 54, 0.75);
}

/* Resume intro after clear with first row hidden: no orphan gap / rule above rest block. */
.terminal-line-rest.terminal-line-secondary.terminal-line-rest--visible.terminal-line-rest--flush-top {
  margin-top: 0;
  padding-top: 0;
  border-top-width: 0;
  border-top-color: transparent;
}

.terminal-line-rest .terminal-line + .terminal-line {
  margin-top: 0.65rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(42, 42, 54, 0.75);
}

.terminal-cursor--secondary {
  opacity: 0;
}

.terminal-cursor--secondary.is-active {
  opacity: 1;
  animation: terminal-cursor-blink 1s step-end infinite;
}

.terminal-cursor.terminal-cursor--rapid {
  opacity: 1;
  animation: terminal-cursor-blink-rapid 0.22s step-end infinite;
}

.terminal-cursor--secondary.terminal-cursor--rapid {
  opacity: 1;
  animation: terminal-cursor-blink-rapid 0.22s step-end infinite;
}

.terminal-prompt {
  flex-shrink: 0;
  color: var(--accent-dim);
}

.terminal-typed {
  color: #c8e6d0;
}

.terminal-cursor {
  display: inline-block;
  margin-left: 1px;
  color: var(--accent);
  animation: terminal-cursor-blink 1s step-end infinite;
}

.terminal-cursor--done {
  animation: none;
  opacity: 0;
}

.terminal-cursor--secondary.terminal-cursor--done {
  animation: none;
  opacity: 0;
}

@keyframes terminal-cursor-blink {
  50% {
    opacity: 0;
  }
}

@keyframes terminal-cursor-blink-rapid {
  50% {
    opacity: 0;
  }
}

.scroll-spacer {
  height: 100vh;
  height: 100dvh;
  pointer-events: none;
}

.player {
  display: flex;
  flex-direction: column;
  background: #000;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.video-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  background: #000;
  line-height: 0;
  z-index: 0;
  pointer-events: none;
  filter: blur(calc(var(--hero-scroll) * 14px));
  transform: scale(calc(1 - var(--hero-scroll) * 0.035));
  transform-origin: center center;
  will-change: filter, transform;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: calc(var(--hero-scroll) * 0.85);
  background:
    radial-gradient(ellipse 90% 75% at 50% 42%, transparent 35%, rgba(5, 5, 10, 0.45) 70%, rgba(0, 0, 0, 0.92) 100%),
    linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, calc(var(--hero-scroll) * 0.35)) 100%);
  mix-blend-mode: multiply;
}

#screen {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

.scanlines {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 1;
  background: repeating-linear-gradient(
    transparent 0,
    transparent 2px,
    rgba(0, 0, 0, 0.12) 2px,
    rgba(0, 0, 0, 0.12) 3px
  );
  opacity: calc(0.35 + var(--hero-scroll) * 0.25);
}

.controls-bar {
  flex-shrink: 0;
  z-index: 10;
  border-top: 1px solid rgba(42, 42, 54, 0.9);
  background: rgba(10, 10, 12, 0.82);
  backdrop-filter: blur(10px);
  opacity: calc(1 - clamp(0, var(--hero-scroll) * 5, 1));
  transform: translateY(calc(clamp(0, var(--hero-scroll) * 5, 1) * 120%));
  pointer-events: auto;
}

.music-bar {
  flex-shrink: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) minmax(0, 1fr);
  align-items: center;
  gap: 0.75rem 1rem;
  padding: 0.55rem 1rem 0.65rem;
  border-top: 1px solid rgba(42, 42, 54, 0.9);
  background: rgba(18, 18, 18, 0.96);
  backdrop-filter: blur(12px);
  opacity: calc(1 - clamp(0, var(--hero-scroll) * 5, 1));
  transform: translateY(calc(clamp(0, var(--hero-scroll) * 5, 1) * 120%));
  pointer-events: auto;
  max-height: 200px;
  transition:
    opacity 0.45s ease,
    transform 0.45s ease,
    visibility 0.45s ease,
    max-height 0.45s ease,
    padding 0.45s ease,
    border-width 0.45s ease;
}

.music-bar.music-bar--hidden-by-video-audio {
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden;
  max-height: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  border-top-width: 0 !important;
  margin: 0 !important;
  overflow: hidden !important;
  min-height: 0 !important;
  gap: 0 !important;
}

.music-bar__left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.music-bar__art {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 6px;
  background: linear-gradient(145deg, #1e1e26 0%, #121218 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.music-bar__record {
  --record-rotate: 0deg;
  --music-vol: 0.8;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  position: relative;
  transform: rotate(var(--record-rotate));
  transform-origin: 50% 50%;
  will-change: transform;
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.12) 0%, transparent 35%),
    radial-gradient(circle at 50% 50%, #2d2d36 0%, #0e0e12 42%, #18181f 45%, #08080a 100%);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.55),
    inset 0 2px 6px rgba(255, 255, 255, 0.04),
    0 2px 8px rgba(0, 0, 0, 0.55);
  transition: box-shadow 0.3s ease;
}

.music-bar--playing .music-bar__record {
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.55),
    inset 0 2px 6px rgba(255, 255, 255, 0.06),
    0 0 0 1px rgba(29, 185, 84, calc(0.15 + var(--music-vol, 0.8) * 0.35)),
    0 2px 12px rgba(29, 185, 84, calc(0.08 + var(--music-vol, 0.8) * 0.2));
}

.music-bar__record-grooves {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  background: repeating-radial-gradient(
    circle at 50% 50%,
    transparent 0,
    transparent 2px,
    rgba(255, 255, 255, 0.035) 2px,
    rgba(255, 255, 255, 0.035) 3px
  );
  opacity: calc(0.35 + var(--music-vol, 0.8) * 0.35);
  mix-blend-mode: soft-light;
}

.music-bar__record-label {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 38%;
  height: 38%;
  margin: -19% 0 0 -19%;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 32%, #2edd84 0%, var(--spotify-green) 45%, #0d5c32 100%);
  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, 0.25),
    inset 0 -1px 3px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}

.music-bar__record-hole {
  width: 22%;
  height: 22%;
  min-width: 5px;
  min-height: 5px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 40%, #1a1a20 0%, #050508 100%);
  box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.9);
}

.music-bar__meta {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.music-bar__title {
  font-size: 0.82rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.music-bar__artist {
  font-size: 0.72rem;
  color: rgba(179, 179, 179, 0.95);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.music-bar__center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.music-bar__transport {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.music-bar__btn {
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: color 0.15s, transform 0.1s;
}

.music-bar__btn:hover {
  color: #fff;
}

.music-bar__btn:focus-visible {
  outline: 2px solid var(--spotify-green);
  outline-offset: 2px;
}

.music-bar__btn--skip {
  width: 36px;
  height: 36px;
}

.music-bar__btn--skip:hover {
  color: #fff;
}

.music-bar__btn--play {
  width: 44px;
  height: 44px;
  background: #fff;
  color: #000;
}

.music-bar__btn--play:hover {
  background: #fff;
  transform: scale(1.06);
}

.music-bar__btn--play.is-playing {
  background: var(--spotify-green);
  color: #000;
}

.music-bar__btn--play.is-playing:hover {
  background: var(--spotify-green-hover);
}

.music-bar__play-glyph {
  display: block;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 8px 0 8px 14px;
  border-color: transparent transparent transparent currentColor;
  margin-left: 3px;
}

.music-bar__btn--play.is-playing .music-bar__play-glyph {
  width: 14px;
  height: 16px;
  border: none;
  margin-left: 0;
  background: linear-gradient(
    to right,
    currentColor 0,
    currentColor 5px,
    transparent 5px,
    transparent 9px,
    currentColor 9px,
    currentColor 14px
  );
}

.music-bar__progress-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  max-width: 420px;
}

.music-bar__time {
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
  color: rgba(179, 179, 179, 0.95);
  min-width: 2.5rem;
}

.music-bar__seek {
  flex: 1;
  min-width: 0;
  height: 4px;
  accent-color: var(--spotify-green);
  cursor: pointer;
}

.music-bar__right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  min-width: 0;
}

.music-bar__track-label {
  min-width: 0;
  flex: 1;
  max-width: 14rem;
}

.music-bar__select {
  width: 100%;
  padding: 0.35rem 0.5rem;
  font-family: inherit;
  font-size: 0.75rem;
  color: #e8e8ed;
  background-color: #2a2a36;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 4px;
  cursor: pointer;
  accent-color: var(--spotify-green);
  color-scheme: dark;
}

.music-bar__select option {
  background-color: #1e1e26;
  color: #e8e8ed;
}

.music-bar__select:focus-visible {
  outline: 2px solid var(--spotify-green);
  outline-offset: 2px;
}

.music-bar__vol {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  color: rgba(179, 179, 179, 0.95);
}

.music-bar__vol input[type="range"] {
  width: 96px;
  height: 4px;
  accent-color: var(--spotify-green);
  cursor: pointer;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
  padding: 0.75rem 1rem 0.65rem;
}

.btn {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 8px;
  width: 44px;
  height: 44px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, background 0.15s;
}

.btn:hover {
  border-color: var(--accent-dim);
  background: #16161f;
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-text {
  width: auto;
  min-width: 7rem;
  padding: 0 0.85rem;
  font-family: inherit;
  font-size: 0.78rem;
}

.btn-text[aria-pressed="true"] {
  border-color: var(--accent-dim);
  color: var(--accent);
}

.icon-play {
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 8px 0 8px 14px;
  border-color: transparent transparent transparent var(--accent);
  margin-left: 3px;
}

.btn.is-playing .icon-play {
  width: 14px;
  height: 16px;
  border: none;
  margin-left: 0;
  background: linear-gradient(
    to right,
    var(--accent) 0,
    var(--accent) 5px,
    transparent 5px,
    transparent 9px,
    var(--accent) 9px,
    var(--accent) 14px
  );
}

.time {
  font-size: 0.8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-width: 2.5rem;
}

.seek {
  flex: 1 1 180px;
  min-width: 120px;
  accent-color: var(--accent);
  height: 6px;
}

.video-select {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.video-select-label {
  white-space: nowrap;
}

.video-select-input {
  min-width: 8.5rem;
  max-width: 14rem;
  padding: 0.35rem 0.5rem;
  font-family: inherit;
  font-size: 0.78rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  accent-color: var(--accent);
}

.video-select-input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.dens {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.controls > .dens:first-of-type {
  margin-left: auto;
}

.dens-label {
  white-space: nowrap;
}

.dens input {
  width: 100px;
  accent-color: var(--accent);
}

/* Clip audio: only for sources with audio; collapses when off (no layout gap). */
.dens.dens-audio-clip {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  gap: 0;
  max-height: 0;
  max-width: 0;
  margin: 0;
  padding: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  visibility: hidden;
  transition:
    max-height 0.42s cubic-bezier(0.4, 0, 0.2, 1),
    max-width 0.42s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.3s ease,
    visibility 0.35s ease,
    gap 0.35s ease;
}

.dens.dens-audio-clip.dens-audio-clip--on {
  max-height: 3.75rem;
  max-width: 18rem;
  gap: 0.5rem;
  opacity: 1;
  overflow: visible;
  pointer-events: auto;
  visibility: visible;
}

@media (prefers-reduced-motion: reduce) {
  .dens.dens-audio-clip {
    transition: none;
  }
}

/**
 * Rainbow border: 2px padding ring; ::before fills the wrapper and only the
 * conic-gradient *angle* animates (@property). Rotating the whole layer + clip
 * caused a left–right “bounce”; this stays centered and sweeps smoothly.
 */
.btn-color-rainbow {
  position: relative;
  display: inline-flex;
  vertical-align: middle;
  padding: 2px;
  border-radius: 10px;
  isolation: isolate;
}

/* Default: no fill — if the rainbow lived here, it would flash during the opacity
   fade when :hover ends (background reverts before opacity hits 0). */
.btn-color-rainbow::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 10px;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  background: transparent;
  animation: none;
}

.btn-color-rainbow:hover::before {
  opacity: 1;
  background: conic-gradient(
    from var(--rainbow-angle),
    hsl(330, 100%, 58%),
    hsl(280, 95%, 55%),
    hsl(220, 95%, 58%),
    hsl(160, 90%, 48%),
    hsl(50, 100%, 52%),
    hsl(25, 100%, 55%),
    hsl(330, 100%, 58%)
  );
  animation: btn-color-rainbow-spin 2.4s linear infinite;
}

/* Color mode on: ring stays neutral (no rainbow) so it doesn’t fight the canvas. */
.btn-color-rainbow:hover:has(.btn-text[aria-pressed="true"])::before {
  background: conic-gradient(
    from 0deg,
    hsl(220, 6%, 34%),
    hsl(220, 5%, 44%),
    hsl(220, 4%, 30%),
    hsl(220, 6%, 40%),
    hsl(220, 5%, 36%),
    hsl(220, 6%, 34%)
  );
  animation: none;
}

.btn-color-rainbow .btn-text {
  position: relative;
  z-index: 1;
}

.btn-color-rainbow:hover .btn-text {
  border-color: transparent;
  background: #16161f;
}

.btn-color-rainbow:hover .btn-text[aria-pressed="true"] {
  border-color: var(--accent-dim);
  color: var(--accent);
}

@keyframes btn-color-rainbow-spin {
  from {
    --rainbow-angle: 0deg;
  }
  to {
    --rainbow-angle: 360deg;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .btn-color-rainbow::before {
    animation: none !important;
  }

  .btn-color-rainbow:hover::before {
    opacity: 0.85;
  }

  .video-wrap {
    filter: none !important;
    transform: none !important;
  }

  .controls-bar {
    opacity: 1 !important;
    transform: none !important;
  }

  .music-bar:not(.music-bar--hidden-by-video-audio) {
    opacity: 1 !important;
    transform: none !important;
  }

  .hero-overlay {
    opacity: 0.5 !important;
  }
}

@media (max-width: 640px) {
  .video-select {
    width: 100%;
    margin-left: 0;
  }

  .video-select-input {
    flex: 1;
    max-width: none;
  }

  .controls > .dens:first-of-type {
    margin-left: 0;
  }

  .dens {
    width: 100%;
  }

  .controls .dens.dens-audio-clip:not(.dens-audio-clip--on) {
    width: 0;
    min-width: 0;
    flex: 0 0 0;
    overflow: hidden;
  }

  .controls .dens.dens-audio-clip.dens-audio-clip--on {
    width: 100%;
    max-width: none;
  }

  .music-bar {
    grid-template-columns: 1fr;
    padding: 0.65rem 0.85rem;
  }

  .music-bar__right {
    justify-content: stretch;
    flex-wrap: wrap;
  }

  .music-bar__track-label {
    max-width: none;
    width: 100%;
  }
}

