/* =====================================================================
   Peregrinatio Mariae – stile (mobile first, desktop da 900px)
   ===================================================================== */

:root {
  --primary: #1f4fa3;
  --primary-strong: #153a7d;
  --primary-ink: #ffffff;
  --primary-soft: #e5edfb;
  --gold: #c99a2e;
  --gold-soft: #fbf3df;
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f1f3f7;
  --text: #1b1e24;
  --muted: #5e6572;
  --line: #e2e6ec;
  --inverse: #1f2329;
  --live: #188038;
  --live-soft: #e6f4ea;
  --route: #1f4fa3;
  --shadow-1: 0 1px 2px rgba(32, 38, 52, .18), 0 1px 4px 1px rgba(32, 38, 52, .08);
  --shadow-2: 0 2px 6px 2px rgba(32, 38, 52, .12), 0 1px 3px rgba(32, 38, 52, .2);
  --shadow-3: 0 8px 28px rgba(20, 28, 48, .18);
  --card: var(--surface-2);
  /* Fondo caldo (come lo sfondo della foto) su cui si posa sempre la Madonna, anche in tema scuro */
  --medallion: #f7ede1;
  --medallion-hover: #f0e0cc;

  --rail-w: 84px;
  --panel-w: 420px;
  --tabbar-h: calc(66px + env(safe-area-inset-bottom));
  --safe-top: env(safe-area-inset-top);
  --sheet-visible: 0px;

  --font: "Google Sans", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --primary: #8db4f7;
    --primary-strong: #b9d0fb;
    --primary-ink: #0b1d3a;
    --primary-soft: #1e2d48;
    --gold: #e2bc5c;
    --gold-soft: #2e2817;
    --bg: #111317;
    --surface: #1b1e24;
    --surface-2: #252931;
    --text: #e8eaed;
    --muted: #a0a6b0;
    --line: #333842;
    --inverse: #e8eaed;
    --live: #81c995;
    --live-soft: #1b3324;
    --route: #8db4f7;
    --shadow-1: 0 1px 3px rgba(0, 0, 0, .5);
    --shadow-2: 0 2px 10px rgba(0, 0, 0, .45);
    --shadow-3: 0 8px 28px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; overflow: hidden; background: var(--bg); color: var(--text);
  font: 15px/1.45 var(--font); -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent; overscroll-behavior: none;
}
a { color: var(--primary); }
button { font: inherit; color: inherit; }
h1, h2, h3, h4 { line-height: 1.2; }
.muted { color: var(--muted); }
.i { width: 20px; height: 20px; flex: none; }
.i-lg { width: 34px; height: 34px; }
.madonna { display: block; width: 100%; height: 100%; }
.desktop-only { display: none !important; }

