/* ============================================================================
   SEPTIGENESIS — FRAMEWORK COMPARTIDO DE FICHAS INTERACTIVAS
   ficha.css — estilos unificados teal / navy / Poppins  ·  edición PREMIUM
   ----------------------------------------------------------------------------
   Paleta oficial (septigenesis.com):
     Teal primario  : #00a99d
     Navy headings  : #143e6b
     Fuente         : Poppins (fallback Barlow / Open Sans)
   Contraste: todos los textos cumplen WCAG AA (>= 4.5:1 texto normal).
   RTL: `body.rtl` invierte dirección para árabe (propiedades lógicas).
   ----------------------------------------------------------------------------
   NOTA DE CONTRATO: este archivo es puramente estético. NO se modifican los
   IDs ni las clases que `ficha.js` requiere (queso-slice, panel, modal-*,
   func-group-*, full-*, etc.). Todo lo nuevo es aditivo (::before/::after,
   variables, capas decorativas). No rompe ninguna de las 7 fichas.
   ----------------------------------------------------------------------------
   WCAG 2.2 AA — parche accesibilidad 2026-07-04
   • Chips dinámicos (.chip, .strain-chip, .func-tag, .panel-tag): los
     colores de genus/función se usan como texto sobre blanco. Los géneros
     con colores claros (#00a99d 3.09:1, #008b80 3.63:1, #0d7d74 4.34:1,
     #1f6feb 4.35:1) se oscurecen vía .chip-dark-text para lograr ≥4.5:1.
   • focus-visible reforzado en todos los interactivos.
   • panel-close min 44×44 táctil (ya superaba 24 CSS px; se amplía hit area).
   • Estilos para aria-expanded en lang-btn.
   ============================================================================ */

