/* ==========================================================================
   INGEFULLER — BLOG DESIGN SYSTEM
   --------------------------------------------------------------------------
   Hoja única de la sección /blog/. Se carga DESPUÉS de components1.css
   (header + footer compartidos) y no pisa ninguno de sus selectores.

   Todos los tokens van namespaced con --if-* para no colisionar con las
   variables globales del sitio (--red, --white, --blue, --yellow), que
   siguen funcionando igual en el header y el footer.

   Índice:
     1. Tokens (color, tipografía, espacio, radio, sombra, motion)
     2. Reset y base
     3. Utilidades de layout
     4. Primitivas (botones, chips, badges, inputs, cards)
     5. Secciones
     6. Motion / reveal
     7. Responsive
     8. Modo oscuro
     9. Accesibilidad y preferencias del usuario
   ========================================================================== */

/* ==========================================================================
   1. TOKENS
   ========================================================================== */

:root {
  /* --- Marca -------------------------------------------------------------
     --if-brand es el rojo de marca (#ff0012). Sobre blanco da 4.0:1, que
     NO pasa WCAG AA para texto normal, así que se reserva para fondos y
     display grande. Para texto sobre claro se usa --if-brand-ink (5.47:1). */
  --if-brand: #ff0012;
  --if-brand-ink: #d50011;
  --if-brand-hover: #b3000e;
  --if-brand-soft: #fff1f2;
  --if-brand-ring: rgba(255, 0, 18, 0.28);

  /* --- Acentos por categoría --------------------------------------------- */
  --if-fire: #d50011;
  --if-fire-soft: #fff1f2;
  --if-power: #a86500;
  --if-power-soft: #fff8e6;
  --if-water: #0b6fa4;
  --if-water-soft: #eef7fc;
  --if-norm: #3f4a5a;
  --if-norm-soft: #f1f4f8;

  /* --- Neutros (escala fría, legible en lectura larga) -------------------- */
  --if-n-0: #ffffff;
  --if-n-25: #fcfcfd;
  --if-n-50: #f7f8fa;
  --if-n-100: #eef0f4;
  --if-n-200: #e2e5ea;
  --if-n-300: #cbd0d9;
  --if-n-400: #9aa2b1;
  --if-n-500: #6b7482;
  --if-n-600: #4d5563;
  --if-n-700: #363d49;
  --if-n-800: #232936;
  --if-n-900: #141922;
  --if-n-950: #0b0e14;

  /* --- Roles semánticos --------------------------------------------------- */
  --if-bg: var(--if-n-0);
  --if-bg-subtle: var(--if-n-50);
  --if-bg-sunken: var(--if-n-100);
  --if-surface: var(--if-n-0);
  --if-surface-hover: var(--if-n-25);
  --if-border: var(--if-n-200);
  --if-border-strong: var(--if-n-300);
  --if-text: var(--if-n-900);
  --if-text-muted: var(--if-n-600);
  --if-text-subtle: var(--if-n-500);
  --if-text-invert: var(--if-n-0);

  /* Roles de componente. Existen para que el modo oscuro se resuelva
     intercambiando tokens y no añadiendo reglas más específicas que
     terminarían pisando a los modificadores (.btn-if--ghost, etc.). */
  --if-btn-neutral-bg: var(--if-n-900);
  --if-btn-neutral-fg: var(--if-n-0);
  --if-btn-brand-bg: var(--if-brand-ink);
  --if-chip-on-bg: var(--if-n-900);
  --if-chip-on-fg: var(--if-n-0);
  --if-skeleton-a: var(--if-n-100);
  --if-skeleton-b: var(--if-n-200);

  /* --- Tipografía --------------------------------------------------------- */
  --if-font-display: 'Montserrat', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --if-font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --if-font-mono: ui-monospace, 'SFMono-Regular', 'Cascadia Code', Menlo, monospace;

  /* Escala tipográfica fluida — ratio 1.25 en móvil, 1.28 en desktop */
  --if-t-xs: 0.75rem;      /* 12 */
  --if-t-sm: 0.8125rem;    /* 13 */
  --if-t-base: 0.9375rem;  /* 15 */
  --if-t-md: 1rem;         /* 16 */
  --if-t-lg: 1.125rem;     /* 18 */
  --if-t-xl: clamp(1.25rem, 0.9rem + 0.9vw, 1.5rem);
  --if-t-2xl: clamp(1.5rem, 1.1rem + 1.4vw, 2rem);
  --if-t-3xl: clamp(1.875rem, 1.3rem + 2.2vw, 2.75rem);
  --if-t-4xl: clamp(2.25rem, 1.4rem + 3.6vw, 4rem);

  --if-lh-tight: 1.12;
  --if-lh-snug: 1.28;
  --if-lh-normal: 1.55;
  --if-lh-relaxed: 1.7;

  --if-track-tight: -0.022em;
  --if-track-wide: 0.08em;

  /* --- Espaciado (base 4px) ---------------------------------------------- */
  --if-s-1: 0.25rem;
  --if-s-2: 0.5rem;
  --if-s-3: 0.75rem;
  --if-s-4: 1rem;
  --if-s-5: 1.25rem;
  --if-s-6: 1.5rem;
  --if-s-8: 2rem;
  --if-s-10: 2.5rem;
  --if-s-12: 3rem;
  --if-s-16: 4rem;
  --if-s-20: 5rem;
  --if-s-24: 6rem;

  /* Ritmo vertical entre secciones */
  --if-section-y: clamp(3.5rem, 2rem + 6vw, 6.5rem);

  /* --- Layout ------------------------------------------------------------- */
  --if-max: 1200px;
  --if-max-narrow: 720px;
  --if-gutter: clamp(1.125rem, 0.6rem + 2.2vw, 2rem);

  /* El header compartido es position:fixed y mide 100px en todos los anchos
     (su contenido, logo incluido, queda dentro). --if-header-clear es el
     espacio que el contenido debe dejar libre por debajo; se mantiene como
     token aparte para poder ajustar el despeje sin tocar la referencia a la
     altura real de la barra. */
  --if-header-h: 100px;
  --if-header-clear: 100px;

  /* --- Radios ------------------------------------------------------------- */
  --if-r-sm: 6px;
  --if-r-md: 10px;
  --if-r-lg: 14px;
  --if-r-xl: 20px;
  --if-r-2xl: 28px;
  --if-r-full: 999px;

  /* --- Sombras (elevación en 4 pasos) ------------------------------------ */
  --if-sh-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
  --if-sh-sm: 0 1px 3px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.04);
  --if-sh-md: 0 4px 8px -2px rgba(16, 24, 40, 0.08), 0 2px 4px -2px rgba(16, 24, 40, 0.05);
  --if-sh-lg: 0 12px 20px -6px rgba(16, 24, 40, 0.1), 0 4px 8px -4px rgba(16, 24, 40, 0.06);
  --if-sh-xl: 0 24px 40px -12px rgba(16, 24, 40, 0.16), 0 8px 16px -8px rgba(16, 24, 40, 0.08);

  /* --- Motion ------------------------------------------------------------- */
  --if-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --if-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --if-dur-fast: 140ms;
  --if-dur: 240ms;
  --if-dur-slow: 520ms;

  --if-z-sticky: 40;
  --if-z-top: 60;
}


/* ==========================================================================
   2. RESET Y BASE
   ========================================================================== */

