/* =========================================================
   Dr. Alejandro Mendoza · Cardiólogo
   Diseño en cursiva (Cormorant Garamond italic)
   Paleta: marfil + azul profundo + acento rojo carmesí
   ========================================================= */

:root {
  --bg: #fbf8f3;
  --bg-2: #f3eee5;
  --ink: #1a2740;
  --ink-soft: #4a566f;
  --line: #d9d2c5;
  --accent: #b22a3a;       /* carmesí cardiaco */
  --accent-soft: #e87a85;
  --blue: #1f3a68;
  --blue-soft: #4a6aa0;
  --gold: #b89548;
  --serif: 'Cormorant Garamond', 'Georgia', serif;
  --sans: 'Inter', system-ui, sans-serif;
  --radius: 14px;
  --ease: cubic-bezier(.2,.7,.2,1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* small UI labels go in upright sans for readability */
.eyebrow, .nav-links, .t-year, .num, .plus,
.btn-primary, .btn-ghost, .scroll-hint, .footer .tiny {
  font-family: var(--sans);
  font-style: normal;
}

a { color: inherit; text-decoration: none; }

.container { max-width: 1140px; margin: 0 auto; padding: 0 28px; }

/* =========================================================
   NAV
   ========================================================= */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  backdrop-filter: blur(10px);
  background: rgba(251, 248, 243, .75);
  border-bottom: 1px solid rgba(217, 210, 197, .6);
}
.nav-inner {
  max-width: 1140px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px;
}
.logo {
  display: flex; align-items: center; gap: 10px;
  font-size: 1.25rem; color: var(--ink);
}
.logo-heart {
  width: 26px; height: 26px; color: var(--accent);
  animation: heartbeat 1.4s var(--ease) infinite;
}
@keyframes heartbeat {
  0%, 60%, 100% { transform: scale(1); }
  20% { transform: scale(1.15); }
  40% { transform: scale(.95); }
}
.nav-links { display: flex; gap: 28px; list-style: none; }
.nav-links a {
  font-size: .85rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-soft); transition: color .3s var(--ease); position: relative;
}
.nav-links a::after {
  content: ""; position: absolute; left: 0; bottom: -6px;
  width: 0; height: 1px; background: var(--accent);
  transition: width .35s var(--ease);
}
.nav-links a:hover { color: var(--accent); }
.nav-links a:hover::after { width: 100%; }

@media (max-width: 720px) {
  .nav-links { display: none; }
}

/* =========================================================
   HERO
   ========================================================= */
.hero {
  position: relative;
  min-height: 100vh;
  padding: 140px 28px 200px;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  text-align: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 20%, rgba(178,42,58,.06), transparent 60%),
    radial-gradient(circle at 80% 80%, rgba(31,58,104,.07), transparent 60%),
    var(--bg);
}
.hero-bg-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(31,58,104,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31,58,104,.05) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
}
.hero-content { position: relative; z-index: 2; max-width: 880px; }

.eyebrow {
  font-size: .8rem; letter-spacing: .35em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 20px;
}

.hero-title {
  font-size: clamp(2.6rem, 7vw, 5.6rem);
  font-weight: 600; line-height: 1.05; letter-spacing: -.01em;
  color: var(--ink); margin-bottom: 28px;
}
.hero-title .line { display: block; }
.hero-title .line:nth-child(2) { color: var(--accent); }

.hero-sub {
  font-size: clamp(1.1rem, 1.6vw, 1.35rem);
  color: var(--ink-soft); max-width: 620px; margin: 0 auto 40px;
}

