/* ── Design tokens ──────────────────────────────────────────────
   Change fonts here; everything below references these variables.
   ────────────────────────────────────────────────────────────── */
:root {
  --font-serif: 'Young Serif', Georgia, serif;
  --font-sans: 'Instrument Sans', system-ui, sans-serif;

  /* Type scale — base 16 px */
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.375rem;
  --text-2xl: clamp(2rem, 5vw, 3.5rem);
  --text-3xl: clamp(2.75rem, 8vw, 5.5rem);  /* 44 px → 88 px */

  /* UI surfaces */
  --surface: rgba(255, 255, 255, 0.82);
  --border: rgba(0, 0, 0, 0.10);

  /* Colours UI */
  --zeri-blue: #4F90CC;
  --zeri-blue-dark: #1d5a8e;
  --text-primary: #1a1a18;
  --text-secondary: #555;
  --text-muted: #888;
  --text-danger: #dc3545;
  --text-danger-muted: #c0747c;
  --border: #e0ddd5;
  --surface: rgba(255, 255, 255, 0.92);
  --bg-chip: #f0f5fb;

  /* Colour legend */
  --col-church: #4a75cc;
  --col-cathed: #9a44cc;
  --col-monast: #4daa28;
  --col-museum: #cc3aaa;
  --col-orator: #c49a10;
  --col-others: #737373;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  /* 1 rem anchor */
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-sans);
}

#map {
  width: 100%;
  height: 100%;
}

/* Hero covers the full screen, sits above the map */
#hero {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1001; /* above Leaflet controls (z-index 1000) */

  /* Version 1: Only black panel */
  
  /*
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  */
  
  /* Version 2: Photograph */
  /* https://commons.wikimedia.org/wiki/Category:San_Petronio_(Bologna)_-_Views_from_a_distance#/media/File:Bologna-SanPetronioPiazzaMaggiore1.jpg */

   
  background:
    linear-gradient(180deg, rgba(0,0,0,0.60) 0%, rgba(0,0,0,0.30) 45%, rgba(0,0,0,0.88) 100%),
    url("assets/images/hero-sstefano.jpg") center/cover no-repeat;
  backdrop-filter: blur(12px);
  
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
  padding: 2.5rem 2rem;
  transition: transform 1.1s ease-in-out;
}

#hero.up {
  transform: translateY(-100%);
}

/* ── Top logo row ── */
#hero-logos {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.hero-logo-link {
  display: block;
  border-radius: 50%;
  /* Thin white ring that echoes the glass aesthetic */
  outline: 1.5px solid rgba(255, 255, 255, 0.25);
  outline-offset: 3px;
  transition: outline-color 0.2s ease, transform 0.2s ease;
}

.hero-logo-link:hover {
  outline-color: rgba(255, 255, 255, 0.7);
  transform: scale(1.06);
}

#hero-logos img {
  display: block;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  /* Slight white overlay so JPEG backgrounds blend into the glass panel */
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15) inset;
}

/* ── Central text ── */
#hero-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

#hero-center h1 {
  font-family: var(--font-serif);
  font-size: var(--text-3xl);
  font-weight: 700;
  line-height: 1.15;
}

#hero-center p {
  font-family: var(--font-sans);
  font-size: var(--text-xl);
  /* 18 px */
  font-weight: 400;
  opacity: 0.78;
  line-height: 1.6;
}

/* ── Circular arrow button ── */
#btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: bounce 1.6s ease-in-out infinite;
  transition: background 0.2s ease, border-color 0.2s ease;
}

#btn:hover {
  background: rgba(255, 255, 255, 0.26);
  border-color: rgba(255, 255, 255, 0.8);
}

@keyframes bounce {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(7px);
  }
}

/* ── Floating action buttons (top-left) ── */
.float {
  position: fixed;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.25s ease;
}

.float.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

#ui-float-top {
  top: 24px;
  left: 24px;
  transform: translateY(-6px);
}

#ui-float-top.visible {
  transform: translateY(0);
}

/* ── Hero footer (bottom row: copyright + btn + sponsor logos) ── */
#hero-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  width: 100%;
  gap: 1rem;
}

#hero-copyright {
  flex: 1;
}

#hero-copyright p {
  font-family: var(--font-sans);
  font-size: calc(var(--text-sm) * 0.85);
  color: rgba(255, 255, 255, 0.65);
  margin: 0;
  text-align: left;
}

.hero-sponsor-label {
  font-size: calc(var(--text-sm) * 0.85) !important;
}

#hero-sponsor-logos {
  flex: 1;
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 16px;
}