.blog-page {
  margin: 0;
  background: var(--if-bg);
  color: var(--if-text);
  font-family: var(--if-font-sans);
  font-size: var(--if-t-md);
  line-height: var(--if-lh-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'kern' 1, 'liga' 1, 'cv11' 1;
  overflow-x: hidden;
}

.blog-page *,
.blog-page *::before,
.blog-page *::after { box-sizing: border-box; }

/* El header del sitio es position:fixed; el contenido debe despejarlo. */
.blog-main {
  padding-top: var(--if-header-clear);
  /* Ancla el scroll de los enlaces internos por debajo del header fijo. */
  scroll-behavior: smooth;
}

/* Se aplica a cualquier elemento con id, no solo a :target, para que también
   scrollIntoView() y los saltos programáticos respeten el header fijo. */
.blog-page [id] { scroll-margin-top: calc(var(--if-header-clear) + var(--if-s-6)); }

.blog-page h1,
.blog-page h2,
.blog-page h3,
.blog-page h4 {
  font-family: var(--if-font-display);
  font-weight: 800;
  line-height: var(--if-lh-tight);
  letter-spacing: var(--if-track-tight);
  color: var(--if-text);
  margin: 0;
  text-wrap: balance;
}

.blog-page p { margin: 0; text-wrap: pretty; }
/* Incluye <ol>: el breadcrumb es una lista ordenada y sin esto el navegador
   pinta los marcadores numéricos ("1. Inicio 2. Blog"). */
.blog-page ul,
.blog-page ol { margin: 0; padding: 0; list-style: none; }

.blog-page a {
  color: inherit;
  text-decoration: none;
  transition: color var(--if-dur-fast) var(--if-ease);
}

/* Acotado a .blog-main a propósito: el header y el footer son compartidos y
   los dimensiona components1.css con reglas como `.logo img { height: 85px }`.
   Un reset a nivel de .blog-page tiene la misma especificidad y, al cargarse
   esta hoja después, ganaba y estiraba el logo a su tamaño intrínseco. */
.blog-main img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Anillo de foco único y consistente en toda la sección. */
.blog-page :focus-visible {
  outline: 2px solid var(--if-brand-ink);
  outline-offset: 3px;
  border-radius: var(--if-r-sm);
}
.blog-page :focus:not(:focus-visible) { outline: none; }

/* --- Skip link ----------------------------------------------------------- */
.skip-link {
  position: absolute;
  left: var(--if-s-4);
  top: var(--if-s-4);
  z-index: 10000;
  transform: translateY(-200%);
  background: var(--if-n-900);
  color: var(--if-n-0);
  padding: var(--if-s-3) var(--if-s-5);
  border-radius: var(--if-r-md);
  font-size: var(--if-t-base);
  font-weight: 600;
  transition: transform var(--if-dur) var(--if-ease);
}
.skip-link:focus { transform: translateY(0); }

/* ==========================================================================
   3. UTILIDADES DE LAYOUT
   ========================================================================== */

.wrap {
  width: 100%;
  max-width: var(--if-max);
  margin-inline: auto;
  padding-inline: var(--if-gutter);
}

.wrap--narrow { max-width: var(--if-max-narrow); }

.section { padding-block: var(--if-section-y); }
.section--subtle { background: var(--if-bg-subtle); }
.section--tight { padding-block: clamp(2.5rem, 1.5rem + 4vw, 4rem); }

.section-head {
  display: flex;
  flex-direction: column;
  gap: var(--if-s-4);
  margin-bottom: var(--if-s-12);
  max-width: 760px;
}

.section-head--center {
  margin-inline: auto;
  text-align: center;
  align-items: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--if-s-2);
  font-family: var(--if-font-sans);
  font-size: var(--if-t-xs);
  font-weight: 700;
  letter-spacing: var(--if-track-wide);
  text-transform: uppercase;
  color: var(--if-brand-ink);
}

.eyebrow::before {
  content: '';
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
}

.eyebrow--center::before { display: none; }

.section-title { font-size: var(--if-t-3xl); }

.section-sub {
  font-size: var(--if-t-lg);
  line-height: var(--if-lh-relaxed);
  color: var(--if-text-muted);
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   4. PRIMITIVAS
   ========================================================================== */

/* --- 4.1 Botón ----------------------------------------------------------- */
.btn-if {
  --btn-bg: var(--if-btn-neutral-bg);
  --btn-fg: var(--if-btn-neutral-fg);
  --btn-bd: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--if-s-2);
  padding: 0.8125rem 1.375rem;
  font-family: var(--if-font-sans);
  font-size: var(--if-t-base);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1;
  color: var(--btn-fg);
  background: var(--btn-bg);
  border: 1px solid var(--btn-bd);
  border-radius: var(--if-r-md);
  cursor: pointer;
  white-space: nowrap;
  transition:
    transform var(--if-dur-fast) var(--if-ease),
    box-shadow var(--if-dur) var(--if-ease),
    background-color var(--if-dur-fast) var(--if-ease),
    border-color var(--if-dur-fast) var(--if-ease);
}

/* El botón también se usa como enlace (recursos que abren una herramienta,
   acciones del modal "próximamente"). `.blog-page a { color: inherit }` tiene
   especificidad 0-1-1 y le gana a `.btn-if` (0-1-0): sin esta regla, un
   <a class="btn-if"> hereda el color del texto que lo rodea y queda ilegible
   sobre el fondo del propio botón. */
.blog-page a.btn-if { color: var(--btn-fg); }

.btn-if:hover { transform: translateY(-1px); box-shadow: var(--if-sh-md); }
.btn-if:active { transform: translateY(0); box-shadow: var(--if-sh-xs); }

.btn-if--primary {
  --btn-bg: var(--if-btn-brand-bg);
  --btn-fg: #fff;
  box-shadow: 0 1px 2px rgba(213, 0, 17, 0.24);
}
.btn-if--primary:hover { --btn-bg: var(--if-brand-hover); box-shadow: 0 8px 18px -6px rgba(213, 0, 17, 0.45); }

.btn-if--ghost {
  --btn-bg: var(--if-surface);
  --btn-fg: var(--if-text);
  --btn-bd: var(--if-border-strong);
}
.btn-if--ghost:hover { --btn-bg: var(--if-surface-hover); --btn-bd: var(--if-n-400); }

.btn-if--wide { width: 100%; }
.btn-if--lg { padding: 1rem 1.75rem; font-size: var(--if-t-md); }

.btn-if__icon { width: 18px; height: 18px; flex: none; }

/* Estado de carga genérico, reutilizable por cualquier botón del blog. */
.btn-if[data-loading='true'] {
  pointer-events: none;
  color: transparent !important;
  position: relative;
}
.btn-if[data-loading='true']::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 18px; height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: if-spin 0.65s linear infinite;
}
.btn-if--ghost[data-loading='true']::after {
  border-color: var(--if-n-300);
  border-top-color: var(--if-n-700);
}

@keyframes if-spin { to { transform: rotate(360deg); } }

/* --- 4.2 Badge de categoría ---------------------------------------------- */
.cat-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.3125rem 0.625rem;
  font-size: var(--if-t-xs);
  font-weight: 700;
  letter-spacing: 0.02em;
  border-radius: var(--if-r-full);
  color: var(--cat-ink, var(--if-n-700));
  background: var(--cat-soft, var(--if-n-100));
  white-space: nowrap;
}

.cat-badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

/* Un solo par de tokens por categoría: se aplica a badges, cards y bordes. */
[data-cat='incendio']  { --cat-ink: var(--if-fire);  --cat-soft: var(--if-fire-soft); }
[data-cat='electrico'] { --cat-ink: var(--if-power); --cat-soft: var(--if-power-soft); }
[data-cat='hidraulico']{ --cat-ink: var(--if-water); --cat-soft: var(--if-water-soft); }
[data-cat='normativa'] { --cat-ink: var(--if-norm);  --cat-soft: var(--if-norm-soft); }

