:root {
  --ink: #202124;
  --muted: #6a6f76;
  --line: #d8d3ca;
  --paper: #f7f5f0;
  --surface: #ffffff;
  --accent: #315d64;
  --accent-strong: #173f46;
  --warm: #c49063;
  --shadow: 0 24px 70px rgba(31, 34, 37, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

body.tour-immersive {
  overflow: hidden;
  background: #111;
}

button,
a {
  font: inherit;
}

button {
  cursor: pointer;
}

img {
  display: block;
  width: 100%;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 72px;
  padding: 14px clamp(18px, 4vw, 56px);
  border-bottom: 1px solid rgba(32, 33, 36, 0.1);
  background: rgba(247, 245, 240, 0.92);
  backdrop-filter: blur(14px);
}

.brand {
  color: var(--ink);
  text-decoration: none;
}

.brand span {
  display: block;
  font-size: 18px;
  font-weight: 760;
  line-height: 1;
}

.brand small {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.main-nav a {
  min-width: 94px;
  padding: 10px 14px;
  border-radius: 999px;
  color: var(--ink);
  text-align: center;
  text-decoration: none;
}

.main-nav a:hover {
  background: rgba(49, 93, 100, 0.1);
}

.section {
  padding: clamp(44px, 7vw, 86px) clamp(18px, 4vw, 56px);
}

.section-heading {
  max-width: 760px;
  margin: 0 0 28px;
}

.section-heading.compact {
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 760;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-weight: 780;
  letter-spacing: 0;
}

h1 {
  max-width: 720px;
  font-size: clamp(34px, 5vw, 64px);
  line-height: 1.02;
}

h2 {
  font-size: clamp(28px, 3.4vw, 44px);
  line-height: 1.08;
}

.map-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: clamp(18px, 3vw, 32px);
  align-items: stretch;
}

.image-stage {
  position: relative;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.implantation-stage {
  min-height: 420px;
}

.implantation-stage img {
  height: 100%;
  object-fit: contain;
}

.apartment-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 320px;
  padding: clamp(24px, 4vw, 38px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.apartment-panel h2 {
  margin-bottom: 14px;
}

.apartment-panel p:not(.eyebrow) {
  margin: 0 0 24px;
  color: var(--muted);
  line-height: 1.65;
}

.primary-action,
.room-choice,
.tour-tabs button {
  border: 1px solid transparent;
  border-radius: 999px;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
  min-height: 46px;
  padding: 0 20px;
  color: #fff;
  background: var(--accent);
  text-decoration: none;
}

.primary-action:hover,
.primary-action:focus-visible {
  background: var(--accent-strong);
  transform: translateY(-1px);
}

.apartment-pin,
.room-pin {
  position: absolute;
  left: var(--x);
  top: var(--y);
  z-index: 2;
  transform: translate(-50%, -50%);
  border: 0;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 12px 30px rgba(23, 63, 70, 0.3);
}

.apartment-pin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 112px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  font-weight: 760;
  text-decoration: none;
}

.room-pin {
  min-width: 88px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 720;
}

.apartment-pin::after,
.room-pin::after {
  content: "";
  position: absolute;
  inset: -7px;
  z-index: -1;
  border: 2px solid rgba(49, 93, 100, 0.28);
  border-radius: inherit;
}

.apartment-pin:hover,
.room-pin:hover,
.room-pin.is-active {
  background: var(--warm);
}

.apartment-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: clamp(18px, 3vw, 28px);
  align-items: start;
}

.floorplan-stage {
  max-width: 860px;
}

.room-list {
  position: sticky;
  top: 96px;
  display: grid;
  gap: 10px;
}

.room-choice,
.tour-tabs button {
  min-height: 42px;
  padding: 0 16px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.68);
  border-color: var(--line);
}

.room-choice {
  width: 100%;
  text-align: left;
}

.room-choice:hover,
.room-choice.is-active,
.tour-tabs button:hover,
.tour-tabs button.is-active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.tour-section {
  padding-top: 24px;
}

.tour-page {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 72px);
  padding: 18px clamp(14px, 3vw, 32px) clamp(14px, 3vw, 32px);
}

.tour-immersive .tour-page {
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  padding: 0;
}

.tour-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 18px;
}

.tour-page .tour-heading {
  flex: 0 0 auto;
}

