@font-face { font-family: "Space Grotesk"; font-weight: 400; font-display: swap; src: url(../fonts/space-grotesk-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Space Grotesk"; font-weight: 500; font-display: swap; src: url(../fonts/space-grotesk-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Space Grotesk"; font-weight: 700; font-display: swap; src: url(../fonts/space-grotesk-latin-700-normal.woff2) format("woff2"); }

:root {
  --ink: #111111;
  --ink-2: #8e8e93;
  --line: #ececef;
  --green: #34c759;
  --red: #ff3b30;
  --orange: #ff9500;
  --blue: #0a84ff;
  --ad-bg: #1c1c1e;
  --ad-2: #2c2c2e;
  --r: 22px;
  --shadow: 0 4px 18px rgba(0, 0, 0, .14);
  --st: env(safe-area-inset-top, 0px);
  --sb: env(safe-area-inset-bottom, 0px);
  --sheet-peek: 188px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body { font-family: "Space Grotesk", system-ui, -apple-system, sans-serif; color: var(--ink); background: #eef0ea; overflow: hidden; overscroll-behavior: none; }
button { font: inherit; color: inherit; cursor: pointer; }
.muted { color: var(--ink-2); }
[hidden] { display: none !important; }
svg { width: 20px; height: 20px; flex: none; }

/* ─── Mappa ─── */
#map { position: fixed; inset: 0; }
.maplibregl-ctrl-attrib { font-size: 10px; }
.maplibregl-ctrl-bottom-right { bottom: calc(var(--sheet-peek) + var(--sb)); }

/* ─── Intestazione mobile: card flottante ─── */
.hdr {
  position: fixed; z-index: 20; top: calc(8px + var(--st)); left: 12px; right: 12px;
  background: rgba(255, 255, 255, .82); backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-radius: var(--r); padding: 12px 0 12px 12px; box-shadow: var(--shadow);
}
.logo { display: flex; align-items: center; gap: 12px; padding-right: 12px; }
.logo-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--ink); color: #fff; display: grid; place-items: center; }
.logo-mark svg { width: 22px; height: 22px; }
.logo-text { font-size: 24px; font-weight: 500; letter-spacing: -.01em; }
.logo-wordmark { display: none; }
.chips { display: flex; gap: 8px; margin-top: 12px; overflow-x: auto; scrollbar-width: none; padding-right: 12px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; flex: none;
  border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 999px; padding: 9px 16px 9px 13px; font-size: 16px;
}
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ─── Marker ─── */
.pin {
  display: flex; align-items: center; gap: 7px; padding: 4px 11px 4px 4px; border-radius: 999px;
  background: #fff; color: var(--ink); font-size: 16px; font-weight: 500; font-variant-numeric: tabular-nums;
  box-shadow: 0 2px 7px rgba(0, 0, 0, .22); position: relative; cursor: pointer; white-space: nowrap;
  margin-bottom: 7px;
}
.pin::after { content: ""; position: absolute; left: 50%; bottom: -6px; width: 12px; height: 12px; background: inherit; transform: translateX(-50%) rotate(45deg); border-radius: 2px; box-shadow: 3px 3px 5px rgba(0,0,0,.1); z-index: -1; }
.pin.low { background: var(--green); color: #fff; }
.pin.high { background: var(--red); color: #fff; }
.mk:hover { z-index: 5; }
.pin:hover { transform: scale(1.08); }
.badge {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex: none;
  font-size: 11px; font-weight: 700; letter-spacing: .02em; background: #1c1c1e; color: #fff; text-transform: uppercase;
}
.pin .badge { box-shadow: 0 0 0 1.5px #fff; }
.dot { width: 14px; height: 14px; border-radius: 50%; background: #9ca3af; border: 2.5px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.3); }
.me { width: 22px; height: 22px; border-radius: 50%; background: var(--blue); border: 3.5px solid #fff; box-shadow: 0 0 0 7px rgba(10,132,255,.18), 0 2px 6px rgba(0,0,0,.3); }

/* ─── Pulsante posizione ─── */
.locate {
  position: fixed; z-index: 15; right: 14px; bottom: calc(var(--sheet-peek) + 16px + var(--sb));
  width: 56px; height: 56px; border-radius: 50%; border: 0; background: #fff; box-shadow: var(--shadow); display: grid; place-items: center;
}
.locate svg { width: 26px; height: 26px; }

/* ─── Gate ─── */
.gate { position: fixed; inset: 0; z-index: 30; display: flex; align-items: flex-end; justify-content: center; padding-bottom: calc(56px + var(--sb)); cursor: pointer; background: linear-gradient(to top, rgba(0,0,0,.35), transparent 45%); }
.gate-btn { border: 0; background: var(--ink); color: #fff; font-size: 18px; font-weight: 500; padding: 18px 28px; border-radius: 999px; box-shadow: var(--shadow); animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.04); } }

/* ─── Elenco: bottom sheet ─── */
.sheet {
  position: fixed; z-index: 18; left: 0; right: 0; bottom: 0; height: calc(100vh - var(--hdr-b, 250px)); height: calc(100dvh - var(--hdr-b, 250px));
  background: #fff; border-radius: 24px 24px 0 0; box-shadow: 0 -4px 20px rgba(0,0,0,.12);
  transform: translateY(calc(100% - var(--sheet-peek) - var(--sb))); transition: transform .28s cubic-bezier(.2,.8,.2,1);
  display: flex; flex-direction: column; padding-bottom: var(--sb);
}
.sheet.open { transform: translateY(0); }
.sheet.dragging { transition: none; }
.sheet-grip { padding: 10px 0 4px; display: grid; place-items: center; cursor: grab; touch-action: none; }
.sheet-grip span { width: 40px; height: 5px; border-radius: 3px; background: #d1d1d6; }
.sheet-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 8px 24px 12px; font-size: 18px; white-space: nowrap; cursor: pointer; touch-action: none; }
.sheet-head strong { font-weight: 500; }
.sheet-head .muted { font-size: 14px; }
.list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; overscroll-behavior: contain; }
.row { display: flex; align-items: center; gap: 16px; padding: 14px 24px; border-top: 1px solid var(--line); cursor: pointer; }
.row:hover { background: #fafafa; }
.row .badge { width: 48px; height: 48px; border-radius: 12px; font-size: 16px; font-weight: 500; }
.row .who { flex: 1; min-width: 0; }
.row .who b { display: block; font-weight: 500; font-size: 19px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .who span { display: block; color: var(--ink-2); font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-transform: uppercase; }
.row .who span i { font-style: normal; text-transform: none; }
.price { min-width: 88px; text-align: center; border-radius: 14px; padding: 8px 10px 6px; border: 1.5px solid #d1d1d6; font-size: 20px; font-weight: 500; line-height: 1.05; font-variant-numeric: tabular-nums; }
.price small { display: block; font-size: 12px; font-weight: 400; }
.price.low { background: var(--green); border-color: var(--green); color: #fff; }
.price.high { background: var(--red); border-color: var(--red); color: #fff; }
.banner-slot { padding: 0 24px 12px; text-align: center; }
.banner-slot img { max-width: 100%; height: auto; }

.hint, .demo {
  position: fixed; z-index: 16; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 10px 16px; border-radius: 999px; font-size: 14px; box-shadow: var(--shadow); white-space: nowrap;
}
.hint { bottom: calc(var(--sheet-peek) + 20px + var(--sb)); }
.demo { top: calc(150px + var(--st)); background: #fde68a; color: #78350f; font-size: 12px; padding: 5px 12px; }

/* ─── Popup distributore ─── */
.maplibregl-map, .maplibregl-popup, .maplibregl-popup-content { font-family: "Space Grotesk", system-ui, sans-serif; }
.maplibregl-popup-content { border-radius: 16px; padding: 14px 16px; box-shadow: var(--shadow); font-family: inherit; min-width: 230px; }
.maplibregl-popup-close-button { font-size: 20px; padding: 2px 8px; }
.pop-top { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.pop-top .badge { width: 36px; height: 36px; border-radius: 10px; font-size: 13px; }
.pop-top b { display: block; font-size: 16px; font-weight: 700; }
.pop-top div span { display: block; font-size: 12px; color: var(--ink-2); }
.pop-prices { width: 100%; border-collapse: collapse; font-size: 14px; margin: 4px 0 10px; }
.pop-prices td { padding: 6px 0; border-top: 1px solid var(--line); }
.pop-prices td:last-child { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.pop-prices tr.sel td { color: var(--ink); }
.pop-prices tr:not(.sel) td { color: #555; font-weight: 400; }
.pop-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 11px; color: var(--ink-2); }
.pop-go { background: var(--ink); color: #fff; text-decoration: none; padding: 8px 12px; border-radius: 10px; font-weight: 700; font-size: 13px; white-space: nowrap; }

/* ─── Scheda distributore mobile ─── */
.detail { position: fixed; z-index: 25; left: 10px; right: 10px; bottom: calc(10px + var(--sb)); background: #fff; border-radius: 22px; box-shadow: 0 10px 40px rgba(0,0,0,.25); padding: 18px 18px 16px; }
.detail-close { position: absolute; top: 8px; right: 10px; border: 0; background: #f2f2f7; width: 32px; height: 32px; border-radius: 50%; font-size: 20px; line-height: 1; }
.detail .pop-top { padding-right: 36px; }
.detail .pop-top .badge { width: 44px; height: 44px; font-size: 15px; }
.detail .pop-top b { font-size: 19px; }
.detail .pop-top div span { font-size: 14px; }
.detail .pop-prices { font-size: 16px; }
.detail .pop-foot { font-size: 13px; }
.detail .pop-go { font-size: 15px; padding: 12px 16px; }

/* ─── Link legali ─── */
.legal-links { padding: 14px 24px calc(18px + var(--sb)); font-size: 12px; color: var(--ink-2); border-top: 1px solid var(--line); line-height: 1.8; }
.legal-links a, .linklike { color: var(--ink-2); }
.linklike { background: none; border: 0; padding: 0; font: inherit; text-decoration: underline; cursor: pointer; }
.legal-links span { display: block; }
.gate { flex-direction: column; align-items: center; gap: 14px; }
.gate-legal { font-size: 12px; background: rgba(255,255,255,.85); padding: 4px 10px; border-radius: 999px; }
.gate-legal a { color: var(--ink); }

/* ─── Preroll ─── */
.ad { position: fixed; inset: 0; z-index: 100; background: var(--ad-bg); display: flex; }
.ad-card { display: flex; flex-direction: column; width: 100%; height: 100%; }
.ad-media { position: relative; flex: 1 1 auto; min-height: 0; background: #000; }
.ad-media video { width: 100%; height: 100%; object-fit: cover; display: block; cursor: pointer; }
.ad-label { position: absolute; top: calc(12px + var(--st)); left: 16px; background: rgba(0,0,0,.72); color: #fff; font-size: 13px; letter-spacing: .14em; padding: 7px 14px; border-radius: 8px; }
.ad-link { position: absolute; right: 14px; bottom: 14px; background: rgba(255,255,255,.92); color: var(--ink); text-decoration: none; font-weight: 700; font-size: 14px; padding: 9px 14px; border-radius: 10px; }
.ad-panel { flex: none; background: var(--ad-bg); color: #fff; padding: 28px 28px calc(28px + var(--sb)); }
.ad-row { display: flex; align-items: center; gap: 16px; }
.ad-icon { width: 52px; height: 52px; border-radius: 13px; background: var(--ad-2); display: grid; place-items: center; }
.ad-icon svg { width: 28px; height: 28px; }
.ad-who { flex: 1; min-width: 0; }
.ad-who b { display: block; font-size: 22px; font-weight: 500; }
.ad-who span { display: block; color: #a1a1aa; font-size: 15px; letter-spacing: .02em; }
.ad-count { width: 52px; height: 52px; border-radius: 50%; border: 1.5px solid #8e8e93; display: grid; place-items: center; font-size: 20px; font-variant-numeric: tabular-nums; }
.ad-bar { height: 5px; background: #3a3a3c; border-radius: 3px; margin: 20px 0 16px; overflow: hidden; }
.ad-bar i { display: block; height: 100%; width: 0; background: var(--orange); border-radius: 3px; transition: width .25s linear; }
.ad-text { text-align: center; color: #a1a1aa; font-size: 16px; margin: 0 0 16px; }
.ad-btn { width: 100%; border: 0; border-radius: 16px; padding: 18px; font-size: 19px; background: var(--ad-2); color: #fff; }
.ad-btn:disabled { color: #8e8e93; cursor: default; }
.ad-btn:not(:disabled) { background: var(--green); color: #fff; font-weight: 700; }

/* ─── Consenso ─── */
.consent {
  position: fixed; z-index: 90; left: 12px; right: 12px; bottom: calc(12px + var(--sb));
  background: #fff; border-radius: 18px; box-shadow: 0 8px 30px rgba(0,0,0,.25); padding: 16px; font-size: 14px;
}
.consent p { margin: 0 0 12px; }
.consent a { color: inherit; }
.consent-btns { display: flex; gap: 10px; }
.consent-btns button { flex: 1; border: 0; border-radius: 12px; padding: 12px; font-weight: 700; background: var(--ink); color: #fff; }
.consent-btns .ghost { background: #f2f2f7; color: var(--ink); }

/* ═══════════ Desktop ═══════════ */
@media (min-width: 900px) {
  :root { --sheet-peek: 0px; --hdr: 72px; }
  .hdr {
    top: 0; left: 0; right: 0; border-radius: 0; background: #000; color: #fff; padding: 0 28px; height: var(--hdr);
    display: flex; align-items: center; justify-content: space-between; box-shadow: none; backdrop-filter: none;
  }
  .logo { padding: 0; }
  .logo-mark, .logo-text { display: none; }
  .logo-wordmark { display: block; font-family: "Space Grotesk", sans-serif; font-weight: 700; font-size: 28px; letter-spacing: -.01em; }
  .chips { margin: 0; padding: 5px; gap: 6px; background: #fff; border-radius: 999px; }
  .chip { font-size: 14px; padding: 7px 14px 7px 11px; border-color: #e5e5ea; }
  .chip svg { width: 17px; height: 17px; }
  .chip[aria-pressed="true"] { background: #1c1c1e; border-color: #1c1c1e; color: #fff; }
  #map { top: var(--hdr); }
  .demo { top: calc(var(--hdr) + 14px); }
  .maplibregl-ctrl-bottom-right { bottom: 0; }
  .locate { right: 24px; bottom: 36px; width: 58px; height: 58px; }
  .sheet {
    left: 20px; right: auto; top: calc(var(--hdr) + 20px); bottom: 20px; width: 380px; height: auto;
    border-radius: 20px; transform: none; transition: none; box-shadow: var(--shadow);
  }
  .sheet-grip { display: none; }
  .sheet-head { padding: 18px 20px 12px; font-size: 17px; cursor: default; }
  .sheet-head .muted { font-size: 13px; }
  .row { padding: 10px 20px; gap: 12px; }
  .row .badge { width: 40px; height: 40px; border-radius: 10px; font-size: 14px; }
  .row .who b { font-size: 16px; }
  .row .who span { font-size: 12px; }
  .price { min-width: 74px; font-size: 17px; padding: 6px 8px 4px; border-radius: 12px; }
  .price small { font-size: 11px; }
  .banner-slot { padding: 0 20px 12px; }
  .hint { bottom: 40px; }
  .gate { padding-bottom: 80px; }
  .consent { left: auto; right: 24px; bottom: 110px; width: 380px; }
  /* Preroll desktop: finestra centrata */
  .ad { background: rgba(0,0,0,.82); align-items: center; justify-content: center; }
  .ad-card { width: min(720px, 92vw); height: auto; border-radius: 22px; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
  .ad-media { aspect-ratio: 16 / 9; flex: none; }
  .ad-media video { object-fit: contain; }
  .ad-label { top: 14px; }
  .ad-panel { padding: 22px 26px 26px; }
}
