:root {
  --show-preview-canvas: #f7f6f4;
  --dressage-preview-canvas: #f6f4f2;
}

/* Stage 02: the media area owns all scaling and clips it before the copy. */
.gender-choice {
  background: #fff !important;
}

.gender-choice .choice-media {
  position: relative;
  align-self: stretch;
  width: 100%;
  height: 100%;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: var(--show-preview-canvas);
}

.gender-choice .choice-media:has(.is-dressage-preview) {
  background: var(--dressage-preview-canvas);
}

.gender-choice .choice-media img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: contain;
  object-position: center;
  padding: 14px;
  background: transparent;
  filter: none;
  mix-blend-mode: normal;
  transform: none;
}

.gender-choice .choice-media img.is-dressage-preview {
  padding: 0;
  transform: scale(1.22);
  transform-origin: center;
}

/* Stage 03: image and copy are separate grid regions, so neither can overlap. */
.model-card {
  background: #fff !important;
  overflow: hidden;
}

.model-card-media {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  margin: 0;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: var(--show-preview-canvas);
}

.model-card-media:has(.dressage-model-preview) {
  background: var(--dressage-preview-canvas);
}

.model-card-media img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  box-sizing: border-box;
  object-fit: contain;
  object-position: center;
  padding: 24px;
  background: transparent;
  transform: none;
}

.model-card-media img.dressage-model-preview {
  padding: 18px;
  transform: none;
  transform-origin: center;
}

@media (min-width: 901px) {
  .gender-choice {
    grid-template-columns: minmax(0, 42%) minmax(0, 58%) !important;
  }

  .gender-choice > div {
    min-width: 0;
    position: relative;
    z-index: 1;
    background: #fff;
  }

  .model-grid:not(:has(.model-card + .model-card)) .model-card {
    grid-template-columns: minmax(0, 38%) minmax(0, 62%);
    min-height: 390px;
  }

  .model-grid:has(.model-card + .model-card) .model-card {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 390px minmax(300px, auto);
  }

  .model-grid:has(.model-card + .model-card) .model-card-media {
    height: 390px;
  }
}

@media (max-width: 900px) {
  .gender-choice {
    grid-template-columns: 1fr;
    height: auto;
  }

  .gender-choice .choice-media {
    height: 300px;
  }

  .gender-choice .choice-media img,
  .gender-choice .choice-media img.is-dressage-preview {
    width: 100%;
    height: 100%;
    padding: 14px;
    transform: none;
    object-fit: contain;
    object-position: center;
  }

  .model-card {
    grid-template-columns: 1fr;
  }

  .model-card-media {
    height: 300px;
  }
}