.tour-page h1 {
  font-size: clamp(30px, 4vw, 50px);
}

.tour-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.viewer-shell {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #151515;
  box-shadow: var(--shadow);
}

.tour-page .viewer-shell {
  flex: 1 1 auto;
}

.tour-immersive .viewer-shell {
  width: 100vw;
  height: 100vh;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

#panorama {
  width: 100%;
  height: min(72vh, 720px);
  min-height: 460px;
}

.tour-page #panorama {
  height: 100%;
  min-height: 0;
}

.tour-immersive #panorama {
  width: 100vw;
  height: 100vh;
}

.viewer-message {
  display: grid;
  place-content: center;
  gap: 10px;
  width: 100%;
  height: 100%;
  padding: 28px;
  color: #fff;
  text-align: center;
}

.viewer-message strong {
  font-size: 22px;
}

.viewer-message span {
  max-width: 520px;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.55;
}

.viewer-minimap {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 6;
  width: clamp(168px, 18vw, 250px);
  filter: drop-shadow(0 14px 28px rgba(0, 0, 0, 0.38));
}

.minimap-apartment-label {
  width: 100%;
  margin-bottom: 8px;
  color: #fff;
  font-size: 13px;
  font-weight: 850;
  line-height: 1;
  text-align: center;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
  white-space: nowrap;
}

.minimap-stage {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background: transparent;
}

.minimap-stage img {
  opacity: 0.96;
}

.minimap-points {
  position: absolute;
  inset: 0;
}

.minimap-point {
  position: absolute;
  left: var(--x);
  top: var(--y);
  display: grid;
  place-items: center;
  width: 12px;
  height: 12px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 50%;
  color: transparent;
  background: var(--accent);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.32);
  transform: translate(-50%, -50%);
}

.minimap-point span {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 5px);
  display: none;
  padding: 4px 7px;
  border-radius: 999px;
  color: #fff;
  background: rgba(15, 17, 18, 0.88);
  font-size: 11px;
  font-weight: 760;
  white-space: nowrap;
  transform: translateX(-50%);
}

.minimap-point:hover span,
.minimap-point:focus-visible span {
  display: block;
}

.minimap-point.is-active {
  width: 17px;
  height: 17px;
  background: var(--warm);
}

.minimap-point.is-active::after {
  content: "";
  position: absolute;
  inset: -5px;
  border: 2px solid rgba(196, 144, 99, 0.58);
  border-radius: 50%;
}

.minimap-back {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  margin-top: 10px;
  border-radius: 999px;
  color: #fff;
  background: rgba(23, 63, 70, 0.9);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
  font-size: 13px;
  font-weight: 780;
  text-decoration: none;
}

.minimap-back:hover,
.minimap-back:focus-visible {
  background: rgba(196, 144, 99, 0.94);
}

.minimap-edit-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
  margin-top: 10px;
}

.minimap-edit-actions button {
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  color: var(--accent-strong);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
  font-size: 12px;
  font-weight: 780;
}

.minimap-edit-actions button:hover,
.minimap-edit-actions button:focus-visible {
  background: #fff;
}

.is-editing-minimap .minimap-stage {
  outline: 2px solid rgba(196, 144, 99, 0.9);
  outline-offset: 3px;
}

.is-editing-minimap .minimap-point {
  cursor: grab;
}

.is-editing-minimap .minimap-point:active {
  cursor: grabbing;
}

.aim-crosshair {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 5;
  width: 34px;
  height: 34px;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.aim-crosshair::before,
.aim-crosshair::after {
  content: "";
  position: absolute;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.45);
}

.aim-crosshair::before {
  left: 50%;
  top: 0;
  width: 2px;
  height: 100%;
  transform: translateX(-50%);
}

.aim-crosshair::after {
  left: 0;
  top: 50%;
  width: 100%;
  height: 2px;
  transform: translateY(-50%);
}

.debug-panel {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 7px 8px 7px 13px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  color: #fff;
  background: rgba(15, 17, 18, 0.78);
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.26);
}

