/* Reusable components. See DESIGN.md §7. */

/* Icon */

.icon {
  flex: none;
}

/* Button */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 3rem;
  padding: var(--space-2) var(--space-6);
  border: 2px solid transparent;
  border-radius: var(--radius-pill);
  font-size: var(--text-base);
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color var(--duration-fast) ease,
    border-color var(--duration-fast) ease,
    transform var(--duration-fast) ease;
}

.button:active {
  transform: scale(0.98);
}

.button:disabled,
.button[aria-disabled='true'] {
  opacity: 0.45;
  cursor: not-allowed;
}

.button--primary {
  background: var(--color-coral-600);
  color: var(--color-white);
}

.button--primary:hover:not(:disabled) {
  background: var(--color-coral-700);
}

.button--secondary {
  border-color: var(--color-ink-900);
  background: transparent;
  color: var(--color-ink-900);
}

.button--secondary:hover:not(:disabled) {
  background: var(--color-ink-900);
  color: var(--color-white);
}

.button--ghost {
  background: transparent;
  color: var(--text-primary);
}

.button--ghost:hover:not(:disabled) {
  background: var(--surface-quiet);
}

.button--block {
  width: 100%;
}

.button--lg {
  min-height: 3.5rem;
  font-size: var(--text-lg);
}

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--tap-min);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.link-arrow:hover {
  text-decoration: underline;
}

/* Chip: small toggle or filter */

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--tap-min);
  padding: 0 var(--space-4);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--color-white);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.chip:hover {
  border-color: var(--color-ink-900);
}

.chip[aria-pressed='true'],
.chip[aria-current='true'],
.chip.is-active {
  border-color: var(--color-ink-900);
  background: var(--color-ink-900);
  color: var(--color-white);
}

.chip-row {
  display: flex;
  gap: var(--space-2);
  margin-inline: calc(var(--gutter) * -1);
  padding: var(--space-1) var(--gutter);
  overflow-x: auto;
  scrollbar-width: none;
}

.chip-row::-webkit-scrollbar {
  display: none;
}

/* Badge */

