/* Custom styles for Val di Tora */

/* Sidebar logo: prevent squishing when sidebar is resized */
#sidebar .flex.items-center.gap-3 > div:first-child {
  flex-shrink: 0;
}
#sidebar .flex.items-center.gap-3 > div:last-child {
  min-width: 0;
  overflow: hidden;
}
#sidebar .flex.items-center.gap-3 > div:last-child h1,
#sidebar .flex.items-center.gap-3 > div:last-child p {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Sidebar resize handle */
#sidebarResizeHandle {
  position: absolute;
  top: 0;
  right: 0;
  width: 5px;
  height: 100%;
  cursor: col-resize;
  z-index: 10;
  transition: background 0.15s;
}
#sidebarResizeHandle:hover,
#sidebarResizeHandle:active {
  background: rgba(23, 207, 176, 0.35);
}
@media (max-width: 767px) {
  #sidebarResizeHandle { display: none; }
}

.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

.hide-scrollbar::-webkit-scrollbar {
    display: none;
}

.hide-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Map background with gradient */
.map-bg {
    background: 
        radial-gradient(circle at 30% 40%, rgba(23, 207, 176, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 70% 60%, rgba(59, 130, 246, 0.1) 0%, transparent 50%),
        linear-gradient(135deg, #d4e4dd 0%, #b8cfc5 100%);
}


/* Smooth transitions */
* {
    transition-property: color, background-color, border-color, transform, opacity;
    transition-duration: 200ms;
    transition-timing-function: ease-in-out;
}

/* Custom animations */
@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.animate-bounce {
    animation: bounce 2s infinite;
}

.delay-75 {
    animation-delay: 0.2s;
}

.delay-100 {
    animation-delay: 0.4s;
}

/* Card hover effects */
.group:hover .group-hover\:scale-110 {
    transform: scale(1.1);
}

.group:hover .group-hover\:scale-105 {
    transform: scale(1.05);
}

/* Fade in animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* Timeline selector active state */
.timeline-selector:checked + label {
    background-color: #17cfb0;
    color: white;
}

/* Loading spinner */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.spinner {
    border: 3px solid rgba(23, 207, 176, 0.2);
    border-top-color: #17cfb0;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

/* Responsive utilities */
@media (max-width: 768px) {
    main {
        margin-left: 0 !important;
    }
}

/* Dark mode improvements */
.dark {
    color-scheme: dark;
}

/* Selection color */
::selection {
    background-color: rgba(23, 207, 176, 0.3);
    color: inherit;
}

/* Focus styles */
button:focus,
a:focus,
input:focus,
select:focus {
    outline: 2px solid #17cfb0;
    outline-offset: 2px;
}

/* Custom scrollbar for webkit browsers */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.dark ::-webkit-scrollbar-track {
    background: #1a2b28;
}

::-webkit-scrollbar-thumb {
    background: #17cfb0;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #14b89a;
}


/* --- Mobile layout tweaks --- */
@media (max-width: 767px) {
  /* make horizontal carousels easier */
  .hide-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }
  .hide-scrollbar::-webkit-scrollbar { display: none; }
}

/* Hide Material Icons text while font loads — JS removes this class once fonts are ready */
html.icons-loading .material-symbols-outlined {
  opacity: 0;
}
.material-symbols-outlined {
  transition: opacity 0.15s ease;
}
/* iOS safe areas */
body { padding-bottom: env(safe-area-inset-bottom); }


/* --- Strong mobile overrides (ensures responsive layout) --- */
@media (max-width: 767px) {
  /* Sidebar should overlay and not reserve space */
  #sidebar {
    width: 82vw;
    max-width: 22rem;
  }

  /* Main content must not be shifted by desktop sidebar */
  main {
    margin-left: 0 !important;
  }

  /* Common fixed-width elements -> fluid on mobile */
  .w-96 { width: calc(100vw - 2.5rem) !important; max-width: 28rem !important; }
  .w-72 { width: 82vw !important; max-width: 22rem !important; }

  /* Prevent oversized headings */
  h1.text-6xl, h1.text-7xl, h1.text-8xl { font-size: 2.5rem !important; line-height: 1.1 !important; }
  h1.text-5xl { font-size: 2.25rem !important; line-height: 1.1 !important; }
}


/* ============================================================
   KIOSK / TOTEM  –  Overlay di inattività
   ============================================================ */

#kiosk-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgb(5, 12, 11);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.45s ease;
}

