.modal-gallery {
  display: grid;
  grid-template-rows: auto auto;
  align-content: start;
  align-self: start;
  position: sticky;
  top: 0;
  min-height: 0;
  background: #111111;
}

.modal-gallery .modal-main-image {
  width: 100%;
  height: auto;
  min-height: 0;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.modal-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(68px, 1fr));
  gap: 8px;
  padding: 10px;
  background: rgba(17, 17, 17, 0.96);
}

.modal-thumb {
  min-height: 54px;
  padding: 0;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 6px;
  background: #222222;
  cursor: pointer;
}

.modal-thumb.active {
  border-color: var(--green);
}

.modal-thumb img {
  width: 100%;
  height: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}

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

.sortable-thumb {
  display: grid;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.photo-order-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.photo-order-actions button {
  min-height: 30px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  font-size: 0.72rem;
  font-weight: 900;
}

.photo-order-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

@media (max-width: 760px) {
  .modal-gallery {
    position: static;
    align-self: stretch;
  }

  .modal-thumbs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

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

/* --- Fullscreen photo lightbox --- */

body.lightbox-open,
body.booking-open {
  overflow: hidden;
}

.modal-main-frame {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: #111111;
  cursor: zoom-in;
}

.modal-expand-hint {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 6px 11px;
  border-radius: 999px;
  background: rgba(17, 17, 17, 0.72);
  color: #ffffff;
  font-size: 0.74rem;
  font-weight: 700;
  pointer-events: none;
}

.photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 600;
}

.photo-lightbox[hidden] {
  display: none;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 8, 8, 0.95);
}

.lightbox-stage {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: 1fr auto;
  height: 100svh;
  margin: 0;
}

.lightbox-scroll {
  display: grid;
  place-items: center;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.lightbox-image {
  max-width: 100vw;
  max-height: calc(100svh - 58px);
  object-fit: contain;
  user-select: none;
  cursor: zoom-in;
}

.photo-lightbox.is-zoomed .lightbox-image {
  max-width: none;
  max-height: none;
  height: 195svh;
  width: auto;
  cursor: zoom-out;
}

.lightbox-caption {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 16px;
  min-height: 58px;
  padding: 8px 16px;
  color: #ffffff;
  font-size: 0.9rem;
  text-align: center;
}

.lightbox-counter {
  opacity: 0.7;
}

.lightbox-zoom-hint {
  width: 100%;
  font-size: 0.72rem;
  opacity: 0.45;
}

.lightbox-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.lightbox-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 46px;
  height: 68px;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  font-size: 1.45rem;
  cursor: pointer;
}

.lightbox-prev {
  left: 10px;
}

.lightbox-next {
  right: 10px;
}

/* --- Monthly payment hint --- */

.price-stack {
  display: grid;
  justify-items: end;
  gap: 2px;
}

.price-permo {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--green-dark, #157a41);
  opacity: 0.9;
}

.modal-price .price-permo {
  font-size: 0.95rem;
}

/* --- Test drive booking --- */

.booking-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: grid;
  place-items: center;
  padding: 18px;
}

.booking-overlay[hidden] {
  display: none;
}

.booking-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(23, 23, 23, 0.68);
  backdrop-filter: blur(10px);
}

.booking-panel {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  max-height: calc(100svh - 36px);
  overflow: auto;
  padding: 26px;
  border-radius: var(--radius, 14px);
  background: var(--surface, #ffffff);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
}

.booking-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: rgba(23, 23, 23, 0.08);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.booking-form {
  display: grid;
  gap: 14px;
}

.booking-form h2 {
  margin: 0;
}

.booking-lead {
  margin: 0;
  color: rgba(23, 23, 23, 0.65);
}

.booking-field {
  display: grid;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 800;
}

.booking-field select,
.booking-field input {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line, #dddddd);
  border-radius: 10px;
  background: #ffffff;
  font: inherit;
}

.booking-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.booking-chip {
  display: grid;
  gap: 2px;
  place-items: center;
  min-width: 76px;
  padding: 8px 10px;
  border: 1.5px solid var(--line, #dddddd);
  border-radius: 12px;
  background: #ffffff;
  font-weight: 800;
  cursor: pointer;
}

.booking-chip span {
  font-size: 0.72rem;
  font-weight: 600;
  opacity: 0.65;
}

.booking-chip.active {
  border-color: var(--green, #1d9a52);
  background: rgba(29, 154, 82, 0.09);
}

.booking-chip-time {
  min-width: 88px;
  padding: 11px 10px;
}

.booking-contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.booking-website {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.booking-submit {
  width: 100%;
  min-height: 50px;
  font-size: 1rem;
}

.booking-note {
  min-height: 1.3em;
  margin: 0;
  font-size: 0.9rem;
  color: rgba(23, 23, 23, 0.75);
}

.booking-note a {
  color: var(--green-dark, #157a41);
  font-weight: 800;
  text-decoration: underline;
}

.booking-success {
  display: grid;
  gap: 12px;
  justify-items: center;
  padding: 10px 0;
  text-align: center;
}

.booking-success h2 {
  margin: 0;
}

.booking-success .button {
  width: 100%;
}

.booking-success-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--green, #1d9a52);
  color: #ffffff;
  font-size: 1.9rem;
}

.booking-summary {
  margin: 0;
  font-weight: 800;
}

/* --- Sticky mobile action bar --- */

.mobile-action-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 280;
  display: none;
  grid-template-columns: 1fr 1.5fr;
  gap: 10px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line, #e2e2e2);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
}

.mab-call {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border: 1.5px solid var(--carbon, #171717);
  border-radius: 12px;
  font-weight: 900;
}

.mab-book {
  min-height: 48px;
  border: 0;
  border-radius: 12px;
  background: var(--green, #1d9a52);
  color: #ffffff;
  font-size: 1rem;
  font-weight: 900;
  cursor: pointer;
}

@media (max-width: 760px) {
  .mobile-action-bar {
    display: grid;
  }

  body {
    padding-bottom: 78px;
  }

  body.modal-open .mobile-action-bar,
  body.booking-open .mobile-action-bar,
  body.lightbox-open .mobile-action-bar {
    display: none;
  }

  .booking-contact-grid {
    grid-template-columns: 1fr;
  }

  .lightbox-arrow {
    width: 40px;
    height: 56px;
    background: rgba(255, 255, 255, 0.1);
  }
}
