/* Feito em Portugal — tipos de letra do sistema (sem Google Fonts = sem envio de IP a terceiros). */
:root {
  --bg: #f7f4ee;
  --surface: #ffffff;
  --ink: #1c2230;
  --muted: #5d6475;
  --line: #e3ddd1;
  --azul: #1d4f91;
  --azul-soft: #e6edf7;
  --verde: #1f6b4a;
  --vermelho: #b8322a;
  --amarelo: #e0a526;
  --map-land: #fbf9f4;
  --map-other: #ece7dc;
  --map-line: #b9b1a1;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --r: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151c; --surface: #1a1f29; --ink: #e9e6df; --muted: #a3a9b6; --line: #2c3340;
    --azul: #7fa8e6; --azul-soft: #1f2b40; --verde: #6cc59a; --vermelho: #e2776f;
    --map-land: #222936; --map-other: #181c24; --map-line: #3a4252;
    color-scheme: dark;
  }
  .tiles { filter: invert(1) hue-rotate(180deg) brightness(.85) contrast(.9); }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 16px/1.5 var(--sans); }
a { color: var(--azul); }
button, input, select { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- cabeçalho com azulejo ---------- */
.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.top__inner { max-width: 1400px; margin: 0 auto; padding: 14px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.brand strong { display: block; font: 600 22px/1.1 var(--serif); letter-spacing: -.01em; }
.brand small { color: var(--muted); font-size: 13px; }
.brand__tile {
  width: 40px; height: 40px; border-radius: 6px; flex: none;
  background:
    radial-gradient(circle at 50% 50%, var(--surface) 0 18%, transparent 19%),
    radial-gradient(circle at 0 0, var(--azul) 0 34%, transparent 35%),
    radial-gradient(circle at 100% 0, var(--azul) 0 34%, transparent 35%),
    radial-gradient(circle at 0 100%, var(--azul) 0 34%, transparent 35%),
    radial-gradient(circle at 100% 100%, var(--azul) 0 34%, transparent 35%),
    var(--azul-soft);
  box-shadow: inset 0 0 0 2px var(--azul);
}
.top__nav { display: flex; align-items: center; gap: 18px; }
.top__nav > a:not(.btn) { color: var(--ink); text-decoration: none; }
.btn { display: inline-block; padding: 9px 16px; border-radius: 999px; text-decoration: none; font-weight: 600; font-size: 15px; white-space: nowrap; }
.btn--primary { background: var(--azul); color: var(--surface); }
.btn--primary:hover { filter: brightness(1.1); }

.langpick { position: relative; }
.langpick__btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 12px; font-size: 14px; cursor: pointer; }
.langpick__btn:hover, .langpick__btn[aria-expanded="true"] { border-color: var(--azul); }
.langpick__chev { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.flag { width: 20px; height: 14px; border-radius: 2px; object-fit: cover; box-shadow: 0 0 0 1px rgb(0 0 0 / .12); flex: none; }
.langpick__menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 1000; min-width: 160px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 6px; box-shadow: 0 12px 32px rgb(0 0 0 / .14); display: grid; }
.langpick__menu[hidden] { display: none; }
.langpick__menu a, .langpick__menu button { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; border: 0; background: none; font-size: 15px; color: var(--ink); text-decoration: none; text-align: left; cursor: pointer; }
.langpick__menu a:hover, .langpick__menu button:hover, .langpick__menu :focus-visible { background: var(--azul-soft); outline: none; }
.langpick__menu [aria-current="true"] { font-weight: 600; }
.preview { margin: 0; padding: 8px 16px; text-align: center; font-size: 14px; background: var(--amarelo); color: #1c2230; }

/* ---------- filtros ---------- */
.filters { max-width: 1400px; margin: 0 auto; padding: 18px 20px 10px; }
.filters__row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.search { flex: 1 1 320px; display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 0 16px; }
.search:focus-within { border-color: var(--azul); box-shadow: 0 0 0 3px var(--azul-soft); }
.search svg { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.search input { border: 0; outline: 0; background: none; padding: 11px 0; width: 100%; }
select { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 10px 14px; }
.toggle { display: flex; gap: 8px; align-items: center; font-size: 15px; color: var(--muted); padding: 0 6px; }
.toggle input { accent-color: var(--azul); width: 18px; height: 18px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 13px; cursor: pointer; font-size: 14px; display: inline-flex; gap: 6px; align-items: center; }
.chip i { font-style: normal; }
.chip span { color: var(--muted); font-size: 12px; }
.chip:hover { border-color: var(--azul); }
.chip[aria-pressed="true"] { background: var(--azul); border-color: var(--azul); color: var(--surface); }
.chip[aria-pressed="true"] span { color: inherit; opacity: .8; }

/* ---------- lista + mapa ---------- */
.viewtabs { display: none; }
.layout { max-width: 1400px; margin: 0 auto; padding: 8px 20px 24px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 20px; }
.results__count { color: var(--muted); margin: 0 0 10px; font-size: 14px; }
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); transition: border-color .15s, box-shadow .15s; }
.card:hover { border-color: var(--azul); box-shadow: 0 4px 18px rgb(29 79 145 / .08); }
.card__main { all: unset; cursor: pointer; display: flex; gap: 14px; padding: 14px 16px 6px; width: 100%; box-sizing: border-box; }
.card__main:focus-visible { outline: 2px solid var(--azul); outline-offset: -2px; border-radius: var(--r); }
.card__mono { flex: none; width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; font: 600 22px var(--serif); color: var(--azul); background: var(--azul-soft); }
.card__body { display: grid; gap: 2px; min-width: 0; }
.card__name { font: 600 18px/1.25 var(--serif); }
.card__meta { color: var(--muted); font-size: 13px; }
.card__desc { font-size: 15px; margin-top: 2px; }
.card__links { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; padding: 4px 16px 12px 74px; font-size: 14px; }
.card__links a { font-weight: 600; text-decoration: none; }
.card__links a:hover { text-decoration: underline; }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--azul-soft); color: var(--azul); font-style: normal; font-weight: 500; }
.tag--visit { background: color-mix(in srgb, var(--verde) 14%, transparent); color: var(--verde); }
.tag--sample { background: color-mix(in srgb, var(--amarelo) 22%, transparent); color: var(--ink); font-family: var(--sans); vertical-align: middle; }
.tag--check { background: color-mix(in srgb, var(--amarelo) 22%, transparent); color: var(--ink); font-family: var(--sans); vertical-align: middle; }
.tag--new { background: var(--vermelho); color: var(--surface); }
.favbtn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 9px 14px; cursor: pointer; font-size: 15px; }
.favbtn svg, .fav svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.favbtn:hover { border-color: var(--vermelho); }
.favbtn[aria-pressed="true"] { background: var(--vermelho); border-color: var(--vermelho); color: var(--surface); }
.favbtn__n:empty { display: none; }
.favbtn__n { font-size: 12px; opacity: .8; }
.card { position: relative; }
.fav { position: absolute; top: 10px; right: 10px; z-index: 1; width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; }
.fav:hover { background: var(--azul-soft); color: var(--vermelho); }
.fav[aria-pressed="true"] { color: var(--vermelho); }
.fav[aria-pressed="true"] svg { fill: currentColor; }
.detail__fav { position: absolute; top: 14px; right: 58px; }
.detail__fav .fav { position: static; }
.card__main { padding-right: 48px; }
.tag--made { font-family: var(--sans); vertical-align: middle; }
.tag--own { background: color-mix(in srgb, var(--verde) 14%, transparent); color: var(--verde); }
.tag--partner { background: var(--azul-soft); color: var(--azul); }
.empty { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r); padding: 24px; text-align: center; }

