:root {
  --navy: #153450;
  --navy-dark: #0e2537;
  --green: #2CA44E;
  --green-dark: #22803d;
  --white: #FFFFFF;
  --gray-light: #F2F4F5;
  --gray-border: #E2E6E9;
  --text: #1C2B36;
  --text-muted: #5A6B78;
  --radius: 10px;
  --max-width: 1140px;

  /* tokens que cambian entre modo claro/oscuro */
  --bg: #FFFFFF;
  --bg-alt: #F2F4F5;
  --bg-surface: #FFFFFF;
  --border: #E2E6E9;
  --heading: #153450;
  --link: #22803d;
  --header-bg: #FFFFFF;
  --card-shadow: 0 2px 10px rgba(21,52,80,0.06);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1B24;
    --bg-alt: #16242E;
    --bg-surface: #1B2A35;
    --border: #2A3A45;
    --text: #E7EDF1;
    --text-muted: #9FB0BB;
    --heading: #EAF2F7;
    --link: #43C96A;
    --header-bg: #101E28;
    --card-shadow: none;
  }
}

:root[data-theme="dark"] {
  --bg: #0E1B24;
  --bg-alt: #16242E;
  --bg-surface: #1B2A35;
  --border: #2A3A45;
  --text: #E7EDF1;
  --text-muted: #9FB0BB;
  --heading: #EAF2F7;
  --link: #43C96A;
  --header-bg: #101E28;
  --card-shadow: none;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

section[id] { scroll-margin-top: 84px; }

/* Las secciones del menú llenan la pantalla disponible (debajo del header)
   y centran su contenido, para que al navegar no se asome la siguiente
   sección, sin importar el alto de la ventana. */
#nosotros,
#servicios,
#cobertura,
#certificaciones {
  min-height: calc(100vh - 84px);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

#cobertura { padding: 24px 0; }
#cobertura .section-title { margin-bottom: 6px; }
#cobertura .section-lead { margin-bottom: 14px; }

body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  transition: background 0.2s, color 0.2s;
}

img { max-width: 100%; display: block; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

h1, h2, h3, h4 { margin: 0 0 12px; line-height: 1.25; }

a { text-decoration: none; color: inherit; }

/* ---------- HEADER ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  transition: background 0.2s, border-color 0.2s;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 80px;
  max-width: 1400px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #FFFFFF;
  border-radius: 8px;
  padding: 6px 9px;
}

.logo-badge img { height: 38px; width: auto; }

.logo-text {
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--heading);
  font-size: 1.31rem;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 28px;
}

.site-nav a {
  color: var(--heading);
  font-weight: 600;
  font-size: 0.95rem;
}

.site-nav a:hover { color: var(--link); }

.nav-login {
  border: 1px solid var(--border);
  padding: 9px 16px;
  border-radius: 999px;
  color: var(--heading) !important;
}

.nav-login:hover { border-color: var(--green); color: var(--link) !important; }

.nav-cta {
  background: var(--green);
  color: var(--white) !important;
  padding: 10px 18px;
  border-radius: 999px;
}

.nav-cta:hover { background: var(--green-dark); color: var(--white) !important; }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-alt);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}

.theme-toggle:hover { border-color: var(--green); }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.nav-toggle span {
  width: 24px;
  height: 2px;
  background: var(--heading);
  display: block;
}

/* ---------- HERO ---------- */
.hero {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-dark) 100%);
  color: var(--white);
  padding: 100px 0 90px;
  text-align: center;
}

.hero-inner { max-width: 760px; margin: 0 auto; }

.hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
}

.hero-sub {
  font-size: 1.15rem;
  color: #C9D6E0;
  margin-bottom: 32px;
}

.hero-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  padding: 14px 28px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.95rem;
  border: 2px solid transparent;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.btn-primary {
  background: var(--green);
  color: var(--white);
}
.btn-primary:hover { background: var(--green-dark); }

.btn-outline {
  border-color: var(--white);
  color: var(--white);
}
.btn-outline:hover { background: rgba(255,255,255,0.1); }

.btn-primary-inverse {
  background: var(--white);
  color: var(--navy);
}
.btn-primary-inverse:hover { background: var(--gray-light); }

.btn-outline-inverse {
  border-color: var(--white);
  color: var(--white);
}
.btn-outline-inverse:hover { background: rgba(255,255,255,0.15); }

.btn-outline-navy {
  border-color: var(--border);
  color: var(--heading);
}
.btn-outline-navy:hover { border-color: var(--green); color: var(--link); }

/* ---------- TRUST BAR ---------- */
.trust-bar {
  background: var(--navy-dark);
  color: #DCE6EC;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.trust-inner {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 14px 20px;
  flex-wrap: wrap;
  text-align: center;
}

.trust-inner .dot { color: var(--green); }

/* ---------- SECTIONS ---------- */
.section { padding: 48px 0; }
.section-alt { background: var(--bg-alt); transition: background 0.2s; }

.section-title {
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  color: var(--heading);
  text-align: center;
  margin-bottom: 10px;
}

