/* ==========================================================================
   Dr. Juan José de Benito — estilos compartidos de páginas de contenido
   (artículos, especialidades, trayectoria, colegas, 404).
   Mismo sistema visual que la home (src/styles.css).
   ========================================================================== */

/* Fuentes alojadas en el propio sitio (SIL Open Font License). */
@font-face { font-family: "Fraunces"; font-style: normal; font-weight: 400 600; font-display: swap; src: url("/fonts/fraunces-latin.woff2") format("woff2"); }
@font-face { font-family: "Fraunces"; font-style: italic; font-weight: 400 500; font-display: swap; src: url("/fonts/fraunces-italic-latin.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("/fonts/inter-latin.woff2") format("woff2"); }

:root {
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;

  --ink-950: #061a1c;
  --ink-900: #0b2a2d;
  --ink-800: #173a3d;
  --ink-700: #2f4a4d;
  --ink-600: #4d6366;
  --ink-500: #5f7376;
  --line: #e5e8e2;
  --line-strong: #d4dad3;

  --paper: #f8f6f1;
  --white: #ffffff;

  --brand-900: #0a3d38;
  --brand-800: #0d4c45;
  --brand-700: #0f5f56;
  --brand-600: #13766a;
  --brand-500: #1d8f7f;
  --brand-200: #bfe0d6;
  --brand-100: #dcefe9;
  --brand-50: #eef7f4;

  --gold-600: #9a7535;
  --gold-500: #b48a46;
  --gold-300: #d9bf8f;

  --radius-sm: 12px;
  --radius: 18px;
  --radius-lg: 26px;
  --shadow-sm: 0 1px 2px rgba(6, 26, 28, 0.05), 0 2px 8px rgba(6, 26, 28, 0.04);
  --shadow: 0 1px 2px rgba(6, 26, 28, 0.04), 0 14px 34px -14px rgba(6, 26, 28, 0.16);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --header-h: 74px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--white); color: var(--ink-700);
  font-family: var(--font-sans); font-size: 1.0625rem; line-height: 1.7;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;
}
img { display: block; max-width: 100%; height: auto; }
a { color: var(--brand-700); }
h1, h2, h3, h4 { color: var(--ink-900); text-wrap: balance; }
:focus-visible { outline: 3px solid var(--brand-500); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--brand-100); color: var(--ink-900); }
[hidden] { display: none !important; }

.container { width: min(1200px, calc(100% - 3rem)); margin-inline: auto; }

.skip-link { position: absolute; left: 1rem; top: -100px; z-index: 100; padding: 0.75rem 1rem; border-radius: var(--radius-sm); background: var(--ink-900); color: var(--white); font-weight: 600; text-decoration: none; }
.skip-link:focus { top: 1rem; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 46px; padding: 0.75rem 1.3rem; border-radius: 999px; border: 1.5px solid transparent;
  font-size: 0.98rem; font-weight: 600; line-height: 1.2; text-align: center; text-decoration: none; cursor: pointer;
  transition: transform 220ms var(--ease), background-color 220ms var(--ease), border-color 220ms var(--ease), color 220ms var(--ease), box-shadow 220ms var(--ease);
}
.btn:hover { transform: translateY(-2px); }
.btn--sm { min-height: 42px; padding: 0.55rem 1.1rem; font-size: 0.93rem; }
.btn--block { display: flex; width: 100%; }
.btn--primary { background: var(--brand-700); color: var(--white); box-shadow: 0 10px 24px -12px rgba(15, 95, 86, 0.65); }
.btn--primary:hover { background: var(--brand-800); }
.btn--outline { background: var(--white); color: var(--brand-700); border-color: var(--brand-700); }
.btn--outline:hover { background: var(--brand-700); color: var(--white); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, 0.9);
  -webkit-backdrop-filter: saturate(160%) blur(16px); backdrop-filter: saturate(160%) blur(16px);
  border-bottom: 1px solid var(--line);
}
.site-header__inner { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: 0.75rem; min-width: 0; text-decoration: none; }
.brand__mark {
  flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%;
  background: var(--brand-700); color: var(--white); font-family: var(--font-serif); font-size: 0.98rem; font-weight: 500;
  box-shadow: inset 0 0 0 3px var(--brand-700), inset 0 0 0 4px rgba(255, 255, 255, 0.45);
}
.brand__text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.brand__name { font-family: var(--font-serif); font-size: 1.1rem; font-weight: 500; color: var(--ink-900); white-space: nowrap; }
.brand__role { margin-top: 0.15rem; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-500); white-space: nowrap; }
.site-nav { display: flex; align-items: center; gap: 0.3rem; }
.site-nav__link { padding: 0.5rem 0.8rem; border-radius: 999px; font-size: 0.95rem; font-weight: 500; color: var(--ink-700); text-decoration: none; transition: background-color 200ms var(--ease), color 200ms var(--ease); }
.site-nav__link:hover { background: rgba(15, 95, 86, 0.07); color: var(--ink-900); }
.site-nav .btn { margin-left: 0.5rem; white-space: nowrap; }

