/* ===========================================================================
   Topolino route map — shared styles
   Loaded by both /map.html (standalone) and /campaign-book/index.html (deck slide).
   Every rule is scoped under the wrapper class `.topolino-map`; the design tokens
   are declared on the wrapper so they never leak into a host page's globals.
   The wrapper defaults to position:absolute; inset:0 (fills its container) —
   map.html overrides it to position:fixed for a full-viewport page.
   =========================================================================== */

.topolino-map {
  /* palette (was map.html :root) — scoped so a host page's --terra/--rosso/etc. are untouched */
  --paper: #F8E7C5;
  --paper-light: #FFF6E4;
  --cream: #FBF5EC;
  --ink: #17304A;
  --navy: #14324F;
  --navy-soft: rgba(20, 50, 79, .78);
  --terra: #B85B0E;
  --terra-deep: #5E2F05;
  --terra-soft: #D78332;
  --mint: #9FD6C9;
  --limone: #EFC75E;
  --rosso: #C8102E;
  --white: #FFFFFF;
  --paper-line: rgba(94, 47, 5, .24);
  --shadow: 0 18px 60px rgba(94, 47, 5, .22);
  --poster-inset: 22px;
  /* fonts (the standalone page drew these from colors_and_type.css .voice-comporta) */
  --font-display: "Gotham HTF", "Gotham", "Inter", -apple-system, sans-serif;
  --font-body: "Gotham HTF", "Gotham", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
}

.topolino-map, .topolino-map * { box-sizing: border-box; }

.topolino-map #map {
  position: absolute;
  inset: var(--poster-inset);
  overflow: hidden;
  border: 1px solid rgba(94, 47, 5, .26);
  box-shadow:
    inset 0 0 0 10px rgba(255, 246, 228, .28),
    0 22px 60px rgba(94, 47, 5, .22);
  filter: sepia(.17) saturate(.9) contrast(.96) brightness(1.04);
  z-index: 0;
}

.topolino-map .poster-frame,
.topolino-map .poster-grain,
.topolino-map .poster-vignette {
  position: absolute;
  pointer-events: none;
}

.topolino-map .poster-frame {
  inset: 0;
  z-index: 2;
  border: var(--poster-inset) solid var(--paper);
  box-shadow:
    inset 0 0 0 1px rgba(94, 47, 5, .3),
    inset 0 0 80px rgba(184, 91, 14, .16);
}

.topolino-map .poster-frame::before,
.topolino-map .poster-frame::after {
  content: "";
  position: absolute;
  right: 38px;
  left: 38px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(94, 47, 5, .36), transparent);
}

.topolino-map .poster-frame::before { top: 12px; }
.topolino-map .poster-frame::after { bottom: 12px; }

.topolino-map .poster-grain {
  inset: var(--poster-inset);
  z-index: 2;
  opacity: .15;
  mix-blend-mode: multiply;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(94, 47, 5, .18) 0 1px, transparent 1px),
    radial-gradient(circle at 70% 65%, rgba(20, 50, 79, .12) 0 1px, transparent 1px),
    linear-gradient(115deg, rgba(255, 246, 228, .42), rgba(184, 91, 14, .08) 38%, rgba(239, 199, 94, .18));
  background-size: 9px 9px, 13px 13px, 100% 100%;
}

.topolino-map .poster-vignette {
  inset: var(--poster-inset);
  z-index: 2;
  background:
    radial-gradient(circle at 73% 16%, rgba(239, 199, 94, .34), transparent 34%),
    radial-gradient(circle at 14% 84%, rgba(184, 91, 14, .18), transparent 38%),
    linear-gradient(180deg, rgba(255, 246, 228, .2), transparent 36%, rgba(94, 47, 5, .14));
  mix-blend-mode: multiply;
}

.topolino-map .mapboxgl-ctrl-logo,
.topolino-map .mapboxgl-ctrl-attrib {
  filter: saturate(.75);
}

.topolino-map .brand {
  position: absolute;
  top: 38px;
  left: 40px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 13px;
  border: 1px solid rgba(251, 245, 236, .42);
  background: rgba(20, 50, 79, .88);
  color: var(--white);
  box-shadow: 0 14px 40px rgba(94, 47, 5, .22);
  backdrop-filter: blur(16px);
}

.topolino-map .brand img.spatia {
  height: 22px;
  width: auto;
  display: block;
}

.topolino-map .brand .divider {
  width: 1px;
  height: 22px;
  background: rgba(255, 255, 255, .45);
}

.topolino-map .brand .fiat {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding: 0 7px;
  background: var(--white);
  border-radius: 4px;
}

