/* ============================================================
   uii.css — Sistema de diseño editorial flat (blog redacta +)
   Un solo CSS para: portada (index) + artículo (articulo)
   ============================================================ */

/* ---------- 1. Tokens ---------- */
:root {
  /* Color */
  --ink: #10161c;
  --ink-soft: #414d59;
  --ink-mute: #6d7a87;
  --line: #e3e7ea;
  --surface: #ffffff;
  --surface-alt: #f4f5f2;
  --surface-dark: #10161c;
  --brand: #9B0F10;
  --brand-soft: #f2d4d4;
  --accent: #7a0c0d;

  /* Tipografía */
  --font-title: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;

  --step--1: clamp(0.78rem, 0.76rem + 0.1vw, 0.85rem);
  --step-0: clamp(1rem, 0.97rem + 0.16vw, 1.09rem);
  --step-1: clamp(1.2rem, 1.12rem + 0.4vw, 1.45rem);
  --step-2: clamp(1.5rem, 1.32rem + 0.9vw, 2.1rem);
  --step-3: clamp(2rem, 1.6rem + 2vw, 3.2rem);
  --step-4: clamp(2.4rem, 1.7rem + 3.4vw, 4.6rem);

  /* Espacio y forma */
  --gap: 1.5rem;
  --pad-block: clamp(2.5rem, 6vw, 5rem);
  --radius: 4px;
  --maxw: 1240px;
  --measure: 68ch;
}

/* ---------- 2. Reset ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }

h1, h2, h3, h4 {
  font-family: var(--font-title);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.015em;
  margin: 0;
}

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

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 99;
  background: var(--ink); color: #fff; padding: 0.75rem 1rem;
}
.skip-link:focus { left: 0; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- 3. Layout ---------- */
.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2.5rem);
}
.wrap--narrow { max-width: 780px; }
.section { padding-block: var(--pad-block); }
.stack > * + * { margin-top: var(--gap); }

/* ---------- 4. Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  min-height: 68px;
}
.brand {
  display: inline-flex; align-items: center; gap: 0.6rem;
  min-width: 0; font-weight: 700; letter-spacing: -0.02em;
}
.brand__mark {
  width: 30px; height: 30px; flex: 0 0 auto;
  background: var(--brand); color: #fff; border-radius: var(--radius);
  display: grid; place-items: center; font-size: 0.85rem; font-weight: 700;
}
.brand__name { font-size: 1.05rem; }
.brand__name span { color: var(--brand); }

.nav { display: none; gap: 1.6rem; font-size: var(--step--1); }
.nav a { color: var(--ink-soft); letter-spacing: 0.02em; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); }
@media (min-width: 900px) {
  .nav { display: flex; }
  .site-header__inner { grid-template-columns: auto minmax(0, 1fr) auto; }
}

/* Header transparente sobre el hero (portada) */
.site-header--overlay {
  position: absolute; top: 0; left: 0; right: 0; z-index: 50;
  background: transparent; border-bottom: 0; backdrop-filter: none;
}
.site-header--overlay .site-header__inner {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  min-height: 0;
  padding-block: clamp(0.9rem, 2.5vw, 1.5rem);
}
.brand__logo {
  width: clamp(160px, 22vw, 240px); height: auto; display: block;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.25));
}
.site-header__actions { display: flex; align-items: center; gap: 0.5rem; }
.btn--icon-light {
  background: var(--brand); color: #fff;
  border: 1px solid var(--brand);
}
.btn--icon-light:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
@media (max-width: 820px) {
  .site-header__actions .btn--icon { width: 36px; height: 36px; }
}

