/* ============================================================
 * ============================================================
 *
 *   BOOKING MAP MODULE  —  styles for [booking_map] shortcode
 *   Clickable floor-plan areas + popup that fills the
 *   Gravity Forms "Area" dropdown (CSS class: booking-area).
 *   Pairs with booking-map.php.
 *
 *   Fonts (Comfortaa / Manrope) are loaded by the @import
 *   in style.css.
 *
 * ============================================================
 * ============================================================ */

/* Shared tokens — change colours / fonts here */
.booking-map,
.booking-map-tooltip {
  --booking-map-navy: #1A445A;
  --booking-map-muted: #737272;
  --booking-map-card-bg: #ffffff;
  --booking-map-accent: #64A09B;
  --booking-map-card-shadow: 0 0 24px rgba(0, 0, 0, 0.18); /* even all round — no downward shift */
  --booking-map-radius: 16px;
  --booking-map-pad: 18px;       /* popup text padding */
  --booking-map-media-pad: 10px; /* badge + close button distance from the photo edges */
  --booking-map-heading-font: "Comfortaa", sans-serif;
  --booking-map-body-font: "Manrope", sans-serif;

  /* Area highlight brightness (0 = invisible, 1 = solid white) */
  --booking-map-zone-rest: 0.3;         /* every area, always — "minimum visibility" */
  --booking-map-zone-pulse: 0.6;        /* peak of the attract loop */
  --booking-map-zone-pulse-scale: 1.05; /* area grows this much at the peak of its glow (1 = no scale) */
  --booking-map-zone-active: 0.6;       /* open popup / chosen in the form */
}

/* Map — background image with the zones SVG laid exactly on top.
   Without a background image the SVG sits in normal flow on its own. */
.booking-map {
  position: relative;
  width: 100%;
}

/* Rounded corners clip the image and the zone highlights alike
   (the popup lives on <body>, so it is never clipped).
   isolation: isolate keeps Safari clipping the corners while the
   zones fade in and out. */
.booking-map-stage {
  position: relative;
  overflow: hidden;
  border-radius: var(--booking-map-radius);
  isolation: isolate;
}

.booking-map-bg {
  display: block;
  width: 100%;
  height: auto;
}

.booking-map-zones svg {
  display: block;
  width: 100%;
  height: auto;
}

.booking-map-stage.has-bg .booking-map-zones {
  position: absolute;
  inset: 0;
}

.booking-map-stage.has-bg .booking-map-zones svg {
  height: 100%;
}

/* Zones. Only opacity is changed, so the fill colour from the SVG artwork
   is kept (the feather filter is added by booking-map.js).
   Named shapes that are not (yet) areas stay hidden: before the script
   runs, if it fails, or a shape in the SVG has no entry in the area list.
   The script turns real areas into .booking-map-zone. Shapes only, not
   <g>: a named wrapper group at opacity 0 would hide its zones for good. */
.booking-map-zones svg :is(path, rect, polygon, polyline, circle, ellipse)[id]:not(.booking-map-zone) {
  opacity: 0;
}

/* Resting state: every area faintly visible. Two classes so it outranks
   a <style> block a design tool may put inside the SVG. */
.booking-map-zones .booking-map-zone {
  opacity: var(--booking-map-zone-rest);
  cursor: pointer;
  outline: none;
  transition: opacity 300ms ease;
  -webkit-tap-highlight-color: transparent;
  transform-box: fill-box;   /* scale each area from its own centre */
  transform-origin: center;
}

/* Attract loop: booking-map.js gives one area at a time .is-pulse, in
   sequence, while nothing is chosen. 1600ms = PULSE_MS in the script. */
.booking-map-zones .booking-map-zone.is-pulse {
  animation: booking-map-pulse 1600ms ease-in-out;
}

/* A shape exported with its own transform (e.g. rotated in Figma) would
   lose it while scaling — those only fade */
.booking-map-zones .booking-map-zone.is-pulse[transform] {
  animation-name: booking-map-pulse-fade;
}

@keyframes booking-map-pulse {
  0%, 100% { opacity: var(--booking-map-zone-rest); transform: scale(1); }
  50%      { opacity: var(--booking-map-zone-pulse); transform: scale(var(--booking-map-zone-pulse-scale)); }
}

@keyframes booking-map-pulse-fade {
  0%, 100% { opacity: var(--booking-map-zone-rest); }
  50%      { opacity: var(--booking-map-zone-pulse); }
}

/* Open popup / chosen in the form: brightest. !important also beats a
   running pulse. (No hover effect — the attract loop shows the areas.) */
.booking-map-zone.is-active {
  opacity: var(--booking-map-zone-active) !important;
}

/* Keyboard focus: crisp shape + outline (the feather filter would
   soften the outline away) */
.booking-map-zone:focus-visible {
  opacity: var(--booking-map-zone-active) !important;
  stroke: var(--booking-map-navy);
  stroke-width: 3;
  filter: none;
}

/* Popup — lives on <body> (moved there by the script) and is positioned
   in JS above the clicked zone, clamped inside the screen. The doubled
   class selectors below outrank Hello Elementor / Elementor kit styles
   for h3, p and button. */
.booking-map-tooltip {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 99; /* just under the site's fixed Elementor header (z-index 100) — slides beneath it on scroll */
  width: min(260px, calc(100vw - 32px));
}

.booking-map-tooltip.is-shown {
  display: block;
}

.booking-map-tooltip .booking-map-tooltip-card {
  position: relative;
  background: var(--booking-map-card-bg);
  border-radius: var(--booking-map-radius);
  box-shadow: var(--booking-map-card-shadow);
  opacity: 0;
  transform: scale(0.82);
  transform-origin: var(--booking-map-origin, 50% 100%);
  transition: transform 150ms ease, opacity 150ms ease;
}

.booking-map-tooltip.is-open .booking-map-tooltip-card {
  opacity: 1;
  transform: scale(1);
  transition: transform 280ms cubic-bezier(0.34, 1.4, 0.64, 1), opacity 200ms ease;
}

/* Photo */
.booking-map-tooltip .booking-map-tooltip-media {
  position: relative;
  z-index: 1;
  aspect-ratio: 16 / 10;
  max-height: 35vh;
  overflow: hidden;
  border-radius: var(--booking-map-radius) var(--booking-map-radius) 0 0;
  background: #e9eef0;
}

.booking-map-tooltip.no-img .booking-map-tooltip-media {
  display: none;
}

.booking-map-tooltip .booking-map-tooltip-img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  border-radius: 0;
}

/* Seating type ("Sunbed", "Dining Table") — badge over the photo's
   top-left corner. Badge and close button sit --booking-map-media-pad
   from the photo edges and are both 28px tall. */
.booking-map-tooltip .booking-map-tooltip-badge {
  position: absolute;
  top: var(--booking-map-media-pad);
  left: var(--booking-map-media-pad);
  z-index: 2;
  padding: 7px 10px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.15);
  font-family: var(--booking-map-body-font);
  font-size: 12px;
  font-weight: 600;
  line-height: 14px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--booking-map-navy);
}

/* Text — same style as the food menu cards (acf-shortcodes.css):
   title (area name), guests in the description style, then
   "Book Now →" in the price style. */
.booking-map-tooltip .booking-map-tooltip-body {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: var(--booking-map-pad);
  text-align: left;
}

/* No photo: keep the title clear of the badge and close button */
.booking-map-tooltip.no-img .booking-map-tooltip-body {
  padding-top: calc(var(--booking-map-media-pad) + 28px + var(--booking-map-pad));
}

.booking-map-tooltip .booking-map-tooltip-title {
  margin: 0;
  padding: 0;
  font-family: var(--booking-map-heading-font);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--booking-map-navy);
}

/* Guests ("4 Guests") — food card description style */
.booking-map-tooltip .booking-map-tooltip-pax {
  margin: 0;
  padding: 0;
  font-family: var(--booking-map-body-font);
  font-size: 15px;
  font-weight: 400;
  line-height: 24px;
  letter-spacing: 0.5px;
  color: var(--booking-map-muted);
}

/* "Book Now →" — food card price style, arrow on the right.
   No hover effect; hover / focus repeat the normal look so the Hello
   Elementor theme's pink button hover can't show. */
.booking-map-tooltip .booking-map-tooltip-card .booking-map-tooltip-book,
.booking-map-tooltip .booking-map-tooltip-card .booking-map-tooltip-book:hover,
.booking-map-tooltip .booking-map-tooltip-card .booking-map-tooltip-book:focus {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 10px;
  margin: 0;
  padding: 2px 0 0;
  background: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
  color: var(--booking-map-accent);
  font-family: var(--booking-map-body-font);
  font-size: 20px;
  font-weight: 600;
  line-height: 26px;
  letter-spacing: 1px;
  text-transform: none;
  cursor: pointer;
}

.booking-map-tooltip .booking-map-tooltip-book-arrow {
  display: block;
  flex: none;
}

.booking-map-tooltip .booking-map-tooltip-card .booking-map-tooltip-book:focus-visible {
  outline: 2px solid var(--booking-map-navy);
  outline-offset: 4px;
}

/* Close button — small round, over the photo's top-right corner,
   thick drawn cross (SVG). No hover effect. */
.booking-map-tooltip .booking-map-tooltip-card .booking-map-tooltip-close,
.booking-map-tooltip .booking-map-tooltip-card .booking-map-tooltip-close:hover,
.booking-map-tooltip .booking-map-tooltip-card .booking-map-tooltip-close:focus {
  position: absolute;
  top: var(--booking-map-media-pad);
  right: var(--booking-map-media-pad);
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin: 0;
  padding: 0;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.15);
  color: var(--booking-map-navy);
  line-height: 0;
  cursor: pointer;
}

.booking-map-tooltip .booking-map-tooltip-card .booking-map-tooltip-close svg {
  display: block;
}

.booking-map-tooltip .booking-map-tooltip-card .booking-map-tooltip-close:focus-visible {
  outline: 2px solid var(--booking-map-navy);
  outline-offset: 2px;
}

/* Short screens (phones in landscape): compact popup so it fits
   between the fixed header and the bottom of the screen.
   Kept after the regular popup rules so it wins (same specificity). */
@media (max-height: 480px) {
  .booking-map-tooltip {
    --booking-map-pad: 14px;
  }
  .booking-map-tooltip .booking-map-tooltip-media {
    max-height: 20vh;
  }
  .booking-map-tooltip .booking-map-tooltip-title {
    font-size: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .booking-map-zones .booking-map-zone,
  .booking-map-tooltip .booking-map-tooltip-card,
  .booking-map-tooltip.is-open .booking-map-tooltip-card {
    transition: none;
  }
  .booking-map-tooltip .booking-map-tooltip-card {
    transform: none;
  }
  .booking-map-zones .booking-map-zone.is-pulse {
    animation: none;
  }
}

/* ============================================================
 *   END BOOKING MAP MODULE STYLES
 * ============================================================ */
