/* ==========================================================================
   Centro de Psicología Clínica C.E.D.I. — hoja de estilos
   Mobile-first · sin dependencias · WCAG 2.2 AA
   ========================================================================== */

/* ---------- Tipografías (autoalojadas, licencia SIL OFL) ---------- */
@font-face {
  font-family: "Literata";
  src: url("../fonts/literata-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Sans 3";
  src: url("../fonts/source-sans-3-normal-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Sans 3";
  src: url("../fonts/source-sans-3-italic-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-style: italic;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  --ink: #12283a;
  --ink-soft: #3c5366;
  --cedi: #1b6a9e;
  --cedi-deep: #0e4a72;
  --mist: #e6eff5;
  --mist-line: #c9dbe7;
  --paper: #fafbfa;
  --white: #ffffff;
  --ochre: #b7822a;
  --ochre-soft: #f6ead6;

  --serif: "Literata", "Iowan Old Style", Georgia, serif;
  --sans: "Source Sans 3", "Segoe UI", system-ui, sans-serif;

  /* Escala tipográfica (razón ~1.25) */
  --fs-sm: 1rem;
  --fs-base: 1.125rem;
  --fs-md: 1.3125rem;
  --fs-lg: clamp(1.4rem, 1.2rem + 0.8vw, 1.75rem);
  --fs-xl: clamp(1.75rem, 1.4rem + 1.6vw, 2.5rem);
  --fs-hero: clamp(2.1rem, 1.4rem + 3.4vw, 3.9rem);

  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2.5rem;
  --space-5: 4rem;
  --space-6: clamp(4rem, 3rem + 5vw, 7rem);

  --measure: 68ch;
  --wrap: 72rem;
  --radius: 6px;
  --bracket: 6px; /* grosor de los corchetes de marca */
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 6rem; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--fs-base);
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

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

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: -0.01em;
  margin: 0 0 0.6em;
  text-wrap: balance;
}
h1 { font-size: var(--fs-hero); font-weight: 500; }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
h4 { font-size: var(--fs-md); }

p, ul, ol, dl { margin: 0 0 1em; }
p { text-wrap: pretty; }

a { color: var(--cedi); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { color: var(--cedi-deep); text-decoration-thickness: 2px; }

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

.skip-link {
  position: absolute; left: 1rem; top: -4rem;
  background: var(--ink); color: var(--white);
  padding: 0.75rem 1rem; z-index: 100; border-radius: var(--radius);
}
.skip-link:focus { top: 1rem; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.wrap { width: min(100% - 2rem, var(--wrap)); margin-inline: auto; }
.prose { max-width: var(--measure); }
.prose li { margin-bottom: 0.4em; }

/* ---------- Cabecera ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--mist-line);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-2); min-height: 4.25rem;
}

.brand { display: inline-flex; text-decoration: none; color: var(--ink); }
.brand svg { width: 11.5rem; height: auto; }
.brand:hover { color: var(--ink); }

.nav-toggle {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font: 600 var(--fs-sm)/1 var(--sans);
  background: none; border: 1.5px solid var(--ink); color: var(--ink);
  border-radius: var(--radius); padding: 0.65rem 0.85rem; cursor: pointer;
  min-height: 44px;
}
.nav-toggle-bars, .nav-toggle-bars::before, .nav-toggle-bars::after {
  display: block; width: 18px; height: 2px; background: currentColor; position: relative;
  transition: transform 0.2s ease;
}
.nav-toggle-bars::before, .nav-toggle-bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle-bars::before { top: -6px; }
.nav-toggle-bars::after { top: 6px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::after { transform: translateY(-6px) rotate(-45deg); }

.site-nav { display: none; }
.site-nav.is-open {
  display: block; position: absolute; inset: 100% 0 auto 0;
  background: var(--paper); border-bottom: 1px solid var(--mist-line);
  padding: var(--space-2) 1rem var(--space-3);
  max-height: calc(100vh - 4.25rem); overflow-y: auto;
}
.nav-list, .subnav { list-style: none; margin: 0; padding: 0; }
.nav-list > li > a, .subnav a, .nav-group-label {
  display: block; padding: 0.7rem 0.25rem; color: var(--ink);
  text-decoration: none; font-weight: 600;
}
.nav-group-label { color: var(--ink-soft); font-weight: 400; padding-bottom: 0.2rem; }
.subnav { padding-left: 1rem; border-left: 2px solid var(--mist-line); margin-left: 0.25rem; }
.subnav a { font-weight: 400; padding-block: 0.55rem; }
.site-nav a[aria-current="page"] { color: var(--cedi); box-shadow: inset 3px 0 0 var(--cedi); padding-left: 0.75rem; }
.nav-call { margin-top: var(--space-2); }
.nav-list > li > a.btn-primary, .nav-list > li > a.btn-primary:hover { color: var(--white); background: var(--cedi); display: inline-flex; padding: 0.55rem 0.9rem; }
.nav-list > li > a.btn-primary:hover { background: var(--cedi-deep); }

@media (min-width: 64rem) {
  .nav-toggle { display: none; }
  .site-nav, .site-nav.is-open {
    display: block; position: static; padding: 0; border: 0; background: none; max-height: none; overflow: visible;
  }
  .nav-list { display: flex; align-items: center; gap: 0.25rem; }
  .nav-list > li { position: relative; }
  .nav-list > li > a, .nav-group-label {
    padding: 0.55rem 0.75rem; border-radius: var(--radius); font-size: var(--fs-sm);
  }
  .nav-list > li > a:hover { background: var(--mist); color: var(--ink); }
  .site-nav a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--cedi); padding-left: 0.75rem; border-radius: 0; }
  .nav-group > button.nav-group-label {
    font: 600 var(--fs-sm)/1.6 var(--sans); color: var(--ink); background: none; border: 0; cursor: pointer;
    display: inline-flex; align-items: center; gap: 0.35rem;
  }
  .nav-group > button.nav-group-label::after {
    content: ""; width: 0.45rem; height: 0.45rem; border: solid currentColor; border-width: 0 2px 2px 0;
    transform: translateY(-2px) rotate(45deg); transition: transform 0.2s ease;
  }
  .nav-group > button[aria-expanded="true"]::after { transform: translateY(1px) rotate(-135deg); }
  .nav-group > button:hover { background: var(--mist); }
  .nav-group .subnav {
    display: none; position: absolute; top: calc(100% + 0.4rem); left: 0; min-width: 16rem;
    background: var(--white); border: 1px solid var(--mist-line); border-radius: var(--radius);
    padding: 0.4rem; margin: 0; box-shadow: 0 12px 30px -12px rgba(18, 40, 58, 0.35);
  }
  .nav-group .subnav.is-open { display: block; }
  .nav-group .subnav a { padding: 0.55rem 0.75rem; border-radius: 4px; font-size: var(--fs-sm); }
  .nav-group .subnav a:hover { background: var(--mist); }
  .nav-call { margin: 0 0 0 0.75rem; }
}
/* En móvil el grupo "Tratamientos" se muestra abierto como lista */
@media (max-width: 63.99rem) {
  .nav-group > button.nav-group-label { display: none; }
  .nav-group > .nav-group-text { display: block; }
}
@media (min-width: 64rem) {
  .nav-group > .nav-group-text { display: none; }
}

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.6rem;
  min-height: 48px; padding: 0.75rem 1.25rem;
  border-radius: var(--radius); font: 700 var(--fs-base)/1.2 var(--sans);
  text-decoration: none; border: 2px solid transparent; cursor: pointer;
}
.btn svg { width: 1.15em; height: 1.15em; flex: none; }
.btn-primary { background: var(--cedi); color: var(--white); }
.btn-primary:hover { background: var(--cedi-deep); color: var(--white); text-decoration: none; }
.btn-ghost { border-color: var(--cedi); color: var(--cedi); background: transparent; }
.btn-ghost:hover { background: var(--mist); color: var(--cedi-deep); }
.btn-light { background: var(--white); color: var(--cedi-deep); }
.btn-light:hover { background: var(--mist); color: var(--cedi-deep); }
.btn-small { min-height: 44px; padding: 0.55rem 0.9rem; font-size: var(--fs-sm); }

/* ---------- Corchetes de marca ---------- */
.bracketed { position: relative; padding: 0.35em 0.7em; }
.bracketed::before, .bracketed::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 0.42em;
  border: var(--bracket) solid var(--cedi);
}
.bracketed::before { left: 0; border-right: 0; }
.bracketed::after { right: 0; border-left: 0; }

/* ---------- Hero ---------- */
.hero { padding: var(--space-4) 0 var(--space-5); }
.hero-grid { display: grid; gap: var(--space-4); align-items: center; }
.hero h1 { margin: 0 0 var(--space-3); }
.hero h1.bracketed { display: inline-block; margin-left: -0.15em; padding-inline: 0.6em; }
.hero h1 .line { display: block; }
@media (min-width: 30rem) { .hero h1 .line { white-space: nowrap; } }
.hero-lead { font-size: var(--fs-md); color: var(--ink-soft); max-width: 40ch; margin-bottom: var(--space-3); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: var(--space-3); }
.hero-figure { margin: 0; }
.hero-figure img { border-radius: var(--radius); aspect-ratio: 4 / 3; object-fit: cover; width: 100%; }
.hero-figure figcaption { font-size: var(--fs-sm); color: var(--ink-soft); margin-top: 0.6rem; }

.facts {
  display: grid; gap: 0.25rem 1.5rem; margin: 0; padding: var(--space-2) 0 0;
  border-top: 1px solid var(--mist-line); font-size: var(--fs-sm);
}
.facts div { display: flex; gap: 0.5rem; }
.facts dt { font-weight: 700; }
.facts dd { margin: 0; color: var(--ink-soft); }

@media (min-width: 48rem) {
  .facts { grid-template-columns: repeat(3, auto); justify-content: start; }
  .facts div { flex-direction: column; gap: 0; }
}
@media (min-width: 60rem) {
  .hero { padding: var(--space-5) 0 var(--space-6); }
  .hero-grid { grid-template-columns: 1.15fr 1fr; gap: var(--space-5); }
}

/* ---------- Secciones ---------- */
.section { padding: var(--space-6) 0; }
.section-tint { background: var(--mist); }
.section-head { max-width: 46rem; margin-bottom: var(--space-4); }
.section-head p { color: var(--ink-soft); font-size: var(--fs-md); }

.split { display: grid; gap: var(--space-4); }
@media (min-width: 60rem) { .split { grid-template-columns: 1fr 1fr; gap: var(--space-5); align-items: start; } }

/* Áreas de tratamiento */
.areas { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; border-top: 1px solid var(--mist-line); }
.area {
  display: grid; grid-template-columns: 3rem 1fr; gap: 0.25rem 1rem;
  padding: var(--space-3) 0; border-bottom: 1px solid var(--mist-line); position: relative;
}
.area svg { width: 2.5rem; height: 2.5rem; color: var(--cedi); grid-row: span 2; }
.area h3 { margin: 0; font-size: var(--fs-lg); }
.area h3 a { color: var(--ink); text-decoration: none; }
.area h3 a::after { content: ""; position: absolute; inset: 0; }
.area:hover h3 a { color: var(--cedi); text-decoration: underline; }
.area p { margin: 0; color: var(--ink-soft); grid-column: 2; }
@media (min-width: 48rem) {
  .areas { grid-template-columns: 1fr 1fr; column-gap: var(--space-4); }
}

/* Equipo */
.team { display: grid; gap: var(--space-4); }
@media (min-width: 48rem) { .team { grid-template-columns: 1fr 1fr; } }
.member { display: grid; grid-template-columns: 7.5rem 1fr; gap: var(--space-3); align-items: start; }
.portrait { position: relative; padding: 0.55rem; margin: 0; }
.portrait::before, .portrait::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 1.1rem;
  border: 4px solid var(--cedi);
}
.portrait::before { left: 0; border-right: 0; }
.portrait::after { right: 0; border-left: 0; }
.portrait img { aspect-ratio: 5 / 6; object-fit: cover; width: 100%; border-radius: 2px; }
.member h3 { margin-bottom: 0.15em; }
.member .role { color: var(--cedi-deep); font-weight: 700; margin-bottom: 0.25em; }
.member .reg { color: var(--ink-soft); font-size: var(--fs-sm); }

.bio { display: grid; gap: var(--space-4); padding: var(--space-5) 0; border-top: 1px solid var(--mist-line); }
.bio:first-of-type { border-top: 0; padding-top: 0; }
@media (min-width: 52rem) { .bio { grid-template-columns: 15rem 1fr; gap: var(--space-5); } }
.bio .portrait { max-width: 15rem; }
.bio-meta { list-style: none; padding: 0; margin: var(--space-3) 0 0; font-size: var(--fs-sm); }
.bio-meta li { padding: 0.5rem 0; border-top: 1px solid var(--mist-line); }

/* Consulta (galería) */
.gallery { display: grid; gap: 0.75rem; grid-template-columns: 1fr 1fr; margin: 0; }
.gallery img { border-radius: var(--radius); width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
.gallery .wide { grid-column: span 2; }
@media (min-width: 60rem) {
  .gallery { grid-template-columns: 2fr 1fr; }
  .gallery .wide { grid-column: 1; grid-row: 1 / span 2; }
  .gallery .wide img { height: 100%; aspect-ratio: auto; }
}

/* Nota / aviso */
.note {
  background: var(--ochre-soft);
  padding: var(--space-3); border-radius: var(--radius); max-width: var(--measure);
}
.note h2, .note h3 { font-size: var(--fs-md); margin-bottom: 0.5em; }
.note > :last-child { margin-bottom: 0; }

/* Listas de problemas (páginas de área) */
.topics { display: grid; gap: var(--space-3); margin: 0; padding: 0; list-style: none; }
@media (min-width: 52rem) { .topics { grid-template-columns: 1fr 1fr; gap: var(--space-3) var(--space-4); } }
.topic { padding-top: var(--space-2); border-top: 2px solid var(--cedi); }
.topic h3 { font-size: var(--fs-md); margin-bottom: 0.35em; }
.topic p { margin: 0; color: var(--ink-soft); }

.checklist { list-style: none; padding: 0; margin: 0 0 var(--space-3); max-width: var(--measure); }
.checklist li { position: relative; padding: 0.7rem 0 0.7rem 1.75rem; border-bottom: 1px solid var(--mist-line); }
.checklist li::before {
  content: ""; position: absolute; left: 0.2rem; top: 1.05rem; width: 0.45rem; height: 0.85rem;
  border: solid var(--cedi); border-width: 3px 0 3px 3px;
}

/* Cabecera de página interior */
.page-head { padding: var(--space-5) 0 var(--space-4); border-bottom: 1px solid var(--mist-line); }
.page-head h1 { font-size: var(--fs-xl); margin-bottom: 0.35em; }
.page-head p { color: var(--ink-soft); font-size: var(--fs-md); max-width: 46rem; margin: 0; }
.breadcrumbs { font-size: var(--fs-sm); margin-bottom: var(--space-2); }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 0.35rem; padding: 0; margin: 0; }
.breadcrumbs li + li::before { content: "/"; margin-right: 0.35rem; color: var(--ink-soft); }
.breadcrumbs a { color: var(--ink-soft); }

.page-body { padding: var(--space-5) 0 var(--space-6); }
.layout-aside { display: grid; gap: var(--space-5); }
@media (min-width: 64rem) { .layout-aside { grid-template-columns: minmax(0, 1fr) 20rem; } }
.aside-box { background: var(--mist); border-radius: var(--radius); padding: var(--space-3); align-self: start; font-size: var(--fs-sm); }
@media (min-width: 64rem) { .aside-box { position: sticky; top: 6rem; } }
.aside-box h2 { font-size: var(--fs-md); }
.aside-box .btn { width: 100%; margin-top: 0.5rem; }
.aside-box img { border-radius: 4px; margin-bottom: var(--space-2); }

/* Línea temporal y publicaciones */
.timeline { list-style: none; margin: 0; padding: 0; max-width: 52rem; }
.timeline li { display: grid; grid-template-columns: 4.25rem 1fr; gap: 1rem; padding: 0.85rem 0; border-top: 1px solid var(--mist-line); }
.timeline .year { font-family: var(--serif); font-weight: 600; color: var(--cedi-deep); font-variant-numeric: lining-nums tabular-nums; }
.timeline p { margin: 0; }

.toc { display: flex; flex-wrap: wrap; gap: 0.5rem; list-style: none; padding: 0; margin: 0 0 var(--space-4); }
.toc a { display: inline-block; padding: 0.5rem 0.9rem; border: 1px solid var(--mist-line); border-radius: 999px; text-decoration: none; color: var(--ink); background: var(--white); }
.toc a:hover { border-color: var(--cedi); color: var(--cedi); }

.pubs { list-style: none; padding: 0; margin: 0 0 var(--space-5); max-width: 56rem; }
.pubs li { padding: 0.9rem 0 0.9rem 0; border-top: 1px solid var(--mist-line); }
.pubs .ref { margin: 0; }
.pubs .links { margin: 0.35rem 0 0; font-size: var(--fs-sm); display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; }
.pub-year { font-family: var(--serif); font-size: var(--fs-lg); margin: var(--space-4) 0 0.5rem; color: var(--cedi-deep); }
.badge { display: inline-block; font-size: 0.8rem; font-weight: 700; padding: 0.05rem 0.45rem; border-radius: 3px; background: var(--mist); color: var(--cedi-deep); margin-left: 0.25rem; vertical-align: 0.1em; }

/* Colaboraciones */
.collab { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--space-2); }
@media (min-width: 52rem) { .collab { grid-template-columns: 1fr 1fr; column-gap: var(--space-4); } }
.collab li { padding: var(--space-2) 0; border-top: 1px solid var(--mist-line); }
.collab strong { display: block; font-family: var(--serif); font-size: var(--fs-md); font-weight: 600; margin-bottom: 0.2rem; }
.collab span { color: var(--ink-soft); }

