/* Fabric swatch picker — matches the falcon theme and pixel_tablequote (gold #bc8246, Mulish). */

.fp {
  --fp-gold: #bc8246;
  --fp-gold-dark: #9c6a36;
  --fp-gold-soft: #f6ede3;
  --fp-ink: #232323;
  --fp-muted: #8a8a94;
  --fp-line: #e6e1da;
  --fp-white: #fff;
  --fp-danger: #c0392b;
  --fp-success: #3c8d4f;
  --fp-radius: 14px;
  --fp-ease: cubic-bezier(.22, .8, .24, 1);
  --fp-chip: 52px;
  margin: .25rem 0 1.25rem;
  padding: 16px 16px 12px;
  font-family: "Mulish", Roboto, sans-serif;
  color: var(--fp-ink);
  background: var(--fp-white);
  border: 1px solid var(--fp-line);
  border-radius: var(--fp-radius);
  position: relative;
  container-type: inline-size;
  transition: border-color .25s, box-shadow .25s;
}

.fp svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- Header ---------- */

.fp-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
}

.fp-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
}

.fp-icon {
  width: 20px;
  height: 20px;
  color: var(--fp-gold);
}

.fp-current {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--fp-muted);
}

.fp-current__chip {
  display: none;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  background: var(--fp-image, none) center / cover no-repeat, var(--fp-color, #ccc);
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1);
}

.fp-current__chip.is-visible {
  display: inline-block;
}

.fp-current__value {
  font-weight: 600;
  color: var(--fp-muted);
}

.fp.has-choice .fp-current__value {
  color: var(--fp-ink);
}

.fp-lead {
  margin: 4px 0 12px;
  font-size: 13px;
  color: var(--fp-muted);
}

/* ---------- Collection tabs ---------- */

/* Tabs wrap instead of scrolling: a hidden horizontal scroller gave no hint that more collections exist. */
.fp-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}

.fp-tab,
.fp-swatch {
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.fp-tab {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--fp-ink);
  white-space: nowrap;
  background: var(--fp-white);
  border: 1px solid var(--fp-line);
  border-radius: 999px;
  cursor: pointer;
  transition: border-color .2s, background-color .2s, color .2s;
}

.fp-tab:hover {
  border-color: var(--fp-gold);
}

.fp-tab:focus-visible,
.fp-swatch:focus-visible,
.fp-btn:focus-visible {
  outline: 2px solid var(--fp-gold);
  outline-offset: 2px;
}

.fp-tab[aria-selected="true"] {
  color: var(--fp-gold-dark);
  background: var(--fp-gold-soft);
  border-color: var(--fp-gold);
}

.fp-tab__count {
  min-width: 20px;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  color: var(--fp-muted);
  background: #f2f0ec;
  border-radius: 999px;
}

.fp-tab[aria-selected="true"] .fp-tab__count {
  color: var(--fp-white);
  background: var(--fp-gold);
}

.fp-tab--other {
  border-style: dashed;
}

/* ---------- Collection header ---------- */

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

.fp.is-all .fp-panel + .fp-panel:not([data-fp-panel="other"]) {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--fp-line);
}

.fp-coll {
  margin: 0 0 10px;
}

.fp-coll__name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--fp-ink);
  text-transform: none;
  letter-spacing: 0;
}

.fp-coll__material {
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--fp-gold-dark);
  text-transform: uppercase;
  letter-spacing: .04em;
  background: var(--fp-gold-soft);
  border-radius: 999px;
}

.fp-coll__desc {
  margin: 4px 0 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--fp-muted);
}

/* ---------- Swatches ---------- */

.fp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--fp-chip), 1fr));
  gap: 12px 10px;
}

.fp-swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

.fp-swatch__chip {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--fp-chip);
  height: var(--fp-chip);
  overflow: hidden;
  background: var(--fp-image, none) center / cover no-repeat, var(--fp-color, #ccc);
  border-radius: 12px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
  transition: transform .2s var(--fp-ease), box-shadow .2s;
}

/* Woven texture for colour-only swatches, so they read as fabric rather than paint. */
.fp-swatch:not(.fp-swatch--photo) .fp-swatch__chip::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .09) 0 1px, transparent 1px 4px),
    repeating-linear-gradient(-45deg, rgba(0, 0, 0, .07) 0 1px, transparent 1px 4px),
    radial-gradient(circle at 30% 25%, rgba(255, 255, 255, .22), transparent 60%);
  pointer-events: none;
}

.fp-swatch:hover .fp-swatch__chip {
  transform: translateY(-2px);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08), 0 8px 18px -10px rgba(0, 0, 0, .45);
}

.fp-swatch[aria-checked="true"] .fp-swatch__chip {
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08), 0 0 0 2px var(--fp-white), 0 0 0 4px var(--fp-gold);
}

.fp-swatch__check {
  position: relative;
  width: 24px;
  height: 24px;
  padding: 4px;
  color: var(--fp-gold-dark);
  background: rgba(255, 255, 255, .92);
  border-radius: 50%;
  opacity: 0;
  transform: scale(.6);
  transition: opacity .2s, transform .25s var(--fp-ease);
  stroke-width: 2.6;
}

.fp-swatch[aria-checked="true"] .fp-swatch__check {
  opacity: 1;
  transform: scale(1);
}

