/* Kefiralia Editorial CSS
   Fichero separado para cargar DESPUES de argento_custom.css.
   Pensado para contenido CMS/editorial en Magento/Argento.
   Sin emojis, sin iconos externos, sin estilos globales agresivos.
*/

/* Tokens de marca (variables CSS).
   Usarlas en lugar de hex hardcoded permite ajustar la paleta sin tocar
   cada selector. Compatibilidad: navegadores modernos (Edge 16+, Safari 9.1+,
   Chrome 49+); en navegadores muy antiguos se ignoran y se usa el fallback. */
:root {
  --kf-color-text: #555;
  --kf-color-text-soft: #777;
  --kf-color-h1: #333;
  --kf-color-h2: #3d3d3d;
  --kf-color-h3: #46563b;
  --kf-color-accent: #587a41;
  --kf-color-accent-dark: #486832;
  --kf-color-accent-soft: #f7faf4;
  --kf-color-accent-border: #dfe9d7;
  --kf-color-rule: #ededed;
  --kf-color-card-bg: #fbfcfa;
  --kf-color-warning-border: #eadfbd;
  --kf-color-warning-bg: #fffaf0;
  --kf-color-warning-text: #7a5b20;
  /* Rating callout post-H1 (transaccionales). Dorado para estrellas
     (estándar UX de reviews) + fondo crema suave + borde acento dorado. */
  --kf-rating-star: #f5a623;
  --kf-rating-bg: #fdfaf2;
}

/* Microinteracciones globales: smooth scroll para anchors del TOC,
   y un highlight sutil cuando el H2 destino se carga via :target. */
html { scroll-behavior: smooth; }

.kf-h2:target,
.kf-h3:target {
  animation: kf-target-flash 1.4s ease-out;
}
@keyframes kf-target-flash {
  0%   { background: rgba(88, 122, 65, 0.10); }
  100% { background: transparent; }
}

/* Accesibilidad: respetar usuarios con prefers-reduced-motion (WCAG 2.3.3). */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .kf-h2:target,
  .kf-h3:target { animation: none; }
  *, *::before, *::after { transition: none !important; }
}

/* Tipografia base del editorial: system UI font stack
   (Segoe UI en Windows, San Francisco en macOS/iOS, Roboto en Android).
   Se aplica a cada clase editorial para no chocar con el resto del tema
   ni requerir un wrapper comun en el HTML. */
.kf-h1, .kf-h2, .kf-h3, .kf-intro, .kf-text, .kf-small,
ul.lista_check, ul.lista_check > li,
ol.kf-ordered, ol.kf-ordered > li,
.kf-note, .kf-note-title,
.kf-warning, .kf-warning-title,
.kf-info,
table.kf-table, table.kf-table th, table.kf-table td,
.kf-cta, .kf-btn,
.opiniones-destacadas, .opiniones-destacadas *,
.kf-toc, .kf-toc *,
details, summary {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  /* kern: kerning tipográfico; liga: ligaduras estándar; tnum: numerales tabulares
     (números del mismo ancho — útil en tablas de precios/cifras). */
  font-feature-settings: "kern", "liga", "tnum";
}

.kf-h1 {
  /* clamp(): tipo fluido entre 28px (mobile pequeño) y 36px (desktop).
     Evita saltos abruptos en breakpoints. Compatibilidad: Edge 79+, Safari 13.1+, Chrome 79+. */
  font-size: clamp(30px, 4.4vw, 40px);
  line-height: 1.18;
  color: var(--kf-color-h1);
  font-weight: 700;
  margin: 0 0 16px;
  letter-spacing: -0.01em;
  /* Sin `text-wrap: balance`: en h1 largos deja la 1ª línea sin llegar al borde
     derecho, dando sensación de que el título no ocupa todo el ancho. Layout
     normal: la línea se rompe cuando llena el contenedor (más natural). */
}