/* --- 4.3 Meta de artículo ------------------------------------------------ */
.meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--if-s-2);
  font-size: var(--if-t-sm);
  color: var(--if-text-subtle);
}

.meta__dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: 0.55; }

.meta__item { display: inline-flex; align-items: center; gap: 0.3125rem; }
.meta__item svg { width: 14px; height: 14px; flex: none; opacity: 0.75; }

/* --- 4.4 Input / campo --------------------------------------------------- */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--if-s-2);
}

.field__label {
  font-size: var(--if-t-sm);
  font-weight: 600;
  color: var(--if-text-muted);
}

.field__control {
  width: 100%;
  padding: 0.75rem 0.875rem;
  font-family: inherit;
  font-size: var(--if-t-base);
  color: var(--if-text);
  background: var(--if-surface);
  border: 1px solid var(--if-border-strong);
  border-radius: var(--if-r-md);
  transition: border-color var(--if-dur-fast) var(--if-ease), box-shadow var(--if-dur-fast) var(--if-ease);
  -webkit-appearance: none;
  appearance: none;
}

.field__control::placeholder { color: var(--if-n-400); }

.field__control:focus {
  outline: none;
  border-color: var(--if-brand-ink);
  box-shadow: 0 0 0 3px var(--if-brand-ring);
}

.field__control:disabled { background: var(--if-bg-sunken); cursor: not-allowed; }

select.field__control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%236b7482' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 7.5 10 12.5 15 7.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 18px;
  padding-right: 2.25rem;
}

.field__hint { font-size: var(--if-t-xs); color: var(--if-text-subtle); }

/* --- 4.5 Card base ------------------------------------------------------- */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--if-surface);
  border: 1px solid var(--if-border);
  border-radius: var(--if-r-lg);
  overflow: hidden;
  transition:
    transform var(--if-dur) var(--if-ease),
    box-shadow var(--if-dur) var(--if-ease),
    border-color var(--if-dur) var(--if-ease);
}

.card:hover { transform: translateY(-3px); box-shadow: var(--if-sh-lg); border-color: var(--if-border-strong); }

/* Toda la card es clickeable pero solo el título es el enlace real:
   una sola parada de tabulador y un texto de enlace descriptivo. */
.card__link::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
}

/* ==========================================================================
   5. SECCIONES
   ========================================================================== */

/* --- 5.0 Barra de utilidades (breadcrumb + tema) ------------------------- */
.utilbar {
  border-bottom: 1px solid var(--if-border);
  background: var(--if-bg);
}

.utilbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--if-s-4);
  min-height: 46px;
}

.crumbs { font-size: var(--if-t-sm); color: var(--if-text-subtle); }

.crumbs__list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4375rem;
}

.crumbs__list a:hover { color: var(--if-brand-ink); }
.crumbs [aria-current='page'] { color: var(--if-text); font-weight: 600; }

/* El separador es decorativo: como pseudo-elemento no entra en el árbol de
   accesibilidad ni desordena la numeración de la lista. */
.crumbs__list li + li::before {
  content: '/';
  margin-right: 0.4375rem;
  opacity: 0.45;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  padding: 0;
  color: var(--if-text-muted);
  background: transparent;
  border: 1px solid var(--if-border);
  border-radius: var(--if-r-md);
  cursor: pointer;
  transition: background-color var(--if-dur-fast) var(--if-ease), color var(--if-dur-fast) var(--if-ease);
}
.theme-toggle:hover { background: var(--if-bg-sunken); color: var(--if-text); }
.theme-toggle svg { width: 17px; height: 17px; }
.theme-toggle__moon { display: none; }
[data-theme='dark'] .theme-toggle__sun { display: none; }
[data-theme='dark'] .theme-toggle__moon { display: block; }

/* --- 5.1 HERO ------------------------------------------------------------ */
.hero-blog {
  position: relative;
  padding-block: clamp(3rem, 2rem + 5vw, 5.5rem) clamp(3rem, 2rem + 4vw, 4.5rem);
  background: var(--if-bg);
  overflow: hidden;
  isolation: isolate;
}

/* Malla técnica de fondo: evoca planos de ingeniería sin ruido visual.
   Es un gradiente CSS, no una imagen: 0 bytes de red, 0 impacto en LCP. */
.hero-blog::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -2;
  background-image:
    linear-gradient(to right, var(--if-n-100) 1px, transparent 1px),
    linear-gradient(to bottom, var(--if-n-100) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse 90% 65% at 50% 0%, #000 25%, transparent 78%);
  mask-image: radial-gradient(ellipse 90% 65% at 50% 0%, #000 25%, transparent 78%);
}

/* Halo cálido de marca, muy sutil. */
.hero-blog::after {
  content: '';
  position: absolute;
  top: -180px;
  left: 50%;
  z-index: -1;
  width: 760px; height: 420px;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(255, 0, 18, 0.07) 0%, transparent 68%);
  pointer-events: none;
}

.hero-blog__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: clamp(2rem, 1rem + 4vw, 4.5rem);
  align-items: center;
}

.hero-blog__content { max-width: 620px; }

.hero-blog__tag {
  display: inline-flex;
  align-items: center;
  gap: var(--if-s-2);
  padding: 0.375rem 0.75rem 0.375rem 0.5rem;
  margin-bottom: var(--if-s-5);
  font-size: var(--if-t-xs);
  font-weight: 600;
  color: var(--if-text-muted);
  background: var(--if-surface);
  border: 1px solid var(--if-border);
  border-radius: var(--if-r-full);
  box-shadow: var(--if-sh-xs);
}

.hero-blog__tag strong { color: var(--if-brand-ink); font-weight: 700; }

.hero-blog__pulse {
  position: relative;
  width: 7px; height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--if-brand);
}
.hero-blog__pulse::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid var(--if-brand);
  opacity: 0;
  animation: if-pulse 2.4s var(--if-ease) infinite;
}

@keyframes if-pulse {
  0%   { transform: scale(0.6); opacity: 0.9; }
  70%  { transform: scale(1.5); opacity: 0; }
  100% { transform: scale(1.5); opacity: 0; }
}

.hero-blog__title {
  font-size: var(--if-t-4xl);
  letter-spacing: -0.032em;
}

.hero-blog__title em {
  font-style: normal;
  color: var(--if-brand-ink);
}

.hero-blog__sub {
  margin-top: var(--if-s-5);
  font-size: clamp(1rem, 0.94rem + 0.3vw, 1.1875rem);
  line-height: var(--if-lh-relaxed);
  color: var(--if-text-muted);
  max-width: 54ch;
}

/* --- Buscador ------------------------------------------------------------ */
.searchbox {
  position: relative;
  margin-top: var(--if-s-8);
  max-width: 520px;
}

.searchbox__field {
  display: flex;
  align-items: center;
  gap: var(--if-s-3);
  padding: 0.3125rem 0.3125rem 0.3125rem 0.9375rem;
  background: var(--if-surface);
  border: 1px solid var(--if-border-strong);
  border-radius: var(--if-r-lg);
  box-shadow: var(--if-sh-sm);
  transition: border-color var(--if-dur) var(--if-ease), box-shadow var(--if-dur) var(--if-ease);
}

.searchbox__field:focus-within {
  border-color: var(--if-brand-ink);
  box-shadow: 0 0 0 4px var(--if-brand-ring), var(--if-sh-md);
}

.searchbox__icon { width: 19px; height: 19px; flex: none; color: var(--if-n-400); }

.searchbox__input {
  flex: 1;
  min-width: 0;
  padding: 0.625rem 0;
  font-family: inherit;
  font-size: var(--if-t-md);
  color: var(--if-text);
  background: transparent;
  border: 0;
}
.searchbox__input::placeholder { color: var(--if-n-400); }
.searchbox__input:focus { outline: none; }
.searchbox__input::-webkit-search-cancel-button { display: none; }

