/* ==========================================================================
   Generation'26 — colour themes

   Ten palettes. Each sets four tokens and the whole page follows, because
   every gradient, badge, counter, band and border in the build reads from
   these rather than carrying a colour of its own.

       --theme-color / --theme-rgb          the accent
       --secondary-color / --secondary-rgb  the partner it gradients into
       --dark-color / --dark-rgb            the band behind the dark sections

   The rgb pairs exist because the theme's gradients and shadows need
   rgba() with their own alpha; a hex token cannot be given one.

   Every dark colour here was checked to carry white text at 4.5:1 or
   better, since the dark bands reverse their type out of it.
   ========================================================================== */

:root,
[data-theme="vermilion"] {
  --theme-color: #FF3C1F;
  --theme-rgb: 255, 60, 31;
  --secondary-color: #FFC107;
  --secondary-rgb: 255, 193, 7;
  --dark-color: #001C3D;
  --dark-rgb: 0, 28, 61;
}

/* Gold on near-black. The results sheet the client keeps pointing at. */
[data-theme="gold"] {
  --theme-color: #F5A524;
  --theme-rgb: 245, 165, 36;
  --secondary-color: #FFD966;
  --secondary-rgb: 255, 217, 102;
  --dark-color: #14110B;
  --dark-rgb: 20, 17, 11;
}

/* Stage magenta into violet. */
[data-theme="magenta"] {
  --theme-color: #E4157B;
  --theme-rgb: 228, 21, 123;
  --secondary-color: #9B4DFF;
  --secondary-rgb: 155, 77, 255;
  --dark-color: #1B0B2A;
  --dark-rgb: 27, 11, 42;
}

/* Arena blue. */
[data-theme="electric"] {
  --theme-color: #2E6BFF;
  --theme-rgb: 46, 107, 255;
  --secondary-color: #24D3EE;
  --secondary-rgb: 36, 211, 238;
  --dark-color: #06142E;
  --dark-rgb: 6, 20, 46;
}

/* Green into lime. */
[data-theme="emerald"] {
  --theme-color: #00A76F;
  --theme-rgb: 0, 167, 111;
  --secondary-color: #8FD14F;
  --secondary-rgb: 143, 209, 79;
  --dark-color: #04241C;
  --dark-rgb: 4, 36, 28;
}

/* Deep purple into pink. */
[data-theme="violet"] {
  --theme-color: #7B3FF2;
  --theme-rgb: 123, 63, 242;
  --secondary-color: #FF6FD8;
  --secondary-rgb: 255, 111, 216;
  --dark-color: #14082E;
  --dark-rgb: 20, 8, 46;
}

/* Sunset. */
[data-theme="coral"] {
  --theme-color: #FF5D5D;
  --theme-rgb: 255, 93, 93;
  --secondary-color: #FFA36C;
  --secondary-rgb: 255, 163, 108;
  --dark-color: #2A0F16;
  --dark-rgb: 42, 15, 22;
}

/* Teal into sand. */
[data-theme="teal"] {
  --theme-color: #0E9594;
  --theme-rgb: 14, 149, 148;
  --secondary-color: #E8C547;
  --secondary-rgb: 232, 197, 71;
  --dark-color: #062626;
  --dark-rgb: 6, 38, 38;
}

/* Crimson into amber. */
[data-theme="crimson"] {
  --theme-color: #D7263D;
  --theme-rgb: 215, 38, 61;
  --secondary-color: #F46036;
  --secondary-rgb: 244, 96, 54;
  --dark-color: #1E0A10;
  --dark-rgb: 30, 10, 16;
}

/* Monochrome: one accent, no partner. For anyone who wants the pictures
   to carry the colour. */
[data-theme="mono"] {
  --theme-color: #111111;
  --theme-rgb: 17, 17, 17;
  --secondary-color: #6B6B6B;
  --secondary-rgb: 107, 107, 107;
  --dark-color: #111111;
  --dark-rgb: 17, 17, 17;
}

/* ==========================================================================
   The picker
   ========================================================================== */
.theme-switch {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.theme-switch.is-open {
  transform: translateX(0);
}

.theme-switch__toggle {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: var(--theme-color);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  border-radius: 8px 0 0 8px;
  box-shadow: -4px 4px 14px rgba(0, 0, 0, .2);
  transition: background .25s ease, transform .2s ease;
}

.theme-switch__toggle:hover {
  transform: scale(1.05);
}

.theme-switch__panel {
  width: var(--panel-w);
  padding: 16px 14px;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, .12);
  border-right: 0;
  border-radius: 0 0 0 10px;
  box-shadow: -8px 10px 30px rgba(0, 0, 0, .16);
  box-sizing: border-box;
}

.theme-switch__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.theme-switch__panel h6 {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: #44474c;
}

.theme-switch__close {
  background: transparent;
  border: none;
  padding: 0;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  color: #888;
  cursor: pointer;
  border-radius: 4px;
  transition: color .2s, background .2s;
}

.theme-switch__close:hover {
  color: #111;
  background: rgba(0, 0, 0, .06);
}

.theme-switch__grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.theme-swatch {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  cursor: pointer;
  /* the two colours the theme actually is, split down the middle */
  background: linear-gradient(135deg, var(--sw-a) 0 50%, var(--sw-b) 50% 100%);
  transition: transform .18s ease, box-shadow .18s ease;
}

.theme-swatch:hover {
  transform: scale(1.18);
}

.theme-swatch[aria-pressed="true"] {
  border-color: #111;
  box-shadow: 0 0 0 2px #fff inset;
}

@media only screen and (max-width: 767px) {
  .theme-switch {
    --panel-w: 175px;
    top: 130px;
  }
  .theme-switch__toggle {
    width: 36px;
    height: 36px;
    font-size: 14px;
  }
  .theme-switch__panel {
    padding: 12px;
  }
}

@media print {
  .theme-switch { display: none; }
}