/* Contacto */
.contact-band { background: var(--cedi-deep); color: var(--white); padding: var(--space-5) 0; }
.contact-band a:not(.btn) { color: var(--white); }
.contact-band h2 { color: var(--white); }
.contact-grid { display: grid; gap: var(--space-4); }
@media (min-width: 60rem) { .contact-grid { grid-template-columns: 1.2fr 1fr 1fr; } }
.phone-big { font-family: var(--serif); font-size: var(--fs-xl); font-weight: 600; text-decoration: none; letter-spacing: 0.01em; display: inline-block; margin-bottom: 0.25em; }
.contact-band .muted { color: #c9dcea; }
.contact-band .hours div { grid-template-columns: 6rem 1fr; }
.hours { margin: 0; }
.hours div { display: grid; grid-template-columns: 9rem 1fr; gap: 0.5rem; padding: 0.35rem 0; }
.hours dt { font-weight: 700; }
.hours dd { margin: 0; }

.contact-cards { display: grid; gap: var(--space-3); margin-bottom: var(--space-4); }
@media (min-width: 48rem) { .contact-cards { grid-template-columns: repeat(2, 1fr); } }
.contact-item { border-top: 2px solid var(--cedi); padding-top: var(--space-2); }
.contact-item h2 { font-size: var(--fs-md); margin-bottom: 0.4em; }
.contact-item p { margin: 0; }
.contact-item .big { font-family: var(--serif); font-size: var(--fs-lg); font-weight: 600; text-decoration: none; }

.map-box { position: relative; background: var(--mist); border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 10; display: grid; place-items: center; text-align: center; padding: var(--space-3); }
.map-box iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.map-box p { max-width: 34rem; font-size: var(--fs-sm); color: var(--ink-soft); }

/* ---------- Pie ---------- */
.site-footer { background: var(--ink); color: #d6e2ec; padding: var(--space-5) 0 var(--space-3); font-size: var(--fs-sm); }
.site-footer a { color: var(--white); }
.footer-grid { display: grid; gap: var(--space-4); margin-bottom: var(--space-4); }
@media (min-width: 52rem) { .footer-grid { grid-template-columns: 1.4fr 1fr 1fr; } }
.site-footer h2 { font-family: var(--sans); font-size: var(--fs-base); font-weight: 700; color: var(--white); margin-bottom: 0.6em; letter-spacing: 0; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: 0.4rem; }
.footer-brand svg { width: 12rem; color: var(--white); margin-bottom: var(--space-2); }
.footer-brand svg path { stroke: #8fc1e3; }
.footer-brand svg text:first-of-type { fill: #8fc1e3; }
.footer-legal { border-top: 1px solid #2c4559; padding-top: var(--space-3); display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; justify-content: space-between; }
.footer-legal ul { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; }

/* Barra fija de llamada en móvil */
.call-bar {
  position: fixed; inset: auto 0 0 0; z-index: 40; display: flex; gap: 0.5rem;
  padding: 0.6rem 1rem calc(0.6rem + env(safe-area-inset-bottom));
  background: var(--paper); border-top: 1px solid var(--mist-line);
}
.call-bar .btn { flex: 1; }
body { padding-bottom: 4.6rem; }
@media (min-width: 64rem) { .call-bar { display: none; } body { padding-bottom: 0; } }

/* Páginas legales */
.legal h2 { font-size: var(--fs-lg); margin-top: 1.6em; }
.legal table { border-collapse: collapse; width: 100%; font-size: var(--fs-sm); margin-bottom: 1.5em; }
.legal th, .legal td { border: 1px solid var(--mist-line); padding: 0.6rem; text-align: left; vertical-align: top; overflow-wrap: anywhere; hyphens: auto; }
@media (max-width: 40rem) { .legal table { font-size: 0.875rem; } .legal th, .legal td { padding: 0.4rem; } }
.legal th { background: var(--mist); }
.review { background: var(--ochre-soft); padding: 0 0.25em; border-radius: 2px; }

/* Movimiento: una sola entrada orquestada en el hero */
@media (prefers-reduced-motion: no-preference) {
  .hero h1.bracketed::before, .hero h1.bracketed::after { animation: bracket-in 0.7s cubic-bezier(.2,.7,.2,1) both; }
  .hero h1.bracketed::after { animation-delay: 0.08s; }
  @keyframes bracket-in { from { transform: scaleY(0.2); opacity: 0; } to { transform: none; opacity: 1; } }
}

/* ==========================================================================
   Capa de profundidad
   Sombras tintadas en azul, el corchete de marca como capa de fondo y
   superficies elevadas. Mismo HTML y mismo contenido.
   ========================================================================== */
:root {
  --shadow-sm: 0 1px 2px rgba(14, 58, 90, 0.08), 0 3px 8px -3px rgba(14, 58, 90, 0.14);
  --shadow-md: 0 2px 4px rgba(14, 58, 90, 0.05), 0 14px 32px -14px rgba(14, 58, 90, 0.34);
  --shadow-lg: 0 4px 10px rgba(14, 58, 90, 0.06), 0 34px 70px -30px rgba(14, 58, 90, 0.5);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ghost: rgba(27, 106, 158, 0.07);
}

/* Superficies del navegador */
::selection { background: #cfe2ef; color: var(--ink); }
html { scrollbar-color: #9fbdd2 var(--paper); accent-color: var(--cedi); }
body { caret-color: var(--cedi); }

/* Cabecera: se despega del contenido */
.site-header { box-shadow: 0 1px 0 var(--mist-line), 0 10px 24px -20px rgba(14, 58, 90, 0.5); border-bottom-color: transparent; }

/* Botones con relieve y respuesta */
.btn { transition: transform 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out), background-color 0.2s ease, color 0.2s ease; }
.btn-primary { box-shadow: 0 1px 1px rgba(14, 58, 90, 0.2), 0 8px 18px -8px rgba(27, 106, 158, 0.7); background-image: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0)); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 2px 3px rgba(14, 58, 90, 0.2), 0 14px 26px -10px rgba(27, 106, 158, 0.75); }
.btn-ghost { background: var(--white); }
.btn-ghost:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0); }
.btn-light { box-shadow: 0 10px 22px -10px rgba(0, 0, 0, 0.45); }

/* ---------- Hero: campo de color, corchete fantasma y foto elevada ---------- */
.hero { position: relative; isolation: isolate; overflow: hidden;
  background:
    radial-gradient(70rem 40rem at 85% 10%, rgba(201, 219, 231, 0.55), transparent 60%),
    linear-gradient(180deg, var(--paper) 0%, var(--paper) 55%, #eef4f8 100%);
}
.hero-figure { position: relative; }
/* FONDO FOTO INICIO ANULADO
.hero-figure::before { /* bloque desplazado detrás de la foto */
  content: ""; position: absolute; z-index: -1; top: -1.25rem; left: -1.25rem; right: 1.5rem; bottom: 3.4rem;
  border-radius: var(--radius);
  background:
    radial-gradient(rgba(255, 255, 255, 0.16) 1.2px, transparent 1.4px) 0 0 / 14px 14px,
    linear-gradient(135deg, var(--cedi), var(--cedi-deep));
}
*/
.hero-figure img { box-shadow: var(--shadow-lg); position: relative; }
.hero-figure figcaption { padding-left: 0.1rem; }
.facts { background: rgba(255, 255, 255, 0.7); border: 1px solid var(--mist-line); border-radius: var(--radius); padding: var(--space-2); box-shadow: var(--shadow-sm); }
@media (min-width: 48rem) { .facts { display: inline-grid; } .facts div + div { border-left: 1px solid var(--mist-line); padding-left: 1.5rem; } }
@media (max-width: 47.99rem) { .hero-figure::before { top: -0.75rem; left: -0.75rem; right: 0.75rem; } }

/* ---------- Secciones con tinte: suaves degradados y profundidad ---------- */
.section-tint {
  background: linear-gradient(180deg, #e9f1f6 0%, var(--mist) 40%, #e2ecf3 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), inset 0 -1px 0 var(--mist-line);
}

/* Galería de la consulta */
.gallery img { box-shadow: var(--shadow-md); transition: transform 0.6s var(--ease-out), box-shadow 0.6s var(--ease-out); }
.gallery > img:hover, .gallery .wide:hover img { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

/* ---------- Tratamientos: el punto álgido, en azul profundo ---------- */
.section-deep {
  position: relative; isolation: isolate; overflow: hidden; color: #e3eef6;
  background:
    radial-gradient(50rem 30rem at 0% 0%, rgba(42, 128, 186, 0.45), transparent 60%),
    radial-gradient(40rem 30rem at 100% 100%, rgba(8, 40, 64, 0.8), transparent 60%),
    var(--cedi-deep);
}
.section-deep::before, .section-deep::after { /* corchetes que enmarcan la sección */
  content: ""; position: absolute; z-index: -1; pointer-events: none; display: none;
  top: 3.5rem; bottom: 3.5rem; width: 3.5rem; border: 1.1rem solid rgba(255, 255, 255, 0.07);
}
.section-deep::before { left: max(1rem, calc((100% - var(--wrap)) / 2 - 5.5rem)); border-right: 0; }
.section-deep::after { right: max(1rem, calc((100% - var(--wrap)) / 2 - 5.5rem)); border-left: 0; }
@media (min-width: 82rem) { .section-deep::before, .section-deep::after { display: block; } }
.section-deep h2 { color: var(--white); }
.section-deep .section-head p { color: #c4d9e8; }
.section-deep .areas { border-top: 0; gap: 0.75rem; }
.section-deep .area {
  border: 1px solid rgba(255, 255, 255, 0.12); border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.025));
  padding: var(--space-3); grid-template-columns: 3.75rem 1fr; column-gap: 1.25rem;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset, 0 20px 40px -28px rgba(0, 0, 0, 0.6);
  transition: transform 0.45s var(--ease-out), background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.45s var(--ease-out);
}
.section-deep .area svg {
  width: 3.5rem; height: 3.5rem; padding: 0.6rem; border-radius: 50%;
  color: var(--cedi-deep); background: #dcebf5; box-shadow: 0 6px 16px -6px rgba(0, 0, 0, 0.5);
}
.section-deep .area h3 a { color: var(--white); }
.section-deep .area p { color: #c4d9e8; }
.section-deep .area:hover { transform: translateY(-3px); border-color: rgba(255, 255, 255, 0.28); background-color: rgba(255, 255, 255, 0.05); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08) inset, 0 28px 50px -26px rgba(0, 0, 0, 0.7); }
.section-deep .area:hover h3 a { color: var(--white); text-decoration-color: #8fc1e3; }
.section-deep .area:focus-within { outline: 3px solid var(--ochre); outline-offset: 3px; }
.section-deep .area h3 a:focus-visible { outline: none; }
@media (min-width: 48rem) { .section-deep .areas { gap: 1.25rem; } }

/* ---------- Equipo: retratos con volumen ---------- */
.portrait img { box-shadow: var(--shadow-md); }
.member { background: rgba(255, 255, 255, 0.72); border: 1px solid rgba(255, 255, 255, 0.9); border-radius: var(--radius); padding: var(--space-3); box-shadow: var(--shadow-md); }
.bio .portrait img { box-shadow: var(--shadow-lg); }
.bio .portrait::before, .bio .portrait::after { width: 1.6rem; }

/* ---------- Investigación: pastillas con relieve ---------- */
.toc a { box-shadow: var(--shadow-sm); transition: transform 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out), border-color 0.2s ease, color 0.2s ease; }
.toc a:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }

/* ---------- Banda de contacto ---------- */
.contact-band { position: relative; isolation: isolate; overflow: hidden;
  background:
    radial-gradient(40rem 24rem at 100% 0%, rgba(42, 128, 186, 0.5), transparent 60%),
    var(--cedi-deep);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.phone-big { text-shadow: 0 6px 24px rgba(0, 0, 0, 0.25); }
.section-deep + .section-tint, .contact-band + .site-footer { box-shadow: none; }

/* ---------- Páginas interiores: cabecera con profundidad ---------- */
.page-head { position: relative; isolation: isolate; overflow: hidden; border-bottom: 0;
  background:
    radial-gradient(48rem 26rem at 90% -10%, rgba(201, 219, 231, 0.7), transparent 60%),
    linear-gradient(180deg, var(--paper), #edf3f8);
  box-shadow: inset 0 -1px 0 var(--mist-line);
}
.page-head::after {
  content: ""; position: absolute; z-index: -1; pointer-events: none;
  right: 4%; top: 50%; transform: translateY(-50%); width: 7rem; height: 13rem;
  border: 1.6rem solid var(--ghost); border-left: 0;
}
.page-head::before {
  content: ""; position: absolute; z-index: -1; pointer-events: none;
  right: calc(4% + 12rem); top: 50%; transform: translateY(-50%); width: 7rem; height: 13rem;
  border: 1.6rem solid var(--ghost); border-right: 0;
}
@media (max-width: 47.99rem) { .page-head::before, .page-head::after { display: none; } }

/* Caja lateral de cita: tarjeta elevada con corchetes */
.aside-box { background: var(--white); border: 1px solid var(--mist-line); box-shadow: var(--shadow-lg); padding: var(--space-3) var(--space-3) var(--space-3); position: relative; }
.aside-box::before, .aside-box::after {
  content: ""; position: absolute; top: -1px; bottom: -1px; width: 0.9rem; border: 4px solid var(--cedi);
}
.aside-box::before { left: -1px; border-right: 0; border-radius: var(--radius) 0 0 var(--radius); }
.aside-box::after { right: -1px; border-left: 0; border-radius: 0 var(--radius) var(--radius) 0; }
.aside-box img { box-shadow: var(--shadow-sm); }

/* Temas de cada área: paneles ligeros */
.topic { position: relative; background: var(--white); border: 1px solid var(--mist-line); border-radius: var(--radius); padding: var(--space-3); box-shadow: var(--shadow-sm); }
.checklist { background: var(--white); border: 1px solid var(--mist-line); border-radius: var(--radius); padding: 0.25rem var(--space-3); box-shadow: var(--shadow-sm); }
.checklist li:last-child { border-bottom: 0; }

/* Esquinas de corchete en paneles (motivo de marca en lugar de borde de acento) */
.topic::before, .contact-item::before, .topic::after, .contact-item::after {
  content: ""; position: absolute; width: 1rem; height: 1rem; border: 3px solid var(--cedi); pointer-events: none;
}
.topic::before, .contact-item::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; border-top-left-radius: var(--radius); }
.topic::after, .contact-item::after { top: -1px; right: -1px; border-left: 0; border-bottom: 0; border-top-right-radius: var(--radius); }
.topic h3 { font-size: 1.45rem; }
.note h2, .note h3 { font-size: 1.45rem; }

/* Enlaces sobre fondos oscuros: el hover no puede oscurecerse */
.site-footer a:hover, .contact-band a:not(.btn):hover { color: #b9dcf3; }

/* Notas: panel cálido con esquinas de corchete */
.note { position: relative; border: 1px solid #ecd9b6; box-shadow: var(--shadow-sm); }
.note::before, .note::after { content: ""; position: absolute; width: 1.1rem; height: 1.1rem; border: 3px solid var(--ochre); }
.note::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; border-top-left-radius: var(--radius); }
.note::after { bottom: -1px; right: -1px; border-left: 0; border-top: 0; border-bottom-right-radius: var(--radius); }

/* Datos de contacto */
.contact-item { position: relative; background: var(--white); border: 1px solid var(--mist-line); border-radius: var(--radius); padding: var(--space-3); box-shadow: var(--shadow-sm); }
.map-box { border: 1px solid var(--mist-line); box-shadow: var(--shadow-md);
  background-image: radial-gradient(rgba(27, 106, 158, 0.14) 1.2px, transparent 1.3px); background-size: 16px 16px; background-color: var(--mist); }

/* Línea temporal con hilo y nodos */
.timeline { position: relative; }
.timeline li { position: relative; border-top: 0; padding: 0.9rem 0 0.9rem 0; grid-template-columns: 4.25rem 1.5rem 1fr; gap: 0 0.75rem; }
.timeline li::before { content: ""; grid-column: 2; grid-row: 1; justify-self: center; width: 0.75rem; height: 0.75rem; margin-top: 0.45rem; border-radius: 50%; background: var(--white); border: 3px solid var(--cedi); box-shadow: 0 0 0 4px var(--paper); position: relative; z-index: 1; }
.timeline::before { content: ""; position: absolute; top: 1.2rem; bottom: 1.2rem; left: calc(4.25rem + 0.75rem + 0.75rem - 1px); width: 2px; background: linear-gradient(var(--mist-line), var(--cedi) 15%, var(--cedi) 85%, var(--mist-line)); opacity: 0.45; }
.timeline .year { grid-column: 1; grid-row: 1; text-align: right; }
.timeline li > p { grid-column: 3; grid-row: 1; }
.timeline li + li .year { color: var(--cedi-deep); }

/* Colaboraciones como fichas */
.collab li { background: rgba(255, 255, 255, 0.75); border: 1px solid rgba(255, 255, 255, 0.95); border-radius: var(--radius); padding: var(--space-3); box-shadow: var(--shadow-sm); }
.collab { gap: var(--space-2); }

/* Publicaciones: años como marcas */
.pub-year { display: inline-flex; align-items: center; gap: 0.6rem; }
.pub-year::before { content: ""; width: 0.55rem; height: 1.3rem; border: 3px solid var(--cedi); border-right: 0; }
.pubs li { transition: background-color 0.2s ease; border-radius: 4px; padding-inline: 0.5rem; margin-inline: -0.5rem; }
.pubs li:hover { background: rgba(230, 239, 245, 0.6); }

/* Pie */

@media (prefers-reduced-motion: reduce) {
  .btn, .gallery img, .section-deep .area, .toc a { transition: none; }
  .btn:hover, .gallery img:hover, .section-deep .area:hover, .toc a:hover { transform: none; }
}

@media print {
  .site-header, .call-bar, .site-footer, .hero-actions, .contact-band .btn { display: none !important; }
  body { padding: 0; background: #fff; }
  a { color: inherit; }
}