.searchbox__clear {
  display: none;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  flex: none;
  color: var(--if-text-subtle);
  background: var(--if-bg-sunken);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}
.searchbox__clear svg { width: 13px; height: 13px; }
.searchbox__clear:hover { color: var(--if-text); background: var(--if-n-200); }
.searchbox[data-filled='true'] .searchbox__clear { display: inline-flex; }

.searchbox__kbd {
  display: inline-flex;
  gap: 3px;
  padding-right: var(--if-s-2);
  flex: none;
}
.searchbox__kbd kbd {
  font-family: var(--if-font-sans);
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--if-text-subtle);
  background: var(--if-bg-sunken);
  border: 1px solid var(--if-border);
  border-bottom-width: 2px;
  border-radius: var(--if-r-sm);
  padding: 2px 6px;
  line-height: 1.3;
}

/* Panel de sugerencias — el markup se inyecta desde blog.js.
   La estructura y los estados visuales viven aquí para que el JS
   solo maneje datos, nunca estilos. */
.searchbox__panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0; right: 0;
  z-index: var(--if-z-top);
  max-height: 340px;
  overflow-y: auto;
  padding: var(--if-s-2);
  background: var(--if-surface);
  border: 1px solid var(--if-border);
  border-radius: var(--if-r-lg);
  box-shadow: var(--if-sh-xl);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity var(--if-dur) var(--if-ease), transform var(--if-dur) var(--if-ease), visibility var(--if-dur);
}

.searchbox__panel[data-open='true'] { opacity: 1; visibility: visible; transform: translateY(0); }

.sugg {
  display: flex;
  align-items: center;
  gap: var(--if-s-3);
  width: 100%;
  padding: var(--if-s-3);
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: var(--if-r-md);
  cursor: pointer;
  font: inherit;
  color: var(--if-text);
}
.sugg:hover,
.sugg[aria-selected='true'] { background: var(--if-bg-sunken); }

.sugg__body { min-width: 0; }
.sugg__title {
  font-size: var(--if-t-base);
  font-weight: 600;
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.sugg__title mark { background: var(--if-brand-soft); color: var(--if-brand-ink); padding: 0 2px; border-radius: 3px; }
.sugg__meta { font-size: var(--if-t-xs); color: var(--if-text-subtle); margin-top: 2px; }

.sugg__empty {
  padding: var(--if-s-5) var(--if-s-3);
  text-align: center;
  font-size: var(--if-t-base);
  color: var(--if-text-subtle);
}

/* --- Acciones y confianza del hero -------------------------------------- */
.hero-blog__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--if-s-3);
  margin-top: var(--if-s-6);
}

/* Rejilla en vez de flex-wrap: con tres cifras de ancho desigual, el wrap
   dejaba dos arriba y una suelta abajo. La rejilla las mantiene alineadas. */
.trust {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--if-s-5) var(--if-s-6);
  margin-top: var(--if-s-10);
  padding-top: var(--if-s-6);
  border-top: 1px solid var(--if-border);
}

.trust__item { display: flex; flex-direction: column; gap: 2px; }

.trust__value {
  font-family: var(--if-font-display);
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--if-text);
  line-height: 1.1;
}

.trust__label {
  font-size: var(--if-t-xs);
  font-weight: 500;
  color: var(--if-text-subtle);
  letter-spacing: 0.01em;
}

/* --- Visual del hero ----------------------------------------------------- */
.hero-blog__visual { position: relative; }

.hero-blog__frame {
  position: relative;
  border-radius: var(--if-r-xl);
  overflow: hidden;
  border: 1px solid var(--if-border);
  box-shadow: var(--if-sh-xl);
  background: var(--if-n-900);
  aspect-ratio: 4 / 3;
}

.hero-blog__frame img {
  width: 100%; height: 100%;
  object-fit: cover;
}

/* Tarjeta flotante: prueba social concreta, no decoración. */
.hero-blog__chip {
  position: absolute;
  left: -14px;
  bottom: 22px;
  display: flex;
  align-items: center;
  gap: var(--if-s-3);
  padding: var(--if-s-3) var(--if-s-4);
  background: var(--if-surface);
  border: 1px solid var(--if-border);
  border-radius: var(--if-r-lg);
  box-shadow: var(--if-sh-xl);
  max-width: 260px;
}

.hero-blog__chip-icon {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  flex: none;
  border-radius: var(--if-r-md);
  background: var(--if-brand-soft);
  color: var(--if-brand-ink);
}
.hero-blog__chip-icon svg { width: 18px; height: 18px; }

/* Ambos son <span>: sin display:block quedarían en la misma línea. */
.hero-blog__chip-title {
  display: block;
  font-size: var(--if-t-sm);
  font-weight: 700;
  line-height: 1.25;
}
.hero-blog__chip-text {
  display: block;
  margin-top: 2px;
  font-size: var(--if-t-xs);
  color: var(--if-text-subtle);
  line-height: 1.35;
}

/* --- 5.2 CATEGORÍAS ------------------------------------------------------ */
.cats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: var(--if-s-5);
}

.cat-card {
  padding: var(--if-s-6);
  gap: var(--if-s-4);
}

/* Franja de color de la categoría que se revela al hover. */
.cat-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--cat-ink);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--if-dur-slow) var(--if-ease-out);
}
.cat-card:hover::before,
.cat-card:focus-within::before { transform: scaleX(1); }

.cat-card__icon {
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  border-radius: var(--if-r-md);
  color: var(--cat-ink);
  background: var(--cat-soft);
  transition: transform var(--if-dur) var(--if-ease);
}
.cat-card:hover .cat-card__icon { transform: scale(1.06) rotate(-3deg); }
.cat-card__icon svg { width: 22px; height: 22px; }

.cat-card__title { font-size: var(--if-t-lg); font-weight: 700; }
.cat-card__desc { font-size: var(--if-t-base); color: var(--if-text-muted); line-height: var(--if-lh-normal); }

.cat-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--if-s-3);
  margin-top: auto;
  padding-top: var(--if-s-4);
  border-top: 1px solid var(--if-border);
  font-size: var(--if-t-sm);
  color: var(--if-text-subtle);
}

.cat-card__go {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
  /* Sin nowrap, "Ver artículos" se parte en dos líneas y la flecha
     queda suelta debajo cuando la tarjeta es estrecha. */
  white-space: nowrap;
  font-weight: 600;
  color: var(--cat-ink);
}

/* La lista de normas cede el espacio antes que el enlace de acción. */
.cat-card__foot > span:first-child { min-width: 0; }
.cat-card__go svg { width: 15px; height: 15px; transition: transform var(--if-dur) var(--if-ease); }
.cat-card:hover .cat-card__go svg { transform: translateX(3px); }

/* --- 5.3 FILTROS --------------------------------------------------------- */
.filters {
  position: sticky;
  /* Se engancha por debajo del distintivo del logo, que sobresale del
     header y taparía el primer chip si la barra parara en --if-header-h. */
  top: var(--if-header-clear);
  z-index: var(--if-z-sticky);
  padding-block: var(--if-s-4);
  /* Fondo sólido primero: navegadores sin color-mix descartan la segunda
     declaración y conservan una barra legible en vez de una transparente. */
  background: var(--if-bg);
  background: color-mix(in srgb, var(--if-bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--if-dur) var(--if-ease), box-shadow var(--if-dur) var(--if-ease);
}

.filters[data-stuck='true'] { border-bottom-color: var(--if-border); box-shadow: var(--if-sh-sm); }

.filters__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--if-s-4);
}

