/* ============================================
   Imperial Club – style.css (ottimizzato)
   ============================================ */

/* Font fallback stack mentre Google Fonts carica */
:root {
  --primary: #ef4444;
  --primary-dark: #dc2626;
  --background: #0a0a0a;
  --card: #1a1a1a;
  --foreground: #f5f5f5;
  --muted: #404040;
  --border: #262626;
  --text-muted: #a3a3a3;

  /* Tipografia */
  --font-display: 'Cormorant Garamond', 'Georgia', serif;
  --font-body: 'Jost', 'Helvetica Neue', Arial, sans-serif;

  /* Spacing scale */
  --section-padding: clamp(3rem, 8vw, 6rem);
}

/* ============ Reset ============ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ============ Base ============ */
html {
  scroll-behavior: smooth;
  /* Migliora la leggibilità su Retina */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Prevent layout shift da scrollbar */
  scrollbar-gutter: stable;
}

body {
  font-family: var(--font-body);
  background-color: var(--background);
  color: var(--foreground);
  line-height: 1.6;
  /* Migliora la performance del rendering */
  text-rendering: optimizeSpeed;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

address {
  font-style: normal;
}

/* ============ Container ============ */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* ============ Navigation ============ */
nav {
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 100;
  transition: background 0.3s ease, border-color 0.3s ease;
  background: transparent;
  border-bottom: 1px solid transparent;
  /* GPU compositing layer – evita repaint durante scroll */
  will-change: background;
}

nav.scrolled {
  background: rgba(10, 10, 10, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom-color: var(--border);
}

nav .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 80px;
}

.logo img {
  height: 64px;
  width: 64px;
  object-fit: contain;
}

/* Nav links – uso <a> veri anziché <button> per navigazione */
.nav-menu {
  display: flex;
  gap: 2rem;
  list-style: none;
}

.nav-menu a {
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--foreground);
  transition: color 0.3s ease;
  padding: 0.25rem 0;
  /* Underline animato */
  background-image: linear-gradient(var(--primary), var(--primary));
  background-size: 0 2px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: color 0.3s ease, background-size 0.3s ease;
}

.nav-menu a:hover,
.nav-menu a:focus-visible {
  color: var(--primary);
  background-size: 100% 2px;
  outline: none;
}

/* ============ Mobile Menu Button ============ */
.mobile-menu-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  width: 40px;
  height: 40px;
}

.mobile-menu-btn span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--foreground);
  transition: transform 0.3s ease, opacity 0.3s ease;
  transform-origin: center;
}

.mobile-menu-btn[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.mobile-menu-btn[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}
.mobile-menu-btn[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ============ Mobile Nav Dropdown ============ */
.nav-mobile {
  display: none;
  background: rgba(10, 10, 10, 0.98);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding: 1.5rem 2rem;
}

.nav-mobile.open {
  display: block;
}

.nav-mobile ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.nav-mobile a {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--foreground);
  transition: color 0.2s ease;
}

.nav-mobile a:hover {
  color: var(--primary);
}

@media (max-width: 768px) {
  .nav-menu { display: none; }
  .mobile-menu-btn { display: flex; }
}

/* ============ Hero ============ */
.hero {
  position: relative;
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  /* background-attachment:fixed causa repaint su ogni scroll su mobile.
     Sostituiamo con una soluzione che usa transform per il parallax. */
  background-image: url('../images/005.webp');
  background-size: cover;
  background-position: center;
  /* Promuoviamo su GPU layer per evitare repaint */
  will-change: transform;
  z-index: 0;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 1;
}

.hero .container {
  position: relative;
  z-index: 10;
  padding-top: 80px; /* Compensa la nav fixed */
}

.hero-content {
  max-width: 42rem;
}

.hero-content h1 {
  font-size: clamp(2.5rem, 8vw, 5rem);
  margin-bottom: 1.5rem;
}

.hero-content h1 .accent {
  color: var(--primary);
}

.hero-content > p {
  font-size: 1.125rem;
  color: #d1d5db;
  margin-bottom: 2rem;
  line-height: 1.8;
}

.hero-buttons {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ============ Scroll Indicator ============ */
.scroll-indicator {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  color: var(--primary);
  animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%       { transform: translateX(-50%) translateY(10px); }
}

/* ============ Buttons ============ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 2rem;
  border: none;
  border-radius: 0.5rem;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.15s ease, box-shadow 0.3s ease;
  text-decoration: none;
}

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

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 4px 20px rgba(239,68,68,0.3);
}

.btn-whatsapp {
  background: #25D366;
  color: #fff;
}
.btn-whatsapp:hover {
  background: #20BA5A;
  box-shadow: 0 4px 20px rgba(37,211,102,0.3);
}

.btn-outline {
  border: 2px solid var(--foreground);
  color: var(--foreground);
  background: transparent;
}
.btn-outline:hover {
  background: var(--foreground);
  color: var(--background);
}

/* ============ Labels ============ */
.label {
  color: var(--primary);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  margin-bottom: 1rem;
  display: block;
}

/* ============ Sections ============ */
section {
  padding: var(--section-padding) 0;
}

section.bg-card       { background: var(--card); }
section.bg-background { background: var(--background); }

.section-header {
  text-align: center;
  margin-bottom: 4rem;
}

.section-header h2 {
  font-size: clamp(2rem, 5vw, 3.5rem);
}

/* ============ About ============ */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
}

.about-content h2 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  margin-bottom: 1.5rem;
}

