/* =========================================================
   Blog: listado (blog.html) y lectura (articulo.html).
   Hereda tokens, menú, botones y pie de página del sitio.
   Cada publicación lleva el color de su norma (--c):
   9001 azul, 14001 verde, 45001 naranja; el resto, petróleo.
   ========================================================= */
.bpage { background: var(--paper); caret-color: var(--brand-ink); }
.bpage ::selection { background: var(--brand); color: var(--white); }
html:has(.bpage) { scrollbar-color: #8f9a9c var(--paper); }

/* ---------- Banda oscura de cabecera (debajo del menú fijo) ---------- */
.bhead, .ahead { position: relative; overflow: hidden; isolation: isolate; background: var(--ink); color: var(--white); }
.bhead { padding: calc(82px + clamp(36px, 6vw, 72px)) 0 clamp(44px, 6vw, 76px); }
.bhead h1 { font-size: clamp(3.4rem, 9vw, 6rem); font-weight: 400; line-height: .95; }
.bhead p { margin: 18px 0 0; max-width: 46ch; color: var(--muted-dark); font-size: clamp(1rem, 1.5vw, 1.15rem); }
/* Isotipo en marca de agua, como en el portal de validación */
.bhead__mark {
  position: absolute; z-index: -1; right: max(16px, calc(50% - 600px)); top: calc(82px + 4px);
  width: clamp(170px, 19vw, 260px); height: auto; aspect-ratio: 1;
  --logo-fill: rgba(255,255,255,.045); pointer-events: none;
}

/* ---------- Listado ---------- */
.bmain { padding-bottom: clamp(72px, 10vw, 120px); }
.btools {
  display: flex; align-items: center; justify-content: space-between; gap: 14px 24px; flex-wrap: wrap;
  margin-top: clamp(28px, 4vw, 40px); scroll-margin-top: 100px;
}
/* Categorías: la píldora blanca se desliza como el indicador del menú */
.btabs { position: relative; display: inline-flex; gap: 2px; padding: 5px; border-radius: 999px; background: var(--paper-2); }
.btabs__pill {
  position: absolute; left: 0; top: 5px; bottom: 5px; width: 0; border-radius: 999px;
  background: var(--white); box-shadow: 0 1px 2px rgba(13,18,20,.08), 0 6px 16px -8px rgba(13,18,20,.3);
}
.btabs.is-ready .btabs__pill { transition: transform .45s var(--spring), width .45s var(--spring); }
.btabs button {
  position: relative; z-index: 1; height: 40px; padding: 0 18px; border: 0; border-radius: 999px; background: none;
  color: var(--muted); font-size: .92rem; font-weight: 600; white-space: nowrap; transition: color .25s;
}
.btabs button:hover, .btabs button[aria-pressed="true"] { color: var(--ink); }

.bsearch { position: relative; flex: 0 1 340px; }
.bsearch > svg { position: absolute; left: 18px; top: 50%; translate: 0 -50%; width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.bsearch input {
  width: 100%; height: 50px; padding: 0 48px 0 48px; border-radius: 999px; border: 1.5px solid var(--line);
  background: var(--white); font-size: .95rem; -webkit-appearance: none; appearance: none;
  transition: border-color .25s, box-shadow .25s;
}
.bsearch input::placeholder { color: #6b7578; }
.bsearch input::-webkit-search-cancel-button { display: none; }
.bsearch input:hover { border-color: rgba(13,18,20,.24); }
.bsearch input:focus { outline: none; border-color: var(--brand-ink); box-shadow: 0 0 0 4px rgba(30,77,84,.16); }
.bsearch__clear {
  position: absolute; right: 7px; top: 50%; translate: 0 -50%; width: 36px; height: 36px;
  display: grid; place-items: center; border: 0; border-radius: 50%; background: none; color: var(--muted);
  transition: background .2s, color .2s;
}
.bsearch__clear:hover { background: var(--paper); color: var(--ink); }
.bsearch__clear svg { width: 16px; height: 16px; }

.bcount { min-height: 1.6em; margin: 22px 0 0; color: var(--muted); font-size: .9rem; }

/* Filas: portada + texto. La más reciente va destacada */
.bposts { list-style: none; margin: 0; padding: 0; transition: opacity .2s; }
.bposts.is-loading { opacity: .45; }
.bpost {
  position: relative; display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
  gap: clamp(20px, 3.4vw, 48px); align-items: center;
  padding: clamp(24px, 3vw, 36px) 0; border-top: 1px solid var(--line);
}
.bpost:first-child { border-top: 0; }
.bpost--lead { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); padding: 14px 0 clamp(32px, 4vw, 48px); }
.bpost__img {
  aspect-ratio: 1140 / 600; border-radius: var(--radius-sm); overflow: hidden; background: var(--ink-2);
  box-shadow: 0 1px 2px rgba(13,18,20,.08), 0 18px 36px -22px rgba(13,18,20,.5);
}
.bpost--lead .bpost__img { border-radius: var(--radius); }
.bpost__img img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease); }
.bpost:hover .bpost__img img { transform: scale(1.035); }
.bpost__body { min-width: 0; }
.bpost__title { font-size: clamp(1.45rem, 2.2vw, 1.85rem); line-height: 1.15; text-wrap: balance; }
/* La norma del título va en su color (oscurecido para leerse sobre el papel) */
.bnorm { color: color-mix(in srgb, var(--c) 72%, var(--ink)); }
.bpost--lead .bpost__title { font-size: clamp(1.9rem, 3.3vw, 2.75rem); }
.bpost__title a { color: var(--ink); text-decoration: none; transition: color .25s; }
/* Toda la fila es el enlace (un solo enlace por publicación para lectores de pantalla) */
.bpost__title a::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: 18px; }
.bpost:hover .bpost__title a { color: var(--brand-ink); }
.bpost__title a:focus-visible { outline: none; }
.bpost__title a:focus-visible::after { outline: 3px solid var(--brand-ink); outline-offset: 4px; }
.bpost__excerpt {
  margin: 12px 0 0; max-width: 62ch; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
/* Debajo del texto: próxima fecha clave · categoría · fecha de publicación */
.bpost__facts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 16px 0 0; color: var(--muted); font-size: .86rem; }
.bpost__facts > * + *::before { content: "·"; margin-right: 12px; color: rgba(13,18,20,.35); }
.bpost--lead .bpost__facts { font-size: .92rem; }
/* El aro repite el de la línea de tiempo del artículo */
.bpost__due { display: flex; flex-basis: 100%; align-items: flex-start; gap: 8px; font-weight: 600; color: color-mix(in srgb, var(--c) 72%, var(--ink)); }
.bpost__due + *::before { content: none; }
.bpost__due time { white-space: nowrap; }
.bring { flex: none; width: 13px; height: 13px; margin-top: .22em; border-radius: 50%; border: 2.5px solid var(--c); background: var(--white); }
.bpost__more { margin-top: 16px; }
.bpost:hover .bpost__more { background-size: 100% 2px; }
.bpost:hover .bpost__more svg { transform: translateX(4px); }
.bpost mark { background: color-mix(in srgb, var(--brand-light) 40%, transparent); color: inherit; border-radius: 4px; padding: 0 2px; }