#kiosk-overlay.kiosk-overlay--visible {
  opacity: 1;
}

.kiosk-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  padding: 2rem;
  text-align: center;
}

.kiosk-brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  text-align: left;
}

.kiosk-brand-logo {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: contain;
  flex-shrink: 0;
}

.kiosk-brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.kiosk-brand-title {
  font-family: 'Lexend', sans-serif;
  font-size: clamp(1.35rem, 2.2vw, 1.9rem);
  font-weight: 700;
  color: #ffffff;
  margin: 0;
  line-height: 1.1;
}

.kiosk-brand-subtitle {
  font-family: 'Lexend', sans-serif;
  font-size: clamp(0.75rem, 1.2vw, 0.95rem);
  font-weight: 500;
  letter-spacing: 0.22em;
  color: rgba(230, 235, 233, 0.72);
  margin: 0;
}

.kiosk-label {
  font-family: 'Lexend', sans-serif;
  font-size: clamp(1.2rem, 3vw, 1.75rem);
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
  letter-spacing: 0.03em;
  max-width: 540px;
  line-height: 1.4;
  margin: 0;
}

@media (max-width: 640px) {
  .kiosk-brand {
    gap: 0.75rem;
  }

  .kiosk-brand-logo {
    width: 48px;
    height: 48px;
  }

  .kiosk-brand-subtitle {
    letter-spacing: 0.14em;
  }
}

.kiosk-btn {
  font-family: 'Lexend', sans-serif;
  font-size: clamp(1.1rem, 2.5vw, 1.5rem);
  font-weight: 700;
  color: #ffffff;
  background: #17cfb0;
  border: none;
  border-radius: 9999px;
  padding: 1.25rem 3rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 0 0 0 rgba(23, 207, 176, 0.5);
  animation: kiosk-pulse 2.2s ease-in-out infinite;
  transition: background 0.2s ease, transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.kiosk-btn:hover,
.kiosk-btn:focus {
  background: #13b89a;
  outline: none;
}

.kiosk-btn:active {
  transform: scale(0.97);
}

.kiosk-btn .material-symbols-outlined {
  font-size: 1.8rem !important;
}

@keyframes kiosk-pulse {
  0%   { box-shadow: 0 0 0  0px rgba(23, 207, 176, 0.55); transform: scale(1); }
  50%  { box-shadow: 0 0 0 28px rgba(23, 207, 176, 0);    transform: scale(1.04); }
  100% { box-shadow: 0 0 0  0px rgba(23, 207, 176, 0);    transform: scale(1); }
}

/* Ensure Leaflet stays below sidebar/overlays */
.leaflet-pane, .leaflet-control { z-index: 500; }

/* Two-finger gesture hint overlay */
.map-gesture-hint {
  position: absolute;
  inset: 0;
  z-index: 800;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  color: #ffffff;
  font-family: 'Lexend', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  padding: 1rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
  border-radius: inherit;
}

.map-gesture-hint .material-symbols-outlined {
  font-size: 2.2rem;
  opacity: 0.9;
}

.map-gesture-hint--visible {
  opacity: 1;
}

/* --- Mobile polish pass --- */
@media (max-width: 767px) {
  /* Reduce giant headings generated by Tailwind classes */
  .text-6xl { font-size: 2.4rem !important; line-height: 1.05 !important; }
  .text-5xl { font-size: 2.1rem !important; line-height: 1.08 !important; }
  .text-4xl { font-size: 1.8rem !important; line-height: 1.1 !important; }

  /* Ensure hero text stays readable and doesn't crowd */
  #heroTitle { font-size: 1.5rem !important; line-height: 1.15 !important; }
  #heroText { font-size: 0.95rem !important; }

  /* Sidebar spacing */
  #sidebar { padding-top: env(safe-area-inset-top); }

}

/* --- Layout safety: prevent clipping on mobile --- */
html, body { height: auto; min-height: 100%; }
main { width: 100%; }

/* Ensure content doesn't touch edges on pages without inner padding */
@media (max-width: 767px) {
  .max-w-6xl.mx-auto, .max-w-5xl.mx-auto { padding-left: 1rem; padding-right: 1rem; }
}

/* ============================================================
   MOBILE / TABLET TOP HEADER  (< 1024px)
   ============================================================ */
#mobile-header {
  display: none;
}