.hero-cta { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

.btn-primary, .btn-ghost {
  display: inline-block; padding: 14px 32px; border-radius: 999px;
  font-size: .8rem; letter-spacing: .15em; text-transform: uppercase;
  font-weight: 500; transition: all .35s var(--ease);
  cursor: pointer; border: 1px solid transparent;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover {
  background: #8c1f2d; transform: translateY(-2px);
  box-shadow: 0 14px 30px -10px rgba(178,42,58,.5);
}
.btn-ghost { color: var(--ink); border-color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--bg); }

.btn-primary.big { padding: 18px 44px; margin-top: 32px; font-size: .85rem; }

/* ECG hero strip */
.ecg-strip {
  position: absolute; bottom: 90px; left: 0; right: 0;
  height: 120px; pointer-events: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 15%, #000 85%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 15%, #000 85%, transparent);
}
.ecg-svg { width: 100%; height: 100%; display: block; }
.ecg-path {
  fill: none; stroke: var(--accent); stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 2400;
  stroke-dashoffset: 2400;
  animation: ecg-draw 4s var(--ease) infinite;
}
@keyframes ecg-draw {
  0%   { stroke-dashoffset: 2400; opacity: .25; }
  20%  { opacity: 1; }
  80%  { stroke-dashoffset: 0; opacity: 1; }
  100% { stroke-dashoffset: 0; opacity: 0; }
}
.ecg-dot {
  fill: var(--accent);
  filter: drop-shadow(0 0 6px var(--accent));
  offset-path: path("M0,60 L150,60 L180,60 L200,55 L215,65 L230,20 L245,100 L260,60 L290,60 L310,58 L330,62 L360,60 L500,60 L520,60 L540,55 L555,65 L570,20 L585,100 L600,60 L640,60 L660,58 L680,62 L720,60 L860,60 L880,60 L900,55 L915,65 L930,20 L945,100 L960,60 L1000,60 L1020,58 L1040,62 L1080,60 L1200,60");
  offset-distance: 0%;
  animation: ecg-dot 4s var(--ease) infinite;
}
@keyframes ecg-dot {
  0%   { offset-distance: 0%;   opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { offset-distance: 100%; opacity: 0; }
}

.scroll-hint {
  position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  color: var(--ink-soft); font-size: .7rem; letter-spacing: .3em; text-transform: uppercase;
}
.scroll-line {
  width: 1px; height: 40px; background: var(--ink-soft);
  animation: scrollPulse 2s var(--ease) infinite;
  transform-origin: top;
}
@keyframes scrollPulse {
  0%, 100% { transform: scaleY(.4); opacity: .4; }
  50%      { transform: scaleY(1);  opacity: 1; }
}

/* =========================================================
   SECTIONS
   ========================================================= */
.section { padding: 120px 0; position: relative; overflow: visible; }
.section .container { overflow: visible; }

.section-title {
  font-size: clamp(2rem, 4vw, 3.2rem);
  font-weight: 600; line-height: 1.1;
  text-align: center; margin-bottom: 14px; color: var(--ink);
}
.section-title em { color: var(--accent); font-style: italic; }

.section-sub {
  text-align: center; color: var(--ink-soft);
  font-size: 1.15rem; max-width: 600px; margin: 0 auto 70px;
}

/* =========================================================
   BIO
   ========================================================= */
.bio { background: var(--bg-2); }
.two-col {
  display: grid; grid-template-columns: 1fr 1.3fr; gap: 80px; align-items: center;
}
@media (max-width: 860px) {
  .two-col { grid-template-columns: 1fr; gap: 50px; }
}

.bio-portrait { display: flex; justify-content: center; }
.portrait-frame {
  position: relative; width: 280px; height: 340px;
  border-radius: 8px; overflow: hidden;
  box-shadow: 0 30px 60px -20px rgba(31,58,104,.4);
}
.portrait-svg { width: 100%; height: 100%; display: block; }
.portrait-pulse {
  position: absolute; inset: -6px; border-radius: 12px;
  border: 2px solid var(--accent);
  animation: portraitPulse 2.4s var(--ease) infinite;
  pointer-events: none;
}
@keyframes portraitPulse {
  0%, 100% { transform: scale(1);    opacity: .8; }
  50%      { transform: scale(1.04); opacity: 0; }
}

.bio-text h2 {
  font-size: clamp(1.9rem, 3.6vw, 2.8rem);
  font-weight: 600; line-height: 1.15; margin-bottom: 24px;
}
.bio-text h2 em { color: var(--accent); }
.bio-text p { color: var(--ink-soft); font-size: 1.15rem; margin-bottom: 18px; }

.quote {
  margin-top: 36px; padding: 24px 28px;
  border-left: 3px solid var(--accent);
  background: rgba(255,255,255,.5); border-radius: 0 var(--radius) var(--radius) 0;
  position: relative;
}
.quote p { font-size: 1.3rem; color: var(--ink); margin: 0; }
.q-mark {
  font-family: var(--serif); font-size: 2.4rem; color: var(--accent);
  line-height: 0; position: absolute; top: 18px; left: 12px;
}
.q-mark.q-end { left: auto; right: 12px; bottom: 4px; top: auto; }

/* =========================================================
   TIMELINE
   ========================================================= */
.timeline-section { background: var(--bg); }
.timeline { position: relative; max-width: 880px; margin: 0 auto; }
.timeline-line {
  position: absolute; left: 50%; top: 0; bottom: 0; width: 2px;
  background: linear-gradient(to bottom, transparent, var(--accent) 10%, var(--accent) 90%, transparent);
  transform: translateX(-50%);
}
.t-item {
  position: relative; width: 50%; padding: 24px 40px;
}
.t-item:nth-child(odd)  { padding-right: 50px; text-align: right; }
.t-item:nth-child(even) { padding-left: 50px; margin-left: 50%; }

.t-dot {
  position: absolute; top: 36px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); border: 3px solid var(--bg);
  box-shadow: 0 0 0 0 rgba(178,42,58,.5);
  animation: dotPulse 2s var(--ease) infinite;
}
.t-item:nth-child(odd)  .t-dot { right: -8px; }
.t-item:nth-child(even) .t-dot { left:  -8px; }

@keyframes dotPulse {
  0%   { box-shadow: 0 0 0 0 rgba(178,42,58,.5); }
  100% { box-shadow: 0 0 0 18px rgba(178,42,58,0); }
}

.t-card {
  background: #fff; padding: 24px 28px; border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: 0 8px 30px -16px rgba(31,58,104,.25);
  transition: transform .4s var(--ease), box-shadow .4s var(--ease);
}
.t-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 40px -14px rgba(31,58,104,.3);
}
.t-year {
  display: inline-block; font-size: .75rem; letter-spacing: .2em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 8px;
}
.t-card h3 { font-size: 1.4rem; font-weight: 600; margin-bottom: 8px; }
.t-card p  { color: var(--ink-soft); font-size: 1.02rem; }