.hero-sponsor-item {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.hero-sponsor-label {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 0.06em;
}

.hero-sponsor-img {
  max-height: 42px;
  width: auto;
  object-fit: contain;
  display: block;
  transition: opacity 0.15s;
}

.hero-sponsor-item a {
  display: flex;
}

.hero-sponsor-item a:hover .hero-sponsor-img {
  opacity: 0.75;
}

/* Shared surface style for pill */
.float-pill {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.float-pill:hover {
  background: var(--bg-chip);
  color: var(--zeri-blue-dark);
  border-color: #c9ddf0;
}

/* ── Info pill (CTA style) ── */
.float-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 14px 0 18px;
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 500;
}

.float-pill i {
  font-size: 18px;
  flex-shrink: 0;
}

.float-pill-title {
  font-size: var(--text-base);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.float-pill--cta {
  width: calc(300px + 10px + 44px); /*Sum of below floats + gap*/
  height: 52px;
  padding: 0 16px 0 22px;
  font-size: var(--text-lg);
}

.float-pill--cta .float-pill-title {
  font-size: var(--text-lg);
  font-weight: 500;
}

.float-box {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 22px;
  overflow: hidden;
  color: var(--text-primary);
}

/* ── Legend float: always visible ── */
#legend-float {
  width: 300px;
  border-radius: 16px;
}

#legend-float-header {
  display: flex;
  align-items: center;
}

#legend-float-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  color: var(--zeri-blue-dark);
}

#legend-float-header .legend-title {
  margin: 0;
}

#float-row {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 10px;
}

#legend-float-body {
  padding: 0 14px 14px;
}

#legend-float-body .chip-list {
  margin-bottom: 0;
}

.legend-title {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  margin-top: 8px;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ── Legend chips ── */
.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
}

.chip-dot {
  flex-shrink: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.chip-dot--symbol {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: black;
  line-height: 1.5;
}

.chip-label {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: #333;
  white-space: nowrap;
}

/* ── Left column: stacks the two circular buttons vertically ── */
#float-left-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── Circular float button (3rd element in ui-float-top) ── */
.float-circle-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.float-circle-btn:hover {
  background: var(--bg-chip);
  color: var(--zeri-blue-dark);
  border-color: #c9ddf0;
}

.info-section h5 {
  color: var(--zeri-blue-dark);
}

/* ── Non più esistente marker ── */
.place-marker--ex {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.30);
}

.place-marker--ex .fa-asterisk {
  font-size: 7px;
  color: #fff;
  line-height: 1;
}

/* ── Active marker ── */
/* circleMarker (SVG path) */
path.active-marker {
  stroke: #1a1a18;
  stroke-width: 3;
  filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.45));
}

/* divIcon marker (non più esistente) */
.active-marker .place-marker--ex {
  border-color: #1a1a18;
  border-width: 2.5px;
  filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.45));
  transform: scale(1.25);
}

/* ── Marker cluster icon ── */
.cluster-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff;
  border: 1.5px solid rgba(0, 0, 0, 0.55);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cluster-icon .fa-plus {
  font-size: 18px;
  line-height: 1;
  color: rgba(0, 0, 0, 0.65);
}

/* ── Filter chip states ── */
.chip[data-category] {
  cursor: pointer;
  transition: opacity 0.18s;
  user-select: none;
}

.chip[data-category]:not(.chip--active) {
  opacity: 0.32;
}

/* ── Tooltip ── */
.leaflet-tooltip {
  font-family: var(--font-sans);
}

/* ── Floating popup panel (bottom-left) ── */

#ui-float-popup {
  bottom: 24px;
  left: 24px;
  transform: translateY(6px);
}

#ui-float-popup.visible {
  transform: translateY(0);
}

#popup-content {
  width: 500px;
  /*height: 500px;*/
  border-radius: 16px;
}

#popup-body {
  width: 100%;
  height: 100%;
  border: none;  
}

#popup-header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 0.5rem;
}

#popup-header-text {
  flex: 1;
  min-width: 0;
}

#popup-title-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.popup-site-link {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  color: var(--zeri-blue-dark);
  font-size: 1.35rem;
  text-decoration: none;
  line-height: 1;
  transition: color 0.15s;
}

.popup-site-link:hover {
  color: var(--zeri-blue);
}

.card-img-link {
  display: flex;
  cursor: pointer;
}

.card-img-link[href="#"] {
  pointer-events: none;
  cursor: default;
}

.card-img-link img {
  transition: opacity 0.15s;
}

.card-img-link:not([href="#"]):hover img {
  opacity: 0.85;
}

#non-existing-place-text {
  color: var(--text-danger-muted);
  font-style: italic;
}

#card-img-container {
  display: flex;
  justify-content: center;
  margin: 5% 0;
}

#card-img {
  max-height: 250px;
  width: auto;
  object-fit: cover;
}

.btn-catalog-container a {
  width: 100%;
}

/* ── Bootstrap primary → Zeri blue ── */
:root {
  --zeri-btn:           #2e6da4;
  --zeri-btn-dark:      #1d5a8e;
  --zeri-btn-sec:       #5f6b7a;
  --zeri-btn-sec-dark:  #445060;
}

