/* ==========================================================================
   TENUTA MARANGONE - Official Web Platform Stylesheet
   Luxury Editorial Design System: Italian Country Estate & Heritage
   ========================================================================== */

:root {
  --color-primary: #172a1e;       /* Deep Evergreen Forest */
  --color-primary-light: #254431;
  --color-accent: #c69c4e;        /* Tuscan Gold / Warm Champagne */
  --color-accent-light: #dfbe7d;
  --color-accent-dark: #997532;
  --color-bg-light: #faf8f5;      /* Natural Travertine / Linen */
  --color-bg-card: #ffffff;
  --color-text-main: #232926;
  --color-text-muted: #5e6863;
  --color-border: #e6e0d6;
  --color-cream: #f4efe6;
  
  --font-serif: 'Cormorant Garamond', 'Playfair Display', Georgia, serif;
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  
  --shadow-sm: 0 2px 8px rgba(23, 42, 30, 0.05);
  --shadow-md: 0 8px 24px rgba(23, 42, 30, 0.08);
  --shadow-lg: 0 16px 40px rgba(23, 42, 30, 0.12);
  --shadow-xl: 0 24px 60px rgba(23, 42, 30, 0.18);
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  background-color: var(--color-bg-light);
  color: var(--color-text-main);
  font-family: var(--font-sans);
}

body {
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1, h2, h3, h4, .font-serif {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.2;
}

/* Luxury Utilities */
.text-gold {
  color: var(--color-accent);
}
.bg-forest {
  background-color: var(--color-primary);
}
.bg-cream {
  background-color: var(--color-cream);
}
.border-gold {
  border-color: var(--color-accent);
}

.gold-gradient-text {
  background: linear-gradient(135deg, #dfbe7d 0%, #c69c4e 50%, #997532 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.gold-gradient-bg {
  background: linear-gradient(135deg, #dfbe7d 0%, #c69c4e 50%, #997532 100%);
}

.glass-nav {
  background: rgba(23, 42, 30, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.glass-card {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.6);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--color-bg-light);
}
::-webkit-scrollbar-thumb {
  background: #c2baaf;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-accent);
}

/* ==========================================================================
   KILLER FEATURE: BEFORE & AFTER COMPARATOR
   ========================================================================== */

.comparator-container {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: 680px;
  overflow: hidden;
  border-radius: 1rem;
  box-shadow: var(--shadow-xl);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none; /* Crucial for mobile touchscreen dragging */
  background-color: #0f1c14;
}

.comparator-image-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 5;
}

.comparator-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

/* Foreground Clipped Real Layer */
.comparator-real-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 10;
  will-change: clip-path;
}

.comparator-real-layer img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

/* Backward compatibility */
.comparator-after-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  will-change: width;
}

.comparator-after-layer img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

/* Divider Handle */
.comparator-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 4px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 14px rgba(0, 0, 0, 0.45);
  cursor: ew-resize;
  z-index: 20;
  touch-action: none;
  transform: translateX(-50%);
  will-change: left;
}

.comparator-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--color-accent);
  border: 3px solid #ffffff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  cursor: ew-resize;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease;
}

/* Expanded invisible touch hit area for fingers on mobile */
.comparator-handle::after {
  content: '';
  position: absolute;
  top: -16px;
  bottom: -16px;
  left: -16px;
  right: -16px;
  border-radius: 50%;
  pointer-events: auto;
}

.comparator-handle:hover,
.comparator-container.is-dragging .comparator-handle {
  transform: translate(-50%, -50%) scale(1.12);
  box-shadow: 0 6px 20px rgba(198, 156, 78, 0.6);
}

.comparator-handle svg {
  width: 24px;
  height: 24px;
  stroke-width: 2.5;
  pointer-events: none;
}

/* Badges - Bollino REAL Blu & Bollino AI Rosso */
.badge-state {
  position: absolute;
  top: 1.25rem;
  padding: 0.45rem 0.9rem;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  z-index: 25;
  pointer-events: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 1.5px solid rgba(255, 255, 255, 0.5);
  white-space: nowrap;
}

.bollino-dot {
  width: 9px;
  height: 9px;
  border-radius: 9999px;
  display: inline-block;
  flex-shrink: 0;
}

