/* Piezas de la web WWX: portada, tarjetas de posse, columna lateral de la posse.
   Usa las variables del tema (--wwe-*) con valores de reserva. */

/* --- Insignia de facción ------------------------------------------------- */
.wwx-insignia {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  color: var(--wwe-heading, #fff);
  text-decoration: none;
  font-weight: 600;
}
.wwx-insignia img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  padding: 8px;
  border-radius: 50%;
  background: var(--wwe-panel-solid, #181926);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .45);
  transition: transform .2s ease, box-shadow .2s ease;
}
.wwx-insignia:hover { color: var(--wwe-accent-hover, #ffc56b); }
.wwx-insignia:hover img { transform: scale(1.06); box-shadow: 0 0 0 2px var(--wwe-accent, #e9a23b), 0 6px 20px rgba(0, 0, 0, .5); }
.wwx-insignia--grande img { width: 150px; height: 150px; padding: 14px; }
.wwx-insignia--grande span { font-size: 1.25rem; }
.wwx-grupo__titulo .wwx-insignia { flex-direction: row; gap: .9rem; font-size: 1.4rem; }
.wwx-grupo__titulo .wwx-insignia img { width: 56px; height: 56px; padding: 6px; }

/* --- Tarjetas de posse ---------------------------------------------------- */
.wwx-rejilla {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}
.wwx-tarjeta {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--wwe-radius, 10px);
  background: var(--wwe-panel-solid, #181926);
  border: 1px solid var(--wwe-border, rgba(255, 255, 255, .1));
  color: var(--wwe-text, #d6d7e0);
  text-decoration: none;
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.wwx-tarjeta:hover {
  transform: translateY(-3px);
  border-color: var(--wwe-accent, #e9a23b);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .5);
  color: var(--wwe-text, #d6d7e0);
}
.wwx-tarjeta__img {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  background: #0d0e16;
}
.wwx-tarjeta__img > img:first-child { width: 100%; height: 100%; object-fit: cover; display: block; }
.wwx-tarjeta__logo {
  position: absolute;
  right: .6rem;
  bottom: -22px;
  width: 48px;
  height: 48px;
  padding: 5px;
  border-radius: 50%;
  background: var(--wwe-panel-solid, #181926);
  object-fit: contain;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .5);
}
.wwx-tarjeta__cuerpo { display: flex; flex-direction: column; gap: .3rem; padding: .9rem 1rem 1.1rem; }
.wwx-tarjeta__faccion { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--wwe-accent, #e9a23b); }
.wwx-tarjeta__titulo { font-size: 1.15rem; font-weight: 700; color: var(--wwe-heading, #fff); }
.wwx-tarjeta__texto { font-size: .9rem; line-height: 1.5; color: var(--wwe-muted, #9a9cb0); }

/* --- Listado /posses --------------------------------------------------------- */
.wwx-posses .wwx-intro { max-width: 820px; font-size: 1.05rem; line-height: 1.7; margin-bottom: 2rem; }
.wwx-grupo { margin-bottom: 2.75rem; }
.wwx-grupo__titulo { margin: 0 0 1.1rem; padding-bottom: .6rem; border-bottom: 1px solid var(--wwe-border, rgba(255, 255, 255, .1)); }

/* --- Columna lateral de la posse ------------------------------------------- */
.wwx-lateral { display: flex; flex-direction: column; align-items: center; gap: 1.25rem; }
.wwx-lateral__titulo { align-self: stretch; margin: .5rem 0 0; font-size: 1.2rem; color: var(--wwe-heading, #fff); }
.wwx-rejilla--lateral { grid-template-columns: 1fr; align-self: stretch; }
.wwx-rejilla--lateral .wwx-tarjeta__texto { display: none; }

/* --- Portada ------------------------------------------------------------------- */
.wwx-portada { margin-bottom: 2.5rem; }
.wwx-portada__hero {
  position: relative;
  overflow: hidden;
  border-radius: calc(var(--wwe-radius, 10px) * 1.5);
  background:
    linear-gradient(90deg, rgba(12, 13, 22, .96) 0%, rgba(12, 13, 22, .85) 45%, rgba(12, 13, 22, .25) 100%),
    var(--wwx-fondo) center 30% / cover no-repeat,
    #12131d;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .5);
}
.wwx-portada__texto { max-width: 640px; padding: clamp(1.75rem, 5vw, 3.5rem); }
.wwx-portada__antetitulo { margin: 0 0 .5rem; font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; color: var(--wwe-accent, #e9a23b); }
.wwx-portada__titulo { margin: 0 0 1rem; font-size: clamp(2rem, 4.5vw, 3.2rem); line-height: 1.1; color: #fff; }
.wwx-portada__texto p { font-size: 1.05rem; line-height: 1.7; color: var(--wwe-text, #d6d7e0); }
.wwx-portada__botones { display: flex; flex-wrap: wrap; gap: .75rem; margin: 1.5rem 0 0; }
.wwx-boton {
  display: inline-block;
  padding: .65rem 1.2rem;
  border-radius: 999px;
  border: 1px solid var(--wwe-accent, #e9a23b);
  color: var(--wwe-accent, #e9a23b);
  font-weight: 600;
  text-decoration: none;
  transition: background .2s ease, color .2s ease;
}
.wwx-boton:hover { background: rgba(233, 162, 59, .15); color: var(--wwe-accent-hover, #ffc56b); }
.wwx-boton--principal { background: var(--wwe-accent, #e9a23b); color: #1b1b1b; }
.wwx-boton--principal:hover { background: var(--wwe-accent-hover, #ffc56b); color: #1b1b1b; }
.wwx-cifras {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0 2.5rem;
}
.wwx-cifra {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem .5rem;
  border-radius: var(--wwe-radius, 10px);
  background: var(--wwe-panel, rgba(9, 15, 21, .55));
  border: 1px solid var(--wwe-border, rgba(255, 255, 255, .1));
  color: var(--wwe-muted, #9a9cb0);
  text-decoration: none;
}
.wwx-cifra strong { font-size: 1.9rem; line-height: 1.1; color: var(--wwe-accent, #e9a23b); }
.wwx-cifra:hover { border-color: var(--wwe-accent, #e9a23b); color: var(--wwe-text, #d6d7e0); }
.wwx-portada__seccion { margin: 0 0 1.25rem; font-size: 1.5rem; text-align: center; color: #fff; }
.wwx-facciones {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 1.5rem 1rem;
  justify-items: center;
}
.wwx-insignia--portada img { width: 110px; height: 110px; padding: 10px; }

/* --- Menú lateral del trasfondo (ficha de facción) ----------------------------- */
/* Lo que se queda fijo es la región entera (su columna sí es tan alta como el artículo). */
.region-sidebar-first:has(.wwx-indice-lateral) { position: sticky; top: 1.5rem; }
.wwx-indice-lateral {
  max-height: calc(100vh - 3rem);
  overflow-y: auto;
  margin: 1.5rem 1.5rem 2rem 0;
  padding: 1.25rem 1rem 1rem;
  background: var(--wwe-panel, rgba(9, 15, 21, .55));
  border: 1px solid var(--wwe-border, rgba(255, 255, 255, .1));
  border-radius: var(--wwe-radius, 10px);
  scrollbar-width: thin;
}
.wwx-indice-lateral .wwx-insignia { display: flex; margin: 0 auto 1rem; }
.wwx-insignia--lateral img { width: 96px; height: 96px; padding: 10px; }
.wwx-indice-lateral__titulo {
  margin: 0 0 .5rem;
  padding-bottom: .4rem;
  border-bottom: 1px solid var(--wwe-border, rgba(255, 255, 255, .1));
  font-size: .8rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--wwe-accent, #e9a23b);
}
.wwx-indice-lateral ol { list-style: none; margin: 0; padding: 0; counter-reset: apartado; }
.wwx-indice-lateral li { counter-increment: apartado; }
.wwx-indice-lateral ol a {
  display: block;
  padding: .32rem .5rem .32rem 2rem;
  position: relative;
  border-left: 2px solid transparent;
  border-radius: 0 6px 6px 0;
  font-size: .88rem;
  line-height: 1.35;
  color: var(--wwe-text, #d6d7e0);
  text-decoration: none;
}
.wwx-indice-lateral ol a::before {
  content: counter(apartado);
  position: absolute;
  left: .5rem;
  color: var(--wwe-muted, #9a9cb0);
  font-size: .78rem;
}
.wwx-indice-lateral ol a:hover { background: rgba(255, 255, 255, .05); color: var(--wwe-accent-hover, #ffc56b); }
.wwx-indice-lateral ol a.activo {
  border-left-color: var(--wwe-accent, #e9a23b);
  background: rgba(233, 162, 59, .1);
  color: var(--wwe-accent, #e9a23b);
}
.wwx-indice-lateral__arriba { display: block; margin-top: .8rem; font-size: .8rem; color: var(--wwe-muted, #9a9cb0); }
/* En pantalla ancha el índice va en el lateral; en móvil (donde la barra lateral
   queda debajo del texto) se usa el índice que lleva el propio artículo arriba. */
@media (min-width: 992px) {
  .wwx-trasfondo .wwx-indice { display: none; }
}
@media (max-width: 991px) {
  .wwx-indice-lateral { display: none; }
}

/* --- Cabecera de la ficha de facción ----------------------------------------- */
.page-node-type-faction .block-page-title-block { display: none; }
.wwx-cabecera {
  position: relative;
  overflow: hidden;
  min-height: 260px;
  aspect-ratio: 21 / 8;
  margin: 1.5rem 0 2rem;
  border-radius: calc(var(--wwe-radius, 10px) * 1.5);
  background: #10111a;
  box-shadow: 0 12px 36px rgba(0, 0, 0, .5);
}
.wwx-cabecera__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 30%; }
.wwx-cabecera__mosaico {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-auto-rows: 50%;
  opacity: .55;
  filter: saturate(.8);
}
.wwx-cabecera__mosaico img { width: 100%; height: 100%; object-fit: cover; object-position: center top; }
.wwx-cabecera::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(10, 11, 18, .92) 0%, rgba(10, 11, 18, .35) 45%, rgba(10, 11, 18, 0) 75%);
}
.wwx-cabecera__texto { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; padding: 1.5rem 2rem; }
.wwx-cabecera__ante { margin: 0 0 .2rem; font-size: .8rem; letter-spacing: .16em; text-transform: uppercase; color: var(--wwe-accent, #e9a23b); }
.wwx-cabecera__titulo { margin: 0; font-size: clamp(2rem, 4.5vw, 3.4rem); line-height: 1.05; color: #fff; text-shadow: 0 2px 12px rgba(0, 0, 0, .6); }
@media (max-width: 767px) {
  .wwx-cabecera { aspect-ratio: 16 / 9; min-height: 200px; }
  .wwx-cabecera__mosaico { grid-template-columns: repeat(4, 1fr); }
}

/* --- Carta de posse y huecos ---------------------------------------------------- */
.wwx-carta { margin: 2rem 0; }
.wwx-carta__img { margin: 0 0 2rem; }
.wwx-carta__img img {
  display: block;
  width: 100%;
  max-width: 900px;
  height: auto;
  border-radius: var(--wwe-radius, 10px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
}
.wwx-carta__img figcaption { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; }
.wwx-carta__datos {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: .6rem 1.25rem;
  margin: 0 0 2rem;
  padding: 1.1rem 1.25rem;
  background: var(--wwe-panel, rgba(9, 15, 21, .55));
  border: 1px solid var(--wwe-border, rgba(255, 255, 255, .1));
  border-radius: var(--wwe-radius, 10px);
}
.wwx-carta__datos dt { color: var(--wwe-accent, #e9a23b); font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; padding-top: .25rem; }
.wwx-carta__datos dd { margin: 0; line-height: 1.6; }
.wwx-carta__titulo { margin: 0 0 1rem; font-size: 1.35rem; color: #fff; }
.wwx-huecos { list-style: none; margin: 0; padding: 0; display: grid; gap: .9rem; }
.wwx-hueco {
  padding: .9rem 1rem;
  background: var(--wwe-panel-solid, #181926);
  border: 1px solid var(--wwe-border, rgba(255, 255, 255, .1));
  border-radius: var(--wwe-radius, 10px);
}
.wwx-hueco__cab { display: flex; align-items: center; gap: .9rem; }
.wwx-hueco__num {
  flex: 0 0 2.2rem;
  height: 2.2rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #0d0e16;
  border: 2px solid var(--wwe-accent, #e9a23b);
  color: var(--wwe-accent, #e9a23b);
  font-weight: 700;
}
.wwx-hueco__texto { flex: 1; font-weight: 600; color: var(--wwe-heading, #fff); }
.wwx-hueco__cuenta { font-size: .8rem; color: var(--wwe-muted, #9a9cb0); white-space: nowrap; }
.wwx-hueco details { margin-top: .7rem; }
.wwx-hueco summary { cursor: pointer; font-size: .85rem; color: var(--wwe-muted, #9a9cb0); }
.wwx-chips { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .55rem; }
.wwx-carta__datos .wwx-chips { margin-top: 0; }
.wwx-chip {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .2rem .7rem .2rem .2rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--wwe-border, rgba(255, 255, 255, .1));
  color: var(--wwe-text, #d6d7e0);
  font-size: .85rem;
  text-decoration: none;
}
.wwx-chip img, .wwx-chip__vacio { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; object-position: top; background: #0d0e16; }
.wwx-chip small { color: var(--wwe-muted, #9a9cb0); }
.wwx-chip:hover { border-color: var(--wwe-accent, #e9a23b); color: var(--wwe-accent-hover, #ffc56b); }
.wwx-chip--texto { padding: .3rem .8rem; }

/* --- Caja de la posse -------------------------------------------------------------- */
.wwx-caja {
  display: grid;
  grid-template-columns: minmax(0, 320px) 1fr;
  gap: 1.5rem;
  align-items: start;
  margin: 0 0 2.25rem;
  padding: 1.25rem;
  background: var(--wwe-panel, rgba(9, 15, 21, .55));
  border: 1px solid var(--wwe-border, rgba(255, 255, 255, .1));
  border-radius: var(--wwe-radius, 10px);
}
.wwx-caja__img img { width: 100%; height: auto; border-radius: 8px; background: #fff; box-shadow: 0 6px 20px rgba(0, 0, 0, .45); }
.wwx-caja__ante { margin: 0; font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; color: var(--wwe-accent, #e9a23b); }
.wwx-caja__titulo { margin: .2rem 0 1rem; font-size: 1.4rem; color: #fff; }
.wwx-caja__titulo small { font-size: .75rem; font-weight: 400; color: var(--wwe-muted, #9a9cb0); margin-left: .4rem; }
.wwx-caja__sub { margin: 0 0 .4rem; font-weight: 600; color: var(--wwe-heading, #fff); }
.wwx-caja__piezas { list-style: none; margin: 0 0 1rem; padding: 0; columns: 2 200px; }
.wwx-caja__piezas li { padding: .2rem 0; break-inside: avoid; }
.wwx-caja__n { display: inline-block; min-width: 2rem; color: var(--wwe-accent, #e9a23b); font-weight: 700; }
@media (max-width: 767px) {
  .wwx-caja { grid-template-columns: 1fr; }
}
