/* Color Palette Studio — a full-height row of role-based brand swatches you can
   lock, regenerate, and fine-tune, styled to sit inside the Admit One brand. */

.palette-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* Slim, subtle top strip: a back link on the left, the brand mark centered. */
.palette-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  padding: 10px clamp(16px, 4vw, 40px);
  background: var(--black);
  border-bottom: 1px solid rgba(251, 247, 238, 0.14);
}

.palette-bar .back-link {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 8px;
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid var(--gold);
  border-radius: 999px;
  background: var(--gold);
  color: var(--black);
  font-size: 0.84rem;
  font-weight: 800;
  transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}

.palette-bar .back-link:hover,
.palette-bar .back-link:focus-visible {
  background: var(--warm);
  color: var(--black);
  border-color: var(--warm);
  outline: 0;
}

.palette-bar .back-arrow {
  font-size: 1.1em;
  line-height: 1;
}

.palette-bar .bar-brand {
  display: inline-flex;
  align-items: center;
  justify-self: center;
}

.palette-bar .bar-brand img {
  display: block;
  width: auto;
  height: 24px;
  filter: brightness(0) invert(1);
}

/* Toolbar strip directly under the swatches. */
.palette-toolbar {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 10px 14px;
  padding: 14px clamp(16px, 4vw, 40px);
  background: var(--paper);
  border-top: 1px solid var(--line-strong);
}

.palette-toolbar .toolbar-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  min-width: 0;
  justify-self: start;
}

.palette-toolbar .toolbar-cue {
  min-width: 0;
  justify-self: center;
}

.palette-toolbar .toolbar-group.is-end {
  justify-self: end;
}

.palette-toolbar .button {
  min-height: 40px;
}

/* Brand-color picker. */
.brand-pick {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.brand-pick input[type="color"] {
  width: 44px;
  height: 38px;
  padding: 2px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--warm);
  cursor: pointer;
}

.brand-pick input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.brand-pick input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 7px;
}

.brand-pick input[type="color"]:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}

.toolbar-hint {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  white-space: nowrap;
  animation: cue-breathe 2.8s ease-in-out infinite;
}

.copy-menu {
  position: relative;
  display: none;
}

.copy-menu-toggle {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--black);
  color: var(--warm);
  cursor: pointer;
  box-shadow: 0 9px 20px rgba(26, 23, 16, 0.14);
  transition: background-color 150ms ease, transform 150ms ease;
}

.copy-menu-toggle svg {
  width: 18px;
  height: 18px;
  display: block;
}

.copy-menu-toggle:hover,
.copy-menu-toggle:focus-visible,
.copy-menu-toggle[aria-expanded="true"] {
  background: var(--gold);
  color: var(--black);
  outline: 0;
  transform: translateY(-1px);
}

.copy-menu-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  z-index: 20;
  min-width: 164px;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.copy-menu-panel[hidden] {
  display: none;
}

.copy-menu-panel button {
  width: 100%;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 6px;
  color: var(--black);
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.copy-menu-panel button:hover,
.copy-menu-panel button:focus-visible {
  background: var(--gold);
  outline: 0;
}

kbd {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--warm);
  color: var(--black);
  font-family: var(--sans);
  font-size: 0.76rem;
  font-weight: 800;
}

@keyframes cue-breathe {
  0%,
  100% {
    opacity: 0.74;
    transform: translateY(0);
  }

  50% {
    opacity: 1;
    transform: translateY(-1px);
  }
}

/* The swatch stage fills the rest of the viewport. */
.palette-stage {
  flex: 1;
  display: flex;
  min-height: 0;
}

.palette-row {
  flex: 1;
  display: flex;
  width: 100%;
}

.swatch {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  padding: 26px 12px 40px;
  background: var(--swatch, #ccc);
  color: var(--ink, #1a1710);
  cursor: default;
  overflow: hidden;
  transition: flex-grow 320ms ease;
}

.swatch:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: -7px;
}

.swatch-controls {
  display: flex;
  gap: 8px;
  opacity: 0.5;
  transform: translateY(6px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.swatch:hover .swatch-controls,
.swatch:focus-within .swatch-controls,
.swatch.is-locked .swatch-controls {
  opacity: 1;
  transform: none;
}

.swatch-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--ink) 12%, transparent);
  color: inherit;
  cursor: pointer;
  transition: background-color 150ms ease, transform 150ms ease;
}

.swatch-btn svg {
  width: 18px;
  height: 18px;
  display: block;
}

.swatch-btn:hover,
.swatch-btn:focus-visible {
  background: color-mix(in srgb, var(--ink) 22%, transparent);
  transform: translateY(-2px);
  outline: 0;
}

.swatch.is-locked .swatch-lock {
  background: color-mix(in srgb, var(--ink) 88%, transparent);
  color: var(--swatch);
}

.swatch-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  max-width: 100%;
  text-align: center;
}

.swatch-role {
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.74;
}

