/* Guías de Briblo (/guias/*): cabecera de sitio, banda hero, índice lateral, cuerpo de lectura y tarjetas de relacionadas.
   Se carga después de /assets/legal.css. Las reglas de una tabla concreta (ancho mínimo, primera columna fija) siguen inline en cada guía.
   Las fichas de autor (/guias/autores/*) lo cargan solo por la cabecera: no usan ninguna otra clase de este archivo. */
:root {
  --blue-deep: #012DFD;
  --body-text: #333B57;
  --header-h: 80px;
  --cta-shadow: 0 8px 24px rgba(1, 83, 253, .18);
  --card-shadow: 0 12px 36px rgba(7, 20, 55, .06);
}

/* Cabecera de sitio (la misma que /guias/) */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 52px; padding: 0 24px; border: 0; border-radius: 12px; font: inherit; font-size: 1rem; font-weight: 700; text-decoration: none; white-space: nowrap; cursor: pointer; transition: background-color .2s ease; }
.btn-primary { background: var(--blue); color: #fff; box-shadow: var(--cta-shadow); }
.btn-primary:hover { background: var(--blue-deep); }
.btn-sm { min-height: 44px; padding: 0 18px; font-size: .9375rem; }
.site-header { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--bg); border-bottom: 1px solid var(--border); }
.site-header .wrap { max-width: 1240px; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: var(--header-h); }
.logo { display: block; padding-block: 12px; border-radius: 6px; }
.logo img { display: block; width: 124px; height: auto; }
.main-nav { display: flex; gap: 4px; margin-left: auto; }
.main-nav a, .lang-switch { display: inline-flex; align-items: center; min-height: 44px; border-radius: 10px; color: var(--text-2); text-decoration: none; }
.main-nav a { padding: 0 14px; font-size: .9375rem; font-weight: 600; }
.lang-switch { padding: 0 12px; font-size: .875rem; font-weight: 700; }
.main-nav a:hover, .lang-switch:hover { color: var(--navy); background: var(--soft); }
@media (max-width: 960px) { .main-nav { display: none; } .lang-switch { margin-left: auto; } }
@media (max-width: 760px) {
  :root { --header-h: 64px; }
  .site-header { position: static; }
  .header-inner { gap: 8px; }
  .logo img { width: 104px; }
  .header-cta { min-height: 40px; padding: 0 14px; font-size: .875rem; box-shadow: none; }
}
@media (max-width: 400px) { .lang-switch { padding: 0 8px; } .logo img { width: 96px; } .header-cta { padding: 0 12px; } }

/* Estructura: banda hero a todo el ancho y debajo dos columnas (índice + cuerpo) */
main.guide-main { padding: 0 0 clamp(64px, 8vw, 96px); }
.guide-main .guide-wrap { max-width: 1240px; }
/* Fondo mesh: focos con los colores de la home (cian #04BEFD, azul #0153FD) y un toque violeta, con el color fuerte fuera
   de la zona del byline y la fecha (franja superior, detrás del H1 y lado derecho); termina en --soft hacia la tarjeta blanca */
