/* Página do mapa: base, topo, palco, legenda, rodapé, avisos, embed e fallback (spec §6.7 e §6.8). */
@font-face{font-family:'Avenir';font-weight:400;font-style:normal;font-display:swap;src:url('/fonts/Avenir-400.woff2') format('woff2')}
@font-face{font-family:'Avenir';font-weight:700;font-style:normal;font-display:swap;src:url('/fonts/Avenir-700.woff2') format('woff2')}

:root {
  --laranja: #F39200;
  --dourado: #F0B400;
  --amarelo: #FFD500;
  --marrom: #6E3A22;
  /* Exceção à Pantone (decisão do Alexandre, 12/10/2026; spec §6.7): o verde-limão, cor funcional nomeada que só marca
     o lote disponível (camada e contorno, amostra da legenda, selo do card e a bolinha do "Só disponíveis"). */
  --verde-disponivel: #75C833;
  --tinta: #1A1A1A;
  --texto: #333333;
  --apagado: #5F5F5F;
  --linha: #E6E1D6;
  --areia: #F5EFE0;
  --sombra: 0 2px 10px rgba(30, 20, 10, .18);
  --fonte: "Avenir", "Avenir Next", system-ui, -apple-system, "Segoe UI", sans-serif;
  --alto-topo: 60px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #FFFFFF; color: var(--texto); font-family: var(--fonte); }
body { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }
a { color: var(--marrom); }
:focus-visible { outline: 3px solid var(--laranja); outline-offset: 2px; }
.vh { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* A tag RD do GTM ainda não exclui /mapa (spec §6.7; contratos/site.md §3.4). */
[id^="rd-floating_button"], .rdstation-popup-js-floating-button, .bricks--floating--button { display: none !important; }

/* Topo */
.topo { position: relative; z-index: 6; display: flex; align-items: center; gap: 12px; min-height: var(--alto-topo);
  padding: 6px max(16px, env(safe-area-inset-right)) 6px max(16px, env(safe-area-inset-left));
  background: #FFFFFF; border-bottom: 1px solid var(--linha); }
.topo-logo { display: flex; flex: none; align-items: center; min-height: 44px; }
.topo-logo img { display: block; height: 44px; width: auto; }
.busca { display: flex; flex: 1 1 auto; flex-direction: column; min-width: 0; max-width: 360px; margin-left: auto; }
.busca label { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--marrom); }
.busca-linha { display: flex; align-items: center; height: 44px; background: var(--areia);
  box-shadow: inset 0 0 0 1px var(--linha); border-radius: 10px; overflow: hidden; }
.busca-linha:focus-within { box-shadow: inset 0 0 0 1px var(--laranja), 0 0 0 3px rgba(243, 146, 0, .18); }
.busca input { flex: 1; min-width: 0; height: 100%; padding: 0 10px; font-size: 16px; background: transparent; border: 0; outline: 0; }
.busca input::-webkit-search-cancel-button { display: none; }
.busca-ir { display: grid; place-items: center; flex: none; width: 44px; height: 44px; padding: 0; background: none;
  border: 0; color: var(--marrom); cursor: pointer; }
.botao-filtro { display: inline-flex; flex: none; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px;
  font-size: 14px; font-weight: 700; color: var(--marrom); background: #FFFFFF; border: 2px solid var(--dourado);
  border-radius: 999px; cursor: pointer; }
/* O botão continua dourado (controle da marca); a bolinha verde-limão o liga à legenda (crítica D10). O anel de 1 px no
   verde-escuro do texto do selo: sem ele, a bolinha some no dourado do estado ligado (1,12 : 1 de luminância); com
   ele, 7,9 : 1 contra o dourado e 14,8 : 1 contra o branco. A sombra não ocupa espaço (o topo a 480 px não muda). */
.botao-filtro::before { content: ""; flex: none; width: 10px; height: 10px; background: var(--verde-disponivel);
  border-radius: 50%; box-shadow: 0 0 0 1px #182D02; }
.botao-filtro[aria-pressed="true"] { color: var(--marrom); background: var(--dourado); }
.botao-filtro:disabled { opacity: .45; cursor: not-allowed; }
html:not(.embed) .so-embed { display: none; }

.faixa { position: relative; z-index: 5; padding: 8px 16px; font-size: 14px; font-weight: 700; text-align: center;
  color: var(--tinta); background: var(--amarelo); }

/* Palco: o mapa e o que flutua sobre ele */
.palco { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; }
.mapa { position: absolute; inset: 0; background: #FFFFFF; }
.maplibregl-canvas:focus-visible { outline: 3px solid var(--laranja); outline-offset: -3px; }

.controles { position: absolute; top: 12px; right: 12px; z-index: 2; display: flex; flex-direction: column; gap: 8px; }
/* Desktop com o card aberto: os controles saem de trás do painel (360 px + 12 de margem + 24 de folga). */
@media (min-width: 768px) { body.com-painel .controles { right: 396px; } }

/* Antes dos lotes: aviso de carga; legenda e controles só aparecem com o mapa pronto. */
.carregando { position: absolute; top: 50%; left: 50%; z-index: 4; display: none; margin: 0; padding: 10px 16px;
  font-size: 15px; font-weight: 700; color: var(--marrom); background: rgba(255, 255, 255, .94); border-radius: 12px;
  box-shadow: var(--sombra); transform: translate(-50%, -50%); }
html:not([data-mapa="pronto"]):not([data-mapa="fallback"]) .carregando { display: block; }
html:not([data-mapa="pronto"]) .legenda, html:not([data-mapa="pronto"]) .controles { display: none; }
.botao-mapa, .botao-flutuante { display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 44px; min-height: 44px; padding: 0 14px; font-size: 14px; font-weight: 700; color: var(--marrom);
  text-decoration: none; background: #FFFFFF; border: 0; border-radius: 12px; box-shadow: var(--sombra); cursor: pointer; }

.legenda { position: absolute; left: 12px; bottom: 12px; z-index: 2; padding: 10px 12px; font-size: 13px;
  background: rgba(255, 255, 255, .94); border-radius: 12px; box-shadow: var(--sombra); }
.legenda-total { margin: 0 0 6px; font-weight: 700; color: var(--marrom); }
.legenda-total:empty { display: none; }
.legenda ul { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.legenda li { display: flex; align-items: center; gap: 8px; }
.amostra { display: inline-grid; place-items: center; flex: none; width: 18px; height: 14px; border-radius: 3px; }
/* Amostras com a cor já misturada sobre a grama da arte, medida no lote na vista inicial (spec §6.7). A da hachura é a
   medida no render aprovado (plano F, vista inicial do desktop, mediana dos 6 lotes "i" visíveis): fundo #7F8378 e
   listra #5C6256. */
.amostra-d { background: #76C039; box-shadow: inset 0 0 0 2px #C1E6A3; }
.amostra-v { background: #876036; }
.amostra-v img { display: block; width: 12px; height: 12px; }
.amostra-i { background: repeating-linear-gradient(45deg, #7F8378 0 3px, #5C6256 3px 5px); }

.dica { position: absolute; top: 12px; left: 50%; z-index: 4; width: max-content; max-width: calc(100% - 140px);
  margin: 0; padding: 10px 14px; font-size: 14px; color: #FFFFFF; text-align: center; background: rgba(46, 30, 18, .88);
  border-radius: 12px; transform: translateX(-50%); pointer-events: none; }

.mensagem { position: absolute; top: 12px; left: 50%; z-index: 4; display: flex; flex-wrap: wrap; align-items: center;
  gap: 8px 12px; width: min(440px, calc(100% - 24px)); padding: 12px 52px 12px 16px; font-size: 15px; background: #FFFFFF;
  border-left: 4px solid var(--laranja); border-radius: 12px; box-shadow: var(--sombra); transform: translateX(-50%); }
.mensagem p { margin: 0; flex: 1 1 220px; color: var(--tinta); }
.mensagem .botao-fechar { position: absolute; top: 2px; right: 2px; }

.tooltip { position: absolute; left: 0; top: 0; z-index: 5; padding: 6px 10px; font-size: 13px; font-weight: 700;
  color: #FFFFFF; white-space: nowrap; background: rgba(46, 30, 18, .92); border-radius: 8px; pointer-events: none; }

.rotulos { position: absolute; inset: 0; z-index: 1; overflow: hidden; pointer-events: none; }
.rotulo { position: absolute; left: 0; top: 0; padding: 2px 6px; font: 700 12px/1.2 var(--fonte); color: var(--marrom);
  white-space: nowrap; background: rgba(255, 255, 255, .86); border-radius: 4px; will-change: transform; }
.rotulo-marco { font-size: 13px; color: var(--tinta); background: rgba(255, 213, 0, .9); }
.rotulo.oculto { visibility: hidden; }

.aviso-contexto { position: absolute; inset: 0; z-index: 8; display: grid; place-content: center; gap: 12px;
  text-align: center; background: rgba(255, 255, 255, .92); }
.aviso-contexto p { margin: 0; font-size: 18px; font-weight: 700; color: var(--tinta); }

/* Fallback sem WebGL2 (spec §6.8) */
.fallback { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; gap: 12px; padding: 16px;
  overflow: auto; background: #FFFFFF; }
.fallback h2 { margin: 0; font-size: 20px; color: var(--marrom); }
.fallback-imagem { flex: none; overflow: auto; }
/* No desktop, a imagem inteira passaria da dobra: até 60% da altura, centrada, com "Tentar de novo" e o contato à vista. */
.fallback-imagem img { display: block; width: auto; max-width: 100%; height: auto; max-height: 60vh; margin: 0 auto;
  border-radius: 12px; }
.fallback-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
html[data-mapa="fallback"] .busca, html[data-mapa="fallback"] .botao-filtro, html[data-mapa="fallback"] #abrir-busca,
html[data-mapa="fallback"] .legenda, html[data-mapa="fallback"] .controles { display: none; }

/* Rodapé fixo, com os avisos expansíveis por cima do mapa */
.rodape { position: relative; z-index: 6; padding: 8px max(16px, env(safe-area-inset-right))
  calc(8px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); font-size: 12px; color: var(--texto);
  background: #FFFFFF; border-top: 1px solid var(--linha); }
.rodape-linha { margin: 0; line-height: 1.5; }
/* "ilustrativa · Avisos" não quebra: o "·" nunca começa a 2ª linha (a 375 px a linha não cabe). */
.rodape-fim { white-space: nowrap; }
.rodape-avisos { display: inline-flex; align-items: center; min-width: 44px; min-height: 44px; margin: -10px 0;
  padding: 0 8px; font-weight: 700; color: var(--marrom); text-decoration: underline; text-underline-offset: 3px;
  vertical-align: middle; background: none; border: 0; cursor: pointer; }
.avisos { position: absolute; left: 0; right: 0; bottom: 100%; max-height: 50vh; overflow: auto; padding: 12px 16px;
  background: #FFFFFF; border-top: 1px solid var(--linha); box-shadow: 0 -6px 16px rgba(30, 20, 10, .12); }
.avisos p { margin: 0; max-width: 72ch; padding-right: 40px; line-height: 1.5; }
.avisos .botao-fechar { position: absolute; top: 2px; right: max(4px, env(safe-area-inset-right)); }

@media (max-width: 767px) {
  :root { --alto-topo: 56px; }
  /* Com a bolinha do "Só disponíveis", o espaço sai das folgas: a 480 px, o campo da busca numa linha fica com 122 px
     (a verificação exige ≥ 120). */
  .topo { gap: 6px; }
  .topo-logo img { height: 32px; }
  .botao-filtro { gap: 5px; padding: 0 10px 0 8px; font-size: 13px; }
  .controles { top: auto; right: 8px; bottom: 8px; }
  .botao-mapa { padding: 0 10px; font-size: 13px; }
  .legenda { left: 8px; bottom: 8px; padding: 8px 10px; font-size: 12px; }
  .dica { top: 8px; left: 8px; right: 8px; width: auto; max-width: none; text-align: left; transform: none; }
  body.com-painel .legenda, body.com-painel .dica, body.com-painel .controles { display: none; }
  .rodape { font-size: 11px; }
}

/* Celular em retrato (≤ 479 px): o logo legível (146 px) e "Só disponíveis" na 1ª linha; a busca, com o rótulo
   visível à esquerda do campo, na 2ª. O Alexandre decidiu a 2ª linha para ≤ 360 px (09/10); com o logo legível, numa
   linha só a busca ficaria com 66 a 141 px de 375 a 414 px, então o corte vai até 479 px (de 480 a 767 px a busca
   tem 171 px ou mais numa linha). */
@media (max-width: 479px) {
  html:not(.embed) .topo { flex-wrap: wrap; row-gap: 8px; }
  html:not(.embed) .topo-logo { margin-right: auto; }
  html:not(.embed) .busca { order: 3; flex: 1 0 100%; flex-direction: row; align-items: center; gap: 10px;
    max-width: none; margin-left: 0; }
  html:not(.embed) .busca label { flex: none; }
  html:not(.embed) .busca-linha { flex: 1 1 auto; min-width: 0; }
}

/* Embed (?embed=1): sem topo; busca e filtro viram botões flutuantes, mais "Abrir em tela cheia" (spec §6.7).
   O app move o #topo para dentro do palco, abaixo da faixa. */
html.embed .topo { position: absolute; top: 0; left: 0; right: auto; z-index: 7; flex-wrap: wrap; align-items: flex-start;
  min-height: 0; max-width: calc(100% - 140px); padding: 8px; background: none; border: 0; }
html.embed .topo-logo { display: none; }
html.embed .so-embed { display: inline-flex; }
html.embed .busca { order: 9; flex: 1 0 100%; max-width: 320px; margin: 0; padding: 8px; background: #FFFFFF;
  border-radius: 12px; box-shadow: var(--sombra); }
html.embed .topo:not(.busca-aberta) .busca { display: none; }
html.embed .botao-filtro { border: 0; box-shadow: var(--sombra); }
html.embed .dica, html.embed .mensagem { top: 64px; }
@media (max-width: 767px) {
  html.embed .topo { max-width: 100%; }
  html.embed #tela-cheia { width: 44px; padding: 0; }
  html.embed #tela-cheia span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}