.topolino-map .brand .fiat img {
  height: 17px;
  display: block;
}

.topolino-map .map-title {
  position: absolute;
  top: 44px;
  right: 42px;
  z-index: 5;
  max-width: min(510px, calc(100vw - 360px));
  padding: 18px 20px 20px;
  border: 1px solid rgba(94, 47, 5, .22);
  background:
    linear-gradient(135deg, rgba(255, 246, 228, .97), rgba(248, 231, 197, .92)),
    var(--paper-light);
  box-shadow:
    10px 10px 0 rgba(200, 143, 66, .16),
    0 20px 54px rgba(94, 47, 5, .22);
  backdrop-filter: blur(14px);
}

.topolino-map .map-title::before {
  content: "";
  display: block;
  width: 82px;
  height: 6px;
  margin: 0 0 14px;
  background: linear-gradient(90deg, var(--rosso) 0 44%, var(--paper-light) 44% 58%, var(--terra) 58%);
}

/* eyebrow — named .map-eyebrow (not .kicker) to avoid colliding with a host page's .kicker rules */
.topolino-map .map-eyebrow {
  margin: 0 0 8px;
  color: var(--terra-deep);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .18em;
  line-height: 1.25;
  text-transform: uppercase;
}

.topolino-map h1 {
  margin: 0;
  max-width: 440px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(36px, 4.8vw, 74px);
  font-weight: 300;
  letter-spacing: 0;
  line-height: .84;
  text-transform: uppercase;
}

.topolino-map .map-title .map-intro {
  margin: 14px 0 0;
  color: rgba(94, 47, 5, .78);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .04em;
  line-height: 1.5;
  text-transform: uppercase;
}

.topolino-map .route-panel {
  position: absolute;
  left: 42px;
  bottom: 42px;
  z-index: 5;
  width: min(438px, calc(100vw - 84px));
  max-height: min(61vh, 640px);
  overflow: auto;
  padding: 11px;
  border: 2px solid rgba(191, 126, 37, .72);
  background:
    linear-gradient(145deg, rgba(255, 246, 228, .97), rgba(248, 231, 197, .91)),
    radial-gradient(circle at 16% 14%, rgba(239, 199, 94, .22) 0 1px, transparent 1px),
    radial-gradient(circle at 76% 72%, rgba(20, 50, 79, .12) 0 1px, transparent 1px),
    var(--paper-light);
  background-size: auto, 12px 12px, 16px 16px;
  box-shadow:
    inset 0 0 0 3px rgba(255, 246, 228, .78),
    7px 7px 0 rgba(184, 91, 14, .22),
    0 22px 58px rgba(94, 47, 5, .24);
  backdrop-filter: blur(14px);
}

.topolino-map .route-panel::before {
  content: "Itinerari Topolino";
  display: block;
  margin: 1px 3px 10px;
  padding: 0 0 9px 1px;
  border-bottom: 1px solid rgba(184, 91, 14, .28);
  color: var(--terra-deep);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.topolino-map .route-list {
  display: grid;
  gap: 10px;
}

/* "back to overview" — shown only while a route is selected */
.topolino-map .route-back {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  margin: 0 0 10px;
  padding: 8px 11px;
  border: 1px solid rgba(184, 91, 14, .5);
  border-radius: 6px;
  background: rgba(255, 246, 228, .72);
  color: var(--terra-deep);
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  text-align: left;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
}

.topolino-map .route-back:hover,
.topolino-map .route-back:focus-visible {
  background: #FFF2D0;
  border-color: var(--terra);
  transform: translateY(-1px);
  outline: none;
}

.topolino-map .route-back[hidden] { display: none; }

.topolino-map .route-card {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr);
  gap: 13px;
  width: 100%;
  min-height: 124px;
  padding: 14px 15px 14px 14px;
  position: relative;
  border: 2px solid rgba(191, 126, 37, .48);
  border-left: 9px solid var(--route-color);
  border-radius: 8px 8px 6px 6px;
  background:
    linear-gradient(90deg, rgba(255, 246, 228, .78), transparent 39%),
    linear-gradient(180deg, rgba(255, 246, 228, .98), rgba(239, 199, 94, .18)),
    radial-gradient(circle at 18px 18px, rgba(184, 91, 14, .13) 0 1px, transparent 1px);
  background-size: auto, auto, 11px 11px;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  box-shadow:
    inset 0 0 0 2px rgba(255, 246, 228, .72),
    0 5px 0 rgba(94, 47, 5, .08);
  transition: transform .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.topolino-map .route-card::before,
.topolino-map .route-card::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(191, 126, 37, .32);
  border-radius: 50%;
  background: var(--paper);
  transform: translateY(-50%);
}