.debug-panel span {
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  font-weight: 760;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.debug-panel strong {
  min-width: 142px;
  font-size: 13px;
  font-weight: 760;
}

.debug-panel button {
  min-height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  color: var(--accent-strong);
  background: #fff;
  font-size: 13px;
  font-weight: 760;
}

.pnlm-container {
  background: #151515;
}

.nav-hotspot-base {
  width: 42px !important;
  height: 42px !important;
  background-image: none !important;
  background: transparent !important;
}

.pnlm-hotspot.nav-hotspot-base {
  background-image: none !important;
}

.nav-hotspot-wrapper {
  width: 42px !important;
  height: 42px !important;
  overflow: visible !important;
  background-image: none !important;
  background: transparent !important;
}

.nav-hotspot {
  position: relative;
  display: block;
  width: 42px !important;
  height: 42px !important;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 50%;
  background: rgba(23, 63, 70, 0.72);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.28);
  transition:
    background 160ms ease,
    box-shadow 160ms ease;
}

.nav-hotspot::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(23, 63, 70, 0.78);
}

.nav-hotspot::after {
  content: "";
  position: absolute;
  left: 16px;
  top: 12px;
  width: 11px;
  height: 17px;
  background: #fff;
  clip-path: polygon(0 0, 100% 50%, 0 100%, 28% 50%);
}

.nav-hotspot-wrapper:hover .nav-hotspot,
.nav-hotspot-wrapper:focus-visible .nav-hotspot {
  background: rgba(196, 144, 99, 0.94);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.34);
}

.nav-hotspot-wrapper:hover .nav-hotspot::before,
.nav-hotspot-wrapper:focus-visible .nav-hotspot::before {
  background: rgba(196, 144, 99, 0.94);
}

.nav-hotspot-label {
  position: absolute;
  left: 50%;
  top: calc(100% + 8px);
  display: none;
  padding: 5px 8px;
  border-radius: 999px;
  color: #fff;
  background: rgba(15, 17, 18, 0.78);
  font-size: 12px;
  font-weight: 760;
  line-height: 1;
  white-space: nowrap;
  transform: translateX(-50%);
}

.nav-hotspot-wrapper:hover .nav-hotspot-label,
.nav-hotspot-wrapper:focus-visible .nav-hotspot-label {
  display: block;
}

.info-hotspot-base {
  width: auto !important;
  height: auto !important;
  background-image: none !important;
  background: transparent !important;
}

.pnlm-hotspot.info-hotspot-base {
  background-image: none !important;
}

.info-hotspot {
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  color: #fff;
  background: rgba(15, 17, 18, 0.68);
  backdrop-filter: blur(8px);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.34);
  font-size: 12px;
  font-weight: 850;
  line-height: 1;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.72);
  pointer-events: none;
  white-space: nowrap;
}

