/* =====================================================================
   juegos.css — Sección Juegos de ElCuervoNica
   Reutiliza las variables del tema (--accent, --radius-md, --shadow-*).
   ===================================================================== */

.jx-wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.2rem 1rem 3rem;
}

/* ---------- Migas y títulos ---------- */
.jx-crumbs { font-size: .8rem; color: var(--muted, #666); margin: .2rem 0 1rem; }
.jx-crumbs a { color: var(--muted, #666); text-decoration: none; }
.jx-crumbs a:hover { color: var(--accent, #ff002a); }
.jx-crumbs span[aria-current] { color: var(--ink, #111); font-weight: 500; }

.jx-h1 {
  font-family: "Bangers", cursive;
  font-size: clamp(2rem, 4.4vw, 3.2rem);
  letter-spacing: .5px;
  line-height: 1;
  margin: 0 0 .35rem;
  color: var(--ink, #111);
  text-transform: uppercase;
}
.jx-h1 em { font-style: normal; color: var(--accent, #ff002a); }

.jx-lead {
  font-size: 1.02rem;
  color: var(--muted, #666);
  max-width: 70ch;
  margin: 0 0 1.4rem;
}

.jx-h2 {
  font-family: "Bangers", cursive;
  font-size: clamp(1.4rem, 2.4vw, 1.9rem);
  letter-spacing: .4px;
  text-transform: uppercase;
  margin: 2.2rem 0 .9rem;
  color: var(--ink, #111);
}
.jx-h2::after {
  content: "";
  display: block;
  width: 54px;
  height: 3px;
  margin-top: .35rem;
  background: linear-gradient(90deg, var(--accent, #ff002a), var(--accent-2, #d40022));
  border-radius: 2px;
}

/* ---------- Texto ---------- */
.jx-prose { max-width: 74ch; font-size: .95rem; line-height: 1.65; color: #222; }
.jx-prose p { margin: 0 0 .85rem; }
.jx-prose h3 { font-size: 1rem; margin: 1.3rem 0 .4rem; color: var(--ink, #111); }
.jx-prose ul { margin: 0 0 .9rem 1.1rem; padding: 0; }
.jx-prose li { margin-bottom: .3rem; }
.jx-prose a { color: var(--accent, #ff002a); }
.jx-intro-categoria { margin-bottom: .5rem; }

.jx-empty { color: var(--muted, #666); font-size: .9rem; }

/* ---------- Categorías ---------- */
.jx-cats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
  gap: .7rem;
}
.jx-cat {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .8rem .9rem;
  text-decoration: none;
  color: var(--ink, #111);
  background: var(--bar-bg, #fafafa);
  border: 1px solid var(--bar-border, #eaeaea);
  border-radius: var(--radius-md, 12px);
  font-weight: 600;
  font-size: .92rem;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.jx-cat:hover {
  transform: translateY(-2px);
  border-color: var(--accent, #ff002a);
  box-shadow: var(--shadow-sm, 0 4px 8px rgba(0,0,0,.2));
}
.jx-cat i { color: var(--accent, #ff002a); font-size: 1.05rem; width: 1.3rem; text-align: center; }
.jx-cat small { display: block; font-weight: 400; font-size: .72rem; color: var(--muted, #666); }

/* ---------- Parrilla y tarjetas ---------- */
.jx-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1rem;
}
.jx-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  background: #fff;
  border: 1px solid var(--bar-border, #eaeaea);
  border-radius: var(--radius-md, 12px);
  overflow: hidden;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.jx-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md, 0 8px 16px rgba(0,0,0,.2));
  border-color: var(--accent, #ff002a);
}
.jx-card .jx-thumb { position: relative; display: block; aspect-ratio: 16/9; background: #111; overflow: hidden; }
.jx-card .jx-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.jx-card .jx-cat-tag {
  position: absolute; left: .5rem; top: .5rem;
  padding: .22rem .5rem;
  font-size: .66rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: #fff; background: rgba(0,0,0,.62); border-radius: 4px;
}
.jx-card .jx-body { display: block; padding: .7rem .8rem .85rem; }
.jx-card h3 { margin: 0 0 .25rem; font-size: .95rem; line-height: 1.25; font-weight: 600; color: var(--ink, #111); }
.jx-card p {
  margin: 0;
  font-size: .78rem;
  color: var(--muted, #666);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.jx-card .jx-play-mini {
  margin-top: .55rem;
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .72rem; font-weight: 600; color: var(--accent, #ff002a);
  text-transform: uppercase; letter-spacing: .04em;
}

/* ---------- Facade del juego ---------- */
.jgame { margin: 0 0 1.6rem; }
.jgame-frame {
  /* La altura manda y el ancho se deriva del aspect-ratio:
     así el marco nunca se deforma al limitar la altura en móvil. */
  --jx-ar: 16 / 9;
  position: relative;
  width: auto;
  max-width: 100%;
  height: min(70vh, calc((100vw - 2rem) * 9 / 16));
  aspect-ratio: var(--jx-ar);
  margin-inline: auto;
  background: #000;
  border-radius: var(--radius-md, 12px);
  overflow: hidden;
  box-shadow: var(--shadow-md, 0 8px 16px rgba(0,0,0,.2));
}
.jgame--vertical .jgame-frame {
  --jx-ar: 9 / 16;
  height: min(76vh, calc((100vw - 2rem) * 16 / 9));
}
.jgame-frame iframe,
.jgame-frame > iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  overscroll-behavior: contain;
}
.jgame-cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.jgame-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; gap: .55rem;
  align-items: center; justify-content: center; text-align: center;
  background: linear-gradient(180deg, rgba(0,0,0,.12), rgba(0,0,0,.72));
}
.jgame-play {
  display: inline-flex; align-items: center; gap: .6rem;
  padding: .9rem 1.7rem;
  font: 600 1rem/1 "Poppins", system-ui, sans-serif;
  color: #fff; text-transform: uppercase; letter-spacing: .05em;
  background: linear-gradient(90deg, var(--accent, #ff002a), var(--accent-2, #d40022));
  border: 0; border-radius: 999px; cursor: pointer;
  box-shadow: var(--shadow-md, 0 8px 16px rgba(0,0,0,.2));
  transition: transform .15s ease, filter .15s ease;
}
.jgame-play:hover { transform: translateY(-2px) scale(1.02); filter: brightness(1.08); }
.jgame-play:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.jgame-note { margin: 0; color: #e8e8e8; font-size: .76rem; }
.jgame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.jgame-noscript { margin: .5rem 0 0; font-size: .85rem; }

.jx-foot-note {
  margin-top: 2.4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--bar-border, #eaeaea);
  font-size: .75rem;
  color: var(--muted, #666);
}
.jx-foot-note a { color: var(--accent, #ff002a); }

@media (max-width: 640px) {
  .jx-wrap { padding: .9rem .7rem 2.4rem; }
  .jx-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .7rem; }
  .jx-card h3 { font-size: .85rem; }
  .jx-card p { font-size: .72rem; }
  .jgame-frame { max-height: 62vh; }
  .jgame-play { padding: .75rem 1.3rem; font-size: .9rem; }
}
/* ---------- Bloques plegables: el texto sigue en el HTML pero no estorba ---------- */
.jx-details {
  margin: 1.6rem 0 0;
  border: 1px solid var(--bar-border, #eaeaea);
  border-radius: var(--radius-md, 12px);
  background: var(--bar-bg, #fafafa);
  padding: .1rem .9rem;
}
.jx-details summary {
  cursor: pointer;
  list-style: none;
  padding: .75rem 0;
  font-weight: 600;
  font-size: .9rem;
  color: var(--ink, #111);
  display: flex;
  align-items: center;
  gap: .5rem;
}
.jx-details summary::-webkit-details-marker { display: none; }
.jx-details summary::before {
  content: "+";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 50%;
  background: var(--accent, #ff002a);
  color: #fff;
  font-size: .85rem;
  font-weight: 700;
  line-height: 1;
  flex: 0 0 auto;
}
.jx-details[open] summary::before { content: "\2013"; }
.jx-details summary:hover { color: var(--accent, #ff002a); }
.jx-details .jx-prose { padding: 0 0 1rem; }
/* ---------- Barra de herramientas del juego (tras cargar) ---------- */
.jgame-tools {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem .8rem;
  align-items: center;
  justify-content: center;
  margin-top: .6rem;
}
.jgame-fs {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .55rem 1rem;
  font: 600 .8rem/1 "Poppins", system-ui, sans-serif;
  color: #fff;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 999px;
  cursor: pointer;
}
.jgame-fs:hover { background: var(--accent, #ff002a); border-color: transparent; }
.jgame-fs:focus-visible { outline: 2px solid var(--accent, #ff002a); outline-offset: 2px; }
.jgame-hint { font-size: .72rem; color: var(--muted, #666); }

@media (max-width: 640px) {
  .jgame--vertical .jgame-frame {
    height: min(72vh, calc((100vw - 1.4rem) * 16 / 9));
  }
  .jgame--horizontal .jgame-frame {
    height: min(58vh, calc((100vw - 1.4rem) * 9 / 16));
  }
  .jgame-tools { margin-top: .5rem; }
  .jgame-fs { padding: .5rem .9rem; font-size: .76rem; }
}
/* ---------- Pantalla completa ---------- */
.jgame-frame:fullscreen,
.jgame-frame:-webkit-full-screen,
.jgame-frame.is-fullscreen {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  aspect-ratio: auto;
  border-radius: 0;
  background: #000;
}