.badge {
  display: inline-flex;
  align-items: center;
  height: 1.625rem;
  padding: 0 var(--space-3);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge--bestseller {
  background: var(--color-coral-600);
  color: var(--color-white);
}

.badge--new {
  background: var(--color-denim-700);
  color: var(--color-white);
}

.badge--limited {
  background: var(--color-butter-200);
  color: var(--color-ink-900);
}

/* Yarn picker: the signature control */

.yarn-picker {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.yarn-picker__legend {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  width: 100%;
  padding: 0;
  margin-bottom: var(--space-3);
}

.yarn-picker__label {
  font-size: var(--text-sm);
  font-weight: 600;
}

.yarn-picker__value {
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.yarn-picker__list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.yarn-picker--sm .yarn-picker__list {
  flex-wrap: nowrap;
  margin-inline: calc(var(--space-4) * -1);
  padding: var(--space-1) var(--space-4);
  overflow-x: auto;
  scrollbar-width: none;
}

.yarn-picker--sm .yarn-picker__list::-webkit-scrollbar {
  display: none;
}

.yarn {
  --yarn-size: 2.75rem;
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: var(--yarn-size);
  height: var(--yarn-size);
  border-radius: 50%;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.yarn-picker--sm .yarn {
  --yarn-size: 2.5rem;
}

/* A wound ball of yarn: highlight, crossing threads, then the colour itself. */
.yarn__ball {
  width: calc(var(--yarn-size) - 0.5rem);
  height: calc(var(--yarn-size) - 0.5rem);
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, rgb(255 255 255 / 0.45), transparent 46%),
    repeating-linear-gradient(38deg, rgb(0 0 0 / 0.13) 0 1.5px, transparent 1.5px 5px),
    repeating-linear-gradient(-52deg, rgb(255 255 255 / 0.16) 0 1.5px, transparent 1.5px 6px),
    var(--yarn);
  box-shadow:
    inset 0 -3px 6px rgb(0 0 0 / 0.22),
    0 1px 2px rgb(43 18 22 / 0.2);
  transition: transform var(--duration-fast) var(--ease-out);
}

.yarn--light .yarn__ball {
  box-shadow:
    inset 0 -3px 6px rgb(0 0 0 / 0.14),
    inset 0 0 0 1px rgb(43 18 22 / 0.18),
    0 1px 2px rgb(43 18 22 / 0.2);
}

.yarn:hover .yarn__ball {
  transform: scale(1.08);
}

.yarn__input:checked + .yarn__ball {
  outline: 2px solid var(--color-ink-900);
  outline-offset: 3px;
}

.yarn__input:focus-visible + .yarn__ball {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

.yarn-dots {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.yarn-dot {
  display: inline-block;
  flex: none;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  background: var(--yarn);
}

.yarn-dot--light {
  box-shadow: inset 0 0 0 1px rgb(43 18 22 / 0.22);
}

.yarn-dots__more {
  margin-left: 0.125rem;
  color: var(--text-muted);
  font-size: var(--text-xs);
}

/* Tinted bag */

.tinted-bag {
  position: relative;
  width: 100%;
  aspect-ratio: var(--bag-ratio);
  isolation: isolate; /* keeps the multiply blend inside the component */
}

.tinted-bag__color {
  position: absolute;
  inset: 0;
  background-color: var(--tint);
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  transition: background-color var(--duration-fast) ease;
}

.tinted-bag__image {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.tinted-bag--tintable .tinted-bag__image {
  mix-blend-mode: multiply;
}

/* Stitched surface: only for hand-made or customer-made things (DESIGN.md §2). */

.stitched {
  border: 2px dashed var(--color-coral-500);
  border-radius: var(--radius-lg);
  background: var(--color-white);
}

/* Product card and grids */

.product-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-6) var(--space-3);
}

.product-card__link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.product-card__photo {
  position: relative;
  aspect-ratio: 4 / 5;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface-quiet);
}

.product-card__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--duration-slow) var(--ease-out);
}

.product-card__link:hover .product-card__photo img {
  transform: scale(1.04);
}

.product-card__photo .badge {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
}

.product-card__body {
  padding-top: var(--space-3);
}

.product-card__name {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 400;
  line-height: 1.2;
}

.product-card__price {
  margin-top: var(--space-1);
  margin-bottom: var(--space-2);
  color: var(--text-secondary);
  font-weight: 500;
}

/* Horizontal snap scroller */

.scroller {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 62%;
  gap: var(--space-3);
  margin-inline: calc(var(--gutter) * -1);
  padding-inline: var(--gutter);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--gutter);
  scrollbar-width: none;
}

.scroller::-webkit-scrollbar {
  display: none;
}

.scroller > * {
  scroll-snap-align: start;
}

/* Cart lines */

.cart-lines {
  margin: 0;
}

.cart-line {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: var(--space-3);
  padding-block: var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
}

.cart-line__photo {
  aspect-ratio: 4 / 5;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-quiet);
}

.cart-line__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cart-line__body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.cart-line__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
}

.cart-line__name {
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: var(--text-lg);
  line-height: 1.2;
  text-decoration: none;
}

.cart-line__price {
  font-weight: 600;
  white-space: nowrap;
}

.cart-line__meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-1);
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.cart-line__quantity {
  margin-top: var(--space-1);
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.cart-line__controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: var(--space-3);
}

.cart-line__remove {
  display: inline-grid;
  place-items: center;
  width: var(--tap-min);
  height: var(--tap-min);
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-secondary);
}

.cart-line__remove:hover {
  background: var(--surface-quiet);
  color: var(--color-danger-600);
}

/* Quantity stepper */

.stepper {
  display: inline-flex;
  align-items: center;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--color-white);
}

.stepper__button {
  display: inline-grid;
  place-items: center;
  width: var(--tap-min);
  height: var(--tap-min);
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-primary);
}

.stepper__button:disabled {
  color: var(--text-muted);
  cursor: not-allowed;
}

.stepper__value {
  min-width: 1.75rem;
  font-weight: 600;
  text-align: center;
}

/* Totals */

.totals {
  display: grid;
  gap: var(--space-2);
}

.totals-row {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
}

.totals-row--strong {
  font-size: var(--text-lg);
  font-weight: 600;
}

.totals-row--total {
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-subtle);
  font-family: var(--font-display);
  font-size: var(--text-h3);
}

/* Free delivery progress */

.free-delivery {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--surface-quiet);
}

