/* ========================================================= 
   STILE BASE UNIFORME PER TUTTO IL SITO (LEGGIBILE + FANTASY)
   ========================================================= */

/* Font:
   - Titoli: Cinzel Decorative (fantasy ma leggibile)
   - Testi: Cormorant Garamond (molto leggibile)
*/
@import url('https://fonts.googleapis.com/css2?family=Cinzel+Decorative:wght@400;700&family=Cormorant+Garamond:wght@400;500;600&display=swap');

:root{
  --bg: #1f1f1f;
  --panel: rgba(255,255,255,0.05);
  --text: #ffffff;
  --muted: rgba(255,255,255,0.88);
  --border: rgba(255,255,255,0.18);
  --shadow: rgba(0,0,0,0.35);

  --font-title: "Cinzel Decorative", serif;
  --font-text: "Cormorant Garamond", serif;
}

*{ box-sizing: border-box; }

/* ✅ FIX: base robusta (aiuta anche in casi “nero sotto”) */
html{ height: 100%; }

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-text);
  text-align: center;
  letter-spacing: 0.2px;
}

/* Testi leggibili (niente glow bianco forte) */
p, span, li, a, div, section, article, label, input, textarea {
  color: var(--text);
  text-shadow: 0 1px 2px rgba(0,0,0,0.35);
}

/* Titoli fantasy */
h1, h2, h3 {
  font-family: var(--font-title);
  color: var(--text);
  margin: 18px 0;
  text-align: center;
  text-shadow: 0 2px 8px rgba(0,0,0,0.45);
  letter-spacing: 1px;
}

/* =========================================================
   NAVBAR
   ========================================================= */
.navbar {
  position: fixed;
  width: 100%;
  top: 0;
  padding: 12px 10px;
  background: rgba(0, 0, 0, 0.85);
  z-index: 2000;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.navbar ul {
  list-style: none;
  display: flex;
  gap: 18px;
  justify-content: center;
  align-items: center;
  padding: 0;
  margin: 0;
  flex-wrap: wrap; /* mobile: va a capo */
}

.navbar a {
  text-decoration: none;
  color: #ffffff;
  font-size: 1.05rem;
  transition: 0.2s;
  padding: 6px 8px;
  font-family: var(--font-title);
  text-transform: uppercase; /* più leggibile */
  letter-spacing: 1px;
}

.navbar a:hover { color: #d9d9d9; }

/* =========================================================
   HEADER / HERO (NON TOCCO NULLA QUI)
   ========================================================= */
header{
  position: relative; /* serve per ancorare il titolo sopra l’immagine */
}

header img {
  width: 100%;
  height: 350px;
  object-fit: cover;
  display: block;
}

header h1{
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  margin: 0;
  padding: 12px 18px;

  font-size: clamp(1.4rem, 3.2vw, 2.6rem);
  letter-spacing: 2px;
  text-transform: uppercase;

  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 12px;

  text-shadow: 0 2px 10px rgba(0,0,0,0.65);
}

/* =========================================================
   BOTTONI
   ========================================================= */
button,
.home-btn,
.mode-btn,
#restartBtn,
#backBtn {
  background: #333;
  border: 2px solid #fff;
  padding: 10px 18px;
  border-radius: 8px;
  color: #ffffff;
  cursor: pointer;
  transition: 0.25s ease;
  font-size: 1.05rem;
  font-weight: 700;
  font-family: var(--font-title);
}

button:hover,
.home-btn:hover,
.mode-btn:hover,
#restartBtn:hover,
#backBtn:hover {
  background: #ffffff;
  color: #000000;
}

/* =========================================================
   HOME: GRID IMMAGINI (ANTEPRIMA)
   ========================================================= */
.home-image-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  padding: 18px;
  max-width: 1100px;
  margin: 0 auto;
}

.home-image-slot {
  width: 100%;
  height: 140px;
  background: #333;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.25s, box-shadow 0.25s;
  border: 1px solid var(--border);
}

.home-image-slot:hover {
  transform: scale(1.03);
  box-shadow: 0 10px 22px var(--shadow);
}

