/* ================================================================
   Clínica Rita Guijarro · Sistema de diseño global
   ================================================================ */

:root {
  /* Paleta del brief */
  --primary: #1A1A2E;
  --primary-soft: #2B2B40;
  --accent: #8C6F4B;
  --accent-soft: #A88660;
  --accent-light: #E8D9C4;
  --bg: #F8F5F0;
  --bg-alt: #F2EDE4;
  --bg-deep: #ECE4D4;
  --surface: #FFFFFF;
  --text: #1A1A2E;
  --text-body: #2B2B35;
  --text-muted: #6B6B75;
  --text-subtle: #9A9AA6;
  --border: #D4C4A8;
  --border-soft: #E8DDC7;
  --border-hair: #EFE7D8;
  --success: #6FA775;
  --alert: #B85450;

  /* Tipografías */
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;

  /* Espaciado */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 16px; --sp-4: 24px;
  --sp-5: 32px; --sp-6: 48px; --sp-7: 64px; --sp-8: 96px;
  --sp-9: 128px; --sp-10: 160px;

  /* Containers */
  --max-w: 1200px;
  --max-w-wide: 1320px;
  --max-w-narrow: 880px;

  /* Bordes y sombras */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-pill: 100px;
  --shadow-sm: 0 1px 3px rgba(26,26,46,0.06);
  --shadow-md: 0 4px 18px rgba(26,26,46,0.08);
  --shadow-lg: 0 20px 48px -8px rgba(26,26,46,0.14);
  --shadow-xl: 0 40px 80px -20px rgba(26,26,46,0.25);

  /* Easings */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-soft: cubic-bezier(0.65, 0, 0.35, 1);
}

/* ============ RESET ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; font-size: 16px; }
body {
  font-family: var(--font-body);
  color: var(--text-body);
  background: var(--bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
button { font: inherit; background: none; border: none; cursor: pointer; color: inherit; }
a { color: inherit; text-decoration: none; }

/* ============ KEYFRAMES ============ */
@keyframes fadeUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pulseRing { 0% { transform: scale(0.8); opacity: 0.5; } 100% { transform: scale(1.6); opacity: 0; } }
@keyframes portraitEnter { 0% { opacity: 0; transform: scale(1.04); } 100% { opacity: 1; transform: scale(1); } }

/* ============ REVEAL ON SCROLL ============ */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 800ms var(--ease-out-expo), transform 800ms var(--ease-out-expo); }
.reveal.visible { opacity: 1; transform: translateY(0); }
.reveal-child { opacity: 0; transform: translateY(20px); transition: opacity 700ms var(--ease-out-expo), transform 700ms var(--ease-out-expo); }
.reveal.visible .reveal-child { opacity: 1; transform: translateY(0); }
.reveal.visible .reveal-child:nth-child(1) { transition-delay: 0ms; }
.reveal.visible .reveal-child:nth-child(2) { transition-delay: 100ms; }
.reveal.visible .reveal-child:nth-child(3) { transition-delay: 200ms; }
.reveal.visible .reveal-child:nth-child(4) { transition-delay: 300ms; }
.reveal.visible .reveal-child:nth-child(5) { transition-delay: 400ms; }
.reveal.visible .reveal-child:nth-child(6) { transition-delay: 500ms; }

