/*
 * Homepage (index.php): hero con messaggio, statistiche live, carosello tribù,
 * svolgimento della partita, premi, CTA fissa su mobile.
 * Caricato dopo style.css / style_lotr.css, vale per entrambi i temi.
 */

/* ---------- Hero ---------- */
#hero::before {
  content: "";
  position: absolute;
  inset: 0;
  /* Lo sfondo è molto dettagliato: velo scuro al centro per rendere leggibile il testo */
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, .65) 0%, rgba(0, 0, 0, .35) 70%, rgba(0, 0, 0, .2) 100%);
}

#hero .hero-container {
  z-index: 1;
}

#hero .hero-tagline {
  color: #fff;
  font-family: "Raleway", sans-serif;
  font-weight: 700;
  font-size: clamp(24px, 4.2vw, 46px);
  line-height: 1.2;
  max-width: 900px;
  margin: 16px auto 10px;
  text-shadow: 0 2px 12px rgba(0, 0, 0, .8);
}

#hero .hero-subtitle {
  color: #f1f1f1;
  font-size: clamp(16px, 2vw, 21px);
  margin: 0 auto 4px;
  max-width: 760px;
  text-shadow: 0 1px 8px rgba(0, 0, 0, .8);
}

#hero .hero-noemail {
  display: inline-block;
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  margin-top: 8px;
  padding: 4px 14px;
  border-radius: 50px;
  background: rgba(24, 160, 90, .85);
}

/* Registrati e Login stessa dimensione: cambia solo il colore */
#hero .php-email-form .hero-btn-main,
#hero .php-email-form .hero-btn-secondary {
  font-size: 19px;
  font-weight: 700;
  padding: 11px 38px;
  min-width: 230px;
}

#hero .php-email-form .hero-btn-main {
  box-shadow: 0 4px 18px rgba(253, 104, 14, .55);
}

#hero .php-email-form .hero-btn-secondary {
  box-shadow: 0 4px 18px rgba(23, 105, 194, .55);
}

/* Statistiche live del server: barra scura in cima alla sezione tribù, sotto l'hero */
.hero-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 22px;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto 34px;
  padding: 10px 22px;
  border-radius: 14px;
  /* pastello caldo come le card delle tribù: niente stacco scuro sul fondo chiaro */
  background: linear-gradient(180deg, #fff4df 0%, #fbe9c8 100%);
  border: 1px solid #ecd3a3;
  box-shadow: 0 3px 10px rgba(120, 80, 20, .1);
  color: #5a4128;
  font-size: 15px;
}

.hero-stats b {
  color: #800000;
  font-size: 18px;
}

.hero-stats .live-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #2ecc71;
  margin-right: 6px;
  box-shadow: 0 0 0 0 rgba(46, 204, 113, .7);
  animation: hp-pulse 2s infinite;
}

.hero-stats .hero-countdown {
  color: #b34a00;
  font-weight: 600;
}

@keyframes hp-pulse {
  0% { box-shadow: 0 0 0 0 rgba(46, 204, 113, .7); }
  70% { box-shadow: 0 0 0 8px rgba(46, 204, 113, 0); }
  100% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0); }
}

