/* Timed selling popup — complements site tokens in car-card.css */

.selling-popup {
  --selling-popup-accent: var(--detail-accent, #d14d33);
  --selling-popup-dark: #1a1a1a;
  --selling-popup-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --selling-popup-duration: 480ms;

  position: fixed;
  inset: 0;
  z-index: 1080;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 1.25rem 1rem 2rem;
  pointer-events: none;
  visibility: hidden;
}

.selling-popup.is-visible {
  pointer-events: auto;
  visibility: visible;
}

.selling-popup__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 12, 12, 0.48);
  opacity: 0;
  transition: opacity var(--selling-popup-duration) var(--selling-popup-ease);
}

.selling-popup.is-visible .selling-popup__backdrop {
  opacity: 1;
}

.selling-popup.is-leaving .selling-popup__backdrop {
  opacity: 0;
}

.selling-popup__card {
  position: relative;
  z-index: 1;
  width: min(100%, 52rem);
  margin-top: clamp(1.5rem, 8vh, 4.5rem);
  overflow: visible;
  opacity: 0;
  transform: translateY(-1.75rem);
  transition:
    opacity var(--selling-popup-duration) var(--selling-popup-ease),
    transform var(--selling-popup-duration) var(--selling-popup-ease);
}

.selling-popup__panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 1.25rem;
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.18),
    0 2px 8px rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

.selling-popup__scroll {
  min-height: 0;
  overflow: visible;
}

.selling-popup.is-visible .selling-popup__card {
  opacity: 1;
  transform: translateY(0);
}

.selling-popup.is-leaving .selling-popup__card {
  opacity: 0;
  transform: translateY(-1.25rem);
}

.selling-popup__close {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  z-index: 5;
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--selling-popup-dark);
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: none;
  -webkit-tap-highlight-color: transparent;
}

.selling-popup__close:hover,
.selling-popup__close:focus-visible {
  background: transparent;
  color: var(--selling-popup-accent);
  outline: none;
}

.selling-popup__close:focus-visible {
  outline: 2px solid rgba(209, 77, 51, 0.45);
  outline-offset: 2px;
}

.selling-popup__layout {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  align-items: stretch;
}

.selling-popup__media {
  /* Match row height from the right column; don't grow the popup taller */
  height: 0;
  min-height: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 1.15rem 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 0.65rem;
  overflow: hidden;
  background: transparent;
}

.selling-popup__img {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  object-position: center;
  border-radius: 1rem;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.18);
}

.selling-popup__body {
  padding: 1.35rem 2.75rem 1.25rem 0.85rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.selling-popup__title {
  margin: 0 0 0.65rem;
  font-family: "Montserrat", "Inter", system-ui, sans-serif;
  font-size: clamp(1.15rem, 2.2vw, 1.45rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--selling-popup-dark);
}

.selling-popup__title-accent {
  color: var(--selling-popup-accent);
}

.selling-popup__subtitle {
  margin: 0 0 1.1rem;
  font-family: "Inter", system-ui, sans-serif;
  font-size: 0.95rem;
  line-height: 1.45;
  color: #5c5c5c;
}

.selling-popup__benefits {
  margin: 0 0 1.35rem;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.55rem;
}

.selling-popup__benefits li {
  position: relative;
  padding-left: 1.35rem;
  font-family: "Inter", system-ui, sans-serif;
  font-size: 0.9rem;
  line-height: 1.35;
  color: #333;
}

.selling-popup__benefits li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.4rem;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 2px;
  background: var(--selling-popup-accent);
  transform: rotate(45deg);
}

