:root {
  /* Colors */
  --md-sys-color-background: #faf9f6;
  --md-sys-color-on-background: #1a1c1a;
  --md-sys-color-surface: #faf9f6;
  --md-sys-color-on-surface: #1a1c1a;
  
  /* Primary / Soft Sage Green */
  --md-sys-color-primary: #4a654f;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #8daa91;
  --md-sys-color-on-primary-container: #253f2b;
  --md-sys-color-primary-fixed: #cceacf;
  --md-sys-color-on-primary-fixed: #062010;

  /* Error / Terracotta */
  --md-sys-color-error: #ba1a1a;
  --md-sys-color-on-error: #ffffff;
  --md-sys-color-error-container: #ffdad6;
  --md-sys-color-on-error-container: #93000a;

  /* Custom roles */
  --color-warm-beige: #F5F5DC;
  --color-deep-teal: #2F4F4F;
  
  --md-sys-color-surface-container: #efeeea;
  --md-sys-color-surface-variant: #e3e2df;
  --md-sys-color-on-surface-variant: #424842;
  
  /* Typography */
  --font-family-display: 'Playfair Display', serif;
  --font-family-body: 'Inter', sans-serif;
  
  /* Elevation */
  --shadow-ambient: 0px 10px 30px rgba(47, 79, 79, 0.08);
  --shadow-hover: 0px 15px 40px rgba(47, 79, 79, 0.12);
  
  /* Shapes */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 32px;
  
  /* Spacing */
  --spacing-base: 8px;
  --spacing-sm: 12px;
  --spacing-md: 24px;
  --spacing-lg: 48px;
  --spacing-gutter: 24px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family-body);
  background-color: var(--md-sys-color-background);
  color: var(--md-sys-color-on-background);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family-display);
  color: var(--color-deep-teal);
}

h1 { font-size: 48px; font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; }
h2 { font-size: 32px; font-weight: 600; line-height: 1.3; }
h3 { font-size: 24px; font-weight: 500; line-height: 1.4; }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 40px;
}

@media (max-width: 768px) {
  .container { padding: 0 16px; }
  h1 { font-size: 32px; }
  h2 { font-size: 28px; }
}

/* Navbar */
.navbar {
  background: rgba(250, 249, 246, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  position: fixed;
  width: 100%;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(47, 79, 79, 0.05);
  /* Transición específica (no 'all') evita repaints innecesarios */
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

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

.logo {
  font-family: var(--font-family-display);
  font-size: 24px;
  font-weight: 600;
  color: var(--color-deep-teal);
  text-decoration: none;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 16px 32px;
  border-radius: var(--radius-sm);
  font-family: var(--font-family-body);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.05em;
  text-decoration: none;
  text-align: center;
  transition: all 0.3s ease;
  cursor: pointer;
  border: none;
}

.btn-primary {
  background-color: var(--md-sys-color-primary-container); /* Soft Sage Green */
  color: var(--color-deep-teal);
}

.btn-primary:hover {
  background-color: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

/* Hero Section */
.hero {
  padding: 180px 0 100px;
  text-align: center;
  background: linear-gradient(135deg, var(--md-sys-color-background) 0%, #E6F0E8 100%);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(74, 101, 79, 0.12) 0%, transparent 60%);
  animation: rotateBg 20s linear infinite;
  z-index: 2; /* encima de la imagen de fondo */
}

@keyframes rotateBg {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* will-change + isolation previenen repaints del hero */
.hero::before { will-change: transform; isolation: isolate; }

.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, rgba(250,249,246,0.82) 0%, rgba(230,240,232,0.75) 100%);
  z-index: 3; /* encima de imagen y animación, debajo del texto */
}

/* Div para imagen de fondo (seteado vía JS) */
.hero-bg-img {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  z-index: 1; /* debajo de la animación */
  transition: background-image 0.4s ease;
}

.hero .container {
  position: relative;
  z-index: 4; /* encima de todo */
  animation: fadeInUp 1s ease-out forwards;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-subtitle {
  font-size: 18px;
  /* Mejorar contraste: ratio 4.5:1 sobre fondo claro (WCAG AA) */
  color: #374151;
  max-width: 600px;
  margin: 24px auto 48px;
}

/* Chips */
.chip {
  display: inline-block;
  padding: 6px 16px;
  border-radius: var(--radius-pill);
  background-color: #E6F0E8; /* Light sage tint */
  color: var(--color-deep-teal);
  font-size: 14px;
  font-weight: 500;
  margin-right: 8px;
  margin-bottom: 8px;
}

/* Profiles */
.profiles {
  padding: 100px 0;
  background-color: var(--color-warm-beige); /* Warm Beige Background */
}

.section-title {
  text-align: center;
  margin-bottom: var(--spacing-lg);
}

.grid-profiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--spacing-gutter);
}

.card {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-ambient);
  /* Forzar GPU layer: las transformaciones son composited y no causan layout shift */
  transform: translateZ(0);
  transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1),
              box-shadow 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
  will-change: transform;
}