/* ---------- Encabezado de página ---------- */
.page-hero {
  padding: clamp(2.5rem, 1.5rem + 3vw, 4.5rem) 0 clamp(2.5rem, 1.5rem + 3vw, 4rem);
  background:
    radial-gradient(800px 420px at 92% 0%, rgba(29, 143, 127, 0.1), transparent 62%),
    var(--paper);
  border-bottom: 1px solid var(--line);
}
.page-hero__inner > * { max-width: 860px; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin-bottom: 1.6rem; font-size: 0.88rem; color: var(--ink-500); }
.crumbs a { color: var(--ink-600); text-decoration: none; }
.crumbs a:hover { color: var(--brand-700); text-decoration: underline; }
.crumbs span[aria-hidden] { color: var(--gold-500); }
.page-hero .eyebrow {
  display: inline-flex; align-items: center; gap: 0.75rem;
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.15em; text-transform: uppercase; color: var(--brand-600);
}
.page-hero .eyebrow::before { content: ""; width: 28px; height: 1px; background: var(--gold-500); }
.page-hero h1 {
  margin: 1rem 0 0; font-family: var(--font-serif); font-weight: 440; font-optical-sizing: auto;
  font-size: clamp(2.15rem, 1.4rem + 2.6vw, 3.4rem); line-height: 1.08; letter-spacing: -0.02em;
}
.page-hero .meta, .page-hero .lead { margin: 1.2rem 0 0; max-width: 720px; color: var(--ink-600); }
.page-hero .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; font-size: 0.95rem; }
.page-hero .lead { font-size: 1.15rem; line-height: 1.7; }
.page-hero .badge-list, .page-hero .tag-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.5rem; }

.badge, .tag {
  display: inline-flex; align-items: center; padding: 0.32rem 0.8rem; border-radius: 999px;
  background: var(--white); border: 1px solid var(--line-strong);
  font-size: 0.82rem; font-weight: 600; line-height: 1.4; color: var(--ink-800);
}
.prose .badge, .prose .tag { margin: 0 0.35rem 0.5rem 0; background: var(--brand-50); border-color: var(--brand-100); color: var(--brand-800); }

/* ---------- Cuerpo ---------- */
.page-body { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: clamp(2.5rem, 1rem + 4vw, 5rem); align-items: start; padding: clamp(2.5rem, 1.5rem + 3vw, 4.5rem) 0 clamp(3.5rem, 2rem + 4vw, 6rem); }
.page-body--single { grid-template-columns: minmax(0, 1fr); }
.page-body--single .prose { max-width: 820px; }