@media (max-width: 1023px) {
  #mobile-header {
    display: flex;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    z-index: 3050;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid #e5e7e7;
    padding: 0 1rem;
  }

  .dark #mobile-header {
    background: rgba(26, 43, 40, 0.96);
    border-bottom-color: #2d3d3a;
  }

  .mobile-header-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 0.5rem;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #111817;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
  }

  .dark .mobile-header-menu-btn {
    color: #ffffff;
  }

  .mobile-header-menu-btn:hover {
    background: #f0f4f4;
  }

  .dark .mobile-header-menu-btn:hover {
    background: #253633;
  }

  .mobile-header-brand {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    white-space: nowrap;
    text-decoration: none;
  }

  .mobile-header-logo {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: contain;
    flex-shrink: 0;
  }

  .mobile-header-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
  }

  .mobile-header-title {
    font-family: 'Lexend', sans-serif;
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.15;
    color: #111817;
  }

  .dark .mobile-header-title {
    color: #ffffff;
  }

  .mobile-header-subtitle {
    font-family: 'Lexend', sans-serif;
    font-size: 0.58rem;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #638882;
  }

  .dark .mobile-header-subtitle {
    color: #8eb3ad;
  }

  /* Push all page content below the header */
  main {
    padding-top: 60px !important;
  }
}

/* ============================================================
   SITE FOOTER
   ============================================================ */
#site-footer {
  background: #ffffff;
  border-top: 1px solid #e5e7e7;
  padding: 3rem 2.5rem 2rem;
  margin-left: 0;
}

.dark #site-footer {
  background: #1a2b28;
  border-top-color: #2d3d3a;
}

/* Desktop: account for fixed sidebar */
@media (min-width: 768px) {
  #site-footer {
    margin-left: 18rem;
  }
}

.footer-inner {
  max-width: 64rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

@media (min-width: 640px) {
  .footer-inner {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
  }
}

.footer-brand {
  max-width: 22rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.footer-brand-logo-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.footer-brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: contain;
  flex-shrink: 0;
}

.footer-brand-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.footer-brand-name {
  font-family: 'Lexend', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
  color: #111817;
}

.dark .footer-brand-name {
  color: #ffffff;
}

.footer-brand-tagline {
  font-family: 'Lexend', sans-serif;
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #638882;
}

.dark .footer-brand-tagline {
  color: #8eb3ad;
}

.footer-desc {
  font-size: 0.8rem;
  line-height: 1.65;
  color: #638882;
  font-style: italic;
  margin: 0;
}

.dark .footer-desc {
  color: #8eb3ad;
}

.footer-links {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2.5rem;
  flex-shrink: 0;
}

.footer-col-title {
  font-family: 'Lexend', sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #638882;
  margin: 0 0 0.85rem 0;
}

.dark .footer-col-title {
  color: #8eb3ad;
}

.footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.footer-col ul li a {
  font-size: 0.875rem;
  font-weight: 500;
  color: #111817;
  text-decoration: none;
  transition: color 0.2s;
}

.dark .footer-col ul li a {
  color: #e2eded;
}

.footer-col ul li a:hover {
  color: #17cfb0;
}

.footer-bottom {
  max-width: 64rem;
  margin: 2rem auto 0;
  padding-top: 1.25rem;
  border-top: 1px solid #e5e7e7;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  text-align: center;
  font-size: 0.7rem;
  color: #638882;
}

.dark .footer-bottom {
  border-top-color: #2d3d3a;
  color: #8eb3ad;
}
