/* ==========================================================================
   CAIM Xalapa — Landing estática
   Hoja de estilos única (minimalista, monocromática, blanca y negra)
   ========================================================================== */

:root {
  /* Paleta */
  --bg: #ffffff;
  --fg: #09090b;
  --ink: #111111;
  --muted: #52525b;
  --text-muted: #71717a;
  --soft: #a1a1aa;
  --border: #e4e4e7;
  --panel: #fafafa;
  --panel-2: #f4f4f5;

  /* Gradientes */
  --grad-text: linear-gradient(180deg, #09090b 0%, #52525b 100%);
  --grad-btn: linear-gradient(180deg, #18181b 0%, #09090b 100%);
  --grad-btn-hover: linear-gradient(180deg, #27272a 0%, #18181b 100%);
  --grad-card: linear-gradient(160deg, #18181b 0%, #09090b 100%);
  --hero-overlay: linear-gradient(to bottom, rgba(255, 255, 255, 0.65) 0%, rgba(255, 255, 255, 0.88) 60%, #ffffff 100%);

  /* Sistema */
  --radius: 14px;
  --max: 1080px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --dur: 0.35s;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a { color: var(--ink); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 3px;
  border-radius: 4px;
}

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

.container {
  width: min(var(--max), 92%);
  margin: 0 auto;
}

/* Texto con degradado metálico oscuro */
.text-gradient {
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--fg);
  color: #fff;
  padding: 10px 16px;
  border-radius: 0 0 8px 0;
  z-index: 100;
}
.skip-link:focus { left: 0; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.86);
  -webkit-backdrop-filter: blur(10px) saturate(160%);
  backdrop-filter: blur(10px) saturate(160%);
  border-bottom: 1px solid var(--border);
  transition: box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
}
.site-header.scrolled {
  box-shadow: 0 10px 30px -22px rgba(9, 9, 11, 0.6);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
}

.brand img { height: 38px; width: auto; }

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

.site-nav a {
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--muted);
  text-decoration: none;
  transition: color var(--dur) var(--ease);
}
.site-nav a:hover { color: var(--fg); }

.nav-cta { text-decoration: none; }

/* ---------- Botón hamburguesa ---------- */
.menu-toggle {
  display: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  transition: border-color var(--dur) var(--ease);
}
.menu-toggle:hover { border-color: var(--fg); }
.menu-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--fg);
  transition: transform 0.25s var(--ease), opacity 0.2s var(--ease);
}
.menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 0.94rem;
  font-weight: 600;
  text-decoration: none;
  transition: all var(--dur) var(--ease);
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }

.btn-primary {
  background: var(--grad-btn);
  color: #e4e4e7;
  border: 1px solid #09090b;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 10px 22px -14px rgba(9, 9, 11, 0.9);
  transition: all var(--dur) var(--ease);
}
.btn-primary:hover,
.btn-primary:active {
  background: var(--grad-btn-hover);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 16px 30px -14px rgba(9, 9, 11, 0.95);
}
.btn-primary:hover {
  
  background: var(--grad-btn-hover);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 14px 28px -14px rgba(9, 9, 11, 0.95);
}

.btn-outline {
  background: #fff;
  color: var(--fg);
  border: 1px solid var(--border);
}
.btn-outline:hover { border-color: var(--fg); }

/* Alta especificidad: evita que .site-nav a:hover herede color sobre el botón */
.btn-primary,
a.btn-primary,
.nav-cta,
a.nav-cta {
  background: #09090b !important;
  color: #e4e4e7 !important;
  text-decoration: none !important;
}
.btn-primary:hover,
a.btn-primary:hover,
.btn-primary:focus,
a.btn-primary:focus,
.nav-cta:hover,
a.nav-cta:hover,
.nav-cta:focus,
a.nav-cta:focus {
  background: #18181b !important;
  color: #ffffff !important;
  text-decoration: none !important;
  box-shadow: 0 10px 25px -10px rgba(0, 0, 0, 0.7);
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: 88px 0 76px;
  background-image: url("images/Clinica_degradado.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: var(--hero-overlay);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
.hero > .container {
  position: relative;
  z-index: 1;
}
.eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: transparent;
  background-image: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 15px;
  margin-bottom: 24px;
  box-shadow: inset 0 1px 0 #fff, 0 1px 0 rgba(9, 9, 11, 0.02);
}
.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.3rem);
  line-height: 1.06;
  letter-spacing: -0.025em;
  font-weight: 700;
  max-width: 16em;
}
.hero p {
  margin: 24px 0 0;
  color: var(--text-muted);
  max-width: 40em;
  font-size: 1.05rem;
}
.hero p strong { color: var(--fg); }
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 34px;
}

/* ---------- Secciones ---------- */
.section { padding: 76px 0; border-top: 1px solid var(--border); }
.section.alt { background: linear-gradient(180deg, var(--panel) 0%, #ffffff 100%); }
.section-head { max-width: 42em; margin-bottom: 44px; }
.section-head .kicker {
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--soft);
}
.section-head h2 {
  margin: 12px 0 0;
  font-size: clamp(1.6rem, 3.4vw, 2.3rem);
  letter-spacing: -0.025em;
  font-weight: 700;
}
.section-head p { margin: 14px 0 0; color: var(--text-muted); }

/* ---------- Grid ---------- */
.grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

/* ---------- Tarjetas de servicio ---------- */
.card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  transition: all var(--dur) var(--ease);
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--grad-card);
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}