/* ============ NAV ============ */
.crg-nav {
  position: sticky; top: 0; z-index: 50;
  padding: 14px 0;
  background: rgba(248, 245, 240, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-hair);
}
.crg-nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; padding: 0 24px;
  max-width: var(--max-w-wide); margin: 0 auto;
}
.crg-brand { display: flex; align-items: center; }
.crg-brand img { height: 38px; width: auto; }
.crg-nav-links { display: none; gap: 30px; list-style: none; }
@media (min-width: 920px) { .crg-nav-links { display: flex; } }
.crg-nav-links a {
  font-size: 13px; font-weight: 500; color: var(--text);
  position: relative; padding: 4px 0;
  transition: color 200ms;
  letter-spacing: 0.01em;
}
.crg-nav-links a:hover, .crg-nav-links a.active { color: var(--accent); }
.crg-nav-links a.active::after {
  content: ''; position: absolute; bottom: -2px; left: 0;
  width: 100%; height: 1px; background: var(--accent);
}
.crg-nav-cta { display: flex; align-items: center; gap: 14px; }
.crg-phone-link { display: none; font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); }
@media (min-width: 768px) { .crg-phone-link { display: inline; } }
/* Hamburguesa móvil */
.crg-burger {
  display: flex; flex-direction: column; gap: 5px;
  width: 28px; height: 28px;
  justify-content: center; align-items: center;
  background: transparent; border: none; cursor: pointer;
  padding: 0;
}
@media (min-width: 920px) { .crg-burger { display: none; } }
.crg-burger span {
  width: 22px; height: 1.5px; background: var(--primary);
  transition: transform 250ms var(--ease-out-expo), opacity 200ms;
}
.crg-burger.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.crg-burger.open span:nth-child(2) { opacity: 0; }
.crg-burger.open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }
.crg-mobile-menu {
  display: none;
  position: fixed; top: 66px; left: 0; right: 0;
  background: var(--bg); border-bottom: 1px solid var(--border-hair);
  padding: 24px;
  z-index: 49;
}
.crg-mobile-menu.open { display: block; }
.crg-mobile-menu ul { list-style: none; }
.crg-mobile-menu li { padding: 14px 0; border-bottom: 1px solid var(--border-hair); }
.crg-mobile-menu li:last-child { border-bottom: none; }
.crg-mobile-menu a { font-family: var(--font-display); font-size: 22px; color: var(--primary); }

