/* ============================================================
   Psiquiatría Talca — Dr. Helier Fuster Aguayo
   Sistema de diseño: editorial, cálido, sereno.
   ============================================================ */

:root {
  /* Color */
  --ink: #14262b;
  --ink-soft: #31474d;
  --ink-muted: #5d7377;
  --sage: #7f9c85;
  --sage-deep: #5d7d66;
  --sage-light: #dde7da;
  --cream: #faf6ef;
  --sand: #f0e8db;
  --terracotta: #bd7a52;
  --terracotta-deep: #a5643f;
  --white: #ffffff;
  --line: rgba(20, 38, 43, 0.12);

  /* Tipografía */
  --font-display: "Fraunces", "Georgia", serif;
  --font-body: "Manrope", "Segoe UI", system-ui, sans-serif;

  /* Escala */
  --step--1: clamp(0.83rem, 0.8rem + 0.15vw, 0.92rem);
  --step-0: clamp(1rem, 0.96rem + 0.2vw, 1.08rem);
  --step-1: clamp(1.2rem, 1.12rem + 0.4vw, 1.45rem);
  --step-2: clamp(1.5rem, 1.32rem + 0.9vw, 2rem);
  --step-3: clamp(1.9rem, 1.55rem + 1.7vw, 2.9rem);
  --step-4: clamp(2.5rem, 1.8rem + 3.4vw, 4.3rem);

  /* Layout */
  --container: 1180px;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --radius-s: 10px;
  --radius-m: 18px;
  --radius-l: 28px;
  --radius-arch: 999px 999px 24px 24px;

  /* Sombras */
  --shadow-s: 0 1px 2px rgba(20, 38, 43, 0.06), 0 4px 14px rgba(20, 38, 43, 0.06);
  --shadow-m: 0 6px 18px rgba(20, 38, 43, 0.08), 0 24px 60px -24px rgba(20, 38, 43, 0.25);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.65;
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, p { margin: 0; }
:focus-visible { outline: 3px solid var(--terracotta); outline-offset: 3px; border-radius: 4px; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 999;
  padding: 0.8rem 1.2rem; background: var(--ink); color: var(--white);
  border-radius: 0 0 var(--radius-s) 0;
}
.skip-link:focus { left: 0; }

.container { width: min(100% - 2 * var(--gutter), var(--container)); margin-inline: auto; }

/* ---------- Tipografía ---------- */
.display {
  font-family: var(--font-display);
  font-weight: 420;
  line-height: 1.06;
  letter-spacing: -0.02em;
  font-variation-settings: "SOFT" 40, "WONK" 0;
}
.display em { font-style: italic; color: var(--sage-deep); }

.eyebrow {
  display: inline-flex; align-items: center; gap: 0.6rem;
  font-size: var(--step--1); font-weight: 700; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--sage-deep);
}
.eyebrow::before {
  content: ""; width: 2rem; height: 1px; background: var(--sage-deep);
}

.lead { font-size: var(--step-1); line-height: 1.55; color: var(--ink-soft); }
.muted { color: var(--ink-muted); }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.6rem;
  padding: 0.95rem 1.6rem; border-radius: 999px;
  font-weight: 700; font-size: 0.98rem; letter-spacing: 0.01em;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), background 0.25s var(--ease), color 0.25s var(--ease);
  will-change: transform;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--ink); color: var(--cream);
  box-shadow: var(--shadow-s);
}
.btn-primary:hover { background: var(--ink-soft); box-shadow: var(--shadow-m); }

.btn-whatsapp {
  background: var(--sage-deep); color: var(--white);
  box-shadow: var(--shadow-s);
}
.btn-whatsapp:hover { background: #4f6d57; box-shadow: var(--shadow-m); }

.btn-ghost {
  border: 1.5px solid var(--line); color: var(--ink); background: transparent;
}
.btn-ghost:hover { border-color: var(--ink); background: rgba(20, 38, 43, 0.04); }

.btn svg { flex: none; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(250, 246, 239, 0.82);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.site-header.is-scrolled { border-color: var(--line); box-shadow: 0 1px 0 rgba(20, 38, 43, 0.04); }

.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1.5rem; padding-block: 0.85rem;
}

.brand { display: flex; align-items: center; gap: 0.8rem; }
.brand-mark {
  width: 46px; height: 46px; flex: none;
  display: grid; place-items: center;
  border-radius: 50% 50% 42% 42% / 46% 46% 54% 54%;
  object-fit: contain;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-family: var(--font-display); font-size: 1.06rem; font-weight: 500; }
.brand-sub { font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-muted); }