.selling-popup__cta {
  align-self: flex-end;
  min-width: 10.5rem;
  margin-bottom: 0.25rem;
  padding: 0.7rem 1.4rem;
  border: 0;
  border-radius: 0.65rem;
  background: var(--selling-popup-accent);
  color: #fff;
  font-family: "Montserrat", "Inter", system-ui, sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  box-shadow: 0 6px 16px rgba(209, 77, 51, 0.28);
  transition:
    background 0.2s ease,
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.selling-popup__cta:hover,
.selling-popup__cta:focus-visible {
  background: #b84331;
  color: #fff;
  box-shadow: 0 8px 20px rgba(184, 67, 49, 0.32);
}

.selling-popup__cta:active {
  transform: translateY(1px);
}

.selling-popup__band {
  flex: 0 0 auto;
  margin: 0;
  width: 100%;
  max-width: 100%;
  padding: 0.7rem 1rem;
  box-sizing: border-box;
  border-radius: 0.75rem;
  background: var(--selling-popup-dark);
  color: #fff;
  text-align: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
  transform-origin: center center;
}

.selling-popup.is-visible .selling-popup__band {
  animation: selling-popup-band-pump 1.8s var(--selling-popup-ease) infinite;
}

.selling-popup__band-accent {
  display: block;
  margin: 0 0 0.2rem;
  color: var(--selling-popup-accent);
  font-family: "Montserrat", "Inter", system-ui, sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1.15;
}

.selling-popup__band-text {
  display: block;
  font-family: "Montserrat", "Inter", system-ui, sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.3;
  color: #fff;
}

@keyframes selling-popup-band-pump {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.045);
  }
}

@media (max-width: 767.98px) {
  .selling-popup {
    align-items: center;
    padding: max(0.5rem, env(safe-area-inset-top))
      max(0.65rem, env(safe-area-inset-right))
      max(0.75rem, env(safe-area-inset-bottom))
      max(0.65rem, env(safe-area-inset-left));
  }

  .selling-popup__card {
    width: 100%;
    margin-top: 0;
    max-height: min(92dvh, calc(100vh - 1rem));
    max-height: min(92dvh, calc(100svh - 1rem));
    display: flex;
    flex-direction: column;
  }

  .selling-popup__panel {
    flex: 1 1 auto;
    min-height: 0;
    max-height: 100%;
    border-radius: 1rem;
  }

  .selling-popup__scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .selling-popup__close {
    top: 0.35rem;
    right: 0.4rem;
    width: 2.25rem;
    height: 2.25rem;
    font-size: 1.85rem;
  }

  .selling-popup__layout {
    grid-template-columns: 1fr;
  }

  .selling-popup__media {
    height: auto;
    min-height: 0;
    padding: 2.75rem 0.85rem 0.35rem;
    gap: 0.65rem;
    overflow: visible;
    background: transparent;
  }

  .selling-popup__img {
    flex: 0 0 auto;
    width: 100%;
    max-width: 100%;
    height: 10.5rem;
    max-height: 10.5rem;
    aspect-ratio: auto;
    object-fit: cover;
    object-position: center;
    margin: 0;
    align-self: stretch;
  }

  .selling-popup__band {
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
    padding: 0.6rem 0.85rem;
    border-radius: 0.65rem;
  }

  .selling-popup__band-accent {
    font-size: 0.95rem;
  }

  .selling-popup__band-text {
    font-size: 0.64rem;
  }

  .selling-popup__body {
    padding: 0.25rem 1rem 0.85rem;
    text-align: left;
  }

  .selling-popup__title {
    font-size: 1.05rem;
    margin-bottom: 0.45rem;
    padding-right: 0.25rem;
  }

  .selling-popup__subtitle {
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
  }

  .selling-popup__benefits {
    margin-bottom: 0.95rem;
    gap: 0.4rem;
  }

  .selling-popup__benefits li {
    font-size: 0.84rem;
  }

  .selling-popup__cta {
    align-self: stretch;
    width: 100%;
    min-width: 0;
    padding: 0.8rem 1rem;
    font-size: 1rem;
  }
}

@media (max-width: 380px) {
  .selling-popup__img {
    height: 9rem;
    max-height: 9rem;
  }

  .selling-popup__title {
    font-size: 0.98rem;
  }

  .selling-popup__benefits li {
    font-size: 0.8rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .selling-popup,
  .selling-popup__backdrop,
  .selling-popup__card {
    transition: none !important;
  }

  .selling-popup__card {
    transform: none;
  }

  .selling-popup.is-leaving .selling-popup__card {
    transform: none;
  }

  .selling-popup__band {
    animation: none !important;
  }
}