/* ---------- 5. Botones y chips ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.7rem 1.15rem;
  border: 1px solid var(--ink);
  background: var(--ink); color: #fff;
  border-radius: 999px;
  font-size: var(--step--1); font-weight: 600; letter-spacing: 0.01em;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn:hover { background: var(--brand); border-color: var(--brand); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn--brand { background: var(--brand); border-color: var(--brand); }
.btn--brand:hover { background: var(--ink); border-color: var(--ink); }
.btn--sm { padding: 0.45rem 0.85rem; }
.btn--icon { padding: 0.5rem; width: 38px; height: 38px; justify-content: center; }

.chip {
  display: inline-block;
  font-size: 0.72rem; font-weight: 700;
  letter-spacing: 0.09em; text-transform: uppercase;
  padding: 0.32rem 0.7rem;
  border-radius: 999px;
  background: var(--brand-soft); color: var(--brand);
}
.chip--light { background: rgba(255,255,255,0.14); color: #fff; }

.meta {
  font-size: var(--step--1);
  color: var(--ink-mute);
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem;
}
.meta__dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; }

/* ---------- 6. Filtros de sección ---------- */
.filters {
  display: flex; gap: 0.5rem; overflow-x: auto;
  padding-block: 0.25rem; scrollbar-width: none;
  border-bottom: 1px solid var(--line);
}
.filters::-webkit-scrollbar { display: none; }
.filters__btn {
  flex: 0 0 auto;
  padding: 0.6rem 0.9rem;
  font-size: var(--step--1); font-weight: 600; color: var(--ink-mute);
  background: transparent; border: 0; border-bottom: 2px solid transparent;
  cursor: pointer;
}
.filters__btn.is-active, .filters__btn:hover {
  color: var(--ink); border-bottom-color: var(--brand);
}
.card.is-hidden { display: none !important; }

/* ---------- 7. Hero destacado (listado) ---------- */
.hero { border-bottom: 1px solid var(--line); }
.hero__grid {
  display: grid; gap: clamp(1.5rem, 4vw, 3rem);
  align-items: center;
  padding-block: var(--pad-block);
}
@media (min-width: 900px) { .hero__grid { grid-template-columns: 1.05fr 1fr; } }
.hero__title { font-size: var(--step-4); }
.hero__sub { color: var(--ink-soft); max-width: 52ch; font-size: var(--step-1); }
.hero__media { position: relative; }
.hero__media img { aspect-ratio: 4/3; object-fit: cover; border-radius: var(--radius); }
.hero__actions { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }

/* ---------- 8. Grid de artículos ---------- */
.grid {
  display: grid; gap: clamp(1.5rem, 3vw, 2.5rem);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr));
}