.kf-h2 {
  font-size: clamp(24px, 3.3vw, 30px);
  line-height: 1.25;
  color: var(--kf-color-h2);
  font-weight: 700;
  /* Más aire por arriba: 36px (separa visualmente las secciones). */
  margin: 36px 0 14px;
  letter-spacing: -0.005em;
  scroll-margin-top: 16px; /* anchor desde el TOC no queda pegado al borde */
  position: relative; /* para el anchor # al hover */
}

.kf-h3 {
  font-size: clamp(20px, 2.6vw, 22px);
  line-height: 1.3;
  color: var(--kf-color-h3);
  font-weight: 700;
  margin: 22px 0 12px;
  scroll-margin-top: 16px;
}

/* Anchor # discreto al hover de H2 (desktop) — permite copiar enlace a la sección.
   Solo visible cuando el H2 tiene id (es decir, está en el TOC).
   Móvil: se muestra siempre con opacidad reducida para descubribilidad táctil. */
.kf-h2[id]::before {
  content: "#";
  position: absolute;
  left: -22px;
  top: 0;
  color: var(--kf-color-accent);
  font-weight: 400;
  opacity: 0;
  transition: opacity 0.15s ease;
  text-decoration: none;
}
@media (hover: hover) {
  .kf-h2[id]:hover::before { opacity: 0.5; }
}
@media (max-width: 600px) {
  /* En mobile no hay hover; ocultamos el # para no romper layout estrecho. */
  .kf-h2[id]::before { display: none; }
}

.kf-intro {
  font-size: clamp(18px, 2vw, 20px);
  line-height: 1.75;
  color: var(--kf-color-text);
  margin: 0 0 18px;
  /* text-wrap: pretty evita líneas viudas/huérfanas en párrafos. Compat moderno. */
  text-wrap: pretty;
  /* Cepas científicas largas (Lactobacillus kefiranofaciens, ~25 chars)
     y URLs/DOIs no rompen layout en mobile estrecho. */
  overflow-wrap: break-word;
}

.kf-text {
  font-size: clamp(17px, 1.8vw, 18px);
  line-height: 1.7;
  color: var(--kf-color-text);
  margin: 0 0 14px;
  text-wrap: pretty;
  overflow-wrap: break-word;
}

/* Indice del articulo (TOC). Va tras kf-intro y antes del primer H2.
   Anchors internos a los <h2 id="..."> del cuerpo.

   Estructura HTML esperada (TOC plegable mobile-first):
     <nav class="kf-toc" aria-label="Indice del articulo">
       <details class="kf-toc-details" open>
         <summary class="kf-toc-titulo">En este articulo</summary>
         <ol class="kf-toc-lista">...</ol>
       </details>
     </nav>

   En mobile el <details> es plegable con marker +/-. En desktop está siempre
   abierto sin marker. El TOC va inline (no sticky) porque el HTML lo coloca
   en flow normal a ancho completo entre el intro y el primer H2. */
.kf-toc {
  border: 1px solid var(--kf-color-accent-border);
  background: var(--kf-color-accent-soft);
  padding: 16px 20px;
  margin: 22px 0 26px;
  box-sizing: border-box;
  border-radius: 4px;
}

/* TOC inline (no sticky): el HTML del prompt mete el .kf-toc en flow normal
   entre el intro y el primer H2, así que ocupa el ancho completo del artículo.
   Aplicar position:sticky aquí lo convierte en una barra que tapa el contenido
   al hacer scroll. Si en el futuro se introduce un layout de 2 columnas con
   sidebar, la regla sticky se reintroduce solo dentro de esa columna. */

.kf-toc-titulo {
  font-size: 15px;
  font-weight: 700;
  color: var(--kf-color-h3);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0 0 10px;
  /* Si <kf-toc-titulo> es un <summary>, se hace clicable en mobile.
     En desktop el <details open> está siempre abierto (con regla open). */
  cursor: pointer;
  list-style: none;
  position: relative;
}

/* TOC plegable: el <details> interno tiene un marker +/- en mobile,
   en desktop está siempre abierto sin marker (mejor UX en columna ancha). */
.kf-toc-details > summary.kf-toc-titulo::-webkit-details-marker { display: none; }
.kf-toc-details > summary.kf-toc-titulo::marker { content: ""; }