.free-delivery__text {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 500;
}

.free-delivery__track {
  height: 0.375rem;
  margin-top: var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--color-blush-300);
  overflow: hidden;
}

.free-delivery__track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--color-coral-600);
  transition: width var(--duration-base) var(--ease-out);
}

.free-delivery.is-reached .free-delivery__track span {
  background: var(--color-success-600);
}

/* Empty state */

.empty-state {
  display: grid;
  justify-items: center;
  gap: var(--space-3);
  padding: var(--space-9) var(--space-4);
  text-align: center;
}

/* Forms */

.form-grid {
  display: grid;
  gap: var(--space-4);
}

.field {
  display: grid;
  gap: var(--space-2);
}

.field__label {
  font-size: var(--text-sm);
  font-weight: 600;
}

.field__optional {
  color: var(--text-muted);
  font-weight: 400;
}

.field__hint {
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 3.25rem;
  padding: var(--space-3) var(--space-4);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--color-white);
  color: var(--text-primary);
  font-size: 1rem; /* 16px keeps iOS from zooming into the field */
}

.textarea {
  min-height: 7rem;
  resize: vertical;
}

.input::placeholder,
.textarea::placeholder {
  color: var(--text-muted);
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--color-ink-900);
}

.field.has-error .input,
.field.has-error .select,
.field.has-error .textarea {
  border-color: var(--color-danger-600);
}

.form-error {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  color: var(--color-danger-600);
  font-size: var(--text-sm);
  font-weight: 500;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  min-height: var(--tap-min);
  padding-block: var(--space-2);
  cursor: pointer;
}

.check input {
  flex: none;
  width: 1.375rem;
  height: 1.375rem;
  margin: 0.1rem 0 0;
  accent-color: var(--color-coral-600);
}

/* Option card: a radio or checkbox presented as a selectable card */

.option-list {
  display: grid;
  gap: var(--space-2);
}

.option {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 3.5rem;
  padding: var(--space-3) var(--space-4);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--color-white);
  cursor: pointer;
}

.option:has(input:checked) {
  border-color: var(--color-ink-900);
  box-shadow: inset 0 0 0 1px var(--color-ink-900);
}

.option:has(input:focus-visible) {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.option input {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  margin: 0;
  accent-color: var(--color-coral-600);
}

.option__body {
  flex: 1;
  min-width: 0;
}

.option__title {
  display: block;
  font-weight: 600;
}

.option__text {
  display: block;
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.option__price {
  font-weight: 600;
  white-space: nowrap;
}

/* Range slider */

.range {
  display: grid;
  gap: var(--space-1);
}

.range__label {
  font-size: var(--text-sm);
  font-weight: 600;
}

.range input {
  width: 100%;
  height: var(--tap-min);
  margin: 0;
  accent-color: var(--color-coral-600);
}

/* Accordion (native details) */

.accordion {
  border-top: 1px solid var(--border-subtle);
}

.accordion__item {
  border-bottom: 1px solid var(--border-subtle);
}

.accordion__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: 3.5rem;
  padding-block: var(--space-3);
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}

.accordion__summary::-webkit-details-marker {
  display: none;
}

.accordion__summary::after {
  content: '';
  flex: none;
  width: 0.625rem;
  height: 0.625rem;
  margin-right: var(--space-1);
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform var(--duration-fast) ease;
}

.accordion__item[open] .accordion__summary::after {
  transform: rotate(-135deg) translateY(-2px);
}

.accordion__panel {
  padding-bottom: var(--space-5);
  color: var(--text-secondary);
}

.accordion__panel > * + * {
  margin-top: var(--space-3);
}

/* Definition list used for product facts and order details */

.facts {
  display: grid;
  gap: var(--space-2);
}

.facts__row {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
}

.facts__row dt {
  color: var(--text-secondary);
}

.facts__row dd {
  color: var(--text-primary);
  font-weight: 500;
  text-align: right;
}

/* Promise list: icon + short text */

.promises {
  display: grid;
  gap: var(--space-3);
}

.promise {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  font-size: var(--text-sm);
}

.promise .icon {
  margin-top: 0.1rem;
  color: var(--color-coral-600);
}

/* Steps: only for real sequences */

.steps {
  display: grid;
  gap: var(--space-5);
  counter-reset: step;
}

.step {
  display: grid;
  grid-template-columns: 2.75rem 1fr;
  gap: var(--space-4);
  counter-increment: step;
}

.step::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 2px dashed var(--color-coral-500);
  border-radius: 50%;
  color: var(--color-coral-600);
  font-family: var(--font-display);
  font-size: var(--text-h3);
}

