/* Laboratorio Clínico Sorto Álvarez — hoja de estilos (v3)
   Hero en lavanda muy suave con la ilustración del frotis; el resto en blanco y gris clínico.
   Violeta de la marca para "precisos", enlaces y detalles; rojo del logo para el banco de sangre; verde solo para WhatsApp.
   Tipos: Familjen Grotesk (títulos y marca) e IBM Plex Sans (texto e interfaz). */

@font-face {
  font-family: "Familjen Grotesk";
  src: url("/assets/fonts/familjen-var.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/assets/fonts/plex-sans-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/assets/fonts/plex-sans-latin-ext.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+20A0-20AB, U+20AD-20C4, U+2C60-2C7F, U+A720-A7FF;
}
/* Respaldo con métricas parecidas para que no salte el texto mientras cargan las fuentes */
@font-face { font-family: "Familjen Fallback"; src: local("Arial"), local("Helvetica"); size-adjust: 96%; ascent-override: 95%; descent-override: 27%; }
@font-face { font-family: "Plex Fallback"; src: local("Arial"), local("Helvetica"); size-adjust: 101%; ascent-override: 101%; descent-override: 27%; }

:root {
  --paper: #ffffff;
  --lav: #f4f1fc;
  --lav-line: #dcd4f3;
  --violet: #5c12f9;
  --hemo: #d93a4e;
  --stone: #f3f3f0;      /* gris clínico para el pie */
  --ink: #17151f;
  --muted: #55525f;
  --rule: #dcdbe0;
  --brand: #5c12f9;      /* violeta de la marca: solo acentos */
  --link: #4a0fd0;
  --red: #b8243a;        /* rojo del logo: banco de sangre */
  --wa: #0b7a3c;
  --wa-hover: #096532;

  --display: "Familjen Grotesk", "Familjen Fallback", Arial, sans-serif;
  --sans: "IBM Plex Sans", "Plex Fallback", Arial, sans-serif;

  --gutter: clamp(1rem, 4vw, 2.5rem);
  --max: 72rem;
  --r: 8px;
  --bar-h: 4.5rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 5rem; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--sans); font-size: 1.0625rem; line-height: 1.6;
  padding-bottom: calc(var(--bar-h) + env(safe-area-inset-bottom));
  overflow-x: hidden;
}
@media (min-width: 60rem) { body { padding-bottom: 0; } }

