:root {
  --page-background: #353f47;
  --page-background-light: #4d5b65;

  --map-background: #ffffff;

  --text-primary: #111111;
  --text-light: #ffffff;
  --text-secondary: #f58220;

  --accent-color: #f58220;
  --origin-color: #c10524;

  --tooltip-background: rgba(17, 17, 17, 0.94);
  --tooltip-secondary: #d5e8ff;

  --map-max-width: 800px;
  --map-radius: 20px;
}

/* Reset generale */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  padding: 40px 20px;

  overflow-x: hidden;

  font-family: Arial, Helvetica, sans-serif;
  color: var(--text-primary);

  background:
    radial-gradient(
      circle at top,
      var(--page-background-light) 0%,
      var(--page-background) 55%
    );

  display: flex;
  align-items: center;
  justify-content: center;
}

/* Contenitore principale */

.map-page {
  width: 100%;
  max-width: 1000px;

  display: flex;
  flex-direction: column;
  align-items: center;

  gap: 28px;
}

/* Intestazione */

.map-header {
  width: 100%;
  max-width: 760px;

  color: var(--text-light);
  text-align: center;
}

.map-eyebrow {
  margin: 0 0 10px;

  color: var(--accent-color);

  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.map-title {
  margin: 0;

  color: var(--text-light);

  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.map-description {
  max-width: 620px;
  margin: 16px auto 0;

  color: var(--text-secondary);

  font-size: clamp(1rem, 2vw, 1.1rem);
  line-height: 1.6;
}

/* Contenitore della mappa */

.tl-map-wrap {
  position: relative;

  width: min(100%, var(--map-max-width));
  margin: 0;

  overflow: hidden;

  background: var(--map-background);

  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--map-radius);

  box-shadow:
    0 28px 70px rgba(0, 0, 0, 0.28),
    0 8px 24px rgba(0, 0, 0, 0.18);
}

/* SVG */

.tl-map-svg {
  display: block;

  width: 100%;
  height: auto;
}

/* Immagine di sfondo */

.map-bg {
  filter:
    brightness(1.08)
    saturate(1.06)
    contrast(1);
}

/* Sovrapposizione azzurra */

.blue-wash {
  fill: #bfe3ff;
  opacity: 0.28;

  mix-blend-mode: screen;
  pointer-events: none;
}

/* Linee di collegamento */

.connection-line {
  stroke: var(--accent-color);
  stroke-width: 1.4;
  stroke-linecap: round;

  opacity: 0.55;

  pointer-events: none;
  vector-effect: non-scaling-stroke;

  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;

  animation: draw-line 1.5s ease forwards;
}

@keyframes draw-line {
  to {
    stroke-dashoffset: 0;
  }
}

/* Collegamenti delle città */

.city-link {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.city-link:focus:not(:focus-visible) {
  outline: none;
}

.city-link:focus-visible {
  outline: 2px solid rgba(245, 130, 32, 0.95);
  outline-offset: 2px;
}

/* Punti delle città */

.city-dot {
  fill: var(--accent-color);

  transform-box: fill-box;
  transform-origin: center;

  filter:
    drop-shadow(
      0 0 5px rgba(245, 130, 32, 0.4)
    );

  transition:
    transform 0.25s ease,
    filter 0.25s ease,
    opacity 0.25s ease;

  animation:
    blink-pulse 2.5s infinite ease-in-out;
}

.city-link:hover .city-dot,
.city-link:focus-visible .city-dot {
  transform: scale(1.35);

  filter:
    drop-shadow(
      0 0 8px rgba(245, 130, 32, 0.7)
    );
}

@keyframes blink-pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.96;
  }

  50% {
    transform: scale(1.18);
    opacity: 0.76;
  }
}

/* Nomi delle città */

.city-name {
  fill: var(--text-primary);
  font-size: 3px;
  font-weight: 700;

  dominant-baseline: middle;
  pointer-events: auto;

  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.9);
  stroke-width: 0.35px;

  transition:
    transform 0.25s ease,
    opacity 0.25s ease;
}