.card:hover {
  transform: translateY(-8px) scale(1.01);
  box-shadow: var(--shadow-hover);
}

.video-placeholder {
  height: 240px;
  background: var(--md-sys-color-surface-container);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--md-sys-color-on-surface-variant);
}

.card-body {
  padding: var(--spacing-md);
}

.credentials {
  /* Contraste mejorado para texto secundario */
  color: #374151;
  margin-bottom: var(--spacing-md);
  font-size: 16px;
}

.availability {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--md-sys-color-primary);
  background: var(--md-sys-color-primary-fixed);
  padding: 8px 16px;
  border-radius: var(--radius-pill);
}

/* Triage Form */
.triage-section {
  padding: 120px 0;
  background-color: var(--md-sys-color-background);
}

.triage-container {
  max-width: 640px;
  margin: 0 auto;
  background: #ffffff;
  padding: 48px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-ambient);
}

.triage-desc {
  text-align: center;
  /* Contraste mejorado: #374151 = 7.5:1 sobre fondo blanco (WCAG AA) */
  color: #374151;
  margin-bottom: var(--spacing-lg);
}

.form-group {
  margin-bottom: var(--spacing-md);
}

label {
  display: block;
  margin-bottom: var(--spacing-sm);
  font-weight: 600;
  font-size: 14px;
  color: var(--color-deep-teal);
  letter-spacing: 0.05em;
}

input, textarea {
  width: 100%;
  padding: 16px;
  background: var(--color-warm-beige); /* Warm Beige fill instead of clinical white */
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: var(--font-family-body);
  font-size: 16px;
  color: var(--md-sys-color-on-surface);
  transition: all 0.3s ease;
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--md-sys-color-primary-container);
  background: #ffffff;
  box-shadow: 0 0 0 2px var(--md-sys-color-primary);
}

/* Validation States */
.input-error {
  border-color: var(--md-sys-color-error) !important;
  background-color: var(--md-sys-color-error-container) !important;
}

.input-error:focus {
  box-shadow: 0 0 0 2px var(--md-sys-color-error) !important;
}

.error-text {
  color: var(--md-sys-color-error);
  font-size: 14px;
  font-weight: 500;
  margin-top: 8px;
  display: none;
}

.error-text.visible {
  display: block;
}

.btn-submit {
  width: 100%;
  margin-top: 16px;
}

