/* ==========================================================================
   Centro Médico Cornejo — styles.css
   Paleta inspirada en la fachada real: pared grafito, detalles turquesa,
   vegetación y calidez. Mobile first, sin dependencias externas.
   ========================================================================== */

:root {
  --turquesa: #1c9e96;
  --turquesa-oscuro: #157d77;
  --petroleo: #0f3d43;
  --petroleo-profundo: #0b2e33;
  --grafito: #2b2d2e;
  --texto: #32403f;
  --texto-suave: #5c6b69;
  --blanco-calido: #faf9f6;
  --gris-claro: #eef2f0;
  --verde-suave: #dcebe2;
  --whatsapp: #1fa855;
  --whatsapp-oscuro: #178a45;
  --borde: #dde4e1;
  --sombra: 0 8px 24px rgba(15, 61, 67, 0.08);
  --radio: 14px;
  --fuente: system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

/* Reset básico */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--fuente);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--texto);
  background: var(--blanco-calido);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3 { line-height: 1.2; color: var(--petroleo); margin: 0 0 0.6em; text-wrap: balance; }
h1 { font-size: clamp(1.9rem, 5.5vw, 3rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.5rem, 4vw, 2.2rem); letter-spacing: -0.01em; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
a { color: var(--turquesa-oscuro); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--petroleo); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--turquesa);
  outline-offset: 2px;
  border-radius: 4px;
}

.container { width: min(100% - 2.5rem, 1100px); margin-inline: auto; }

/* El fallback sin JavaScript solo se muestra cuando JS está desactivado */
.js noscript { display: none; }

/* Saltar al contenido */
.skip-link {
  position: absolute; left: 1rem; top: -100px;
  background: var(--petroleo); color: #fff;
  padding: 0.7rem 1.2rem; border-radius: 8px; z-index: 200;
  transition: top 0.2s;
}
.skip-link:focus { top: 1rem; color: #fff; }

/* ==========================================================================
   Botones
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.55rem;
  min-height: 48px; padding: 0.7rem 1.4rem;
  border-radius: 999px; border: 2px solid transparent;
  font: inherit; font-weight: 600; font-size: 1rem;
  text-decoration: none; cursor: pointer;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s, transform 0.15s;
}
.btn:hover { transform: translateY(-1px); }
.btn--primary { background: var(--turquesa); color: #fff; }
.btn--primary:hover { background: var(--turquesa-oscuro); color: #fff; }
.btn--whatsapp { background: var(--whatsapp); color: #fff; }
.btn--whatsapp:hover { background: var(--whatsapp-oscuro); color: #fff; }
.btn--secondary { background: transparent; color: var(--petroleo); border-color: var(--petroleo); }
.btn--secondary:hover { background: var(--petroleo); color: #fff; }
.btn--outline { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.6); }
.btn--outline:hover { background: rgba(255, 255, 255, 0.12); color: #fff; border-color: #fff; }
.btn--small { min-height: 42px; padding: 0.45rem 1.1rem; font-size: 0.95rem; }
.btn--big { min-height: 56px; padding: 0.9rem 1.8rem; font-size: 1.05rem; }
.btn--block { width: 100%; }

/* ==========================================================================
   Encabezado
   ========================================================================== */
.header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(250, 249, 246, 0.96);
  border-bottom: 1px solid var(--borde);
  backdrop-filter: blur(6px);
}
.header__inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--petroleo); }
.brand__mark { flex: none; }
.brand__text { display: flex; flex-direction: column; line-height: 1.1; }
.brand__text strong { font-size: 1rem; letter-spacing: 0.01em; }
.brand__text span { font-size: 0.85rem; color: var(--turquesa-oscuro); font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; }

.nav-toggle {
  display: flex; flex-direction: column; justify-content: center; gap: 5px;
  width: 48px; height: 48px; padding: 12px;
  background: none; border: 1px solid var(--borde); border-radius: 10px; cursor: pointer;
}
.nav-toggle__bar { display: block; width: 100%; height: 2.5px; background: var(--petroleo); border-radius: 2px; transition: transform 0.25s, opacity 0.2s; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }

.nav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: var(--blanco-calido); border-bottom: 1px solid var(--borde); box-shadow: var(--sombra); }
.nav.nav--abierto { display: block; }
.nav__list { list-style: none; margin: 0; padding: 0.8rem 1.25rem 1.2rem; display: flex; flex-direction: column; gap: 0.15rem; }
.nav__list a:not(.btn) {
  display: block; padding: 0.7rem 0.5rem; border-radius: 8px;
  color: var(--petroleo); text-decoration: none; font-weight: 500;
}
.nav__list a:not(.btn):hover { background: var(--gris-claro); }
.nav__cta { margin-top: 0.6rem; }

