/* ==========================================================================
   Medianoche y vino — sistema visual, sitio de cardiología (Querétaro)
   Uso: <link rel="stylesheet" href="medianoche-vino.css"> en el <head>.
   Secciones oscuras: agrega class="tema-noche" al <section>, <header> o <footer>.
   ========================================================================== */

@import url("https://fonts.googleapis.com/css2?family=Google+Sans+Flex:wght@400..700&display=swap");

/* --------------------------------------------------------------------------
   Tokens — tema claro (contenido)
   -------------------------------------------------------------------------- */
:root {
  /* Superficies */
  --surface: #FFFFFF;
  --surface-alt: #F4F6F9;
  --surface-raised: #FFFFFF;
  --noche: #0E1726;
  --line: #DDE3EA;
  --line-field: #8795A6;

  /* Texto */
  --ink: #0E1726;
  --ink-muted: #4A5A6E;

  /* Acentos */
  --acero: #3E6A8A;
  --acero-soft: #E6EEF4;
  --vino: #8C2F39;
  --vino-fill: #8C2F39;
  --vino-fill-hover: #74252E;
  --on-vino: #FFFFFF;
  --vino-soft: #F7E9EB;

  /* Estados */
  --exito: #2F6B4F;
  --error: #B42318;

  /* Marca fija (logo, favicon, redes) */
  --medianoche: #0E1726;

  /* Tipografía */
  --font-display: "Google Sans Flex", "Google Sans", "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-sans: "Google Sans Flex", "Google Sans", "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Espaciado (base 4px) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
  --space-16: 64px;
  --space-24: 96px;

  /* Radios */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  /* Sombras */
  --shadow-sm: 0 1px 2px #0e17260f, 0 2px 6px #0e17260d;
  --shadow-lg: 0 8px 24px #0e17261a, 0 2px 6px #0e172614;

  /* Layout */
  --container: 1200px;
  --measure: 68ch;
  --section-pad: clamp(var(--space-12), 8vw, var(--space-24));
  --gutter: clamp(var(--space-4), 4vw, var(--space-6));

  /* Movimiento */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 200ms;
}

/* --------------------------------------------------------------------------
   Tokens — tema Noche (hero, franja de cita, footer)
   -------------------------------------------------------------------------- */
.tema-noche {
  --surface: #0E1726;
  --surface-alt: #152238;
  --surface-raised: #1B2A42;
  --noche: #22344F;
  --line: #2A3A55;
  --line-field: #5B6E8A;

  --ink: #F2F5F9;
  --ink-muted: #A9B6C6;

  --acero: #7FA6C4;
  --acero-soft: #1A2E44;
  --vino: #E08690;
  --vino-fill: #B33A47;
  --vino-fill-hover: #C44856;
  --on-vino: #FFFFFF;
  --vino-soft: #3A1A22;

  --exito: #7CC5A1;
  --error: #F59A8F;

  --shadow-sm: 0 1px 3px #00000080;
  --shadow-lg: 0 12px 32px #000000b3;

  background: var(--surface);
  color: var(--ink);
  color-scheme: dark;
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 26px;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img, svg, video { display: block; max-width: 100%; height: auto; }

h1, h2, h3 {
  margin: 0;
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-weight: 500;
  color: var(--ink);
  text-wrap: balance;
}

p { margin: 0 0 var(--space-4); max-width: var(--measure); text-wrap: pretty; }

a {
  color: var(--acero);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--dur) var(--ease-out);
}
a:hover { color: var(--ink); }

