/* ==========================================================
   Óptica Miramar · estilos
   Paleta del logo: azul marca, azul profundo y verde de acento
   ========================================================== */

@font-face {
  font-family: "Jakarta";
  src: url("../fonts/jakarta-var.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --blue: #2f80c8;
  --blue-600: #1f6aad;      /* azul accesible para texto pequeño sobre blanco */
  --navy: #163a6b;
  --navy-900: #0f2a4f;
  --green: #6db53f;
  --green-700: #3f7f1c;     /* verde con contraste AA para texto */
  --ink: #1c2430;
  --muted: #586374;
  --line: #e3e9f0;
  --bg: #ffffff;
  --bg-alt: #f4f7fa;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(15, 42, 79, .06), 0 8px 24px rgba(15, 42, 79, .06);
  --wrap: 1180px;
  --gutter: clamp(16px, 4vw, 32px);
  --font: "Jakarta", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
a { color: var(--blue-600); text-underline-offset: 3px; }
h1, h2, h3 { color: var(--navy); line-height: 1.15; letter-spacing: -.02em; margin: 0 0 .5em; }
h1 { font-size: clamp(2.1rem, 5.2vw, 3.6rem); font-weight: 750; }
h2 { font-size: clamp(1.65rem, 3.4vw, 2.5rem); font-weight: 700; }
h3 { font-size: 1.15rem; font-weight: 700; letter-spacing: -.01em; }
p { margin: 0 0 1em; }
ul { margin: 0; padding: 0; list-style: none; }
figure { margin: 0; }
address { font-style: normal; }

:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; border-radius: 6px; }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
.center { text-align: center; margin-top: 2.5rem; }

.skip {
  position: absolute; left: 1rem; top: -100px; z-index: 100;
  background: var(--navy); color: #fff; padding: .6rem 1rem; border-radius: 8px;
}
.skip:focus { top: 1rem; }

.eyebrow {
  display: inline-flex; align-items: center; gap: .55rem;
  font-size: .8rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--blue-600); margin-bottom: 1rem;
}
.eyebrow::before { content: ""; width: 22px; height: 2px; background: var(--green); border-radius: 2px; }
.eyebrow--light { color: #bcd7f2; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 50px; padding: .8rem 1.4rem;
  border-radius: 999px; border: 1.5px solid transparent;
  font: inherit; font-weight: 650; font-size: 1rem; line-height: 1.2;
  text-decoration: none; cursor: pointer;
  transition: background-color .2s, color .2s, border-color .2s, transform .2s;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--navy); color: #fff; }