/* Bollino REAL Blu */
.badge-before {
  left: 1.25rem;
  background: rgba(29, 78, 216, 0.92); /* Rich Royal Blue */
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(29, 78, 216, 0.45);
}

.bollino-blue {
  background-color: #93c5fd;
  box-shadow: 0 0 8px rgba(147, 197, 253, 0.9);
}

/* Bollino AI Rosso */
.badge-after {
  right: 1.25rem;
  background: rgba(220, 38, 38, 0.92); /* Vivid Crimson Red */
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.45);
}

.bollino-red {
  background-color: #fca5a5;
  box-shadow: 0 0 8px rgba(252, 165, 165, 0.9);
}

@media (max-width: 640px) {
  .badge-state {
    top: 0.75rem;
    padding: 0.35rem 0.65rem;
    font-size: 0.65rem;
    gap: 0.35rem;
  }
  .badge-before {
    left: 0.75rem;
  }
  .badge-after {
    right: 0.75rem;
  }
}

/* Tabs */
.comparator-tab {
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  background-color: #ffffff;
  color: #44403c;
  border: 1px solid #e7e5e4;
}

.comparator-tab:hover {
  background-color: #f5f5f4;
  color: #1c1917;
  border-color: #d6d3d1;
}

.comparator-tab:active {
  transform: scale(0.97);
}

.comparator-tab.active {
  background-color: #172a1e !important;
  color: #ffffff !important;
  border-color: #c69c4e !important;
  box-shadow: 0 4px 14px rgba(23, 42, 30, 0.25) !important;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
  animation: fadeIn 0.45s ease forwards;
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 18, 0.8);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: #ffffff;
  border-radius: 1.25rem;
  max-width: 640px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  transform: translateY(20px);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 110;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 320px;
  max-width: 440px;
  background: #ffffff;
  border-left: 4px solid var(--color-accent);
  box-shadow: var(--shadow-lg);
  border-radius: 0.5rem;
  padding: 1rem 1.25rem;
  font-size: 0.92rem;
}

/* ==========================================================================
   MOBILE MENU & NAVIGATION FIXES
   ========================================================================== */

#mobileMenu {
  background-color: #0b1610 !important;
  opacity: 1 !important;
  z-index: 99999 !important;
  overflow-y: auto;
}

#mobileMenu.hidden {
  display: none !important;
}

#mobileMenu:not(.hidden) {
  display: flex !important;
}

/* ==========================================================================
   DUAL SOUL TABS (RESIDENZA VS BUSINESS) - CLEAR COLOR FEEDBACK
   ========================================================================== */

.soul-tab-btn {
  transition: all 0.25s ease-in-out;
  cursor: pointer;
}

.active-soul {
  background-color: #172a1e !important;
  color: #dfbe7d !important;
  border: 2px solid #c69c4e !important;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35) !important;
  transform: translateY(-2px);
}

.inactive-soul {
  background-color: #ffffff !important;
  color: #57534e !important;
  border: 2px solid #e7e5e4 !important;
  opacity: 0.85;
}

.inactive-soul:hover {
  background-color: #f5f5f4 !important;
  color: #172a1e !important;
  opacity: 1;
}

/* ==========================================================================
   REAL PHOTO GALLERY FILTER TABS
   ========================================================================== */

.gallery-filter-btn {
  padding: 0.5rem 1.25rem;
  border-radius: 9999px;
  font-size: 0.82rem;
  font-weight: 600;
  border: 1px solid #d6d3d1;
  background-color: #ffffff;
  color: #57534e;
  transition: all 0.2s ease;
  cursor: pointer;
}

.gallery-filter-btn:hover {
  background-color: #f5f5f4;
  color: #172a1e;
  border-color: #a8a29e;
}

.gallery-filter-btn.active {
  background-color: #172a1e;
  color: #dfbe7d;
  border-color: #c69c4e;
  box-shadow: 0 2px 10px rgba(23, 42, 30, 0.2);
}

.gallery-item {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.gallery-item.hidden-item {
  display: none !important;
}



@media (max-width: 1023px) {
  #mobileMenuBtn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    flex-shrink: 0 !important;
    z-index: 100;
  }
}