.mapwrap { position: sticky; top: 16px; height: calc(100vh - 32px); max-height: 820px; border-radius: var(--r); overflow: hidden; border: 1px solid var(--line); }
#map { position: absolute; inset: 0; background: var(--map-other); }
.land { stroke: var(--map-line); }
.land--PT { fill: var(--map-land); }
.land--ES { fill: var(--map-other); }
.pin { fill: var(--azul); stroke: var(--surface); fill-opacity: .9; cursor: pointer; transition: r .15s; }
.pin--approx { fill-opacity: .45; stroke-dasharray: 3 2; }
.pin--hot { fill: var(--vermelho); fill-opacity: 1; }
.regions { position: absolute; z-index: 500; top: 10px; right: 10px; display: flex; gap: 0; background: var(--surface); border-radius: 999px; border: 1px solid var(--line); overflow: hidden; }
.regions button { border: 0; background: none; padding: 6px 12px; font-size: 13px; cursor: pointer; }
.regions button + button { border-left: 1px solid var(--line); }
.regions button:hover { background: var(--azul-soft); }
.leaflet-tooltip { font: 13px/1.35 var(--sans); }

/* ---------- ficha ---------- */
dialog { border: 0; padding: 0; border-radius: 16px; width: min(560px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px rgb(0 0 0 / .25); }
dialog::backdrop { background: rgb(18 21 28 / .5); }
.detail { padding: 28px; position: relative; }
.detail h2 { font: 600 30px/1.15 var(--serif); margin: 6px 0 4px; }
.detail h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 22px 0 8px; }
.detail__close { position: absolute; top: 14px; right: 14px; border: 0; background: var(--azul-soft); width: 34px; height: 34px; border-radius: 50%; font-size: 22px; line-height: 1; cursor: pointer; }
.detail__cats { margin: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.detail__cats a { font-size: 13px; text-decoration: none; background: var(--azul-soft); padding: 3px 10px; border-radius: 999px; }
.detail__made { color: var(--muted); margin: 0 0 8px; }
.detail__prod { display: inline-block; margin: 0 0 12px; font-size: 14px; font-weight: 600; padding: 4px 12px; border-radius: 999px; background: color-mix(in srgb, var(--verde) 14%, transparent); color: var(--verde); }
.detail__prod--partner { background: var(--azul-soft); color: var(--azul); }
.kv, .locs { list-style: none; margin: 0; padding: 0; }
.kv li { display: flex; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.kv li span { width: 100px; flex: none; color: var(--muted); font-size: 14px; }
.kv li .kv__v { width: auto; flex: 1; color: inherit; font-size: inherit; }
.kv a[href^="tel:"] { white-space: nowrap; }
.locs li { display: grid; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; font-size: 15px; }
.locs li span { color: var(--muted); }
.locs li small { color: var(--muted); font-size: 13px; }
.detail__note { background: color-mix(in srgb, var(--amarelo) 16%, transparent); border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.locs a { font-size: 14px; }
.detail__foot { margin: 22px 0 0; font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 10px; }

/* ---------- rodapé ---------- */
.foot { border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; padding: 20px; text-align: center; }
.foot p { max-width: 760px; margin: 6px auto; }

/* ---------- página sobre ---------- */
.prose { max-width: 760px; margin: 0 auto; padding: 32px 20px 48px; }
.prose h1 { font: 600 38px/1.1 var(--serif); margin: 0 0 12px; }
.prose h2 { font: 600 24px/1.2 var(--serif); margin: 36px 0 8px; }
.prose li { margin: 4px 0; }
.prose .lead { font-size: 19px; color: var(--muted); }
.steps { counter-reset: s; list-style: none; padding: 0; display: grid; gap: 10px; }
.steps li { counter-increment: s; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px 14px 56px; position: relative; }
.steps li::before { content: counter(s); position: absolute; left: 16px; top: 13px; width: 26px; height: 26px; border-radius: 50%; background: var(--azul); color: var(--surface); display: grid; place-items: center; font-weight: 700; font-size: 14px; }

/* ---------- telemóvel ---------- */
@media (max-width: 860px) {
  .top__inner { padding: 12px 16px; }
  .brand small, .top__nav > a:not(.btn) { display: none; }
  .top__nav { gap: 8px; }
  .langpick__btn { padding: 9px 10px; gap: 6px; }
  .langpick__name { display: none; }  /* no telemóvel: só a bandeira; o menu mostra o nome completo */
  .btn { padding: 8px 12px; font-size: 14px; }
  .brand strong { font-size: 19px; }
  .filters { padding: 12px 16px 4px; }
  .filters__row select { flex: 1 1 40%; min-width: 0; }
  .chips { flex-wrap: nowrap; overflow-x: auto; margin: 12px -16px 0; padding: 0 16px 4px; scrollbar-width: none; }
  .chip { flex: none; }
  .viewtabs { display: flex; margin: 8px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
  .viewtabs button { flex: 1; border: 0; background: none; padding: 7px; border-radius: 999px; cursor: pointer; font-weight: 600; }
  .viewtabs [aria-selected="true"] { background: var(--azul); color: var(--surface); }
  .layout { display: block; padding: 4px 16px 16px; }
  .layout[data-view="list"] .mapwrap, .layout[data-view="map"] .results { display: none; }
  .mapwrap { position: relative; top: 0; height: calc(100vh - 230px); min-height: 380px; }
  .card__links { padding-left: 16px; }
  .detail { padding: 22px 20px; }
  .detail h2 { font-size: 26px; }
}