.card:hover,
.card:focus-within {
  transform: translateY(-6px);
  border-color: transparent;
  box-shadow:
    0 24px 48px -26px rgba(9, 9, 11, 0.6),
    0 10px 20px -16px rgba(9, 9, 11, 0.5);
}

.card:hover::before,
.card:focus-within::before { opacity: 1; }

/* Tarjeta de servicio */
.card { padding: 24px; }
.card h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
  color: var(--ink);
  transition: color var(--dur) var(--ease);
}
.card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.94rem;
  transition: color var(--dur) var(--ease);
}

.card:hover h3,
.card:focus-within h3 { color: #ffffff; }
.card:hover p,
.card:focus-within p { color: var(--soft); }

/* ---------- Directorio ---------- */
.area { margin-top: 40px; }
.area:first-of-type { margin-top: 0; }
.area-title {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 18px;
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg);
}
.area-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border), transparent);
}

/* Cuadrícula de ancho uniforme (las tarjetas no se estiran con 1 solo doctor) */
.area .grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 260px));
  gap: 20px;
  justify-content: start;
}
@media (max-width: 600px) {
  .area .grid {
    grid-template-columns: 1fr;
  }
}

/* Tarjeta de especialista (revela fotografía en hover / tap) */
.doctor {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px 16px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #ffffff;
  min-height: 250px;
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.doctor .photo {
  position: relative;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  margin-bottom: 16px;
  overflow: hidden;
  background: #f4f4f5;
  border: 2px solid #e4e4e7;
  transition: all 0.35s ease;
  z-index: 2;
}
.doctor .photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  filter: grayscale(1);
  opacity: 0.85;
  transition: all 0.35s ease;
}
.doctor .name {
  position: relative;
  z-index: 2;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  transition: color 0.35s ease;
  margin-top: 4px;
}
/* Fondo oscuro dinámico en tarjeta */
.doctor::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: var(--grad-card);
  opacity: 0;
  transition: opacity 0.35s ease;
}
/* Efecto Hover / Focus / Tap (.is-active) */
.doctor:hover,
.doctor:focus-within,
.doctor.is-active {
  transform: translateY(-6px);
  border-color: #27272a;
  box-shadow: 0 20px 35px -15px rgba(0, 0, 0, 0.4);
}
.doctor:hover::before,
.doctor:focus-within::before,
.doctor.is-active::before {
  opacity: 1;
}
.doctor:hover .photo,
.doctor:focus-within .photo,
.doctor.is-active .photo {
  width: 130px;
  height: 130px;
  border-radius: 18px;
  border-color: #3f3f46;
}
.doctor:hover .photo img,
.doctor:focus-within .photo img,
.doctor.is-active .photo img {
  filter: grayscale(0);
  opacity: 1;
  transform: scale(1.05);
}
.doctor:hover .name,
.doctor:focus-within .name,
.doctor.is-active .name {
  color: #ffffff;
}

/* ---------- Ubicación ---------- */
.location {
  display: grid;
  gap: 28px;
  grid-template-columns: 1fr 1.2fr;
  align-items: start;
}
.contact-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.contact-list li {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  padding: 16px 18px;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.contact-list li:hover {
  border-color: var(--soft);
  box-shadow: 0 16px 30px -24px rgba(9, 9, 11, 0.55);
}
.contact-list .label {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--soft);
  margin-bottom: 4px;
}
.contact-list a,
.contact-list span.value {
  color: var(--muted);
  font-size: 0.95rem;
  word-break: break-word;
}
.contact-list a:hover { color: var(--fg); }

.map-frame {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  line-height: 0;
  box-shadow: 0 24px 50px -34px rgba(9, 9, 11, 0.55);
}
.map-frame iframe { display: block; width: 100%; height: 350px; border: 0; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 48px 0 34px;
  background: linear-gradient(180deg, #ffffff 0%, var(--panel) 100%);
}
.footer-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: 1.4fr 1fr 1fr;
}
.site-footer img { height: 34px; width: auto; margin-bottom: 14px; }
.site-footer p,
.site-footer a { color: var(--text-muted); font-size: 0.9rem; }
.site-footer a { transition: color var(--dur) var(--ease); }
.site-footer a:hover { color: var(--fg); }
.site-footer h4 {
  margin: 0 0 12px;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
}
.footer-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.footer-bottom {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--soft);
}

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .menu-toggle { display: flex; }

  .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: #fff;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 24px 40px -30px rgba(9, 9, 11, 0.6);
    padding: 10px 4% 18px;
  }
  .site-nav.open { display: flex; }
  .site-nav a {
    padding: 14px 4px;
    border-bottom: 1px solid var(--border);
    font-size: 1rem;
    color: var(--fg);
  }
  .site-nav .nav-cta {
    margin-top: 14px;
    border-bottom: none;
    color: #e4e4e7;
  }
  .site-nav .nav-cta:hover,
  .site-nav .nav-cta:active {
    color: #ffffff;
  }

  .hero { padding: 60px 0 52px; }
  .section { padding: 54px 0; }
  .location { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }

  /* Títulos de especialidad centrados (solo móvil/tablet) */
  .area-title {
    justify-content: center;
    text-align: center;
    margin-bottom: 20px;
  }
  .area-title::after {
    display: none;
  }

  /* Tarjetas de doctor centradas y proporcionadas */
  .area .grid {
    grid-template-columns: minmax(auto, 280px);
    justify-content: center;
  }
}

/* ---------- Movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }
}