/* Silueta de carga */
.sk {
  display: block; height: 14px; margin-top: 12px; border-radius: 8px;
  background: linear-gradient(90deg, var(--paper-2) 30%, #f4f0e7 50%, var(--paper-2) 70%) 0 0 / 300% 100%;
  animation: sk 1.4s linear infinite;
}
.sk:first-child { margin-top: 0; }
.sk--s { width: 30%; }
.sk--t { height: 26px; }
.sk--m { width: 60%; }
.sk--h { width: 92%; height: .78em; margin-top: .26em; border-radius: 12px; }
.sk--dark { background-image: linear-gradient(90deg, rgba(255,255,255,.06) 30%, rgba(255,255,255,.13) 50%, rgba(255,255,255,.06) 70%); }
@keyframes sk { from { background-position: 100% 0; } to { background-position: 0 0; } }
.bpost--skel .bpost__img { background: var(--paper-2); box-shadow: none; }

/* Sin resultados / error */
.bstate {
  margin-top: 8px; padding: clamp(32px, 5vw, 56px) clamp(24px, 4vw, 48px); text-align: center;
  border-radius: var(--radius); background: var(--white); box-shadow: var(--shadow);
}
.bstate h2 { font-size: clamp(1.6rem, 2.6vw, 2.1rem); text-wrap: balance; }
.bstate p { margin: 10px auto 22px; max-width: 46ch; color: var(--muted); }

/* Paginación */
.bpager { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: clamp(32px, 4vw, 48px); }
.bpager button {
  display: inline-grid; place-items: center; min-width: 44px; height: 44px; padding: 0 10px;
  border: 0; border-radius: 999px; background: none; color: var(--ink); font-weight: 600; transition: background .2s;
}
.bpager button:hover:not(:disabled) { background: var(--paper-2); }
.bpager button[aria-current="page"] { background: var(--ink); color: var(--white); }
.bpager button:disabled { opacity: .35; cursor: default; }
.bpager svg { width: 18px; height: 18px; }
.bpager__gap { padding: 0 4px; color: var(--muted); }

/* ---------- Artículo ---------- */
.apage main { padding-bottom: clamp(72px, 10vw, 120px); }
.acol { width: min(720px, 100% - 32px); margin-inline: auto; }
.ahead { padding: calc(82px + clamp(24px, 4vw, 44px)) 0 clamp(150px, 19vw, 240px); }
.ahead__back {
  display: inline-flex; align-items: center; gap: 8px; margin-bottom: clamp(24px, 4vw, 40px);
  color: var(--muted-dark); font-size: .92rem; font-weight: 600; text-decoration: none; transition: color .2s;
}
.ahead__back:hover { color: var(--white); }
.ahead__back svg { width: 16px; height: 16px; transition: transform .3s var(--ease); }
.ahead__back:hover svg { transform: translateX(-4px); }
.ahead h1 { font-size: clamp(2.3rem, 5.2vw, 3.9rem); font-weight: 400; text-wrap: balance; }
/* Sobre la banda oscura la norma se aclara, como el año en las tarjetas de la home */
.ahead h1 .bnorm { color: color-mix(in srgb, var(--c) 62%, var(--white)); }
.ahead__info { display: flex; flex-wrap: wrap; gap: 6px 12px; margin: 22px 0 0; color: var(--muted-dark); font-size: .92rem; }
.ahead__info > * + *::before { content: "·"; margin-right: 12px; opacity: .6; }
.ahead__act { margin-top: 28px; }
.art.is-empty .ahead { padding-bottom: clamp(64px, 9vw, 110px); }
.art.is-empty .art__cover { display: none; }

/* La portada se monta sobre el borde de la banda */
.art__cover {
  position: relative; z-index: 1;
  width: min(1040px, 100% - 32px); margin: calc(-1 * clamp(110px, 15vw, 190px)) auto 0;
  aspect-ratio: 1140 / 600; border-radius: var(--radius); overflow: hidden; background: var(--ink-3);
  /* Filo claro: las portadas son oscuras y sin él se funden con la banda */
  box-shadow: 0 0 0 1px rgba(255,255,255,.1), 0 2px 4px rgba(13,18,20,.1), 0 40px 80px -40px rgba(13,18,20,.55);
}
.art__cover img { width: 100%; height: 100%; object-fit: cover; }

/* Columna de lectura */
.art__body { margin-top: clamp(40px, 6vw, 72px); font-size: 1.07rem; line-height: 1.78; }
.art__body > :first-child { margin-top: 0; }
.art__body p { margin: 0 0 1.15em; }
.art__body h2 { margin: 1.9em 0 .55em; font-size: clamp(1.65rem, 2.6vw, 2.15rem); line-height: 1.15; text-wrap: balance; }
.art__body h3 { margin: 1.6em 0 .5em; font-size: clamp(1.3rem, 2vw, 1.55rem); line-height: 1.2; }
.art__body strong { font-weight: 600; }
.art__body em { color: var(--brand-ink); }
.art__body a { color: var(--brand-ink); text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; transition: text-decoration-thickness .2s; }
.art__body a:hover { text-decoration-thickness: 2.5px; }
.art__body ul, .art__body ol:not(.art__dates) { list-style: none; margin: 0 0 1.4em; padding: 0; }
.art__body ul > li, .art__body ol:not(.art__dates) > li { position: relative; margin-bottom: .55em; padding-left: 28px; }
.art__body ul > li::before { content: ""; position: absolute; left: 6px; top: .74em; width: 7px; height: 7px; border-radius: 50%; background: var(--c, var(--brand)); }
.art__body ol:not(.art__dates) { counter-reset: n; }
.art__body ol:not(.art__dates) > li { counter-increment: n; }
.art__body ol:not(.art__dates) > li::before { content: counter(n) "."; position: absolute; left: 0; font-weight: 700; color: var(--brand-ink); }
.art__body img { height: auto; margin: 1.6em 0; border-radius: var(--radius-sm); }
.art__body blockquote { margin: 1.6em 0; font-family: var(--serif); font-size: 1.4rem; line-height: 1.4; }
.art__body hr { margin: 2.2em 0; border: 0; border-top: 1px solid var(--line); }
.art__table { margin: 1.6em 0; overflow-x: auto; }
.art__body table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.art__body th, .art__body td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }

/* Plazos: las listas que empiezan con fecha se leen como línea de tiempo */
.art__dates {
  list-style: none; margin: 1.4em 0 1.8em; padding: clamp(20px, 3vw, 28px) clamp(20px, 3vw, 32px);
  border-radius: var(--radius-sm); background: var(--white); box-shadow: var(--shadow);
}
.art__dates li { position: relative; padding: 0 0 1.3em 34px; }
.art__dates li:last-child { padding-bottom: 0; }
.art__dates li::before {
  content: ""; position: absolute; z-index: 1; left: 0; top: .3em; width: 16px; height: 16px; border-radius: 50%;
  background: var(--white); border: 3px solid var(--c, var(--brand));
}
.art__dates li::after {
  content: ""; position: absolute; left: 7px; top: calc(.3em + 18px); bottom: 2px; width: 2px; border-radius: 2px;
  background: color-mix(in srgb, var(--c, var(--brand)) 30%, transparent);
}
.art__dates li:last-child::after { display: none; }
.art__date { display: block; margin-bottom: 2px; font-weight: 700; font-variant-numeric: tabular-nums; color: color-mix(in srgb, var(--c, var(--brand)) 62%, var(--ink)); }
.art__dates .is-past .art__date { color: var(--muted); }
.art__dates .is-past::before { border-color: rgba(13,18,20,.25); }