.about-content h2 .accent {
  color: var(--primary);
}

.about-content p {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  line-height: 1.8;
  font-size: 1.0625rem;
}

.about-image {
  border-radius: 0.5rem;
  overflow: hidden;
  min-height: 400px;
  /* Aspect ratio per evitare layout shift */
  aspect-ratio: 3/2;
}

.about-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 768px) {
  .about-grid {
    grid-template-columns: 1fr;
  }
  .about-image { min-height: 260px; }
}

/* ============ Events ============ */
.events-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
}

.event-card {
  border-radius: 0.5rem;
  overflow: hidden;
  background: var(--card);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.event-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(0,0,0,0.4);
}

.event-image {
  position: relative;
  /* aspect-ratio evita il layout shift mentre le immagini caricano */
  aspect-ratio: 3/2;
  overflow: hidden;
}

.event-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.event-card:hover .event-image img {
  transform: scale(1.06);
}

.event-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.35);
  transition: background 0.3s ease;
}

.event-card:hover .event-overlay {
  background: rgba(0,0,0,0.15);
}

.event-content {
  padding: 1.5rem;
}

.event-date {
  color: var(--primary);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  margin-bottom: 0.5rem;
  display: block;
}

.event-content h3 {
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
}

.event-content p {
  color: var(--text-muted);
  line-height: 1.6;
  font-size: 0.9375rem;
  margin-bottom: 1.25rem;
}

.btn-event-wa {
  width: 100%;
  justify-content: center;
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
}

/* ============ Instagram ============ */
.instagram-feed {
  max-width: 600px;
  margin: 0 auto;
}

.instagram-post {
  border-radius: 0.5rem;
  overflow: hidden;
  background: var(--card);
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.instagram-post iframe {
  border-radius: 0.5rem;
  max-width: 100%;
  display: block;
}

.instagram-cta {
  text-align: center;
}

.facebook-feed {
  max-width: 600px;
  margin: 0 auto;
}

.facebook-post {
  border-radius: 0.5rem;
  overflow: hidden;
  background: var(--card);
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.facebook-post iframe {
  border-radius: 0.5rem;
  max-width: 100%;
  display: block;
}

.facebook-cta {
  text-align: center;
}

/* ============ Partners Slider ============ */
.partners-section {
  padding: 4rem 0;
  overflow: hidden;
}

.partners-track-wrapper {
  overflow: hidden;
  width: 100%;
  mask-image: linear-gradient(to right, transparent 0%, black 10%, black 90%, transparent 100%);
  -webkit-mask-image: linear-gradient(to right, transparent 0%, black 10%, black 90%, transparent 100%);
}

.partners-track {
  display: flex;
  align-items: center;
  gap: 4rem;
  width: max-content;
  animation: scroll-left 18s linear infinite;
}

.partners-track:hover {
  animation-play-state: paused;
}

@keyframes scroll-left {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.partner-logo {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 80px;
  padding: 0 1rem;
}

.partner-logo img {
  max-height: 70px;
  max-width: 180px;
  width: auto;
  object-fit: contain;
  filter: invert(1) brightness(0.7);
  opacity: 0.6;
  transition: opacity 0.3s ease, filter 0.3s ease;
}

.partner-logo img:hover {
  opacity: 1;
  filter: invert(1) brightness(1);
}

/* ============ Gallery ============ */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.gallery-item {
  position: relative;
  border-radius: 0.5rem;
  overflow: hidden;
  aspect-ratio: 3/2;
}

/* Foto 1: panoramica full-width */
.gallery-item--large {
  grid-column: 1 / -1;
  aspect-ratio: 16/7;
}

/* Foto 2 e 3: metà larghezza ciascuna (2 colonne su 4) */
.gallery-item:nth-child(2),
.gallery-item:nth-child(3) {
  grid-column: span 2;
}

/* Foto 4 e 5: un quarto ciascuna */
.gallery-item:nth-child(4),
.gallery-item:nth-child(5) {
  grid-column: span 2;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.gallery-item:hover img {
  transform: scale(1.04);
}

.gallery-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0);
  transition: background 0.3s ease;
}

.gallery-item:hover .gallery-overlay {
  background: rgba(0,0,0,0.2);
}

@media (max-width: 640px) {
  .gallery-grid {
    grid-template-columns: 1fr;
  }
  .gallery-item--large,
  .gallery-item:nth-child(2),
  .gallery-item:nth-child(3),
  .gallery-item:nth-child(4),
  .gallery-item:nth-child(5) {
    grid-column: 1;
    aspect-ratio: 3/2;
  }
}

/* ============ Contact ============ */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: start;
}

.contact-info h2 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  margin-bottom: 2rem;
}