/* Telefono: testo più piccolo così le statistiche stanno su due righe invece di quattro */
@media (max-width: 576px) {
  .hero-stats {
    gap: 4px 12px;
    margin-bottom: 26px;
    padding: 8px 12px;
    font-size: 12.5px;
    line-height: 1.4;
  }
  .hero-stats > span { white-space: nowrap; }
  .hero-stats .hero-countdown { white-space: normal; text-align: center; }
  .hero-stats b { font-size: 14px; }
  .hero-stats .live-dot { width: 7px; height: 7px; margin-right: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-stats .live-dot { animation: none; }
}

/* ---------- Titoli sezioni ---------- */
.hp-section-title {
  text-align: center;
  margin-bottom: 34px;
}

.hp-section-title h2 {
  font-weight: 700;
  margin-bottom: 8px;
}

.hp-section-title p {
  color: #666;
  margin: 0;
}

/* ---------- Tribù: fila di schede scorrevole orizzontalmente ---------- */
.tribe-carousel {
  position: relative;
}

.tribe-row {
  display: flex;
  gap: 18px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding: 0 4px;
  /* spazio per ombra e sollevamento in hover, che altrimenti verrebbero tagliati */
  padding: 16px 4px 22px;
  scrollbar-width: thin;
  scrollbar-color: #fd680e #f3e6d2;
  -webkit-overflow-scrolling: touch;
  cursor: grab;
}

/* Scrollbar arancione come i pulsanti del gioco (Chrome/Safari/Edge; Firefox usa scrollbar-color) */
.tribe-row::-webkit-scrollbar {
  height: 8px;
}

.tribe-row::-webkit-scrollbar-track {
  background: #f3e6d2;
  border-radius: 8px;
}

.tribe-row::-webkit-scrollbar-thumb {
  background: linear-gradient(90deg, #fd680e, #ff8a3d);
  border-radius: 8px;
}

.tribe-row::-webkit-scrollbar-thumb:hover {
  background: #e65c00;
}

/* Durante il trascinamento col mouse niente snap (altrimenti la fila "salta") né selezione testo */
.tribe-row.dragging {
  scroll-snap-type: none;
  cursor: grabbing;
  user-select: none;
}

.tribe-row.dragging .tribe-card {
  pointer-events: none;
}

.tribe-card {
  flex: 0 0 200px;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 16px 12px 14px;
  border-radius: 12px;
  /* pergamena chiara: un po' più calda in alto, dietro l'unità */
  background: linear-gradient(180deg, #f6ecd6 0%, #fbf7ee 55%, #fdfbf6 100%);
  border: 2px solid var(--tribe-color, #e8dcc2);
  color: #333;
  transition: transform .25s, box-shadow .25s;
}

/* Bordo in base all'indole: offensiva rossa, difensiva blu, mista viola */
.tribe-card.tribe-off   { --tribe-color: #d9534f; }
.tribe-card.tribe-def   { --tribe-color: #3b82d6; }
.tribe-card.tribe-mixed { --tribe-color: #9b59b6; }
.tribe-card.tribe-green { --tribe-color: #1e5631; }

.tribe-card:hover,
.tribe-card:focus-visible {
  transform: translateY(-10px);
  box-shadow: 0 14px 28px rgba(0, 0, 0, .18), 0 0 0 1px var(--tribe-color, #e8dcc2);
  color: #333;
  text-decoration: none;
}

.tribe-card img {
  width: 120px;
  height: 120px;
  object-fit: contain;
  margin-bottom: 8px;
}

.tribe-card h3 {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 6px;
  color: #800000;
}

.tribe-card .tribe-desc {
  font-size: 13px;
  line-height: 1.45;
  color: #555;
}

/* Quota di villaggi della tribù sul server attuale */
.tribe-card .tribe-share {
  margin-top: auto;
  padding-top: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #1769c2;
}

.tribe-card .tribe-share + .tribe-badge {
  margin-top: 6px;
}

/* Frecce del carosello (solo dispositivi con mouse) */
.tribe-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 44px;
  height: 44px;
  margin-top: -22px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .95);
  box-shadow: 0 3px 12px rgba(0, 0, 0, .25);
  color: #800000;
  font-size: 30px;
  line-height: 44px;
  padding: 0;
  cursor: pointer;
  transition: opacity .2s;
}

.tribe-nav-prev { left: -14px; }
.tribe-nav-next { right: -14px; }

.tribe-nav.hidden {
  opacity: 0;
  pointer-events: none;
}

@media (hover: none) {
  .tribe-nav { display: none; }
}

@media (max-width: 575px) {
  .tribe-card { flex-basis: 70vw; max-width: 240px; }
}

.tribe-card .tribe-badge {
  margin-top: auto;
  padding: 3px 10px;
  border-radius: 50px;
  font-size: 12px;
  background: #f3e3b5;
  color: #6b4d00;
}

/* ---------- Svolgimento della partita ---------- */
.steps {
  counter-reset: hp-step;
}

.step {
  position: relative;
  height: 100%;
  padding: 26px 20px 20px;
  border-radius: 12px;
  background: #fff;
  border-top: 4px solid #fd680e;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .07);
}

.step::before {
  counter-increment: hp-step;
  content: counter(hp-step);
  position: absolute;
  top: -18px;
  left: 20px;
  width: 36px;
  height: 36px;
  line-height: 36px;
  text-align: center;
  border-radius: 50%;
  background: #fd680e;
  color: #fff;
  font-weight: 700;
}

.step i {
  font-size: 34px;
  color: #800000;
}

.step h3 {
  font-size: 19px;
  font-weight: 700;
  margin: 8px 0;
}

.step p {
  margin: 0;
  color: #555;
}

.hp-android img {
  width: 180px;
  height: auto;
}

/* ---------- Gameplay: carosello (base in screenshots.css) ---------- */
/* In home niente fondo nero di screenshots.php: sabbia calda, in tono con il resto della pagina */
.home-gallery {
  padding: 50px 0 40px;
  background: linear-gradient(180deg, #f3e6cc 0%, #e9d6b0 100%);
  color: #4a3420;
}

.home-gallery .rail-title {
  color: #800000;
  font-weight: 700;
}

/* Più spazio sopra/sotto: la scheda ingrandita non deve essere tagliata dalla riga scorrevole */
.home-gallery .rail {
  margin-top: 0;
}

.home-gallery .rail-track {
  padding-top: 34px;
  padding-bottom: 34px;
}

.home-gallery .rail-arrow {
  top: 34px;
  bottom: 34px;
}

@media (hover: hover) and (pointer: fine) {
  .home-gallery .shot {
    transition: transform .3s ease .1s, box-shadow .3s ease .1s;
  }

  /* Effetto "Netflix": la scheda sotto il mouse si ingrandisce sopra le vicine */
  .home-gallery .shot:hover,
  .home-gallery .shot:focus-visible {
    transform: scale(1.25);
    box-shadow: 0 14px 34px rgba(60, 35, 10, .45);
    z-index: 2;
  }

  /* La prima e l'ultima crescono verso l'interno, così non escono dallo schermo */
  .home-gallery .shot:first-child {
    transform-origin: left center;
  }

  .home-gallery .shot:last-child {
    transform-origin: right center;
  }
}

.home-gallery-more {
  text-align: center;
}

.home-gallery-more a {
  color: #800000;
  font-size: 18px;
  font-weight: 600;
}

.home-gallery-more a:hover,
.home-gallery-more a:focus-visible {
  color: #d35400;
}

/* ---------- Premi ---------- */
.reward-box {
  display: flex;
  gap: 20px;
  align-items: center;
  max-width: 860px;
  margin: 0 auto;
  padding: 22px 26px;
  border-radius: 12px;
  background: #fffaf0;
  border: 1px solid #f0d9a8;
}

.reward-box svg {
  flex: 0 0 56px;
}

.reward-box h2 {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 6px;
}

.reward-box p {
  margin: 0 0 4px;
  color: #444;
}

.reward-box .reward-pay {
  font-size: 14px;
  color: #777;
}

@media (max-width: 575px) {
  .reward-box {
    flex-direction: column;
    text-align: center;
  }
}

/* ---------- CTA fissa su mobile ---------- */
.mobile-cta {
  display: none;
}

@media (max-width: 767px) {
  .mobile-cta {
    display: block;
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 999;
    padding: 13px;
    border-radius: 50px;
    text-align: center;
    font-weight: 700;
    font-size: 17px;
    color: #fff;
    background: #fd680e;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .35);
    transform: translateY(150%);
    transition: transform .3s;
  }

  .mobile-cta.visible {
    transform: none;
  }

  .mobile-cta:hover,
  .mobile-cta:focus-visible {
    color: #fff;
    text-decoration: none;
  }

  /* Spazio in fondo: la CTA non deve coprire il footer */
  body.has-mobile-cta #footer {
    padding-bottom: 80px;
  }
}
