/* ==========================================================================
   Letter picker — position-scoped replacement dialog.
   Selected state is drawn outside the photograph: an offset ring plus a text
   badge, so it never depends on colour alone and never touches the image.
   ========================================================================== */

.picker {
  border: none;
  padding: 0;
  width: min(58rem, calc(100vw - 2rem));
  max-height: min(84vh, 48rem);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  overflow: hidden;
}

.picker::backdrop { background: rgb(22 24 28 / 0.5); }

.picker__inner { display: grid; grid-template-rows: auto 1fr auto; max-height: inherit; }

.picker__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-5);
  border-bottom: 1px solid var(--rule);
}

.picker__title { font-size: var(--step-1); font-weight: 500; }
.picker__subtitle { font-size: 0.875rem; color: var(--ink-soft); margin-top: var(--space-1); }

.picker__close {
  font: inherit;
  font-size: 1.5rem;
  line-height: 1;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--ink-soft);
  cursor: pointer;
  padding: var(--space-2) var(--space-3);
}
.picker__close:hover { background: var(--surface); color: var(--ink); }

.picker__body { overflow-y: auto; padding: var(--space-5); }

.variants {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(6.25rem, 1fr));
  gap: var(--space-4);
  list-style: none;
  margin: 0;
  padding: 0;
}

.variant__button {
  display: grid;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-2);
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-align: center;
  transition: background 120ms ease, border-color 120ms ease;
}

.variant__button:hover { background: var(--paper-warm); border-color: var(--rule); }
.variant__button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Current selection: ring drawn clear of the image, plus the text badge below.
   Two independent cues, neither of which is colour on its own. */
.variant--current .variant__button {
  border-color: var(--ink);
  background: var(--paper-warm);
  box-shadow: 0 0 0 1px var(--ink);
}

.variant__code {
  font-size: 0.6875rem;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

.variant--current .variant__code { color: var(--ink); font-weight: 500; }

.variant__state {
  font-size: 0.625rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
}

.variant__used {
  font-size: 0.625rem;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}

.picker__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--rule);
  background: var(--paper-warm);
  font-size: 0.875rem;
  color: var(--ink-soft);
}

@media (max-width: 32rem) {
  .picker { width: 100vw; max-width: 100vw; max-height: 100vh; height: 100vh; border-radius: 0; }
  .picker__inner { max-height: 100vh; }
  .variants { grid-template-columns: repeat(auto-fill, minmax(5rem, 1fr)); gap: var(--space-3); }
}