:root {
  --teal:        #00a99d;
  --teal-dark:   #007a71;   /* AA sobre blanco: 4.5:1+ para texto pequeño */
  --teal-tint:   #e6f6f5;   /* fondo suave */
  --teal-glow:   rgba(0,169,157,.28);
  --navy:        #143e6b;
  --navy-dark:   #0e2d4f;
  --navy-deep:   #0a2340;   /* extremo del gradiente hero */
  --navy-tint:   #eaf0f7;
  --cyan:        #7ae8e3;   /* acento claro (septigenesis.com) */
  --ink:         #2a2f38;   /* texto principal (11.6:1 sobre blanco) */
  --ink-soft:    #55606f;   /* texto secundario (5.3:1 sobre blanco) */
  --ink-faint:   #6b7280;   /* solo texto grande/decorativo */
  --line:        #e2e8ec;
  --line-soft:   #eef3f5;
  --bg:          #f4f9f9;   /* fondo página, teal muy suave */
  --surface:     #ffffff;
  --danger:      #b3261e;   /* rojo AA para errores */
  --danger-tint: #fdecea;
  --gold:        #c9963a;   /* acento cálido puntual (desbloqueo) */
  --gold-dark:   #a97a24;
  --radius-xl:   22px;
  --radius-lg:   16px;
  --radius-md:   12px;
  --radius-sm:   8px;
  --shadow-xs:   0 1px 3px rgba(20, 62, 107, .06);
  --shadow-md:   0 6px 24px rgba(20, 62, 107, .09);
  --shadow-lg:   0 18px 48px rgba(20, 62, 107, .20);
  --shadow-hero: 0 20px 60px rgba(10, 35, 64, .34);
  --ring:        0 0 0 3px rgba(0,169,157,.30);
  --font: 'Poppins', 'Barlow', 'Open Sans', 'Segoe UI', Tahoma, sans-serif;
  --ease:  cubic-bezier(.16, 1, .3, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* ------------------------------------------------------- Atmósfera de página
   Patrón sutil de "moléculas" en radiales muy tenues para dar sensación de
   página de producto científico sin imágenes externas. Fijo, no distrae. */
body.ficha {
  font-family: var(--font);
  color: var(--ink);
  padding: 20px 16px 28px;
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 12% 8%,  rgba(0,169,157,.10) 0, transparent 42%),
    radial-gradient(circle at 88% 4%,  rgba(20,62,107,.09) 0, transparent 38%),
    radial-gradient(circle at 78% 82%, rgba(0,169,157,.07) 0, transparent 46%);
  background-attachment: fixed;
}
body.ficha > * { position: relative; }
/* Contenedor visual: centra el contenido en pantallas anchas (look producto) */
body.ficha > .ficha-back,
body.ficha > header,
body.ficha > section,
body.ficha > .unlock-bar,
body.ficha > footer {
  max-width: 720px;
  margin-inline: auto;
}
body.ficha.rtl { direction: rtl; }

/* ---------------------------------------------------------------- Back link */
.ficha-back {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--navy); text-decoration: none;
  font-weight: 600; margin-bottom: 14px;
  padding: 6px 12px 6px 10px;
  background: rgba(255,255,255,.7);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-xs);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), color .15s;
  backdrop-filter: blur(6px);
}
.ficha-back:hover { color: var(--teal-dark); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.ficha-back:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
body.ficha.rtl .ficha-back { flex-direction: row-reverse; }

/* ------------------------------------------------------------------- Header
   Banda hero tipo página de producto: gradiente teal→navy, halo decorativo,
   franja de acento inferior. Logo integrado en "pastilla" clara.
   ACCESIBILIDAD 2026-07-04: overflow cambiado a visible para que el menú
   desplegable de idioma no quede recortado. El pseudo-elemento ::before
   lleva border-radius: inherit para auto-recortarse en las esquinas. */
.ficha-header {
  position: relative;
  /* FIX BUG6: el header crea contexto de apilamiento (z-index:100) para que
     el .lang-menu flote SOBRE la rueda/torta. Antes el header no tenía z-index,
     así que la rueda (en otro contexto) tapaba el dropdown. 100 < 600 (modales),
     por lo que los modales siguen cubriendo el header correctamente. */
  z-index: 100;
  overflow: visible;           /* FIX: era overflow:hidden; recortaba .lang-menu */
  background:
    radial-gradient(120% 160% at 100% 0%, rgba(0,169,157,.55) 0, transparent 55%),
    linear-gradient(135deg, var(--navy) 0%, var(--navy-dark) 55%, var(--navy-deep) 100%);
  border-radius: var(--radius-xl);
  padding: 22px 22px 24px;
  margin-bottom: 18px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  box-shadow: var(--shadow-hero);
  border: 1px solid rgba(255,255,255,.06);
}
/* Patrón de "burbujas/moléculas" decorativo — sin imágenes externas.
   border-radius + overflow:hidden propios para que se recorte él mismo
   sin afectar al dropdown del idioma. */
.ficha-header::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  border-radius: inherit;      /* FIX: se recorta solo en las esquinas */
  overflow: hidden;
  background-image:
    radial-gradient(circle at 18% 120%, rgba(122,232,227,.16) 0, transparent 26%),
    radial-gradient(circle 3px at 78% 26%, rgba(255,255,255,.20) 0, transparent 100%),
    radial-gradient(circle 2px at 88% 62%, rgba(122,232,227,.35) 0, transparent 100%),
    radial-gradient(circle 2px at 66% 78%, rgba(255,255,255,.18) 0, transparent 100%),
    radial-gradient(circle 4px at 94% 20%, rgba(0,169,157,.30)  0, transparent 100%);
}
/* Línea de acento teal→cyan al pie del hero.
   border-radius inferior para que no sobresalga de las esquinas del header. */
.ficha-header::after {
  content: ""; position: absolute; inset-inline: 0; bottom: 0; height: 3px;
  background: linear-gradient(90deg, var(--teal), var(--cyan), var(--teal));
  opacity: .9;
  border-radius: 0 0 var(--radius-xl) var(--radius-xl); /* FIX: recorta esquinas */
}
.ficha-header > * { position: relative; z-index: 1; }

.ficha-logo {
  height: 46px; width: auto; display: block; flex-shrink: 0;
  padding: 7px 11px; border-radius: 12px;
  background: rgba(255,255,255,.96);
  box-shadow: 0 4px 14px rgba(0,0,0,.18);
}
.ficha-header-titles { min-width: 0; }
.ficha-title {
  color: #ffffff; font-weight: 700; font-size: 22px; letter-spacing: .2px;
  line-height: 1.15; text-shadow: 0 1px 10px rgba(0,0,0,.28);
}
.ficha-title .accent { color: var(--cyan); }
.ficha-sub {
  color: #cfe2ee; font-size: 12px; margin-top: 5px; font-weight: 500;
  letter-spacing: .2px;
}

.ficha-header-right {
  margin-inline-start: auto;
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}

/* -------------------------------------------------------- Toggle vista btns
   Segmentos tipo "chips" con estado activo teal sólido. */
