/* ==========================================================
   Blog — Estudio Jurídico Ríos
   Se carga DESPUÉS de /styles.css y usa sus mismas variables.
   ========================================================== */

:root {
  --ease-out: cubic-bezier(.23, 1, .32, 1); /* entra rápido, asienta suave */
}

/* ---- Entrada de la página: una sola vez, escalonada y corta ---- */
@keyframes blog-in {
  from { opacity: 0; transform: translateY(10px); }
}
.blog-hero-inner > *,
.blog-list .blog-card { animation: blog-in .5s var(--ease-out) backwards; }
.blog-hero-inner > :nth-child(2) { animation-delay: 50ms; }
.blog-hero-inner > :nth-child(3) { animation-delay: 100ms; }
.blog-hero-inner > :nth-child(4) { animation-delay: 150ms; }
.blog-hero-inner > :nth-child(5) { animation-delay: 200ms; }
.blog-list .blog-card:nth-child(1) { animation-delay: 120ms; }
.blog-list .blog-card:nth-child(2) { animation-delay: 170ms; }
.blog-list .blog-card:nth-child(3) { animation-delay: 220ms; }
.blog-list .blog-card:nth-child(4) { animation-delay: 270ms; }

/* ---- Hero del blog y de cada nota ---- */
.blog-hero { padding-bottom: 72px; border-bottom: 1px solid var(--line); }
.blog-hero-inner { position: relative; z-index: 2; }
.blog-hero-inner > * { max-width: 860px; }
.blog-hero h1 { font-size: clamp(36px, 4.2vw, 56px); margin-bottom: 24px; }
.blog-hero:has(.blog-breadcrumb) h1 { font-size: clamp(32px, 3.6vw, 48px); line-height: 1.12; } /* títulos de nota: largos */
.blog-hero .hero-lead { max-width: 720px; text-wrap: pretty; }

.blog-breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 26px; color: var(--muted); font-size: 12px; font-weight: 600; }
.blog-breadcrumb a { color: var(--wine); text-underline-offset: 3px; }
.blog-breadcrumb a:hover { text-decoration: underline; }
.blog-breadcrumb span[aria-hidden] { color: var(--clay); }

.article-meta { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 30px 0 0; padding-top: 22px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.article-meta strong { color: var(--ink); font-weight: 700; }
.article-meta span + span::before { content: "·"; margin-right: 22px; color: var(--clay); }

/* Temas: etiquetas informativas, no botones (no filtran nada) */
.blog-filters { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 32px; }
.blog-filters span { display: inline-flex; align-items: center; gap: 10px; color: var(--wine); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.blog-filters span::before { content: ""; width: 6px; height: 6px; background: var(--gold); transform: rotate(45deg); }

/* ---- Listado de artículos ---- */
.blog-list { background: var(--cream); padding-top: 80px; }
.blog-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.blog-card { position: relative; display: flex; flex-direction: column; padding: 38px 36px 34px; background: var(--paper); border: 1px solid var(--line); -webkit-tap-highlight-color: transparent; transition: transform .22s var(--ease-out), box-shadow .22s var(--ease-out), border-color .22s var(--ease-out); }
.blog-card::before { content: ""; position: absolute; top: -1px; left: 36px; width: 46px; height: 2px; background: var(--gold); transform-origin: left; transition: transform .4s var(--ease-out); }
.blog-card-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 18px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; font-variant-numeric: tabular-nums; }
.blog-card-meta span { color: var(--wine); font-weight: 800; }
.blog-card h2, .blog-card h3 { margin: 0 0 14px; font: 650 23px/1.25 var(--sans); letter-spacing: -.02em; text-wrap: balance; }
.blog-card h2 a::after, .blog-card h3 a::after { content: ""; position: absolute; inset: 0; } /* toda la tarjeta clickeable */
.blog-card > p:not(.blog-card-meta) { flex: 1; color: var(--muted); font-size: 14px; margin-bottom: 26px; text-wrap: pretty; }
.blog-card-link { display: inline-flex; align-items: center; gap: 10px; color: var(--wine); font-size: 13px; font-weight: 700; }
.blog-card-link span { transition: transform .25s var(--ease-out); }
.blog-card:has(a:focus-visible) { outline: 3px solid var(--focus); outline-offset: 3px; } /* el ::after estira el link, el aro va en la tarjeta */
.blog-card a:focus-visible { outline: 0; }

/* ---- Cuerpo de la nota ---- */
.article-section { padding: 80px 0 40px; background: var(--paper); }
.article-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 80px; align-items: start; }
.article-body { max-width: 700px; font-size: 17px; line-height: 1.8; text-wrap: pretty; }
.article-body h2 { margin: 56px 0 18px; font-size: clamp(26px, 2.4vw, 32px); letter-spacing: -.025em; }
.article-body h2::before { content: ""; display: block; width: 32px; height: 2px; margin-bottom: 18px; background: var(--gold); } /* mismo trazo dorado que las tarjetas */
.article-body h2:first-child { margin-top: 0; }
.article-body p { color: #3d3833; margin-bottom: 20px; }
.article-body strong { color: var(--ink); }
.article-body a { color: var(--wine); font-weight: 700; text-decoration: underline; text-decoration-thickness: 1px; text-decoration-color: rgba(82,37,29,.35); text-underline-offset: 4px; transition: text-decoration-color .2s, text-decoration-thickness .2s; }
.article-body a:hover { text-decoration-color: currentColor; text-decoration-thickness: 2px; }
.article-body .check-list { margin: 4px 0 26px; }
.article-body .check-list li { font-size: 16px; }
.article-disclaimer { margin-top: 48px !important; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted) !important; font-size: 13px; font-style: italic; }

