/* ==========================================================================
   Dra. Metztli Calva González — Psiquiatría
   Brand: Beige #F7F2E7 · Verde #003623 · Pistache #C2C4A4
   Type: TAN MEMORIES (titles) · MATTER (text). Google Fonts stand-ins are
   loaded by default; drop licensed files into assets/fonts/ and uncomment
   the @font-face blocks below to use the official typefaces.
   ========================================================================== */

/*
@font-face { font-family: "Tan Memories"; src: url("../fonts/TANMemories-Regular.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Tan Memories"; src: url("../fonts/TANMemories-Italic.woff2") format("woff2"); font-style: italic; font-display: swap; }
@font-face { font-family: "Matter"; src: url("../fonts/Matter-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Matter"; src: url("../fonts/Matter-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
*/

:root {
  --beige: #f7f2e7;
  --verde: #003623;
  --verde-profundo: #0a2a1e;
  --pistache: #c2c4a4;
  --lima: #8fae5a;
  --texto: #0f3a2a;

  --font-display: "Tan Memories", "Instrument Serif", Georgia, serif;
  --font-body: "Matter", "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;

  --container: 1120px;
  --gutter: clamp(20px, 5vw, 48px);
  --radius-xl: clamp(40px, 7vw, 96px);

  --grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

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

html { scroll-behavior: smooth; scroll-padding-top: 80px; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--beige);
  color: var(--texto);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 400; }
p { margin: 0 0 1em; }

.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

:focus-visible { outline: 2px solid var(--lima); outline-offset: 3px; border-radius: 4px; }

/* ---------- Button ---------- */
.btn {
  display: inline-block;
  padding: .8em 1.8em;
  border-radius: 999px;
  background: var(--verde);
  color: var(--beige);
  font-weight: 600;
  font-size: .95rem;
  text-decoration: none;
  transition: background .25s, transform .25s;
}
.btn:hover { background: #0b4a33; transform: translateY(-1px); }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--beige) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: box-shadow .3s;
}
.site-header.is-scrolled { box-shadow: 0 1px 0 rgba(0, 54, 35, .12); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 72px; }
.brand img { width: 170px; height: auto; }