.topolino-map .route-card::before { left: -16px; }
.topolino-map .route-card::after { right: -8px; }

.topolino-map .route-card:hover,
.topolino-map .route-card:focus-visible {
  border-color: rgba(184, 91, 14, .72);
  background:
    linear-gradient(90deg, rgba(255, 246, 228, .88), transparent 39%),
    linear-gradient(180deg, #FFF2D0, #F7DBAA),
    radial-gradient(circle at 18px 18px, rgba(184, 91, 14, .16) 0 1px, transparent 1px);
  outline: none;
  transform: translateY(-1px);
  box-shadow:
    inset 0 0 0 2px rgba(255, 246, 228, .82),
    0 12px 28px rgba(94, 47, 5, .16);
}

.topolino-map .route-card.is-active {
  background:
    linear-gradient(90deg, rgba(184, 91, 14, .16), transparent 43%),
    linear-gradient(180deg, #FFF0C2, #F5D18F),
    radial-gradient(circle at 18px 18px, rgba(20, 50, 79, .14) 0 1px, transparent 1px);
  color: var(--ink);
  border-color: rgba(94, 47, 5, .74);
  box-shadow:
    inset 0 0 0 2px rgba(255, 246, 228, .82),
    inset 0 0 0 5px rgba(20, 50, 79, .08),
    0 16px 34px rgba(94, 47, 5, .24);
}

.topolino-map .route-number {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 2px solid rgba(191, 126, 37, .68);
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 28%, rgba(255, 246, 228, .92), rgba(239, 199, 94, .3) 52%, rgba(184, 91, 14, .16)),
    var(--paper-light);
  color: var(--navy);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .08em;
  box-shadow:
    inset 0 0 0 3px rgba(255, 246, 228, .74),
    0 4px 0 rgba(94, 47, 5, .12);
}

.topolino-map .route-card.is-active .route-number {
  color: var(--paper-light);
  background:
    radial-gradient(circle at 32% 26%, rgba(255, 246, 228, .36), var(--route-color) 64%, var(--terra-deep));
  border-color: rgba(255, 246, 228, .86);
}

.topolino-map .route-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.topolino-map .route-name {
  margin: 0;
  overflow-wrap: anywhere;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 300;
  line-height: 1.08;
  letter-spacing: 0;
  text-transform: uppercase;
}

.topolino-map .route-time {
  flex: none;
  color: var(--terra);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.topolino-map .route-card.is-active .route-time {
  color: var(--terra-deep);
}

.topolino-map .route-copy,
.topolino-map .route-surprise,
.topolino-map .route-meta {
  display: block;
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.45;
}

.topolino-map .route-copy {
  color: rgba(23, 48, 74, .74);
}

.topolino-map .route-card.is-active .route-copy {
  color: rgba(23, 48, 74, .78);
}

.topolino-map .route-surprise {
  color: rgba(23, 48, 74, .86);
}

.topolino-map .route-card.is-active .route-surprise {
  color: rgba(23, 48, 74, .92);
}

.topolino-map .route-surprise b {
  display: inline-block;
  margin-right: 6px;
  padding: 3px 6px 2px;
  border: 1px solid rgba(184, 91, 14, .48);
  background: rgba(255, 246, 228, .62);
  transform: rotate(-2deg);
  color: var(--rosso);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.topolino-map .route-card.is-active .route-surprise b {
  color: var(--rosso);
}

.topolino-map .route-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(94, 47, 5, .22);
  color: rgba(94, 47, 5, .66);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.topolino-map .route-card.is-active .route-meta {
  color: rgba(94, 47, 5, .76);
}

.topolino-map .sunset-pill {
  display: none;
  margin-top: 9px;
  padding: 8px 9px;
  border: 1px solid rgba(184, 91, 14, .34);
  background:
    linear-gradient(90deg, rgba(239, 199, 94, .34), rgba(255, 246, 228, .34));
  color: var(--terra-deep);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  line-height: 1.35;
  text-transform: uppercase;
}

.topolino-map .route-card.is-active .sunset-pill {
  background: rgba(251, 245, 236, .48);
  color: var(--terra-deep);
}

.topolino-map .route-card[data-route-id="il-tramonto"] .sunset-pill {
  display: block;
}

.topolino-map .topolino-car-marker {
  width: clamp(118px, 10vw, 154px);
  height: clamp(78px, 6.7vw, 103px);
  pointer-events: none;
  transform-origin: center;
  z-index: 6;
}

.topolino-map .topolino-car-sprite {
  position: relative;
  width: 100%;
  height: 100%;
  animation: topolino-bob 1.8s ease-in-out infinite;
  filter: drop-shadow(0 10px 18px rgba(20, 50, 79, .36));
  transform-origin: center;
}

.topolino-map .topolino-car-sprite::before {
  content: "";
  position: absolute;
  inset: 22% 20% 16%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(159, 214, 201, .46), rgba(159, 214, 201, 0) 68%);
  transform: scale(1.15);
  z-index: -1;
}

.topolino-map .topolino-car-sprite img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.topolino-map .topolino-car-marker.is-parked .topolino-car-sprite {
  animation: none;
}

@keyframes topolino-bob {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-4px) scale(1.015); }
}