/* Nav: base = menú off-canvas para móvil */
.nav {
  position: fixed; inset: 0 0 auto 0; top: 68px;
  flex-direction: column; align-items: flex-start; gap: 0;
  display: flex;
  background: var(--cream); padding: 1rem var(--gutter) 1.6rem;
  border-bottom: 1px solid var(--line);
  transform: translateY(-8px); opacity: 0; pointer-events: none;
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
  box-shadow: var(--shadow-m);
}
.nav.is-open { opacity: 1; transform: none; pointer-events: auto; }
.nav a {
  font-size: 1rem; font-weight: 600; color: var(--ink-soft);
  padding: 0.85rem 0; width: 100%; border-bottom: 1px solid var(--line);
}

.header-cta { display: flex; align-items: center; gap: 0.9rem; }
.header-phone { display: none; }

.nav-toggle {
  display: grid; place-items: center; width: 44px; height: 44px;
  border: 1.5px solid var(--line); border-radius: 50%;
}
.nav-toggle svg { width: 20px; height: 20px; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: auto -20% -40% auto;
  width: 60vw; height: 60vw; border-radius: 50%;
  background: radial-gradient(circle at center, rgba(143, 169, 143, 0.18), transparent 65%);
  pointer-events: none;
}
.hero-grid {
  display: grid; grid-template-columns: 1fr;
  align-items: center; gap: clamp(2rem, 6vw, 5rem);
  padding-block: clamp(2.4rem, 8vw, 6.5rem) clamp(3rem, 8vw, 6rem);
}

.hero-copy .eyebrow { margin-bottom: 1.4rem; }
.hero-title { font-size: var(--step-4); margin-bottom: 1.5rem; }
.hero-title span { display: block; }
.hero-title .hero-name { color: var(--ink); }
.hero-lede { max-width: 34rem; margin-bottom: 2rem; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-bottom: 2.2rem; }

.hero-creds {
  display: flex; flex-wrap: wrap; gap: 1.4rem 2rem;
  padding-top: 1.6rem; border-top: 1px solid var(--line);
}
.cred { display: flex; flex-direction: column; gap: 0.15rem; }
.cred strong { font-size: 0.95rem; }
.cred span { font-size: 0.8rem; color: var(--ink-muted); letter-spacing: 0.02em; }

.hero-visual { position: relative; }
.portrait-frame {
  position: relative; margin-inline: auto; width: min(100%, 430px);
  aspect-ratio: 4 / 5;
  border-radius: var(--radius-arch);
  overflow: hidden;
  background: linear-gradient(160deg, var(--sage-light), var(--sand));
  box-shadow: var(--shadow-m);
}
.portrait-frame img { width: 100%; height: 100%; object-fit: cover; }
.portrait-frame .portrait-placeholder {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--sage-deep);
}
.portrait-frame .portrait-placeholder svg { width: 42%; height: auto; opacity: 0.55; }

.hero-badge {
  position: absolute; left: -1.2rem; bottom: 2.6rem;
  display: flex; align-items: center; gap: 0.7rem;
  background: var(--white); border-radius: 999px;
  padding: 0.75rem 1.15rem; box-shadow: var(--shadow-m);
  font-size: 0.86rem; font-weight: 700; color: var(--ink-soft);
}
.hero-badge .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--sage-deep); box-shadow: 0 0 0 4px rgba(93, 125, 102, 0.18); }

.hero-leaf {
  position: absolute; right: -2.6rem; top: 1.2rem; width: 92px; opacity: 0.7;
  color: var(--sage); transform: rotate(18deg);
}

/* ---------- Banda de confianza ---------- */
.trust-band { background: var(--ink); color: var(--cream); }
.trust-inner {
  display: grid; grid-template-columns: 1fr;
  gap: 1.2rem; padding-block: 1.4rem;
}
.trust-item { display: flex; align-items: center; gap: 0.85rem; font-size: 0.92rem; }
.trust-item svg { flex: none; color: var(--sage); }
.trust-item strong { display: block; font-size: 0.95rem; }
.trust-item span { color: rgba(250, 246, 239, 0.68); font-size: 0.82rem; }