.section-lead {
  text-align: center;
  color: var(--text-muted);
  max-width: 640px;
  margin: 0 auto 28px;
}

.section-note {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 24px;
}

/* ---------- ABOUT ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 18px;
}

.about-card {
  background: var(--bg-alt);
  border-radius: var(--radius);
  padding: 18px 22px;
}

.about-card h3 { color: var(--link); margin-bottom: 6px; }
.about-card p { margin: 0; font-size: 0.92rem; }

.values-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.value-item {
  text-align: center;
  padding: 4px 14px;
}

.value-icon { font-size: 1.6rem; display: block; margin-bottom: 4px; }

.value-item h4 { color: var(--heading); margin: 0 0 4px; font-size: 1rem; }

.value-item p { color: var(--text-muted); font-size: 0.85rem; line-height: 1.4; margin: 0; }

/* ---------- SERVICES ---------- */
.services-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.service-card {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  border-top: 4px solid var(--green);
  cursor: default;
}

.service-card h3 { color: var(--heading); font-size: 1.05rem; }
.service-card p { color: var(--text-muted); font-size: 0.9rem; margin: 0; }

.service-tooltip {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 8px;
  right: 8px;
  z-index: 20;
  background: var(--bg-surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  text-align: left;
  box-shadow: 0 6px 18px rgba(0,0,0,0.16);
  font-size: 0.8rem;
}

.service-card:hover .service-tooltip,
.service-card:focus-within .service-tooltip,
.service-card:focus .service-tooltip {
  display: block;
}

.service-tooltip strong {
  display: block;
  color: var(--heading);
  font-size: 0.75rem;
  margin-bottom: 4px;
}

.service-tooltip ul {
  margin: 0;
  padding-left: 16px;
}

.service-tooltip li { padding: 1px 0; }

.tooltip-more {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-style: italic;
}

/* ---------- COVERAGE ---------- */
.coverage-layout {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 30px;
  align-items: center;
}

.coverage-map {
  background: #EAF2F8;
  border-radius: var(--radius);
  padding: 10px;
  max-width: 300px;
}

.coverage-map img,
.coverage-map svg {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 975.537 / 654.82;
  object-fit: contain;
}

.coverage-map-state {
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.coverage-map-state:hover,
.coverage-map-state:focus {
  opacity: 0.75;
  outline: none;
}

.coverage-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.coverage-card {
  background: var(--navy);
  color: var(--white);
  border-radius: var(--radius);
  padding: 14px 24px;
  text-align: center;
  cursor: default;
  transition: background 0.15s;
}

.coverage-card:hover,
.coverage-card:focus-visible {
  background: var(--navy-dark);
  outline: none;
}

.coverage-card h3 { margin: 0; font-size: 1.1rem; }

/* Panel fijo debajo del mapa y las tarjetas — nunca se superpone a nada,
   el contenido cambia con JS según el estado que se esté señalando. */
.coverage-cities-panel {
  margin-top: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 16px;
  font-size: 0.82rem;
  min-height: 16px;
}

.coverage-cities-panel .cities-hint {
  color: var(--text-muted);
  font-style: italic;
}

.coverage-cities-panel strong {
  color: var(--heading);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-right: 8px;
}

.coverage-cities-panel .cities-list { color: var(--text); }

/* ---------- CERTIFICATIONS ---------- */
.cert-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.cert-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
  box-shadow: var(--card-shadow);
}

.cert-icon { font-size: 2.2rem; display: block; margin-bottom: 10px; }
.cert-card h3 { color: var(--heading); font-size: 1.05rem; }
.cert-card p { color: var(--text-muted); font-size: 0.9rem; margin: 0; }

/* ---------- CTA FINAL ---------- */
.cta-final {
  background: var(--green);
  color: var(--white);
  padding: 70px 0;
  text-align: center;
}

.cta-final h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
.cta-final p { margin-bottom: 28px; color: #EAF6EE; }

/* ---------- CONTACT ---------- */
#contacto { padding: 36px 0 28px; }

.contact-wrap {
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
}

.contact-title {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(1.5rem, 3vw, 2rem);
  color: var(--heading);
  margin-bottom: 14px;
}

.contact-form-dark {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #1A1A1D;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 18px;
  padding: 22px 26px;
  text-align: left;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.contact-form-dark .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.contact-form-dark input,
.contact-form-dark select,
.contact-form-dark textarea {
  width: 100%;
  font-family: inherit;
  font-size: 0.9rem;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
  background: #232326;
  color: #EDEDED;
}

.contact-form-dark select { color: #9A9A9E; }
.contact-form-dark select:valid { color: #EDEDED; }

.contact-form-dark input::placeholder,
.contact-form-dark textarea::placeholder { color: #7A7A7E; }

.contact-form-dark textarea { resize: vertical; min-height: 64px; }

.contact-form-dark input:focus,
.contact-form-dark select:focus,
.contact-form-dark textarea:focus {
  outline: none;
  border-color: var(--green);
}

.form-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.85rem;
  color: #ABABAF;
}

.form-check input {
  width: 16px;
  height: 16px;
  min-width: 16px;
  margin-top: 2px;
  accent-color: var(--green);
}

.form-check a { color: #EDEDED; text-decoration: underline; }

.contact-form-dark .btn {
  align-self: flex-end;
  background: #F2F2F0;
  color: #111;
  font-weight: 700;
  padding: 12px 34px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
}

.contact-form-dark .btn:hover { background: #FFFFFF; }

.form-note {
  color: var(--green);
  font-weight: 600;
  font-size: 0.9rem;
}

.form-note-error {
  color: #E5484D;
}

.form-note-error a { color: inherit; text-decoration: underline; }

.legal-links {
  margin-top: 14px;
  font-size: 0.8rem;
  color: #8A8A8E;
}

.legal-links a { color: #B7B7BC; text-decoration: underline; }
.legal-links a:hover { color: #FFFFFF; }

@media (max-width: 640px) {
  .contact-form-dark .form-row { grid-template-columns: 1fr; }
  .contact-form-dark .btn { align-self: stretch; }
}

/* ---------- FOOTER ---------- */
.site-footer {
  background: var(--navy-dark);
  color: #B9C6CF;
  padding: 32px 0;
  font-size: 0.85rem;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--white);
  font-weight: 700;
}

.footer-brand img { height: 28px; }

/* ---------- INSURERS DIRECTORY ---------- */
.insurers-hero { padding-top: 48px; }

.insurers-search { max-width: 420px; margin: 0 auto 20px; }

.insurers-search input {
  width: 100%;
  font-family: inherit;
  font-size: 1rem;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-surface);
  color: var(--text);
}

.insurers-search input:focus {
  outline: none;
  border-color: var(--green);
}

.insurers-disclaimer {
  max-width: 720px;
  margin: 0 auto 36px;
}

.inline-link { color: var(--link); font-weight: 600; }

.insurers-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.insurer-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.insurer-card h3 { color: var(--heading); font-size: 1rem; margin-bottom: 2px; }

.insurer-phone-note {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin: 0;
}

.insurer-phone {
  color: var(--link);
  font-weight: 700;
  font-size: 1.05rem;
}

.insurer-site {
  color: var(--text-muted);
  font-size: 0.85rem;
  text-decoration: underline;
}

@media (max-width: 860px) {
  .insurers-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .insurers-grid { grid-template-columns: 1fr; }
}

/* ---------- LOGIN PLACEHOLDER ---------- */
.login-placeholder { padding: 100px 0; }

.login-placeholder-inner {
  max-width: 560px;
  margin: 0 auto;
  text-align: center;
}

.login-icon { font-size: 2.6rem; display: block; margin-bottom: 16px; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 860px) {
  .about-grid,
  .contact-grid {
    grid-template-columns: 1fr;
  }
  .values-grid,
  .services-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .coverage-layout,
  .cert-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .nav-toggle { display: flex; }

  .site-nav {
    position: absolute;
    top: 72px;
    left: 0;
    right: 0;
    background: var(--header-bg);
    flex-direction: column;
    align-items: flex-start;
    padding: 16px 20px 24px;
    border-bottom: 1px solid var(--border);
    display: none;
    gap: 16px;
  }

  .site-nav.open { display: flex; }

  .nav-cta { align-self: flex-start; }

  .values-grid,
  .services-grid {
    grid-template-columns: 1fr;
  }

  .hero { padding: 70px 0 60px; }
  .section { padding: 56px 0; }
}

/* Animación de entrada: el logo aparece opaco/gris y se va "coloreando" */
.intro-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  transition: opacity 0.45s ease, visibility 0.45s ease;
}

.intro-loader.intro-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.intro-logo-wrap {
  position: relative;
  width: 110px;
  height: 110px;
}

.intro-logo-wrap img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.intro-logo-base {
  filter: grayscale(100%) opacity(0.3);
}

.intro-logo-fill {
  clip-path: inset(100% 0 0 0);
  animation: intro-fill 1.1s cubic-bezier(0.65, 0, 0.35, 1) forwards;
  animation-delay: 0.2s;
}

@keyframes intro-fill {
  to { clip-path: inset(0 0 0 0); }
}

body.intro-active {
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .intro-logo-base { display: none; }
  .intro-logo-fill { clip-path: inset(0 0 0 0); animation: none; }
}

/* ---------- LEGAL PAGES ---------- */
.legal-page { padding: 64px 0 90px; }

.legal-content { max-width: 760px; margin: 0 auto; }

.legal-updated {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 32px;
}

.legal-content h2 {
  color: var(--heading);
  font-size: 1.15rem;
  margin: 32px 0 10px;
}

.legal-content p,
.legal-content li {
  color: var(--text);
  line-height: 1.7;
}

.legal-content ul { padding-left: 20px; margin: 10px 0; }
.legal-content a { color: var(--link); font-weight: 600; }