.ficha-toggle {
  background: rgba(255,255,255,.08); color: #eafffb;
  border: 1.5px solid rgba(122,232,227,.55); border-radius: 999px;
  padding: 8px 15px; cursor: pointer;
  font-family: var(--font); font-size: 12.5px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background .18s var(--ease), color .15s, border-color .15s, transform .12s;
  backdrop-filter: blur(4px);
}
.ficha-toggle:hover { background: rgba(0,169,157,.28); border-color: var(--cyan); transform: translateY(-1px); }
.ficha-toggle.active {
  background: var(--teal); color: #04231f; border-color: var(--teal);
  box-shadow: 0 4px 14px rgba(0,169,157,.45); font-weight: 700;
}
/* ACCESIBILIDAD: indicador visual adicional para el toggle activo
   (check mark en pseudo-elemento, como refuerzo no-color del estado).
   Aria-pressed lo gestiona ficha.js. */
.ficha-toggle[aria-pressed="true"]::after {
  content: "";
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #04231f;
  margin-inline-start: 4px;
  opacity: .6;
}
.ficha-toggle:focus-visible { outline: 3px solid #ffffff; outline-offset: 2px; }

/* -------------------------------------------------------------- Lang picker
   FIX BUG VISUAL: .lang-wrap tiene z-index alto para que el menú flote
   por encima de la torta/queso y demás elementos. .lang-menu sube a z-index
   1000 y tiene max-height + overflow-y:auto para los 9 idiomas en pantallas
   pequeñas. En móvil la posición se ajusta para no salirse de la ventana.
   ACCESIBILIDAD: lang-btn expone aria-expanded (actualizado por JS).
   lang-arrow rota 180° cuando el menú está abierto (indicador visual). */
.lang-wrap { position: relative; z-index: 200; }
.lang-btn {
  background: rgba(255,255,255,.12);
  border: 1.5px solid rgba(255,255,255,.42);
  border-radius: 999px; padding: 8px 13px; cursor: pointer;
  color: #ffffff; font-family: var(--font); font-size: 12.5px; font-weight: 600;
  display: flex; align-items: center; gap: 7px;
  transition: background .18s var(--ease), border-color .15s, transform .12s;
  backdrop-filter: blur(4px);
}
.lang-btn:hover { background: rgba(255,255,255,.22); border-color: rgba(255,255,255,.7); transform: translateY(-1px); }
.lang-btn:focus-visible { outline: 3px solid #ffffff; outline-offset: 2px; }
/* Flecha rota 180° cuando el menú está abierto (aria-expanded=true) */
.lang-arrow { font-size: 9px; opacity: .85; display: inline-block; transition: transform .18s var(--ease); }
.lang-btn[aria-expanded="true"] .lang-arrow { transform: rotate(180deg); }
.lang-menu {
  position: absolute; top: calc(100% + 8px); inset-inline-end: 0;
  background: var(--surface); border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 1000;              /* FIX: por encima de torta y hero */
  min-width: 182px;
  max-height: 320px;          /* FIX: scrolleable si no cabe en pantalla pequeña */
  overflow-y: auto;
  display: none; border: 1px solid var(--line);
  animation: menuIn .16s var(--ease);
}
@keyframes menuIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.lang-menu.show { display: block; }
.lang-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 11px 15px; background: var(--surface); border: none; cursor: pointer;
  font-family: var(--font); font-size: 13px; color: var(--ink);
  border-bottom: 1px solid var(--line-soft); text-align: start;
  transition: background .12s, padding-inline-start .14s var(--ease);
  /* Objetivo táctil mínimo 44px alto en móvil (SC 2.5.8) */
  min-height: 44px;
}
.lang-item:last-child { border-bottom: none; }
.lang-item:hover { background: var(--teal-tint); padding-inline-start: 18px; }
.lang-item.active { background: var(--teal-tint); font-weight: 700; color: var(--navy); }
.lang-item:focus-visible { outline: 2px solid var(--navy); outline-offset: -2px; }
.lang-item .flag { font-size: 18px; line-height: 1; }
.lang-item .check { margin-inline-start: auto; color: var(--teal-dark); font-weight: 700; }

/* FIX MÓVIL: en pantallas pequeñas el menú puede salirse por la derecha;
   se alinea a la izquierda del botón si queda fuera de la vista. */
@media (max-width: 380px) {
  .lang-menu { inset-inline-end: auto; inset-inline-start: 0; }
}

/* -------------------------------------------------------------- Instruction */
.ficha-instruction {
  font-size: 13px; color: var(--ink-soft); text-align: center;
  margin: 4px auto 16px; max-width: 460px; font-weight: 500;
}

/* ------------------------------------------------------------- Torta/queso
   Enmarcada en una tarjeta limpia con halo teal para que "respire". */
.queso-wrap {
  display: flex; flex-direction: column; align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 26px 20px 22px;
  box-shadow: var(--shadow-md);
  position: relative; overflow: hidden;
}
/* Halo radial detrás de la torta */
.queso-wrap::before {
  content: ""; position: absolute; top: -10%; left: 50%; transform: translateX(-50%);
  width: 460px; height: 460px; max-width: 120%; pointer-events: none;
  background: radial-gradient(circle, rgba(0,169,157,.09) 0, transparent 62%);
}
.queso-circle {
  position: relative; width: 400px; height: 400px; max-width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 50%; overflow: hidden; touch-action: manipulation;
  z-index: 1;
  box-shadow:
    0 0 0 10px rgba(255,255,255,.9),
    0 0 0 11px var(--line),
    0 14px 40px rgba(20,62,107,.16);
}
.queso-slice {
  position: absolute; cursor: pointer;
  transition: filter .18s var(--ease), opacity .18s var(--ease);
  pointer-events: auto;
}
.queso-slice:hover { filter: brightness(1.1) saturate(1.05); }
.queso-slice.dimmed { opacity: .38; }
.queso-slice:focus-visible { outline: 3px solid var(--navy); outline-offset: -3px; }
.queso-slice-emoji {
  position: absolute; font-size: 15px; transform: translate(-50%,-50%);
  pointer-events: none; user-select: none; text-shadow: 0 1px 3px rgba(0,0,0,.5);
}
.queso-slice-label {
  position: absolute; font-size: 6.8px; font-weight: 600; color: #fff;
  transform: translate(-50%,-50%); pointer-events: none; user-select: none;
  text-align: center; width: 74px; line-height: 1.1;
  text-shadow: 0 1px 2px rgba(0,0,0,.6);
}
/* REDISEÑO: nombre (abreviado) escrito RADIALMENTE sobre cada segmento. La
   rotación se pasa inline; aquí solo tipografía + contraste. `.on-light` para
   segmentos de color claro (texto navy), `.is-sel` agranda el seleccionado. */
.queso-slice-name {
  position: absolute; transform-origin: center center;
  font-size: clamp(6px, 1.7vw, 9px); font-weight: 700; font-style: italic;
  color: #fff; white-space: nowrap; pointer-events: none; user-select: none;
  letter-spacing: .1px; text-shadow: 0 1px 2px rgba(0,0,0,.55);
  transition: font-size .18s var(--ease);
}
.queso-slice-name.on-light { color: var(--navy); text-shadow: 0 1px 2px rgba(255,255,255,.6); }
.queso-slice-name.is-sel { font-size: clamp(7px, 2vw, 11px); font-weight: 800; }
.queso-center {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: 122px; height: 122px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--navy) 0, var(--navy-deep) 100%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  pointer-events: none; z-index: 5; text-align: center;
  box-shadow: 0 6px 20px rgba(10,35,64,.5), inset 0 0 0 1px rgba(122,232,227,.25);
}
.queso-center-title { color: var(--cyan); font-weight: 800; font-size: 13px; letter-spacing: .6px; }
.queso-center-sub {
  color: #fff; font-size: 20px; font-weight: 800; margin-top: 1px; line-height: 1;
}
.queso-center-tag { color: #a9c6d6; font-size: 9px; margin-top: 4px; padding: 0 6px; font-weight: 500; }
/* REDISEÑO (req. b): al seleccionar, el centro crece y entra con un "pop"
   para que el nombre completo se lea grande y sea el foco visual. */
.queso-center-sel {
  padding: 6px; box-sizing: border-box;
  width: 140px; height: 140px;
  animation: centerPop .34s cubic-bezier(.2, 1.05, .3, 1);
}
.queso-center-emoji { font-size: clamp(18px, 5vw, 24px); line-height: 1; }
/* El nombre completo del género (ej. "Rhodopseudomonas spp.") se muestra GRANDE
   dentro del círculo central: font-size fluido, corte de palabra y ancho acotado. */
.queso-center-sel-name {
  color: #fff; font-size: clamp(10px, 3.3vw, 14px); font-weight: 800; font-style: italic;
  text-align: center; line-height: 1.14; margin-top: 5px;
  padding: 0 5px; max-width: 100%; box-sizing: border-box;
  overflow-wrap: break-word; word-break: break-word; hyphens: auto;
}
@keyframes centerPop {
  from { transform: translate(-50%, -50%) scale(.72); opacity: 0; }
  to   { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* ------------------------------------------------------------------ Legend */
.legend {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 12px;
  margin-top: 18px; padding: 14px 12px 2px; z-index: 1;
  border-top: 1px dashed var(--line);
  width: 100%;
}
.legend-item {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; background: var(--bg);
  border: 1px solid var(--line-soft);
  /* REDISEÑO: la leyenda ahora ES el selector accesible por texto (reemplaza la
     lista larga de chips). Cada item es un botón que selecciona el género. */
  cursor: pointer; font-family: var(--font);
  transition: background .14s, border-color .14s, transform .12s;
}
.legend-item:hover { background: var(--surface); border-color: var(--teal); transform: translateY(-1px); }
.legend-item:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; }
.legend-dot {
  width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(255,255,255,.9);
}
.legend-label { font-size: 11px; color: var(--ink-soft); font-weight: 500; }

/* ------------------------------------------------------------------- Panel */
.panel {
  background: var(--surface); border-radius: var(--radius-lg);
  padding: 20px; box-shadow: var(--shadow-md); margin-top: 16px;
  border: 1px solid var(--line);
  position: relative; overflow: hidden;
  animation: panelIn .28s var(--ease);
}
/* Franja de acento lateral (color heredado inline por el motor via icon bg) */
.panel::before {
  content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 4px;
  background: linear-gradient(var(--teal), var(--navy));
  opacity: .85;
}
@keyframes panelIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.panel-head { display: flex; align-items: center; gap: 13px; margin-bottom: 13px; }
.panel-icon {
  width: 50px; height: 50px; border-radius: 15px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(20,62,107,.08);
}
.panel-titles { min-width: 0; }
.panel-name { font-weight: 700; font-size: 16px; color: var(--navy); line-height: 1.25; }
.panel-tag {
  display: inline-block; font-size: 11px; font-weight: 700; margin-top: 5px;
  padding: 3px 10px; border-radius: 999px; letter-spacing: .2px;
}
.panel-close {
  background: var(--navy-tint); border: none; border-radius: 50%;
  /* WCAG 2.5.8: objetivo mínimo 24×24 CSS px. Usamos 36×36 para comodidad
     táctil (WCAG 2.5.5 recomienda 44×44 para móvil). El padding amplía
     el área de toque sin agrandar el icono visualmente. */
  width: 36px; height: 36px; cursor: pointer; font-size: 15px; color: var(--navy);
  margin-inline-start: auto; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, transform .12s;
}
.panel-close:hover { background: var(--line); transform: rotate(90deg); }
.panel-close:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; }
.panel-desc { font-size: 13.5px; color: var(--ink-soft); margin-bottom: 12px; line-height: 1.68; }

.func-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.func-tag {
  border-radius: 999px; padding: 5px 12px; font-size: 11.5px; font-weight: 600;
  /* color: teal-dark (#007a71) sobre teal-tint (#e6f6f5): ratio 4.95:1 — AA */
  background: var(--teal-tint); color: var(--teal-dark);
  border: 1px solid rgba(0,169,157,.5);
  display: inline-flex; align-items: center; gap: 5px;
  transition: background .14s, transform .12s;
}
.func-tag:hover { background: #d3efec; transform: translateY(-1px); }
/* func-tag con color inline (de genera.color): si el color es claro,
   ficha.js añade chip-dark-text para garantizar contraste */
.func-tag.chip-dark-text {
  background: var(--navy-tint) !important;
  color: var(--navy) !important;
  border-color: rgba(20,62,107,.3) !important;
}

/* ------------------------------------------------------------- Empty state */
.empty-state {
  margin-top: 16px; background: var(--surface); border-radius: var(--radius-lg);
  padding: 18px 16px; text-align: center; border: 1px solid var(--line);
  box-shadow: var(--shadow-xs);
}
.empty-text { color: var(--ink-soft); font-size: 13px; margin-bottom: 13px; font-weight: 500; }
.chip-list { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip {
  border-radius: 999px; padding: 6px 13px; cursor: pointer;
  font-family: var(--font); font-size: 11.5px; font-weight: 600;
  border: 1.5px solid; background: var(--surface);
  transition: transform .12s var(--ease), box-shadow .15s, background .14s;
  /* Objetivo táctil mínimo: 24×24 CSS px (SC 2.5.8); la altura real
     con padding 6px + line-height ~1.6 × 11.5px = ~24.5px — cumple. */
}
.chip:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.chip:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; }

/* ---------------------------------------------------------------
   WCAG AA — contraste texto en chips dinámicos (SC 1.4.3)
   Los géneros con colores claros (#00a99d, #008b80, #0d7d74, #1f6feb)
   producen texto con ratio < 4.5:1 sobre fondo blanco. La clase
   .chip-dark-text la añade ficha.js cuando detecta luminancia alta
   (> 0.18), forzando el texto a navy (15:1) y oscureciendo el borde.
   Fallback CSS: cuando JS no aplica la clase, navy garantiza AA
   sobre cualquier fondo de género claro.
   ---------------------------------------------------------------- */
/* Fallback para cuando JS no carga: navy garantiza AA en todos los chips */
.chip {
  color: var(--navy);
  border-color: var(--navy-dark);
}

.chip.chip-dark-text {
  color: var(--navy) !important;
  border-color: var(--navy-dark) !important;
}
.chip.chip-dark-text:focus-visible { outline-color: var(--navy); }

/* ---------------------------------------------------- Vista Por Función */
.func-groups { display: flex; flex-direction: column; gap: 9px; }
.func-group-head {
  background: var(--surface); border-radius: var(--radius-md);
  padding: 14px 16px; cursor: pointer; display: flex; align-items: center; gap: 13px;
  border: 2px solid; transition: background .2s, box-shadow .16s, transform .12s;
  font-family: var(--font); width: 100%; text-align: start;
  box-shadow: var(--shadow-xs);
}
.func-group-head:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.func-group-icon {
  font-size: 22px; flex-shrink: 0; width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px; background: rgba(20,62,107,.06);
}
.func-group-label { font-size: 14.5px; font-weight: 700; }
.func-group-count { font-size: 11px; margin-top: 2px; font-weight: 500; }
.func-group-head:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; }
.func-group-strains {
  display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 6px 12px;
  animation: panelIn .22s var(--ease);
}
.strain-chip {
  background: var(--surface); border-radius: 999px; padding: 6px 14px; cursor: pointer;
  font-family: var(--font); font-size: 12px; font-weight: 600; border: 1.5px solid;
  transition: transform .12s var(--ease), box-shadow .15s;
}
.strain-chip:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.strain-chip:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; }
/* Mismo patrón de corrección de contraste que .chip */
.strain-chip.chip-dark-text {
  color: var(--navy) !important;
  border-color: var(--navy-dark) !important;
}