.home-image-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display:block;
}

/* =========================================================
   LIGHTBOX
   ========================================================= */
#lightbox-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.92);
  justify-content: center;
  align-items: center;
  z-index: 3000;
}

#lightbox-overlay.show { display: flex; }

#lightbox-overlay img {
  max-width: 92%;
  max-height: 82%;
  border-radius: 10px;
  border: 2px solid #fff;
}

#lightbox-overlay .close-btn,
#lightbox-overlay .prev-btn,
#lightbox-overlay .next-btn {
  position: absolute;
  font-size: 20px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.25);
  border-radius: 6px;
  cursor: pointer;
  user-select:none;
}

#lightbox-overlay .close-btn { top: 18px; right: 22px; }
#lightbox-overlay .prev-btn { left: 16px; top: 50%; transform: translateY(-50%); }
#lightbox-overlay .next-btn { right: 16px; top: 50%; transform: translateY(-50%); }

/* =========================================================
   PANNELLI GENERICI
   ========================================================= */
.panel {
  background: var(--panel);
  padding: 20px;
  margin: 20px auto;
  max-width: 900px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

/* =========================================================
   SFONDI "WALLPAPER" PER LE SEZIONI (anche ai lati) + overlay
   Uso:
   <section class="bg-wrap" style="--bg:url('img/IMG_7006.JPG');">
     <div class="content-wrap"> ... </div>
   </section>
   ========================================================= */

.bg-wrap{
  position: relative;
  width: 100%;
  padding: 80px 0;
  overflow: hidden;

  /* fallback se non passa --bg */
  background: #151515;

  /* ✅ FIX FONDAMENTALE: evita “nero sotto” quando la pagina è corta */
  min-height: 100vh;
}

/* immagine dietro */
.bg-wrap::before{
  content:"";
  position:absolute;
  inset:0;
  background-image: var(--bg);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.35;
  transform: scale(1.04);
  z-index: 0;
}

/* overlay scuro per leggere bene */
.bg-wrap::after{
  content:"";
  position:absolute;
  inset:0;
  background: rgba(0,0,0,0.55);
  z-index: 0;
}

/* contenitore centrato coerente ovunque */
.content-wrap{
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* =========================================================
   UTILITY
   ========================================================= */
.hidden { display: none !important; }

/* =========================================================
   RESPONSIVE MOBILE
   ========================================================= */
@media (max-width: 900px){
  header img { height: 280px; }
  .home-image-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 640px){
  header img { height: 240px; }
  .navbar a { font-size: 0.98rem; }
  .home-image-grid { grid-template-columns: repeat(2, 1fr); }
  .home-image-slot { height: 120px; }
  .bg-wrap{ padding: 55px 0; }
}

@media (max-width: 420px){
  .home-image-grid { grid-template-columns: 1fr; }
  .home-image-slot { height: 180px; }
}

/* =========================================================
   FIX HOME: niente min-height 100vh sui blocchi (evita striscia nera)
   ========================================================= */
body.home-page .bg-wrap{
  min-height: auto !important;   /* ✅ toglie l'altezza forzata che crea il buco */
  background: transparent !important;
  padding: 55px 0 !important;    /* (se vuoi uguale ai tuoi valori) */
}

/* Se nella HOME usi bg-debug/bg-overlay interni, spegni i pseudo-elementi */
body.home-page .bg-wrap::before,
body.home-page .bg-wrap::after{
  content: none !important;
}

/* ===== FIX CONTATTI MOBILE ===== */
@media (max-width: 768px){

  .hero-home,
  .page-hero {
    height: 260px !important; /* header più basso */
  }

  .page-title,
  .page-subtitle {
    position: relative !important;
    top: auto !important;
    transform: none !important;
    margin-top: 16px;
    padding: 0 14px;
  }

  .page-title{
    font-size: 2.2rem !important;
    background: none !important;
  }

  .page-subtitle{
    font-size: 1rem !important;
    opacity: 0.9;
  }
}