@media (max-width: 600px) {
  .kf-toc-details > summary.kf-toc-titulo {
    padding-right: 28px;
  }
  .kf-toc-details > summary.kf-toc-titulo::after {
    content: "+";
    position: absolute;
    right: 0; top: -2px;
    font-size: 22px;
    font-weight: 400;
    color: var(--kf-color-accent);
    line-height: 1;
    transition: transform 0.2s ease;
  }
  .kf-toc-details[open] > summary.kf-toc-titulo::after { content: "\2212"; }
}

@media (min-width: 601px) {
  /* Desktop: el <details> queda siempre abierto sin permitir cerrar. */
  .kf-toc-details > summary.kf-toc-titulo { cursor: default; }
  /* Sin "+" en desktop: el TOC ya está siempre desplegado, el indicador
     plegable solo tiene sentido en mobile. Override del summary::after general. */
  .kf-toc-details > summary.kf-toc-titulo::after { content: none; }
}

.kf-toc-lista {
  margin: 0;
  padding: 0 0 0 22px;
  list-style: decimal;
  color: #587a41;
}

.kf-toc-lista > li {
  margin: 0 0 6px;
  padding-left: 4px;
  font-size: 15px;
  line-height: 1.5;
}

.kf-toc-lista > li::marker {
  color: #587a41;
  font-weight: 700;
}

.kf-toc-link {
  color: #46563b;
  text-decoration: none;
  border-bottom: 1px dotted transparent;
  transition: border-color 0.15s ease;
}

@media (hover: hover) {
  .kf-toc-link:hover {
    color: #587a41;
    border-bottom-color: #587a41;
  }
}

.kf-toc-link:focus {
  outline: 2px solid #587a41;
  outline-offset: 2px;
}

.kf-toc-link:focus:not(:focus-visible) {
  outline: none;
}

.kf-small {
  font-size: 15px;
  line-height: 1.6;
  color: #777;
  margin: 0 0 12px;
}

/* lista_check: sin decoracion propia. Se respeta el bullet/imagen
   heredado del tema (argento_custom.css) para no duplicar icono.
   Solo se mantiene el espaciado vertical entre items. */
ul.lista_check {
  margin: 0 0 18px;
}

ul.lista_check > li {
  margin: 0 0 10px;
  font-size: 18px;
  line-height: 1.65;
  color: var(--kf-color-text);
  overflow-wrap: break-word;
}

ol.kf-ordered {
  margin: 0 0 18px;
  padding: 0;
  /* Numerales estilizados "01.", "02." con counter-reset y ::marker.
     Más editorial que los "1." default. Compat: marker styling Edge 86+. */
  counter-reset: kf-li;
  list-style: none;
}

ol.kf-ordered > li {
  position: relative;
  padding-left: 38px;
  margin-bottom: 12px;
  font-size: 18px;
  line-height: 1.7;
  color: var(--kf-color-text);
  counter-increment: kf-li;
  overflow-wrap: break-word;
}

ol.kf-ordered > li::before {
  content: counter(kf-li, decimal-leading-zero) ".";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--kf-color-accent);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.04em;
  font-feature-settings: "tnum"; /* numerales tabulares (mismo ancho) */
}

.kf-note {
  border: 1px solid var(--kf-color-accent-border);
  background: #f8fbf6;
  padding: 16px 18px 16px 48px; /* extra padding-left para el icono */
  margin: 22px 0;
  box-sizing: border-box;
  border-radius: 4px;
  position: relative;
}
.kf-note::before {
  /* Icono SVG check (✓) inline como background data-URI. Color = --kf-color-accent. */
  content: "";
  position: absolute;
  left: 16px; top: 18px;
  width: 20px; height: 20px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23587a41' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='20 6 9 17 4 12'/></svg>");
  background-repeat: no-repeat;
  background-size: contain;
}

