:root {
  --ink: #10364b;
  --muted: #486476;
  --paper: #f1faff;
  --panel: #ffffff;
  --brand-blue: #00abe4;
  --teal: #00658a;
  --teal-dark: #003e59;
  --mint: #bceeff;
  --lime: #00abe4;
  --coral: #ef6b52;
  --amber: #e9a53a;
  --line: #c8e2ef;
  --shadow: 0 24px 70px rgba(0, 75, 110, 0.14);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: 16px; top: -60px; z-index: 9999; padding: 12px 16px; color: #fff; background: var(--teal-dark); border-radius: 8px; }
.skip-link:focus { top: 12px; }

.topbar { min-height: 78px; padding: 14px clamp(20px, 4vw, 70px); display: flex; align-items: center; justify-content: space-between; background: rgba(245,247,243,.94); border-bottom: 1px solid var(--line); position: relative; z-index: 20; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; color: var(--teal); border: 1px solid #bfd2ca; border-radius: 50%; }
.brand-mark svg { width: 30px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.brand strong { display: block; font-family: Georgia, serif; font-size: 19px; line-height: .95; letter-spacing: -.02em; }
.brand small { display: block; margin-top: 4px; color: var(--teal); font-size: 11px; font-weight: 800; letter-spacing: .21em; }
.privacy-pill { display: inline-flex; align-items: center; gap: 8px; padding: 9px 13px; color: #33504a; background: #e9f2ed; border: 1px solid #d4e4dc; border-radius: 999px; font-size: 12px; font-weight: 700; }
.privacy-pill span { color: #2e9b70; font-size: 10px; }

.hero { padding: clamp(54px, 8vw, 116px) clamp(20px, 7vw, 110px) clamp(58px, 8vw, 106px); display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(250px, .65fr); align-items: end; gap: 72px; background: radial-gradient(circle at 92% 0%, #def3e7 0, transparent 32%), var(--paper); }
.eyebrow { margin: 0 0 14px; color: var(--teal); font-size: 11px; font-weight: 850; letter-spacing: .19em; }
h1, h2 { font-family: Georgia, "Times New Roman", serif; font-weight: 500; letter-spacing: -.04em; }
h1 { max-width: 870px; margin: 0; font-size: clamp(48px, 7vw, 94px); line-height: .94; }
h1 em { color: var(--teal); font-weight: 500; }
.hero-copy { max-width: 660px; margin: 30px 0 0; color: var(--muted); font-size: clamp(17px, 1.6vw, 21px); line-height: 1.65; }
.hero-metrics { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); box-shadow: 0 14px 35px rgba(20,55,48,.07); }
.hero-metrics div { display: flex; align-items: baseline; justify-content: space-between; gap: 15px; padding: 20px 22px; background: rgba(255,255,255,.72); }
.hero-metrics strong { color: var(--teal); font-family: Georgia, serif; font-size: 31px; font-weight: 500; }
.hero-metrics span { max-width: 140px; color: var(--muted); font-size: 12px; line-height: 1.3; text-align: right; }

.explorer { padding: 70px clamp(18px, 4vw, 64px) 78px; background: #e8eee9; border-top: 1px solid #d4ded7; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; max-width: 1440px; margin: 0 auto 28px; }
h2 { margin: 0; font-size: clamp(37px, 4.2vw, 58px); line-height: 1; }
.result-count { margin: 0; color: var(--teal); font-size: 13px; font-weight: 800; }
.filters { max-width: 1440px; margin: 0 auto 16px; display: grid; grid-template-columns: 1.35fr repeat(2, minmax(155px, .7fr)) auto; gap: 8px; }
.filters label { min-width: 0; padding: 7px 12px; display: flex; flex-direction: column; justify-content: center; background: rgba(255,255,255,.88); border: 1px solid #d4dfd7; border-radius: 10px; }
.filters label > span { margin-bottom: 2px; color: #73817e; font-size: 9px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.filters select, .filters input { min-width: 0; width: 100%; padding: 4px 24px 4px 0; color: var(--ink); background: transparent; border: 0; outline: 0; font-size: 13px; font-weight: 650; }
.local-field select { cursor: pointer; font-size: 16px; }
.local-field:focus-within { outline: 2px solid var(--ink); outline-offset: 2px; }
.reset-button { padding: 0 18px; color: var(--teal); background: transparent; border: 1px solid #b8cbc2; border-radius: 10px; font-size: 12px; font-weight: 800; }
.reset-button:hover, .reset-button:focus-visible { background: #fff; }

.map-shell { position: relative; max-width: 1440px; height: min(70vh, 720px); min-height: 590px; margin: 0 auto; overflow: hidden; background: #cddbd3; border: 1px solid #c4d0c8; border-radius: 16px; box-shadow: var(--shadow); }
#map { width: 100%; height: 100%; background: #dfe8e1; }
.leaflet-container { font-family: inherit; }
@media (any-pointer: coarse) {
  #map, #map .leaflet-marker-icon, #map .leaflet-image-layer {
    touch-action: pan-y pinch-zoom !important;
  }
}
.leaflet-control-zoom { border: 0 !important; box-shadow: 0 7px 25px rgba(0,0,0,.13) !important; }
.leaflet-control-zoom a { color: var(--ink) !important; border-bottom-color: var(--line) !important; }
.leaflet-control-attribution { background: rgba(255,255,255,.84) !important; font-size: 9px !important; }
.custom-marker { background: transparent; border: 0; }
.plan-marker { width:35px; height:35px; display:grid; place-items:center; border:2px solid white; border-radius:50%; background:#bd3229; color:#fff; font-size:13px; font-weight:800; box-shadow:0 1px 5px #0005; }
.plan-marker.active { background:#075e58; outline:4px solid #d8f06b; }
.marker-pin { width: 35px; height: 35px; display: grid; place-items: center; color: #fff; background: var(--teal); border: 3px solid rgba(255,255,255,.92); border-radius: 50% 50% 50% 8px; box-shadow: 0 5px 13px rgba(6,48,42,.28); transform: rotate(-45deg); font-size: 11px; font-weight: 900; }
.marker-pin span { transform: rotate(45deg); }
.marker-pin.critical { background: var(--coral); }
.marker-pin.high { background: var(--amber); }
.marker-pin.active { outline: 4px solid rgba(216,240,107,.65); transform: rotate(-45deg) scale(1.12); }
.detail-panel { position: absolute; top: 14px; right: 14px; bottom: 14px; z-index: 500; width: min(390px, calc(100% - 28px)); overflow: auto; background: rgba(255,255,255,.97); border: 1px solid rgba(255,255,255,.9); border-radius: 12px; box-shadow: 0 20px 55px rgba(9,43,37,.2); }
.panel-empty { min-height: 100%; padding: 40px; display: flex; flex-direction: column; justify-content: center; }
.empty-marker, .point-number { width: 48px; height: 48px; display: grid; place-items: center; color: var(--teal); background: #e6f4ed; border-radius: 50%; font-weight: 850; }
.panel-empty h3 { margin: 22px 0 8px; font-family: Georgia, serif; font-size: 26px; font-weight: 500; }
.panel-empty p { margin: 0; color: var(--muted); line-height: 1.6; }
.panel-body { padding: 26px; }
.panel-top { display: flex; align-items: center; justify-content: space-between; }
.close-panel { width: 38px; height: 38px; color: #65736f; background: #f2f5f2; border: 0; border-radius: 50%; font-size: 21px; }
.status-row { margin: 20px 0 10px; display: flex; gap: 7px; flex-wrap: wrap; }
.tag { display: inline-flex; padding: 6px 9px; border-radius: 999px; font-size: 10px; font-weight: 850; letter-spacing: .04em; text-transform: uppercase; }
.tag.critical { color: #8d2f20; background: #fee3dd; }
.tag.high { color: #7c4e05; background: #fff0ce; }
.tag.area { color: #35524c; background: #e8efeb; }
.panel-body h3 { margin: 0 0 8px; font-family: Georgia, serif; font-size: 31px; font-weight: 500; line-height: 1.07; letter-spacing: -.025em; }
.location { margin: 0 0 24px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.detail-block { padding: 17px 0; border-top: 1px solid var(--line); }
.detail-block h4 { margin: 0 0 9px; color: #71807c; font-size: 10px; letter-spacing: .13em; text-transform: uppercase; }
.detail-block p { margin: 0; font-size: 14px; line-height: 1.55; }
.time-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.time-card { padding: 12px; background: #f2f6f3; border-radius: 8px; }
.time-card span { display: block; color: #71807c; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.time-card strong { display: block; margin-top: 4px; font-size: 13px; }
.measure-list { margin: 0; padding: 0; list-style: none; }
.measure-list li { position: relative; padding: 0 0 9px 18px; font-size: 13px; line-height: 1.45; }
.measure-list li::before { content: ""; position: absolute; left: 1px; top: 7px; width: 7px; height: 7px; background: var(--lime); border: 2px solid var(--teal); border-radius: 50%; }
.mobile-list { display: none; }

.priorities { padding: 86px clamp(20px, 7vw, 110px) 42px; color: #f1f7f3; background: var(--teal-dark); }
.section-heading.light { align-items: end; }
.section-heading.light .eyebrow { color: var(--mint); }
.section-heading.light > p { max-width: 440px; margin: 0; color: #a9c2bb; line-height: 1.55; }
.priority-grid { max-width: 1440px; margin: 50px auto 70px; display: grid; grid-template-columns: repeat(3,1fr); border-top: 1px solid rgba(255,255,255,.17); border-bottom: 1px solid rgba(255,255,255,.17); }
.priority-grid article { min-height: 240px; padding: 34px 34px 38px; border-right: 1px solid rgba(255,255,255,.17); }
.priority-grid article:last-child { border-right: 0; }
.priority-grid span { color: var(--lime); font-size: 11px; font-weight: 900; }
.priority-grid h3 { margin: 55px 0 12px; font-family: Georgia, serif; font-size: 26px; font-weight: 500; }
.priority-grid p { margin: 0; color: #a9c2bb; line-height: 1.6; }
.source-note { max-width: 1440px; margin: 0 auto; color: #83a39b; font-size: 11px; line-height: 1.5; }

/* Digital blue sampled from the logo published on iniciativaliberal.pt.
   Darker text and pale surfaces preserve readable contrast. */
.topbar { background: #fff; border-top: 5px solid var(--brand-blue); }
.brand-mark { border-color: #a4ddef; }
.hero { background: linear-gradient(115deg, #dcf5ff 0%, #a6e4f8 60%, #00abe4 100%); }
h1, h2, h3 { color: var(--teal-dark); }
.hero-metrics { border-color: #8acfe7; background: #8acfe7; box-shadow: none; }
.explorer { background: #e6f5fc; border-color: var(--line); }
.filters label, .reset-button { border-color: #add5e7; }
.filters label > span { color: #486476; }
.map-shell, #map { background: #dcecf5; border-color: #add5e7; }
.plan-marker.active { background: var(--teal-dark); outline-color: var(--brand-blue); }
.empty-marker, .point-number { color: var(--teal); background: #e1f4fc; }
.close-panel { color: var(--teal-dark); background: #e7f4fb; }
.tag.area { color: #225a73; background: #e1f1fb; }
.detail-block h4, .time-card span { color: #486476; }
.time-card { background: #edf7fc; }
.priorities { color: #fff; background: var(--teal-dark); }
.priorities h2, .priorities h3 { color: #fff; }
.section-heading.light > p, .priority-grid p, .source-note { color: #c7e7f5; }
.priority-grid span { color: #8bdfff; }
.priority-grid, .priority-grid article { border-color: #39718c; }

@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; gap: 46px; }
  .hero-metrics { grid-template-columns: repeat(3,1fr); }
  .hero-metrics div { min-width: 0; flex-direction: column; align-items: flex-start; }
  .hero-metrics span { text-align: left; }
  .filters { grid-template-columns: 1fr 1fr; }
  .local-field { grid-column: 1 / -1; }
  .reset-button { min-height: 52px; grid-column: 1 / -1; }
  .priority-grid { grid-template-columns: 1fr; }
  .priority-grid article { min-height: auto; border-right: 0; border-bottom: 1px solid rgba(255,255,255,.17); }
  .priority-grid article:last-child { border-bottom: 0; }
  .priority-grid h3 { margin-top: 28px; }
}

@media (max-width: 700px) {
  .topbar { min-height: 66px; }
  .privacy-pill { padding: 8px 10px; font-size: 10px; }
  .brand-mark { width: 36px; height: 36px; }
  .brand strong { font-size: 16px; }
  .hero { padding-top: 58px; }
  h1 { font-size: clamp(46px, 14vw, 68px); }
  .hero-metrics { grid-template-columns: 1fr; }
  .hero-metrics div { flex-direction: row; align-items: baseline; }
  .hero-metrics span { text-align: right; }
  .explorer { padding-top: 52px; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 12px; }
  .filters { grid-template-columns: 1fr 1fr; }
  .map-shell { height: 62vh; min-height: 480px; }
  .detail-panel { top: auto; height: min(68%, 460px); }
  .panel-empty { display: none; }
  .mobile-list { margin-top: 14px; display: grid; gap: 8px; }
  .point-card { width: 100%; padding: 14px; display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 11px; color: var(--ink); text-align: left; background: rgba(255,255,255,.83); border: 1px solid #d4dfd7; border-radius: 10px; }
  .point-card .card-number { width: 34px; height: 34px; display: grid; place-items: center; color: #fff; background: var(--teal); border-radius: 50%; font-size: 10px; font-weight: 850; }
  .point-card .card-number.critical { background: var(--coral); }
  .point-card .card-number.high { background: var(--amber); }
  .point-card strong { font-size: 13px; }
  .point-card small { display: block; margin-top: 3px; color: var(--muted); }
  .point-card .arrow { color: var(--teal); font-size: 20px; }
  .priorities { padding-top: 68px; }
  .section-heading.light > p { font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

.topbar nav{font-size:1rem}.topbar nav a{color:inherit;text-decoration:none}.topbar nav a:hover{text-decoration:underline}.studies{padding:2rem;background:#edf3f5;border-left:5px solid #0d6779;margin:1rem 0 3rem;border-radius:0 12px 12px 0}.studies h2{font-size:2rem;margin:.5rem 0}.studies p{line-height:1.6}.study-button{display:inline-block;padding:.85rem 1.2rem;background:#123f4c;color:white;text-decoration:none;border-radius:7px;font-weight:600}.study-meta{font-size:.9rem;color:#45616c}@media(max-width:600px){.topbar{flex-wrap:wrap;gap:1rem}.studies{padding:1.25rem}}

/* Point details occupy their own space; closing removes the entire panel. */
[hidden] { display: none !important; }
.point-workspace { max-width: 1440px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(280px, 1fr); gap: 20px; align-items: start; }
.point-workspace .map-shell { width: 100%; height: 620px; min-height: 0; margin: 0; }
.point-navigation { min-width: 0; height: 620px; display: flex; flex-direction: column; padding: 16px; background: #edf3ef; border: 1px solid #c6d5cd; border-radius: 16px; }
.point-navigation .mobile-list { overflow-y: auto; min-height: 0; padding: 3px; scrollbar-gutter: stable; }
.point-navigation h3 { margin: 0 0 12px; font-size: 1.15rem; }
.detail-panel { position: static; grid-column: 1 / -1; width: 100%; height: auto; max-height: none; overflow: visible; min-width: 0; z-index: auto; box-shadow: none; border: 1px solid #c6d5cd; }
.detail-panel .panel-body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 28px; }
.panel-body > .panel-top, .panel-body > .status-row, .panel-body > h3, .panel-body > .location { grid-column: 1 / -1; }
.mobile-list { display: grid; gap: 8px; margin: 0; }
.point-card { width: 100%; min-height: 56px; padding: 14px; display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 11px; color: var(--ink); text-align: left; background: #fff; border: 1px solid #c6d5cd; border-radius: 10px; }
.point-card .card-number { width: 34px; height: 34px; display: grid; place-items: center; color: #fff; background: var(--teal); border-radius: 50%; font-size: 14px; font-weight: 800; }
.point-card .card-number.critical { background: #a93e2b; }
.point-card .card-number.high { background: #95600a; }
.point-card strong { font-size: 16px; }
.point-card small { display: block; margin-top: 3px; color: var(--muted); font-size: 14px; }
.point-card .arrow { color: var(--teal); font-size: 22px; }
.point-card[aria-pressed="true"] { border: 2px solid var(--teal); background: #e6f4ed; }
.point-navigation { background: #edf8ff; border-color: #add5e7; }
.point-card, .detail-panel { border-color: #add5e7; }
.point-card[aria-pressed="true"] { background: #d7f1fd; border-color: var(--teal); }
.studies { background: #e3f5ff; border-left-color: var(--brand-blue); }
.study-button { background: var(--teal); color: #fff; }
.study-button:hover { background: var(--teal-dark); }
.study-meta { color: var(--muted); }
.point-card:focus-visible, .close-panel:focus-visible { outline: 3px solid #95600a; outline-offset: 3px; }
.close-panel { width: 44px; height: 44px; }
.detail-block h4, .tag, .time-card span { font-size: 14px; }
.detail-block p, .location, .measure-list li, .time-card strong { font-size: 16px; }
@media(max-width:900px) {
 .point-workspace { grid-template-columns: minmax(0, 1fr); gap: 16px; }
 .point-workspace .map-shell { height: clamp(330px, 52vh, 500px); }
 .point-navigation { height: auto; }
 .point-navigation .mobile-list { overflow: visible; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
 .detail-panel { grid-row: 2; }
}
@media(max-width:600px) {
 .point-navigation .mobile-list, .detail-panel .panel-body { grid-template-columns: minmax(0, 1fr); }
 .panel-body { padding: 20px; }
}

/* Keep the legend readable without clipped rows or a nested scroll area. */
.point-navigation { height: auto; min-height: 620px; }
.point-navigation .mobile-list { display: grid; overflow: visible; flex: 1 0 auto; align-content: start; }
.point-card strong { display: block; color: #10364b; line-height: 1.4; overflow-wrap: anywhere; }
.point-card small { color: #486476; line-height: 1.4; }
.map-fallback { width: 100%; height: 100%; object-fit: contain; }
.map-notice { position: absolute; bottom: 0; padding: 10px; background: white; color: #10364b; }
@media(max-width:900px) { .point-navigation { min-height: 0; } }

#map { position:relative; display:flex; align-items:center; justify-content:center; overflow:hidden; touch-action:pan-y pinch-zoom; }
.plan-stage { position:relative; flex:none; width:min(100%,699px); aspect-ratio:853/756; transform-origin:center; }
.plan-stage > img { display:block; width:100%; height:auto; user-select:none; }
.plan-anchors { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; }
#map .map-point { position:absolute; transform:translate(-50%,-50%); width:32px; height:32px; min-height:0; padding:0; display:grid; place-items:center; border:2px solid white; border-radius:50%; background:#bc3025; color:white; font:700 12px Arial,sans-serif; cursor:pointer; touch-action:pan-y pinch-zoom; }
#map .map-point[aria-pressed="true"] { background:#003e59; outline:3px solid #00abe4; }
.plan-zoom { position:absolute; left:10px; bottom:10px; display:flex; gap:4px; }
.plan-zoom button { width:40px; height:40px; border:1px solid #486476; border-radius:5px; background:white; font-size:24px; color:#10364b; }
@media(max-width:900px) { .plan-stage { width:min(100%,calc(clamp(330px,52vh,500px)*853/756)); } }

/* Keep the right-hand legend aligned with the map, including filtered lists. */
.point-workspace .point-navigation { height:620px; min-height:0; overflow:hidden; }
.point-navigation .mobile-list { min-height:0; flex:1 1 auto; overflow-y:auto; grid-template-columns:1fr; grid-auto-rows:max-content; }
@media(max-width:900px) {
 .point-workspace { grid-template-columns:minmax(0,1.25fr) minmax(160px,1fr); gap:8px; }
 .point-workspace .point-navigation { height:clamp(330px,52vh,500px); padding:8px; }
 .point-card { grid-template-columns:26px minmax(0,1fr); padding:8px; gap:6px; }
 .point-card .arrow { display:none; }
 .point-card .card-number { width:26px;height:26px; }
 .point-card strong { font-size:14px; }
 .point-navigation h3 { font-size:14px; }
}
