/* ============================================================
   THE KARIBU SITE MAP — homepage interactive site plan
   Replaces the old React masterplan bundle (assets/masterplan/,
   kept on disk as a backup). The photorealistic aerial render is
   a pure base layer: every zone, marker, tooltip and panel is
   HTML/CSS/JS (js/sitemap.js) so labels stay editable, scalable
   and accessible without touching the image.
   All classes are sm- prefixed to avoid colliding with style.css;
   panel CTAs reuse the site's .btn button classes.
   ============================================================ */

#sitemap { padding: 4.5rem 0 4rem; }
#sitemap .sm-wrap { max-width: 1200px; margin: 0 auto; padding: 0 1rem; }

/* ---------- "This is interactive" affordances ----------
   A reviewer looked at the finished map and did not realise anything
   on it could be clicked, so the interactivity is now stated in words
   before it is discovered by accident: an instruction line above the
   map, a badge on the image itself, and a one-time attract pulse when
   the map first scrolls into view. */
.sm-howto {
  max-width: 1200px;
  margin: 0 auto 1rem;
  display: flex; align-items: center; justify-content: center;
  gap: 0.6rem;
  font-family: var(--sans);
  font-size: 0.8rem;
  color: var(--azure);
  text-align: center;
  line-height: 1.5;
}
.sm-howto svg { width: 17px; height: 17px; flex: none; color: var(--gold-deep); }
.sm-howto .desktop-only { display: inline; }
.sm-howto .mobile-only { display: none; }
@media (max-width: 700px) {
  .sm-howto .desktop-only { display: none; }
  .sm-howto .mobile-only { display: inline; }
}

/* Badge sitting on the render itself */
.sm-live-badge {
  position: absolute; top: 0.9rem; left: 0.9rem; z-index: 6;
  display: inline-flex; align-items: center; gap: 0.45rem;
  background: rgba(1,26,77,0.86);
  backdrop-filter: blur(4px);
  color: var(--white);
  font-family: var(--sans);
  font-size: 0.56rem; font-weight: 500;
  letter-spacing: 0.22em; text-transform: uppercase;
  padding: 0.5rem 0.8rem;
  pointer-events: none;
}
.sm-live-badge .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--gold);
  animation: sm-blink 2.2s ease-in-out infinite;
}
@keyframes sm-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

/* One-time attract pulse, played when the map first enters the viewport */
@keyframes sm-attract {
  0%   { box-shadow: 0 0 0 0 rgba(217,179,108,0.9), 0 3px 10px rgba(1,26,77,0.45); }
  70%  { box-shadow: 0 0 0 16px rgba(217,179,108,0), 0 3px 10px rgba(1,26,77,0.45); }
  100% { box-shadow: 0 0 0 0 rgba(217,179,108,0), 0 3px 10px rgba(1,26,77,0.45); }
}
.sm-marker.sm-attract { animation: sm-attract 1.7s var(--ease) 3; }
@keyframes sm-legend-attract {
  0%, 100% { border-color: rgba(1,35,101,0.28); background: rgba(255,255,255,0.72); }
  50%      { border-color: var(--gold-deep);    background: rgba(217,179,108,0.24); }
}
.sm-legend button.sm-attract { animation: sm-legend-attract 1.9s var(--ease) 2; }
@media (prefers-reduced-motion: reduce) {
  .sm-marker.sm-attract, .sm-legend button.sm-attract { animation: none; }
  .sm-live-badge .dot { animation: none; }
}

/* ---------- Map stage ---------- */
.sm-stage {
  position: relative;
  border: 1px solid rgba(1,35,101,0.18);
  background: #0b1c33;
  box-shadow: 0 24px 60px rgba(1,26,77,0.14);
}
.sm-stage img.sm-base { width: 100%; height: auto; user-select: none; -webkit-user-drag: none; }
.sm-stage svg.sm-overlay { position: absolute; inset: 0; width: 100%; height: 100%; }