.city-link:hover .city-name,
.city-link:focus-visible .city-name {
  fill: #f58220;
  transform: translateY(-0.4px);
  opacity: 0.80;
}
.city-link:active .city-name {
  fill: #d96a0c;
}
  
.city-link.is-origin:hover .city-name,
.city-link.is-origin:focus-visible .city-name {
  fill: #C10524;
}

/* Città di partenza */

.city-link.is-origin .city-dot {
  fill: var(--origin-color);

  filter:
    drop-shadow(
      0 0 6px rgba(193, 5, 36, 0.5)
    );
}

.city-link.is-origin:hover .city-dot,
.city-link.is-origin:focus-visible .city-dot {
  filter:
    drop-shadow(
      0 0 10px rgba(255, 255, 255, 0.95)
    );
}

/* Tooltip */

.map-tooltip {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 5;

  max-width: calc(100% - 24px);
  padding: 10px 12px;

  color: var(--text-light);
  background: var(--tooltip-background);

  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;

  box-shadow:
    0 10px 25px rgba(0, 0, 0, 0.22);

  font-size: 0.9rem;
  line-height: 1.25;
  white-space: nowrap;

  opacity: 0;
  visibility: hidden;
  pointer-events: none;

  transform:
    translate(
      -50%,
      calc(-100% - 14px)
    );

  transition:
    opacity 0.2s ease,
    visibility 0.2s ease;
}

.map-tooltip.show {
  opacity: 1;
  visibility: visible;
}

.map-tooltip span {
  display: block;
}

.map-tooltip .tooltip-title {
  margin-bottom: 3px;
  font-weight: 700;
}

.map-tooltip .tooltip-url {
  color: var(--tooltip-secondary);
  font-size: 0.78rem;
}

/* Elementi visibili solo agli screen reader */

.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;
}

/* Tablet */

@media (max-width: 900px) {
  body {
    padding: 32px 16px;
  }

  .map-page {
    gap: 22px;
  }

  .city-name {
    font-size: 3.5px;
    stroke-width: 0.45px;
  }
}

/* Smartphone */

@media (max-width: 640px) {
  body {
    align-items: flex-start;
    padding: 24px 12px;
  }

  .map-page {
    gap: 18px;
  }

  .map-header {
    padding-inline: 8px;
  }

  .map-eyebrow {
    margin-bottom: 8px;
    font-size: 0.72rem;
  }

  .map-title {
    font-size: 2rem;
    line-height: 1.1;
  }

  .map-description {
    margin-top: 12px;
    font-size: 0.95rem;
    line-height: 1.5;
  }

  .tl-map-wrap {
    border-radius: 14px;
  }

  .city-name {
    font-size: 3.8px;
    stroke-width: 0.55px;
  }

  .city-dot {
    transform: scale(1.15);
  }

  .city-link:hover .city-dot,
  .city-link:focus-visible .city-dot {
    transform: scale(1.4);
  }

  .map-tooltip {
    max-width: calc(100% - 16px);
    padding: 8px 10px;

    border-radius: 9px;

    font-size: 0.8rem;
  }

  .map-tooltip .tooltip-url {
    font-size: 0.7rem;
  }
}

/* Telefoni molto piccoli */

@media (max-width: 380px) {
  body {
    padding: 18px 8px;
  }

  .map-title {
    font-size: 1.7rem;
  }

  .map-description {
    font-size: 0.88rem;
  }

  .city-name {
    font-size: 4px;
    stroke-width: 0.6px;
  }

  .tl-map-wrap {
    border-radius: 10px;
  }
}

/* Riduzione delle animazioni */

@media (prefers-reduced-motion: reduce) {
  .connection-line,
  .city-dot {
    animation: none;
  }

  .city-dot,
  .city-name,
  .map-tooltip {
    transition: none;
  }

  .connection-line {
    stroke-dashoffset: 0;
  }
}