/* ---------- Secciones ---------- */
.section { padding-block: clamp(4rem, 9vw, 7rem); }
.section-head { max-width: 44rem; margin-bottom: clamp(2.5rem, 5vw, 4rem); }
.section-head .eyebrow { margin-bottom: 1.1rem; }
.section-head h2 { font-size: var(--step-3); margin-bottom: 1.2rem; }
.section-head p { color: var(--ink-soft); }

.section-alt { background: var(--white); }
.section-sand { background: var(--sand); }

/* ---------- Sobre ---------- */
.about-grid {
  display: grid; grid-template-columns: 1fr;
  gap: clamp(2.6rem, 6vw, 5rem); align-items: center;
}
.about-visual { position: relative; }
.about-photo {
  border-radius: var(--radius-l); overflow: hidden; aspect-ratio: 4 / 4.6;
  background: linear-gradient(160deg, var(--sand), var(--sage-light));
  box-shadow: var(--shadow-m);
}
.about-photo img { width: 100%; height: 100%; object-fit: cover; }
.about-quote {
  position: absolute; right: -1.4rem; bottom: -1.6rem; max-width: 260px;
  background: var(--ink); color: var(--cream);
  border-radius: var(--radius-m); padding: 1.3rem 1.4rem;
  font-family: var(--font-display); font-style: italic; font-size: 1.02rem; line-height: 1.45;
  box-shadow: var(--shadow-m);
}
.about-quote::before { content: "“"; display: block; font-size: 2.2rem; line-height: 0.6; color: var(--sage); margin-bottom: 0.5rem; }
.about-copy h2 { font-size: var(--step-3); margin-bottom: 1.3rem; }
.about-copy p + p { margin-top: 1rem; }
.about-points { margin-top: 1.8rem; display: grid; gap: 0.9rem; }
.about-points li { display: flex; gap: 0.8rem; align-items: flex-start; font-size: 0.98rem; }
.about-points svg { flex: none; margin-top: 0.2rem; color: var(--sage-deep); }

/* ---------- Formación / timeline ---------- */
.timeline { position: relative; max-width: 46rem; margin-inline: auto; }
.timeline::before {
  content: ""; position: absolute; left: 11px; top: 8px; bottom: 8px;
  width: 2px; background: linear-gradient(var(--sage), var(--sand));
}
.timeline-item { position: relative; padding-left: 3rem; padding-bottom: 2.4rem; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
  content: ""; position: absolute; left: 4px; top: 6px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--cream); border: 3px solid var(--sage-deep);
}
.timeline-year {
  display: inline-block; font-size: 0.78rem; font-weight: 800; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--terracotta-deep); margin-bottom: 0.35rem;
}
.timeline-item h3 { font-family: var(--font-display); font-size: 1.25rem; font-weight: 500; margin-bottom: 0.3rem; }
.timeline-item p { color: var(--ink-muted); font-size: 0.95rem; max-width: 38rem; }

/* ---------- Áreas ---------- */
.areas-grid { display: grid; grid-template-columns: 1fr; gap: 1.2rem; }
.area-card {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-m);
  padding: 1.7rem 1.6rem; transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), border-color 0.3s var(--ease);
}
.section-alt .area-card { background: var(--cream); }
.area-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-m); border-color: transparent; }
.area-icon {
  width: 52px; height: 52px; display: grid; place-items: center;
  background: var(--sage-light); color: var(--sage-deep);
  border-radius: 16px; margin-bottom: 1.1rem;
}
.area-card h3 { font-family: var(--font-display); font-size: 1.18rem; font-weight: 500; margin-bottom: 0.45rem; }
.area-card p { font-size: 0.92rem; color: var(--ink-muted); }

.areas-note {
  margin-top: 2rem; font-size: 0.88rem; color: var(--ink-muted);
  border-left: 3px solid var(--sage); padding-left: 1rem; max-width: 46rem;
}

/* ---------- Lugares / modalidades ---------- */
.places-grid { display: grid; grid-template-columns: 1fr; gap: 1.4rem; }
.place-card {
  position: relative; background: var(--white); border-radius: var(--radius-m);
  padding: 2rem; border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 0.9rem;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.place-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-m); }