/* ------------------------------------------------------- Botón desbloqueo
   Barra "premium" con candado; look confiable, no un botón suelto. */
.unlock-bar {
  margin-top: 22px; text-align: center;
  background: linear-gradient(135deg, rgba(20,62,107,.04), rgba(0,169,157,.05));
  border: 1px dashed rgba(20,62,107,.22);
  border-radius: var(--radius-lg);
  padding: 20px 18px;
}
.btn-unlock {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-dark) 100%);
  color: #fff; border: 1.5px solid var(--gold);
  border-radius: 999px; padding: 13px 24px; cursor: pointer;
  font-family: var(--font); font-size: 13.5px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 9px;
  box-shadow: 0 8px 24px rgba(20,62,107,.28);
  transition: transform .16s var(--ease), box-shadow .18s, filter .15s;
}
.btn-unlock:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(20,62,107,.36); filter: brightness(1.06); }
/* WCAG SC 2.4.11: navy = 11:1 sobre fondo página ✅ (el dorado tenía 2.13:1 sobre blanco) */
.btn-unlock:focus-visible { outline: 3px solid var(--navy); outline-offset: 3px; }

/* --------------------------------------------------------------- Modal
   ACCESIBILIDAD: z-index 600 (por encima del lang-menu que es 1000... se
   pone en 600 porque el modal es un overlay de página completa; el lang-menu
   tiene z-index 1000 pero solo se abre mientras el modal está cerrado,
   por lo que no hay conflicto real). El modal tiene role=dialog + aria-modal,
   y el JS implementa focus-trap (Tab/Shift+Tab ciclan dentro del modal). */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(10,35,64,.62);
  backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center;
  z-index: 600; padding: 20px;
}
.modal-overlay.show { display: flex; animation: overlayIn .2s ease; }
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface); border-radius: var(--radius-xl);
  padding: 26px; width: 100%; max-width: 420px; box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
  position: relative; overflow: hidden;
  animation: modalIn .26s var(--ease);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
