/* ============================================================
   Wadham popups — media-first place cards
   ============================================================ */

.mapboxgl-popup {
  max-width: 360px !important;
  z-index: 50;
}

.mapboxgl-popup.wadham-popup {
  -webkit-animation: wadhamPopupIn 0.34s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation: wadhamPopupIn 0.34s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@-webkit-keyframes wadhamPopupIn {
  from {
    opacity: 0;
    -webkit-transform: translateY(14px) scale(0.94);
    transform: translateY(14px) scale(0.94);
  }
  to {
    opacity: 1;
    -webkit-transform: none;
    transform: none;
  }
}

@keyframes wadhamPopupIn {
  from { opacity: 0; transform: translateY(14px) scale(0.94); }
  to { opacity: 1; transform: none; }
}

.mapboxgl-popup-content {
  position: relative;
  width: max-content !important;
  min-width: 200px !important;
  max-width: min(340px, calc(100% - 24px)) !important;
  overflow: hidden;
  padding: 0 !important;
  background: #fff !important;
  border-radius: 28px !important;
  border: none !important;
  box-shadow:
    0 0 0 1px rgba(23, 18, 15, 0.05),
    0 18px 40px rgba(23, 18, 15, 0.18),
    0 40px 90px rgba(23, 18, 15, 0.22) !important;
  font-family: "Sora", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.custom-popup.has-hero,
.custom-popup.is-text-card,
.custom-popup.is-detail-card {
  width: min(340px, calc(100% - 24px));
}

.custom-popup.is-title-card {
  width: max-content;
  max-width: min(340px, calc(100% - 24px));
}

.mapboxgl-popup-anchor-bottom .mapboxgl-popup-tip {
  border-top-color: #fff !important;
}

.mapboxgl-popup-anchor-top .mapboxgl-popup-tip {
  border-bottom-color: #fff !important;
}

.mapboxgl-popup-close-button {
  position: absolute !important;
  top: 12px !important;
  right: 12px !important;
  z-index: 8;
  width: 34px !important;
  height: 34px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  border-radius: 50% !important;
  font-size: 18px !important;
  line-height: 32px !important;
  font-weight: 600;
  color: #17120f !important;
  background: rgba(255, 255, 255, 0.92) !important;
  box-shadow: 0 6px 18px rgba(23, 18, 15, 0.18);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.mapboxgl-popup-close-button:hover {
  background: #C00D0D !important;
  color: #fff !important;
  transform: scale(1.05);
}

.custom-popup {
  position: relative;
  font-family: "Sora", system-ui, sans-serif !important;
  width: 100% !important;
  max-width: 100% !important;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  color: #17120f;
}

.custom-popup[style] {
  width: 100% !important;
  font-family: "Sora", system-ui, sans-serif !important;
}

/* ---------- Hero ---------- */
.popup-hero {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10.5;
  overflow: hidden;
  margin: 0;
  background: linear-gradient(145deg, #e8dfd4, #cfc3b4);
}

.popup-hero > img,
.popup-hero .mainImage {
  width: 100% !important;
  max-width: none !important;
  height: 100% !important;
  margin: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  object-fit: cover !important;
  display: block;
  cursor: zoom-in;
}

.popup-hero-copy {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  padding: 56px 20px 18px;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(12, 9, 7, 0.55) 48%,
    rgba(12, 9, 7, 0.88) 100%
  );
  pointer-events: none;
}

.popup-hero-copy h3 {
  margin: 0 !important;
  padding: 0 40px 0 0 !important;
  color: #fff !important;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.48rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.35);
}

.popup-hero--gallery {
  aspect-ratio: auto;
  background: #1a1512;
}

.popup-hero--gallery .mainImage {
  aspect-ratio: 16 / 10.5;
  height: auto !important;
}

.popup-hero--gallery .image-swap-container > div {
  display: flex !important;
  gap: 6px !important;
  padding: 8px 10px 10px;
  justify-content: flex-start;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.popup-hero--gallery .thumb {
  flex: 0 0 auto;
  width: 56px !important;
  max-width: none !important;
  height: 42px !important;
  margin: 0 !important;
  border-radius: 8px !important;
  object-fit: cover !important;
  box-shadow: none !important;
  opacity: 0.75;
  border: 2px solid transparent;
  cursor: pointer;
}

.popup-hero--gallery .thumb:hover {
  opacity: 1;
}

/* ---------- Body ---------- */
.popup-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px 20px 22px;
}

.custom-popup:not(.has-hero) .popup-body {
  padding-top: 22px;
}

.custom-popup:not(.has-hero) h3,
.popup-body > h3 {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.22;
  margin: 0 0 14px;
  padding: 0 36px 0 0;
  color: #17120f;
}

/* Title-only places (commented-out photos, etc.) */
.custom-popup.is-title-card .popup-body {
  padding: 18px 52px 18px 20px;
  gap: 0;
}

.custom-popup.is-title-card .popup-body > h3 {
  margin: 0;
  padding: 0;
  font-size: 1.2rem;
  line-height: 1.3;
  max-width: 240px;
}

.popup-prose,
.popup-body > p {
  margin: 0;
  font-family: "Sora", system-ui, sans-serif;
  font-size: 0.86rem;
  font-weight: 400;
  line-height: 1.6;
  color: #4f453c;
}

.custom-popup.is-text-card .popup-body {
  padding: 22px 22px 24px;
}

.custom-popup.is-text-card .popup-prose {
  font-size: 0.88rem;
  line-height: 1.65;
}

/* Safety net if polish ever skips body wrap */
.custom-popup:not(:has(.popup-body)):not(:has(.popup-hero)) {
  padding: 18px 52px 18px 20px;
}

.custom-popup .occupancy,
.custom-popup .facilities,
.custom-popup .department-info,
.custom-popup .department-info-modern {
  margin: 0 !important;
}

.custom-popup .note {
  margin: 0 !important;
  line-height: 1.5;
}

.section-label,
.custom-popup .occupancy-title,
.custom-popup .facilities-title {
  display: block;
  text-align: left;
  font-weight: 650;
  margin: 0 0 12px;
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #9a8f84;
}

.custom-popup .occupancy-title strong {
  font-weight: 650;
  letter-spacing: 0.16em;
}

/* Capacity chips */
.custom-popup .occupancy .icon-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(84px, 1fr));
  gap: 10px;
  text-align: left;
}

.custom-popup .occupancy .icon-row > div {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 12px 13px;
  border-radius: 16px;
  background: #f6f2ec;
  border: none;
  font-size: 0.7rem;
  font-weight: 500;
  color: #6a5f55;
  line-height: 1.35;
}

.capacity-top {
  display: flex;
  align-items: center;
  gap: 5px;
}

.capacity-label {
  display: block;
}

.custom-popup .occupancy .icon-row > div svg,
.custom-popup .occupancy .icon-row > div img {
  width: 14px !important;
  height: 14px !important;
  max-width: 14px !important;
  margin: 0 !important;
  border-radius: 0 !important;
  display: block;
  flex-shrink: 0;
}

.custom-popup .occupancy .note,
.custom-popup .occupancy center {
  display: block;
  margin-top: 12px !important;
  font-size: 0.74rem;
  line-height: 1.45;
  color: #8f8276;
  font-weight: 500;
}

.occupancy-number {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: #17120f;
  display: inline;
  margin-right: 2px;
  line-height: 1;
}

/* Facilities chips */
.custom-popup .facilities .icon-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  text-align: center;
}