/* ============ BOTONES ============ */
.crg-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font-weight: 600; font-size: 14px;
  padding: 13px 24px; border-radius: var(--radius-sm);
  transition: all 250ms var(--ease-out-expo);
  white-space: nowrap;
  letter-spacing: 0.01em;
}
.crg-btn-primary { background: var(--accent); color: #fff; }
.crg-btn-primary:hover { background: var(--primary); transform: translateY(-1px); box-shadow: var(--shadow-md); color: #fff; }
.crg-btn-dark { background: var(--primary); color: var(--bg); }
.crg-btn-dark:hover { background: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow-md); color: #fff; }
.crg-btn-outline { border: 1px solid var(--primary); color: var(--primary); padding: 12px 23px; }
.crg-btn-outline:hover { background: var(--primary); color: var(--bg); }
.crg-btn-text { color: var(--accent); padding: 12px 0; }
.crg-btn-text .arrow { transition: transform 250ms var(--ease-out-expo); display: inline-block; }
.crg-btn-text:hover .arrow { transform: translateX(4px); }

/* ============ TIPOGRAFÍA / EYEBROWS / SECCIONES ============ */
.crg-eyebrow {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--accent); letter-spacing: 0.18em;
  text-transform: uppercase;
  display: block; margin-bottom: 16px;
  font-weight: 500;
}
.crg-section-title {
  font-family: var(--font-display);
  font-size: clamp(32px, 4.5vw, 52px);
  font-weight: 400;
  color: var(--primary); line-height: 1.1;
  letter-spacing: -0.02em; text-wrap: balance;
}
.crg-section-title em { font-style: italic; color: var(--accent); font-weight: 300; }
.crg-section-lead {
  font-size: 17px; color: var(--text-muted);
  max-width: 600px; line-height: 1.7;
}
.crg-section-header {
  display: flex; gap: 32px; align-items: flex-end; justify-content: space-between;
  margin-bottom: 56px; flex-wrap: wrap;
}
.crg-section-header-left { flex: 1; min-width: 280px; }
.crg-section-header-center {
  text-align: center; max-width: 720px; margin: 0 auto 56px;
}
.crg-section-header-center .crg-section-lead { margin: 16px auto 0; }

/* ============ CONTAINERS ============ */
.crg-container { max-width: var(--max-w); margin: 0 auto; padding: 0 24px; }
.crg-container-wide { max-width: var(--max-w-wide); margin: 0 auto; padding: 0 24px; }
.crg-container-narrow { max-width: var(--max-w-narrow); margin: 0 auto; padding: 0 24px; }

/* ============ FOOTER ============ */
.crg-footer { background: #0F0F1E; color: rgba(248, 245, 240, 0.6); padding: 72px 24px 32px; }
.crg-footer-inner { max-width: var(--max-w); margin: 0 auto; }
.crg-footer-grid { display: grid; gap: 40px; grid-template-columns: 1fr; margin-bottom: 56px; }
@media (min-width: 720px) { .crg-footer-grid { grid-template-columns: 2fr 1fr 1fr 1.5fr; } }
.crg-footer-brand-logo { margin-bottom: 18px; }
.crg-footer-brand-logo img { height: 40px; width: auto; }
.crg-footer-brand p { font-size: 14px; line-height: 1.75; max-width: 320px; }
.crg-footer-title {
  font-family: var(--font-mono); font-size: 11px; color: var(--accent-light);
  letter-spacing: 0.15em; text-transform: uppercase; margin-bottom: 18px;
}
.crg-footer-links { list-style: none; padding: 0; }
.crg-footer-links li { margin-bottom: 10px; }
.crg-footer-links a {
  font-size: 14px; color: rgba(248, 245, 240, 0.6);
  transition: color 200ms;
}
.crg-footer-links a:hover { color: var(--accent-light); }
.crg-footer-contact-line { font-size: 13px; line-height: 1.7; margin-bottom: 12px; }
.crg-footer-contact-line strong { color: rgba(248, 245, 240, 0.85); display: block; font-weight: 500; }
.crg-sub-footer {
  padding-top: 28px; border-top: 1px solid rgba(255,255,255,0.08);
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 24px; flex-wrap: wrap;
  font-size: 11px; line-height: 1.7; color: rgba(248, 245, 240, 0.4);
}
.crg-sub-links { display: flex; gap: 22px; flex-wrap: wrap; }
.crg-sub-links a { transition: color 200ms; }
.crg-sub-links a:hover { color: var(--accent-light); }

/* ============ WHATSAPP FLOTANTE ============ */
.crg-whatsapp {
  position: fixed; bottom: 24px; right: 24px;
  width: 56px; height: 56px; background: #25D366;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(37, 211, 102, 0.4);
  color: white; transition: transform 250ms; z-index: 40;
}
.crg-whatsapp:hover { transform: scale(1.08); }
.crg-whatsapp svg { width: 28px; height: 28px; fill: currentColor; }
.crg-whatsapp::before {
  content: ''; position: absolute; inset: -3px;
  border-radius: 50%; background: #25D366;
  opacity: 0; animation: pulseRing 2.5s ease-out infinite; z-index: -1;
}

/* ============ HERO genérico (subpáginas) ============ */
.crg-page-hero { padding: 80px 24px 64px; max-width: var(--max-w); margin: 0 auto; }
@media (min-width: 1024px) { .crg-page-hero { padding: 120px 32px 80px; } }
.crg-page-hero-grid { display: grid; gap: 48px; grid-template-columns: 1fr; align-items: center; }
@media (min-width: 1024px) { .crg-page-hero-grid { grid-template-columns: 1.1fr 0.9fr; gap: 80px; } }
.crg-page-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(40px, 5.5vw, 68px); font-weight: 300;
  color: var(--primary); line-height: 1.05;
  letter-spacing: -0.025em; margin-bottom: 24px; text-wrap: balance;
}
.crg-page-hero h1 em { font-style: italic; color: var(--accent); font-weight: 300; }
.crg-page-hero-sub {
  font-size: 18px; color: var(--text-muted);
  line-height: 1.65; max-width: 540px; margin-bottom: 32px;
}
.crg-page-hero-image {
  aspect-ratio: 4/5; border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow-xl);
}
.crg-page-hero-image img { width: 100%; height: 100%; object-fit: cover; }
.crg-page-hero-placeholder {
  background: linear-gradient(135deg, var(--bg-deep) 0%, var(--accent-light) 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 56px 40px; position: relative;
}
.crg-page-hero-placeholder::before {
  content: ''; position: absolute; inset: 18px;
  border: 1px solid rgba(140, 111, 75, 0.25);
  border-radius: var(--radius-md);
  pointer-events: none;
}
.crg-page-hero-placeholder-quote {
  font-family: var(--font-display); font-weight: 300;
  font-size: clamp(24px, 3vw, 32px);
  color: var(--primary); line-height: 1.3;
  text-align: center; letter-spacing: -0.01em;
  position: relative; z-index: 1;
}
.crg-page-hero-placeholder-quote em { font-style: italic; color: var(--accent); font-weight: 300; }
.crg-page-hero-placeholder-mark {
  font-family: var(--font-display); font-style: italic;
  font-size: 80px; color: var(--accent); opacity: 0.4;
  line-height: 0.4; display: block; margin-bottom: 12px;
}

/* ============ TARJETAS DE TRATAMIENTO ============ */
.crg-treatments-grid {
  display: grid; gap: 24px;
  grid-template-columns: 1fr;
}
@media (min-width: 640px) { .crg-treatments-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .crg-treatments-grid { grid-template-columns: repeat(3, 1fr); } }
.crg-treatment-card {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg); padding: 32px 28px;
  transition: all 350ms var(--ease-out-expo);
}
.crg-treatment-card:hover {
  border-color: var(--accent); transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.crg-treatment-card h3 {
  font-family: var(--font-display); font-size: 22px; font-weight: 500;
  color: var(--primary); margin-bottom: 12px; line-height: 1.25;
  letter-spacing: -0.01em;
}
.crg-treatment-card p { font-size: 14.5px; color: var(--text-muted); line-height: 1.7; }

/* ============ LISTA "A QUIÉN VA DIRIGIDO" ============ */
.crg-target-list {
  list-style: none; padding: 0;
  display: grid; gap: 16px;
  grid-template-columns: 1fr;
  max-width: 720px; margin: 0 auto;
}
@media (min-width: 720px) { .crg-target-list { grid-template-columns: 1fr 1fr; } }
.crg-target-list li {
  position: relative; padding-left: 32px;
  font-size: 15.5px; color: var(--text-body); line-height: 1.7;
}
.crg-target-list li::before {
  content: ''; position: absolute; left: 0; top: 12px;
  width: 18px; height: 1px; background: var(--accent);
}

/* ============ CTA FINAL (servicios) ============ */
.crg-service-cta {
  background: var(--primary); color: var(--bg);
  padding: 96px 24px; text-align: center;
}
.crg-service-cta-inner { max-width: 760px; margin: 0 auto; }
.crg-service-cta h2 {
  font-family: var(--font-display);
  font-size: clamp(34px, 5vw, 52px); font-weight: 400;
  line-height: 1.15; margin-bottom: 20px;
  letter-spacing: -0.02em;
}
.crg-service-cta h2 em { font-style: italic; color: var(--accent-light); font-weight: 300; }
.crg-service-cta p {
  font-size: 17px; color: rgba(248, 245, 240, 0.7);
  margin-bottom: 44px; line-height: 1.65;
}
.crg-service-cta-options {
  display: grid; gap: 14px; grid-template-columns: 1fr;
  max-width: 720px; margin: 0 auto;
}
@media (min-width: 720px) { .crg-service-cta-options { grid-template-columns: repeat(3, 1fr); } }
.crg-service-cta-option {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 24px 16px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(232, 217, 196, 0.18);
  border-radius: var(--radius-md);
  transition: all 250ms;
  color: var(--bg);
}
.crg-service-cta-option:hover {
  background: rgba(140, 111, 75, 0.15);
  border-color: var(--accent);
  transform: translateY(-2px);
}
.crg-service-cta-option-label {
  font-family: var(--font-mono); font-size: 10px;
  color: var(--accent-light); letter-spacing: 0.15em;
  text-transform: uppercase;
}
.crg-service-cta-option-value {
  font-family: var(--font-display); font-size: 17px; font-weight: 500;
}

/* ============ REDUCED MOTION ============ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal, .reveal-child { opacity: 1 !important; transform: none !important; }
  html { scroll-behavior: auto; }
}

/* ============ COOKIE BANNER ============ */
.crg-cookie-banner {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--primary); color: var(--bg);
  padding: 24px;
  z-index: 60;
  box-shadow: 0 -8px 32px rgba(0,0,0,0.18);
  transform: translateY(100%);
  transition: transform 400ms var(--ease-out-expo);
}
.crg-cookie-banner.visible { transform: translateY(0); }
.crg-cookie-banner-inner {
  max-width: var(--max-w); margin: 0 auto;
  display: flex; gap: 24px; align-items: center; flex-wrap: wrap;
  justify-content: space-between;
}
.crg-cookie-banner-text { flex: 1; min-width: 280px; font-size: 14px; line-height: 1.6; color: rgba(248, 245, 240, 0.85); }
.crg-cookie-banner-text a { color: var(--accent-light); text-decoration: underline; }
.crg-cookie-banner-buttons { display: flex; gap: 10px; flex-wrap: wrap; }
.crg-cookie-banner button {
  padding: 10px 18px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all 200ms; white-space: nowrap;
}
.crg-cookie-banner .cookie-accept { background: var(--accent); color: #fff; border: none; }
.crg-cookie-banner .cookie-accept:hover { background: var(--accent-soft); }
.crg-cookie-banner .cookie-reject { background: transparent; color: var(--bg); border: 1px solid rgba(248, 245, 240, 0.3); }
.crg-cookie-banner .cookie-reject:hover { border-color: var(--accent-light); }
.crg-cookie-banner .cookie-config { background: transparent; color: rgba(248, 245, 240, 0.7); border: none; font-weight: 500; text-decoration: underline; }

.crg-cookie-modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.65);
  z-index: 70; display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.crg-cookie-modal.visible { display: flex; }