.article-aside { position: sticky; top: 120px; }
.article-aside-card { padding: 32px 28px; color: #fff; background: linear-gradient(150deg, #4b1c11, #78301d); box-shadow: var(--shadow); }
.article-aside-card .eyebrow { margin-bottom: 16px; font-size: 11px; }
.article-aside-title { margin-bottom: 10px; font-size: 21px; font-weight: 650; line-height: 1.25; letter-spacing: -.02em; text-wrap: balance; }
.article-aside-card > p:not(.eyebrow):not(.article-aside-title) { color: rgba(255,255,255,.7); font-size: 14px; margin-bottom: 24px; }
.article-aside-link { display: flex; justify-content: center; gap: 10px; margin-top: 18px; color: rgba(255,255,255,.82); font-size: 13px; font-weight: 700; transition: color .2s; }
.article-aside-link span { transition: transform .25s var(--ease-out); }
.article-aside-link:hover { color: #fff; }

/* ---- CTA y relacionados ---- */
.article-cta { padding: 20px 0 60px; background: var(--paper); }
.article-cta-index { padding: 0 0 100px; background: var(--cream); }
.blog-related { background: var(--cream); border-top: 1px solid var(--line); }
.blog-related h2 { margin-bottom: 44px; }
.blog-grid-related { grid-template-columns: repeat(3, 1fr); }
.blog-grid-related .blog-card { padding: 32px 28px 28px; }
.blog-grid-related .blog-card::before { left: 28px; }
.blog-grid-related .blog-card h3 { font-size: 19px; }

/* Hover solo con cursor: en táctil dispara al tocar y queda pegado */
@media (hover: hover) and (pointer: fine) {
  .blog-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: rgba(111,43,24,.25); }
  .blog-card:hover::before { transform: scaleX(1.7); }
  .blog-card:hover .blog-card-link span,
  .article-aside-link:hover span { transform: translateX(5px); }
}

/* Presión: la tarjeta confirma el toque (va después del hover para ganarle) */
.blog-card:active { transform: scale(.985); box-shadow: none; transition-duration: .12s; }

@media (max-width: 960px) {
  .article-layout { grid-template-columns: 1fr; gap: 50px; }
  .article-aside { position: static; max-width: 520px; }
  .blog-grid-related { grid-template-columns: 1fr 1fr; }
  .article-cta:not(.article-cta-index) { display: none; } /* en mobile ya está la tarjeta de consulta */
}

@media (max-width: 680px) {
  .blog-hero { padding-bottom: 52px; }
  .blog-hero h1 { font-size: 34px; }
  .blog-hero:has(.blog-breadcrumb) h1 { font-size: 30px; }
  .article-meta { flex-direction: column; gap: 6px; }
  .article-meta span + span::before { display: none; }
  .blog-list { padding-top: 56px; }
  .blog-grid, .blog-grid-related { grid-template-columns: 1fr; }
  .blog-card { padding: 30px 24px 26px; }
  .blog-card::before { left: 24px; }
  .article-section { padding-top: 56px; }
  .article-body { font-size: 16px; }
  .article-body h2 { margin-top: 44px; }
  .article-cta-index { padding-bottom: 70px; }
}

@media (prefers-reduced-motion: reduce) {
  .blog-hero-inner > *, .blog-list .blog-card { animation: none; }
  .blog-card, .blog-card::before, .blog-card-link span, .article-aside-link span { transition: none; }
  .blog-card:hover, .blog-card:active { transform: none; }
}