.custom-popup .facilities .icon-row > div {
  flex: 0 0 auto;
  min-width: 60px;
  padding: 12px 10px 10px;
  border-radius: 14px;
  background: #f6f2ec;
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #3d342e;
  line-height: 1.3;
}

.custom-popup .facilities .icon-row > div svg,
.custom-popup .facilities .icon-row > div img {
  width: 22px !important;
  height: 22px !important;
  max-width: 22px !important;
  margin: 0 auto 7px !important;
  border-radius: 0 !important;
  display: block;
}

.custom-popup .facilities .icon-row > div br { display: none; }

.custom-popup .facilities .icon-row > div span {
  display: block;
}

.custom-popup .facilities .note {
  margin-top: 12px !important;
}

.facilities--cta-only {
  display: contents;
}

.facilities--cta-only .facilities-title {
  display: none;
}

/* Fallback images (no hero wrap) */
.custom-popup > img,
.popup-body > img {
  display: block;
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  border-radius: 16px !important;
  margin: 0;
  object-fit: cover;
}

.custom-popup .zoomable-img { cursor: zoom-in; }

.custom-popup .thumb {
  display: inline-block;
  width: 30% !important;
  max-width: 88px !important;
  margin: 0 1% !important;
  border-radius: 10px !important;
  vertical-align: top;
}