.nav { display: flex; gap: 0; }
.nav a {
  text-decoration: none;
  text-transform: uppercase;
  font-size: .82rem;
  letter-spacing: .04em;
  padding: .3em 1.4em;
  position: relative;
}
.nav a + a::before {
  content: "";
  position: absolute; left: 0; top: 50%;
  width: 1px; height: 1em; transform: translateY(-50%);
  background: currentColor; opacity: .7;
}
.nav a:last-child { padding-right: 0; }
.nav a:hover { color: #3b6b2c; }

.nav-toggle { display: none; }

@media (max-width: 720px) {
  .nav-toggle {
    display: grid; place-content: center; gap: 6px;
    width: 44px; height: 44px; margin-right: -10px;
    background: none; border: 0; cursor: pointer; color: var(--verde);
  }
  .nav-toggle span { display: block; width: 24px; height: 1.5px; background: currentColor; transition: transform .3s; }
  .nav-toggle[aria-expanded="true"] span:first-child { transform: translateY(3.75px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span:last-child { transform: translateY(-3.75px) rotate(-45deg); }

  .nav {
    position: absolute; inset: 72px 0 auto 0;
    flex-direction: column;
    background: var(--beige);
    padding: 8px var(--gutter) 24px;
    border-bottom: 1px solid rgba(0, 54, 35, .12);
    visibility: hidden; opacity: 0; transform: translateY(-8px);
    transition: opacity .25s, transform .25s, visibility .25s;
  }
  .nav.is-open { visibility: visible; opacity: 1; transform: none; }
  .nav a { padding: .9em 0; font-size: .95rem; border-top: 1px solid rgba(0, 54, 35, .08); }
  .nav a + a::before { display: none; }
}

/* ---------- Hero ---------- */
.hero { padding: clamp(8px, 2vw, 24px) 0 clamp(64px, 9vw, 110px); text-align: center; }
.hero-inner { display: flex; flex-direction: column; align-items: center; }

.hero-visual { display: grid; place-items: center; width: 100%; }
.hero-visual > * { grid-area: 1 / 1; }
.hero-brain { width: min(370px, 72vw); mix-blend-mode: multiply; }

.hero-title,
.display-title {
  font-family: var(--font-display);
  color: var(--verde);
  line-height: .86;
  letter-spacing: -.02em;
}
.hero-title {
  align-self: end;
  margin-bottom: 9%;
  font-size: clamp(3.2rem, 8.6vw, 6.6rem);
  display: flex; flex-direction: column;
  text-shadow: 0 0 30px var(--beige), 0 0 12px var(--beige);
}
.hero-title span { transform: translateX(-12%); }
.hero-title em { transform: translateX(8%); }

.hero-copy { max-width: 560px; margin: 28px auto 32px; font-size: .95rem; }

/* ---------- About ---------- */
.about {
  position: relative;
  isolation: isolate;
  color: var(--beige);
  border-radius: var(--radius-xl);
  padding: clamp(56px, 8vw, 96px) 0;
  overflow: hidden;
  background:
    radial-gradient(60% 70% at 100% 100%, #8fae5a 0%, rgba(143, 174, 90, .35) 30%, transparent 60%),
    radial-gradient(55% 60% at 0% 0%, #2f6a52 0%, transparent 70%),
    linear-gradient(160deg, #0c3a29 0%, #072a1d 55%, #0a3322 100%);
}
.about::after,
.site-footer::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background-image: var(--grain); opacity: .12; mix-blend-mode: overlay; pointer-events: none;
}

.about-inner {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(32px, 5vw, 64px);
  align-items: start;
  max-width: 960px;
}
.about-photo { margin: 0; }
.about-photo img { width: 100%; aspect-ratio: 1 / 1.05; object-fit: cover; object-position: 50% 30%; }

.about-text h2 { font-size: clamp(1.8rem, 3.2vw, 2.4rem); font-weight: 300; letter-spacing: -.01em; margin-bottom: .55em; }
.about-text > p { font-size: 1rem; font-weight: 300; max-width: 46ch; }
.about-text strong { font-weight: 500; }

.credentials { list-style: none; padding: 0; margin: 1.8em 0 0; display: grid; gap: 1.05em; }
.credentials li {
  display: grid;
  padding-left: 32px;
  line-height: 1.35;
  background: url("../img/icon-white.svg") no-repeat 0 .15em / 14px auto;
}
.credentials strong { font-weight: 500; }
.credentials span { font-weight: 300; opacity: .9; }

@media (max-width: 760px) {
  .about-inner { grid-template-columns: 1fr; }
  .about-photo { max-width: 420px; }
}

/* ---------- Help ---------- */
.help { padding: clamp(72px, 10vw, 120px) 0 clamp(72px, 9vw, 110px); }
.display-title {
  font-size: clamp(2.8rem, 7vw, 5rem);
  display: flex; flex-direction: column; align-items: center;
  margin-bottom: clamp(32px, 4vw, 48px);
}
.display-title span { transform: translateX(-10%); }
.display-title em { transform: translateX(14%); }

.help-grid {
  list-style: none; margin: 0 auto; padding: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(14px, 2vw, 22px);
}
.help-grid li {
  aspect-ratio: 1;
  border: 1px solid var(--verde);
  border-radius: clamp(24px, 3vw, 36px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 18px 14px 16px;
  text-align: center;
  transition: background .3s, transform .3s;
}
.help-grid li:hover { background: rgba(194, 196, 164, .25); transform: translateY(-3px); }
.help-grid img { height: clamp(56px, 6vw, 80px); width: auto; margin-bottom: 18px; }
.help-grid p { margin: 0; font-size: .78rem; letter-spacing: .06em; line-height: 1.35; max-width: 18ch; }
.help-note { text-align: center; font-size: .82rem; letter-spacing: .06em; margin: clamp(32px, 4vw, 44px) 0 0; }

@media (max-width: 900px) { .help-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) {
  .help-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .help-grid li { aspect-ratio: auto; min-height: 160px; }
}

/* ---------- Approach ---------- */
.approach-band {
  position: relative;
  color: var(--beige);
  background: var(--verde-profundo) url("../img/textura-esmeril-alta.webp") center / cover;
  padding: clamp(64px, 9vw, 110px) 0;
}
.approach-band::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(4, 30, 20, .92) 0%, rgba(4, 30, 20, .7) 45%, rgba(4, 30, 20, .25) 100%);
}
.approach-band-inner {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: clamp(24px, 4vw, 40px);
  max-width: 960px;
}
.approach-title {
  font-family: var(--font-display);
  font-size: clamp(3rem, 7vw, 5rem);
  line-height: 1;
  padding-right: clamp(24px, 4vw, 40px);
  border-right: 1px solid rgba(247, 242, 231, .7);
}
.approach-copy { max-width: 46ch; font-size: .95rem; }
.approach-copy p:last-child { margin: 0; }

@media (max-width: 640px) {
  .approach-band-inner { grid-template-columns: 1fr; }
  .approach-title { border-right: 0; border-bottom: 1px solid rgba(247, 242, 231, .7); padding: 0 0 .25em; }
}

.cycle {
  position: relative;
  padding: clamp(40px, 6vw, 72px) var(--gutter);
  background: var(--beige) url("../img/cerebro-fondo.webp") center / auto 100% no-repeat;
}
.cycle-diagram {
  position: relative;
  max-width: 520px;
  margin: 0 auto;
  aspect-ratio: 440 / 470;
  color: var(--verde);
}
.cycle-arcs { position: absolute; inset: 0; width: 100%; height: auto; }
.cycle-step { position: absolute; transform: translateX(-50%); width: 46%; text-align: center; line-height: 1.3; }
.cycle-step h3 { font-size: clamp(1.05rem, 2vw, 1.25rem); font-weight: 500; }
.cycle-step p { margin: .2em 0 0; font-size: .9rem; }
.step-1 { left: 50%; top: 56%; width: 42%; }
.step-2 { left: 27%; top: 74%; }
.step-3 { left: 73%; top: 74%; }

@media (max-width: 520px) {
  .cycle-diagram { aspect-ratio: auto; display: grid; gap: 28px; }
  .cycle-arcs { display: none; }
  .cycle-step { position: static; transform: none; width: auto; }
  .cycle-step + .cycle-step::before { content: "↓"; display: block; margin: -18px 0 10px; opacity: .6; }
  .step-1 { order: 1; } .step-2 { order: 2; } .step-3 { order: 3; }
}

/* ---------- Institutions ---------- */
.institutions { background: var(--verde); color: var(--beige); padding: clamp(48px, 6vw, 72px) 0 clamp(56px, 7vw, 84px); text-align: center; }
.institutions-logo { width: 220px; margin: 0 auto clamp(36px, 5vw, 52px); }
.institutions-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: clamp(28px, 5vw, 64px);
}
.institutions-list li { display: flex; align-items: center; gap: 16px; }
.institutions-list img { width: auto; }
.logo-unam { height: 72px; }
.logo-clinic { height: 48px; }
.logo-ub { height: 34px; }
.logo-innn { height: 48px; }
.divider { width: 1px; height: 52px; background: rgba(247, 242, 231, .8); }

@media (max-width: 560px) {
  .logo-unam { height: 60px; }
  .logo-clinic { height: 38px; }
  .logo-ub { height: 26px; }
  .logo-innn { height: 40px; }
  .divider { height: 40px; }
}

/* ---------- Contact ---------- */
.contact { padding: clamp(56px, 8vw, 100px) 0; }
.contact-inner {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 6fr);
  gap: clamp(32px, 6vw, 72px);
  align-items: center;
}
.contact-visual img { width: 100%; max-width: 360px; border-radius: 8px; }
.contact-text h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); line-height: 1.2; font-weight: 400; max-width: 17em; margin-bottom: .6em; color: var(--verde); }
.contact-text > p { max-width: 46ch; font-size: .95rem; }
.contact-text .btn { margin: .6em 0 2.4em; }