@media (min-width: 900px) {
  .nav-toggle { display: none; }
  .nav { display: block; position: static; background: none; border: 0; box-shadow: none; }
  .nav__list { flex-direction: row; align-items: center; gap: 0.2rem; padding: 0; }
  .nav__list a:not(.btn) { padding: 0.5rem 0.75rem; }
  .nav__cta { margin: 0 0 0 0.6rem; }
}

/* ==========================================================================
   Hero
   ========================================================================== */
.hero { padding: 3rem 0 3.5rem; background: linear-gradient(180deg, var(--verde-suave) 0%, var(--blanco-calido) 70%); }
.hero__grid { display: grid; gap: 2.2rem; align-items: center; }
.eyebrow {
  font-size: 0.82rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--turquesa-oscuro); margin-bottom: 0.9rem;
}
.eyebrow--light { color: #7fd4cc; }
.hero__lead { font-size: 1.1rem; color: var(--texto-suave); max-width: 34rem; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 0.8rem; margin: 1.6rem 0 1.8rem; }
.hero__data { list-style: none; margin: 0; padding: 1.1rem 0 0; border-top: 1px solid var(--borde); display: flex; flex-wrap: wrap; gap: 1.2rem 2.2rem; }
.hero__data li { display: flex; flex-direction: column; gap: 0.1rem; }
.hero__data a { font-weight: 600; white-space: nowrap; }
.hero__data-label { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--texto-suave); }
.hero__media { margin: 0; }
.hero__media img {
  width: 100%; aspect-ratio: 4 / 3.4; object-fit: cover; object-position: 50% 62%;
  border-radius: var(--radio); box-shadow: var(--sombra);
  border: 6px solid #fff;
}
@media (min-width: 900px) {
  .hero { padding: 4.5rem 0 5rem; }
  .hero__grid { grid-template-columns: 1.15fr 0.85fr; gap: 3.5rem; }
  .hero__media img { aspect-ratio: 4 / 4.4; }
}

/* ==========================================================================
   Secciones
   ========================================================================== */
