/* Accent colour easter egg (accent.js). The K's five dots always wear the accent. Near the K, twelve dots of colour
   fan out around it with a "Pick a colour" link. Holding the K swells its dots one by one along the letter, then the
   picker opens under it. Loaded on every layout. */

/* The K and its ring, wrapped by accent.js; the wrapper takes the K's place in the menu grid. */
.nav-brand-wrap {
  position: relative;
  grid-column: 1;
  justify-self: start;
  display: inline-flex;
  align-items: center;
}

.nav-brand {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.nav-brand circle {
  fill: var(--accent, #d64553);
  transform-box: fill-box;
  transform-origin: center;
  transition: fill 300ms ease, transform 300ms ease;
}

/* Along the stroke of the K: top left, middle, top right, bottom right, bottom left. */
.nav-brand.is-holding circle {
  animation: accent-k-node 150ms ease-out forwards;
}

.nav-brand.is-holding circle:nth-of-type(5) { animation-delay: 90ms; }
.nav-brand.is-holding circle:nth-of-type(3) { animation-delay: 180ms; }
.nav-brand.is-holding circle:nth-of-type(4) { animation-delay: 270ms; }
.nav-brand.is-holding circle:nth-of-type(2) { animation-delay: 360ms; }

.nav-brand.is-near circle,
.nav-brand.is-picking circle {
  transform: scale(1.3);
}

/* The ring: a point at the centre of the K, with the dots on a circle around it. */
.accent-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  width: 0;
  height: 0;
}

.accent-ring-dot {
  position: absolute;
  left: -0.22rem;
  top: -0.22rem;
  width: 0.44rem;
  height: 0.44rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 8px color-mix(in srgb, var(--c) 55%, transparent);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: rotate(var(--a)) translateY(0) scale(0);
  transition:
    transform 260ms ease calc(var(--i) * 12ms),
    opacity 160ms ease calc(var(--i) * 12ms),
    visibility 0s linear 420ms;
}

/* A larger target than the dot itself. */
.accent-ring-dot::before {
  content: "";
  position: absolute;
  inset: -0.28rem;
  border-radius: 50%;
}

.accent-ring.is-open .accent-ring-dot {
  opacity: 1;
  visibility: visible;
  transform: rotate(var(--a)) translateY(-1.8rem) scale(1);
  transition:
    transform 420ms cubic-bezier(0.2, 0.9, 0.25, 1.25) calc(var(--i) * 22ms),
    opacity 200ms ease calc(var(--i) * 22ms),
    visibility 0s;
}

.accent-ring.is-open .accent-ring-dot:hover,
.accent-ring.is-open .accent-ring-dot:focus-visible {
  transform: rotate(var(--a)) translateY(-1.8rem) scale(1.7);
  transition-delay: 0s;
}

.accent-ring-dot[aria-pressed="true"] {
  box-shadow: 0 0 0 1.5px #080808, 0 0 0 2.5px #fafafa;
}

.accent-ring-dot:focus-visible {
  outline: none;
  box-shadow: 0 0 0 1.5px #080808, 0 0 0 2.5px #fafafa;
}

/* The link beside the ring. */
.accent-ring-more {
  position: absolute;
  top: 0;
  left: 2.75rem;
  padding: 0.3rem 0;
  border: 0;
  background: none;
  color: rgba(250, 250, 250, 0.62);
  font: 500 0.74rem/1.2 "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0.02em;
  white-space: nowrap;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translate(-0.35rem, -50%);
  transition: opacity 160ms ease, transform 200ms ease, visibility 0s linear 220ms, color 200ms ease;
}

.accent-ring.is-open .accent-ring-more {
  opacity: 1;
  visibility: visible;
  transform: translate(0, -50%);
  transition: opacity 260ms ease 240ms, transform 320ms ease 240ms, visibility 0s, color 200ms ease;
}

.accent-ring-more:hover,
.accent-ring-more:focus-visible {
  color: #fafafa;
  text-decoration: underline;
  text-decoration-color: var(--accent, #d64553);
  text-underline-offset: 0.3em;
}

.accent-ring-more:focus-visible {
  outline: none;
}

@keyframes accent-k-node {
  to {
    transform: scale(1.7);
  }
}

/* The picker */
.accent-picker {
  position: fixed;
  z-index: 1300;
  width: 16.5rem;
  max-width: calc(100vw - 24px);
  padding: 1rem;
  border: 1px solid rgba(250, 250, 250, 0.12);
  border-radius: 0.5rem;
  background: rgba(12, 12, 12, 0.94);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.45);
  color: #fafafa;
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.8rem;
  line-height: 1.4;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
  transform-origin: top left;
  transition: opacity 200ms ease, transform 240ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.accent-picker.is-open {
  opacity: 1;
  transform: none;
}

.accent-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.9rem;
  color: rgba(250, 250, 250, 0.6);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.accent-picker-chip {
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: var(--accent, #d64553);
  box-shadow: 0 0 14px var(--accent, #d64553);
}

/* The hue ring as a slider: the track is painted by accent.js with the ring's colours. */
.accent-picker-hue {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 0.85rem;
  margin: 0;
  border-radius: 999px;
  cursor: pointer;
}

.accent-picker-hue::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 1.15rem;
  height: 1.15rem;
  border: 2px solid #fafafa;
  border-radius: 50%;
  background: var(--accent, #d64553);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.5);
}

.accent-picker-hue::-moz-range-thumb {
  width: 1.15rem;
  height: 1.15rem;
  border: 2px solid #fafafa;
  border-radius: 50%;
  background: var(--accent, #d64553);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.5);
}

.accent-picker-swatches {
  display: flex;
  justify-content: space-between;
  margin-top: 1rem;
}

.accent-picker-swatches button {
  width: 1.55rem;
  height: 1.55rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--c);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  cursor: pointer;
  transition: transform 200ms ease, box-shadow 200ms ease;
}

.accent-picker-swatches button:hover {
  transform: scale(1.12);
}

.accent-picker-swatches button[aria-pressed="true"] {
  box-shadow: 0 0 0 2px #0c0c0c, 0 0 0 3px #fafafa;
}

.accent-picker-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1rem;
  padding-top: 0.8rem;
  border-top: 1px solid rgba(250, 250, 250, 0.08);
  color: rgba(250, 250, 250, 0.4);
}

.accent-picker-reset {
  padding: 0.2rem 0;
  border: 0;
  background: none;
  color: rgba(250, 250, 250, 0.72);
  font: inherit;
  text-decoration: underline;
  text-decoration-color: rgba(250, 250, 250, 0.25);
  text-underline-offset: 0.25em;
  cursor: pointer;
}

.accent-picker-reset:hover {
  color: #fafafa;
}

.accent-picker :focus-visible {
  outline: 2px solid #fafafa;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .accent-picker,
  .nav-brand circle,
  .accent-ring-dot,
  .accent-ring.is-open .accent-ring-dot,
  .accent-ring-more,
  .accent-ring.is-open .accent-ring-more {
    transition: none;
  }

  .nav-brand.is-holding circle {
    animation-duration: 1ms;
  }
}