.crg-cookie-modal-inner {
  background: var(--surface); border-radius: var(--radius-lg);
  max-width: 540px; width: 100%; max-height: 90vh; overflow-y: auto;
  padding: 36px 32px;
}
.crg-cookie-modal h3 { font-family: var(--font-display); font-size: 26px; color: var(--primary); margin-bottom: 8px; font-weight: 500; }
.crg-cookie-modal p { font-size: 14px; color: var(--text-muted); margin-bottom: 24px; }
.crg-cookie-option {
  border-top: 1px solid var(--border-hair); padding: 18px 0;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
}
.crg-cookie-option-text { flex: 1; }
.crg-cookie-option h4 { font-size: 15px; font-weight: 600; color: var(--primary); margin-bottom: 4px; }
.crg-cookie-option p { font-size: 13px; color: var(--text-muted); margin: 0; }
.crg-cookie-toggle {
  position: relative; width: 44px; height: 24px;
  background: var(--border); border-radius: 12px; cursor: pointer;
  transition: background 200ms; flex-shrink: 0;
}
.crg-cookie-toggle.active { background: var(--accent); }
.crg-cookie-toggle.disabled { opacity: 0.5; cursor: not-allowed; }
.crg-cookie-toggle::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  transition: transform 200ms;
}
.crg-cookie-toggle.active::after { transform: translateX(20px); }
.crg-cookie-modal-buttons {
  display: flex; gap: 12px; margin-top: 24px; padding-top: 20px;
  border-top: 1px solid var(--border-hair);
  justify-content: flex-end; flex-wrap: wrap;
}
.crg-cookie-modal button {
  padding: 11px 22px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all 200ms;
}
.crg-cookie-modal .save { background: var(--primary); color: var(--bg); border: none; }
.crg-cookie-modal .save:hover { background: var(--accent); }
.crg-cookie-modal .accept-all { background: var(--accent); color: #fff; border: none; }
.crg-cookie-modal .accept-all:hover { background: var(--accent-soft); }

/* Placeholder de mapas cuando cookies no aceptadas */
.crg-map-placeholder {
  background: var(--bg-deep); border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px 24px; text-align: center;
  aspect-ratio: 4/3;
}
.crg-map-placeholder p { font-size: 14px; color: var(--text-muted); margin-bottom: 16px; max-width: 320px; }
.crg-map-placeholder button {
  padding: 10px 20px; background: var(--primary); color: var(--bg);
  border-radius: var(--radius-sm); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: background 200ms;
}
.crg-map-placeholder button:hover { background: var(--accent); }