/* ---------------- Mappa ---------------- */
.map { position: fixed; inset: 0; z-index: 0; background: var(--bg); }
.maplibregl-map { font-family: var(--font); }
.maplibregl-ctrl-bottom-right, .maplibregl-ctrl-bottom-left { bottom: calc(var(--tabbar-h) + var(--sheet-visible)); transition: bottom .32s var(--ease); }
.maplibregl-ctrl-bottom-right { right: 76px; }
.maplibregl-ctrl-attrib { font-size: 10.5px; }
.maplibregl-ctrl-attrib.maplibregl-compact { border-radius: 14px; }
@media (prefers-color-scheme: dark) {
  .maplibregl-ctrl-attrib, .maplibregl-ctrl-attrib.maplibregl-compact { background: rgba(27, 30, 36, .85); color: #bbb; }
  .maplibregl-ctrl-attrib a { color: #9fc0ff; }
  .maplibregl-ctrl-attrib-button { filter: invert(1); }
}

/* Marker */
.mk-root { cursor: pointer; outline: none; }
.mk { position: relative; }
.mk-dot { width: 26px; height: 26px; }
.mk-dot.is-sel { width: 34px; height: 34px; }
.mk-now { width: 56px; height: 66px; }
.mk-label {
  position: absolute; left: 50%; top: 100%; transform: translateX(-50%); margin-top: 3px;
  white-space: nowrap; font-size: 12.5px; font-weight: 700; color: #1b1e24; pointer-events: none;
  text-shadow: 0 0 2px #fff, 0 0 2px #fff, 0 0 3px #fff, 0 0 4px #fff;
}
@media (prefers-color-scheme: dark) { .mk-label { color: #fff; text-shadow: 0 0 2px #000, 0 0 3px #000, 0 0 4px #000; } }

.mk-dot .mk-b {
  display: flex; align-items: center; justify-content: center; width: 100%; height: 100%;
  border-radius: 50%; background: #fff; border: 2.5px solid var(--c); color: var(--c);
  font: 800 11px/1 var(--font); box-shadow: 0 1px 4px rgba(0, 0, 0, .35); transition: transform .2s var(--ease);
}
.mk-dot .mk-b .i { width: 14px; height: 14px; stroke-width: 3; }
.mk-dot.is-passata .mk-b { background: var(--c); color: #fff; border-color: #fff; opacity: .78; }
.mk-dot.is-sel .mk-b { font-size: 13px; border-width: 3px; box-shadow: 0 0 0 5px color-mix(in srgb, var(--c) 28%, transparent), 0 2px 6px rgba(0, 0, 0, .35); opacity: 1; }
.mk-dot:hover .mk-b { transform: scale(1.12); }
.mk.is-dim { opacity: .28; }

.mk-now { position: relative; }
.mk-pin {
  position: absolute; left: 3px; top: 2px; width: 50px; height: 50px;
  border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  background: var(--medallion); border: 3px solid #1f4fa3;
  box-shadow: 0 3px 10px rgba(10, 30, 70, .45);
}
.mk-pin .madonna { transform: rotate(45deg) translateY(1px); width: 38px; height: 38px; margin: 3px 3px 3px 3px; }
.mk-now.is-sel .mk-pin { border-color: #f2c64a; }
.mk-pulse {
  position: absolute; left: 3px; top: 2px; width: 50px; height: 50px; border-radius: 50%;
  background: #2d63c4; opacity: .35; animation: pulse 2.2s ease-out infinite;
}
.mk-now .mk-label { top: 66px; margin-top: 0; font-size: 13px; }
@keyframes pulse { 0% { transform: scale(.9); opacity: .45; } 100% { transform: scale(2.3); opacity: 0; } }
/* niente "position" qui: il marker è posizionato in assoluto da MapLibre */
.mk-loc { width: 16px; height: 16px; cursor: pointer; }
.mk-loc-dot { display: block; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 4px solid var(--c); box-shadow: 0 1px 4px rgba(0, 0, 0, .35); }
.mk-loc .mk-label { font-size: 12px; font-weight: 600; }
.mk-me span { display: block; width: 18px; height: 18px; margin: 2px; border-radius: 50%; background: #4285f4; border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .4); }

/* ---------------- Ricerca ---------------- */
.search { position: fixed; z-index: 30; top: calc(var(--safe-top) + 10px); left: 12px; right: 12px; }
.search-box {
  display: flex; align-items: center; gap: 8px; height: 50px; padding: 0 6px 0 7px;
  background: var(--surface); border-radius: 25px; box-shadow: var(--shadow-2);
}
.search-logo { width: 36px; height: 36px; border-radius: 50%; background: var(--medallion); padding: 3px; flex: none; }
.search input {
  flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent;
  font: 16px var(--font); color: var(--text);
}
.search input::placeholder { color: var(--muted); }
.search input::-webkit-search-cancel-button { display: none; }
.search-results {
  margin-top: 8px; background: var(--surface); border-radius: 22px; box-shadow: var(--shadow-3);
  max-height: min(60vh, 460px); overflow: auto; padding: 6px 0;
}
.res-head { padding: 10px 16px 4px; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.res { display: flex; align-items: center; gap: 12px; padding: 9px 16px; color: var(--text); text-decoration: none; }
.res:hover, .res:focus { background: var(--surface-2); outline: 0; }
.res-icon { width: 38px; height: 38px; border-radius: 50%; background: color-mix(in srgb, var(--c) 14%, var(--surface)); color: var(--c); display: flex; align-items: center; justify-content: center; flex: none; }
.res-icon .madonna { width: 30px; height: 30px; }
.res-icon:has(.madonna) { background: var(--medallion); }
.res-body { display: flex; flex-direction: column; min-width: 0; }
.res-body b { font-weight: 600; }
.res-body small { color: var(--muted); font-size: 13px; }
.res-body em { color: var(--live); font-style: normal; font-weight: 700; }
.res-empty { padding: 16px; color: var(--muted); }

/* ---------------- Chips ---------------- */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.map-chips { position: fixed; z-index: 15; top: calc(var(--safe-top) + 70px); left: 0; right: 0; padding: 2px 12px 6px; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px;
  border-radius: 17px; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.map-chips .chip { border-color: transparent; box-shadow: var(--shadow-1); }
.chip.is-on { background: var(--primary-soft); color: var(--primary-strong); border-color: color-mix(in srgb, var(--primary) 45%, transparent); font-weight: 600; }
.chip-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--primary)); flex: none; }
.chips-inline { margin: 0 -16px 10px; padding: 0 16px; }

/* ---------------- Pulsanti mappa ---------------- */
.fabs { position: fixed; z-index: 18; display: flex; flex-direction: column; gap: 10px; align-items: center;
  bottom: calc(var(--tabbar-h) + var(--sheet-visible) + 12px); transition: bottom .32s var(--ease), opacity .2s; }
.fabs-right { right: 12px; }
body[data-sheet="full"] .fabs, body.is-page .fabs, body.is-searching .fabs { opacity: 0; pointer-events: none; }
.fab {
  width: 48px; height: 48px; border-radius: 16px; border: 0; background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-2); display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.fab:hover { background: var(--surface-2); }
.fab:active { transform: scale(.96); }
.fab-group { display: flex; flex-direction: column; border-radius: 16px; overflow: hidden; box-shadow: var(--shadow-2); }
.fab-group .fab { box-shadow: none; border-radius: 0; height: 44px; }
.fab-group .fab + .fab { border-top: 1px solid var(--line); }
.fab-madonna { width: 56px; height: 56px; border-radius: 18px; background: var(--medallion); padding: 5px; border: 2px solid var(--gold); }
.fab-madonna:hover { background: var(--medallion-hover); }

/* ---------------- Pannello / Bottom sheet ---------------- */
.panel {
  position: fixed; z-index: 20; left: 0; right: 0;
  top: calc(var(--safe-top) + 68px); bottom: var(--tabbar-h);
  background: var(--surface); border-radius: 26px 26px 0 0; box-shadow: 0 -2px 16px rgba(20, 28, 48, .14);
  display: flex; flex-direction: column; transition: transform .34s var(--ease); will-change: transform;
}
.panel.no-anim { transition: none; }
.sheet-handle { flex: none; height: 22px; display: flex; align-items: center; justify-content: center; cursor: grab; touch-action: none; }
.sheet-handle span { width: 38px; height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--muted) 45%, transparent); }
.panel-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.panel[data-sheet="half"] .panel-scroll, .panel[data-sheet="peek"] .panel-scroll { overflow: hidden; }
.panel-content { padding: 0 16px 28px; }

/* Pagina a tutto schermo su mobile (sezioni diverse dall'itinerario) */
body.is-page .panel {
  top: 0; transform: none !important; border-radius: 0; z-index: 40; background: var(--bg); --card: var(--surface);
  box-shadow: none; animation: pageIn .26s var(--ease);
}
body.is-page .sheet-handle, body.is-page .search, body.is-page .map-chips { display: none; }
body.is-page .panel-content { padding-top: calc(var(--safe-top) + 6px); }
@keyframes pageIn { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

/* ---------------- Tab bar (mobile) ---------------- */
.tabbar {
  position: fixed; z-index: 50; left: 0; right: 0; bottom: 0; height: var(--tabbar-h);
  padding-bottom: env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, 1fr);
}
.tab, .rail-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); text-decoration: none; font-size: 11.5px; font-weight: 600; background: none; border: 0; cursor: pointer;
}
.nav-ic { width: 58px; height: 30px; border-radius: 15px; display: flex; align-items: center; justify-content: center; transition: background .2s; }
.tab.is-active, .rail-item.is-active { color: var(--text); }
.tab.is-active .nav-ic, .rail-item.is-active .nav-ic { background: var(--primary-soft); color: var(--primary-strong); }
.rail { display: none; }

/* ---------------- Snackbar ---------------- */
.snackbar {
  position: fixed; z-index: 100; left: 50%; bottom: calc(var(--tabbar-h) + 12px);
  transform: translate(-50%, 30px); opacity: 0; pointer-events: none;
  display: flex; align-items: center; gap: 4px; width: max-content; max-width: calc(100% - 24px);
  padding: 6px 6px 6px 16px; min-height: 48px; border-radius: 16px;
  background: var(--inverse); color: var(--bg); box-shadow: var(--shadow-3); font-size: 14px;
  transition: transform .3s var(--ease), opacity .3s;
}
.snackbar > span { padding: 6px 4px 6px 0; }
.snackbar.is-on { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.snack-btn { border: 0; background: none; color: #a8c7fa; font-weight: 700; padding: 10px 12px; border-radius: 10px; cursor: pointer; white-space: nowrap; }
@media (prefers-color-scheme: dark) { .snack-btn { color: #1f4fa3; } }
.snack-btn:hover { background: rgba(255, 255, 255, .08); }
.snackbar .icon-btn { color: inherit; opacity: .8; }

/* ---------------- Componenti ---------------- */
.sec { margin: 14px 0 18px; }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sec-title { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 16.5px; font-weight: 700; }
.sec-title .i { color: var(--primary); }
.sec-intro { margin: -4px 0 12px; font-size: 14px; }
.card { background: var(--card); border-radius: 22px; padding: 16px; }
.list-card { background: var(--card); border-radius: 22px; overflow: hidden; }
.link-btn { border: 0; background: none; color: var(--primary); font-weight: 600; font-size: 14px; cursor: pointer; padding: 6px 8px; border-radius: 10px; margin: -6px -8px 4px 0; }
.link-btn:hover { background: var(--primary-soft); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 42px; padding: 0 18px;
  border-radius: 21px; border: 0; font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background .15s, transform .1s;
}
.btn:active { transform: scale(.97); }
.btn .i { width: 18px; height: 18px; }
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: var(--primary-strong); }
.btn-tonal { background: var(--primary-soft); color: var(--primary-strong); }
.btn-tonal:hover { background: color-mix(in srgb, var(--primary) 22%, var(--surface)); }
.btn-icon { width: 42px; padding: 0; }
.btn-sm { height: 36px; padding: 0 14px; }
.icon-btn {
  width: 40px; height: 40px; flex: none; border-radius: 20px; border: 0; background: transparent; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; text-decoration: none;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.pill { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 10px; border-radius: 12px; font-size: 12px; font-weight: 700; white-space: nowrap; background: var(--surface-2); color: var(--muted); flex: none; }
.pill-live { background: var(--live-soft); color: var(--live); }
.pill-live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: blink 1.6s infinite; }
.pill-soft { background: var(--primary-soft); color: var(--primary-strong); }
.pill-muted { background: var(--surface-2); color: var(--muted); }
@keyframes blink { 50% { opacity: .35; } }

.banner { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: 16px; background: var(--primary-soft); font-size: 13.5px; margin-bottom: 10px; }
.banner .i { color: var(--primary); margin-top: 1px; width: 18px; height: 18px; }
.banner-after { margin: 10px 0 0; }
.banner-warn { background: var(--gold-soft); }
.banner-warn .i { color: var(--gold); }

/* Hero: dov'è ora la Madonna */
.hero {
  position: relative; overflow: hidden; border-radius: 26px; padding: 18px 18px 16px;
  background:
    radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, var(--c) 22%, transparent), transparent 60%),
    linear-gradient(160deg, color-mix(in srgb, var(--primary) 10%, var(--surface)), var(--card));
  border: 1px solid color-mix(in srgb, var(--c) 18%, transparent);
}
.hero-art { position: absolute; right: 8px; top: 10px; width: 96px; height: 96px; filter: drop-shadow(0 4px 10px rgba(20, 40, 90, .2)); }
.hero-kicker { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: color-mix(in srgb, var(--c) 75%, var(--text)); padding-right: 84px; }
.hero-kicker .i { width: 16px; height: 16px; }
.hero-title { margin: 6px 100px 4px 0; font-size: 27px; font-weight: 800; letter-spacing: -.01em; }
.hero-title.is-long, .place-title.is-long { font-size: 21px; line-height: 1.25; }
.hero-count { margin-top: 4px; font-size: 15px; color: var(--muted); }
.hero-count b { font-size: 46px; line-height: 1; font-weight: 800; color: var(--text); letter-spacing: -.02em; }
.hero-sub { margin: 0; color: var(--muted); padding-right: 70px; }
.hero-meta { display: flex; align-items: center; gap: 7px; margin-top: 10px; font-size: 14px; font-weight: 500; }
.hero-meta .i { width: 17px; height: 17px; color: var(--muted); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.hero-next {
  display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 10px; margin-top: 14px;
  padding: 11px 12px 11px 14px; border-radius: 16px; background: var(--surface); color: var(--text); text-decoration: none; font-size: 14px;
}
.hero-next span:first-child { font-size: 12px; color: var(--muted); font-weight: 600; }
.hero-next span:nth-child(3) { color: var(--muted); font-size: 13px; }
.hero-next .i { color: var(--muted); width: 18px; height: 18px; }
.live { width: 9px; height: 9px; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 0 var(--live); animation: live 1.8s infinite; flex: none; }
@keyframes live { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--live) 60%, transparent); } 100% { box-shadow: 0 0 0 9px transparent; } }

/* Avanzamento */
.progress-top { display: flex; justify-content: space-between; font-size: 14px; }
.progress-top b { font-size: 19px; }
.bar { height: 8px; border-radius: 4px; background: var(--line); margin: 10px 0 6px; overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--primary), var(--gold)); }
.progress-bottom { display: flex; justify-content: space-between; font-size: 12px; }