@media (max-width: 980px) {
  .map-shell,
  .apartment-grid {
    grid-template-columns: 1fr;
  }

  .room-list {
    position: static;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .tour-heading {
    align-items: start;
    flex-direction: column;
  }

  .tour-tabs {
    justify-content: flex-start;
  }
}

@media (max-width: 680px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .main-nav {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .main-nav a {
    flex: 0 0 auto;
  }

  .section {
    padding-inline: 14px;
  }

  .implantation-stage {
    min-height: auto;
  }

  .apartment-pin {
    min-width: 92px;
    min-height: 38px;
    font-size: 13px;
  }

  .floorplan-stage {
    overflow: visible;
  }

  .room-pin {
    min-width: 28px;
    width: 28px;
    height: 28px;
    padding: 0;
    font-size: 0;
  }

  .room-pin::before {
    content: "";
    display: block;
    width: 8px;
    height: 8px;
    margin: auto;
    border-radius: 50%;
    background: currentColor;
  }

  .room-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #panorama {
    min-height: 390px;
    height: 62vh;
  }

  .nav-hotspot,
  .nav-hotspot-wrapper {
    width: 36px !important;
    height: 36px !important;
  }

  .nav-hotspot-base {
    width: 36px !important;
    height: 36px !important;
  }

  .nav-hotspot::after {
    left: 14px;
    top: 10px;
    width: 10px;
    height: 15px;
  }

  .viewer-minimap {
    left: 10px;
    bottom: 64px;
    width: 138px;
  }

  .minimap-apartment-label {
    margin-bottom: 6px;
    font-size: 10px;
  }

  .minimap-point {
    width: 11px;
    height: 11px;
  }

  .minimap-point.is-active {
    width: 16px;
    height: 16px;
  }

  .minimap-back {
    min-height: 34px;
    margin-top: 8px;
    font-size: 12px;
  }

  .minimap-edit-actions {
    margin-top: 8px;
  }

  .debug-panel {
    right: 10px;
    bottom: 10px;
    max-width: calc(100% - 20px);
  }
}

/* ============================================================
   IMPLANTAÇÃO — mapa com os 15 apartamentos (bolinhas)
   ============================================================ */
.implant-map {
  position: relative;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.implant-map img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
}

.apt-dot {
  position: absolute;
  left: var(--x);
  top: var(--y);
  transform: translate(-50%, -50%);
  z-index: 2;
  display: grid;
  place-items: center;
  /* Proporcionais à largura da planta (3,4% dela), com piso para não sumir. */
  width: max(16px, 3.4cqw);
  height: max(16px, 3.4cqw);
  border-radius: 50%;
  border: max(1px, 0.2cqw) solid #fff;
  color: #fff;
  font-size: max(8px, 1.3cqw);
  font-weight: 780;
  text-decoration: none;
}
.apt-num { line-height: 1; }

.apt-dot.on {
  background: var(--accent);
  cursor: pointer;
  z-index: 4;
  box-shadow: 0 10px 26px rgba(23, 63, 70, 0.35);
  animation: aptPulse 2s infinite;
}
.apt-dot.on::after {
  content: "";
  position: absolute;
  inset: -6px;
  border: 2px solid rgba(49, 93, 100, 0.4);
  border-radius: 50%;
}
.apt-dot.on:hover {
  background: var(--warm);
  transform: translate(-50%, -50%) scale(1.1);
}
@keyframes aptPulse {
  0%   { box-shadow: 0 10px 26px rgba(23,63,70,0.35), 0 0 0 0 rgba(49,93,100,0.45); }
  70%  { box-shadow: 0 10px 26px rgba(23,63,70,0.35), 0 0 0 12px rgba(49,93,100,0); }
  100% { box-shadow: 0 10px 26px rgba(23,63,70,0.35), 0 0 0 0 rgba(49,93,100,0); }
}

.apt-dot.off {
  background: rgba(154, 160, 166, 0.9);
  border-color: rgba(255, 255, 255, 0.85);
  color: rgba(255, 255, 255, 0.95);
  cursor: not-allowed;
}

/* Barra de edição manual dos pontos (index.html) */
.implant-edit-actions {
  position: fixed;
  left: 14px;
  bottom: 14px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
}

.implant-edit-actions button {
  min-height: 32px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  color: var(--accent-strong);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
  font-size: 12px;
  font-weight: 780;
  cursor: pointer;
}

.implant-edit-actions button:hover,
.implant-edit-actions button:focus-visible {
  background: #fff;
}

.is-editing-implant .implant-map {
  outline: 2px solid rgba(196, 144, 99, 0.9);
  outline-offset: 3px;
}

.is-editing-implant .apt-dot {
  cursor: grab;
}

.is-editing-implant .apt-dot:active {
  cursor: grabbing;
}

/* No modo edição as bolinhas cinza também precisam receber o arraste */
.is-editing-implant .apt-dot.off {
  cursor: grab;
}

.is-editing-implant .apt-dot:hover .apt-tip {
  display: none;
}

.apt-tip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  display: none;
  padding: 5px 10px;
  border-radius: 999px;
  color: #fff;
  background: rgba(15, 17, 18, 0.9);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.apt-dot:hover .apt-tip { display: block; }

.map-legend {
  display: flex;
  justify-content: center;
  gap: 22px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 14px;
}
.map-legend span { display: inline-flex; align-items: center; gap: 8px; }
.dot-ex {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--line);
}
.dot-ex.on { background: var(--accent); }
.dot-ex.off { background: rgba(106, 111, 118, 0.92); }

/* O tamanho das bolinhas já é fluido via clamp/vmin, sem breakpoint fixo. */

/* Layout CLEAN: só imagem + bolinhas, fundo branco */
body.implant-clean {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  padding: 2.5vmin;
}
.implant-clean .implant-map {
  /* Largura explícita (imagem é 16:9) para poder virar container de consulta,
     assim as bolinhas escalam em cima do mapa, não da janela. */
  width: min(78vw, calc(78vh * 16 / 9));
  container-type: inline-size;
  display: inline-block;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  line-height: 0;
}
.implant-clean .implant-map img {
  width: 100%;
  height: auto;
  border-radius: 0;
}