/* Scroll horizontal en móvil sin barra visible ni scroll del body. */
.chips {
  display: flex;
  gap: var(--if-s-2);
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-block: 2px;
  scroll-snap-type: x proximity;
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: none;
  padding: 0.5rem 0.875rem;
  font-family: inherit;
  font-size: var(--if-t-sm);
  font-weight: 600;
  color: var(--if-text-muted);
  background: var(--if-surface);
  border: 1px solid var(--if-border);
  border-radius: var(--if-r-full);
  cursor: pointer;
  scroll-snap-align: start;
  transition:
    color var(--if-dur-fast) var(--if-ease),
    background-color var(--if-dur-fast) var(--if-ease),
    border-color var(--if-dur-fast) var(--if-ease),
    transform var(--if-dur-fast) var(--if-ease);
}

.chip:hover { color: var(--if-text); border-color: var(--if-border-strong); background: var(--if-surface-hover); }
.chip:active { transform: scale(0.97); }

.chip[aria-pressed='true'] {
  color: var(--if-chip-on-fg);
  background: var(--if-chip-on-bg);
  border-color: var(--if-chip-on-bg);
}

.filters__count {
  flex: none;
  font-size: var(--if-t-sm);
  color: var(--if-text-subtle);
  font-variant-numeric: tabular-nums;
}
.filters__count strong { color: var(--if-text); font-weight: 700; }

/* --- 5.4 ARTÍCULOS ------------------------------------------------------- */

/* Artículo destacado: layout horizontal, jerarquía dominante. */
.featured {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  margin-bottom: var(--if-s-10);
  border-radius: var(--if-r-xl);
}

.featured__media {
  position: relative;
  min-height: 300px;
  background: var(--if-n-100);
  overflow: hidden;
}

.featured__media img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform var(--if-dur-slow) var(--if-ease-out);
}
.featured:hover .featured__media img { transform: scale(1.04); }

.featured__flag {
  position: absolute;
  top: var(--if-s-4);
  left: var(--if-s-4);
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0.375rem 0.6875rem;
  font-size: var(--if-t-xs);
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #fff;
  background: var(--if-brand-ink);
  border-radius: var(--if-r-full);
  box-shadow: var(--if-sh-md);
}
.featured__flag svg { width: 13px; height: 13px; }

.featured__body {
  display: flex;
  flex-direction: column;
  gap: var(--if-s-4);
  padding: clamp(1.75rem, 1rem + 2.4vw, 2.75rem);
}

.featured__title {
  font-size: var(--if-t-2xl);
  line-height: var(--if-lh-snug);
}

.featured:hover .featured__title { color: var(--if-brand-ink); }
.featured__title a { transition: color var(--if-dur) var(--if-ease); }

.featured__excerpt {
  font-size: var(--if-t-md);
  line-height: var(--if-lh-relaxed);
  color: var(--if-text-muted);
}

.featured__foot {
  display: flex;
  align-items: center;
  gap: var(--if-s-3);
  margin-top: auto;
  padding-top: var(--if-s-5);
  border-top: 1px solid var(--if-border);
}

/* --- Grid de artículos --------------------------------------------------- */
.posts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--if-s-6);
}

.post { }

.post__media {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--if-n-100);
  overflow: hidden;
}

.post__media img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform var(--if-dur-slow) var(--if-ease-out);
}
.post:hover .post__media img { transform: scale(1.05); }

.post__badge {
  position: absolute;
  top: var(--if-s-3);
  left: var(--if-s-3);
  z-index: 2;
  background: color-mix(in srgb, var(--if-surface) 92%, transparent);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  box-shadow: var(--if-sh-xs);
}

.post__body {
  display: flex;
  flex-direction: column;
  gap: var(--if-s-3);
  padding: var(--if-s-5);
  flex: 1;
}

.post__title {
  font-size: var(--if-t-lg);
  font-weight: 700;
  line-height: var(--if-lh-snug);
  transition: color var(--if-dur) var(--if-ease);
}
.post:hover .post__title { color: var(--if-brand-ink); }

.post__excerpt {
  font-size: var(--if-t-base);
  line-height: var(--if-lh-normal);
  color: var(--if-text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post__foot {
  display: flex;
  align-items: center;
  gap: var(--if-s-2);
  margin-top: auto;
  padding-top: var(--if-s-4);
  border-top: 1px solid var(--if-border);
}

/* --- Autor --------------------------------------------------------------- */
.author {
  display: flex;
  align-items: center;
  gap: var(--if-s-2);
  min-width: 0;
}

.author__avatar {
  width: 28px; height: 28px;
  flex: none;
  border-radius: 50%;
  object-fit: cover;
  background: var(--if-n-100);
  border: 1px solid var(--if-border);
}

/* Monograma en vez de imagen: el icono de marca pesaba 47 KB para
   mostrarse a 28 px. Esto no cuesta ninguna petición y se ve nítido
   en cualquier densidad de pantalla. */
.author__avatar--mark {
  display: grid;
  place-items: center;
  font-family: var(--if-font-display);
  font-size: 0.625rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #fff;
  background: var(--if-brand-ink);
  border-color: transparent;
}

.author__name {
  font-size: var(--if-t-sm);
  font-weight: 600;
  color: var(--if-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.author__role { font-size: var(--if-t-xs); color: var(--if-text-subtle); }

/* --- Estados de la lista ------------------------------------------------- */
/* `.card` declara display:flex, que gana por especificidad al display:none
   que el navegador aplica a [hidden]. Sin esta regla, las tarjetas filtradas
   seguirían visibles. */
.blog-page [hidden] { display: none !important; }

.posts-empty {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: var(--if-s-4);
  padding: var(--if-s-16) var(--if-s-6);
  text-align: center;
  background: var(--if-bg-subtle);
  border: 1px dashed var(--if-border-strong);
  border-radius: var(--if-r-lg);
}

.posts-empty[data-show='true'] { display: flex; }

.posts-empty__icon {
  display: grid;
  place-items: center;
  width: 52px; height: 52px;
  border-radius: 50%;
  color: var(--if-text-subtle);
  background: var(--if-bg-sunken);
}
.posts-empty__icon svg { width: 24px; height: 24px; }

.posts-empty__title { font-size: var(--if-t-xl); }
.posts-empty__text { font-size: var(--if-t-base); color: var(--if-text-muted); max-width: 40ch; }

/* Esqueleto de carga, reutilizable si más adelante se pagina por fetch. */
.skeleton {
  background: linear-gradient(90deg, var(--if-skeleton-a) 25%, var(--if-skeleton-b) 37%, var(--if-skeleton-a) 63%);
  background-size: 400% 100%;
  animation: if-shimmer 1.4s ease-in-out infinite;
  border-radius: var(--if-r-sm);
  color: transparent;
  pointer-events: none;
}

@keyframes if-shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

/* --- 5.5 RECURSOS GRATUITOS ---------------------------------------------- */
.resources {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--if-s-5);
}

.resource {
  padding: var(--if-s-6);
  gap: var(--if-s-4);
}

.resource__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--if-s-3);
}

.resource__icon {
  display: grid;
  place-items: center;
  width: 42px; height: 42px;
  flex: none;
  border-radius: var(--if-r-md);
  color: var(--cat-ink, var(--if-brand-ink));
  background: var(--cat-soft, var(--if-brand-soft));
}
.resource__icon svg { width: 21px; height: 21px; }

.resource__type {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--if-text-subtle);
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--if-border);
  border-radius: var(--if-r-sm);
}

.resource__title { font-size: var(--if-t-lg); font-weight: 700; }
.resource__desc { font-size: var(--if-t-base); color: var(--if-text-muted); line-height: var(--if-lh-normal); }

.resource__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--if-s-3);
  margin-top: auto;
  padding-top: var(--if-s-4);
  border-top: 1px solid var(--if-border);
}

.resource__pages { font-size: var(--if-t-xs); color: var(--if-text-subtle); }

/* Captura del lead magnet en la propia tarjeta (divulgación progresiva).
   Se prefiere a un modal: no interrumpe, no necesita trampa de foco y
   mantiene el contexto de qué recurso se está pidiendo. */
.resource__capture {
  display: flex;
  flex-direction: column;
  gap: var(--if-s-2);
  margin-top: auto;
  padding-top: var(--if-s-4);
  border-top: 1px solid var(--if-border);
}

.resource__capture-row { display: flex; gap: var(--if-s-2); }
.resource__capture-row .field__control { flex: 1; min-width: 0; }

.resource__capture-hint { font-size: var(--if-t-xs); color: var(--if-text-subtle); line-height: 1.45; }

.resource__done {
  display: flex;
  align-items: flex-start;
  gap: var(--if-s-3);
  margin-top: auto;
  padding-top: var(--if-s-4);
  border-top: 1px solid var(--if-border);
  font-size: var(--if-t-base);
  color: var(--if-text-muted);
}

.resource__done-icon {
  display: grid;
  place-items: center;
  width: 26px; height: 26px;
  flex: none;
  border-radius: 50%;
  color: #16a34a;
  background: rgba(22, 163, 74, 0.12);
}
.resource__done-icon svg { width: 14px; height: 14px; }

@media (max-width: 420px) {
  .resource__capture-row { flex-direction: column; }
}

/* --- 5.6 CTA DIAGNÓSTICO ------------------------------------------------- */
.cta-diag {
  position: relative;
  overflow: hidden;
  border-radius: var(--if-r-2xl);
  background: var(--if-n-950);
  color: var(--if-n-0);
  isolation: isolate;
}

.cta-diag::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 0, 18, 0.22) 0%, transparent 48%),
    radial-gradient(circle at 88% 92%, rgba(87, 157, 204, 0.16) 0%, transparent 52%);
}

.cta-diag__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 460px);
  gap: clamp(2rem, 1rem + 4vw, 4rem);
  padding: clamp(2rem, 1.2rem + 3.4vw, 3.75rem);
  align-items: start;
}

/* El panel es oscuro en ambos temas, así que sus encabezados no pueden
   heredar --if-text (casi negro en modo claro). Se apunta al elemento para
   ganarle en especificidad a la regla base `.blog-page h2, h3`. */
.cta-diag h2,
.cta-diag h3 { color: var(--if-n-0); }

.cta-diag__title { font-size: var(--if-t-3xl); }
.cta-diag__title em { font-style: normal; color: #ff5a66; }

.cta-diag__text {
  margin-top: var(--if-s-5);
  font-size: var(--if-t-lg);
  line-height: var(--if-lh-relaxed);
  color: rgba(255, 255, 255, 0.72);
}

.cta-diag__list {
  display: flex;
  flex-direction: column;
  gap: var(--if-s-3);
  margin-top: var(--if-s-8);
}

.cta-diag__item {
  display: flex;
  align-items: flex-start;
  gap: var(--if-s-3);
  font-size: var(--if-t-base);
  color: rgba(255, 255, 255, 0.88);
}

.cta-diag__check {
  display: grid;
  place-items: center;
  width: 20px; height: 20px;
  flex: none;
  margin-top: 1px;
  border-radius: 50%;
  color: #4ade80;
  background: rgba(74, 222, 128, 0.14);
}
.cta-diag__check svg { width: 12px; height: 12px; }

.cta-diag__note {
  display: flex;
  align-items: center;
  gap: var(--if-s-2);
  margin-top: var(--if-s-8);
  padding-top: var(--if-s-5);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: var(--if-t-sm);
  color: rgba(255, 255, 255, 0.55);
}
.cta-diag__note svg { width: 15px; height: 15px; flex: none; }

/* --- Formulario sobre fondo oscuro --------------------------------------- */
.cta-form {
  display: flex;
  flex-direction: column;
  gap: var(--if-s-4);
  padding: clamp(1.5rem, 1rem + 1.6vw, 2rem);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--if-r-xl);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.cta-form__head { margin-bottom: var(--if-s-1); }
.cta-form__title { font-size: var(--if-t-xl); }
.cta-form__sub { margin-top: var(--if-s-2); font-size: var(--if-t-sm); color: rgba(255, 255, 255, 0.6); }

.cta-form .field__label { color: rgba(255, 255, 255, 0.78); }

/* background-color, no el atajo `background`: el atajo reinicia
   background-repeat/position/size y hacía que la flecha del <select> se
   repitiera en mosaico a lo ancho del campo. */
.cta-form .field__control {
  color: #fff;
  background-color: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.16);
}
.cta-form .field__control::placeholder { color: rgba(255, 255, 255, 0.36); }
.cta-form .field__control:focus {
  border-color: #ff5a66;
  box-shadow: 0 0 0 3px rgba(255, 0, 18, 0.28);
  background-color: rgba(255, 255, 255, 0.09);
}
.cta-form select.field__control option { color: #111; background: #fff; }
.cta-form select.field__control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23ffffff' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round' opacity='0.6'%3E%3Cpath d='M5 7.5 10 12.5 15 7.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 18px;
}

/* Campo condicional: se revela sin salto brusco de layout. */
.cta-form .conditional {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows var(--if-dur-slow) var(--if-ease), opacity var(--if-dur) var(--if-ease);
}
.cta-form .conditional > * { overflow: hidden; }
.cta-form .conditional.show { grid-template-rows: 1fr; opacity: 1; }

.cta-form__legal { font-size: var(--if-t-xs); color: rgba(255, 255, 255, 0.45); line-height: 1.5; text-align: center; }
.cta-form__legal a { color: rgba(255, 255, 255, 0.7); text-decoration: underline; text-underline-offset: 2px; }

.cta-form__alt {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--if-s-2);
  padding: 0.75rem;
  font-size: var(--if-t-base);
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--if-r-md);
  transition: background-color var(--if-dur-fast) var(--if-ease), border-color var(--if-dur-fast) var(--if-ease);
}
.cta-form__alt:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.32); }
.cta-form__alt svg { width: 17px; height: 17px; }

.form-status {
  font-size: var(--if-t-sm);
  padding: var(--if-s-3);
  border-radius: var(--if-r-md);
  display: none;
}
.form-status[data-state='error'] { display: block; color: #ffb4b4; background: rgba(255, 0, 18, 0.14); border: 1px solid rgba(255, 0, 18, 0.3); }
.form-status[data-state='ok'] { display: block; color: #86efac; background: rgba(74, 222, 128, 0.12); border: 1px solid rgba(74, 222, 128, 0.28); }

/* --- 5.7 NEWSLETTER ------------------------------------------------------ */
.news {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 400px);
  gap: clamp(2rem, 1rem + 3vw, 3.5rem);
  align-items: center;
  padding: clamp(2rem, 1.2rem + 3vw, 3.25rem);
  background: var(--if-surface);
  border: 1px solid var(--if-border);
  border-radius: var(--if-r-2xl);
  box-shadow: var(--if-sh-md);
}

.news__title { font-size: var(--if-t-2xl); }
.news__text { margin-top: var(--if-s-4); font-size: var(--if-t-md); line-height: var(--if-lh-relaxed); color: var(--if-text-muted); }

.news__points {
  display: flex;
  flex-wrap: wrap;
  gap: var(--if-s-3) var(--if-s-5);
  margin-top: var(--if-s-5);
}

.news__point {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--if-t-sm);
  font-weight: 500;
  color: var(--if-text-muted);
}
.news__point svg { width: 15px; height: 15px; color: var(--if-brand-ink); flex: none; }