.topolino-map .mapboxgl-popup-content {
  padding: 12px 13px;
  border-radius: 0;
  color: var(--navy);
  font-family: var(--font-body);
  box-shadow: 0 16px 44px rgba(20, 50, 79, .18);
}

.topolino-map .popup-title {
  margin: 0;
  color: var(--terra);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.topolino-map .popup-copy {
  margin: 5px 0 0;
  font-size: 12px;
  line-height: 1.4;
}

.topolino-map .map-error {
  position: absolute;
  right: 22px;
  bottom: 22px;
  z-index: 9;
  display: none;
  max-width: min(390px, calc(100vw - 44px));
  padding: 14px 16px;
  background: var(--navy);
  color: var(--white);
  box-shadow: var(--shadow);
  font-size: 13px;
  line-height: 1.5;
}

.topolino-map .map-error.is-visible {
  display: block;
}

@media (max-width: 820px) {
  .topolino-map { --poster-inset: 10px; }

  .topolino-map #map {
    box-shadow:
      inset 0 0 0 5px rgba(255, 246, 228, .24),
      0 16px 38px rgba(94, 47, 5, .16);
  }

  .topolino-map .poster-frame::before,
  .topolino-map .poster-frame::after {
    right: 18px;
    left: 18px;
  }

  .topolino-map .poster-frame::before { top: 7px; }
  .topolino-map .poster-frame::after { bottom: 7px; }

  .topolino-map .brand {
    top: 26px;
    left: 22px;
    padding: 8px 10px;
  }

  .topolino-map .brand img.spatia { height: 18px; }
  .topolino-map .brand .divider { height: 18px; }
  .topolino-map .brand .fiat { height: 24px; }
  .topolino-map .brand .fiat img { height: 14px; }

  .topolino-map .map-title {
    top: auto;
    right: 20px;
    left: 20px;
    bottom: calc(42vh + 18px);
    max-width: none;
    padding: 11px 13px 12px;
    box-shadow:
      5px 5px 0 rgba(200, 143, 66, .12),
      0 14px 32px rgba(94, 47, 5, .18);
  }

  .topolino-map .map-title::before {
    width: 58px;
    height: 5px;
    margin-bottom: 9px;
  }

  .topolino-map .map-title .map-eyebrow,
  .topolino-map .map-title .map-intro {
    display: none;
  }

  .topolino-map h1 {
    max-width: 290px;
    font-size: 27px;
    line-height: .88;
  }

  .topolino-map .route-panel {
    right: 10px;
    bottom: 10px;
    left: 10px;
    width: auto;
    max-height: 42vh;
    padding: 9px;
    border-color: rgba(94, 47, 5, .22);
    box-shadow: 0 -14px 34px rgba(94, 47, 5, .14);
  }

  .topolino-map .route-panel::before {
    margin-bottom: 7px;
    padding-bottom: 7px;
  }

  .topolino-map .route-card {
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 10px;
    min-height: 0;
    padding: 10px;
    border-left-width: 7px;
  }

  .topolino-map .route-heading {
    display: grid;
    gap: 3px;
  }

  .topolino-map .route-number {
    width: 36px;
    height: 36px;
  }

  .topolino-map .route-name { font-size: 18px; }
  .topolino-map .route-time { font-size: 10px; }

  .topolino-map .route-copy,
  .topolino-map .route-surprise,
  .topolino-map .route-meta {
    margin-top: 6px;
    font-size: 10.5px;
    line-height: 1.35;
  }

  .topolino-map .route-surprise b {
    padding: 2px 5px 1px;
    font-size: 9px;
  }

  .topolino-map .route-meta {
    gap: 6px;
    padding-top: 6px;
  }

  .topolino-map .map-error {
    top: 76px;
    right: 14px;
    bottom: auto;
    left: 14px;
    max-width: none;
  }

  .topolino-map .topolino-car-marker {
    width: 112px;
    height: 75px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .topolino-map .route-card { transition: none; }
  .topolino-map .topolino-car-sprite { animation: none; }
}