/* Firma ("Atentamente, …") */
.art__sign { margin-top: 2.6em; padding-top: 1.4em; border-top: 1px solid var(--line); font-size: .95rem; line-height: 1.6; color: var(--muted); }
.art__sign p { margin: 0; }
.art__sign p + p { margin-top: .35em; }
.art__sign strong { font-weight: 600; color: var(--ink); }
.art__sign p:first-child strong { font-weight: 500; color: var(--muted); }
.art__source { margin-top: 26px; color: var(--muted); font-size: .85rem; }

/* Cierre: invitación con el marco interior de la placa de acreditación */
.acta { width: min(1040px, 100% - 32px); margin: clamp(56px, 8vw, 96px) auto 0; }
.acta__in {
  position: relative; display: flex; align-items: center; justify-content: space-between; gap: 22px 40px; flex-wrap: wrap;
  padding: clamp(30px, 4vw, 46px) clamp(26px, 4.4vw, 58px); border-radius: var(--radius); background: var(--white); box-shadow: var(--shadow);
}
.acta__in::before { content: ""; position: absolute; inset: 10px; border-radius: 14px; border: 1px solid rgba(13,18,20,.1); pointer-events: none; }
.acta__text { max-width: 56ch; }
.acta h2 { font-size: clamp(1.6rem, 2.8vw, 2.2rem); text-wrap: balance; }
.acta p { margin: 10px 0 0; color: var(--muted); }
.acta .btn { position: relative; }

/* Más publicaciones */
.amore { width: min(1040px, 100% - 32px); margin: clamp(56px, 8vw, 96px) auto 0; }
.amore__head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 10px; }
.amore h2 { font-size: clamp(1.7rem, 3vw, 2.3rem); }
.amore .bpost:first-child { border-top: 1px solid var(--line); }
.bpost--compact { grid-template-columns: 220px minmax(0, 1fr); padding: 22px 0; }
.bpost--compact .bpost__title { font-size: clamp(1.25rem, 1.8vw, 1.5rem); }
.bpost--compact .bpost__more { margin-top: 12px; }
.bpost--compact .bpost__facts { margin-top: 10px; }

/* WhatsApp flotante en la lectura: se aparta al bajar (como el menú) y vuelve al subir */
.apage .fab { transition: transform .45s var(--ease), opacity .3s; }
.apage .fab.is-tucked { transform: translateY(calc(100% + 28px)); opacity: 0; pointer-events: none; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .bhead { padding-top: calc(76px + 32px); }
  .ahead { padding-top: calc(76px + 20px); }
  .bhead__mark { top: calc(76px + 4px); }
}
@media (max-width: 760px) {
  .bpost, .bpost--lead { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .btools { flex-direction: column; align-items: stretch; }
  .btabs { align-self: flex-start; max-width: 100%; overflow-x: auto; }
  .bsearch { flex-basis: auto; }
  .bpost--compact { grid-template-columns: 132px minmax(0, 1fr); gap: 16px; align-items: start; }
  .bpost--compact .bpost__more { display: none; }
  .acta__in { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 520px) {
  .bhead__mark { width: 140px; right: -24px; }
  .art__body { font-size: 1.02rem; }
  .bpost--compact { grid-template-columns: 104px minmax(0, 1fr); }
}