.fp-swatch__code {
  max-width: 100%;
  overflow: hidden;
  font-size: 11.5px;
  line-height: 1.2;
  color: var(--fp-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fp-swatch[aria-checked="true"] .fp-swatch__code {
  font-weight: 700;
  color: var(--fp-ink);
}

/* ---------- Zoom ---------- */

.fp-cell {
  position: relative;
  display: flex;
  justify-content: center;
  min-width: 0;
}

.fp-cell .fp-swatch {
  width: 100%;
}

/* Touch only: pointer devices get the hover zoom instead. */
.fp-zoom-btn {
  position: absolute;
  top: -7px;
  right: calc(50% - var(--fp-chip) / 2 - 7px);
  display: none;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  color: var(--fp-ink);
  background: var(--fp-white);
  border: 0;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.fp-zoom-btn svg {
  width: 15px;
  height: 15px;
  stroke-width: 2.2;
}

@media (hover: none) {
  .fp-zoom-btn {
    display: grid;
  }
}

.fp-pop {
  position: absolute;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 196px;
  padding: 8px 8px 10px;
  background: var(--fp-white);
  border-radius: var(--fp-radius);
  box-shadow: 0 14px 34px -12px rgba(0, 0, 0, .45), 0 0 0 1px rgba(0, 0, 0, .05);
  pointer-events: none;
}

.fp-pop[hidden] {
  display: none;
}

.fp-pop__chip,
.fp-dialog__chip {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  /* Enlarged views use the 640 px photo when the fabric has one; the grid thumbnail is the fallback. */
  background: var(--fp-image-large, var(--fp-image, none)) center / cover no-repeat, var(--fp-color, #ccc);
  border-radius: 10px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
}

.fp-pop__name {
  font-size: 13px;
  font-weight: 700;
  color: var(--fp-ink);
}

.fp-pop__material,
.fp-dialog__material {
  padding: 2px 8px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--fp-gold-dark);
  text-transform: uppercase;
  letter-spacing: .04em;
  background: var(--fp-gold-soft);
  border-radius: 999px;
}

.fp-pop__material[hidden],
.fp-dialog__material[hidden] {
  display: none;
}

.fp-dialog {
  width: min(92vw, 340px);
  max-width: none;
  padding: 0;
  font-family: "Mulish", Roboto, sans-serif;
  color: var(--fp-ink);
  background: var(--fp-white);
  border: 0;
  border-radius: 18px;
}

.fp-dialog::backdrop {
  background: rgba(20, 16, 12, .6);
}

.fp-dialog__inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px;
}

.fp-dialog__close {
  position: absolute;
  top: 24px;
  right: 24px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--fp-ink);
  background: rgba(255, 255, 255, .92);
  border: 0;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .2);
  cursor: pointer;
}

.fp-dialog__close svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.2;
}

.fp-dialog__name {
  margin: 6px 0 0;
  font-size: 17px;
  font-weight: 700;
}

.fp-dialog__choose {
  width: 100%;
  margin-top: 8px;
}

/* ---------- Other fabric ---------- */

.fp-other__lead {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--fp-muted);
}

.fp-other {
  display: flex;
  gap: 8px;
}

.fp-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 42px;
  padding: 0 12px;
  font: inherit;
  font-size: 14px;
  color: var(--fp-ink);
  background: var(--fp-white);
  border: 1px solid var(--fp-line);
  border-radius: 10px;
  transition: border-color .2s, box-shadow .2s;
}

.fp-input:focus {
  border-color: var(--fp-gold);
  box-shadow: 0 0 0 3px rgba(188, 130, 70, .18);
  outline: none;
}

.fp-btn {
  flex: 0 0 auto;
  height: 42px;
  padding: 0 18px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  color: var(--fp-white);
  background: var(--fp-gold);
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  transition: background-color .2s;
}

.fp-btn:hover {
  background: var(--fp-gold-dark);
}

/* ---------- Messages ---------- */

.fp-status,
.fp-error {
  margin: 12px 0 0;
  font-size: 13px;
}

.fp-status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--fp-muted);
}

.fp-status[hidden],
.fp-error[hidden] {
  display: none;
}

.fp-status[data-state="busy"]::before {
  content: "";
  width: 12px;
  height: 12px;
  border: 2px solid var(--fp-line);
  border-top-color: var(--fp-gold);
  border-radius: 50%;
  animation: fp-spin .7s linear infinite;
}

.fp-status[data-state="ok"] {
  color: var(--fp-success);
}

.fp-status[data-state="ok"]::before {
  content: "✓";
  font-weight: 700;
}

.fp-error {
  font-weight: 600;
  color: var(--fp-danger);
}

.fp-note {
  margin: 12px 0 0;
  font-size: 11.5px;
  color: var(--fp-muted);
}

.fp.is-flagged {
  border-color: var(--fp-danger);
  box-shadow: 0 0 0 3px rgba(192, 57, 43, .12);
  animation: fp-nudge .45s var(--fp-ease);
}

@keyframes fp-spin {
  to { transform: rotate(360deg); }
}

@keyframes fp-nudge {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-2px); }
}

/* A container query cannot restyle its own container, so the chip size is overridden on the grid. */
@container (max-width: 380px) {
  .fp-grid {
    --fp-chip: 46px;
  }

  .fp-head {
    flex-direction: column;
    gap: 2px;
  }

  .fp-tabs {
    gap: 6px;
  }

  .fp-tab {
    padding: 6px 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .fp *,
  .fp {
    animation: none !important;
    transition: none !important;
  }
}

/* "All" lists every collection, so smaller chips keep the picker short enough to reach "Add to cart". */
.fp.is-all .fp-grid {
  --fp-chip: 44px;
  gap: 10px 8px;
}