/* Hero Animations */
@keyframes slideUpAnim {
    from { opacity: 0; transform: translateY(50px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes zoomInAnim {
    from { opacity: 0; transform: scale(0.85); }
    to { opacity: 1; transform: scale(1); }
}
@keyframes cinematicAnim {
    from { opacity: 0; transform: scale(1.1) translateY(20px); filter: blur(4px); }
    to { opacity: 1; transform: scale(1) translateY(0); filter: blur(0); }
}
@keyframes fadeInAnim {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes bgFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes bgZoomIn {
    from { opacity: 0; transform: scale(1.1); }
    to { opacity: 1; transform: scale(1); }
}
@keyframes bgPan {
    from { opacity: 0; transform: scale(1.1) translateY(-2%); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* Tarjeta de Éxito Animada y SVG Checkmark */
@keyframes checkmarkPop {
    0% { transform: scale(0); opacity: 0; }
    60% { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes checkmarkDraw {
    0% { stroke-dashoffset: 60; }
    100% { stroke-dashoffset: 0; }
}

@keyframes ringPulse {
    0% { transform: scale(0.92); opacity: 0.7; }
    50% { transform: scale(1.12); opacity: 0.25; }
    100% { transform: scale(0.92); opacity: 0.7; }
}

.success-card-panel {
    background: #ffffff;
    border-radius: 20px;
    border: 1px solid #bbf7d0;
    box-shadow: 0 20px 40px -15px rgba(22, 163, 74, 0.15);
    padding: 3rem 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    animation: slideUpAnim 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.success-icon-container {
    position: relative;
    width: 90px;
    height: 90px;
    margin: 0 auto 24px auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.success-pulse-ring {
    position: absolute;
    inset: -12px;
    border-radius: 50%;
    background: rgba(34, 197, 94, 0.15);
    animation: ringPulse 2.5s infinite ease-in-out;
}

.success-svg-check {
    width: 90px;
    height: 90px;
    animation: checkmarkPop 0.7s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.success-svg-path {
    stroke-dasharray: 60;
    stroke-dashoffset: 60;
    animation: checkmarkDraw 0.6s 0.35s ease-in-out forwards;
}

.success-timeline {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin: 32px 0 24px 0;
    text-align: left;
}

.success-timeline-step {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
}

.success-timeline-step:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.04);
}

.contact-inputs-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* 📱 REDISEÑO UI/UX RESPONSIVE MÓVIL PREMIUM (FRONTEND) */
@media (max-width: 768px) {
  /* Deshabilitar backdrop-filter en móvil: evita tareas largas en el hilo principal */
  .navbar {
    background: rgba(255, 255, 255, 0.97) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    padding: 0 16px !important;
    border-bottom: 1px solid rgba(226, 232, 240, 0.8) !important;
  }
  
  .nav-content {
    height: 64px !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 0 !important;
  }
  
  .logo {
    font-size: 20px !important;
    font-weight: 700 !important;
    color: var(--color-deep-teal, #2F4F4F) !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 180px !important;
    letter-spacing: -0.01em !important;
  }
  
  .navbar .btn {
    padding: 9px 16px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    border-radius: 20px !important;
    white-space: nowrap !important;
    background: var(--color-deep-teal, #2F4F4F) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 10px rgba(47, 79, 79, 0.2) !important;
  }

  /* Ocultar enlaces dinámicos superiores en celulares */
  #nav-dynamic-links {
    display: none !important;
  }

  /* Hero Section Móvil */
  .hero {
    padding: 100px 16px 48px !important;
    text-align: center !important;
    background: linear-gradient(180deg, #f8fafc 0%, #edf4ef 100%) !important;
  }
  
  .hero h1 {
    font-size: 26px !important;
    font-weight: 700 !important;
    line-height: 1.3 !important;
    color: var(--color-deep-teal, #2F4F4F) !important;
    margin-bottom: 12px !important;
    letter-spacing: -0.01em !important;
  }
  
  .hero-subtitle {
    font-size: 15px !important;
    line-height: 1.5 !important;
    color: #4b5563 !important;
    margin: 0 auto 24px auto !important;
    padding: 0 8px !important;
    max-width: 100% !important;
  }

  .hero .btn {
    width: 100% !important;
    padding: 14px 20px !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    border-radius: 12px !important;
    background: var(--md-sys-color-primary, #4a654f) !important;
    color: #ffffff !important;
    box-shadow: 0 6px 18px rgba(74, 101, 79, 0.25) !important;
  }

  /* Títulos de Sección */
  .section-title {
    font-size: 22px !important;
    font-weight: 700 !important;
    margin-bottom: 16px !important;
    color: var(--color-deep-teal, #2F4F4F) !important;
  }

  /* Secciones con Tarjetas Responsive */
  .gallery-section, .about-section, .profiles {
    padding: 36px 16px !important;
  }

  #dynamic-gallery, #dynamic-about {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)) !important;
    gap: 12px !important;
  }

  .gallery-item img {
    height: 140px !important;
    border-radius: 12px !important;
  }

  /* Formulario de Triage Móvil de Alta Gama */
  #triage {
    padding: 40px 16px !important;
    background: #f8fafc !important;
  }

  .triage-container {
    padding: 0 !important;
  }

  .contact-form-wrapper {
    padding: 24px 18px !important;
    border-radius: 20px !important;
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 10px 30px rgba(47, 79, 79, 0.06) !important;
  }

  /* Grid del formulario en móvil: una columna */
  .contact-name-age-grid,
  .contact-phone-email-grid {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }

  .contact-inputs-grid {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }

  #contactForm > div {
    display: flex !important;
    flex-direction: column !important;
  }

  label {
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #1f2937 !important;
    margin-bottom: 6px !important;
  }

  input[type="text"], 
  input[type="tel"], 
  input[type="email"], 
  input[type="number"], 
  textarea {
    font-size: 16px !important;
    padding: 12px 14px !important;
    border: 1.5px solid #d1d5db !important;
    border-radius: 10px !important;
    background: #fdfdfd !important;
    width: 100% !important;
    box-sizing: border-box !important;
    transition: all 0.2s ease !important;
  }

  input[type="text"]:focus, 
  input[type="tel"]:focus, 
  input[type="email"]:focus, 
  input[type="number"]:focus, 
  textarea:focus {
    border-color: var(--md-sys-color-primary, #4a654f) !important;
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(74, 101, 79, 0.15) !important;
    background: #ffffff !important;
  }

  /* Selector de Modalidad Segmentado en Móvil */
  #modality-block {
    margin-top: 4px !important;
  }

  #modality-block > div {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    border-radius: 14px !important;
    border: 1px solid #cbd5e1 !important;
    background: #f1f5f9 !important;
    padding: 4px !important;
    box-sizing: border-box !important;
  }

  #btn-modality-online, 
  #btn-modality-presencial {
    width: 100% !important;
    border-radius: 10px !important;
    padding: 12px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    text-align: center !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
  }

  #contactSubmitBtn {
    max-width: 100% !important;
    width: 100% !important;
    padding: 15px !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    border-radius: 12px !important;
    background: linear-gradient(135deg, var(--md-sys-color-primary, #4a654f) 0%, var(--color-deep-teal, #2F4F4F) 100%) !important;
    color: #ffffff !important;
    border: none !important;
    box-shadow: 0 8px 20px rgba(47, 79, 79, 0.25) !important;
    margin-top: 16px !important;
  }

  /* Modales en Móvil */
  #privacyModal > div {
    width: 94% !important;
    padding: 20px 16px !important;
    max-height: 88vh !important;
    border-radius: 16px !important;
  }
}