.prose { min-width: 0; max-width: 740px; font-size: 1.075rem; line-height: 1.8; color: var(--ink-700); }
.prose > *:first-child { margin-top: 0; }
.prose h2 { margin: 2.6rem 0 0.9rem; font-family: var(--font-serif); font-weight: 460; font-size: clamp(1.55rem, 1.3rem + 0.8vw, 1.95rem); line-height: 1.2; letter-spacing: -0.012em; }
.prose h3 { margin: 2rem 0 0.6rem; font-size: 1.15rem; font-weight: 650; line-height: 1.35; }
.prose p { margin: 0 0 1.1rem; }
.prose strong { color: var(--ink-900); font-weight: 650; }
.prose a { color: var(--brand-700); text-decoration: underline; text-decoration-color: var(--brand-200); text-decoration-thickness: 2px; text-underline-offset: 3px; transition: text-decoration-color 200ms var(--ease); }
.prose a:hover { text-decoration-color: var(--brand-700); }
.prose ul, .prose ol { margin: 0 0 1.4rem; padding-left: 0; list-style: none; }
.prose li { position: relative; margin: 0 0 0.65rem; padding-left: 1.6rem; }
.prose ul > li::before { content: ""; position: absolute; left: 0.2rem; top: 0.72em; width: 7px; height: 7px; border-radius: 50%; background: var(--brand-600); box-shadow: 0 0 0 4px var(--brand-50); }
.prose ol { counter-reset: item; }
.prose ol > li { counter-increment: item; padding-left: 2.2rem; }
.prose ol > li::before { content: counter(item); position: absolute; left: 0; top: 0.1em; display: grid; place-items: center; width: 1.55rem; height: 1.55rem; border-radius: 50%; background: var(--brand-50); color: var(--brand-700); font-size: 0.8rem; font-weight: 700; }
.prose table { width: 100%; margin: 1.5rem 0; border-collapse: collapse; font-size: 0.97rem; }
.prose th, .prose td { padding: 0.75rem 0.9rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.prose th { background: var(--paper); color: var(--ink-900); font-weight: 650; }
.prose section { margin-top: 0 !important; }

.highlight {
  margin: 0 0 2rem; padding: 1.4rem 1.6rem; border-radius: var(--radius);
  background: linear-gradient(135deg, var(--brand-50), var(--white)); border: 1px solid var(--brand-100);
  border-left: 4px solid var(--brand-600);
}
.highlight p { margin: 0; font-size: 1.1rem; line-height: 1.75; color: var(--ink-800); }

.note {
  margin: 1.5rem 0; padding: 1rem 1.2rem; border-radius: var(--radius-sm);
  background: #fbf6ea; border: 1px solid #eadcc0; font-size: 0.95rem; line-height: 1.65; color: var(--ink-700);
}

.cta-box {
  position: relative; overflow: hidden; margin: 2.5rem 0; padding: 1.8rem; border-radius: var(--radius-lg);
  background: radial-gradient(420px 220px at 100% 0%, rgba(217, 191, 143, 0.25), transparent 60%), var(--brand-800);
  color: rgba(255, 255, 255, 0.82); text-align: left;
}
.cta-box h3, .cta-box > p:first-child { margin: 0 0 1.1rem; color: var(--white); font-family: var(--font-serif); font-size: 1.3rem; font-weight: 450; line-height: 1.35; }
.cta-box > p { margin: 0 0 1rem; }
.cta-box a, .cta-box .btn {
  display: inline-flex; align-items: center; justify-content: center; margin: 0 0.5rem 0.5rem 0; padding: 0.7rem 1.2rem;
  border-radius: 999px; background: var(--white); color: var(--brand-800); font-size: 0.95rem; font-weight: 600; text-decoration: none;
  transition: transform 220ms var(--ease), background-color 220ms var(--ease);
}
.cta-box a:hover { transform: translateY(-2px); background: var(--paper); }
.cta-box a + a { background: transparent; color: var(--white); border: 1.5px solid rgba(255, 255, 255, 0.45); }
.cta-box a + a:hover { background: rgba(255, 255, 255, 0.08); }
.cta-box .note { color: var(--ink-700); }

.disclaimer { margin-top: 2.5rem; padding: 1.2rem 1.3rem; border-radius: var(--radius-sm); background: var(--paper); border: 1px solid var(--line); font-size: 0.9rem; line-height: 1.65; color: var(--ink-600); }

/* Trayectoria */
.timeline { position: relative; margin: 1.8rem 0 2.2rem; padding-left: 1.8rem; border-left: 1px solid var(--line-strong); }
.timeline-item { position: relative; margin-bottom: 1.6rem; }
.timeline-item::before { content: ""; position: absolute; left: calc(-1.8rem - 6px); top: 0.35rem; width: 11px; height: 11px; border-radius: 50%; background: var(--white); border: 2px solid var(--brand-600); }
.timeline-year { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold-600); }
.timeline-title { margin: 0.25rem 0 0.2rem; font-family: var(--font-serif); font-size: 1.2rem; font-weight: 480; line-height: 1.35; color: var(--ink-900); }
.timeline-desc { margin: 0; font-size: 0.98rem; color: var(--ink-600); }

