/* CSS Variables - Identidad San Miguel */
:root {
  --color-primary: #222651; /* Azul institucional oscuro */
  --color-secondary: #2a4b9b; /* Azul claro / Purpleish */
  --color-white: #FFFFFF;
  --color-bg: #fdfdfd;
  --color-text: #2f333a;
  --color-offwhite: #f5f6fa;
  
  --font-logo: 'Aboreto', cursive;
  --font-text: 'Jost', sans-serif;
  
  --transition-smooth: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-text);
  color: var(--color-text);
  background-color: var(--color-bg);
  line-height: 1.6;
  overflow-x: hidden;
}

/* Typography Utilities */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-logo);
  font-weight: 400;
  color: var(--color-primary);
}

.section-title {
  font-size: clamp(1.8rem, 6vw, 3.5rem);
  margin-bottom: 2rem;
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.text-center { text-align: center; }
.mb-4 { margin-bottom: 2rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-grid { margin-top: 5rem; }

.large-text {
  font-size: clamp(1.2rem, 2vw, 1.4rem);
  font-weight: 300;
  margin-bottom: 1.5rem;
  color: #444;
  line-height: 1.8;
}

/* Layout */
.container {
  width: 90%;
  max-width: 1400px;
  margin: 0 auto;
}

.container-narrow { max-width: 1000px; }
.container-flex { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.section-padding { padding: 6rem 0; }
.bg-alt { background-color: var(--color-offwhite); }
.fullscreen { min-height: 100vh; width: 100%; }

/* Header & Navigation */
.main-header {
  position: fixed;
  top: 0; left: 0; width: 100%;
  padding: 1.5rem 5%;
  display: flex; justify-content: space-between; align-items: center;
  z-index: 1000;
  transition: var(--transition-smooth);
  background: linear-gradient(to bottom, rgba(34, 38, 81, 0.85) 0%, rgba(34, 38, 81, 0) 100%);
}

.main-header.scrolled {
  background-color: rgba(34, 38, 81, 0.95);
  backdrop-filter: blur(10px);
  padding: 1rem 5%;
}

.logo-container {
  display: flex; align-items: center; gap: 1rem; color: var(--color-white);
  transition: var(--transition-smooth);
}

.logo-sm {
  font-family: var(--font-logo);
  font-size: 2.5rem;
  color: var(--color-white);
  line-height: 1;
}

.logo-img {
  width: 160px;
  max-width: 100%;
  height: auto;
  filter: brightness(0) invert(1);
  transform: scale(1.2);
  transform-origin: left center;
}

.logo-img-footer {
  width: 160px;
  max-width: 100%;
  height: auto;
  margin-bottom: 0.5rem;
  filter: brightness(0) invert(1);
  transform: scale(1.1);
  transform-origin: left center;
}

.logo-text h1 {
  font-size: 1.2rem; text-transform: uppercase; color: var(--color-white);
  letter-spacing: 2px; margin-bottom: 2px;
}

.logo-text p {
  font-family: var(--font-text); font-size: 0.65rem;
  text-transform: uppercase; letter-spacing: 1px; opacity: 0.8; color: var(--color-white);
}

.menu-toggle {
  display: none;
}

.main-nav ul { display: flex; list-style: none; gap: 2.5rem; }
.main-nav a {
  text-decoration: none; font-size: 0.9rem;
  text-transform: uppercase; letter-spacing: 1px; color: var(--color-white);
  transition: opacity 0.3s ease; position: relative;
}
.main-nav a.active-link::after, .main-nav a:hover::after { width: 100%; }
.main-nav a::after {
  content: ''; position: absolute; width: 0; height: 1px;
  bottom: -4px; left: 0; background-color: var(--color-white);
  transition: width 0.3s ease;
}

/* Heroes */
.hero, .internal-hero {
  position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden;
}

.internal-hero {
  height: 60vh; min-height: 400px;
  background-size: cover; background-position: center;
}

.hero-video {
  background-color: var(--color-primary);
}

.hero-bg-video {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  z-index: 0;
}

.overlay {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background: linear-gradient(to bottom, rgba(20,24,60,0.3) 0%, rgba(20,24,60,0.6) 100%);
  z-index: 0;
}

.hero-content { z-index: 1; position: relative; }

/* Hero overlay extra dark for internal pages */
.internal-hero .overlay {
  background: linear-gradient(135deg, rgba(20,24,60,0.5) 0%, rgba(34,38,81,0.65) 100%);
}

.hero-content {
  text-align: center; color: var(--color-white); width: 90%; max-width: 1200px; padding-top: 5rem;
}
.hero-title {
  color: var(--color-white); font-size: clamp(2.2rem, 8vw, 5rem);
  margin-bottom: 1rem; line-height: 1.1;
}
.hero-subtitle {
  font-size: 1.5rem; font-weight: 300; opacity: 0.9;
}

.hero-scroll {
  position: absolute; bottom: 3rem; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
  font-size: 0.8rem; text-transform: uppercase; letter-spacing: 2px; opacity: 0.8;
  z-index: 1; color: var(--color-white);
  text-align: center;
  width: max-content;
}

/* Hub Grid (Home) */
.hub-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 3rem;
}
.hub-item {
  display: block; text-decoration: none; color: inherit;
  background: var(--color-white); border-radius: 4px; overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.05);
  transition: transform 0.4s ease, box-shadow 0.4s ease;
}
.hub-item:hover { transform: translateY(-10px); box-shadow: 0 15px 40px rgba(34,38,81,0.1); }
.hub-img { width: 100%; height: 250px; object-fit: cover; }
.hub-content { padding: 2rem; }
.hub-content h3 { font-size: 1.8rem; margin-bottom: 1rem; }
.hub-content p { font-size: 1rem; color: #666; line-height: 1.5; }

/* Content Split Sections (Nosotros & Proceso) */
.content-split {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4rem; align-items: center; margin-bottom: 4rem;
}
.content-split.reverse { direction: rtl; }
.content-split.reverse > * { direction: ltr; }
.content-split.align-start { align-items: flex-start; }

.content-img-wrapper { position: relative; overflow: hidden; border-radius: 4px; }
.content-img {
  width: 100%; height: auto; display: block; object-fit: cover;
  min-height: 300px;
}
.step-image {
  width: 100%; max-height: 250px; object-fit: cover; border-radius: 4px; border: 1px solid rgba(0,0,0,0.05);
}

/* Service Detail List (Especialidades) */
.detailed-services { display: flex; flex-direction: column; gap: 6rem; }
.service-detail {
  display: grid; grid-template-columns: 1fr 1.5fr; gap: 4rem;
  background: var(--color-white); padding: 3rem; border-top: 3px solid var(--color-secondary);
  box-shadow: 0 10px 30px rgba(0,0,0,0.03);
}
.service-detail img {
  width: 100%; height: 100%; max-height: 400px; object-fit: cover; border-radius: 4px;
}
.service-detail-info p { font-size: 1.15rem; color: #555; line-height: 1.8; }

/* Timeline (Proceso) */
.timeline { position: relative; max-width: 900px; margin: 4rem auto 0; }
.timeline::before {
  content: ''; position: absolute; top: 0; left: 40px; height: 100%; width: 1px;
  background-color: rgba(34, 38, 81, 0.2);
}
.timeline-item { position: relative; padding-left: 100px; margin-bottom: 6rem; }
.timeline-item:last-child { margin-bottom: 0; }
.timeline-number {
  position: absolute; left: 20px; top: -10px; color: var(--color-secondary);
  font-family: var(--font-logo); font-size: 1.8rem; background: var(--color-bg); padding: 0.5rem 0;
}
.timeline-content h4 { font-size: 1.8rem; margin-bottom: 1rem; color: var(--color-primary); }
.timeline-content p { font-size: 1.15rem; color: #555; line-height: 1.7; }

/* Gallery (Contacto) */
.photo-gallery {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1rem; margin-top: 3rem;
}
.photo-gallery img {
  width: 100%; height: 250px; object-fit: cover; border-radius: 4px;
  transition: transform 0.4s ease;
}
.photo-gallery img:hover { transform: scale(1.02); }

.contact-layout { max-width: 800px; margin: 0 auto; background: var(--color-white); padding: 3rem; border-radius: 4px; box-shadow: 0 10px 40px rgba(0,0,0,0.05);}
.location-card { border-left: 3px solid var(--color-secondary); padding-left: 1.5rem; margin-bottom: 2rem; }
.location-card h3 { font-family: var(--font-text); font-weight: 500; font-size: 1.2rem; margin-bottom: 0.5rem; }

/* Footer */
.main-footer { background-color: var(--color-primary); color: var(--color-white); padding: 6rem 0 2rem; }
.footer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4rem; margin-bottom: 4rem; }
.footer-brand .logo-sm { font-size: 3.5rem; display: block; margin-bottom: 1rem; }
.footer-brand > p { opacity: 1; font-family: var(--font-logo); font-size: 1.8rem; line-height: 1.2; margin-bottom: 2rem; color: var(--color-white); }
.footer-brand .contact-info p { font-family: var(--font-text); font-size: 1rem; margin-bottom: 0.6rem; color: var(--color-white); }
.footer-brand .contact-info p strong { font-family: var(--font-logo); font-weight: 400; font-size: 1.1rem; color: var(--color-white); display: block; margin-bottom: 0.1rem; }
.footer-brand .contact-info p a { font-family: var(--font-text); font-size: 1rem; color: var(--color-white) !important; text-decoration: none; }
.footer-locations h3 { color: var(--color-white); font-size: 1.5rem; margin-bottom: 2rem; border-bottom: 1px solid rgba(255,255,255,0.2); padding-bottom: 1rem; }
.footer-locations ul { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 2rem; }
.footer-locations li strong { color: #8faef1; font-family: var(--font-logo); font-size: 1.2rem; display: block; margin-bottom: 0.5rem; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.1); padding-top: 2rem; font-size: 0.9rem; opacity: 0.7; }

/* Social Links */
.social-links { display: flex; gap: 1.5rem; align-items: center; margin-top: 2rem; }
.social-links a { color: var(--color-white); opacity: 0.8; transition: var(--transition-smooth); display: flex; align-items: center; justify-content: center; }
.social-links a:hover { opacity: 1; transform: translateY(-3px); }
.social-links svg { width: 22px; height: 22px; fill: currentColor; }

/* Animations */
.fade-in-up, .reveal-up { opacity: 0; transform: translateY(40px); transition: opacity 1s cubic-bezier(0.16, 1, 0.3, 1), transform 1s cubic-bezier(0.16, 1, 0.3, 1); }
.fade-in-up.active, .reveal-up.active { opacity: 1; transform: translateY(0); }
.hero-scroll.fade-in-up { transform: translate(-50%, 40px); }
.hero-scroll.fade-in-up.active { transform: translate(-50%, 0); }
.delay-1 { transition-delay: 0.2s; }
.delay-2 { transition-delay: 0.4s; }
.delay-3 { transition-delay: 0.6s; }

/* Responsive adjustments */
@media (max-width: 900px) {
  .footer-grid, .content-split, .service-detail { grid-template-columns: 1fr; gap: 2.5rem; }
  .content-split.reverse { direction: ltr; }
}

@media (max-width: 768px) {
  /* Layout adjustments */
  .section-padding { padding: 4rem 0; }
  .internal-hero { min-height: 300px; height: 50vh; }
  .hero-content { padding-top: 3rem; }
  .hub-grid { grid-template-columns: 1fr; gap: 1.5rem; }
  .service-detail { padding: 1.5rem; gap: 1.5rem; }
  .contact-layout { padding: 1.5rem; }
  .timeline-item { padding-left: 60px; margin-bottom: 4rem; }
  
  /* Text & Elements adjustments */
  .large-text { font-size: 1.05rem; line-height: 1.6; }
  .logo-img { transform: scale(1); max-width: 130px; }
  .timeline::before { left: 20px; }
  .timeline-number { left: 0; font-size: 1.2rem; }
  .hero-scroll { text-align: center; }
  
  /* Footer Mobile Symmetry */
  .main-footer { padding: 4rem 0 2rem; }
  .footer-grid { text-align: center; }
  .footer-brand .logo-sm { font-size: 2.2rem; margin-bottom: 0.5rem; }
  .footer-brand > p { font-size: 1.3rem; margin-bottom: 1.5rem; }
  .footer-locations h3 { font-size: 1.3rem; }
  .footer-locations ul { justify-content: center; }
  .social-links { justify-content: center; }
  .footer-bottom .container-flex { justify-content: center; text-align: center; }
  
  /* Navigation */
  .main-nav { position: fixed; top: 0; right: -100%; width: 100%; height: 100vh; background-color: var(--color-primary); display: flex; align-items: center; justify-content: center; transition: var(--transition-smooth); }
  .main-nav.active { right: 0; }
  .main-nav ul { flex-direction: column; text-align: center; gap: 2rem; }
  .main-nav a { font-size: 1.5rem; }
  .menu-toggle { display: block; border: none; background: transparent; cursor: pointer; z-index: 1001; }
  .hamburger { display: block; width: 30px; height: 2px; background-color: var(--color-white); position: relative; transition: var(--transition-smooth); }
  .hamburger::before, .hamburger::after { content: ''; position: absolute; width: 100%; height: 2px; background-color: var(--color-white); left: 0; transition: var(--transition-smooth); }
  .hamburger::before { top: -8px; }
  .hamburger::after { bottom: -8px; }
  .menu-toggle.active .hamburger { background-color: transparent; }
  .menu-toggle.active .hamburger::before { top: 0; transform: rotate(45deg); }
  .menu-toggle.active .hamburger::after { bottom: 0; transform: rotate(-45deg); }
}

/* WhatsApp Floating Button */
.whatsapp-btn {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background-color: #25d366;
  width: 65px;
  height: 65px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  z-index: 1000;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  overflow: hidden;
  text-decoration: none;
}

.whatsapp-btn:hover {
  transform: scale(1.1) translateY(-5px);
  box-shadow: 0 8px 24px rgba(37, 211, 102, 0.4);
}

/* SVG perfectamente cuadrado y centrado */
.whatsapp-btn svg {
  width: 36px;
  height: 36px;
  fill: white;
  flex-shrink: 0;
  display: block;
}

@media (max-width: 768px) {
  .whatsapp-btn { bottom: 1.5rem; right: 1.5rem; width: 55px; height: 55px; }
  .whatsapp-btn svg { width: 32px; height: 32px; }
}