.image-swap-container { max-width: 100%; }

/* CTA */
.book-now-btn {
  display: block !important;
  width: 100% !important;
  margin: 4px 0 0 !important;
  padding: 16px 18px !important;
  border: none !important;
  border-radius: 999px !important;
  background: #17120f !important;
  color: #fff !important;
  font-family: "Sora", system-ui, sans-serif !important;
  font-size: 0.9rem !important;
  font-weight: 600 !important;
  letter-spacing: -0.01em;
  text-align: center !important;
  text-decoration: none !important;
  box-shadow: 0 14px 30px rgba(23, 18, 15, 0.22) !important;
  box-sizing: border-box !important;
  cursor: pointer !important;
  transition: background 0.2s ease, transform 0.18s ease, box-shadow 0.2s ease !important;
}

.book-now-btn:hover {
  background: #C00D0D !important;
  transform: translateY(-1px);
  box-shadow: 0 16px 34px rgba(192, 13, 13, 0.28) !important;
}

.book-now-btn:active {
  transform: scale(0.985);
}

.custom-popup .note {
  font-size: 0.74rem;
  line-height: 1.5;
  color: #9a8f84;
  text-align: left;
}

.custom-popup .toast {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 8;
  padding: 14px 16px;
  border-radius: 0 0 28px 28px;
  background: rgba(23, 18, 15, 0.94);
  color: #fff;
  text-align: center;
  font-size: 0.78rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.custom-popup .toast.show {
  opacity: 1;
  pointer-events: auto;
}

/* Departments / contacts */
.department-info,
.department-info-modern {
  width: 100%;
  max-width: 100%;
  font-size: 13px;
}

.department-tags {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.floor-card {
  background: #f6f2ec;
  border: none;
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 0;
}

.floor-label {
  font-weight: 650;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.tag {
  background: #fff;
  border: 1px solid rgba(23, 18, 15, 0.06);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(23, 18, 15, 0.04);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.tag:hover,
.tag.toggle-contact:hover {
  border-color: rgba(192, 13, 13, 0.25);
  transform: translateY(-1px);
}

.tag-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.tag-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chevron {
  flex-shrink: 0;
  width: 0;
  height: 0;
  margin-left: 8px;
  border-style: solid;
  border-width: 5px 0 5px 7px;
  border-color: transparent transparent transparent #8f8276;
  transition: transform 0.2s ease;
}

.chevron.is-open { transform: rotate(90deg); }

.contact-inline {
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.5;
  color: #5c5148;
}

.contact-inline a {
  color: #C00D0D;
  text-decoration: none;
  font-weight: 600;
}

.contact-inline a:hover { text-decoration: underline; }

.requestable {
  cursor: pointer;
  opacity: 0.38;
  transition: opacity 0.2s, transform 0.2s, background 0.2s;
}

.requestable:hover {
  opacity: 1;
  transform: translateY(-1px);
  background: #efe8df !important;
}

/* Photo-only cards */
.custom-popup.is-photo-card {
  padding-bottom: 0;
}

.custom-popup.is-photo-card .popup-hero {
  aspect-ratio: 5 / 4;
}

.custom-popup.is-photo-card .popup-body {
  display: none;
}

@media (max-width: 420px) {
  .mapboxgl-popup-content {
    width: min(340px, calc(100% - 20px)) !important;
    max-width: min(340px, calc(100% - 20px)) !important;
    border-radius: 24px !important;
  }

  .popup-hero-copy h3 {
    font-size: 1.28rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mapboxgl-popup.wadham-popup {
    -webkit-animation: none;
    animation: none;
  }
}
