.tour-booking-modal {
  /* Map to Clubhouse Continuum tokens; keep approved modal structure. */
  --tour-booking-navy: var(--enclave-navy-ink, #10183d);
  --tour-booking-deep-navy: #080e27;
  --tour-booking-raised-navy: var(--enclave-navy-raised, #18234f);
  --tour-booking-cream: var(--enclave-field, #fbf6ef);
  --tour-booking-cream-muted: rgba(251, 246, 239, 0.72);
  --tour-booking-cream-hover: #ebe3d4;
  --tour-booking-gold: var(--enclave-gold, #b9a078);
  --tour-booking-green: var(--enclave-green, #2f775b);
  --tour-booking-green-tint: var(--enclave-green-tint, rgba(47, 119, 91, 0.22));
  --tour-booking-border: rgba(251, 246, 239, 0.14);
  --tour-booking-field-text: var(--enclave-navy-ink, #10183d);
  --tour-booking-placeholder: rgba(16, 24, 61, 0.55);
  --tour-booking-error: var(--enclave-error, #ff8f7a);
  --tour-booking-error-bg: var(--enclave-error-bg, rgba(255, 143, 122, 0.12));
  --tour-booking-focus: var(--enclave-gold, #b9a078);

  position: fixed;
  inset: 0;
  z-index: 1400;
  display: grid;
  place-items: center;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  padding:
    max(20px, env(safe-area-inset-top, 0px))
    max(20px, env(safe-area-inset-right, 0px))
    max(20px, env(safe-area-inset-bottom, 0px))
    max(20px, env(safe-area-inset-left, 0px));
}

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

.tour-booking-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 9, 28, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity var(--duration-base, 220ms) var(--ease-premium, ease);
}

.tour-booking-modal.is-open .tour-booking-modal-backdrop {
  opacity: 1;
}

.tour-booking-modal-dialog {
  position: relative;
  z-index: 1;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  width: min(880px, calc(100vw - 40px));
  max-width: min(880px, calc(100vw - 40px));
  max-height: calc(100dvh - 40px);
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid rgba(251, 246, 239, 0.2);
  border-radius: 22px;
  background:
    radial-gradient(ellipse 80% 50% at 12% -10%, rgba(185, 160, 120, 0.12), transparent 52%),
    linear-gradient(155deg, #1a2554 0%, #10183d 48%, #080e27 100%);
  box-shadow:
    0 28px 72px rgba(2, 8, 32, 0.52),
    inset 0 1px 0 rgba(251, 246, 239, 0.12);
  color: var(--tour-booking-cream);
  opacity: 0;
  transform: translateY(14px) scale(0.985);
  transition:
    opacity var(--duration-settle, 480ms) var(--ease-premium, ease),
    transform var(--duration-settle, 480ms) var(--ease-premium, ease);
}

.tour-booking-modal.is-open .tour-booking-modal-dialog {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.tour-booking-modal-header {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex: 0 0 auto;
  min-height: 72px;
  height: auto;
  padding: 20px 26px 18px;
  border-bottom: 1px solid var(--tour-booking-border);
  background:
    linear-gradient(180deg, rgba(251, 246, 239, 0.05), transparent 70%),
    rgba(8, 14, 39, 0.34);
}

.tour-booking-modal-title-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

.tour-booking-modal-header h2 {
  margin: 0;
  color: var(--tour-booking-cream);
  font-family: var(--font-display, "Cormorant Garamond", Georgia, "Times New Roman", Times, serif);
  font-size: clamp(1.7rem, 2.4vw, 2.05rem);
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: 0.01em;
}

.tour-booking-modal-title-rule {
  display: grid;
  grid-template-columns: 28px auto 1fr;
  align-items: center;
  gap: 8px;
  width: min(148px, 42vw);
  height: auto;
  background: transparent;
  opacity: 1;
}

.tour-booking-modal-title-rule::before,
.tour-booking-modal-title-rule::after {
  content: "";
  display: block;
  height: 1px;
  background: linear-gradient(90deg, var(--tour-booking-gold), rgba(185, 160, 120, 0.2));
}

.tour-booking-modal-title-rule::after {
  background: linear-gradient(90deg, rgba(185, 160, 120, 0.55), transparent);
}

.tour-booking-modal-title-diamond {
  width: 6px;
  height: 6px;
  border-radius: 1px;
  background: var(--tour-booking-gold);
  transform: rotate(45deg);
  box-shadow: 0 0 0 1px rgba(185, 160, 120, 0.18);
}

.tour-booking-modal-close {
  box-sizing: border-box;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  min-width: 42px;
  min-height: 42px;
  max-width: 44px;
  max-height: 44px;
  padding: 0;
  border: 1px solid rgba(251, 246, 239, 0.38);
  border-radius: 12px;
  background: rgba(24, 35, 79, 0.88);
  color: var(--tour-booking-cream);
  font-family: var(--font-ui);
  font-size: 22px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition:
    background-color var(--duration-fast, 150ms) ease,
    border-color var(--duration-fast, 150ms) ease,
    transform var(--duration-fast, 150ms) ease;
}

.tour-booking-modal-close.button-sheen,
.tour-booking-modal-close.button-sheen::after {
  overflow: visible;
  isolation: auto;
}

.tour-booking-modal-close.button-sheen::after {
  content: none !important;
  display: none !important;
}

.tour-booking-modal-close:hover {
  background: #243368;
  border-color: rgba(251, 246, 239, 0.58);
  transform: translateY(-1px);
}

.tour-booking-modal-close:focus-visible {
  outline: 2px solid var(--tour-booking-focus);
  outline-offset: 2px;
}

.tour-booking-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  box-sizing: border-box;
  padding: 24px 26px 26px;
  background: transparent;
  color: var(--tour-booking-cream);
}

/* Boston-only: slightly tighter body padding so Continue fits on desktop. */
.tour-booking-modal[data-tour-booking-market="boston"] .tour-booking-modal-body {
  padding: 20px 24px;
}

@media (min-width: 760px) {
  .tour-booking-modal[data-tour-booking-market="boston"] .tour-booking-modal-body {
    padding: 20px 24px 20px;
  }
}

.tour-booking-modal-status {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(251, 246, 239, 0.22);
  background: rgba(251, 246, 239, 0.08);
  color: var(--tour-booking-cream);
  font: 600 0.9rem / 1.4 var(--font-ui);
}

.tour-booking-modal-status[data-state="error"] {
  border: 1px solid rgba(255, 143, 122, 0.55);
  background: var(--tour-booking-error-bg);
  color: var(--tour-booking-error);
}

.tour-booking-modal-status a {
  color: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.tour-booking-modal-status a:focus-visible {
  outline: 2px solid var(--tour-booking-focus);
  outline-offset: 2px;
  border-radius: 2px;
}

.tour-booking-modal-form-host {
  min-height: 80px;
  background: transparent;
  color: var(--tour-booking-cream);
}

.tour-booking-modal-form-host.is-awaiting-handoff {
  pointer-events: none;
  opacity: 0.72;
}

.tour-booking-modal-form-host iframe,
.tour-booking-modal-form-host form {
  display: block;
  width: 100%;
  max-width: 100%;
  background: transparent;
  border: 0;
}

/* Keep Calendly’s booking pop-up above the Enclave HubSpot modal (z-index 1400). */
.calendly-overlay,
.calendly-popup-content,
.calendly-badge-widget {
  z-index: 10000 !important;
}

html.tour-booking-modal-open,
body.tour-booking-modal-open {
  overflow: hidden;
}

@media (max-width: 720px) {
  .tour-booking-modal {
    padding:
      max(12px, env(safe-area-inset-top, 0px))
      max(12px, env(safe-area-inset-right, 0px))
      max(12px, env(safe-area-inset-bottom, 0px))
      max(12px, env(safe-area-inset-left, 0px));
  }

  .tour-booking-modal-dialog {
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
    max-height: calc(100dvh - 24px);
    border-radius: 18px;
  }

  .tour-booking-modal-header {
    min-height: 64px;
    height: auto;
    padding: 16px 16px 14px;
  }

  .tour-booking-modal-header h2 {
    font-size: 1.45rem;
  }

  .tour-booking-modal-body {
    padding: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tour-booking-modal-backdrop,
  .tour-booking-modal-dialog {
    transition: none;
  }

  .tour-booking-modal-dialog {
    transform: none;
  }
}