.kf-note-title {
  color: var(--kf-color-h3);
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 8px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.kf-warning {
  border: 1px solid var(--kf-color-warning-border);
  background: var(--kf-color-warning-bg);
  padding: 16px 18px 16px 48px;
  margin: 22px 0;
  box-sizing: border-box;
  border-radius: 4px;
  position: relative;
}
.kf-warning::before {
  /* Icono SVG triángulo de advertencia (⚠) inline. Color = --kf-color-warning-text. */
  content: "";
  position: absolute;
  left: 16px; top: 18px;
  width: 20px; height: 20px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237a5b20' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><path d='M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z'/><line x1='12' y1='9' x2='12' y2='13'/><line x1='12' y1='17' x2='12.01' y2='17'/></svg>");
  background-repeat: no-repeat;
  background-size: contain;
}

.kf-warning-title {
  color: var(--kf-color-warning-text);
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 8px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.kf-info {
  border-left: 4px solid var(--kf-color-accent);
  background: var(--kf-color-card-bg);
  padding: 14px 18px 14px 48px;
  margin: 22px 0;
  box-sizing: border-box;
  border-radius: 0 4px 4px 0;
  position: relative;
}
.kf-info::before {
  /* Icono SVG ⓘ inline (info circle). */
  content: "";
  position: absolute;
  left: 16px; top: 14px;
  width: 22px; height: 22px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23587a41' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='10'/><line x1='12' y1='16' x2='12' y2='12'/><line x1='12' y1='8' x2='12.01' y2='8'/></svg>");
  background-repeat: no-repeat;
  background-size: contain;
}

/* === Pull quote (Tier 2): cita destacada editorial sutil ===
   Uso: <blockquote class="kf-pullquote">cita...</blockquote>
   Para destacar afirmación principal, cita científica o frase potente. */
.kf-pullquote {
  border-left: 3px solid var(--kf-color-accent);
  padding: 10px 0 10px 22px;
  margin: 28px 0;
  font-size: clamp(17px, 2.2vw, 20px);
  line-height: 1.5;
  color: var(--kf-color-h2);
  font-style: italic;
  font-weight: 500;
}
.kf-pullquote > * { margin: 0; }

/* === Imágenes (hero + intra-artículo) ===
   El prompt_formato_html.md emite <figure class="kf-hero"> para la cabecera
   y <figure class="kf-figura"> para imágenes intra-artículo. El <img> trae
   width/height explícitos para evitar CLS. Aquí evitamos overflow horizontal,
   centramos y damos un radio sutil. */
.kf-hero,
.kf-figura {
  margin: 24px 0;
  text-align: center;
}
.kf-hero img,
.kf-figura img {
  /* Desktop: hero 70%, intra 50% (más estrecha porque es 4:5 vertical y
     dominaba el flujo de lectura). Mobile (<600px) pasa a 100% más abajo. */
  height: auto;
  display: block;
  margin: 0 auto;
  border-radius: 4px;
}
.kf-hero img { max-width: 70%; }
.kf-figura img { max-width: 50%; }
.kf-figcaption {
  font-size: 13px;
  color: var(--kf-color-text-soft);
  text-align: center;
  margin-top: 10px;
  font-style: italic;
  line-height: 1.5;
}

/* === Bibliografía discreta al final del artículo (citas científicas) ===
   Se emite como <aside class="kf-references"> tras el FAQ y kf-cta, antes de los
   comentarios de cierre. Tipografía pequeña + color suave + separación clara para
   que NO compita visualmente con el cuerpo del artículo. */
.kf-references {
  margin: 32px 0 8px;
  padding: 16px 18px;
  border-top: 1px solid var(--kf-color-rule);
  border-bottom: 0;
  background: transparent;
  font-size: 13px;
  line-height: 1.5;
  color: var(--kf-color-text-soft);
}
.kf-references-titulo {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--kf-color-text-soft);
  margin: 0 0 10px;
}
.kf-references-lista {
  margin: 0;
  padding: 0 0 0 22px;
  list-style: decimal;
}
.kf-references-lista > li {
  margin: 0 0 6px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--kf-color-text-soft);
  overflow-wrap: break-word;
}
.kf-references-lista > li > cite {
  font-style: italic;
  color: var(--kf-color-text);
}

/* === Focus visible accesible (Tier 1): outline solo cuando navegas con teclado === */
.kf-toc-link:focus-visible,
.kf-btn:focus-visible,
summary:focus-visible,
.kf-h2[id]:focus-visible {
  outline: 2px solid var(--kf-color-accent);
  outline-offset: 3px;
  border-radius: 2px;
}
/* Quitamos outline cuando el foco viene de click/tap (no teclado). */
.kf-toc-link:focus:not(:focus-visible),
.kf-btn:focus:not(:focus-visible),
summary:focus:not(:focus-visible) {
  outline: none;
}

.kf-table-wrap {
  overflow-x: auto;
  border: 1px solid #e6e6e6;
  margin: 18px 0;
  box-sizing: border-box;
  /* Indicador visual de scroll horizontal (tecnica de Lea Verou):
     sombras a izq/der que aparecen solo cuando hay contenido oculto. */
  background:
    linear-gradient(to right, #fff 30%, rgba(255,255,255,0)),
    linear-gradient(to right, rgba(255,255,255,0), #fff 70%) right,
    radial-gradient(farthest-side at 0 50%, rgba(0,0,0,.08), rgba(0,0,0,0)),
    radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,.08), rgba(0,0,0,0)) right;
  background-repeat: no-repeat;
  background-size: 30px 100%, 30px 100%, 14px 100%, 14px 100%;
  background-attachment: local, local, scroll, scroll;
}

table.kf-table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: 15px;
}

table.kf-table th {
  background: #f7faf4;
  color: #46563b;
  font-weight: 700;
  text-align: left;
  padding: 12px;
  border-bottom: 1px solid #e6e6e6;
}

table.kf-table td {
  padding: 12px;
  color: #555;
  border-bottom: 1px solid #f0f0f0;
  line-height: 1.6;
  vertical-align: top;
}

table.kf-table tr:last-child td {
  border-bottom: 0;
}

.kf-cta {
  border: 1px solid #dbe7d3;
  background: #f7faf4;
  padding: 20px;
  margin: 20px 0;
  box-sizing: border-box;
}

.kf-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #587a41;
  color: #fff;
  padding: 12px 22px;
  min-height: 44px;       /* tap target accesible (WCAG 2.5.5) */
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  margin-top: 6px;
  border: 0;
  cursor: pointer;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;  /* sin destello azul iOS */
}

/* Hover solo en dispositivos con puntero real (evita estado pegado en touch).
   Background-color en vez de filter brightness para compat IE11/Opera Mini. */
@media (hover: hover) {
  .kf-btn:hover {
    color: #fff;
    text-decoration: none;
    background: #486832;
  }
}

.kf-btn:active {
  color: #fff;
  text-decoration: none;
  background: #3e5a2c;
}

/* Foco visible para teclado/lectores. Doble regla por compat con Safari < 15.4
   (que no soporta :focus-visible). */
.kf-btn:focus,
summary:focus {
  outline: 2px solid #587a41;
  outline-offset: 2px;
}

.kf-btn:focus:not(:focus-visible),
summary:focus:not(:focus-visible) {
  outline: none;
}