.step__title {
  font-family: var(--font-display);
  font-size: var(--text-h3);
  font-weight: 400;
  line-height: 1.2;
}

.step__text {
  margin-top: var(--space-1);
  color: var(--text-secondary);
}

/* Notice */

.notice {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-butter-200);
  font-size: var(--text-sm);
}

/* Toast */

.toast-region {
  position: fixed;
  left: 50%;
  bottom: calc(var(--space-4) + env(safe-area-inset-bottom));
  z-index: var(--layer-toast);
  width: min(calc(100% - 2rem), 26rem);
  transform: translateX(-50%);
  pointer-events: none;
}

.has-buybar .toast-region {
  bottom: calc(var(--buybar-height) + var(--space-4) + env(safe-area-inset-bottom));
}

.toast {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-pill);
  background: var(--color-ink-900);
  color: var(--color-white);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toast-in var(--duration-base) var(--ease-out);
}

.toast__action {
  min-height: 2rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--color-butter-200);
  font-weight: 600;
  text-decoration: underline;
  white-space: nowrap;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(0.75rem);
  }
}

/* Loader: a needle pulling a thread */

.stitch-loader {
  display: block;
  width: 4.5rem;
  height: 0.5rem;
  background: repeating-linear-gradient(90deg, var(--color-coral-500) 0 0.75rem, transparent 0.75rem 1.25rem);
  background-size: 1.25rem 100%;
  border-radius: var(--radius-pill);
  animation: stitch-run 700ms linear infinite;
}

@keyframes stitch-run {
  to {
    background-position: 1.25rem 0;
  }
}

/* Page title block used on inner pages */

.page-head {
  padding-block: var(--space-7) var(--space-6);
}

.page-head__text {
  margin-top: var(--space-3);
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.breadcrumb a {
  color: inherit;
}

.breadcrumb li + li::before {
  content: '/';
  margin-right: var(--space-2);
  color: var(--text-muted);
}

@media (min-width: 48rem) {
  .product-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-8) var(--space-5);
  }

  .scroller {
    grid-auto-columns: 32%;
    gap: var(--space-5);
  }

  .form-grid--two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-grid--two .field--wide {
    grid-column: 1 / -1;
  }

  .steps--row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .steps--row .step {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 64rem) {
  .product-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .scroller {
    grid-auto-columns: 23.5%;
  }
}

/* Favourite (heart) button */

.product-card {
  position: relative;
}

.favorite-button {
  display: inline-grid;
  place-items: center;
  width: var(--tap-min);
  height: var(--tap-min);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgb(255 255 255 / 0.88);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
  -webkit-tap-highlight-color: transparent;
}

.product-card .favorite-button {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
}

.favorite-button .icon path {
  transition: fill var(--duration-fast) ease;
}

.favorite-button[aria-pressed='true'] {
  color: var(--color-coral-600);
}

.favorite-button[aria-pressed='true'] .icon path {
  fill: currentColor;
}

.favorite-button.is-popping {
  animation: count-pop 420ms var(--ease-out);
}

.empty-state__icon {
  color: var(--color-coral-500);
}

/* Header favourites link shares the bag button's count style */
.favorites-link {
  color: var(--text-primary);
}

/* Link-style trigger with an icon, used for the outfit colour match */

.match-trigger {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  min-height: 3.25rem;
  margin-top: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border: 1.5px dashed var(--color-coral-500);
  border-radius: var(--radius-md);
  background: var(--color-white);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.match-trigger > span {
  flex: 1;
}

.match-trigger .icon:first-child {
  color: var(--color-coral-600);
}

/* Sheet (generic modal) */

.sheet {
  position: fixed;
  inset: 0;
  z-index: var(--layer-dialog);
  display: grid;
}

.sheet__scrim {
  position: absolute;
  inset: 0;
  background: var(--color-scrim);
}

.sheet__panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  max-height: 100dvh;
  background: var(--surface-page);
  outline: none;
  animation: sheet-in var(--duration-base) var(--ease-out);
}