.swatch-hex {
  background: none;
  color: inherit;
  padding: 3px 6px;
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  cursor: pointer;
  border-radius: 6px;
  transition: background-color 150ms ease;
}

.swatch-hex:hover,
.swatch-hex:focus-visible {
  background: color-mix(in srgb, var(--ink) 14%, transparent);
  outline: 0;
}

.swatch-name {
  max-width: 100%;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  opacity: 0.82;
  overflow-wrap: anywhere;
}

/* Shade mode: the swatch itself becomes seven full-width color segments. */
.swatch-role,
.swatch-controls,
.swatch-info {
  position: relative;
  z-index: 2;
}

.swatch.is-showing-shades {
  gap: 0;
  padding: 0;
  background: var(--swatch);
}

.swatch.is-showing-shades .swatch-controls {
  display: none;
}

.swatch.is-showing-shades .swatch-role {
  display: none;
}

.swatch.is-showing-shades .swatch-info {
  display: none;
}

.swatch-shades[aria-expanded="true"] {
  background: color-mix(in srgb, var(--ink) 88%, transparent);
  color: var(--swatch);
}

.swatch-shade-stack {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: repeat(7, minmax(0, 1fr));
  gap: 0;
}

.shade-step {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  border-top: 1px solid color-mix(in srgb, var(--shade-ink) 18%, transparent);
  border-radius: 0;
  background: var(--shade);
  color: var(--shade-ink);
  font-size: clamp(0.62rem, 0.78vw, 0.82rem);
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: color 120ms ease;
}

.shade-step:first-child {
  border-top: 0;
}

.shade-hex {
  position: relative;
  z-index: 1;
  text-shadow: 0 1px 8px color-mix(in srgb, var(--shade) 42%, transparent);
}

.shade-step:hover,
.shade-step:focus-visible {
  outline: 0;
}

.shade-step:hover .shade-hex,
.shade-step:focus-visible .shade-hex {
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.shade-step.is-current .shade-hex {
  font-size: 1.42em;
  font-weight: 950;
}

/* Toast feedback for copy actions. */
.palette-toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 90;
  transform: translate(-50%, 18px);
  padding: 11px 20px;
  border-radius: 999px;
  background: var(--black);
  color: var(--warm);
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transition: opacity 200ms ease, transform 200ms ease, visibility 200ms ease;
}

.palette-toast.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

@media (prefers-reduced-motion: reduce) {
  .swatch,
  .swatch-controls,
  .swatch-btn,
  .shade-step,
  .toolbar-hint,
  .copy-menu-toggle,
  .palette-toast {
    transition: none;
    animation: none;
  }
}

@media (hover: none) {
  .swatch-controls {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 760px) {
  .palette-row {
    flex-direction: column;
  }

  .swatch {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 76px;
    padding: 12px 18px;
  }

  .swatch-controls {
    transform: none;
    opacity: 1;
  }

  .swatch-btn {
    width: 38px;
    height: 38px;
  }

  .swatch-info {
    align-items: flex-end;
    text-align: right;
  }

  .swatch.is-showing-shades {
    min-height: 76px;
    padding: 12px 18px;
  }

  .swatch-shade-stack {
    width: 100%;
    height: 100%;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    grid-template-rows: minmax(0, 1fr);
  }

  .shade-step {
    border-top: 0;
    border-left: 1px solid color-mix(in srgb, var(--shade-ink) 18%, transparent);
    font-size: clamp(0.52rem, 2.15vw, 0.62rem);
    letter-spacing: 0.01em;
  }

  .shade-step:first-child {
    border-left: 0;
  }

  .shade-step.is-current .shade-hex {
    font-size: 1.18em;
  }

  .palette-toolbar {
    grid-template-columns: minmax(42px, 1fr) auto minmax(42px, 1fr);
    justify-items: stretch;
    gap: 8px 10px;
    padding-block: 10px;
  }

  .palette-toolbar .toolbar-group {
    justify-content: center;
    justify-self: center;
  }

  .palette-toolbar .toolbar-group:not(.is-end) {
    display: contents;
  }

  .palette-toolbar .toolbar-cue {
    display: none;
  }

  .palette-toolbar .toolbar-group.is-end {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
  }

  #generateBtn {
    grid-column: 2;
    grid-row: 1;
    justify-self: center;
  }

  .brand-pick {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
    gap: 0;
  }

  .brand-pick-label,
  .copy-desktop {
    display: none;
  }

  .copy-menu {
    display: block;
  }
}

@media (max-width: 520px) {
  .palette-bar {
    gap: 8px;
    grid-template-columns: minmax(44px, 1fr) auto minmax(44px, 1fr);
  }

  .palette-bar .back-link {
    justify-content: center;
    width: 44px;
    min-height: 36px;
    padding: 0;
    font-size: 0;
  }

  .palette-bar .back-arrow {
    font-size: 1rem;
  }

  .palette-bar .bar-brand img {
    height: 20px;
  }
}