/* Colegas */
.contact-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-top: 1rem; }
.contact-card { padding: 1.2rem; border-radius: var(--radius); background: var(--white); border: 1px solid var(--line); color: var(--ink-700); }
.contact-card strong { display: block; margin-bottom: 0.35rem; color: var(--ink-900); font-family: var(--font-serif); font-size: 1.15rem; font-weight: 500; }
.cta-box .contact-card a { margin: 0.75rem 0 0; background: var(--brand-700); color: var(--white); border: 0; word-break: break-word; }
.cta-box .contact-card a:hover { background: var(--brand-800); }

/* ---------- Tarjeta lateral ---------- */
.page-aside { position: sticky; top: calc(var(--header-h) + 1.5rem); }
.doctor-card { padding: 1.5rem; border-radius: var(--radius-lg); background: var(--white); border: 1px solid var(--line); box-shadow: var(--shadow); }
.doctor-card__head { display: flex; align-items: center; gap: 0.9rem; }
.doctor-card__head img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; object-position: 50% 6%; box-shadow: 0 0 0 3px var(--white), 0 0 0 4px var(--gold-300); }
.doctor-card__name { margin: 0; font-family: var(--font-serif); font-size: 1.15rem; font-weight: 500; line-height: 1.25; color: var(--ink-900); }
.doctor-card__role { margin: 0.15rem 0 0; font-size: 0.82rem; line-height: 1.45; color: var(--ink-500); }
.doctor-card__list { list-style: none; margin: 1.2rem 0 1.4rem; padding: 1.1rem 0 0; border-top: 1px solid var(--line); display: grid; gap: 0.55rem; }
.doctor-card__list li { position: relative; padding-left: 1.5rem; font-size: 0.92rem; line-height: 1.5; color: var(--ink-700); }
.doctor-card__list li::before {
  content: ""; position: absolute; left: 0; top: 0.3em; width: 15px; height: 15px; border-radius: 50%;
  background: var(--brand-700) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center / 9px no-repeat;
}
.doctor-card .btn + .btn { margin-top: 0.6rem; }
.doctor-card__link { display: block; margin-top: 1rem; text-align: center; font-size: 0.9rem; font-weight: 600; text-decoration: none; }

/* ---------- Índice de artículos ---------- */
.blog-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; padding: clamp(2.5rem, 1.5rem + 3vw, 4.5rem) 0 clamp(3.5rem, 2rem + 4vw, 6rem); }
.blog-card {
  display: flex; flex-direction: column; padding: 1.7rem 1.75rem; border-radius: var(--radius-lg);
  background: var(--white); border: 1px solid var(--line); box-shadow: var(--shadow-sm); text-decoration: none;
  transition: transform 260ms var(--ease), box-shadow 260ms var(--ease), border-color 260ms var(--ease);
}
.blog-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--brand-200); }
.blog-card__eyebrow { font-size: 0.74rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--brand-600); }
.blog-card h2 { margin: 0.7rem 0 0; font-family: var(--font-serif); font-size: 1.38rem; font-weight: 460; line-height: 1.25; }
.blog-card p { flex: 1; margin: 0.75rem 0 0; font-size: 0.98rem; line-height: 1.65; color: var(--ink-600); }
.blog-card__meta { margin-top: 1.2rem; font-size: 0.88rem; font-weight: 600; color: var(--brand-700); }