.card { display: flex; flex-direction: column; min-width: 0; }
.card__media {
  position: relative; overflow: hidden;
  border-radius: var(--radius); background: var(--surface-alt);
}
.card__media img {
  aspect-ratio: 16/10; object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.card:hover .card__media img { transform: scale(1.04); }
.card__chip { position: absolute; left: 0.75rem; top: 0.75rem; }
.card__body { padding-top: 1rem; display: flex; flex-direction: column; gap: 0.55rem; flex: 1; }
.card__kicker {
  font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-mute); font-weight: 600;
}
.card__title { font-size: var(--step-1); }
.card__title a:hover { text-decoration: underline; text-underline-offset: 3px; }
.card__excerpt { color: var(--ink-soft); font-size: 0.95rem; margin: 0; }
.card__footer {
  margin-top: auto; padding-top: 0.9rem;
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  align-items: center; gap: 0.75rem;
  border-top: 1px solid var(--line);
}
.card__author { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.card__avatar {
  width: 30px; height: 30px; flex: 0 0 auto; border-radius: 50%;
  background: var(--surface-alt); display: grid; place-items: center;
  font-size: 0.72rem; font-weight: 700; color: var(--ink-soft);
}
.card__author-name {
  font-size: var(--step--1); color: var(--ink-soft);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card__actions { display: flex; gap: 0.4rem; flex: 0 0 auto; }

/* Tarjeta ancha (primer item de la lista) */
@media (min-width: 800px) {
  .card--wide { grid-column: span 2; flex-direction: row; gap: 1.75rem; align-items: center; }
  .card--wide .card__media { flex: 0 0 46%; }
  .card--wide .card__media img { aspect-ratio: 4/3; }
  .card--wide .card__title { font-size: var(--step-2); }
  .card--wide .card__body { padding-top: 0; }
}

/* ---------- 9. Publicidad ---------- */
.ad {
  display: grid; place-items: center; text-align: center;
  gap: 0.4rem; padding: clamp(1.5rem, 4vw, 2.25rem);
  background: var(--surface-alt);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}
.ad__label {
  font-size: 0.66rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink-mute);
}
.ad__text { font-family: var(--font-title); font-size: var(--step-1); }
.ad--inline { margin-block: clamp(2rem, 5vw, 3rem); }
.ad--dark { background: var(--surface-dark); color: #fff; border-color: transparent; }
.ad--dark .ad__label { color: rgba(255,255,255,0.6); }

/* ---------- 10. Artículo ---------- */
.article-hero {
  position: relative;
  width: 100%;
  min-height: clamp(320px, 58vh, 620px);
  display: grid; align-items: end;
  background: var(--surface-dark);
  overflow: hidden;
}
.article-hero__img {
  position: absolute; inset: 0; z-index: 0;
  width: 100%; height: 100%; object-fit: cover;
}
.article-hero::after {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(to bottom, rgba(0,0,0,0.40) 0%, rgba(0,0,0,0.05) 100%);
}
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(to bottom, rgba(0,0,0,0.40) 0%, rgba(0,0,0,0.05) 100%);
}
.hero { position: relative; overflow: hidden; background: var(--surface-dark); height: 600px; display: grid; align-items: stretch; }
.hero .hero__grid, .hero__media, .hero__media img { position: relative; z-index: 2; }
.hero__bg { position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; object-fit: cover; }
.hero__slider { position: relative; height: 680px; }
.hero__slides { height: 100%; }
.hero__opacidad { height: 100%; background: linear-gradient(to bottom, rgba(0,0,0,0.40) 0%, rgba(0,0,0,0.05) 100%); position: absolute; inset: 0; z-index: 1; }
.article-hero__opacidad { height: 100%; background: linear-gradient(to bottom, rgba(0,0,0,0.40) 0%, rgba(0,0,0,0.05) 100%); position: absolute; inset: 0; z-index: 1; }
.hero__slide { display: none; height: 600px; position: relative; }
.hero__slide.is-active { display: grid; align-items: start; height: 600px; }
.hero__slider .stack { color: #fff; max-width: none; width: 65%; }
.hero__slider .hero__title { color: #fff; max-width: none; font-size: clamp(2.25rem, 1.7rem + 2vw, 3.65rem); line-height: 1.04; }
.hero__slider .hero__sub { color: rgba(255,255,255,.88); max-width: none; font-size: clamp(0.95rem, 0.92rem + 0.22vw, 1.12rem); line-height: 1.5; }
.hero__slider .meta { color: rgba(255,255,255,.78); font-size: 0.82rem; }
.hero__slider .hero__grid { padding-block: clamp(2rem, 6vw, 4rem); width: 100%; grid-template-columns: 1fr; }
.site-header--overlay + main .hero__slider .hero__grid { padding-top: clamp(7rem, 14vw, 10rem); }
.hero__slider .btn--ghost { background: transparent; color: #fff; border-color: #fff; }
.hero__slider .btn--ghost:hover { background: var(--brand); color: #fff; border-color: var(--brand); }
.hero__slider .hero__actions > .btn { color: #fff; }
.hero__slider .hero__actions > .btn:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
.hero__dots { display: flex; gap: .5rem; justify-content: center; padding: 0; position: relative; z-index: 2; }
.hero__dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(0,0,0,.18); border: 0; padding: 0; }
.hero__dot.is-active { background: var(--brand); }
.hero__slider .hero__dots { display: none; }
.article-hero__inner {
  position: relative; z-index: 2;
  color: #fff;
  padding-block: clamp(2rem, 6vw, 4rem);
  display: grid; gap: 1rem;
}
.article-hero__title { font-size: var(--step-4); max-width: 20ch; }
.article-hero__sub {
  font-size: var(--step-1); max-width: 60ch;
  color: rgba(255,255,255,0.86); margin: 0;
}

.byline {
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  align-items: center; gap: 1rem;
  padding-block: 1.25rem;
  border-bottom: 1px solid var(--line);
}
.byline__who { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
.byline__avatar {
  width: 44px; height: 44px; flex: 0 0 auto; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand);
  display: grid; place-items: center; font-weight: 700;
}
.byline__name { font-weight: 600; }
.byline__share { display: flex; gap: 0.4rem; flex: 0 0 auto; }

.prose { max-width: var(--measure); margin-inline: auto; }
.prose p { margin: 0 0 1.4em; color: var(--ink-soft); }
.prose p.lead {
  font-size: var(--step-1); color: var(--ink);
  line-height: 1.55;
}
.prose h2 {
  font-size: var(--step-2);
  margin: 2.2em 0 0.6em;
}
.prose h3 { font-size: var(--step-1); margin: 1.8em 0 0.5em; }
.prose a { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.prose ul { padding-left: 1.1rem; color: var(--ink-soft); margin: 0 0 1.4em; }
.prose li + li { margin-top: 0.4rem; }
.prose blockquote {
  margin: 2rem 0; padding-left: 1.25rem;
  border-left: 3px solid var(--brand);
  font-family: var(--font-title); font-size: var(--step-2);
  line-height: 1.25; color: var(--ink);
}

figure { margin: clamp(2rem, 5vw, 3rem) 0; }
figure img { border-radius: var(--radius); width: 100%; }
figcaption {
  margin-top: 0.6rem; font-size: var(--step--1); color: var(--ink-mute);
}
.figure--wide { max-width: 1000px; margin-inline: auto; }

.article-footer {
  max-width: var(--measure); margin-inline: auto;
  padding-top: 2rem; border-top: 1px solid var(--line);
  display: grid; gap: 1rem;
}
.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* Barra de progreso de lectura */
.progress {
  position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 60;
  background: transparent;
}
.progress__bar { height: 100%; width: 0; background: var(--brand); }

/* ---------- 11. Newsletter ---------- */
.cta {
  background: var(--surface-dark); color: #fff;
  border-radius: var(--radius);
  padding: clamp(1.75rem, 5vw, 3rem);
  display: grid; gap: 1.25rem;
}
@media (min-width: 860px) {
  .cta { grid-template-columns: 1.1fr 1fr; align-items: center; gap: 2.5rem; }
}
.cta h2 { font-size: var(--step-2); }
.cta p { color: rgba(255,255,255,0.72); margin: 0.5rem 0 0; }
.cta__form { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.cta__form input {
  flex: 1 1 220px; min-width: 0;
  padding: 0.8rem 1rem; border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.06); color: #fff;
  font: inherit; font-size: var(--step--1);
}
.cta__form input::placeholder { color: rgba(255,255,255,0.5); }
.cta__form .btn { background: #fff; color: var(--ink); border-color: #fff; }
.cta__form .btn:hover { background: var(--brand-soft); border-color: var(--brand-soft); }

/* ---------- 12. Footer ---------- */
.site-footer {
  background: var(--surface-dark); color: rgba(255,255,255,0.72);
  margin-top: var(--pad-block);
  padding-block: clamp(2.5rem, 6vw, 4rem);
  font-size: var(--step--1);
}
.site-footer a { color: rgba(255,255,255,0.72); }
.site-footer a:hover { color: #fff; }
.footer-brand .brand__logo { width: clamp(150px, 20vw, 220px); }
.site-footer h3 {
  font-family: var(--font-body); font-size: var(--step--1);
  letter-spacing: 0.12em; text-transform: uppercase;
  color: #fff; margin-bottom: 0.9rem; font-weight: 700;
}
.footer-grid {
  display: grid;
  gap: clamp(1.5rem, 4vw, 3rem);
  grid-template-columns: 2fr 1.5fr 1.5fr;
}
@media (max-width: 820px) {
  .footer-grid { grid-template-columns: 1fr; }
}
.footer-col--brand { max-width: 46ch; }
.footer-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.5rem; }
.footer-list--num { counter-reset: footer; }
.footer-list--num li { counter-increment: footer; display: flex; gap: 0.5rem; align-items: baseline; }
.footer-list--num li::before { content: counter(footer); font-weight: 700; color: var(--brand); }
.footer-bottom {
  margin-top: 2.5rem; padding-top: 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.14);
  display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between;
  color: rgba(255,255,255,0.55);
}

/* ---------- 13. Utilidades ---------- */
.section-head {
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  align-items: end; gap: 1rem; margin-bottom: 2rem;
}
.section-head h2 { font-size: var(--step-2); }
.section-head p { margin: 0.35rem 0 0; color: var(--ink-mute); }

.divider { height: 1px; background: var(--line); border: 0; margin: 0; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

@media print {
  .site-header, .site-footer, .ad, .byline__share, .progress { display: none !important; }
  body { color: #000; }
}