.btn-primary {
  --bs-btn-bg:                  var(--zeri-btn);
  --bs-btn-border-color:        var(--zeri-btn);
  --bs-btn-hover-bg:            var(--zeri-btn-dark);
  --bs-btn-hover-border-color:  var(--zeri-btn-dark);
  --bs-btn-active-bg:           var(--zeri-btn-dark);
  --bs-btn-active-border-color: var(--zeri-btn-dark);
  --bs-btn-disabled-bg:         var(--zeri-btn);
  --bs-btn-disabled-border-color:var(--zeri-btn);
  --bs-btn-color:               #fff;
}

.btn-outline-primary {
  --bs-btn-color:               var(--zeri-btn);
  --bs-btn-border-color:        var(--zeri-btn);
  --bs-btn-hover-color:         #fff;
  --bs-btn-hover-bg:            var(--zeri-btn);
  --bs-btn-hover-border-color:  var(--zeri-btn);
  --bs-btn-active-color:        #fff;
  --bs-btn-active-bg:           var(--zeri-btn-dark);
  --bs-btn-active-border-color: var(--zeri-btn-dark);
  --bs-btn-disabled-color:      var(--zeri-btn);
  --bs-btn-disabled-border-color:var(--zeri-btn);
}

.btn-secondary {
  --bs-btn-bg:                  var(--zeri-btn-sec);
  --bs-btn-border-color:        var(--zeri-btn-sec);
  --bs-btn-hover-bg:            var(--zeri-btn-sec-dark);
  --bs-btn-hover-border-color:  var(--zeri-btn-sec-dark);
  --bs-btn-active-bg:           var(--zeri-btn-sec-dark);
  --bs-btn-active-border-color: var(--zeri-btn-sec-dark);
  --bs-btn-disabled-bg:         var(--zeri-btn-sec);
  --bs-btn-disabled-border-color:var(--zeri-btn-sec);
  --bs-btn-color:               #fff;
}

.btn-outline-secondary {
  --bs-btn-color:               var(--zeri-btn-sec);
  --bs-btn-border-color:        var(--zeri-btn-sec);
  --bs-btn-hover-color:         #fff;
  --bs-btn-hover-bg:            var(--zeri-btn-sec);
  --bs-btn-hover-border-color:  var(--zeri-btn-sec);
  --bs-btn-active-color:        #fff;
  --bs-btn-active-bg:           var(--zeri-btn-sec-dark);
  --bs-btn-active-border-color: var(--zeri-btn-sec-dark);
  --bs-btn-disabled-color:      var(--zeri-btn-sec);
  --bs-btn-disabled-border-color:var(--zeri-btn-sec);
}

/* ── Sites list modal ── */
.site-list-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 10px 6px;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.12s, color 0.12s, padding-left 0.12s;
}

.site-list-item:hover {
  background: var(--bg-chip);
  color: var(--zeri-blue-dark);
  padding-left: 12px;
}

.site-list-item:last-child {
  border-bottom: none;
}

.modal-carisbo {
  --bs-modal-width: min(900px, calc(100vw - 2 * var(--bs-modal-margin, 0.5rem)));
}

/* ── Smartphone ── */
@media (max-width: 576px) {
  #ui-float-top {
    top: 12px;
    left: 12px;
  }

  /* CTA pill: full viewport width */
  .float-pill--cta {
    width: calc(60vw);
  }

  /* Legend float: collassa a icona, si espande al tap/hover */
  #legend-float {
    width: 44px;
    border-radius: 50%;
    transition: width 0.22s ease 0.15s, border-radius 0.22s ease 0.15s;
  }

  #legend-float:hover {
    width: min(300px, calc(100vw - 78px)); /* 78 = left 12 + right 12 + circle 44 + gap 10 */
    border-radius: 16px;
    transition: width 0.2s ease, border-radius 0.2s ease;
  }

  #legend-float-icon {
    color: var(--text-primary);
  }

  #legend-float:hover #legend-float-icon {
    color: var(--zeri-blue-dark);
  }

  #legend-float-body {
    max-height: 0;
    overflow: hidden;
    padding-top: 0;
    padding-bottom: 0;
    transition: max-height 0.15s ease, padding 0.15s ease;
  }

  #legend-float:hover #legend-float-body {
    max-height: 300px;
    padding-bottom: 14px;
    transition: max-height 0.3s ease 0.08s, padding 0.3s ease 0.08s;
  }

  #ui-float-popup {
    left: 12px;
    bottom: 12px;
  }

  #popup-content {
    width: calc(100vw - 24px);
  }

  #card-img {
    max-height: 160px;
  }

  .hero-sponsor-img {
    max-height: 22px;
  }

  #hero-sponsor-logos {
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
  }
}