.guide-hero { padding-block: clamp(36px, 6vw, 72px) calc(clamp(36px, 6vw, 64px) + 28px); background:
  linear-gradient(180deg, rgba(246, 249, 252, 0) 55%, var(--soft) 100%),
  radial-gradient(45% 260px at 0% 0%, rgba(4, 190, 253, .42), rgba(4, 190, 253, 0) 100%),
  radial-gradient(26% 240px at 74% 0%, rgba(124, 92, 255, .34), rgba(124, 92, 255, 0) 100%),
  radial-gradient(30% 80% at 100% 20%, rgba(1, 83, 253, .4), rgba(1, 83, 253, 0) 100%),
  radial-gradient(22% 50% at 100% 85%, rgba(4, 190, 253, .3), rgba(4, 190, 253, 0) 100%),
  linear-gradient(180deg, #EEF5FE, var(--soft)); }
/* Por debajo de 1100px el byline llega al lado derecho: el color se queda en la franja de la pill y la esquina superior derecha */
@media (max-width: 1099px) {
  .guide-hero { background:
    linear-gradient(180deg, rgba(246, 249, 252, 0) 55%, var(--soft) 100%),
    radial-gradient(75% 190px at 0% 0%, rgba(4, 190, 253, .42), rgba(4, 190, 253, 0) 100%),
    radial-gradient(45% 170px at 68% 0%, rgba(124, 92, 255, .34), rgba(124, 92, 255, 0) 100%),
    radial-gradient(50% 210px at 100% 0%, rgba(1, 83, 253, .4), rgba(1, 83, 253, 0) 100%),
    linear-gradient(180deg, #EEF5FE, var(--soft)); }
}
.guide-pill { display: inline-block; margin: 0 0 16px; padding: 4px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg); color: var(--blue); font-size: .8125rem; font-weight: 700; line-height: 1.5; }
.guide-hero h1 { max-width: 48rem; margin: 0; font-size: clamp(2.125rem, 1.55rem + 2.2vw, 3rem); line-height: 1.12; letter-spacing: -.024em; text-wrap: balance; }
.guide-hero .byline { max-width: 52rem; margin: 20px 0 0; color: var(--text-2); font-size: .9375rem; line-height: 1.6; }
.guide-hero .byline a { font-weight: 600; }
.hero-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 20px; margin: 8px 0 0; color: var(--text-2); font-size: .9375rem; }
.hero-meta p, .guide-hero .updated { margin: 0; color: var(--text-2); font-size: inherit; }
.guide-hero time { white-space: nowrap; }
.hero-meta .reading { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.reading-icon { flex: none; width: 16px; height: 16px; }
.guide-layout { position: relative; margin-top: -28px; padding-top: clamp(32px, 4vw, 48px); border-radius: 28px 28px 0 0; background: var(--bg); }
.guide-grid { display: grid; grid-template-columns: minmax(0, 1fr); }
.guide-body { min-width: 0; font-size: 1.0625rem; line-height: 1.75; }
.guide-aside { min-width: 0; }

/* Índice: arriba y plegado en móvil y tableta; columna lateral fija y desplegada en escritorio */
.toc { margin: 24px 0 8px; }
.toc details { border: 1px solid var(--border); border-radius: 14px; background: var(--soft); }
.toc summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 0 18px; color: var(--navy); font-size: .9375rem; font-weight: 700; cursor: pointer; list-style: none; border-radius: 14px; }
.toc summary::-webkit-details-marker { display: none; }
.toc summary::after { content: ""; flex: none; width: 8px; height: 8px; margin-top: -4px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform .2s ease; }
.toc details[open] summary::after { margin-top: 4px; transform: rotate(-135deg); }
.toc ol { margin: 0; padding: 0 10px 14px; list-style: none; }
.toc li { margin: 0; }
.toc a { display: block; padding: 7px 10px 7px 12px; border-left: 2px solid transparent; border-radius: 0 8px 8px 0; color: var(--text-2); font-size: .875rem; line-height: 1.4; text-decoration: none; }
.toc a:hover { color: var(--navy); background: var(--bg); }
.toc a[aria-current="location"] { border-left-color: var(--blue); color: var(--navy); font-weight: 700; background: var(--bg); }
.aside-cta { display: none; margin: 16px 0 0; }
.aside-cta .btn { width: 100%; }

@media (min-width: 1024px) {
  .guide-grid { grid-template-columns: clamp(220px, 23vw, 296px) minmax(0, 720px); grid-template-rows: auto 1fr; column-gap: clamp(40px, 5vw, 72px); }
  .guide-grid > .answer { grid-column: 2; grid-row: 1; }
  .guide-aside { grid-column: 1; grid-row: 1 / span 2; }
  .guide-body { grid-column: 2; grid-row: 2; font-size: 1.125rem; }
  .guide-aside-inner { position: sticky; top: calc(var(--header-h) + 24px); max-height: calc(100vh - var(--header-h) - 48px); overflow-y: auto; }
  .toc { margin: 0; }
  .toc summary { min-height: 0; padding: 18px 20px 10px; cursor: default; pointer-events: none; }
  .toc summary::after { display: none; }
  /* Desplegado desde el primer pintado aunque el HTML lo traiga cerrado (sin JS ni salto); guia.js pone además open */
  .toc details::details-content { content-visibility: visible; display: block; }
  .aside-cta { display: block; }
}

/* Anclas: que la cabecera fija no tape el título (en móvil la cabecera no es fija) */
.guide-main [id] { scroll-margin-top: calc(var(--header-h) + 24px); }
@media (max-width: 760px) { .guide-main [id] { scroll-margin-top: 16px; } }

/* Cuerpo de lectura */
.guide-body > p, .guide-body > ul > li, .guide-body > ol > li { color: var(--body-text); }
.guide-body > p { margin: 0 0 1.15em; }
.guide-body > ul, .guide-body > ol { margin: 0 0 1.15em; padding-left: 1.4em; }
.guide-body li { margin-bottom: .5em; }
.guide-body li::marker { color: var(--blue); }
.guide-body h2 { margin: 64px 0 16px; font-size: clamp(1.5rem, 1.3rem + .8vw, 1.875rem); line-height: 1.25; letter-spacing: -.015em; text-wrap: balance; }
.guide-body h3 { margin: 40px 0 10px; font-size: 1.25rem; line-height: 1.35; letter-spacing: -.01em; }
.guide-body h2 + h3 { margin-top: 24px; }
.guide-body ol { padding-left: 1.4em; }
.guide-body table { line-height: 1.5; }
caption { caption-side: top; text-align: left; padding: 0 0 10px; font-size: .875rem; line-height: 1.5; color: var(--text-2); }
tbody th { background: none; }
td small { display: block; font-size: .8125rem; }
.guide-body .table-wrap { margin: 20px 0 16px; }
.guide-main .table-note { color: var(--text-2); font-size: .875rem; line-height: 1.6; }
.guide-main .scroll-hint { display: none; margin: 0 0 6px; color: var(--text-2); font-size: .8125rem; }

/* Respuesta corta */
.answer { padding: 22px 26px; border: 1px solid var(--border); border-left: 4px solid var(--blue); border-radius: 14px; background: var(--soft); }
.guide-main .answer h2 { margin: 0 0 8px; font-size: .9375rem; line-height: 1.4; color: var(--blue); letter-spacing: 0; }
.answer p { margin: 0; color: var(--navy); font-size: 1.125rem; line-height: 1.7; }

/* CTA final, autores y fuentes */
.cta-box { margin-top: 64px; padding: 28px 32px; border: 1px solid var(--border); border-radius: 18px; background: var(--soft); }
.guide-body .cta-box h2 { margin: 0 0 8px; font-size: 1.25rem; }
.cta-box p { margin: 0 0 16px; font-size: 1rem; line-height: 1.65; }
.cta-box .cta-alt { margin: 16px 0 0; font-size: .9375rem; }
.cta-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 22px; border-radius: 12px; background: var(--blue); color: #fff; font-weight: 700; line-height: 1.2; text-decoration: none; }
.cta-btn:hover { background: var(--blue-deep); }
.authors { margin-top: 48px; }
.author { display: flex; gap: 16px; align-items: flex-start; margin: 0 0 20px; }
.author img { flex: none; width: 64px; height: 64px; border-radius: 50%; object-fit: cover; }
.guide-body .author h3 { margin: 0 0 2px; font-size: 1rem; }
.author p, .authors > p { margin: 0; font-size: .9375rem; line-height: 1.65; }
/* Números de dos cifras dentro de la columna: el marcador ocupa el sangrado y no sobresale */
.sources ol { margin: 0; padding-left: 2em; font-size: .9375rem; }
.sources li { font-size: .9375rem; line-height: 1.6; }
.sources p { font-size: .9375rem; }

/* Guías relacionadas: 3 tarjetas (todo el recuadro es el enlace) y, si hay más, lista compacta debajo */
.related-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin: 20px 0 0; padding: 0; list-style: none; }
.guide-body .related-card { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; margin: 0; padding: 20px; border: 1px solid var(--border); border-radius: 16px; background: var(--bg); color: var(--text-2); font-size: .9375rem; line-height: 1.55; transition: border-color .2s ease, box-shadow .2s ease; }
.related-card:hover { border-color: var(--blue); box-shadow: var(--card-shadow); }
.related-pill { padding: 2px 10px; border-radius: 999px; background: var(--ice); color: var(--navy); font-size: .75rem; font-weight: 700; line-height: 1.6; }
.related-card a { color: var(--navy); font-size: 1.0625rem; font-weight: 700; line-height: 1.35; text-decoration: none; }
.related-card a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.related-card:hover a { color: var(--blue); text-decoration: underline; }
.related-card a:focus-visible { outline: none; }
.related-card a:focus-visible::after { outline: 3px solid var(--blue); outline-offset: 3px; }
.related-desc { display: block; }
.related-desc::first-letter { text-transform: uppercase; }
.related-sep { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.related-more { margin: 20px 0 0; padding-left: 1.2em; font-size: .9375rem; }

@media (max-width: 719px) {
  .guide-main .scroll-hint { display: block; }
}
@media (max-width: 600px) {
  .guide-layout { margin-top: -20px; border-radius: 20px 20px 0 0; }
  .guide-hero { padding-bottom: calc(36px + 20px); }
  .guide-body h2 { margin-top: 48px; }
  .answer { padding: 18px 20px; }
  .answer p { font-size: 1.0625rem; }
  .cta-box { padding: 24px 20px; }
}
@media print {
  .site-header, .guide-aside, .cta-box, .scroll-hint { display: none !important; }
  .guide-hero { padding: 0 0 16px; background: none; }
  .guide-layout { margin: 0; padding: 0; }
  .related-card { break-inside: avoid; }
}