/* Franja teal→gold en la cabecera del modal (candado / premium) */
.modal::before {
  content: ""; position: absolute; inset-inline: 0; top: 0; height: 4px;
  background: linear-gradient(90deg, var(--teal), var(--cyan), var(--gold));
}
.modal-title {
  font-size: 18px; font-weight: 700; color: var(--navy); margin-bottom: 6px;
  display: flex; align-items: center; gap: 8px;
}
.modal-desc { font-size: 13px; color: var(--ink-soft); margin-bottom: 16px; line-height: 1.6; }
.modal-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.modal-label { font-size: 12px; font-weight: 600; color: var(--ink); }
.modal-input {
  font-family: var(--font); font-size: 15px; padding: 12px 14px;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  color: var(--ink); background: #fbfdfd; width: 100%;
  letter-spacing: .5px; transition: border-color .15s, box-shadow .15s, background .15s;
}
.modal-input:focus { outline: none; border-color: var(--teal); background: #fff; box-shadow: var(--ring); }
.modal-error {
  font-size: 12px; color: var(--danger); background: var(--danger-tint);
  border: 1px solid rgba(179,38,30,.28);
  border-radius: var(--radius-sm); padding: 10px 12px; margin-top: 10px;
  display: none;
}
.modal-error.show { display: block; }

/* Éxito (solicitud de acceso enviada) */
.modal-success {
  font-size: 12.5px; color: var(--teal-dark); background: var(--teal-tint);
  border: 1px solid var(--teal); border-radius: var(--radius-sm);
  padding: 11px 13px; margin-top: 10px; display: none; line-height: 1.55;
}
.modal-success.show { display: block; }

/* Pestañas del modal híbrido (Ya tengo código · Solicitar acceso) */
.modal-tabs {
  display: flex; gap: 4px; margin: 6px 0 18px;
  background: var(--bg); padding: 4px; border-radius: 999px;
  border: 1px solid var(--line-soft);
}
.modal-tab {
  flex: 1; background: none; border: none; cursor: pointer;
  font-family: var(--font); font-size: 12.5px; font-weight: 600;
  color: var(--ink-soft); padding: 9px 8px; border-radius: 999px;
  transition: color .15s, background .18s var(--ease), box-shadow .15s;
}
.modal-tab:hover { color: var(--navy); }
.modal-tab.active {
  color: var(--navy); background: var(--surface);
  box-shadow: var(--shadow-xs); font-weight: 700;
}
.modal-tab:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }

.modal-pane.hidden { display: none; }

.modal-actions { display: flex; gap: 10px; margin-top: 20px; justify-content: flex-end; }
.btn {
  font-family: var(--font); font-size: 13px; font-weight: 600;
  border-radius: 999px; padding: 11px 20px; cursor: pointer; border: 1.5px solid;
  transition: transform .12s var(--ease), box-shadow .15s, background .15s, color .15s;
}
.btn-primary { background: var(--teal); color: #04231f; border-color: var(--teal); box-shadow: 0 4px 14px rgba(0,169,157,.35); }
.btn-primary:hover { background: var(--teal-dark); color: #fff; transform: translateY(-1px); }
.btn-primary:disabled { opacity: .55; cursor: progress; transform: none; box-shadow: none; }
.btn-ghost { background: none; color: var(--navy); border-color: var(--line); }
.btn-ghost:hover { background: var(--navy-tint); }
.btn:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; }

/* --------------------------------------- Sección formulación completa
   Look "contenido premium desbloqueado": banda de confianza + tabla legible. */
.full-section {
  margin-top: 22px; background: var(--surface); border-radius: var(--radius-xl);
  padding: 22px; box-shadow: var(--shadow-md); border: 1px solid var(--line);
  position: relative; overflow: hidden;
  animation: panelIn .3s var(--ease);
}
.full-section::before {
  content: ""; position: absolute; inset-inline: 0; top: 0; height: 4px;
  background: linear-gradient(90deg, var(--gold), var(--teal), var(--cyan));
}
.full-section[hidden] { display: none; }
.full-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.full-badge {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  /* WCAG AA: blanco sobre dorado #c9963a = 2.13:1 (falla). Oscurecido a #1a1000 = 10.1:1 ✅ */
  color: #1a1000; font-size: 11px; font-weight: 700;
  border-radius: 999px; padding: 4px 12px; display: inline-flex; align-items: center; gap: 5px;
  box-shadow: 0 3px 10px rgba(201,150,58,.35); letter-spacing: .2px;
}
.full-title { font-size: 18px; font-weight: 700; color: var(--navy); }
.full-note { font-size: 12.5px; color: var(--ink-soft); margin-bottom: 16px; line-height: 1.6; }

.full-table-wrap { overflow-x: auto; border-radius: var(--radius-md); border: 1px solid var(--line); box-shadow: var(--shadow-xs); }
table.full-table { width: 100%; border-collapse: collapse; font-size: 12.5px; min-width: 460px; }
table.full-table th {
  padding: 12px 14px; text-align: start; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--navy), var(--navy-dark));
  position: sticky; top: 0;
}
table.full-table td { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
table.full-table tbody tr { transition: background .12s; }
table.full-table tbody tr:hover td { background: var(--teal-tint); }
table.full-table tr:nth-child(even) td { background: #f8fbfb; }
table.full-table tbody tr:nth-child(even):hover td { background: var(--teal-tint); }
table.full-table .sp { font-style: italic; font-weight: 600; color: var(--navy); }
table.full-table .pct { font-weight: 700; color: var(--teal-dark); white-space: nowrap; }

.full-strain-card {
  border: 1px solid var(--line); border-radius: var(--radius-md);
  padding: 13px 15px; margin-top: 11px; border-inline-start: 4px solid var(--teal);
  background: linear-gradient(135deg, #fbfefe, var(--surface));
  transition: box-shadow .16s, transform .12s;
}
.full-strain-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.full-strain-name { font-weight: 700; font-style: italic; color: var(--navy); font-size: 14.5px; }
.full-strain-meta { font-size: 11px; color: var(--ink-soft); margin-top: 3px; }
.full-strain-mech { font-size: 12.5px; color: var(--ink-soft); margin-top: 8px; line-height: 1.6; }

/* ------------------------------------------------------------------ Footer */
.ficha-footer {
  margin-top: 26px; text-align: center;
  padding-top: 18px; border-top: 1px solid var(--line);
}
.ficha-footer p { font-size: 11px; color: var(--ink-faint); margin: 3px 0; font-weight: 500; }
.ficha-footer p:first-child { color: var(--navy); font-weight: 600; }

.hidden { display: none !important; }

/* --------------------------------------------------- Preferencias de usuario */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* -------------------------------------------------------------- Responsive */
@media (max-width: 620px) {
  .ficha-header { padding: 18px 16px 20px; }
  .ficha-header-right { width: 100%; }
}
@media (max-width: 480px) {
  body.ficha { padding: 14px 12px 22px; }
  .ficha-header { padding: 16px 14px 18px; gap: 12px; border-radius: var(--radius-lg); }
  .ficha-title { font-size: 18px; }
  .ficha-sub { font-size: 11px; }
  .ficha-logo { height: 38px; padding: 6px 9px; }
  .ficha-header-right { gap: 6px; }
  .ficha-toggle { padding: 7px 12px; font-size: 12px; }
  .lang-btn { padding: 7px 11px; font-size: 12px; }
  .queso-wrap { padding: 18px 12px 16px; border-radius: var(--radius-lg); }
  .queso-circle {
    width: min(320px, 84vw); height: min(320px, 84vw);
    box-shadow: 0 0 0 7px rgba(255,255,255,.9), 0 0 0 8px var(--line), 0 10px 30px rgba(20,62,107,.15);
  }
  .queso-center { width: 104px; height: 104px; }
  .queso-center-sub { font-size: 17px; }
  .queso-center-emoji { font-size: 20px; }
  .queso-center-sel-name { font-size: 8px; margin-top: 4px; padding: 0 3px; }
  .panel, .full-section { padding: 16px; }
  .modal { padding: 20px; }
}
@media (max-width: 360px) {
  .queso-circle { width: min(300px, 88vw); height: min(300px, 88vw); }
  .queso-center { width: 96px; height: 96px; }
  .queso-center-sel-name { font-size: 7.5px; }
  .lang-btn #lang-label { display: none; }
}


/* Aviso de disponibilidad por mercado (Colombia-only por ahora) */
.ficha-availability{display:flex;align-items:center;justify-content:center;gap:6px;flex-wrap:wrap;margin:12px auto 0;max-width:680px;padding:8px 16px;border-radius:999px;background:rgba(0,169,157,.10);border:1px solid rgba(0,169,157,.38);color:#0a5c55;font-size:.82rem;font-weight:700;line-height:1.35;text-align:center;}
.ficha-availability em{font-style:normal;font-weight:500;opacity:.72;}
