/* RESET Y BASE */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --color-primary: #2E7D32;
  --color-primary-dark: #1B5E20;
  --color-secondary: #1976D2;
  --color-text: #212121;
  --color-text-light: #4f4f4f;
  --color-bg: #FFFFFF;
  --color-bg-light: #F5F5F5;
  --spacing: clamp(1rem, 3vw, 2rem);
  --max-width: 1200px;
  --border-radius: 12px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

html { font-size: 19.9px; scroll-behavior: smooth; }

body {
  font-family: 'Atkinson Hyperlegible', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  line-height: 1.6;
  color: #fff;
  background: linear-gradient(135deg, #0055a5 0%, #369257 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* TEXTOS */
h1, h2, .subtitle, .email-form-description, .faq-question, .feature h3, .feature p {
  color: #fff !important;
  text-shadow: 0 2px 10px rgba(0,0,0,0.25);
}

/* CONTAINER */
.container { width: 100%; max-width: var(--max-width); margin: 0 auto; padding: 0 var(--spacing); }

/* HEADER */
header {
  padding: 0.0rem 0rem;  ;
  background: rgba(255, 255, 255, 0.95);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  position: static; top: 0; z-index: 100;
}
.logo {
  display: flex; align-items: center; gap: 0.7rem;
  font-size: clamp(1.2rem, 10vw, 1.5rem);
  font-weight: 700; color: var(--color-primary);
  font-family: 'A', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif !important;
  text-decoration: none !important;
}

/* HERO */
.hero { padding: 0.7rem 0; text-align: center; }
h1 {
  font-size: clamp(1.8rem, 5vw, 2.5rem);
  font-weight: 700; color: var(--color-primary-dark);
  margin: 0.4rem 0 1rem; line-height: 1.15;
}
.subtitle {
  font-size: clamp(1.2rem, 2.5vw, 1.5rem);
  color: var(--color-text-light);
  margin: 0 auto 1.5rem; max-width: 700px; text-align: center;
}

/* BADGES */
.badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.7rem; margin: 1rem 0; }
.badge {
  background: #fff; padding: 0.5rem 0.6rem; border-radius: 50px;
  font-weight: 600; color: var(--color-primary);
  box-shadow: var(--shadow); display: inline-flex; align-items: center; gap: 0.5rem;
  font-size: 1.4rem; text-shadow: none !important;
}

/* EMAIL FORM */
.email-form {
  background: #fff; padding: 1rem; border-radius: var(--border-radius);
  box-shadow: var(--shadow); max-width: 600px; margin: 0.5rem auto 2rem;
  color: #212121 !important;
}
.email-form h2 { font-size: 1.3rem; margin-bottom: 0.3rem; color: var(--color-primary); }
.email-form-description { margin-bottom: 0.3rem; color: var(--color-text-light); font-size: 1.6rem; }
.form-group { display: flex; gap: 0.3rem; flex-wrap: wrap; align-items: center; justify-content: center; }

input[type="email"] {
  flex: 1; min-width: 200px; padding: 0.6rem 1rem;
  border: 2px solid #E0E0E0; border-radius: var(--border-radius);
  font-size: 1.5rem; transition: border-color 0.3s;
}
input[type="email"]:focus { outline: none; border-color: var(--color-primary); }

button {
  padding: 0.6rem 1.5rem; background: var(--color-primary); color: #fff !important;
  border: none; border-radius: var(--border-radius);
  font-size: 1.5rem; font-weight: 600; cursor: pointer; transition: all 0.3s;
}
button:hover, button:focus {
  background: var(--color-primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(46, 125, 50, 0.3);
}

/* Dictado */
#dictadoBtn { background: #FFB74D; }
#dictadoBtn:hover { background: #FFA726; }
#dictadoBtn:disabled { background: #E0E0E0; cursor: not-allowed; }
#dictadoBtn.listening { background: #FF7043; }
#dictadoBtn.pulsing { animation: pulse 2s infinite; }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 112, 67, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(255, 112, 67, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 112, 67, 0); }
}

input.listening-input { border-color: #FF7043 !important; box-shadow: 0 0 8px rgba(255, 112, 67, 0.5); }
input.dictated-text { color: #C64B00 !important; font-weight: bold; }

/* Success */
.success-message {
  display: none; background: #369257; color: #fff;
  padding: 1rem; border-radius: var(--border-radius);
  margin-top: 1rem; text-align: center; font-weight: 600;
}
.success-message.show { display: block; animation: fadeIn 0.8s ease; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

/* FEATURES */
.features { padding: 0.7rem 0 0; }
.features-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.2rem; margin-top: 1.5rem;
}
.feature {
  background: rgba(0,0,0,0.35); color: #fff; padding: 1rem;
  border-radius: var(--border-radius); box-shadow: var(--shadow);
  text-align: center; transition: transform 0.3s;
}
.feature:hover { transform: translateY(-5px); }
.feature-icon { font-size: 3rem; margin-bottom: 1rem; }
.feature h3 { font-size: 1.5rem; color: var(--color-primary); margin-bottom: 0.5rem; }

/* FAQ */
.faq { padding: 2rem 0; }
.faq h2 { font-size: 1.6rem; margin-bottom: 1rem; color: var(--color-primary); }
.faq-item {
  background: rgba(0,0,0,0.35); color: #fff; padding: 1rem;
  border-radius: var(--border-radius); margin-bottom: 0.7rem; box-shadow: var(--shadow);
}
.faq-question {
  font-weight: 600; color: var(--color-primary);
  margin-bottom: 0.5rem; font-size: 1.25rem;
}
.faq-item a[href="#inicioForm"] {
  color: #212121 !important; background: #fff !important;
  font-weight: 600; border-radius: 6px; padding: 0 4px;
}
.faq-item a[href="#inicioForm"]:hover { background: #f0f0f0 !important; color: #1976D2 !important; }
/* FOOTER */
footer {
  margin-top: auto;
  padding: 0.7rem 0;
  background: #fff;
  text-align: center;
  color: var(--color-text-light);
}
footer a {
  color: var(--color-primary);
  text-decoration: none;
}
footer a:hover,
footer a:focus {
  text-decoration: underline;
}
.footer-contact {
  margin-top: 0.2rem;
  text-align: center;
}

/* ANIMATIONS (extras) */
@keyframes slideIn {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* RESPONSIVE */
@media (max-width: 768px) {
  .form-group {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }
  input[type="email"],
  button {
    width: auto;
  }
}

/* Overrides de color en formulario para accesibilidad en fondo blanco */
.email-form,
.email-form h2,
.email-form-description,
.email-form input[type="email"],
.email-form button {
  color: #212121 !important;
  text-shadow: none !important;
}
.email-form button {
  color: #fff !important;
}

/* Dictado: estilos del input durante escucha y dictado */
input.listening-input {
  border-color: #FF7043 !important;
  box-shadow: 0 0 8px rgba(255, 112, 67, 0.5);
}
input.dictated-text {
  color: #C64B00 !important;
  font-weight: bold;
}

/* Dictado: popup modal */
.dictado-modal-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  opacity: 0; transition: opacity 0.3s ease;
  pointer-events: none;
}
.dictado-modal {
  background: #fff;
  padding: 1.5rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  max-width: 90%; width: 400px;
  text-align: center;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}
.dictado-modal-overlay.show {
  opacity: 1; pointer-events: auto;
}
.dictado-modal-overlay.show .dictado-modal {
  transform: scale(1);
}
.dictado-modal p {
  color: var(--color-text);
  margin-bottom: 1rem;
  font-size: 1.2rem;
}
.dictado-modal .dictated-email {
  font-style: italic;
  font-weight: bold;
  color: var(--color-primary);
  word-break: break-all;
}
.dictado-modal .modal-buttons {
  display: flex; justify-content: center; gap: 1rem;
}
.dictado-modal .modal-buttons button {
  flex: 1;
}
.dictado-modal .modal-buttons button.secondary {
  background: #E0E0E0;
  color: var(--color-text);
}
.dictado-modal .modal-buttons button.secondary:hover {
  background: #BDBDBD;
}

/* Utilidad: ocultar elementos visualmente pero accesibles a lectores de pantalla */
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0, 0, 0, 0); border: 0;
}

.hero h1, .subtitle, .email-form, .badges {
  opacity: 0;
  animation: fadeIn 1.2s ease forwards;
}
.hero h1 { animation-delay: 0.2s; }
.subtitle { animation-delay: 0.5s; }
.email-form { animation-delay: 0.8s; }
.badges { animation-delay: 1.1s; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}