/* FAQ con <details>/<summary> nativos (HTML5, sin JS).
   Estructura del nuevo HTML:
     <details>
       <summary><h2 class="kf-h2">¿pregunta?</h2></summary>
       <p class="kf-text">respuesta</p>
     </details>
   El <h2> dentro de <summary> mantiene jerarquía SEO + UX acordeón.
   Requiere TinyMCE: extended_valid_elements: "details[open|class|id],summary[class|id]"
*/
details {
  border-top: 1px solid var(--kf-color-rule);
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

details:last-of-type {
  border-bottom: 1px solid var(--kf-color-rule);
}

summary {
  cursor: pointer;
  padding: 16px 36px 16px 0;
  position: relative;
  list-style: none;
  /* Color/font genérico solo se aplica si el summary NO contiene un <h2> dentro
     (compat con FAQ legacy en plain text). Para el patrón nuevo, el <h2> manda. */
  color: var(--kf-color-h3);
  font-weight: 700;
  font-size: 18px;
  line-height: 1.45;
}

summary::-webkit-details-marker { display: none; }
summary::marker { content: ""; }

summary::after {
  content: "+";
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 26px;
  font-weight: 400;
  color: var(--kf-color-accent);
  line-height: 1;
}

details[open] summary::after {
  content: "\2212";
}

/* H2 dentro del summary (patrón nuevo del FAQ): hereda comportamiento clicable
   del summary; quitamos su margin-top porque el padding del summary ya lo da.
   Tamaño un poco menor que un H2 normal del cuerpo (más adecuado para FAQ items). */
summary > .kf-h2 {
  display: inline;
  margin: 0;
  font-size: clamp(17px, 2.2vw, 19px);
  line-height: 1.4;
  color: var(--kf-color-h2);
  letter-spacing: 0;
  /* Anchor # del H2 normal NO aplica aquí (el FAQ no entra en TOC).
     Override del ::before para evitar que aparezca el # */
}
summary > .kf-h2::before { content: none !important; }

@media (hover: hover) {
  summary:hover > .kf-h2 { color: var(--kf-color-accent); }
}

/* Hijos del details que no son summary (respuesta del FAQ): margin-top y
   padding inferior. El padding del summary ya da el aire de arriba. */
details > *:not(summary) {
  margin-top: 14px;
  padding-bottom: 16px;
}

@media print {
  details > * { display: block !important; }
  summary::after { display: none; }
}

/* Separador editorial decorativo — línea fina con punto verde de marca al
   centro. Uso: en transaccional, antes y después del bloque Magento de
   productos ({{block type="catalog/product_list"}}). Marca la transición
   visual entre grid de productos y cuerpo SEO. Sin texto, decorativo.
   NO usar en informacional. */
.kf-divider-dot {
  margin: 28px auto;
  width: 100%;
  height: 14px;
  position: relative;
  border: 0;
  background: transparent;
}
.kf-divider-dot::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--kf-color-rule);
}
.kf-divider-dot::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--kf-color-accent);
}

.opiniones-destacadas,
.opiniones-destacadas * {
  box-sizing: border-box;
}

.opiniones-destacadas {
  border: 1px solid #e6e6e6;
  background: #fff;
  padding: 14px 16px;
  margin: 16px 0;
}

.opiniones-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  /* Sin gap: los 2 hijos quedan separados por space-between en desktop.
     En mobile (column) se suple con margin-top en el segundo hijo. */
  border-bottom: 1px solid #ededed;
  padding-bottom: 10px;
  margin-bottom: 12px;
}

.opiniones-header-titulo {
  font-size: 19px;
  line-height: 1.25;
  color: #3d3d3d;
  font-weight: 700;
  margin: 0;
}

.opiniones-header-resumen {
  text-align: right;
  font-size: 13px;
  color: #777;
  flex-shrink: 0;
}

.opiniones-header-nota {
  display: block;
  font-size: 22px;
  font-weight: 700;
  color: #333;
  line-height: 1;
}

/* Estrellas: tamaño explícito por contexto, no heredado del contenedor.
   Header: visualmente alineadas con la nota grande (26px).
   Card: legibles dentro del footer compacto. */
.opiniones-header-estrellas,
.opinion-estrellas {
  color: #f2b01e;
  letter-spacing: 2px;
  white-space: nowrap;
}

.opiniones-header-estrellas {
  display: block;
  font-size: 20px;
  margin-top: 4px;
  line-height: 1;
}

.opinion-estrellas {
  font-size: 16px;
  line-height: 1;
}

.opiniones-header-count {
  display: block;
  margin-top: 4px;
}

.opiniones-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.opinion-card {
  border: 1px solid #e4eadf;
  background: #fbfcfa;
  padding: 13px 14px;
  min-width: 0;
  display: flex;
  flex-direction: column;   /* footer/nombre/verificada al pie con margin-top:auto */
}

/* Si la ultima card cae sola en su fila (numero impar de cards),
   ocupa ancho completo para no dejar hueco a la derecha. */
