/* Functional baseline only; final look comes from the theme (issue #6). */
/* Themes often lay out form.cart as a flex row (quantity + button); the options always take a full row. */
.mm-po {
  flex: 0 0 100%;
  inline-size: 100%;
  margin-block: 1.5rem;
}

.mm-po__group {
  margin: 0 0 1rem;
}

.mm-po__summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  font-weight: 600;
  gap: 0.5rem;
  justify-content: flex-start;
  list-style: none;
  padding-block: 0.5rem;
}

/* Keep the focus ring (set globally by the theme) off the text and the chevron. */
.mm-po__summary:focus-visible {
  border-radius: 4px;
  outline-offset: 4px;
}

.mm-po__summary::-webkit-details-marker {
  display: none;
}

/* Chevron pushed to the right edge; rotates when open. */
.mm-po__summary::after {
  border-block-end: 2px solid currentcolor;
  border-inline-end: 2px solid currentcolor;
  block-size: 0.5rem;
  content: '';
  inline-size: 0.5rem;
  margin-inline-start: auto;
  transform: rotate(45deg);
  transition: transform 0.15s;
}

.mm-po__group[open] > .mm-po__summary::after {
  transform: rotate(-135deg);
}

.mm-po__group[data-mm-po-locked] > .mm-po__summary {
  cursor: not-allowed;
  opacity: 0.55;
}

.mm-po__current {
  font-weight: 400;
}

.mm-po__choices {
  border: 0;
  display: grid;
  gap: 0.5rem;
  grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr));
  margin: 0;
  padding: 0.5rem 0 0;
}

/* Native inputs stay in the DOM (keyboard, validation) but are visually replaced by the tile. */
.mm-po__choice input {
  opacity: 0;
  position: absolute;
  pointer-events: none;
}

.mm-po__tile {
  align-items: center;
  block-size: 100%;
  border: 1px solid currentcolor;
  border-radius: 4px;
  box-sizing: border-box;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  justify-content: center;
  padding: 0.5rem;
  text-align: center;
}

/* Fixed ratio so tiles with and without a photo line up in the grid. */
.mm-po__tile img {
  aspect-ratio: 3 / 2;
  block-size: auto;
  inline-size: 100%;
  object-fit: contain;
}

.mm-po__choice input:checked + .mm-po__tile {
  outline: 2px solid currentcolor;
  outline-offset: 2px;
}

.mm-po__choice input:focus-visible + .mm-po__tile {
  outline: 2px dashed currentcolor;
  outline-offset: 2px;
}

.mm-po__price {
  font-size: 0.875em;
  opacity: 0.8;
}

.mm-po__total {
  font-weight: 600;
}

/* The plugin must not depend on theme utility classes. */
.mm-po__sr {
  border: 0;
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.mm-po__toggle {
  align-items: center;
  cursor: pointer;
  display: flex;
  gap: 0.5rem;
  padding-block: 0.25rem;
}

/* Title and price wrap together, indented past the checkbox. */
.mm-po__toggle-text {
  flex: 1;
}

.mm-po__toggle input {
  margin: 0;
}
