/* ==========================================================================
   Blue Lagoon Resort — 3D resort map
   --------------------------------------------------------------------------
   Styles for the isometric WebGL site plan, the floating hint / theme switch,
   the legend and the room preview card. Layout follows the approved model:
   card anchored top-right, photo centred, price bottom-left, CTA bottom-right.
   ========================================================================== */

/* ---------- map band ---------- */
.map-section {
  position: relative;
  /* Soft halo behind the plate; the outer stop matches the page cream so the
     band edges stay invisible against the surrounding sections. Painted on
     the section (not .map3d) so the legend strip below the model continues
     the same gradient with no seam. */
  background:
    radial-gradient(120% 92% at 50% 32%, #fbf5ea 0%, #f7eee1 46%, var(--cream) 100%);
  padding-bottom: 1px;
}

.map3d {
  position: relative;
  height: 660px;
  overflow: hidden;
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

html[data-theme='dark'] .map-section {
  background:
    radial-gradient(115% 88% at 62% 34%, #273122 0%, #1a2019 52%, #131812 100%);
}

.map3d.is-pointing { cursor: pointer; }
.map3d.is-dragging { cursor: grabbing; }

.map3d:focus-visible {
  outline: 2px solid var(--ink-soft);
  outline-offset: -4px;
}

.map3d__stage { position: absolute; inset: 0; }
.map3d__stage canvas { display: block; touch-action: pan-y; }

.map3d__status {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(360px, 78%);
  margin: 0;
  transform: translate(-50%, -50%);
  font-size: 12px;
  line-height: 1.6;
  letter-spacing: 0.02em;
  text-align: center;
  color: var(--muted);
}

/* Static isometric fallback (no WebGL / reduced motion) */
.map3d__svg { display: block; width: 100%; height: 100%; }
.map3d--static { cursor: default; }

/* ---------- hint + theme toggle ---------- */
.map3d__hint {
  position: absolute;
  top: 20px;
  right: clamp(16px, 2.99vw, 43px);
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 7px;
  max-width: min(290px, calc(100% - 32px));
  margin: 0;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.16em;
  line-height: 1.5;
  text-align: right;
  text-transform: uppercase;
  color: var(--muted);
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

/* the card takes the same corner — hide the hint while it is open */
body.room-preview-open .map3d__hint {
  opacity: 0;
  visibility: hidden;
}

.map3d__hint-text {
  display: block;
  font-size: 10px;
  letter-spacing: 0.13em;
}

.theme-toggle {
  flex: none;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 999px;
  line-height: 0;
  cursor: pointer;
  pointer-events: auto;
}

.theme-toggle__track {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 58px;
  height: 28px;
  padding: 0 7px;
  background: rgba(243, 232, 216, 0.5);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  color: var(--ink-soft);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.theme-toggle__thumb {
  position: absolute;
  top: 2px;
  left: 3px;
  z-index: 0;
  width: 22px;
  height: 22px;
  background: #fffaf0;
  border-radius: 50%;
  box-shadow: 0 1px 4px var(--shadow);
  transition: transform 0.32s cubic-bezier(0.4, 0.05, 0.2, 1), background-color 0.3s ease;
}

.theme-toggle__icon {
  position: relative;
  z-index: 1;
  flex: none;
  opacity: 0.45;
  transition: opacity 0.3s ease;
}

.theme-toggle__icon--sun { opacity: 1; }

.theme-toggle:hover .theme-toggle__track,
.theme-toggle:focus-visible .theme-toggle__track {
  border-color: var(--green);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--ink-soft);
  outline-offset: 3px;
}

html[data-theme='dark'] .theme-toggle__track { background: rgba(8, 13, 8, 0.6); }
html[data-theme='dark'] .theme-toggle__thumb {
  background: #3b4a39;
  transform: translateX(30px);
}
html[data-theme='dark'] .theme-toggle__icon--sun { opacity: 0.4; }
html[data-theme='dark'] .theme-toggle__icon--moon { opacity: 1; }

/* ---------- place note (non-room buildings) ---------- */
.map3d__place {
  position: absolute;
  top: 18px;
  right: clamp(16px, 2.99vw, 43px);
  z-index: 6;
  width: clamp(248px, 24vw, 306px);
  padding: 14px 40px 15px 17px;
  background: var(--surface-raised);
  border: 1px solid var(--hairline);
  box-shadow: 0 22px 48px var(--shadow);
  color: var(--ink);
  pointer-events: auto;
  user-select: text;
  -webkit-user-select: text;
  animation: room-card-in 0.32s cubic-bezier(0.22, 0.7, 0.24, 1) both;
}

.map3d__place[hidden] { display: none; }

/* A place with a photo (the restaurant) shows it across the top of the note,
   like the room card, and the note is a little wider. */
.map3d__place.has-photo { width: clamp(268px, 26vw, 340px); }

.map3d__place-photo {
  display: block;
  width: calc(100% + 57px);
  max-width: none;
  height: auto;
  aspect-ratio: 4 / 3;
  margin: -14px -40px 12px -17px;
  object-fit: cover;
  background: var(--hairline);
}

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

/* Over the photo the close button needs its own light disc to stay visible. */
.map3d__place.has-photo .map3d__place-close {
  background: rgb(255 255 255 / 0.85);
  opacity: 1;
}

/* mirror the room card: the note takes the hint's corner */
.map3d.is-place-open .map3d__hint {
  opacity: 0;
  visibility: hidden;
  /* no fade: the note and hint share the same corner, so an overlapping
     cross-fade reads as a double-exposed label */
  transition: none;
}

.map3d__place-tag {
  margin: 0 0 5px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: var(--muted);
}

.map3d__place-tag::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 7px;
  vertical-align: 1px;
  background: #e8b869;
  border-radius: 50%;
  box-shadow: 0 0 7px #e8b869;
}

.map3d__place-name {
  margin: 0;
  font-family: var(--font-display);
  font-size: 23px;
  font-weight: 400;
  line-height: 1.1;
}

.map3d__place-desc {
  margin: 7px 0 0;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--muted);
}

.map3d__place-close {
  position: absolute;
  top: 7px;
  right: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 29px;
  height: 29px;
  padding: 0;
  color: var(--ink-soft);
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s ease, background-color 0.2s ease;
}

.map3d__place-close:hover,
.map3d__place-close:focus-visible {
  background: var(--hairline);
  opacity: 1;
}

.map3d__place-close:focus-visible { outline: 2px solid var(--ink-soft); outline-offset: 2px; }

/* ---------- reset + zoom ---------- */
.map3d__reset,
.map3d__zoom-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--ink-soft);
  background: rgba(248, 240, 228, 0.74);
  border: 1px solid var(--swatch-ring);
  border-radius: 50%;
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  cursor: pointer;
  opacity: 0.82;
  transition: opacity 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.map3d__reset:hover,
.map3d__zoom-btn:hover { opacity: 1; background: var(--surface-raised); }
.map3d__reset:active,
.map3d__zoom-btn:active { transform: translateY(1px); }
.map3d__reset:focus-visible,
.map3d__zoom-btn:focus-visible { outline: 2px solid var(--ink-soft); outline-offset: 2px; }

html[data-theme='dark'] .map3d__reset,
html[data-theme='dark'] .map3d__zoom-btn { background: rgba(34, 42, 34, 0.74); }

.map3d__reset {
  position: absolute;
  right: clamp(16px, 2.99vw, 43px);
  bottom: 16px;
  z-index: 5;
}

.map3d__zoom {
  position: absolute;
  right: clamp(16px, 2.99vw, 43px);
  bottom: 58px;
  z-index: 5;
  display: grid;
  gap: 6px;
}

/* ---------- legend ---------- */
.map3d__legend {
  position: absolute;
  left: clamp(16px, 2.99vw, 43px);
  bottom: 18px;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  gap: 7px 18px;
  max-width: 60%;
  margin: 0;
  padding: 0;
  list-style: none;
  pointer-events: none;
}

.map3d__key {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 10px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
}

.map3d__swatch {
  width: 10px;
  height: 10px;
  border-radius: 1px;
  box-shadow: inset 0 0 0 1px var(--swatch-ring);
}

.map3d__swatch--lagoon { background: #a87f56; }
.map3d__swatch--garden { background: #738a56; }
.map3d__swatch--family { background: #a9663f; }
.map3d__swatch--water  { background: #8fb3b2; }
.map3d__swatch--road   { background: #d8ccb3; }

html[data-theme='dark'] .map3d__swatch--lagoon { background: #8a6f4e; }
html[data-theme='dark'] .map3d__swatch--garden { background: #5f7a4f; }
html[data-theme='dark'] .map3d__swatch--family { background: #8a4f34; }
html[data-theme='dark'] .map3d__swatch--water  { background: #2a4a4f; }
html[data-theme='dark'] .map3d__swatch--road   { background: #4f4a3e; }

/* ==========================================================================
   Room preview card
   ========================================================================== */
.map-preview {
  position: absolute;
  inset: 0;
  /* The booking engine injects its promo popup at z-index 2147483641
     (.tl-widgets-container); keep the room card above it so prices and the
     CTA are never covered. */
  z-index: 2147483642;
  pointer-events: none;
}

.map-preview[hidden] { display: none; }
.map-preview__scrim { display: none; }

.room-card {
  position: absolute;
  top: 18px;
  right: clamp(16px, 2.99vw, 43px);
  display: flex;
  flex-direction: column;
  width: clamp(300px, 25vw, 344px);
  max-height: calc(100% - 36px);
  overflow: hidden;
  background: var(--surface-raised);
  border: 1px solid var(--hairline);
  box-shadow: 0 22px 48px var(--shadow);
  color: var(--ink);
  cursor: default;
  pointer-events: auto;
  user-select: text;
  -webkit-user-select: text;
  animation: room-card-in 0.32s cubic-bezier(0.22, 0.7, 0.24, 1) both;
}

@keyframes room-card-in {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.room-card:focus-visible {
  outline: 2px solid var(--ink-soft);
  outline-offset: -3px;
}

/* text under the photo: view · cooling, name, facts, short description */
.room-card__body {
  padding: 14px 17px 0;
}

.room-card__eyebrow {
  margin: 0 0 3px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.room-card__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 500;
  line-height: 1.1;
  color: var(--ink);
}

.room-card__desc {
  display: -webkit-box;
  margin: 9px 0 0;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-soft, var(--muted));
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

/* counter and close button share the top-right corner of the photo */
.room-card__topbar {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.room-card__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: rgba(14, 19, 13, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.room-card__close:hover,
.room-card__close:focus-visible {
  background: rgba(14, 19, 13, 0.85);
}

/* photo — centred in the card, arrows either side */
.room-card__media {
  position: relative;
  flex: none;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--green-deep);
}

.room-card__photo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: opacity 0.2s ease;
}

.room-card__photo.is-swapping { opacity: 0.45; }

.room-card__arrow {
  position: absolute;
  top: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  background: rgba(14, 19, 13, 0.48);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  transform: translateY(-50%);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.room-card__arrow:hover,
.room-card__arrow:focus-visible {
  background: rgba(14, 19, 13, 0.75);
  border-color: rgba(255, 255, 255, 0.55);
}

.room-card__arrow--prev { left: 10px; }
.room-card__arrow--next { right: 10px; }

.room-card__counter {
  margin: 0;
  padding: 3px 9px;
  background: rgba(14, 19, 13, 0.6);
  border-radius: 999px;
  color: #fff;
  font-size: 11px;
  letter-spacing: 0.14em;
  line-height: 1.5;
}

/* size · guests · beds */
.room-card__facts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 6px;
  margin: 6px 0 0;
  font-size: 12.5px;
  letter-spacing: 0.01em;
  color: var(--ink);
}

.room-card__facts span { white-space: nowrap; }
.room-card__fact-dot { opacity: 0.6; }

.room-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding: 11px 14px 12px 17px;
  border-top: 1px solid var(--hairline);
}

.room-card__price {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0 5px;
  margin: 0;
  line-height: 1.2;
}

.room-card__amount {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--ink);
}

.room-card__unit {
  font-size: 12px;
  color: var(--muted);
}

.room-card__cta {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 15px;
  background: var(--action-bg);
  border: 1px solid transparent;
  border-radius: 2px;
  color: var(--action-ink);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-decoration: none;
  transition: background-color 0.25s ease;
}

.room-card__cta:hover,
.room-card__cta:focus-visible { background: var(--action-bg-hover); }
.room-card__cta:active { transform: translateY(1px); }

.room-card__cta svg { flex: none; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1023px) {
  .map3d { height: clamp(420px, 62vw, 620px); }
}

@media (max-width: 1199px) {
  /* At these widths the plate leaves too little empty corner, so the key
     steps out of the model and sits in its own strip underneath. */
  .map3d__legend {
    position: static;
    max-width: none;
    padding: 14px clamp(16px, 2.99vw, 43px) 18px;
  }
}

@media (max-width: 767px) {
  .map-preview {
    position: fixed;
    inset: 0;
    z-index: 2147483643;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    pointer-events: auto;
  }

  .map-preview__scrim {
    display: block;
    position: absolute;
    inset: 0;
    background: var(--scrim);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    pointer-events: auto;
  }

  .room-card {
    position: relative;
    top: auto;
    right: auto;
    width: min(400px, 100%);
    max-height: calc(100vh - 36px);
    overflow-y: auto;
    animation: room-card-in-modal 0.32s cubic-bezier(0.22, 0.7, 0.24, 1) both;
  }

  .room-card__body { padding: 14px 16px 0; }
  .room-card__title { font-size: 25px; }

  body.room-preview-open { overflow: hidden; }
}

@keyframes room-card-in-modal {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 599px) {
  .map3d { height: clamp(380px, 112vw, 520px); }

  .map3d__hint {
    top: 12px;
    left: 16px;
    right: 16px;
    gap: 10px;
    max-width: none;
    flex-direction: row-reverse;
    align-items: center;
    justify-content: space-between;
  }

  .map3d__hint-text {
    font-size: 8.5px;
    letter-spacing: 0.03em;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .map3d__legend {
    padding: 12px 16px 16px;
    gap: 6px 14px;
  }

  .map3d__place {
    top: 12px;
    left: 16px;
    right: 16px;
    width: auto;
    padding: 12px 38px 13px 15px;
  }

  .map3d__place-name { font-size: 20px; }

  .map3d__place.has-photo { width: auto; }

  .map3d__place-photo {
    width: calc(100% + 53px);
    margin: -12px -38px 10px -15px;
    aspect-ratio: 16 / 9;
  }

  .map3d__reset,
  .map3d__zoom-btn {
    width: 38px;
    height: 38px;
  }

  .map3d__reset {
    right: 16px;
    bottom: 12px;
  }

  .map3d__zoom {
    right: 16px;
    bottom: 56px;
  }

  .map3d__key { font-size: 9px; letter-spacing: 0.1em; }
}

@media (prefers-reduced-motion: reduce) {
  .room-card,
  .map3d__hint {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