.opiniones-grid > .opinion-card:nth-child(odd):last-child {
  grid-column: 1 / -1;
}

.opinion-card-titulo {
  color: #46563b;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
}

.opinion-burbuja {
  font-size: 15px;
  line-height: 1.6;
  color: #555;
  margin-bottom: 12px;
}

.opinion-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  /* Sin gap: 2 hijos con space-between. Mobile usa column + margin. */
  font-size: 12px;
  margin-bottom: 4px;
  margin-top: auto;          /* empuja footer + nombre + verificada al pie de la card */
}

.opinion-nota {
  color: #666;
  font-weight: 700;
  white-space: nowrap;
}

.opinion-nombre {
  font-size: 13px;
  font-weight: 700;
  color: #444;
}

.opinion-verificada {
  font-size: 12px;
  color: #666;        /* AA WCAG sobre #fbfcfa (5.7:1) */
  margin-top: 3px;
}

@media only screen and (max-width: 600px) {
  .opiniones-grid {
    grid-template-columns: 1fr;
  }

  .opiniones-header {
    align-items: flex-start;
    flex-direction: column;
  }

  /* Sustituye al gap flex (no soportado en Safari iOS < 14.5). */
  .opiniones-header > * + * {
    margin-top: 10px;
  }

  .opiniones-header-resumen {
    text-align: left;
  }
}

@media only screen and (max-width: 600px) {
  /* En mobile, los tipos ya escalan via clamp(); estos overrides solo
     ajustan line-height y separación. */
  .kf-h1 { line-height: 1.22; margin-bottom: 14px; }
  .kf-h2 { line-height: 1.28; margin: 28px 0 12px; }
  .kf-h3 { line-height: 1.35; margin: 20px 0 10px; }
  .kf-intro { line-height: 1.7; }
  .kf-text,
  ul.lista_check > li,
  ol.kf-ordered > li { line-height: 1.7; }

  /* Hyphens auto solo en mobile (justifica mejor texto largo). */
  .kf-intro,
  .kf-text {
    hyphens: auto;
    -webkit-hyphens: auto;
  }

  /* === Margen lateral mobile ===
     En mobile el contenedor Magento (.col-main) no aplica padding lateral
     suficiente y el texto editorial se pega a los bordes de la pantalla.
     Necesitamos `!important` porque Argento `styles.css` tiene reglas más
     específicas tipo `.std p { padding: 0 }` (0,1,1) que ganan sobre nuestro
     `.kf-text` (0,1,0). Y `custom.css` tiene `.lista_check { margin-left: 15% }`
     sin !important que también puede ganar dependiendo del orden de carga
     del bundle. !important asegura que el override funcione siempre. */
  .kf-h1, .kf-h2, .kf-h3,
  .kf-intro, .kf-text, .kf-small,
  .kf-pullquote,
  details {
    padding-inline: 16px !important;
  }

  ul.lista_check, ol.kf-ordered {
    margin-inline: 16px !important;
    padding-inline-end: 16px !important;
  }

  .kf-note,
  .kf-warning,
  .kf-info,
  .kf-cta,
  .opiniones-destacadas,
  .kf-references,
  .kf-toc,
  .kf-table-wrap,
  .kf-hero,
  .kf-figura {
    margin-inline: 16px !important;
  }

  /* En mobile las imágenes pasan a full-width (no sobra ancho que limitar). */
  .kf-hero img,
  .kf-figura img {
    max-width: 100% !important;
  }

  .kf-note,
  .kf-warning,
  .kf-info,
  .kf-cta,
  .opiniones-destacadas {
    padding: 14px;
    margin: 18px 16px;
  }
  .kf-note,
  .kf-warning,
  .kf-info { padding-left: 44px; } /* mantener espacio para el icono */
  .kf-note::before,
  .kf-warning::before,
  .kf-info::before { left: 14px; top: 16px; width: 18px; height: 18px; }

  /* === Tablas modo CARD en móvil ===
     En móvil cada <tr> se renderiza como una tarjeta vertical apilada,
     y cada <td> muestra arriba su label (extraído de data-label="...").
     Requiere que el HTML tenga data-label en cada <td>. Si falta,
     el modo card sigue funcionando pero sin labels (degradación graceful).
     Sustituye al scroll horizontal en pantallas estrechas: más usable. */
  table.kf-table thead { display: none; }
  table.kf-table,
  table.kf-table tbody,
  table.kf-table tr,
  table.kf-table td {
    display: block;
    width: 100%;
    min-width: 0;
  }
  table.kf-table tr {
    margin: 0 0 14px;
    border: 1px solid var(--kf-color-accent-border);
    background: var(--kf-color-card-bg);
    padding: 4px 0;
    box-sizing: border-box;
  }
  table.kf-table tr:last-child { margin-bottom: 0; }
  table.kf-table td {
    padding: 10px 14px;
    border-bottom: 1px dashed #e8ede4;
    position: relative;
  }
  table.kf-table tr td:last-child { border-bottom: 0; }
  table.kf-table td::before {
    content: attr(data-label);
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--kf-color-accent);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 4px;
  }
  /* Si el td no tiene data-label, evitamos que aparezca un ":" suelto */
  table.kf-table td:not([data-label])::before { content: none; }

  /* El wrap pierde el scroll horizontal y los gradients indicadores;
     la card-mode los hace innecesarios. */
  .kf-table-wrap {
    overflow: visible;
    border: 0;
    background: none;
  }

  .kf-btn {
    display: flex;             /* full width sobre inline-flex */
    width: 100%;
    padding: 14px 18px;
    font-size: 16px;
  }

  .opiniones-header-titulo {
    font-size: 18px;
  }

  .opiniones-header-nota {
    font-size: 22px;
  }

  .opinion-card-titulo {
    font-size: 16px;
  }

  .opinion-burbuja {
    font-size: 15px;
    line-height: 1.6;
  }

  .opinion-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  /* Sustituye al gap flex en mobile column. */
  .opinion-footer > * + * {
    margin-top: 4px;
  }

  summary {
    font-size: 17px;
    line-height: 1.5;
    padding: 4px 32px 4px 0;
  }

  details {
    padding: 16px 0;
  }
}

