/* Mafra Con'Junta · mapa do comércio local */
@font-face { font-family: "Raleway"; src: url("../fontes/raleway.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Fraunces"; src: url("../fontes/fraunces-800.woff2") format("woff2"); font-weight: 800; font-display: swap; }
@font-face { font-family: "Playfair J"; src: url("../fontes/playfair-900-J.woff2") format("woff2"); font-weight: 900; font-display: swap; }
@font-face { font-family: "Satisfy"; src: url("../fontes/satisfy.woff2") format("woff2"); font-display: swap; }

:root {
  --verde-escuro: #163626;
  --verde-junta: #597551;
  --verde: #7eb473;
  --verde-claro: #9ac158;
  --castanho: #5a4d43;
  --dourado: #e2b866;
  --dourado-escuro: #8a6420;   /* texto dourado sobre claro (contraste AA) */
  --creme: #f6f1e7;
  --texto: #22201d;
  --texto-suave: #5a4d43;
  --fundo: #fbf8f2;
  --linha: #e4dccd;
  --foco: #0b5cad;
  --raio: 14px;
  --topo: 64px;
  font-family: "Raleway", system-ui, sans-serif;
  color: var(--texto);
  background: var(--fundo);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { background: var(--fundo); font-size: 1rem; line-height: 1.45; }
a { color: var(--verde-junta); }
:focus-visible { outline: 3px solid var(--foco); outline-offset: 2px; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.saltar { position: absolute; left: 8px; top: -60px; z-index: 2000; background: var(--creme); color: var(--verde-escuro); padding: 10px 14px; border-radius: 8px; font-weight: 700; }
.saltar:focus { top: 8px; }

/* ---------- topo ---------- */
.topo {
  height: var(--topo); background: var(--verde-escuro); color: var(--creme);
  display: flex; align-items: center; gap: 12px; padding: 0 16px; padding-top: env(safe-area-inset-top);
  position: relative; z-index: 1000;
}
.topo-freguesia img { height: 50px; width: auto; display: block; }
.topo-marca img { height: 46px; width: auto; display: block; }
.topo-titulo a { color: inherit; }
.aviso-mapa { padding: 80px 20px; }
.topo-titulo {
  margin: 0 0 0 auto; font-weight: 600; font-size: .72rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--dourado); text-align: right; line-height: 1.2; max-width: 9em;
}

/* ---------- estrutura ---------- */
.pagina-mapa { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }
.principal { position: relative; flex: 1; min-height: 0; }
.mapa { position: absolute; inset: 0; background: #e9e5dc; }

/* painel (procura + legenda) por cima do mapa no telemóvel */
.painel { position: absolute; z-index: 900; left: 12px; right: 12px; top: 12px; pointer-events: none; }
.painel > * { pointer-events: auto; }
.procura { position: relative; }
.procura input {
  width: 100%; height: 48px; border-radius: 24px; border: 1px solid var(--linha); background: #fff;
  padding: 0 16px 0 44px; font: inherit; font-size: 1rem; color: var(--texto);
  box-shadow: 0 2px 10px rgba(22, 54, 38, .18);
}
.procura-lupa { position: absolute; left: 15px; top: 14px; width: 20px; height: 20px; fill: none; stroke: var(--verde-junta); stroke-width: 2.2; stroke-linecap: round; }
.resultados {
  list-style: none; margin: 6px 0 0; padding: 6px; background: #fff; border-radius: var(--raio);
  box-shadow: 0 6px 20px rgba(22, 54, 38, .2); max-height: 50vh; overflow: auto;
}
.resultados button { all: unset; box-sizing: border-box; display: block; width: 100%; padding: 10px 12px; border-radius: 10px; cursor: pointer; min-height: 44px; }
.resultados button:hover, .resultados button:focus-visible { background: var(--creme); outline: 3px solid var(--foco); outline-offset: -3px; }
.resultados .r-nome { font-weight: 700; display: block; }
.resultados .r-morada { font-size: .85rem; color: var(--texto-suave); }
.resultados .r-vazio { padding: 10px 12px; color: var(--texto-suave); }

.legenda {
  position: absolute; left: 12px; bottom: 30px; z-index: 900;
  background: rgba(255,255,255,.96); border-radius: var(--raio); padding: 10px 12px;
  box-shadow: 0 2px 10px rgba(22, 54, 38, .18); max-width: calc(100% - 76px);
}
.legenda { display: flex; align-items: center; gap: 10px; padding: 8px 10px; }
.legenda ul { list-style: none; margin: 0; padding: 0; font-size: .82rem; line-height: 1.2; }
.legenda li { display: flex; align-items: center; gap: 7px; min-height: 26px; }
.legenda .ponto-presepio { width: 24px; height: 24px; }
.legenda .ponto-sinos { width: 20px; height: 20px; margin: 0 2px; }
.legenda-botoes { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- botões ---------- */
.botao {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px;
  border-radius: 22px; white-space: nowrap; font: inherit; font-weight: 700; font-size: .95rem; cursor: pointer; text-decoration: none;
  border: 2px solid var(--verde-escuro); background: var(--verde-escuro); color: var(--creme);
}
.botao-linha { background: #fff; color: var(--verde-escuro); }
.botao-linha[aria-pressed="true"], .botao-linha[aria-expanded="true"] { background: var(--verde-escuro); color: var(--creme); }
.botao-fechar {
  position: absolute; right: 10px; top: 10px; width: 44px; height: 44px; border-radius: 22px; border: 0;
  background: var(--creme); color: var(--verde-escuro); font-size: 1.7rem; line-height: 1; cursor: pointer;
}

/* ---------- marcadores ---------- */
.ponto { display: inline-block; flex: none; }
.ponto-presepio, .mk-presepio { width: 30px; height: 30px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop offset='0' stop-color='%23fff1c6'/%3E%3Cstop offset='.5' stop-color='%23e2b866'/%3E%3Cstop offset='1' stop-color='%23a77a30'/%3E%3C/linearGradient%3E%3C/defs%3E%3Ccircle cx='15' cy='15' r='14' fill='%23163626' stroke='%23e2b866' stroke-width='2'/%3E%3Cpath d='M15 4Q16.6 13.4 26 15Q16.6 16.6 15 26Q13.4 16.6 4 15Q13.4 13.4 15 4Z' fill='url(%23g)'/%3E%3C/svg%3E") center/contain no-repeat; }
.ponto-sinos, .mk-sinos { width: 22px; height: 22px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 22'%3E%3Ccircle cx='11' cy='11' r='10' fill='%23597551' stroke='%23fff' stroke-width='2'/%3E%3Cpath d='M11 5.2c-2.3 0-3.6 1.8-3.6 4v2.6L6.2 14h9.6l-1.2-2.2V9.2c0-2.2-1.3-4-3.6-4z' fill='%23e2b866'/%3E%3Ccircle cx='11' cy='15.4' r='1.3' fill='%23e2b866'/%3E%3C/svg%3E") center/contain no-repeat; }
.ponto-outro, .mk-outro { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 3px solid var(--verde-junta); }
.mk { display: block; cursor: pointer; filter: drop-shadow(0 1px 2px rgba(0,0,0,.35)); border-radius: 50%; }
.mk:focus-visible { outline: 3px solid var(--foco); outline-offset: 2px; }
.mk-ativo { transform-origin: center; animation: realce .35s ease-out; }
.leaflet-marker-icon.selecionado { z-index: 10000 !important; }
.leaflet-marker-icon.selecionado .mk { outline: 3px solid var(--dourado); outline-offset: 2px; }
@keyframes realce { from { transform: scale(.6); } to { transform: scale(1); } }

/* ---------- cartão da loja ---------- */
.cartao {
  position: fixed; z-index: 1100; left: 0; right: 0; bottom: 0; max-height: 78dvh; overflow: auto;
  background: #fff; border-radius: 20px 20px 0 0; padding: 22px 20px calc(20px + env(safe-area-inset-bottom));
  box-shadow: 0 -6px 24px rgba(22, 54, 38, .25);
}
.cartao h2 { font-family: "Fraunces", Georgia, serif; font-weight: 800; font-size: 1.45rem; line-height: 1.15; margin: 0 52px 6px 0; color: var(--verde-escuro); }
.cartao .morada { margin: 0 0 4px; color: var(--texto-suave); }
.cartao .aprox { font-size: .82rem; color: var(--texto-suave); margin: 0 0 10px; }
.cartao .selos { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 6px; padding: 0; list-style: none; }
.cartao .selos img { height: 42px; width: auto; display: block; }
.cartao .papeis { margin: 0 0 14px; padding: 0; list-style: none; font-size: .95rem; }
.cartao .papeis li { display: flex; align-items: center; gap: 8px; min-height: 30px; }
.cartao .papeis .ponto-presepio { width: 22px; height: 22px; }
.cartao .papeis .ponto-sinos { width: 18px; height: 18px; }
.cartao .apresentacao { margin: 10px 0 4px; font-size: .97rem; color: var(--texto); }
.cartao .ligacoes { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; padding: 0; list-style: none; }
.cartao .ligacoes a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 20px; background: var(--creme); color: var(--verde-escuro); font-weight: 700; font-size: .9rem; text-decoration: none; }
.cartao .ligacoes a:hover { text-decoration: underline; }
.cartao .acoes { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.galeria { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; margin: 12px 0 0; padding: 0; list-style: none; }
.galeria img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 10px; display: block; background: var(--creme); }
.cartao video { width: 100%; max-height: 60dvh; border-radius: 12px; margin-top: 12px; background: #000; }

/* ---------- lista ---------- */
.lista {
  position: fixed; z-index: 1050; inset: var(--topo) 0 0 0; background: var(--fundo); overflow: auto; padding: 16px 16px 40px;
  display: none;
}
.lista.aberta { display: block; }
.lista-cabeca { position: relative; }
.lista h2 { font-family: "Fraunces", Georgia, serif; font-weight: 800; color: var(--verde-escuro); margin: 4px 56px 12px 0; font-size: 1.35rem; }
.lista ul { list-style: none; margin: 0; padding: 0; }
.lista li { border-bottom: 1px solid var(--linha); }
.lista li button { all: unset; box-sizing: border-box; display: flex; gap: 12px; align-items: center; width: 100%; padding: 12px 6px; cursor: pointer; min-height: 56px; }
.lista li button:focus-visible { outline: 3px solid var(--foco); outline-offset: -3px; }
.lista .l-nome { font-weight: 700; display: block; }
.lista .l-morada { font-size: .88rem; color: var(--texto-suave); }

/* ---------- rodapé ---------- */
.rodape {
  background: var(--verde-escuro); color: var(--creme); font-size: .8rem; padding: 8px 16px calc(8px + env(safe-area-inset-bottom));
  display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; justify-content: space-between;
}
.rodape a { color: var(--creme); }
.rodape nav { display: flex; gap: 16px; }
.rodape .assinatura { margin: 0; opacity: .85; }

/* atribuição do mapa sempre legível */
.leaflet-control-attribution { font-size: 11px; background: rgba(255,255,255,.9) !important; }
.leaflet-control-attribution a { color: #24561f; }
.leaflet-bottom.leaflet-right { margin-bottom: env(safe-area-inset-bottom); }
.leaflet-control-zoom a { width: 40px !important; height: 40px !important; line-height: 40px !important; font-size: 20px !important; }


/* ---------- computador ---------- */
@media (min-width: 900px) {
  :root { --topo: 76px; }
  .topo { padding: 0 24px; gap: 20px; }
  .topo-marca img { height: 58px; }
  .topo-freguesia img { height: 62px; }
  .topo-titulo a { color: inherit; }
.aviso-mapa { padding: 80px 20px; }
.topo-titulo { font-size: .85rem; max-width: none; }
  .painel { left: 16px; top: 16px; right: auto; width: 380px; }
  .legenda { position: absolute; left: 16px; bottom: 24px; }
  .cartao { left: auto; right: 16px; top: 16px; bottom: auto; width: 400px; max-height: calc(100% - 32px); border-radius: 20px; position: absolute; }
  .lista { position: absolute; inset: 0 auto 0 0; width: 420px; box-shadow: 6px 0 20px rgba(22,54,38,.15); padding-top: 84px; }
  .lista.aberta ~ .painel { z-index: 1060; }
}

/* ---------- páginas de texto (Sobre, Acessibilidade) ---------- */
.texto { max-width: 680px; margin: 0 auto; padding: 28px 16px 48px; }
.texto h1 { font-family: "Fraunces", Georgia, serif; font-weight: 800; color: var(--verde-escuro); font-size: 1.9rem; line-height: 1.15; }
.texto h2 { font-family: "Fraunces", Georgia, serif; font-weight: 800; color: var(--verde-escuro); font-size: 1.3rem; margin-top: 2em; }
.texto .lema { font-family: "Satisfy", cursive; color: var(--dourado-escuro); font-size: 1.6rem; margin: 0 0 1em; }
.texto h3 { font-family: "Fraunces", Georgia, serif; font-weight: 800; color: var(--verde-escuro); font-size: 1.1rem; margin: 1.4em 0 .4em; }
.texto ul { padding-left: 1.2em; display: grid; gap: .6em; }
.texto img.selo { height: 40px; width: auto; vertical-align: middle; }
.pagina-texto .rodape { display: flex; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- páginas das lojas e dos projetos (geradas por gerar_paginas.py) ---------- */
.migalhas { font-size: .85rem; color: var(--texto-suave); margin-bottom: 1.2em; }
.migalhas a { color: var(--verde-junta); }
.morada-loja { font-size: 1.1rem; color: var(--texto-suave); margin-top: -.4em; }
.papeis-loja, .lista-projeto, .galeria-loja, .ligacoes-loja { list-style: none; padding: 0; }
.papeis-loja li, .lista-projeto li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lista-projeto li { padding: 8px 0; border-bottom: 1px solid var(--linha); }
.lista-projeto a { font-weight: 700; }
.morada-curta { font-size: .88rem; color: var(--texto-suave); flex-basis: 100%; padding-left: 40px; margin-top: -4px; }
.galeria-loja { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.galeria-loja img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 10px; display: block; background: var(--creme); }
.video-loja { width: 100%; max-width: 420px; aspect-ratio: 9 / 16; border-radius: 14px; background: #000; display: block; margin: 1em 0; }
.ligacoes-loja { display: flex; flex-wrap: wrap; gap: 8px; }
.ligacoes-loja a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 22px; background: var(--creme); color: var(--verde-escuro); font-weight: 700; text-decoration: none; }
.acoes-loja { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 2em; }
.texto h2 a, .texto h3 a { color: inherit; }
/* lista da página inicial escrita no HTML (antes de o JavaScript a substituir) */
.lista li > a { display: flex; gap: 12px; align-items: center; padding: 12px 6px; min-height: 56px; color: inherit; text-decoration: none; }
.cartao .pagina-loja { margin: 14px 0 0; font-size: .9rem; }
.papeis-loja .ponto-presepio, .lista-projeto .ponto-presepio { width: 26px; height: 26px; }
.papeis-loja .ponto-sinos, .lista-projeto .ponto-sinos { width: 20px; height: 20px; margin: 0 3px; }
.morada-curta { padding-left: 36px; }
.texto h4 { font-family: "Raleway", sans-serif; font-weight: 700; color: var(--verde-escuro); font-size: 1rem; margin: 1.3em 0 .3em; }
/* confirmação pelos lojistas e página /lojas/ */
.confirmar-loja { margin: 2em 0 0; padding: 18px 18px 6px; border: 2px solid var(--dourado); border-radius: var(--raio); background: #fffaf0; }
.confirmar-loja h2 { margin-top: 0; font-size: 1.2rem; }
.procura-lojas { display: grid; gap: 6px; max-width: 420px; }
.procura-lojas label { font-weight: 700; }
.procura-lojas input { height: 48px; border-radius: 24px; border: 1px solid var(--linha); padding: 0 16px; font: inherit; }
.sem-resultados { color: var(--texto-suave); }