img, svg { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.05; margin: 0; letter-spacing: -0.025em; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
h1, h2, h3, p, li, dd { hyphens: manual; -webkit-hyphens: manual; overflow-wrap: normal; }

:focus-visible { outline: 3px solid var(--brand); outline-offset: 3px; }
.skip { position: absolute; left: -999px; top: 0.5rem; background: var(--ink); color: #fff; padding: 0.6rem 1rem; border-radius: var(--r); z-index: 100; }
.skip:focus { left: 0.5rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: max(var(--gutter), env(safe-area-inset-left)) max(var(--gutter), env(safe-area-inset-right)); }
.nw { white-space: nowrap; }

.text-link { color: var(--link); font-weight: 600; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.22em; }
@media (hover: hover) { .text-link:hover { text-decoration-thickness: 2px; } }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.6rem;
  min-height: 3rem; padding: 0.7rem 1.25rem;
  border-radius: var(--r); border: 1.5px solid transparent;
  font-family: var(--sans); font-weight: 600; font-size: 1rem; line-height: 1.2;
  text-decoration: none; cursor: pointer; transition: background-color 0.15s, color 0.15s;
}
.btn svg { width: 1.25rem; height: 1.25rem; flex: none; }
.btn-wa { background: var(--wa); color: #fff; }
@media (hover: hover) { .btn-wa:hover { background: var(--wa-hover); } }
.btn-ghost { border-color: var(--ink); color: var(--ink); background: var(--paper); }
@media (hover: hover) { .btn-ghost:hover { background: var(--ink); color: #fff; } }

/* ---------- Cabecera ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: rgba(244, 241, 252, 0.92); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-bottom: 1px solid var(--lav-line); }
.header-row { display: flex; align-items: center; gap: 1.25rem; height: 4.25rem; }
.brand { display: flex; align-items: center; gap: 0.7rem; text-decoration: none; margin-right: auto; min-height: 2.75rem; }
.brand img { width: 2.5rem; height: 2.5rem; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-family: var(--display); font-weight: 700; font-size: 1.3rem; letter-spacing: -0.02em; }
.brand-small { white-space: nowrap; font-size: 0.8rem; color: var(--muted); }
.nav { display: none; gap: 1.75rem; }
.nav a { text-decoration: none; font-weight: 500; font-size: 0.98rem; color: var(--ink); display: inline-flex; align-items: center; min-height: 2.75rem; }
@media (hover: hover) { .nav a:hover { color: var(--link); text-decoration: underline; text-underline-offset: 0.3em; } }
.lang { display: flex; align-items: center; font-size: 0.9rem; font-weight: 600; }
.lang a, .lang span { display: grid; place-items: center; min-width: 2.75rem; min-height: 2.75rem; text-decoration: none; line-height: 1; }
.lang span[aria-current] { color: var(--ink); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.35em; }
.lang a { color: var(--muted); }
@media (hover: hover) { .lang a:hover { color: var(--link); } }
.header-wa { display: none; min-height: 2.75rem; padding: 0.5rem 1rem; font-size: 0.95rem; }
@media (min-width: 60rem) { .nav { display: flex; } .header-wa { display: inline-flex; } }

/* ---------- Hero (de la v1) ---------- */
.hero { position: relative; overflow: hidden; padding-block: clamp(2rem, 6vw, 5rem) clamp(3rem, 7vw, 6rem);
  background: linear-gradient(180deg, var(--lav) 0%, var(--lav) 55%, #faf9fe 85%, var(--paper) 100%); }
.hero::before {
  content: ""; position: absolute; inset: -20% -10% auto auto; width: 70vw; height: 70vw; max-width: 60rem; max-height: 60rem;
  background: radial-gradient(closest-side, rgba(92, 18, 249, 0.1), transparent 70%); pointer-events: none;
}
.hero-grid { position: relative; display: grid; gap: clamp(2.25rem, 5vw, 4rem); align-items: center; }
@media (min-width: 60rem) { .hero-grid { grid-template-columns: 1.15fr 0.85fr; } }
.eyebrow { display: inline-flex; align-items: center; gap: 0.55rem; font-weight: 600; font-size: 0.82rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--violet); }
.eyebrow::before { content: ""; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--hemo); box-shadow: 0 0 0 4px rgba(217, 58, 78, 0.15); }
.hero h1 { font-size: clamp(2.25rem, 0.6rem + 8.2vw, 5.4rem); font-weight: 700; margin-top: 1rem; letter-spacing: -0.035em; line-height: 0.98; }
.hero h1 em { font-style: normal; color: var(--violet); }
.lead { margin-top: 1.4rem; font-size: clamp(1.1rem, 1rem + 0.6vw, 1.3rem); line-height: 1.55; color: var(--muted); max-width: 36rem; }
.lead strong { color: var(--ink); font-weight: 600; }
.hero-ctas { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2rem; }
.hero-ctas .btn { flex: 1 1 14rem; min-height: 3.25rem; font-size: 1.0625rem; }
@media (min-width: 36rem) { .hero-ctas .btn { flex: 0 0 auto; } }
.hero .btn-ghost { background: transparent; }
@media (hover: hover) { .hero .btn-ghost:hover { background: var(--ink); } }
.status { margin-top: 1.5rem; display: inline-flex; align-items: center; gap: 0.6rem; font-size: 0.98rem; color: var(--muted); }
.status .dot { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: #19a35a; box-shadow: 0 0 0 4px rgba(25, 163, 90, 0.18); flex: none; }
.status b { color: var(--ink); font-weight: 600; }
.facts { display: grid; grid-template-columns: repeat(2, 1fr); margin: 2.25rem 0 0; border-top: 1.5px solid var(--ink); max-width: 30rem; }
.facts div { padding: 0.85rem 0.75rem 0 0; }
.facts div + div { padding-left: 0.85rem; border-left: 1px solid var(--lav-line); }
.facts dt { font-family: var(--display); font-weight: 700; font-size: clamp(1.5rem, 5vw, 2rem); letter-spacing: -0.03em; line-height: 1; }
.facts dd { margin: 0.35rem 0 0; font-size: 0.875rem; line-height: 1.3; color: var(--muted); }

/* Campo del microscopio */
.scope { position: relative; width: min(100%, 34rem); margin-inline: auto; aspect-ratio: 1; }
.scope svg { width: 100%; height: 100%; overflow: visible; }
.scope .ring-text { font-family: var(--display); font-weight: 700; font-size: 22px; letter-spacing: 0.2em; fill: var(--ink); }
.drift-a { animation: drift-a 38s ease-in-out infinite alternate; }
.drift-b { animation: drift-b 46s ease-in-out infinite alternate; }
.drift-c { animation: drift-c 54s ease-in-out infinite alternate; }
.spin { transform-origin: 300px 300px; animation: spin 140s linear infinite; }
@keyframes drift-a { to { transform: translate(14px, -10px) rotate(2deg); } }
@keyframes drift-b { to { transform: translate(-12px, 9px); } }
@keyframes drift-c { to { transform: translate(8px, 14px) rotate(-2deg); } }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .drift-a, .drift-b, .drift-c, .spin { animation: none; } }

/* ---------- Secciones ---------- */
.section { padding-block: clamp(3.25rem, 8vw, 6rem); }
.hero + .section { padding-top: clamp(2.5rem, 6vw, 4.5rem); }
.section + .section { border-top: 1px solid var(--rule); }
.section h2 { font-size: clamp(2rem, 1.2rem + 3.2vw, 3.2rem); letter-spacing: -0.03em; }
.section-head { display: grid; gap: 0.75rem 3rem; margin-bottom: clamp(1.75rem, 4vw, 2.75rem); }
@media (min-width: 60rem) { .section-head { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: baseline; } }
.section-head p { color: var(--muted); font-size: 1.0625rem; max-width: 36rem; }

/* Exámenes: lista con reglas, sin tarjetas */
.tests { display: grid; gap: 0 2.5rem; grid-template-columns: 1fr; padding: 0; margin: 0; list-style: none; }
@media (min-width: 40rem) { .tests { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 64rem) { .tests { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.test { border-top: 1px solid var(--ink); padding: 1rem 0 2rem; }
.test h3 { font-size: 1.35rem; letter-spacing: -0.02em; }
.test p { color: var(--muted); margin-top: 0.5rem; font-size: 1rem; line-height: 1.55; }
/* En el celular, las áreas se deslizan de lado en vez de apilarse en una columna larga */
@media (max-width: 39.99rem) {
  .tests {
    display: flex; gap: 1.25rem; overflow-x: auto; overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory; scroll-padding-inline: var(--gutter); scrollbar-width: none;
    margin-inline: calc(-1 * var(--gutter)); padding: 0 var(--gutter) 0.25rem;
  }
  .tests::-webkit-scrollbar { display: none; }
  .test { flex: 0 0 78%; scroll-snap-align: start; padding-bottom: 1rem; }
}
.tests-dots { display: none; }
@media (max-width: 39.99rem) {
  .tests-dots { display: flex; gap: 0; margin-left: -0.9rem; }
  .tests-dots button { width: 2.75rem; height: 2.75rem; border: 0; background: transparent; padding: 0; display: grid; place-items: center; cursor: pointer; }
  .tests-dots button::before { content: ""; width: 0.9rem; height: 3px; background: var(--rule); transition: background-color 0.2s; }
  .tests-dots button[aria-current="true"]::before { background: var(--violet); }
}

/* Dr. y banco de sangre: dos piezas de arte hechas con la misma trama del frotis */
.duo-band { padding-block: clamp(2rem, 5vw, 3.5rem); }
.duo { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 52rem) { .duo { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: stretch; } }
.card {
  --cp: clamp(1.5rem, 3vw, 2.25rem);
  display: flex; flex-direction: column; align-items: flex-start; overflow: hidden;
  border-radius: var(--r); padding: var(--cp); color: #fff;
}
.card h2 { font-size: clamp(1.9rem, 1.5rem + 1.2vw, 2.2rem); letter-spacing: -0.03em; color: #fff; }
.card-dr { background: #160c38;
  --dot-a: #e9e2ff; --dot-b: #b9a4ff; --dot-c: #7c4dff; --fondo: rgba(255, 255, 255, 0.06); }
.card-dr .role { color: #c9bff0; margin-top: 0.35rem; }
.card-dr .bio { margin-top: 0.75rem; color: #ece8f8; }
.card-sangre { background: #a3172b;
  --dot-a: #ffffff; --dot-b: #ffc9d1; --fondo: rgba(255, 255, 255, 0.08); }
.card-sangre p { margin-top: 0.75rem; margin-bottom: 1.5rem; color: #fff0f2; }
.card-sangre .btn { margin-top: auto; background: #fff; color: #a3172b; border-color: #fff; }
@media (hover: hover) { .card-sangre .btn:hover { background: #ffe3e7; border-color: #ffe3e7; } }
.card .btn:focus-visible, .card a:focus-visible { outline-color: #fff; }

/* Arte: sale hasta los bordes de la tarjeta */
.arte { width: calc(100% + 2 * var(--cp)); margin: calc(-1 * var(--cp)) calc(-1 * var(--cp)) 0; }
.arte svg { display: block; width: 100%; height: auto; overflow: hidden; }
.arte-gota { margin-top: calc(-1 * var(--cp) + 1rem); margin-bottom: 1.25rem; }
.cuarenta-txt { font-family: var(--display); font-weight: 700; font-size: 520px; letter-spacing: -0.06em; }
.fondo-40, .fondo-gota { fill: var(--fondo); }
.s40-a, .sg-a { stop-color: var(--dot-a); }
.s40-b, .sg-b { stop-color: var(--dot-b); }
.s40-c { stop-color: var(--dot-c); }
.arte-cap { margin: 0.75rem 0 1.25rem; font-size: 1rem; color: #b9a8ff; }
.arte-cap b { color: #fff; font-weight: 600; }
.arte-forma { transform-box: fill-box; transform-origin: center; transition: transform 0.8s cubic-bezier(.2, .7, .2, 1); }
@media (hover: hover) and (prefers-reduced-motion: no-preference) { .card:hover .arte-forma { transform: scale(1.02); } }

/* Foto aprobada en lugar del 40 */
.figura { margin: 0 0 1.25rem; }
.figura img { width: 100%; height: auto; }
.figura-foto { width: 100%; }
.figura-foto img { border-radius: var(--r); }
.figura figcaption { margin-top: 0.5rem; font-size: 0.875rem; color: #c9bff0; }

/* Cómo llegar */
.visit { display: grid; gap: 2rem 3rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 60rem) { .visit { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); } }
.addr { font-style: normal; font-size: 1.125rem; line-height: 1.55; }
.addr strong { font-family: var(--display); font-weight: 700; font-size: 1.5rem; line-height: 1.2; display: block; margin-bottom: 0.35rem; }
.dir-links { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.25rem; }
.visit-tel { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--rule); }
.visit-tel a { font-weight: 600; font-size: 1.2rem; text-decoration: none; display: inline-flex; gap: 0.6rem; align-items: center; min-height: 2.75rem; font-variant-numeric: tabular-nums; }
.visit-tel svg { width: 1.2rem; height: 1.2rem; }
.visit-tel small { display: block; color: var(--muted); font-size: 0.9rem; }
.map { position: relative; border-radius: var(--r); overflow: hidden; aspect-ratio: 4 / 3; background: var(--stone); }
@media (min-width: 60rem) { .map { aspect-ratio: 16 / 11; } }
.map iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.follow-label { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--rule); font-size: 0.875rem; color: var(--muted); }

/* Redes */
.social { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; }
.social a { display: inline-flex; align-items: center; gap: 0.5rem; min-height: 2.9rem; padding: 0.55rem 1.1rem 0.55rem 0.9rem; border-radius: 999px; color: #fff; font-weight: 700; text-decoration: none; }
.social svg { width: 1.35rem; height: 1.35rem; flex: none; }
.s-fb, .bar-fb { background: #0866ff; }
.s-ig, .bar-ig { background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fd5949 45%, #d6249f 60%, #285aeb 90%); }
@media (hover: hover) { .social a:hover { filter: brightness(1.1); } }

/* Pie */
.site-footer { background: var(--stone); padding-block: 2.75rem 2.5rem; margin-top: clamp(2rem, 6vw, 4rem); }
.foot { display: grid; gap: 1.75rem; }
@media (min-width: 52rem) { .foot { grid-template-columns: 1fr auto; align-items: end; } }
.foot-brand { font-family: var(--display); font-weight: 700; font-size: 1.4rem; line-height: 1.1; margin-bottom: 0.6rem; }
.foot .legal { color: var(--muted); font-size: 0.875rem; line-height: 1.6; }
.foot .legal > span { display: block; }
.foot .legal .sep { display: none; }
.foot .legal.copy { margin-top: 0.5rem; }
.foot nav { display: flex; flex-wrap: wrap; column-gap: 1.25rem; row-gap: 0; }
.foot nav a { color: var(--ink); font-size: 0.95rem; text-underline-offset: 0.22em; display: inline-flex; align-items: center; min-height: 2.75rem; }

/* Barra fija de contacto (móvil) */
.contact-bar {
  position: fixed; inset: auto 0 0 0; z-index: 60; display: grid; grid-template-columns: 1fr repeat(3, 3rem); gap: 0.5rem;
  padding: 0.6rem var(--gutter) calc(0.6rem + env(safe-area-inset-bottom));
  background: var(--paper); border-top: 1px solid var(--rule);
}
.contact-bar .btn { min-height: 3rem; padding: 0.6rem 0.75rem; }
.bar-icon { display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: var(--r); color: #fff; }
.bar-icon svg { width: 1.35rem; height: 1.35rem; }
.bar-tel { background: var(--paper); color: var(--ink); border: 1.5px solid var(--ink); }
@media (max-width: 23rem) {
  .contact-bar { grid-template-columns: minmax(0, 1fr) repeat(3, 2.75rem); gap: 0.4rem; }
  .contact-bar .btn { padding: 0.6rem 0.5rem; gap: 0.4rem; }
  .bar-icon { width: 2.75rem; height: 2.75rem; }
}
@media (min-width: 60rem) { .contact-bar { display: none; } }

/* 404 */
.notfound { min-height: 70vh; display: grid; place-items: center; text-align: center; padding-block: 4rem; }
.notfound .code { font-family: var(--display); font-weight: 700; font-size: clamp(4.5rem, 20vw, 8rem); line-height: 0.9; color: var(--ink); }
.notfound h1 { font-size: clamp(1.8rem, 6vw, 2.6rem); margin-top: 1rem; }
.notfound p { color: var(--muted); margin: 1rem auto 0; max-width: 32rem; }
.notfound .hero-ctas { justify-content: center; }
.section-head .text-link { padding-block: 0.75rem; }