@media only screen and (max-width: 380px) {
  .kf-h1 {
    font-size: 28px;
  }

  .kf-h2 {
    font-size: 23px;
  }

  .kf-h3 {
    font-size: 19px;
  }

  .kf-intro {
    font-size: 18px;
  }
}

/* === Rating callout post-H1 (`<aside class="kf-rating-callout">`) ===
   Solo se inyecta en transaccionales por el generador (Python) tras el </h1>.
   Lleva la valoración global de la categoría Magento + anchor a la zona
   `#opiniones-destacadas`. Datos canónicos en datos_opiniones.json. */
.kf-rating-callout {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.55em 0.7em;
  margin: 0.2em 0 1.8em 0;
  padding: 10px 14px;
  background: var(--kf-rating-bg);
  border-left: 3px solid var(--kf-rating-star);
  border-radius: 3px;
  font-size: 0.95em;
}
.kf-rating-stars {
  color: var(--kf-rating-star);
  letter-spacing: 1px;
  font-size: 1.05em;
  line-height: 1;
}
.kf-rating-nota {
  font-weight: 700;
  font-size: 1.18em;
  color: var(--kf-color-h1);
  font-feature-settings: "tnum"; /* numerales tabulares (mismo ancho) */
}
.kf-rating-text {
  color: var(--kf-color-text);
}
.kf-rating-text strong {
  color: var(--kf-color-h2);
  font-weight: 600;
}
.kf-rating-link {
  margin-left: auto;
  color: var(--kf-color-accent);
  text-decoration: underline;
  font-size: 0.92em;
}
.kf-rating-link:hover {
  text-decoration: none;
  color: var(--kf-color-accent-dark);
}
@media (max-width: 520px) {
  .kf-rating-callout {
    font-size: 0.92em;
    padding: 9px 12px;
  }
  .kf-rating-link {
    margin-left: 0;
    flex: 1 0 100%;
    padding-top: 2px;
  }
}
