/*
 * /ejemplo · ajustes 2.2.3 (aparte de app.css para no chocar con otros cambios de la home).
 * 1. Bandera del idioma en la portada: círculo completo también en Safari/iPhone.
 * 2. Filtros: más compactos en el ordenador y, en el móvil, barra «Filtrar» + hoja desde abajo (assets/js/ejemplos.js).
 */

/* 1 · Bandera. Safari no resuelve height:100% dentro de una caja con aspect-ratio y dibujaba el SVG con 150 px de alto,
   así que solo se veía la parte de arriba (en la de España, rojo y amarillo, sin la franja roja de abajo). */
.mag-langseal { aspect-ratio: auto; height: auto; }
.mag-flag { position: relative; width: 100%; height: 0; padding-bottom: 100%; aspect-ratio: auto; border: 0;
  box-shadow: 0 0 0 3px #fff, 0 4px 12px -3px rgba(11, 60, 73, .6); }
.mag-flag svg, .mag-flag .mag-flag-code { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }

/* 2 · Filtros */
.tvx-fbar { display: none; }
.tvx-fhead, .tvx-ffoot { display: none; }
.tvx-emo { margin-right: .3em; }

@media (min-width: 720px) {
  /* ordenador: misma idea, pero con chips algo más bajos para que el panel ocupe menos */
  .tvx-filters { gap: 10px 24px; padding: 12px 16px; }
  .tvx-fgroup { gap: 4px; }
  .tvx-flabel { font-size: .72rem; }
  .tvx-chip { min-height: 38px; padding: 0 12px; font-size: .88rem; }
  .tvx-count { margin-bottom: 8px; }
}

@media (max-width: 719px) {
  .tvx-fready .tvx-fbar { display: flex; align-items: center; gap: 10px; margin: 0 0 16px; min-height: 44px; }
  .tvx-fbtn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px 0 13px; border-radius: 999px;
    border: 2px solid var(--line-2, rgba(29, 43, 58, .2)); background: #fff; color: var(--ink, #1D2B3A); font: inherit; font-weight: 800; font-size: .95rem; cursor: pointer; }
  .tvx-fbtn svg { width: 20px; height: 20px; flex: none; }
  .tvx-fbtn[aria-expanded="true"] { border-color: var(--night, #0B3C49); }
  .tvx-fbtn:has(.tvx-fn:not([hidden])) { border-color: var(--night, #0B3C49); }
  .tvx-fn { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--coral-strong, #D24326); color: #fff; font-size: .78rem; line-height: 1; }
  .tvx-fn[hidden] { display: none; }
  .tvx-fclear { flex: none; display: inline-grid; place-items: center; width: 40px; height: 40px; margin-left: -4px; padding: 0; border: 0; border-radius: 50%;
    background: rgba(29, 43, 58, .08); color: var(--ink, #1D2B3A); font: inherit; font-size: 1.5rem; line-height: 1; cursor: pointer; }
  .tvx-fclear[hidden] { display: none; }
  .tvx-fcount { margin-left: auto; font-weight: 800; color: var(--ink-2, #4A5561); font-size: .9rem; white-space: nowrap; }

  /* la hoja: oculta hasta pulsar «Filtrar» */
  .tvx-fready .tvx-filters { display: none; }
  .tvx-fready .tvx-filters.is-open { display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 320; margin: 0;
    max-height: 86vh; max-height: 86dvh; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
    padding: 0 18px; border-radius: 22px 22px 0 0; background: #fff; box-shadow: 0 -18px 50px -20px rgba(11, 60, 73, .55);
    outline: none; animation: tvxUp .22s ease-out; }
  .tvx-filters.is-open .tvx-fhead { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 1;
    margin: 0 -18px 4px; padding: 14px 18px 8px; background: #fff; font-size: 1.08rem; }
  .tvx-filters.is-open .tvx-fhead::before { content: ""; position: absolute; top: 6px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 4px; background: rgba(29, 43, 58, .18); }
  .tvx-fx { width: 44px; height: 44px; margin-right: -10px; border: 0; border-radius: 50%; background: none; color: var(--ink, #1D2B3A); font-size: 1.9rem; line-height: 1; cursor: pointer; }
  .tvx-filters.is-open .tvx-fgroup { display: grid; gap: 6px; margin: 0 0 16px; }
  .tvx-filters.is-open .tvx-chip { min-height: 40px; padding: 0 13px; font-size: .9rem; }
  .tvx-filters.is-open .tvx-count { display: none; }
  .tvx-filters.is-open .tvx-ffoot { display: flex; align-items: center; gap: 10px; position: sticky; bottom: 0; margin: 0 -18px; padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
    background: #fff; border-top: 1px solid rgba(29, 43, 58, .1); }
  .tvx-ffoot .btn-primary { flex: 1; justify-content: center; }
  .tvx-ffoot .btn-ghost[disabled] { opacity: .45; cursor: default; }
  .tvx-fback { position: fixed; inset: 0; z-index: 310; background: rgba(8, 30, 38, .5); animation: tvxFade .2s ease-out; }
  .tvx-fopen, .tvx-fopen body { overflow: hidden; }
  .tvx-fopen [data-sticky-cta] { display: none !important; }
}
@keyframes tvxUp { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes tvxFade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .tvx-filters.is-open, .tvx-fback { animation: none; } }