@keyframes sheet-in {
  from {
    opacity: 0;
    transform: translateY(1.5rem);
  }
}

.sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  padding-top: calc(var(--space-3) + env(safe-area-inset-top));
  border-bottom: 1px solid var(--border-subtle);
}

.sheet__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: var(--space-4);
  padding-bottom: calc(var(--space-6) + env(safe-area-inset-bottom));
  overscroll-behavior: contain;
}

/* Outfit colour match */

.match__upload {
  display: grid;
  justify-items: center;
  gap: var(--space-4);
  padding: var(--space-6) var(--space-5);
  text-align: center;
}

.match__actions {
  display: grid;
  gap: var(--space-2);
  width: 100%;
  max-width: 20rem;
}

.match__actions .button:focus-within,
.match__again:focus-within {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.match__result {
  display: grid;
  gap: var(--space-4);
}

.match__photo {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface-quiet);
}

.match__photo img {
  width: 100%;
  max-height: 38dvh;
  object-fit: cover;
}

.match__palette {
  display: flex;
  gap: 3px;
  height: 1.5rem;
  padding: 3px;
  background: var(--color-white);
}

.match__swatch {
  border-radius: 3px;
}

.match__swatch {
  flex-basis: 0;
  background: var(--swatch);
}

.match__hand {
  transform: rotate(-2deg);
  transform-origin: left center;
}

.match__cards {
  display: grid;
  gap: var(--space-3);
  margin: 0;
}

.match-card {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  align-items: center;
  gap: var(--space-2) var(--space-4);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: var(--color-white);
  box-shadow: var(--shadow-sm);
}

.match-card__bag {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  background: var(--surface-quiet);
  padding: var(--space-2);
}

.match-card__ball {
  width: 70%;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, rgb(255 255 255 / 0.45), transparent 46%),
    repeating-linear-gradient(38deg, rgb(0 0 0 / 0.13) 0 1.5px, transparent 1.5px 5px),
    var(--yarn);
}

.match-card__name {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  line-height: 1.2;
}

.match-card .button {
  grid-column: 1 / -1;
  min-height: var(--tap-min);
}

.match__again {
  justify-self: center;
  cursor: pointer;
}

/* What fits inside */

.fits {
  display: grid;
  gap: var(--space-2);
}

.fits__title {
  color: var(--text-primary);
}

.fits__figure {
  margin: var(--space-2) 0 0;
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: var(--color-white);
}

.fits__svg {
  width: 100%;
  max-height: 20rem;
  overflow: visible;
}

.fits__bag {
  fill: color-mix(in srgb, var(--tint) 22%, white);
  stroke: var(--color-coral-500);
  stroke-width: 2.5;
  stroke-dasharray: 9 6;
  transition: fill var(--duration-base) ease;
}

.fits__slot {
  fill: var(--color-white);
  stroke: var(--color-coral-500);
  stroke-width: 2;
}

.fits__item rect {
  fill: var(--color-white);
  stroke: var(--color-ink-900);
  stroke-width: 1.5;
}

.fits__item text,
.fits__dimension text {
  font-family: var(--font-body);
  font-weight: 500;
  fill: var(--color-ink-900);
  text-anchor: middle;
  dominant-baseline: middle;
}

.fits__dimension line {
  stroke: var(--color-ink-400);
  stroke-width: 1.2;
  stroke-dasharray: 3 3;
}

.fits__dimension text {
  fill: var(--color-ink-600);
  font-size: 13px;
}

.fits__list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: var(--space-2) 0 0;
}

.fits__entry {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-pill);
  background: var(--surface-quiet);
  font-size: var(--text-sm);
}

.fits__entry .icon {
  color: var(--color-success-600);
}

.fits__entry--no {
  background: transparent;
  color: var(--text-muted);
  box-shadow: inset 0 0 0 1px var(--border-subtle);
}

.fits__entry--no .icon {
  color: var(--text-muted);
}

@media (min-width: 48rem) {
  .sheet {
    place-items: center;
    padding: var(--space-6);
  }

  .sheet__panel {
    width: min(100%, 34rem);
    height: auto;
    max-height: calc(100dvh - var(--space-9));
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
  }
}
