/* Oftalmo&Plástico — rediseño */
:root {
  --tinta: #14223a;
  --tinta-2: #1d3150;
  --acero: #2e5aa8;
  --acero-hover: #234a8f;
  --iris: #9cc1ea;
  --niebla: #eef3f8;
  --linea: #d5dee9;
  --papel: #ffffff;
  --texto: #1f2a37;
  --grafito: #4f5d6f;

  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;

  --ancho: 1180px;
  --gutter: clamp(16px, 4vw, 40px);
  --r: 6px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  margin: 0;
  background: var(--papel);
  color: var(--texto);
  font: 400 1.0625rem/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--acero); }
a:hover { color: var(--acero-hover); }
h1, h2, h3, p, ul, ol, dl, dd, figure, blockquote { margin: 0; padding: 0; }
ul, ol { list-style: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--iris); outline-offset: 3px; border-radius: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.saltar { position: absolute; left: 12px; top: -60px; z-index: 50; padding: 10px 16px; background: var(--papel); border-radius: var(--r); }
.saltar:focus { top: 12px; }
.envoltura { max-width: var(--ancho); margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- Cabecera: vidrio oscuro sobre el slider ---------- */
.cabecera {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  background: rgba(10, 18, 32, .52);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
          backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid rgba(255,255,255,.1);
  transition: background .3s ease;
}
.cabecera.solida { background: rgba(10, 18, 32, .82); }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .cabecera { background: rgba(10, 18, 32, .92); }
}
.cabecera-in {
  max-width: var(--ancho);
  margin: 0 auto;
  padding: 12px var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.marca img { width: 190px; height: auto; }
.menu { display: flex; align-items: center; gap: 30px; }
.menu a {
  color: #e6edf6;
  text-decoration: none;
  font-weight: 600;
  font-size: .8rem;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.menu a:hover { color: #fff; text-decoration: underline; text-underline-offset: 7px; text-decoration-thickness: 1px; }
.menu .menu-llamar {
  padding: 11px 18px;
  border-radius: 999px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.28);
  color: #fff;
}
.menu .menu-llamar:hover { background: var(--acero); border-color: var(--acero); text-decoration: none; }
.menu-btn { display: none; }
main > section:not(.hero):first-of-type { scroll-margin-top: 80px; }

/* ---------- Slider de frases ---------- */
.hero {
  position: relative;
  height: min(86vh, 780px);
  min-height: 520px;
  background: #050a14;
  color: #fff;
  overflow: hidden;
}
.slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 1s ease, visibility 0s linear 1s;
}
.slide.activa { opacity: 1; visibility: visible; transition: opacity 1s ease; }
.slide-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.08);
}
.slide.activa .slide-bg { animation: acercar var(--dur, 14s) linear forwards; }
@keyframes acercar { from { transform: scale(1.08); } to { transform: scale(1); } }
.slide::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(5,10,20,.78) 0%, rgba(5,10,20,.45) 48%, rgba(5,10,20,0) 80%),
              linear-gradient(0deg, rgba(5,10,20,.55) 0%, rgba(5,10,20,0) 40%);
}
.slide-texto {
  position: absolute;
  z-index: 1;
  left: 0;
  right: 0;
  bottom: clamp(96px, 14vh, 140px);
  max-width: var(--ancho);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: grid;
}
.tiempo {
  grid-area: 1 / 1;
  align-self: end;
  max-width: 100%;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .9s ease, transform .9s ease;
}
.tiempo.visible { opacity: 1; transform: none; }
.tiempo p {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.75rem, 1rem + 2.6vw, 3.25rem);
  line-height: 1.14;
  letter-spacing: -.01em;
  max-width: 24ch;
  text-wrap: balance;
}
.tiempo cite {
  display: block;
  margin-top: 18px;
  font-family: var(--sans);
  font-style: normal;
  font-weight: 500;
  font-size: 1rem;
  color: var(--iris);
}
.hero-controles {
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  bottom: 36px;
  max-width: var(--ancho);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  gap: 16px;
}
.hero-pausa {
  flex: none;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.45);
  border-radius: 50%;
  background: transparent;
  color: #fff;
  cursor: pointer;
}
.hero-pausa:hover { border-color: #fff; }
.hero-pausa svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.hero-pausa .i-play { fill: currentColor; stroke: none; display: none; }
.hero-pausa[aria-pressed="true"] .i-pausa { display: none; }
.hero-pausa[aria-pressed="true"] .i-play { display: block; }
.hero-barras { flex: 1; display: flex; gap: 8px; max-width: 420px; }
.hero-barras button {
  flex: 1;
  height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  position: relative;
}
.hero-barras button::before,
.hero-barras button::after {
  content: "";
  position: absolute;
  left: 0;
  top: 13px;
  height: 2px;
  border-radius: 2px;
}
.hero-barras button::before { right: 0; background: rgba(255,255,255,.3); }
.hero-barras button::after { width: var(--p, 0%); background: #fff; }
.hero-barras button:hover::before { background: rgba(255,255,255,.55); }

/* ---------- Presentación ---------- */
.intro { padding: clamp(56px, 8vw, 104px) 0 clamp(40px, 6vw, 72px); }
.intro-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 80px);
  align-items: start;
}
.intro h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2rem, 1.2rem + 2.6vw, 3.4rem);
  line-height: 1.08;
  letter-spacing: -.015em;
  color: var(--tinta);
  text-wrap: balance;
}
.intro-texto { display: grid; gap: 16px; max-width: 36em; padding-top: 8px; color: var(--grafito); font-size: 1.125rem; }