:focus-visible {
  outline: 2px solid var(--acero);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

::selection { background: var(--vino-soft); color: var(--ink); }

/* --------------------------------------------------------------------------
   Escala tipográfica (desktop → móvil con clamp)
   -------------------------------------------------------------------------- */
.t-display-xl, h1 {
  font-size: clamp(42px, 5.4vw, 60px);
  line-height: 1.06;
  font-weight: 500;
  letter-spacing: -0.025em;
}

.t-display-lg, h2 {
  font-size: clamp(32px, 3.8vw, 40px);
  line-height: 1.15;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.t-heading, h3 {
  font-size: clamp(24px, 2.6vw, 28px);
  line-height: 1.2;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.t-subtitle {
  font-family: var(--font-sans);
  font-size: clamp(18px, 1.9vw, 20px);
  line-height: 1.5;
  font-weight: 500;
  color: var(--ink-muted);
}

.t-body-lg { font-size: 18px; line-height: 30px; }
.t-body { font-size: 16px; line-height: 26px; }

.t-label {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 20px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.t-eyebrow {
  display: inline-block;
  margin-bottom: var(--space-3);
  font-family: var(--font-sans);
  font-size: 12px;
  line-height: 16px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--acero);
}
.tema-noche .t-eyebrow { color: var(--vino); }

.t-caption {
  font-size: 13px;
  line-height: 20px;
  font-weight: 500;
  color: var(--ink-muted);
}

.t-muted { color: var(--ink-muted); }

/* Palabra destacada en un título: <h1>Cuidamos el <em class="acento">ritmo</em> de tu corazón</h1> */
.acento {
  font-style: normal;
  color: var(--vino);
}

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */
.contenedor {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.seccion { padding-block: var(--section-pad); }
.seccion--alt { background: var(--surface-alt); }

.seccion__encabezado {
  max-width: 720px;
  margin-bottom: var(--space-8);
}

/* --------------------------------------------------------------------------
   Botones
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 48px;
  padding: 0 var(--space-6);
  border: 1.5px solid transparent;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 20px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--dur) var(--ease-out),
              color var(--dur) var(--ease-out),
              border-color var(--dur) var(--ease-out),
              transform 120ms var(--ease-out);
}
.btn:active { transform: scale(0.98); }

/* Principal — uno por vista (Agendar cita) */
.btn--primario {
  background: var(--vino-fill);
  color: var(--on-vino);
}
.btn--primario:hover { background: var(--vino-fill-hover); color: var(--on-vino); }

/* Secundario */
.btn--secundario {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink);
}
.btn--secundario:hover { background: var(--ink); color: var(--surface); }

/* Texto con flecha */
.btn--texto {
  min-height: auto;
  padding: 0;
  background: none;
  color: var(--acero);
}
.btn--texto:hover { color: var(--ink); }

/* WhatsApp flotante */
.btn-flotante {
  position: fixed;
  right: var(--space-4);
  bottom: var(--space-4);
  z-index: 50;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-pill);
  background: var(--vino-fill);
  color: var(--on-vino);
  box-shadow: var(--shadow-lg);
}

/* --------------------------------------------------------------------------
   Tarjetas, chips y avisos
   -------------------------------------------------------------------------- */
.tarjeta {
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--dur) var(--ease-out), transform var(--dur) var(--ease-out);
}
.tarjeta:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }

.tarjeta--destacada {
  background: var(--noche);
  border-color: transparent;
  border-radius: var(--radius-lg);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--acero-soft);
  color: var(--acero);
  font-size: 13px;
  line-height: 20px;
  font-weight: 600;
}

.aviso-urgencia {
  padding: var(--space-4) var(--space-6);
  border-radius: var(--radius-md);
  background: var(--vino-soft);
  color: var(--ink);
}
.aviso-urgencia strong { color: var(--vino); }

.foto {
  border-radius: var(--radius-lg);
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   Formularios
   -------------------------------------------------------------------------- */
.campo { display: grid; gap: var(--space-2); margin-bottom: var(--space-4); }

.campo label {
  font-size: 15px;
  line-height: 20px;
  font-weight: 600;
  color: var(--ink);
}

.campo input:not([type="checkbox"]):not([type="radio"]),
.campo select,
.campo textarea {
  width: 100%;
  min-height: 48px;
  padding: var(--space-3) var(--space-4);
  border: 1.5px solid var(--line-field);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  color: var(--ink);
  font: 400 16px/24px var(--font-sans);
  transition: border-color var(--dur) var(--ease-out);
}
.campo input:hover,
.campo select:hover,
.campo textarea:hover { border-color: var(--ink-muted); }
.campo input:focus-visible,
.campo select:focus-visible,
.campo textarea:focus-visible { border-color: var(--acero); outline-offset: 0; }

.campo--error input,
.campo--error select,
.campo--error textarea { border-color: var(--error); }

.campo__mensaje[hidden] { display: none; }

.campo__mensaje {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: 13px;
  line-height: 20px;
  font-weight: 500;
}
.campo--error .campo__mensaje { color: var(--error); }
.campo__mensaje--exito { color: var(--exito); }

/* --------------------------------------------------------------------------
   Accesibilidad y movimiento reducido
   -------------------------------------------------------------------------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