.place-tag {
  align-self: flex-start; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--sage-deep); background: var(--sage-light);
  padding: 0.32rem 0.7rem; border-radius: 999px;
}
.place-card h3 { font-family: var(--font-display); font-size: 1.35rem; font-weight: 500; }
.place-card address { font-style: normal; color: var(--ink-muted); font-size: 0.95rem; }
.place-card .place-meta { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; font-size: 0.85rem; color: var(--ink-soft); margin-top: auto; }
.place-card .place-meta span { display: inline-flex; align-items: center; gap: 0.4rem; }

/* ---------- Proceso ---------- */
.steps { display: grid; grid-template-columns: 1fr; gap: 1.4rem; counter-reset: paso; }
.step {
  position: relative; background: var(--white); border-radius: var(--radius-m);
  padding: 2.2rem 1.8rem 1.8rem; border: 1px solid var(--line);
  counter-increment: paso;
}
.step::before {
  content: "0" counter(paso);
  position: absolute; top: 1.2rem; right: 1.4rem;
  font-family: var(--font-display); font-size: 2.4rem; color: var(--sage-light);
  line-height: 1;
}
.step h3 { font-family: var(--font-display); font-size: 1.15rem; font-weight: 500; margin-bottom: 0.5rem; }
.step p { font-size: 0.92rem; color: var(--ink-muted); }

/* ---------- FAQ ---------- */
.faq { max-width: 48rem; margin-inline: auto; }
.faq-item { border-bottom: 1px solid var(--line); }
.faq-item summary {
  display: flex; justify-content: space-between; align-items: center; gap: 1.5rem;
  padding: 1.35rem 0; cursor: pointer; list-style: none;
  font-weight: 700; font-size: 1.02rem; line-height: 1.4;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+"; flex: none; width: 32px; height: 32px; display: grid; place-items: center;
  border: 1.5px solid var(--line); border-radius: 50%;
  font-weight: 400; font-size: 1.2rem; color: var(--sage-deep);
  transition: transform 0.3s var(--ease), background 0.3s var(--ease);
}
.faq-item[open] summary::after { transform: rotate(45deg); background: var(--sage-light); border-color: transparent; }
.faq-item p { padding: 0 0 1.4rem; color: var(--ink-soft); font-size: 0.95rem; max-width: 42rem; }

/* ---------- Contacto ---------- */
.contact-grid {
  display: grid; grid-template-columns: 1fr; gap: clamp(2rem, 5vw, 4rem);
  align-items: stretch;
}
.contact-panel {
  background: var(--ink); color: var(--cream);
  border-radius: var(--radius-l); padding: clamp(2rem, 5vw, 3.2rem);
  display: flex; flex-direction: column; gap: 1.6rem;
}
.contact-panel h2 { font-size: var(--step-3); color: var(--cream); }
.contact-panel p { color: rgba(250, 246, 239, 0.75); }
.contact-list { display: grid; gap: 1.1rem; margin-top: 0.4rem; }
.contact-row { display: flex; gap: 1rem; align-items: flex-start; }
.contact-row svg { flex: none; color: var(--sage); margin-top: 0.15rem; }
.contact-row strong { display: block; font-size: 0.95rem; }
.contact-row a, .contact-row span { font-size: 0.95rem; color: rgba(250, 246, 239, 0.8); }
.contact-row a:hover { color: var(--white); text-decoration: underline; text-underline-offset: 3px; }
.contact-panel .btn { align-self: flex-start; margin-top: 0.4rem; }

.map-wrap {
  border-radius: var(--radius-l); overflow: hidden; min-height: 420px;
  background: var(--sage-light); position: relative; box-shadow: var(--shadow-s);
}
.map-wrap iframe { width: 100%; height: 100%; min-height: 420px; border: 0; display: block; }
.map-fallback {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
  padding: 2rem; color: var(--sage-deep);
}

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color: rgba(250, 246, 239, 0.7); padding-block: 3rem 2rem; }
.footer-top {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2rem;
  padding-bottom: 2rem; border-bottom: 1px solid rgba(250, 246, 239, 0.12);
}
.footer-brand .brand-mark { background: transparent; }
.footer-brand .brand-name { color: var(--cream); }
.footer-brand .brand-sub { color: rgba(250, 246, 239, 0.55); }
.footer-nav { display: flex; flex-wrap: wrap; gap: 1.6rem; font-size: 0.9rem; }
.footer-nav a:hover { color: var(--white); }
.footer-legal { padding-top: 1.6rem; display: grid; gap: 0.6rem; font-size: 0.78rem; line-height: 1.6; }
.footer-legal strong { color: rgba(250, 246, 239, 0.85); }
.footer-legal a { color: rgba(250, 246, 239, 0.9); text-decoration: underline; text-underline-offset: 2px; }
.footer-legal a:hover { color: var(--white); }
.footer-legal .disclaimer { max-width: 60rem; }