.news__form { display: flex; flex-direction: column; gap: var(--if-s-3); }

.news__row { display: flex; gap: var(--if-s-2); }
.news__row .field__control { flex: 1; min-width: 0; }

.news__legal { font-size: var(--if-t-xs); color: var(--if-text-subtle); line-height: 1.5; }

/* --- 5.8 FAQ ------------------------------------------------------------- */
.faq { display: flex; flex-direction: column; gap: var(--if-s-3); }

.faq__item {
  background: var(--if-surface);
  border: 1px solid var(--if-border);
  border-radius: var(--if-r-lg);
  overflow: hidden;
  transition: border-color var(--if-dur) var(--if-ease), box-shadow var(--if-dur) var(--if-ease);
}

.faq__item:hover { border-color: var(--if-border-strong); }
.faq__item[data-open='true'] { border-color: var(--if-border-strong); box-shadow: var(--if-sh-sm); }

.faq__q {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--if-s-4);
  width: 100%;
  padding: var(--if-s-5) var(--if-s-6);
  font-family: var(--if-font-display);
  font-size: var(--if-t-md);
  font-weight: 700;
  line-height: var(--if-lh-snug);
  text-align: left;
  color: var(--if-text);
  background: transparent;
  border: 0;
  cursor: pointer;
  transition: color var(--if-dur-fast) var(--if-ease);
}
.faq__q:hover { color: var(--if-brand-ink); }

.faq__sign {
  position: relative;
  width: 20px; height: 20px;
  flex: none;
  color: var(--if-text-subtle);
}
.faq__sign::before,
.faq__sign::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  background: currentColor;
  border-radius: 2px;
  transition: transform var(--if-dur) var(--if-ease), opacity var(--if-dur) var(--if-ease);
}
.faq__sign::before { width: 12px; height: 2px; }
.faq__sign::after { width: 2px; height: 12px; }
.faq__item[data-open='true'] .faq__sign::after { transform: rotate(90deg); opacity: 0; }
.faq__item[data-open='true'] .faq__sign { color: var(--if-brand-ink); }

/* grid-template-rows anima a altura automática sin medir con JS. */
.faq__panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows var(--if-dur-slow) var(--if-ease);
}
.faq__item[data-open='true'] .faq__panel { grid-template-rows: 1fr; }

.faq__panel > div { overflow: hidden; }

.faq__a {
  padding: 0 var(--if-s-6) var(--if-s-5);
  font-size: var(--if-t-base);
  line-height: var(--if-lh-relaxed);
  color: var(--if-text-muted);
}
.faq__a p + p { margin-top: var(--if-s-3); }
.faq__a a { color: var(--if-brand-ink); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

/* --- 5.9 Volver arriba --------------------------------------------------- */
.to-top {
  position: fixed;
  right: clamp(1rem, 2vw, 1.75rem);
  bottom: clamp(1rem, 2vw, 1.75rem);
  z-index: var(--if-z-top);
  display: grid;
  place-items: center;
  width: 42px; height: 42px;
  color: var(--if-text);
  background: var(--if-surface);
  border: 1px solid var(--if-border-strong);
  border-radius: 50%;
  box-shadow: var(--if-sh-lg);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity var(--if-dur) var(--if-ease), transform var(--if-dur) var(--if-ease), visibility var(--if-dur);
}
.to-top[data-show='true'] { opacity: 1; visibility: visible; transform: translateY(0); }
.to-top:hover { background: var(--if-bg-sunken); }
.to-top svg { width: 18px; height: 18px; }

/* ==========================================================================
   6. MOTION / REVEAL
   ========================================================================== */

/* Estado inicial aplicado por JS (clase en <html>) para que quien tenga
   JS desactivado vea el contenido sin animación y sin quedar invisible. */
.js-reveal .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity var(--if-dur-slow) var(--if-ease-out),
    transform var(--if-dur-slow) var(--if-ease-out);
  transition-delay: var(--reveal-delay, 0ms);
  will-change: opacity, transform;
}

.js-reveal .reveal.is-in {
  opacity: 1;
  transform: none;
  will-change: auto;
}

/* ==========================================================================
   7. RESPONSIVE
   ========================================================================== */

@media (max-width: 1024px) {
  .hero-blog__grid { grid-template-columns: 1fr; gap: var(--if-s-10); }
  .hero-blog__content { max-width: none; }
  .hero-blog__visual { order: -1; }
  .hero-blog__frame { aspect-ratio: 16 / 9; }
  .searchbox { max-width: none; }
  .featured { grid-template-columns: 1fr; }
  .featured__media { min-height: 0; aspect-ratio: 16 / 9; }
  .cta-diag__grid { grid-template-columns: 1fr; }
  .news { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  /* Flotando sobre una imagen ya reducida, la tarjeta tapaba la foto.
     En móvil pasa a formar parte del flujo, justo debajo. */
  .hero-blog__chip {
    position: static;
    transform: none;
    max-width: none;
    margin-top: var(--if-s-3);
    box-shadow: var(--if-sh-md);
  }
  .hero-blog__visual { margin-bottom: var(--if-s-2); }
  .trust { gap: var(--if-s-5) var(--if-s-6); }
  .trust__value { font-size: 1.3125rem; }
  .hero-blog__actions .btn-if { flex: 1 1 100%; }
  .searchbox__kbd { display: none; }
  .posts { grid-template-columns: 1fr; gap: var(--if-s-5); }
  .cats { grid-template-columns: 1fr; }
  .filters__inner { flex-direction: column; align-items: stretch; gap: var(--if-s-3); }
  .filters__count { order: -1; }
  /* Los chips sangran hasta el borde para dejar claro que hay más. */
  .chips {
    margin-inline: calc(var(--if-gutter) * -1);
    padding-inline: var(--if-gutter);
  }
  .news__row { flex-direction: column; }
  .faq__q { padding: var(--if-s-4) var(--if-s-5); font-size: var(--if-t-base); }
  .faq__a { padding: 0 var(--if-s-5) var(--if-s-4); }
}

@media (max-width: 420px) {
  .featured__foot { flex-wrap: wrap; }
  .to-top { width: 38px; height: 38px; }
}

/* ==========================================================================
   8. MODO OSCURO
   --------------------------------------------------------------------------
   Los tokens se redefinen en tres lugares para cubrir los tres estados del
   tema: elección explícita clara, preferencia del sistema, elección
   explícita oscura. Ningún color tiene su única definición aquí.
   ========================================================================== */

:root[data-theme='dark'] {
  --if-brand-ink: #ff5a66;
  --if-brand-hover: #ff7a84;
  --if-brand-soft: rgba(255, 0, 18, 0.14);
  --if-brand-ring: rgba(255, 90, 102, 0.3);

  --if-fire: #ff6b76;   --if-fire-soft: rgba(255, 107, 118, 0.14);
  --if-power: #f5c451;  --if-power-soft: rgba(245, 196, 81, 0.14);
  --if-water: #6ab7e6;  --if-water-soft: rgba(106, 183, 230, 0.14);
  --if-norm: #a9b4c4;   --if-norm-soft: rgba(169, 180, 196, 0.13);

  --if-bg: #0b0e14;
  --if-bg-subtle: #10141c;
  --if-bg-sunken: #171c26;
  --if-surface: #12171f;
  --if-surface-hover: #171d27;
  --if-border: #242b38;
  --if-border-strong: #333c4c;
  --if-text: #eef1f6;
  --if-text-muted: #a5aebe;
  --if-text-subtle: #808b9c;

  --if-btn-neutral-bg: #eef1f6;
  --if-btn-neutral-fg: #0b0e14;
  --if-btn-brand-bg: var(--if-brand);
  --if-chip-on-bg: #eef1f6;
  --if-chip-on-fg: #0b0e14;
  --if-skeleton-a: #171c26;
  --if-skeleton-b: #242b38;

  --if-sh-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --if-sh-sm: 0 1px 3px rgba(0, 0, 0, 0.5);
  --if-sh-md: 0 4px 10px -2px rgba(0, 0, 0, 0.55);
  --if-sh-lg: 0 12px 24px -8px rgba(0, 0, 0, 0.62);
  --if-sh-xl: 0 24px 48px -14px rgba(0, 0, 0, 0.72);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --if-brand-ink: #ff5a66;
    --if-brand-hover: #ff7a84;
    --if-brand-soft: rgba(255, 0, 18, 0.14);
    --if-brand-ring: rgba(255, 90, 102, 0.3);

    --if-fire: #ff6b76;   --if-fire-soft: rgba(255, 107, 118, 0.14);
    --if-power: #f5c451;  --if-power-soft: rgba(245, 196, 81, 0.14);
    --if-water: #6ab7e6;  --if-water-soft: rgba(106, 183, 230, 0.14);
    --if-norm: #a9b4c4;   --if-norm-soft: rgba(169, 180, 196, 0.13);

    --if-bg: #0b0e14;
    --if-bg-subtle: #10141c;
    --if-bg-sunken: #171c26;
    --if-surface: #12171f;
    --if-surface-hover: #171d27;
    --if-border: #242b38;
    --if-border-strong: #333c4c;
    --if-text: #eef1f6;
    --if-text-muted: #a5aebe;
    --if-text-subtle: #808b9c;

    --if-btn-neutral-bg: #eef1f6;
    --if-btn-neutral-fg: #0b0e14;
    --if-btn-brand-bg: var(--if-brand);
    --if-chip-on-bg: #eef1f6;
    --if-chip-on-fg: #0b0e14;
    --if-skeleton-a: #171c26;
    --if-skeleton-b: #242b38;

    --if-sh-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
    --if-sh-sm: 0 1px 3px rgba(0, 0, 0, 0.5);
    --if-sh-md: 0 4px 10px -2px rgba(0, 0, 0, 0.55);
    --if-sh-lg: 0 12px 24px -8px rgba(0, 0, 0, 0.62);
    --if-sh-xl: 0 24px 48px -14px rgba(0, 0, 0, 0.72);
  }
}