/* Timeline tappe */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 21px; top: 30px; bottom: 26px; width: 2px; background: var(--line); border-radius: 1px; }
.tl-month { padding: 14px 0 6px 54px; font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); position: relative; }
.tl-item { display: flex; align-items: center; gap: 12px; padding: 7px 6px; border-radius: 18px; color: var(--text); text-decoration: none; position: relative; }
.tl-item:hover { background: var(--surface-2); }
.tl-dot {
  width: 30px; height: 30px; margin: 0 0 0 7px; border-radius: 50%; flex: none; position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800;
  background: var(--surface); border: 2.5px solid var(--c); color: var(--c);
}
.tl-dot .i { width: 15px; height: 15px; stroke-width: 3; }
.tl-item.is-passata .tl-dot { background: color-mix(in srgb, var(--c) 16%, var(--surface)); border-color: color-mix(in srgb, var(--c) 50%, var(--surface)); }
.tl-item.is-passata .tl-name { color: var(--muted); }
.tl-dot-m { width: 40px; height: 40px; margin: 0 0 0 2px; padding: 3px; background: var(--medallion); border: 2.5px solid var(--gold); }
.tl-item.is-m { background: color-mix(in srgb, var(--primary) 8%, transparent); }
.tl-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tl-name { font-weight: 650; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-meta { font-size: 13px; color: var(--muted); }
.tl-chev { color: var(--muted); width: 18px; height: 18px; }
.empty-sm { padding: 16px; color: var(--muted); }

/* Scheda tappa (stile "luogo" di Google Maps) */
.place-hero {
  position: relative; height: 168px; border-radius: 22px; overflow: hidden;
  background:
    radial-gradient(70% 90% at 50% 120%, rgba(255, 255, 255, .28), transparent 60%),
    linear-gradient(160deg, color-mix(in srgb, var(--c) 78%, #0b1d3a), color-mix(in srgb, var(--c) 40%, #0b1d3a));
}
.place-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.place-art { position: absolute; left: 50%; top: 50%; width: 124px; height: 124px; padding: 12px; border-radius: 50%; transform: translate(-50%, -50%); background: var(--medallion); border: 3px solid rgba(255, 255, 255, .7); box-shadow: 0 8px 24px rgba(0, 0, 0, .22); }
.place-back { position: absolute; top: 10px; left: 10px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }
.place-step { position: absolute; right: 12px; bottom: 12px; padding: 4px 10px; border-radius: 12px; background: rgba(255, 255, 255, .92); color: #1b1e24; font-size: 12px; font-weight: 700; }
.place-title { margin: 14px 0 3px; font-size: 25px; font-weight: 800; letter-spacing: -.01em; }
.place-sub { margin: 0 0 10px; color: var(--muted); font-size: 14px; }
.vic-tag { display: inline-flex; align-items: center; gap: 6px; color: color-mix(in srgb, var(--c) 80%, var(--text)); font-weight: 650; }
.vic-tag .chip-dot { background: var(--c); }
.place-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin: 16px 0 6px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.round-btn { display: flex; flex-direction: column; align-items: center; gap: 6px; border: 0; background: none; color: var(--primary); font-size: 12px; font-weight: 650; text-decoration: none; cursor: pointer; padding: 2px 0; }
.round-btn > span { width: 46px; height: 46px; border-radius: 16px; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; transition: background .15s; }
.round-btn:hover > span { background: var(--primary-soft); }
.round-btn.is-primary > span { background: var(--primary); color: var(--primary-ink); border-color: transparent; }
.round-btn:disabled { opacity: .4; cursor: default; }
.info-rows { margin: 4px 0 8px; }
.info-row { display: flex; gap: 16px; padding: 11px 2px; align-items: flex-start; }
.info-row + .info-row { border-top: 1px solid var(--line); }
.info-row .i { color: var(--muted); margin-top: 1px; }
.info-row > div { display: flex; flex-direction: column; font-size: 14px; }
.info-row b { font-weight: 600; }
.info-row span { font-size: 13px; }
.place-desc { margin: 6px 0 16px; line-height: 1.55; }
.place .sec-title { margin-top: 22px; }
.day-block { margin: 12px 0; }
.day-label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--muted); margin: 0 4px 7px; }
.prevnext { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 22px; }
.pn { display: flex; align-items: center; gap: 8px; padding: 12px; border-radius: 18px; background: var(--card); color: var(--text); text-decoration: none; min-width: 0; }
.pn:hover { background: color-mix(in srgb, var(--primary) 10%, var(--card)); }
.pn span { display: flex; flex-direction: column; min-width: 0; }
.pn small { color: var(--muted); font-size: 12px; }
.pn b { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pn-next { justify-content: flex-end; text-align: right; }
.pn .i { color: var(--muted); }

/* Eventi */
.ev { display: grid; grid-template-columns: 50px 1fr auto; gap: 10px; padding: 13px 8px 13px 14px; align-items: start; }
.ev + .ev, .dl + .dl, .lnk + .lnk { border-top: 1px solid var(--line); }
.ev.is-past { opacity: .55; }
.ev-time b { display: block; font-size: 15px; font-weight: 700; }
.ev-time small { color: var(--muted); font-size: 12px; }
.ev-tbd { display: flex; flex-direction: column; gap: 2px; color: var(--muted); }
.ev-tbd .i { width: 18px; height: 18px; }
.ev-tbd small { font-size: 11px; line-height: 1.2; }

/* Località di una comunità di fede */
.loc { display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 14px; }
.loc + .loc { border-top: 1px solid var(--line); }
.loc-ic { width: 34px; height: 34px; border-radius: 12px; background: color-mix(in srgb, var(--c) 14%, var(--surface)); color: color-mix(in srgb, var(--c) 80%, var(--text)); display: flex; align-items: center; justify-content: center; flex: none; }
.loc-ic .i { width: 18px; height: 18px; }
.loc-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.loc-body b { font-weight: 600; }
.loc-body small { font-size: 12.5px; }
.loc .icon-btn { color: var(--primary); }
.note { font-size: 13px; margin: 8px 4px 0; }
.ev-body { min-width: 0; }
.ev-type { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--t); }
@media (prefers-color-scheme: dark) { .ev-type { color: color-mix(in srgb, var(--t) 55%, #fff); } }
.ev-type .i { width: 14px; height: 14px; }
.ev-title { font-weight: 650; margin: 2px 0 3px; }
.ev-desc { font-size: 13.5px; color: var(--muted); margin-bottom: 3px; }
.ev-place { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.ev-place .i { width: 14px; height: 14px; }
.ev-place a { color: var(--primary); font-weight: 600; text-decoration: none; }
.ev-cal { margin-top: -4px; }

.seg { display: flex; padding: 4px; border-radius: 22px; background: var(--card); margin-bottom: 12px; }
body.is-page .seg { background: var(--surface-2); }
.seg-btn { flex: 1; height: 36px; border-radius: 18px; border: 0; background: none; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg-btn.is-on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }
.day-group { margin: 0 0 20px; }
.day-h { display: flex; align-items: center; gap: 12px; margin: 0 0 9px; font-size: 14px; font-weight: 500; }
.day-num { width: 42px; height: 42px; border-radius: 14px; background: var(--primary-soft); color: var(--primary-strong); display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 800; flex: none; }
.day-group.is-today .day-num { background: var(--primary); color: var(--primary-ink); }
.day-txt { display: flex; flex-direction: column; line-height: 1.25; }
.day-txt span { color: var(--muted); font-size: 12.5px; }
.day-tappa { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 15px; background: color-mix(in srgb, var(--c) 12%, var(--surface)); color: color-mix(in srgb, var(--c) 80%, var(--text)); font-size: 13px; font-weight: 650; text-decoration: none; max-width: 50%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.day-tappa .chip-dot { background: var(--c); }

/* Intestazione pagine */
.page-head { padding: 16px 4px 4px; }
.page-head h1 { margin: 0; font-size: 30px; font-weight: 800; letter-spacing: -.015em; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

/* Peregrinatio */
.intro-hero {
  text-align: center; border-radius: 28px; padding: 26px 20px 24px; color: #fff; position: relative; overflow: hidden;
  background:
    radial-gradient(80% 60% at 50% 0%, rgba(242, 198, 74, .35), transparent 70%),
    linear-gradient(170deg, #2a5fc4, #12306b);
}
.intro-art { width: 116px; height: 116px; margin: 0 auto 12px; padding: 12px; border-radius: 50%; background: var(--medallion); border: 3px solid rgba(242, 198, 74, .85); box-shadow: 0 8px 24px rgba(0, 0, 0, .3); }
.intro-kicker { margin: 0; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; opacity: .85; font-weight: 700; }
.intro-title { margin: 6px 0 4px; font: 700 32px/1.1 var(--serif); letter-spacing: .01em; }
.intro-sub { margin: 0; opacity: .9; font-size: 14px; }
.intro-slogan { margin: 14px auto 0; font: italic 18px/1.35 var(--serif); max-width: 22em; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.stat { background: var(--card); border-radius: 20px; padding: 14px 8px; text-align: center; display: flex; flex-direction: column; }
.stat b { font-size: 26px; font-weight: 800; color: var(--primary); line-height: 1.1; }
.stat span { font-size: 12.5px; color: var(--muted); }
.vic-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 12px; }
.vic-row .vic-tag { padding: 6px 12px; border-radius: 16px; background: color-mix(in srgb, var(--c) 12%, var(--surface)); font-size: 13.5px; }
.quote { margin: 0; padding: 20px 20px 16px 22px; border-radius: 22px; background: var(--gold-soft); border-left: 4px solid var(--gold); }
.quote p { margin: 0; font: italic 18px/1.45 var(--serif); }
.quote cite { display: block; margin-top: 8px; font-style: normal; font-size: 13px; color: var(--muted); }
.prose p { margin: 0 0 10px; line-height: 1.6; }
.prose p:last-child { margin-bottom: 0; }
.num-list { list-style: none; margin: 0; padding: 6px 16px; }
.num-list li { display: flex; gap: 12px; padding: 11px 0; line-height: 1.45; }
.num-list li + li { border-top: 1px solid var(--line); }
.num { width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: var(--primary-ink); font-size: 13px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex: none; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.step { background: var(--card); border-radius: 20px; padding: 14px 16px; border-left: 4px solid var(--gold); }
.step-when { display: block; font-size: 11.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--primary); }
.step b { display: block; margin-top: 2px; font-size: 15.5px; }
.step p { margin: 4px 0 0; font-size: 14px; color: var(--muted); line-height: 1.5; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile { background: var(--card); border-radius: 20px; padding: 14px 16px; }
.tile b { color: var(--primary); font-size: 15.5px; }
.tile p { margin: 4px 0 0; font-size: 13.5px; color: var(--muted); line-height: 1.45; }
.install-card { display: flex; align-items: center; gap: 14px; }
.install-card > .i { color: var(--primary); }
.install-card > div { flex: 1; }
.install-card p { margin: 2px 0 0; font-size: 13.5px; }
.install-card p .i { width: 15px; height: 15px; vertical-align: -2px; }

/* Materiali e link */
.dl, .lnk { display: flex; align-items: center; gap: 14px; padding: 13px 14px; color: var(--text); text-decoration: none; }
.lnk:hover { background: color-mix(in srgb, var(--primary) 6%, var(--card)); }
.dl-icon, .lnk-icon { position: relative; width: 46px; height: 50px; border-radius: 14px; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; flex: none; }
.lnk-icon { height: 46px; }
.dl-icon .i { width: 24px; height: 24px; }
.dl-icon small { position: absolute; bottom: 4px; font-size: 9px; font-weight: 800; letter-spacing: .03em; }
.dl-icon small + .i, .dl-icon .i:has(+ small) { margin-top: -10px; }
.dl-body, .lnk-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dl-body b, .lnk-body b { font-weight: 650; }
.dl-body span, .lnk-body span { font-size: 13.5px; color: var(--muted); }
.dl-body small, .lnk-body small { font-size: 12px; margin-top: 2px; }
.is-soon .dl-icon, .is-soon .lnk-icon { background: var(--surface-2); color: var(--muted); }
.lnk-ext { color: var(--muted); width: 18px; height: 18px; }

.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty h2 { color: var(--text); font-size: 18px; margin: 10px 0 6px; }
.empty .i-lg { color: var(--primary); }
.foot { text-align: center; font-size: 12px; padding: 18px 0 6px; line-height: 1.6; }

.skeleton { padding: 8px 0; display: grid; gap: 12px; }
.skeleton div { height: 120px; border-radius: 22px; background: linear-gradient(90deg, var(--surface-2), var(--line), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; }
.skeleton div + div { height: 60px; }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (max-width: 380px) {
  .hide-xs { display: none; }
  .hero-title { font-size: 24px; }
}

/* =====================================================================
   DESKTOP: rail a sinistra, pannello laterale fisso, mappa sempre visibile
   ===================================================================== */
@media (min-width: 900px) {
  :root { --tabbar-h: 0px; }
  .desktop-only { display: flex !important; }
  .tabbar, .sheet-handle { display: none; }
  .map { left: var(--rail-w); }
  .maplibregl-ctrl-bottom-right, .maplibregl-ctrl-bottom-left { bottom: 0; }
  .maplibregl-ctrl-bottom-right { right: 0; }

  .rail {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    position: fixed; z-index: 60; left: 0; top: 0; bottom: 0; width: var(--rail-w);
    padding: 14px 0; background: var(--surface); border-right: 1px solid var(--line);
  }
  .rail-logo { width: 50px; height: 50px; border-radius: 16px; background: var(--medallion); padding: 4px; margin-bottom: 18px; border: 2px solid var(--gold); box-shadow: var(--shadow-1); }
  .rail-items { display: flex; flex-direction: column; gap: 10px; }
  .rail-item { width: 76px; padding: 2px 0; font-size: 12px; }
  .rail-install { margin-top: auto; }
  .rail-item:hover .nav-ic { background: var(--surface-2); }
  .rail-item.is-active:hover .nav-ic { background: var(--primary-soft); }

  .panel {
    left: calc(var(--rail-w) + 12px); right: auto; top: 12px; bottom: 12px; width: var(--panel-w);
    border-radius: 26px; box-shadow: var(--shadow-3); transform: none;
    transition: transform .3s var(--ease), opacity .3s;
  }
  .panel-scroll { padding-top: 74px; scroll-padding-top: 74px; }
  .panel-content { padding: 0 20px 24px; }
  .panel-scroll::-webkit-scrollbar { width: 10px; }
  .panel-scroll::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; border: 3px solid var(--surface); }

  .search { left: calc(var(--rail-w) + 24px); right: auto; width: calc(var(--panel-w) - 24px); top: 24px; }
  .search-box { box-shadow: var(--shadow-1); background: var(--surface-2); }
  .search-box:focus-within { background: var(--surface); box-shadow: var(--shadow-2); }
  .map-chips { left: calc(var(--rail-w) + var(--panel-w) + 28px); right: 16px; top: 24px; padding: 2px 4px 8px; transition: left .3s var(--ease); }

  .panel-toggle {
    position: fixed; z-index: 19; top: 50%; left: calc(var(--rail-w) + 12px + var(--panel-w)); transform: translateY(-50%);
    width: 24px; height: 56px; border: 0; border-radius: 0 12px 12px 0; background: var(--surface); color: var(--muted);
    box-shadow: var(--shadow-1); align-items: center; justify-content: center; cursor: pointer; transition: left .3s var(--ease);
  }
  .panel-toggle .i { transition: transform .3s; }
  body.panel-collapsed .panel { transform: translateX(calc(-100% - 40px)); opacity: 0; pointer-events: none; }
  body.panel-collapsed .panel-toggle { left: var(--rail-w); }
  body.panel-collapsed .panel-toggle .i { transform: rotate(180deg); }
  body.panel-collapsed .map-chips { left: calc(var(--rail-w) + var(--panel-w) + 16px); }

  .fabs { bottom: 28px; }
  .fabs-right { right: 16px; }
  body.is-searching .fabs { opacity: 1; pointer-events: auto; }
  .snackbar { bottom: 24px; left: calc(50% + var(--rail-w) / 2); }

  .place-hero { height: 190px; }
  .hero-title { font-size: 29px; }
}

@media (min-width: 1400px) {
  :root { --panel-w: 460px; }
}

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