.btn--primary:hover { background: var(--blue-600); }
.btn--ghost { border-color: var(--line); color: var(--navy); background: #fff; }
.btn--ghost:hover { border-color: var(--blue); color: var(--blue-600); }
.btn--light { background: #fff; color: var(--navy); }
.btn--light:hover { background: #e9f2fb; }
.btn--sm { min-height: 42px; padding: .55rem 1rem; font-size: .95rem; }
.btn svg { width: 18px; height: 18px; fill: currentColor; }

/* ---------- Cabecera ---------- */
.header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.header.is-scrolled { border-bottom-color: var(--line); }
.header__inner { display: flex; align-items: center; gap: 1.5rem; min-height: 80px; }
.brand img { width: 200px; height: auto; }
@media (min-width: 960px) { .brand img { width: 270px; } }
.nav { margin-left: auto; }
.nav ul { display: flex; gap: 1.75rem; }
.nav a { color: var(--ink); text-decoration: none; font-weight: 550; font-size: .97rem; }
.nav a:hover { color: var(--blue-600); }
.nav-toggle { display: none; }

@media (max-width: 959px) {
  .header__cta { display: none; }
  .nav-toggle {
    display: inline-grid; place-content: center; gap: 6px;
    margin-left: auto; width: 46px; height: 46px;
    border: 1px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer;
  }
  .nav-toggle span { display: block; width: 20px; height: 2px; background: var(--navy); border-radius: 2px; transition: transform .25s; }
  .nav-toggle[aria-expanded="true"] span:first-child { transform: translateY(4px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span:last-child { transform: translateY(-4px) rotate(-45deg); }
  .nav {
    position: absolute; left: 0; right: 0; top: 100%;
    background: #fff; border-bottom: 1px solid var(--line); box-shadow: var(--shadow);
    display: none;
  }
  .nav.is-open { display: block; }
  .nav ul { flex-direction: column; gap: 0; padding: .5rem var(--gutter) 1rem; }
  .nav a { display: block; padding: .85rem 0; border-bottom: 1px solid var(--line); font-size: 1.05rem; }
  .nav li:last-child a { border-bottom: 0; }
}

/* ---------- Hero ---------- */
.hero { padding: clamp(1.25rem, 2.5vw, 2rem) 0 clamp(3rem, 6vw, 5.5rem); }
.hero__grid { display: grid; gap: 2.5rem; align-items: center; }
.lead { font-size: clamp(1.05rem, 1.6vw, 1.2rem); color: var(--muted); max-width: 34em; }
.hero__ctas { display: flex; flex-wrap: wrap; gap: .75rem; margin: 1.75rem 0 2.25rem; }
.trust { display: grid; gap: .9rem; border-top: 1px solid var(--line); padding-top: 1.5rem; }
.trust li { font-size: .95rem; color: var(--muted); padding-left: 1.5rem; position: relative; }
.trust li::before {
  content: ""; position: absolute; left: 0; top: .5em;
  width: 9px; height: 9px; border-radius: 50%; background: var(--green);
}
.trust strong { color: var(--navy); display: block; font-size: 1rem; }
.hero__media img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
  border-radius: var(--radius); box-shadow: var(--shadow);
}

@media (min-width: 640px) {
  .trust { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 960px) {
  .hero__grid { grid-template-columns: 1fr 1.15fr; gap: 4rem; }
  .hero__media img { aspect-ratio: 5 / 4; }
}

/* ---------- Secciones ---------- */
.section { padding: clamp(4rem, 8vw, 6.5rem) 0; }
.section--alt { background: var(--bg-alt); }
.section__head { max-width: 44rem; margin-bottom: 3rem; }
.section__head p:last-child { color: var(--muted); margin-bottom: 0; }

/* Tarjetas de servicios */
.cards { display: grid; gap: 1.25rem; }
.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.75rem; transition: border-color .2s, box-shadow .2s;
}
.card:hover { border-color: #cfdcea; box-shadow: var(--shadow); }
.card p { color: var(--muted); margin: 0; font-size: .98rem; }
.card__icon {
  display: inline-grid; place-content: center;
  width: 48px; height: 48px; border-radius: 14px; margin-bottom: 1.1rem;
  background: #eaf3fb; color: var(--blue-600);
}
.card__icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
@media (min-width: 640px) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .cards { grid-template-columns: repeat(3, 1fr); gap: 1.5rem; } }

/* Bloques de dos columnas */
.split { display: grid; gap: 2.5rem; align-items: center; }
.split__media img { width: 100%; border-radius: var(--radius); box-shadow: var(--shadow); }
.split__text > p { color: var(--muted); }
@media (min-width: 960px) {
  .split { grid-template-columns: 1fr 1fr; gap: 4.5rem; }
  .split--rev { grid-template-columns: 1.15fr .85fr; }
}

.checks { display: grid; gap: .7rem; margin: 1.5rem 0 2rem; }
.checks li { position: relative; padding-left: 2rem; font-weight: 550; }
.checks li::before {
  content: ""; position: absolute; left: 0; top: .2em;
  width: 1.3rem; height: 1.3rem; border-radius: 50%;
  background: #e8f4df url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%233f7f1c' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5L19 7'/%3E%3C/svg%3E") center / 62% no-repeat;
}
.checks--light li { color: #fff; }
.checks--light li::before { background-color: rgba(255, 255, 255, .14); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239fdc77' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5L19 7'/%3E%3C/svg%3E"); }

.reasons { display: grid; gap: 1.5rem; margin: 1.5rem 0 0; }
.reasons div { border-left: 3px solid var(--green); padding-left: 1.1rem; }
.reasons dt { font-weight: 700; color: var(--navy); margin-bottom: .2rem; }
.reasons dd { margin: 0; color: var(--muted); }
@media (min-width: 640px) { .reasons { grid-template-columns: 1fr 1fr; } }

/* Destacado miopía infantil */
.feature {
  display: grid; gap: 2.5rem; align-items: center;
  background: linear-gradient(140deg, var(--navy-900), var(--navy) 60%, #1d4f8a);
  color: #dbe7f5; border-radius: 28px;
  padding: clamp(2rem, 5vw, 4rem);
  max-width: calc(var(--wrap) - 2 * var(--gutter));
  width: calc(100% - 2 * var(--gutter));
}
.feature h2 { color: #fff; }
.feature strong { color: #fff; }
.feature__media img { width: 100%; max-width: 420px; margin-inline: auto; border-radius: var(--radius); box-shadow: 0 20px 50px rgba(0, 0, 0, .3); }
@media (min-width: 960px) { .feature { grid-template-columns: 1.2fr .8fr; gap: 4rem; } }

/* Marcas */
.brands {
  display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem 2.25rem;
  padding: 1.75rem 0; border-block: 1px solid var(--line); margin-bottom: 4rem;
}
.brands li { font-weight: 700; font-size: 1.05rem; color: #7a8696; letter-spacing: .02em; }

/* Instagram */
.ig__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .5rem 1rem; margin-bottom: 1.5rem; }
.ig__head h3 { font-size: 1.4rem; margin: 0; }
.ig__handle { font-weight: 650; text-decoration: none; }
.ig__grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; }
.ig__grid a { display: block; overflow: hidden; border-radius: var(--radius-sm); background: var(--bg-alt); }
.ig__grid img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; transition: transform .5s ease; }
.ig__grid a:hover img { transform: scale(1.04); }
.ig__btn { margin-top: 1.75rem; }
@media (min-width: 768px) { .ig__grid { grid-template-columns: repeat(4, 1fr); gap: 1rem; } }

/* Opiniones */
.reviews { display: grid; gap: 1.25rem; }
.review {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.75rem; display: flex; flex-direction: column;
}
.stars { color: #e7a813; letter-spacing: .15em; font-size: 1rem; margin-bottom: .9rem; }
.review blockquote { margin: 0 0 1.25rem; font-size: 1.02rem; color: var(--ink); flex: 1; }
.review__who { margin: 0; font-weight: 700; color: var(--navy); font-size: .95rem; }
@media (min-width: 640px) { .reviews { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .reviews { grid-template-columns: repeat(3, 1fr); } }

/* Contacto */
.contact { display: grid; gap: 2.5rem; align-items: stretch; }
.contact address p { font-size: 1.1rem; }
.tel { font-size: clamp(1.6rem, 3.5vw, 2rem); font-weight: 750; color: var(--navy); text-decoration: none; letter-spacing: -.01em; }
.tel:hover { color: var(--blue-600); }
.hours { background: var(--bg-alt); border-radius: var(--radius-sm); padding: 1.25rem 1.4rem; margin: 1.5rem 0 2rem; }
.hours h3 { margin-bottom: .3rem; }
.hours p { margin: 0; color: var(--muted); }
.contact__ctas { display: flex; flex-wrap: wrap; gap: .75rem; }
.map {
  position: relative; min-height: 340px; border-radius: var(--radius); overflow: hidden;
  background: var(--bg-alt); display: grid; place-items: center;
}
.map > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: saturate(.85) brightness(.75); }
.map__btn { position: relative; z-index: 1; box-shadow: var(--shadow); }
.map__note { position: absolute; bottom: .8rem; left: 0; right: 0; text-align: center; margin: 0; font-size: .82rem; color: #fff; z-index: 1; }
.map iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
@media (min-width: 960px) { .contact { grid-template-columns: .9fr 1.1fr; gap: 4rem; } .map { min-height: 460px; } }

/* ---------- Pie ---------- */
.footer { background: var(--navy-900); color: #b9c8dc; padding: 3.5rem 0 6rem; font-size: .95rem; }
.footer a { color: #fff; text-decoration: none; }
.footer a:hover { text-decoration: underline; }
.footer strong { color: #fff; }
.footer__grid { display: grid; gap: 1.75rem; }
.footer__logo { background: #fff; border-radius: 14px; padding: 6px; margin-bottom: 1rem; }
.footer__legal { font-size: .88rem; }
.footer__copy { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid rgba(255, 255, 255, .1); font-size: .85rem; }
@media (min-width: 768px) { .footer { padding-bottom: 3rem; } .footer__grid { grid-template-columns: 1.2fr 1fr 1fr; } }

/* ---------- Botón flotante (móvil) ---------- */
.fab {
  position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 40;
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .85rem 1.25rem; border-radius: 999px;
  background: var(--navy); color: #fff; font-weight: 700; text-decoration: none;
  box-shadow: 0 10px 30px rgba(15, 42, 79, .35);
}
.fab svg { width: 20px; height: 20px; fill: currentColor; }
@media (min-width: 960px) { .fab { display: none; } }

/* ---------- Página legal ---------- */
.legal { padding: clamp(2.5rem, 6vw, 4.5rem) 0; max-width: 780px; }
.legal h1 { font-size: clamp(1.8rem, 4vw, 2.5rem); }
.legal h2 { font-size: 1.4rem; margin-top: 2.5rem; }
.legal p, .legal li { color: var(--muted); }
.legal ul { list-style: disc; padding-left: 1.25rem; margin-bottom: 1rem; }

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