/* ---------- Encabezados de sección ---------- */
.seccion-cabeza { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 32px; margin-bottom: 28px; }
.seccion-cabeza h2, .directorio h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.75rem, 1.2rem + 1.6vw, 2.5rem);
  line-height: 1.1;
  color: var(--tinta);
}
.seccion-cabeza p { color: var(--grafito); max-width: 34em; }

/* ---------- Especialistas ---------- */
.especialistas { padding: clamp(32px, 5vw, 56px) 0 clamp(64px, 9vw, 112px); border-top: 1px solid var(--linea); }
.filtros { display: flex; flex-wrap: wrap; gap: 8px; }
.filtros button {
  padding: 8px 16px;
  border: 1px solid var(--linea);
  border-radius: 999px;
  background: var(--papel);
  color: var(--texto);
  font-size: .95rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .2s, border-color .2s, color .2s;
}
.filtros button:hover { border-color: var(--acero); color: var(--acero); }
.filtros button[aria-pressed="true"] { background: var(--tinta); border-color: var(--tinta); color: #fff; }
.filtro-estado { min-height: 1.6em; margin: 14px 0 8px; font-size: .95rem; color: var(--grafito); }

.fichas { display: grid; gap: clamp(20px, 3vw, 32px); }
.ficha {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
  background: var(--papel);
  border: 1px solid var(--linea);
  border-radius: 10px;
  overflow: hidden;
}
.ficha[hidden] { display: none; }
.ficha.entra { animation: entra .45s ease both; }
@keyframes entra { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.ficha-foto {
  position: relative;
  align-self: start;
  margin: clamp(12px, 1.6vw, 18px);
  margin-right: 0;
  border-radius: 8px;
  overflow: hidden;
  background: var(--niebla);
}
.ficha-foto img { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; }
.ficha-foto figcaption {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  padding: 6px 12px;
  border-radius: 6px;
  background: rgba(10,18,32,.6);
  -webkit-backdrop-filter: blur(8px);
          backdrop-filter: blur(8px);
  color: #fff;
  font-size: .85rem;
  line-height: 1.35;
}

.ficha-cuerpo {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: clamp(22px, 3vw, 36px);
}
.ficha-cabeza { display: grid; gap: 6px; }
.ficha-clinica { font-weight: 600; font-size: .9rem; color: var(--acero); }
.ficha h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.5rem, 1.1rem + 1vw, 2rem);
  line-height: 1.1;
  color: var(--tinta);
  text-wrap: balance;
}
.ficha-esp { font-weight: 500; color: var(--texto); }
.ficha-bio { color: var(--grafito); font-size: 1rem; }

.ficha-atiende {
  padding: 16px 18px;
  border-radius: 8px;
  background: var(--niebla);
}
.ficha-atiende h4 { margin: 0 0 10px; font-size: .9rem; font-weight: 600; color: var(--tinta); }
.ficha-atiende ul { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 20px; font-size: .95rem; line-height: 1.4; }
.ficha-atiende li { position: relative; padding-left: 24px; }
.ficha-atiende li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .1em;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--acero) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 8.3l2.2 2.2 4.8-5' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 100% no-repeat;
}
.ficha-horario { font-size: .95rem; color: var(--grafito); }

.ficha-contacto {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin-top: auto;
  padding-top: 4px;
}
.ficha-contacto a { text-decoration: none; }
.ficha-contacto .tel {
  display: grid;
  padding: 9px 16px;
  border-radius: 8px;
  background: var(--tinta);
  color: #fff;
  font-size: 1.2rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.ficha-contacto .tel span { font-size: .75rem; font-weight: 500; color: var(--iris); }
.ficha-contacto .tel:hover { background: var(--tinta-2); color: #fff; }
.ficha-contacto .tel-sec { background: var(--niebla); color: var(--tinta); }
.ficha-contacto .tel-sec span { color: var(--grafito); }
.ficha-contacto .tel-sec:hover { background: #e2eaf3; color: var(--tinta); }
.ficha-contacto .enlace {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 14px;
  border: 1px solid var(--linea);
  border-radius: 8px;
  color: var(--acero);
  font-weight: 600;
  font-size: .95rem;
}
.ficha-contacto .enlace:hover { border-color: var(--acero); }
.ficha-contacto .wa { color: #128c4b; }
.ficha-contacto .wa:hover { border-color: #128c4b; color: #0e7a40; }
.ficha-contacto .wa::before {
  content: "";
  width: 18px;
  height: 18px;
  flex: none;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 0 0-8.6 15.1L2 22l5-1.3A10 10 0 1 0 12 2zm0 18.2a8.2 8.2 0 0 1-4.2-1.1l-.3-.2-3 .8.8-2.9-.2-.3A8.2 8.2 0 1 1 12 20.2zm4.5-6.1c-.2-.1-1.5-.7-1.7-.8s-.4-.1-.6.1-.7.8-.8 1-.3.2-.5.1a6.7 6.7 0 0 1-3.3-2.9c-.3-.4.3-.4.7-1.3a.5.5 0 0 0 0-.5l-.8-1.8c-.2-.5-.4-.4-.6-.4h-.5a1 1 0 0 0-.7.3 3 3 0 0 0-.9 2.2 5.1 5.1 0 0 0 1.1 2.7 11.6 11.6 0 0 0 4.5 4c1.7.7 2.3.8 3.2.6a2.7 2.7 0 0 0 1.8-1.2 2.2 2.2 0 0 0 .1-1.3c0-.1-.2-.2-.5-.3z'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 0 0-8.6 15.1L2 22l5-1.3A10 10 0 1 0 12 2zm0 18.2a8.2 8.2 0 0 1-4.2-1.1l-.3-.2-3 .8.8-2.9-.2-.3A8.2 8.2 0 1 1 12 20.2zm4.5-6.1c-.2-.1-1.5-.7-1.7-.8s-.4-.1-.6.1-.7.8-.8 1-.3.2-.5.1a6.7 6.7 0 0 1-3.3-2.9c-.3-.4.3-.4.7-1.3a.5.5 0 0 0 0-.5l-.8-1.8c-.2-.5-.4-.4-.6-.4h-.5a1 1 0 0 0-.7.3 3 3 0 0 0-.9 2.2 5.1 5.1 0 0 0 1.1 2.7 11.6 11.6 0 0 0 4.5 4c1.7.7 2.3.8 3.2.6a2.7 2.7 0 0 0 1.8-1.2 2.2 2.2 0 0 0 .1-1.3c0-.1-.2-.2-.5-.3z'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ---------- Instalaciones ---------- */
.instalaciones { padding: clamp(64px, 9vw, 112px) 0; background: var(--niebla); }
.mosaico {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: clamp(140px, 16vw, 210px);
  gap: 10px;
}
.mosaico button {
  position: relative;
  padding: 0;
  border: 0;
  border-radius: var(--r);
  overflow: hidden;
  cursor: zoom-in;
  background: var(--linea);
}
.mosaico img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s ease; }
.mosaico button:hover img { transform: scale(1.04); }
.mosaico span {
  position: absolute;
  left: 10px;
  bottom: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(20,34,58,.82);
  color: #fff;
  font-size: .85rem;
  font-weight: 500;
}
.m-a { grid-column: span 2; grid-row: span 2; }
.m-b { grid-column: span 2; grid-row: span 2; }
.m-c { grid-column: span 2; }
.m-h { grid-column: span 2; }

.visor {
  max-width: min(92vw, 1100px);
  padding: 0;
  border: 0;
  border-radius: var(--r);
  background: var(--tinta);
  color: #fff;
}
.visor::backdrop { background: rgba(5,10,20,.85); }
.visor img { max-height: 80vh; width: auto; margin: 0 auto; }
.visor-pie { padding: 12px 56px 14px 16px; }
.visor-cerrar {
  position: absolute;
  right: 8px;
  bottom: 6px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
}
.visor-cerrar svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; }

/* ---------- Contacto ---------- */
.contacto { padding: clamp(64px, 9vw, 112px) 0; }
.contacto-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: clamp(32px, 5vw, 72px); align-items: start; }

.directorio {
  padding: clamp(24px, 3.5vw, 40px);
  border-radius: var(--r);
  background: var(--tinta) url("../img/textura-titanium.jpg") center / cover;
  color: #e6edf6;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
}
.directorio h2 { color: #fff; }
.directorio-pbx { margin: 18px 0 22px; font-size: 1.05rem; color: var(--iris); }
.directorio-pbx a {
  display: block;
  margin-top: 2px;
  color: #fff;
  font-size: clamp(2.4rem, 1.6rem + 2.4vw, 3.4rem);
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
}
.directorio dl { display: grid; }
.directorio dl > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid rgba(255,255,255,.14);
}
.directorio dt { font-size: .98rem; }
.directorio dd a {
  color: #fff;
  font-weight: 600;
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
  white-space: nowrap;
}
.directorio a:hover { color: var(--iris); }

.ubicacion { display: grid; gap: 16px; }
.ubicacion h3 { font-family: var(--serif); font-weight: 400; font-size: 1.75rem; color: var(--tinta); }
.ubicacion address { font-style: normal; font-size: 1.15rem; line-height: 1.5; }
.ubicacion > p { color: var(--grafito); max-width: 36em; }
.boton {
  justify-self: start;
  padding: 12px 20px;
  border-radius: 999px;
  border: 1px solid var(--acero);
  color: var(--acero);
  font-weight: 600;
  text-decoration: none;
}
.boton:hover { background: var(--acero); color: #fff; }
.mapa { margin-top: 8px; border-radius: var(--r); overflow: hidden; background: var(--niebla); }
.mapa iframe { display: block; width: 100%; height: 320px; border: 0; }

/* ---------- Pie ---------- */
.pie { background: var(--tinta); color: #c3cfdf; padding: 40px 0; font-size: .95rem; }
.pie-in { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 16px 40px; align-items: center; }
.pie-in img { width: 160px; }
.pie-copy { color: #8fa0b8; }

/* ---------- Responsivo ---------- */
@media (max-width: 760px) {
  .ficha { grid-template-columns: 1fr; }
  .ficha-foto { margin: 12px 12px 0; }
}
@media (max-width: 860px) {
  .menu-btn {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 1px solid rgba(255,255,255,.3);
    border-radius: var(--r);
    background: transparent;
    color: #fff;
    cursor: pointer;
  }
  .menu-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; }
  .menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px var(--gutter) 20px;
    background: rgba(10, 18, 32, .97);
    border-bottom: 1px solid rgba(255,255,255,.1);
    display: none;
  }
  .menu.abierto { display: flex; }
  .menu a { padding: 14px 0; border-bottom: 1px solid rgba(255,255,255,.1); }
  .menu .menu-llamar { margin-top: 14px; text-align: center; border-bottom: 0; }
  .marca img { width: 150px; }
  .menu a { font-size: .85rem; }
  .intro-grid, .contacto-grid { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .hero { height: 82svh; min-height: 520px; }
  .slide::after { background: linear-gradient(0deg, rgba(5,10,20,.85) 0%, rgba(5,10,20,.5) 50%, rgba(5,10,20,.15) 100%); }
  .slide-texto { bottom: 92px; }
  .hero-controles { bottom: 28px; }
  .ficha-atiende ul { grid-template-columns: 1fr; }
  .mosaico { grid-template-columns: 1fr 1fr; grid-auto-rows: 150px; }
  .m-a, .m-b, .m-c, .m-h { grid-column: span 2; grid-row: span 1; }
  .pie-in { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .slide, .tiempo, .mosaico img { transition: none; }
  .slide.activa .slide-bg { animation: none; transform: none; }
  .ficha.entra { animation: none; }
}

/* Ajustes móviles: filtros en una fila deslizable y dirección corrida */
@media (max-width: 680px) {
  .filtros {
    flex-wrap: nowrap;
    overflow-x: auto;
    margin: 0 calc(var(--gutter) * -1);
    padding: 2px var(--gutter) 6px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .filtros::-webkit-scrollbar { display: none; }
  .filtros button { flex: none; }
  .ubicacion address br { display: none; }
}