/* Ajustes puntuales que no son solo intercambio de tokens. */
:root[data-theme='dark'] .hero-blog::before { opacity: 0.5; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .hero-blog::before { opacity: 0.5; }
}

:root[data-theme='dark'] .cta-diag { border: 1px solid var(--if-border); }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .cta-diag { border: 1px solid var(--if-border); }
}
:root[data-theme='dark'] .featured__media,
:root[data-theme='dark'] .post__media { background: var(--if-bg-sunken); }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .featured__media,
  :root:not([data-theme='light']) .post__media { background: var(--if-bg-sunken); }
}

/* ==========================================================================
   8.b MODAL "PRÓXIMAMENTE"
   --------------------------------------------------------------------------
   Se abre al pulsar cualquier enlace con [data-soon]: artículos del clúster
   que todavía no se publican y hubs de categoría sin contenido. Evita el
   404 y convierte un callejón sin salida en una captura de correo.

   El markup lo inyecta blog.js una sola vez; aquí solo vive el estilo, para
   que las dos páginas que lo usan (índice y artículo) compartan la misma
   hoja sin duplicar HTML.
   ========================================================================== */

.soon {
  position: fixed;
  inset: 0;
  z-index: 10001; /* por encima del header fijo (9999) */
  display: grid;
  place-items: center;
  padding: var(--if-s-5);
}

.soon[hidden] { display: none; }

.soon__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 14, 20, 0.62);
  backdrop-filter: blur(3px);
  animation: soon-fade var(--if-dur) var(--if-ease);
}

.soon__panel {
  position: relative;
  width: min(100%, 30rem);
  max-height: calc(100vh - var(--if-s-10));
  overflow-y: auto;
  background: var(--if-surface);
  border: 1px solid var(--if-border);
  border-radius: var(--if-r-xl);
  box-shadow: var(--if-sh-xl);
  padding: clamp(1.5rem, 1.2rem + 1.4vw, 2.25rem);
  text-align: center;
  animation: soon-in var(--if-dur) var(--if-ease-out);
}

@keyframes soon-fade { from { opacity: 0; } }
@keyframes soon-in {
  from { opacity: 0; transform: translateY(12px) scale(0.985); }
}

.soon__close {
  position: absolute;
  top: var(--if-s-3);
  right: var(--if-s-3);
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  background: none;
  border-radius: var(--if-r-sm);
  color: var(--if-text-subtle);
  cursor: pointer;
  transition: color var(--if-dur-fast) var(--if-ease),
              background-color var(--if-dur-fast) var(--if-ease);
}
.soon__close svg { width: 15px; height: 15px; }
.soon__close:hover { color: var(--if-text); background: var(--if-bg-sunken); }

.soon__icon {
  width: 48px;
  height: 48px;
  margin: 0 auto var(--if-s-4);
  border-radius: var(--if-r-lg);
  display: grid;
  place-items: center;
  background: var(--if-brand-soft);
  color: var(--if-brand-ink);
}
.soon__icon svg { width: 24px; height: 24px; }

.soon__eyebrow {
  font-size: var(--if-t-xs);
  font-weight: 700;
  letter-spacing: var(--if-track-wide);
  text-transform: uppercase;
  color: var(--if-brand-ink);
  margin-bottom: var(--if-s-2);
}

.soon__title { font-size: var(--if-t-xl); }

/* El título del artículo que el lector pidió: le confirma que el clic
   se registró sobre lo que él quería, no sobre un enlace cualquiera. */
.soon__subject {
  margin-top: var(--if-s-3);
  padding: var(--if-s-3) var(--if-s-4);
  border-left: 3px solid var(--if-brand);
  border-radius: 0 var(--if-r-sm) var(--if-r-sm) 0;
  background: var(--if-bg-subtle);
  font-size: var(--if-t-base);
  font-weight: 600;
  color: var(--if-text);
  text-align: left;
  line-height: var(--if-lh-normal);
}

.soon__text {
  margin-top: var(--if-s-4);
  font-size: var(--if-t-base);
  line-height: var(--if-lh-relaxed);
  color: var(--if-text-muted);
}

.soon__actions {
  margin-top: var(--if-s-6);
  display: flex;
  flex-direction: column;
  gap: var(--if-s-2);
}

.soon__note {
  margin-top: var(--if-s-4);
  font-size: var(--if-t-xs);
  color: var(--if-text-subtle);
}

/* ==========================================================================
   9. ACCESIBILIDAD Y PREFERENCIAS
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .blog-page *,
  .blog-page *::before,
  .blog-page *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .js-reveal .reveal { opacity: 1; transform: none; }
  .card:hover,
  .btn-if:hover { transform: none; }
}

@media (prefers-contrast: more) {
  :root { --if-border: var(--if-n-400); --if-text-muted: var(--if-n-700); --if-text-subtle: var(--if-n-600); }
}

@media print {
  .filters, .to-top, .theme-toggle, .cta-diag, .news, .site-header, .site-footer { display: none !important; }
  .blog-main { padding-top: 0; }
  .blog-page { color: #000; background: #fff; }
}