.contact-list { margin: 0; display: grid; gap: .8em; font-size: .92rem; }
.contact-list div { display: flex; gap: .45em; }
.contact-list dt { font-weight: 500; flex: none; }
.contact-list dd { margin: 0; }
.contact-list a { text-decoration: none; }
.contact-list a:hover { text-decoration: underline; text-underline-offset: 3px; }

@media (max-width: 760px) {
  .contact-inner { grid-template-columns: 1fr; }
  .contact-visual { order: 2; }
  .contact-visual img { max-width: 240px; margin-inline: auto; }
}

/* ---------- Footer ---------- */
.site-footer {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  color: var(--beige);
  padding: clamp(64px, 9vw, 110px) 0 32px;
  background:
    radial-gradient(45% 80% at 100% 100%, #8fae5a 0%, rgba(143, 174, 90, .3) 35%, transparent 70%),
    radial-gradient(40% 70% at 0% 0%, #2f6a52 0%, transparent 70%),
    linear-gradient(160deg, #0c3a29 0%, #04231a 60%, #0a3322 100%);
}
.footer-logo { width: min(480px, 100%); }
.footer-meta { margin: clamp(48px, 7vw, 80px) 0 0; font-size: .78rem; opacity: .75; }

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .8s ease, transform .8s ease; }
.reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }
