.stord-upsell-tile {
  display: flex;
  border: 1px solid rgba(var(--stord-overlay-rgb, 0, 0, 0), 0.12);
  border-radius: 0.5rem;
  overflow: hidden;
  background: var(--stord-card-bg, #fff);
  box-sizing: border-box;
}

/* Horizontal (column) layout */

.stord-upsell-tile--horizontal {
  flex-direction: column;
  flex: 0 0 auto;
  min-width: 160px;
  max-width: 220px;
}

/* Vertical (row) layout */

.stord-upsell-tile--vertical {
  flex-direction: row;
  align-items: flex-start;
}

/* Image wrap */

.stord-upsell-tile__image-wrap {
  display: block;
  overflow: hidden;
  flex-shrink: 0;
  background: rgba(var(--stord-overlay-rgb, 0, 0, 0), 0.04);
  text-decoration: none;
}

.stord-upsell-tile__image-wrap:hover .stord-upsell-tile__image {
  opacity: 0.85;
}

.stord-upsell-tile--horizontal .stord-upsell-tile__image-wrap {
  width: 100%;
  aspect-ratio: 1;
}

.stord-upsell-tile--vertical .stord-upsell-tile__image-wrap {
  width: 80px;
  height: 80px;
}

.stord-upsell-tile__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.stord-upsell-tile__image-placeholder {
  width: 100%;
  height: 100%;
  background: rgba(var(--stord-overlay-rgb, 0, 0, 0), 0.06);
}

/* Body */

.stord-upsell-tile__body {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 0.25rem;
}

.stord-upsell-tile--horizontal .stord-upsell-tile__body {
  align-items: center;
  text-align: center;
}

.stord-upsell-tile--vertical .stord-upsell-tile__body {
  align-items: flex-start;
  text-align: left;
}

.stord-upsell-tile__name {
  margin: 0;
  font-weight: 600;
  /* px not rem: rem is root-relative and shrinks on themes that set a non-16px
     root font-size (e.g. Dawn's 62.5% = 10px). Value = old rem * 16. */
  font-size: 16px;
  line-height: 1.3;
  color: inherit;
}

a.stord-upsell-tile__name {
  text-decoration: none;
}

a.stord-upsell-tile__name:hover {
  text-decoration: underline;
}

/* Price row */

.stord-upsell-tile__price-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  font-size: 14px;
}

.stord-upsell-tile--horizontal .stord-upsell-tile__price-row {
  justify-content: center;
}

.stord-upsell-tile__price {
  font-weight: 700;
}

.stord-upsell-tile__price--original {
  text-decoration: line-through;
  opacity: 0.5;
  font-weight: 400;
}

.stord-upsell-tile__badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.7em;
  padding: 1px 5px;
  border-radius: 2px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--stord-badge-bg, #f5f5f5);
  color: inherit;
}

.stord-upsell-tile--horizontal .stord-upsell-tile__badge {
  align-self: center;
}

.stord-upsell-tile__desc {
  margin: 0;
  font-size: 0.8em;
  opacity: 0.65;
  line-height: 1.4;
  /* Clamp to ~2 lines so a long description can't dominate the tile (CX-1962). */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.stord-upsell-tile__variant-label {
  margin: 0;
  font-size: 14px;
  opacity: 0.75;
  line-height: 1.3;
}

/* Actions */

.stord-upsell-tile__actions {
  display: flex;
  margin-top: auto;
  padding-top: 0.5rem;
}

.stord-upsell-tile--horizontal .stord-upsell-tile__actions {
  flex-direction: column;
  gap: 0.5rem;
  align-self: stretch;
}

.stord-upsell-tile--vertical .stord-upsell-tile__actions {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

/* Variant select */

.stord-upsell-tile__variant-select {
  font-family: inherit;
  font-size: 0.8em;
  padding: 0.4rem 0.5rem;
  border: 1px solid rgba(var(--stord-overlay-rgb, 0, 0, 0), 0.2);
  border-radius: 0.25rem;
  background: var(--stord-card-bg, #fff);
  box-sizing: border-box;
  cursor: pointer;
}

.stord-upsell-tile--horizontal .stord-upsell-tile__variant-select {
  width: 100%;
}

.stord-upsell-tile--vertical .stord-upsell-tile__variant-select {
  flex: 1;
  min-width: 0;
}

/* ATC button */

.stord-upsell-tile__atc {
  display: block;
  width: 100%;
  text-align: center;
  background: #000;
  color: #fff;
  border: none;
  padding: 0.65rem 1rem;
  border-radius: 0.25rem;
  font-size: 0.8em;
  font-family: inherit;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  box-sizing: border-box;
  transition: opacity 0.2s;
}

.stord-upsell-tile--vertical .stord-upsell-tile__atc {
  flex: 1;
  width: auto;
}

/* Fallback hover for the hardcoded black button. Suppressed once a button has
   inherited the host theme's styles (--themed), which carry their own hover. */
.stord-upsell-tile__atc:not(.stord-upsell-tile__atc--added):not(
    .stord-upsell-tile__atc--themed
  ):hover,
.stord-upsell-tile__atc:not(.stord-upsell-tile__atc--added):not(
    .stord-upsell-tile__atc--themed
  ):focus-visible {
  opacity: 0.85;
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.stord-upsell-tile__atc--added {
  opacity: 0.65;
  cursor: default;
  pointer-events: none;
}

/* Drawer layout: image+text row on top, full-width actions below */

.stord-upsell-tile--drawer {
  flex-direction: column;
}

.stord-upsell-tile__content-row {
  display: flex;
  flex-direction: row;
  gap: 0.5rem;
  align-items: flex-start;
  margin-top: 0.5rem;
  /* Match the actions row's horizontal padding (0.75rem) so the image and
     title share the same left/right edge as the Add-to-Cart button below. */
  padding-inline: 0.75rem;
}

.stord-upsell-tile--drawer .stord-upsell-tile__image-wrap {
  width: 60px;
  height: 60px;
}

.stord-upsell-tile--drawer .stord-upsell-tile__body {
  align-items: flex-start;
  text-align: left;
}

.stord-upsell-tile--drawer .stord-upsell-tile__actions {
  flex-direction: row;
  gap: 0.5rem;
  padding-top: 0.75rem;
  padding-inline: 0.75rem;
  padding-bottom: 0.75rem;
}

.stord-upsell-tile--drawer .stord-upsell-tile__atc {
  flex: 1;
  width: auto;
  padding-block: 0.85rem;
}

.stord-upsell-tile--drawer .stord-upsell-tile__variant-select {
  flex: 1;
  min-width: 0;
}
