/**
 * @file Stili dedicati per la pagina di attesa (Waitlist) ottimizzata per le Storie Instagram.
 * @description Modulo CSS indipendente da caricare insieme a styles.css, sovrascrive o aggiunge regole necessarie al layout Mobile/Story.
 */

/* ==========================================================================
   Variabili CSS Locali per il tema scuro (Deep Green)
   ========================================================================== */
:root {
  --story-bg-color: #2b4f35;
  /* Base green */
  --story-bg-gradient-1: #1f3d28;
  --story-bg-gradient-2: #345c40;
  --story-text-color: #ffffff;
  --story-badge-bg: rgba(255, 255, 255, 0.15);
  --story-input-bg: rgba(255, 255, 255, 0.1);
  --story-input-border: rgba(255, 255, 255, 0.3);
  --story-input-focus: rgba(255, 255, 255, 0.6);
  --story-btn-bg: #ffffff;
  --story-btn-text: #1a3c27;
}

/* ==========================================================================
   Layout Base per la Pagina
   ========================================================================== */
body.story-layout {
  background-color: var(--story-bg-color);
  background: linear-gradient(145deg, var(--story-bg-gradient-1) 0%, var(--story-bg-gradient-2) 100%);
  color: var(--story-text-color);
  min-height: 100vh;
  /* Support per mobile browser toolbars (100dvh) */
  min-height: 100dvh;
  margin: 0;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

/* Nascondere elementi ereditati non necessari */
body.story-layout .visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   Header (Logo e Menu)
   ========================================================================== */
.story-header {
  position: relative;
  z-index: 10;
  padding: 1rem 1.25rem 0;
}

.story-header .header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 600px;
  margin: 0 auto;
}

.story-header .brand {
  display: inline-flex;
  align-items: center;
  gap: 0;
  padding: 5px 9px;
  border: 1px solid rgba(211, 229, 204, .48);
  border-radius: 10px;
  background: rgba(255, 255, 255, .94);
  text-decoration: none;
}

.story-header .brand-logo {
  height: 30px;
  max-width: 126px;
  width: auto;
  display: block;
}

.menu-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  color: white;
  text-decoration: none;
  background: rgba(0, 0, 0, 0.1);
  transition: background 0.2s;
}

.menu-button:hover,
.menu-button:active {
  background: rgba(0, 0, 0, 0.2);
}

/* ==========================================================================
   Sfondo e Decorazioni (Cerchi)
   ========================================================================== */
.story-background {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  z-index: 1;
  pointer-events: none;
}

.story-background .circle {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
}

.story-background .circle-1 {
  width: 120vw;
  height: 120vw;
  top: -30%;
  right: -40%;
}

.story-background .circle-2 {
  width: 150vw;
  height: 150vw;
  top: 10%;
  right: -60%;
}

/* ==========================================================================
   Contenuto Principale
   ========================================================================== */
.story-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 2;
  max-width: 500px;
  margin: 0 auto;
  width: 100%;
}

.story-content {
  padding: 1.5rem 2rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin-top: -2rem;
  /* Bilanciamento altezza */
}

/* ==========================================================================
   Badge "Disponibile a breve"
   ========================================================================== */
.story-badge {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 0.5rem;
  background-color: var(--story-badge-bg);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.35rem 0.85rem;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 1.25rem;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: #a3e6b5;
  border-radius: 50%;
  display: block;
  box-shadow: 0 0 0 rgba(163, 230, 181, 0.6);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(163, 230, 181, 0.6);
  }

  70% {
    box-shadow: 0 0 0 6px rgba(163, 230, 181, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(163, 230, 181, 0);
  }
}

/* ==========================================================================
   Tipografia
   ========================================================================== */
.story-title {
  font-family: 'Nunito', sans-serif;
  font-size: clamp(2.5rem, 10vw, 3.5rem);
  font-weight: 900;
  line-height: 1.05;
  margin: 0 0 1rem 0;
  color: #ffffff;
}

.story-subtitle {
  font-size: 1.05rem;
  line-height: 1.4;
  margin: 0 0 2rem 0;
  color: rgba(255, 255, 255, 0.9);
}

/* ==========================================================================
   Form e Input
   ========================================================================== */
.story-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-group {
  position: relative;
}

.form-input {
  width: 100%;
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--story-input-border);
  border-radius: 12px;
  background-color: var(--story-input-bg);
  color: white;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.05rem;
  outline: none;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.form-input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.form-input:focus {
  border-color: var(--story-input-focus);
  background-color: rgba(255, 255, 255, 0.15);
}