.contact-info h3 {
  font-size: 1rem;
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-weight: 600;
}

.contact-info p {
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.contact-info a {
  color: var(--foreground);
  transition: color 0.2s ease;
}

.contact-info a:hover {
  color: var(--primary);
}

.contact-block {
  margin-bottom: 2rem;
}

.social-links {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.social-links a {
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--foreground);
  transition: color 0.2s ease;
  border-bottom: 1px solid transparent;
}

.social-links a:hover {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

@media (max-width: 768px) {
  .contact-grid {
    grid-template-columns: 1fr;
  }
}

/* ============ Form ============ */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.form-group input,
.form-group select,
.form-group textarea {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--foreground);
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  font-family: var(--font-body);
  font-size: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  appearance: none;
  -webkit-appearance: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(239,68,68,0.15);
}

.form-group input.invalid,
.form-group select.invalid,
.form-group textarea.invalid {
  border-color: #f87171;
}

.form-error {
  font-size: 0.8rem;
  color: #f87171;
  min-height: 1rem;
  display: block;
}

.form-group textarea {
  resize: vertical;
  min-height: 110px;
}

.form-whatsapp-hint {
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.form-whatsapp-hint a {
  color: #25D366;
  font-weight: 600;
  transition: color 0.2s ease;
}

.form-whatsapp-hint a:hover {
  color: #20BA5A;
  text-decoration: underline;
}

.form-success {
  text-align: center;
  color: #4ade80;
  font-weight: 600;
  padding: 0.75rem;
  border: 1px solid #4ade80;
  border-radius: 0.5rem;
  margin-top: 0.5rem;
}

/* ============ Footer ============ */
footer {
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 3rem 0;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-logo img {
  height: 56px;
  width: 56px;
  object-fit: contain;
  margin-bottom: 1rem;
}

.footer-col h4 {
  font-size: 1rem;
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: var(--font-body);
  font-weight: 600;
}

.footer-col p {
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.7;
}

.footer-col ul {
  list-style: none;
}

.footer-col ul li {
  margin-bottom: 0.5rem;
}

.footer-col ul li a {
  color: var(--text-muted);
  font-size: 0.9rem;
  transition: color 0.2s ease;
}

.footer-col ul li a:hover {
  color: var(--primary);
}

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 2rem;
  text-align: center;
  color: #6b7280;
  font-size: 0.875rem;
}

/* ============ Reveal Animations ============ */
/* Usiamo CSS per le animazioni e IntersectionObserver nel JS */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.65s ease, transform 0.65s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-delay-1 { transition-delay: 0.12s; }
.reveal-delay-2 { transition-delay: 0.24s; }
.reveal-delay-3 { transition-delay: 0.36s; }

/* Rispetto per prefer-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .hero-bg { will-change: auto; }
  @keyframes bounce { from, to { transform: translateX(-50%); } }
}

/* ============ Focus styles accessibili ============ */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
  border-radius: 3px;
}

/* ============ Responsive generali ============ */
@media (max-width: 768px) {
  .container { padding: 0 1.25rem; }
  .hero .container { padding-top: 80px; }
}

/* ============ Map ============ */
.map-block {
  margin-top: 4rem;
  padding-top: 3rem;
  border-top: 1px solid var(--border);
}

.map-title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  margin-bottom: 1.5rem;
  color: var(--foreground);
}

.map-wrapper {
  border-radius: 0.75rem;
  overflow: hidden;
  border: 1px solid var(--border);
  /* Aspect ratio per evitare layout shift */
  aspect-ratio: 16/6;
}

.map-wrapper iframe {
  width: 100%;
  height: 100%;
  display: block;
  filter: grayscale(30%) contrast(1.05);
}

.map-directions {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  font-size: 0.875rem;
  color: var(--primary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: color 0.2s ease, gap 0.2s ease;
}

.map-directions:hover {
  color: var(--primary-dark);
  gap: 0.75rem;
}

@media (max-width: 768px) {
  .map-wrapper {
    aspect-ratio: 4/3;
  }
}

/* ============ Phone field ============ */
.phone-group {
  display: flex;
  align-items: stretch;
}

.phone-prefix {
  background: var(--muted);
  border: 1px solid var(--border);
  border-right: none;
  color: var(--foreground);
  padding: 0.75rem 0.875rem;
  border-radius: 0.5rem 0 0 0.5rem;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  white-space: nowrap;
  display: flex;
  align-items: center;
}

.phone-group input {
  border-radius: 0 0.5rem 0.5rem 0 !important;
  flex: 1;
}

/* Required asterisk */
.required {
  color: var(--primary);
  margin-left: 2px;
}