/* ---------- WhatsApp flotante ---------- */
.wa-float {
  position: fixed; right: 1.4rem; bottom: 1.4rem; z-index: 60;
  width: 58px; height: 58px; border-radius: 50%;
  display: grid; place-items: center;
  background: #25d366; color: #fff;
  box-shadow: 0 8px 24px rgba(37, 211, 102, 0.4);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.wa-float:hover { transform: translateY(-3px) scale(1.04); box-shadow: 0 12px 30px rgba(37, 211, 102, 0.5); }
.wa-float svg { width: 30px; height: 30px; }

/* ---------- Animaciones de entrada ----------
   Mobile-first: el contenido siempre es visible sin JS.
   Sólo se oculta cuando el documento está marcado como .js. */
.js .reveal { opacity: 0; transform: translateY(24px); }
.reveal { transition: opacity 0.8s var(--ease), transform 0.8s var(--ease); }
.js .reveal.is-visible { opacity: 1; transform: none; }
.reveal-delay-1 { transition-delay: 0.08s; }
.reveal-delay-2 { transition-delay: 0.16s; }
.reveal-delay-3 { transition-delay: 0.24s; }

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

/* ---------- Responsive (mobile-first) ---------- */

/* Pantallas muy chicas: botones a todo el ancho */
@media (max-width: 420px) {
  .hero-actions .btn { width: 100%; }
  .trust-item { align-items: flex-start; }
}

/* Tablet */
@media (min-width: 620px) {
  .trust-inner { grid-template-columns: repeat(3, 1fr); gap: 1.5rem; padding-block: 1.5rem; }
  .areas-grid { grid-template-columns: repeat(2, 1fr); }
  .places-grid { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: repeat(3, 1fr); }
  .header-cta .btn { display: inline-flex; }
}

/* Escritorio: navegación en fila */
@media (min-width: 761px) {
  .nav {
    position: static; inset: auto;
    flex-direction: row; align-items: center; gap: 1.7rem;
    background: transparent; padding: 0; border: 0;
    box-shadow: none; transform: none; opacity: 1; pointer-events: auto;
  }
  .nav a {
    font-size: 0.93rem; padding-block: 0.3rem; width: auto;
    border-bottom: 0; position: relative;
  }
  .nav a::after {
    content: ""; position: absolute; left: 0; bottom: 0; width: 100%; height: 2px;
    background: var(--sage-deep); transform: scaleX(0); transform-origin: left;
    transition: transform 0.3s var(--ease);
  }
  .nav a:hover::after { transform: scaleX(1); }
  .nav-toggle { display: none; }
  .header-phone { display: inline; }
  .header-phone { font-size: 0.92rem; font-weight: 700; color: var(--ink-soft); }
  .header-phone:hover { color: var(--sage-deep); }
}

/* Escritorio amplio: layouts de dos y tres columnas */
@media (min-width: 981px) {
  .hero-grid { grid-template-columns: 1.05fr 0.95fr; }
  .hero-visual { order: 0; max-width: none; }
  .about-grid { grid-template-columns: 0.9fr 1.1fr; }
  .about-visual { max-width: none; }
  .areas-grid { grid-template-columns: repeat(3, 1fr); }
  .contact-grid { grid-template-columns: 1fr 1fr; }
}

/* Ajustes que dependen del alto de pantalla o del espacio */
@media (max-width: 980px) {
  .hero-visual { max-width: 360px; margin-inline: auto; width: 100%; }
  .about-visual { max-width: 420px; margin-inline: auto; width: 100%; }
  .about-quote { right: 0; bottom: -1.2rem; }
}

@media (max-width: 760px) {
  .header-cta .btn { display: none; }
  .hero-badge { left: 0.6rem; bottom: 1.2rem; }
  .about-quote { position: static; margin-top: 1.2rem; max-width: none; }
  .footer-top { flex-direction: column; }
}