.button-story-submit {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 1.1rem 1.5rem;
  background-color: var(--story-btn-bg);
  color: var(--story-btn-text);
  border: none;
  border-radius: 12px;
  font-family: 'Nunito', sans-serif;
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.button-story-submit:active {
  transform: scale(0.98);
}

.button-story-submit.is-loading {
  opacity: 0.8;
  pointer-events: none;
}

.button-story-submit.is-success {
  background-color: #e6f9ec;
  color: #1a4d2e;
}

/* ==========================================================================
   Checkbox Privacy
   ========================================================================== */
.form-consent {
  display: grid;
  gap: 0.6rem;
  margin-top: 0.75rem;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  font-size: 0.85rem;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  user-select: none;
}

.checkbox-label input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 1px;
  width: 1px;
  margin: 0;
}

.checkbox-custom {
  display: inline-block;
  width: 20px;
  height: 20px;
  background-color: transparent;
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  border-radius: 6px;
  margin-right: 10px;
  position: relative;
  flex-shrink: 0;
  transition: all 0.2s;
}

.checkbox-label input:checked~.checkbox-custom {
  background-color: #a3e6b5;
  border-color: #a3e6b5;
}

.checkbox-custom:after {
  content: "";
  position: absolute;
  display: none;
  left: 6px;
  top: 2px;
  width: 4px;
  height: 10px;
  border: solid var(--story-btn-text);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.checkbox-label input:checked~.checkbox-custom:after {
  display: block;
}

.checkbox-label input:focus-visible~.checkbox-custom {
  outline: 3px solid rgba(255, 255, 255, 0.9);
  outline-offset: 3px;
}

.checkbox-label a {
  color: white;
  text-decoration: underline;
  text-underline-offset: 2px;
  margin-left: 4px;
}

/* ==========================================================================
   Toast Feedback Notifications
   ========================================================================== */
/* ==========================================================================
   Toast Feedback Notifications (High Contrast & Mobile-Optimized)
   ========================================================================== */
/* ==========================================================================
   Feedback Notifications (Success & Error In-Container Cards)
   ========================================================================== */
.story-form .waitlist-feedback {
  display: none;
  width: 100%;
  padding: 0.95rem 1.2rem;
  border-radius: 16px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.9rem !important;
  font-weight: 700;
  line-height: 1.4;
  text-align: left;
  box-sizing: border-box;
  margin-top: 0.75rem;
  word-break: break-word;
  overflow-wrap: anywhere;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
  animation: feedbackFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes feedbackFadeIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.story-form .waitlist-feedback.is-error,
.story-form .waitlist-feedback.is-success {
  display: flex !important;
  align-items: center;
  gap: 0.85rem;
}

/* Card di Successo (Email salvata) */
.story-form .waitlist-feedback.is-success {
  background: #ffffff !important;
  border: 1px solid #86efac !important;
  color: #14532d !important;
}

.story-form .waitlist-feedback.is-success::before {
  content: "✓" !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 30px !important;
  height: 30px !important;
  min-width: 30px !important;
  flex-shrink: 0 !important;
  border-radius: 50% !important;
  background-color: #16a34a !important;
  color: #ffffff !important;
  font-size: 0.95rem !important;
  font-weight: 900 !important;
  animation: none !important;
}

/* Card di Errore (Invio fallito / Errore validazione) */
.story-form .waitlist-feedback.is-error {
  background: #ffffff !important;
  border: 1px solid #fca5a5 !important;
  color: #7f1d1d !important;
}

.story-form .waitlist-feedback.is-error::before {
  content: "!" !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 30px !important;
  height: 30px !important;
  min-width: 30px !important;
  flex-shrink: 0 !important;
  border-radius: 50% !important;
  background-color: #dc2626 !important;
  color: #ffffff !important;
  font-size: 1.05rem !important;
  font-weight: 900 !important;
  animation: none !important;
}

/* ==========================================================================
   Footer Graphics (Mascot & Decorations)
   ========================================================================== */
.story-footer-graphics {
  position: relative;
  width: 100%;
  height: 200px;
  margin-top: auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding-bottom: 0.5rem;
}

.story-mascot {
  height: 130px;
  width: auto;
  z-index: 2;
  margin-bottom: 0.5rem;
}

.dot-matrix {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  width: 80px;
  height: 80px;
  background-image: radial-gradient(rgba(255, 255, 255, 0.15) 2px, transparent 2px);
  background-size: 16px 16px;
  z-index: 1;
}

.sparkle {
  position: absolute;
  right: 2rem;
  bottom: 2rem;
  width: 32px;
  height: 32px;
  color: rgba(255, 255, 255, 0.3);
  z-index: 1;
}

/* ==========================================================================
   Footer Legal Links
   ========================================================================== */
.story-footer-legal {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem 1rem;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.65);
}

.story-footer-legal a {
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  transition: color 0.2s, text-decoration 0.2s;
}

.story-footer-legal a:hover,
.story-footer-legal a:focus-visible {
  color: #ffffff;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.story-footer-legal .dot-sep {
  opacity: 0.4;
  font-size: 0.65rem;
}