.section { padding: 3.5rem 0; }
.section__lead { color: var(--texto-suave); max-width: 40rem; font-size: 1.05rem; margin-bottom: 2rem; }
.section--gray { background: var(--gris-claro); }
.section--dark { background: var(--petroleo-profundo); }
.section--dark h2, .section--dark h3 { color: var(--blanco-calido); }
.section--dark .section__lead { color: #b8cfcb; }
.section--dark a:not(.btn) { color: #7fd4cc; }
.section--dark a:not(.btn):hover { color: #fff; }
.section__cta { margin-top: 2.2rem; text-align: center; }
.section__cta p { font-weight: 600; color: var(--petroleo); }
@media (min-width: 900px) { .section { padding: 5rem 0; } }

/* Principios institucionales */
.principles { display: grid; gap: 1rem; margin-top: 2.2rem; }
.principle { background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.12); border-radius: var(--radio); padding: 1.5rem; }
.principle__icon {
  width: 52px; height: 52px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(28, 158, 150, 0.18); color: #4fc4bb; margin-bottom: 1rem;
}
.principle h3 { margin-bottom: 0.35em; }
.principle p { margin: 0; color: #b8cfcb; font-size: 0.97rem; }
@media (min-width: 720px) { .principles { grid-template-columns: repeat(3, 1fr); gap: 1.3rem; } }

/* Tarjetas de especialidades */
.cards { display: grid; gap: 1rem; }
.card {
  display: flex; align-items: center; gap: 1rem;
  background: #fff; border: 1px solid var(--borde); border-radius: var(--radio);
  padding: 1.5rem; box-shadow: var(--sombra);
}
.card__icon {
  width: 50px; height: 50px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 50px;
  background: var(--verde-suave); color: var(--turquesa-oscuro);
}
.card h3 { margin: 0; }
.card p { margin: 0; color: var(--texto-suave); font-size: 0.97rem; }
@media (min-width: 640px) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .cards { grid-template-columns: repeat(3, 1fr); gap: 1.3rem; } }

/* Equipo */
.team { display: grid; gap: 1rem; }
.profesional {
  background: #fff; border: 1px solid var(--borde); border-radius: var(--radio);
  padding: 1.6rem; box-shadow: var(--sombra);
  display: flex; flex-direction: column; align-items: flex-start; gap: 0.2rem;
}
.profesional__avatar {
  width: 62px; height: 62px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--petroleo); color: #7fd4cc;
  font-weight: 700; font-size: 1.15rem; letter-spacing: 0.04em;
  margin-bottom: 0.9rem;
}
.profesional:nth-child(even) .profesional__avatar { background: var(--turquesa-oscuro); color: #eafaf8; }
.profesional h3 { margin-bottom: 0.15em; }
.profesional__especialidad { color: var(--texto-suave); font-size: 0.95rem; margin: 0 0 1.1rem; }
.profesional .btn { margin-top: auto; }
.team-fallback { padding-left: 1.2rem; }
@media (min-width: 640px) { .team { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .team { grid-template-columns: repeat(3, 1fr); gap: 1.3rem; } }

/* ==========================================================================
   Ubicación
   ========================================================================== */
.ubicacion__grid { display: grid; gap: 1.5rem; }
.ubicacion__media { margin: 0; }
.ubicacion__media img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; object-position: 50% 60%; border-radius: var(--radio); box-shadow: var(--sombra); }
.ubicacion__media figcaption { font-size: 0.9rem; color: var(--texto-suave); margin-top: 0.6rem; }
.ubicacion__map { border-radius: var(--radio); overflow: hidden; border: 1px solid var(--borde); box-shadow: var(--sombra); }
.ubicacion__map iframe { display: block; width: 100%; height: 260px; border: 0; }
.ubicacion__acciones { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 1.2rem; }
.ubicacion__datos { list-style: none; margin: 1.4rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; color: var(--texto-suave); }
@media (min-width: 900px) { .ubicacion__grid { grid-template-columns: 1fr 1.15fr; gap: 2.5rem; align-items: start; } }

/* Contacto */
.contacto__acciones { display: flex; flex-direction: column; gap: 0.9rem; margin-top: 2rem; }
@media (min-width: 720px) { .contacto__acciones { flex-direction: row; flex-wrap: wrap; } }

/* ==========================================================================
   Footer
   ========================================================================== */
.footer { background: var(--grafito); color: #cfd6d4; padding: 3rem 0 1.5rem; }
.footer a { color: #7fd4cc; }
.footer a:hover { color: #fff; }
.footer__grid { display: grid; gap: 2rem; padding-bottom: 2rem; border-bottom: 1px solid rgba(255, 255, 255, 0.12); }
.footer__nombre { font-size: 1.15rem; font-weight: 700; color: #fff; margin-bottom: 0.6rem; }
.footer__brand p { margin: 0 0 0.35rem; }
.footer__nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem 1.4rem; }
.footer__nav a { text-decoration: none; padding: 0.35rem 0; display: inline-block; }
.footer__legal { padding-top: 1.4rem; font-size: 0.9rem; color: #9aa4a1; }
.footer__legal p { margin: 0; }
@media (min-width: 720px) { .footer__grid { grid-template-columns: 1fr auto; align-items: start; } }

/* ==========================================================================
   Botón flotante de WhatsApp
   ========================================================================== */
.whatsapp-flotante {
  position: fixed;
  right: max(1.1rem, env(safe-area-inset-right));
  bottom: max(1.1rem, env(safe-area-inset-bottom));
  z-index: 90;
  width: 58px; height: 58px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--whatsapp); color: #fff;
  box-shadow: 0 6px 18px rgba(23, 138, 69, 0.4);
  transition: transform 0.2s, background-color 0.2s;
}
.whatsapp-flotante:hover { background: var(--whatsapp-oscuro); color: #fff; transform: scale(1.06); }
.whatsapp-flotante:focus-visible { outline: 3px solid var(--petroleo); }

/* ==========================================================================
   Animaciones de entrada (sutiles, respetan prefers-reduced-motion)
   ========================================================================== */
.reveal > * { opacity: 1; transform: none; }
@media (prefers-reduced-motion: no-preference) {
  .js .reveal > * { opacity: 0; transform: translateY(14px); transition: opacity 0.5s ease, transform 0.5s ease; }
  .js .reveal.reveal--visible > * { opacity: 1; transform: none; }
  .js .reveal.reveal--visible > *:nth-child(2) { transition-delay: 0.08s; }
  .js .reveal.reveal--visible > *:nth-child(3) { transition-delay: 0.16s; }
  .js .reveal.reveal--visible > *:nth-child(4) { transition-delay: 0.24s; }
  .js .reveal.reveal--visible > *:nth-child(5) { transition-delay: 0.32s; }
  .js .reveal.reveal--visible > *:nth-child(6) { transition-delay: 0.4s; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