/* ---------- Relacionados ---------- */
.related { padding: clamp(3rem, 2rem + 3vw, 4.5rem) 0; background: var(--paper); border-top: 1px solid var(--line); }
.related h2 { margin: 0 0 1.8rem; font-family: var(--font-serif); font-weight: 450; font-size: clamp(1.7rem, 1.4rem + 1vw, 2.2rem); }
.related__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.related__card {
  display: flex; flex-direction: column; justify-content: space-between; gap: 1rem; min-height: 132px; padding: 1.35rem 1.4rem;
  border-radius: var(--radius); background: var(--white); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  font-family: var(--font-serif); font-size: 1.12rem; font-weight: 450; line-height: 1.35; color: var(--ink-900); text-decoration: none;
  transition: transform 260ms var(--ease), box-shadow 260ms var(--ease), border-color 260ms var(--ease);
}
.related__card span { font-family: var(--font-sans); font-size: 0.9rem; font-weight: 600; color: var(--brand-700); }
.related__card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--brand-200); }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink-950); color: rgba(255, 255, 255, 0.66); padding: 4rem 0 2rem; font-size: 0.95rem; }
.site-footer a { color: inherit; text-decoration: none; transition: color 200ms var(--ease); }
.site-footer a:hover { color: var(--white); }
.site-footer__grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1.1fr; gap: 2.5rem; }
.site-footer .brand__name { color: var(--white); }
.site-footer .brand__role { color: rgba(255, 255, 255, 0.6); }
.site-footer .brand__mark { background: var(--white); color: var(--brand-800); box-shadow: inset 0 0 0 3px var(--white), inset 0 0 0 4px rgba(15, 95, 86, 0.35); }
.site-footer__brand p { margin: 1.2rem 0 0; line-height: 1.7; }
.site-footer h2 { margin: 0; font-family: var(--font-sans); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold-300); }
.site-footer ul { list-style: none; margin: 1.1rem 0 0; padding: 0; display: grid; gap: 0.55rem; }
.site-footer__sedes li { display: grid; }
.site-footer__sedes strong { color: var(--white); font-weight: 600; }
.site-footer__pro { display: inline-block; margin-top: 1.4rem; font-weight: 600; color: var(--white) !important; }
.site-footer__bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.75rem 2rem; margin-top: 3rem; padding-top: 1.6rem; border-top: 1px solid rgba(255, 255, 255, 0.1); font-size: 0.85rem; color: rgba(255, 255, 255, 0.5); }
.site-footer__bottom p { margin: 0; }
.social { display: flex; gap: 0.6rem; margin-top: 1.4rem; }
.social a { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.16); color: var(--white); }
.social a:hover { background: var(--white); color: var(--ink-950); }
.social svg { width: 18px; height: 18px; fill: currentColor; }

/* ---------- CTA móvil ---------- */
.mobile-cta { display: none; }

/* ---------- 404 ---------- */
.not-found { display: grid; place-items: center; min-height: calc(100vh - var(--header-h)); padding: 4rem 0; background: radial-gradient(700px 400px at 50% 0%, rgba(29, 143, 127, 0.1), transparent 62%), var(--paper); text-align: center; }
.not-found__code { margin: 0; font-family: var(--font-serif); font-size: clamp(5rem, 4rem + 6vw, 8rem); font-weight: 400; line-height: 1; color: var(--brand-700); }
.not-found h1 { margin: 1rem 0 0; font-family: var(--font-serif); font-weight: 450; font-size: clamp(1.8rem, 1.4rem + 1.5vw, 2.4rem); }
.not-found p { max-width: 480px; margin: 1rem auto 2rem; color: var(--ink-600); }
.not-found__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.75rem; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .page-body { grid-template-columns: minmax(0, 1fr); }
  .page-aside { position: static; max-width: 560px; }
  .site-footer__grid { grid-template-columns: 1fr 1fr; }
  .related__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .site-nav__link { display: none; }
}

@media (max-width: 640px) {
  :root { --header-h: 66px; }
  body { font-size: 1rem; padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
  .container { width: calc(100% - 2rem); }
  .brand__mark { width: 38px; height: 38px; font-size: 0.9rem; }
  .brand__name { font-size: 0.98rem; }
  .brand__role { display: none; }
  .site-nav .btn { margin-left: 0; padding-inline: 0.95rem; }
  .prose { font-size: 1.02rem; }
  .highlight { padding: 1.15rem 1.2rem; }
  .cta-box { padding: 1.4rem; }
  .cta-box a { display: flex; width: 100%; margin-right: 0; }
  .contact-grid, .related__grid, .site-footer__grid, .blog-list { grid-template-columns: 1fr; }
  .mobile-cta {
    display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 55;
    padding: 0.7rem 1rem calc(0.7rem + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 255, 255, 0.95); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
    border-top: 1px solid var(--line); box-shadow: 0 -10px 30px -20px rgba(6, 26, 28, 0.35);
  }
}

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