/* Collection zones — invisible until hover/focus/selection (no resting
   outlines on the render, per client feedback) */
.sm-zone {
  fill: rgba(197,213,223,0);
  stroke: transparent;
  stroke-width: 2.5;
  cursor: pointer;
  pointer-events: auto;
  outline: none;
  transition: fill 0.25s, stroke 0.25s;
}
.sm-zone:hover, .sm-zone:focus-visible { fill: rgba(217,179,108,0.2); stroke: var(--gold); }
.sm-zone.sm-selected { fill: rgba(217,179,108,0.26); stroke: var(--gold); stroke-width: 3; }
.sm-zone:focus-visible { stroke: #fff; stroke-width: 3.5; }

/* Markers */
.sm-marker {
  position: absolute; transform: translate(-50%,-50%);
  display: flex; align-items: center; justify-content: center;
  border-radius: 999px; border: 1.5px solid rgba(255,255,255,0.9);
  box-shadow: 0 3px 10px rgba(1,26,77,0.45);
  transition: transform 0.2s var(--ease), box-shadow 0.2s, background 0.2s;
  z-index: 3;
  cursor: pointer;
  font-family: var(--sans);
}
.sm-marker:hover, .sm-marker:focus-visible { transform: translate(-50%,-50%) scale(1.22); z-index: 5; box-shadow: 0 6px 18px rgba(1,26,77,0.55); }
.sm-marker:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.sm-marker.sm-selected { background: var(--gold); color: var(--navy-deep); z-index: 5; }
.sm-marker-unit {
  width: 32px; height: 32px;
  background: rgba(1,26,77,0.88); color: #fff;
  font-size: 0.66rem; font-weight: 500; letter-spacing: 0.02em;
  border: 1.5px solid rgba(255,255,255,0.9);
}
.sm-marker-unit.sm-selected { background: var(--gold); color: var(--navy-deep); }
.sm-marker-amenity {
  width: 26px; height: 26px;
  background: rgba(253,253,252,0.92); color: var(--navy);
  font-size: 0.72rem;
}
.sm-marker-amenity:hover, .sm-marker-amenity:focus-visible { background: var(--gold); }
.sm-marker-chip {
  padding: 0.4rem 0.8rem; border-radius: 999px;
  background: rgba(1,26,77,0.88); color: #fff;
  font-size: 0.6rem; font-weight: 500; letter-spacing: 0.16em; text-transform: uppercase;
  white-space: nowrap;
}
.sm-marker-chip:hover, .sm-marker-chip:focus-visible { background: var(--gold); color: var(--navy-deep); }
@media (max-width: 700px) {
  .sm-marker-unit { width: 36px; height: 36px; }
  .sm-marker-amenity { width: 32px; height: 32px; }
  .sm-marker-chip { font-size: 0.52rem; padding: 0.35rem 0.6rem; letter-spacing: 0.12em; }

  /* On a phone, 22 markers at once bury the render. Start with a clean
     map and reveal only what the reader picks from the keys below it —
     js/sitemap.js adds .sm-selected to the matching marker(s). The SVG
     zones stay tappable throughout, so the buildings are still live.
     Desktop is unaffected: markers show at all times there. */
  .sm-marker { display: none; }
  .sm-marker.sm-selected { display: flex; }
}

/* Legend-selection pulse: draws the eye to the highlighted spot */
@keyframes sm-pulse {
  0% { box-shadow: 0 0 0 0 rgba(217,179,108,0.85), 0 3px 10px rgba(1,26,77,0.45); }
  70% { box-shadow: 0 0 0 18px rgba(217,179,108,0), 0 3px 10px rgba(1,26,77,0.45); }
  100% { box-shadow: 0 0 0 0 rgba(217,179,108,0), 0 3px 10px rgba(1,26,77,0.45); }
}
.sm-marker.sm-pulse { animation: sm-pulse 1.1s var(--ease) 3; }
@media (prefers-reduced-motion: reduce) { .sm-marker.sm-pulse { animation: none; } }

/* Hover tooltip (desktop pointer only) */
.sm-tip {
  position: absolute; z-index: 9; pointer-events: none;
  background: var(--navy-deep); color: #fff;
  font-size: 0.7rem; font-weight: 500; letter-spacing: 0.08em;
  padding: 0.45rem 0.75rem; border-radius: 3px;
  transform: translate(-50%,-130%);
  opacity: 0; transition: opacity 0.15s;
  max-width: 260px; text-align: center;
}
.sm-tip.show { opacity: 1; }
@media (hover: none) { .sm-tip { display: none; } }

/* ---------- Legend (labels outside the image) ---------- */
.sm-legend { margin-top: 1.4rem; display: grid; gap: 1.1rem; text-align: center; }
.sm-legend h3 {
  font-family: var(--sans);
  font-size: 0.66rem; font-weight: 500;
  letter-spacing: 0.28em; text-transform: uppercase;
  color: var(--greyblue);
  margin-bottom: 0.7rem;
}
.sm-legend .sm-row { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; }
/* Outlined keys in the manner of the filter chips on Google Maps: a rounded
   square carrying a border only, not a solid fill, so the keys read as map
   controls rather than as buttons. They fill in only once selected, tying the
   chosen key to the gold highlight on the map. */
.sm-legend button {
  font-family: var(--sans);
  border: 1px solid rgba(1,35,101,0.28);
  border-radius: 8px;
  background: rgba(255,255,255,0.72);
  color: var(--navy);
  font-size: 0.7rem; font-weight: 500; letter-spacing: 0.06em;
  padding: 0.7rem 1.05rem;
  min-height: 44px;
  cursor: pointer;
  transition: background 0.25s, color 0.25s, border-color 0.25s, box-shadow 0.25s;
}
.sm-legend button:hover, .sm-legend button:focus-visible {
  border-color: var(--navy);
  background: #fff;
  box-shadow: 0 1px 6px rgba(1,26,77,0.16);
}
.sm-legend button.sm-active {
  border-color: var(--gold-deep);
  background: rgba(217,179,108,0.18);
  color: var(--navy-deep);
  box-shadow: 0 1px 6px rgba(184,146,63,0.26);
}
.sm-legend .sm-zoom-link { font-size: 0.74rem; color: var(--navy); }

/* Mobile-only prompt, since the markers start hidden there. */
.sm-hint { display: none; }
@media (max-width: 700px) {
  .sm-hint {
    display: block;
    margin-top: 0.9rem;
    text-align: center;
    font-size: 0.74rem;
    line-height: 1.6;
    color: var(--greyblue);
  }
}

/* ---------- Panel: side panel desktop, bottom sheet mobile ---------- */
.sm-backdrop { position: fixed; inset: 0; background: rgba(1,26,77,0.35); opacity: 0; pointer-events: none; transition: opacity 0.3s; z-index: 70; }
.sm-backdrop.open { opacity: 1; pointer-events: auto; }
.sm-panel {
  position: fixed; z-index: 75; background: #fff;
  box-shadow: -18px 0 50px rgba(1,26,77,0.25);
  display: flex; flex-direction: column;
  transition: transform 0.35s var(--ease);
  top: 0; right: 0; height: 100%; width: min(430px, 92vw);
  transform: translateX(105%);
}
.sm-panel.open { transform: translateX(0); }
@media (max-width: 700px) {
  .sm-panel {
    top: auto; right: 0; left: 0; bottom: 0; height: auto; max-height: 80vh; width: 100%;
    transform: translateY(105%);
    border-radius: 14px 14px 0 0;
    box-shadow: 0 -18px 50px rgba(1,26,77,0.3);
  }
  .sm-panel.open { transform: translateY(0); }
}
.sm-panel-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
  padding: 1.3rem 1.4rem 1rem;
  border-bottom: 1px solid rgba(141,151,173,0.25);
}
.sm-panel-head .sm-eyebrow {
  font-size: 0.6rem; font-weight: 500; letter-spacing: 0.28em; text-transform: uppercase;
  color: var(--gold-deep); display: block; margin-bottom: 0.3rem;
}
.sm-panel-head h3 { font-family: var(--serif); font-weight: 400; color: var(--navy); font-size: 1.35rem; line-height: 1.25; }
.sm-close {
  flex: none; width: 38px; height: 38px; border-radius: 999px;
  border: 1px solid rgba(1,35,101,0.25); background: #fff; color: var(--navy);
  font-size: 1.15rem; line-height: 1; cursor: pointer;
}
.sm-close:hover, .sm-close:focus-visible { background: var(--navy); color: #fff; }
.sm-panel-body { overflow-y: auto; padding: 1.2rem 1.4rem 1.6rem; }
.sm-spec { list-style: none; margin: 0 0 1.1rem; padding: 0; }
.sm-spec li {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: 0.5rem 0; border-bottom: 1px dashed rgba(141,151,173,0.3);
  font-size: 0.84rem;
}
.sm-spec li span:first-child { color: var(--greyblue); font-size: 0.7rem; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; padding-top: 0.15rem; }
.sm-spec li span:last-child { text-align: right; color: var(--navy); font-weight: 500; }
.sm-panel-body p.sm-desc { font-size: 0.88rem; margin-bottom: 1.1rem; }
.sm-badge {
  display: inline-block;
  font-size: 0.62rem; font-weight: 500; letter-spacing: 0.16em; text-transform: uppercase;
  padding: 0.3rem 0.65rem; border-radius: 3px; border: 1px solid;
}
.sm-badge-founder { color: var(--gold-deep); border-color: var(--gold-deep); background: rgba(217,179,108,0.12); }
.sm-badge-presale { color: var(--navy); border-color: var(--navy); background: rgba(1,35,101,0.07); }
.sm-badge-future { color: var(--azure); border-color: var(--greyblue); background: rgba(141,151,173,0.12); }
.sm-units { list-style: none; margin: 0.3rem 0 1.2rem; padding: 0; }
.sm-units button {
  font-family: var(--sans);
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 0.8rem;
  background: none; border: none; border-bottom: 1px solid rgba(141,151,173,0.25);
  padding: 0.7rem 0.15rem; font-size: 0.86rem; color: var(--navy);
  text-align: left; cursor: pointer;
}
.sm-units button:hover, .sm-units button:focus-visible { background: var(--light-soft, #e9eff4); }
.sm-units .nm { font-weight: 500; }
.sm-units .pr { color: var(--azure); font-size: 0.78rem; margin-left: auto; }
.sm-ctas { display: grid; gap: 0.6rem; margin-top: 0.4rem; }
.sm-ctas .btn { width: 100%; }
.sm-subhead {
  font-family: var(--sans);
  font-size: 0.66rem; font-weight: 500;
  letter-spacing: 0.24em; text-transform: uppercase;
  color: var(--greyblue);
  margin-bottom: 0.2rem;
}
.sm-back {
  background: none; border: none; cursor: pointer;
  color: var(--greyblue);
  font-family: var(--sans);
  font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase;
  margin-bottom: 0.8rem; padding: 0;
}
.sm-back:hover { color: var(--navy); }

/* Debug coordinate readout (?debug=1 only) */
.sm-debug {
  position: fixed; left: 1rem; bottom: 1rem; z-index: 99;
  background: rgba(1,26,77,0.92); color: #9fe0a2;
  font: 12px/1.5 monospace; padding: 0.6rem 0.9rem; border-radius: 6px;
  display: none; white-space: pre;
}
body.sm-debug-on .sm-debug { display: block; }