@media (max-width: 720px) {
  .timeline-line { left: 20px; }
  .t-item, .t-item:nth-child(odd), .t-item:nth-child(even) {
    width: 100%; margin-left: 0;
    padding: 16px 0 16px 50px; text-align: left;
  }
  .t-item:nth-child(odd) .t-dot,
  .t-item:nth-child(even) .t-dot { left: 12px; right: auto; }
}

/* =========================================================
   ESPECIALIDADES
   ========================================================= */
.specs { background: var(--bg-2); }
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 28px;
  padding: 8px 4px;
}
.card {
  background: #fff; padding: 36px 28px; border-radius: var(--radius);
  border: 1px solid var(--line);
  transition: transform .4s var(--ease), box-shadow .4s var(--ease), border-color .4s;
  position: relative; overflow: hidden;
}
.card::before {
  content: ""; position: absolute; left: 0; top: 0;
  width: 100%; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--blue));
  transform: scaleX(0); transform-origin: left;
  transition: transform .5s var(--ease);
}
.card:hover {
  transform: translateY(-6px);
  box-shadow: 0 22px 50px -20px rgba(31,58,104,.3);
  border-color: transparent;
}
.card:hover::before { transform: scaleX(1); }

.card-icon {
  width: 64px; height: 64px; margin-bottom: 22px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: rgba(178,42,58,.08);
  color: var(--accent);
}
.card-icon svg { width: 36px; height: 36px; }
.ico-stroke {
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
.card:hover .ico-pulse {
  stroke-dasharray: 200; stroke-dashoffset: 200;
  animation: pulseDraw 1.6s var(--ease) infinite;
}
@keyframes pulseDraw {
  0%   { stroke-dashoffset: 200; }
  60%  { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: -200; }
}

.card h3 { font-size: 1.35rem; font-weight: 600; margin-bottom: 10px; color: var(--ink); }
.card p  { color: var(--ink-soft); font-size: 1rem; }

/* =========================================================
   STATS
   ========================================================= */
.stats {
  background: var(--ink); color: var(--bg);
  padding: 90px 0 0; position: relative; overflow: hidden;
}
.stats-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 32px; text-align: center; padding-bottom: 60px;
}
@media (max-width: 720px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }

.stat .num {
  font-family: var(--sans); font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 300; color: var(--accent-soft); display: inline-block;
}
.stat .plus { color: var(--accent-soft); font-family: var(--sans); font-size: 2rem; }
.stat p {
  margin-top: 8px; font-size: 1rem; color: rgba(255,255,255,.7);
  letter-spacing: .05em;
}

.heartbeat-wrap {
  height: 100px;
  background:
    repeating-linear-gradient(0deg,  rgba(255,255,255,.04) 0 1px, transparent 1px 20px),
    repeating-linear-gradient(90deg, rgba(255,255,255,.04) 0 1px, transparent 1px 20px);
  border-top: 1px solid rgba(255,255,255,.08);
  position: relative;
}
.heartbeat-svg { width: 100%; height: 100%; display: block; }
.hb-path {
  fill: none; stroke: var(--accent-soft); stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
  filter: drop-shadow(0 0 4px var(--accent-soft));
  stroke-dasharray: 1600; stroke-dashoffset: 1600;
  animation: hbDraw 3s linear infinite;
}
@keyframes hbDraw {
  0%   { stroke-dashoffset: 1600; }
  100% { stroke-dashoffset: 0; }
}

/* =========================================================
   CONTACTO
   ========================================================= */
.contact { background: var(--bg); text-align: center; }
.contact .section-title { margin-bottom: 18px; }
.contact-cards {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 24px; max-width: 880px; margin: 50px auto 0;
}
@media (max-width: 720px) { .contact-cards { grid-template-columns: 1fr; } }

.c-item {
  padding: 32px 24px; background: #fff; border-radius: var(--radius);
  border: 1px solid var(--line);
  transition: transform .4s var(--ease), box-shadow .4s var(--ease);
}
.c-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 40px -18px rgba(31,58,104,.3);
}
.c-ico {
  width: 50px; height: 50px; margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: rgba(31,58,104,.08); color: var(--blue);
}
.c-ico svg { width: 24px; height: 24px; }
.c-item h4 { font-size: .8rem; letter-spacing: .25em; text-transform: uppercase;
  color: var(--ink-soft); margin-bottom: 10px; font-family: var(--sans); font-style: normal; }
.c-item p { color: var(--ink); font-size: 1.1rem; }

/* =========================================================
   FOOTER
   ========================================================= */
.footer {
  padding: 40px 28px; text-align: center;
  background: var(--ink); color: rgba(255,255,255,.7);
  font-size: .95rem;
}
.footer .tiny {
  font-size: .75rem; letter-spacing: .2em; text-transform: uppercase;
  margin-top: 8px; opacity: .6;
}

/* =========================================================
   REVEAL ANIMATIONS
   ========================================================= */
.reveal {
  opacity: 0; transform: translateY(20px);
  transition: opacity .8s var(--ease), transform .8s var(--ease);
  will-change: opacity, transform;
}
.reveal.in {
  opacity: 1; transform: translateY(0);
}

/* Fallback: si JS está desactivado o tarda, mostrar contenido tras 1.2s */
@media (prefers-reduced-motion: no-preference) {
  .reveal { animation: revealFallback 0s 1.5s forwards; }
}
@keyframes revealFallback {
  to { opacity: 1; transform: translateY(0); }
}

/* sequential delay for cards */
.cards .card.in:nth-child(1) { transition-delay: .05s; }
.cards .card.in:nth-child(2) { transition-delay: .15s; }
.cards .card.in:nth-child(3) { transition-delay: .25s; }
.cards .card.in:nth-child(4) { transition-delay: .35s; }
.cards .card.in:nth-child(5) { transition-delay: .45s; }
.cards .card.in:nth-child(6) { transition-delay: .55s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important; transition: none !important;
  }
  .reveal { opacity: 1; transform: none; }
}
