/* ZihWeb Events - lista de eventos (ext/events.php lstlis) y columna de fechas del detalle (.calday).
   Prefijo .zwe- para no chocar con Bootstrap 3. Hereda el color de texto y el fondo del sitio:
   funciona igual en plantillas claras u oscuras (mismo criterio que lib/directory.css).
   Medidas en em, no rem: Bootstrap 3 fija html{font-size:10px}. */

.zwe {
  --zwe-line: rgba(127, 127, 127, .28);
  --zwe-soft: rgba(127, 127, 127, .07);
  --zwe-muted: rgba(127, 127, 127, .95);
  --zwe-accent: #b91c1c;   /* hoy / fecha; texto blanco AA (6.5:1) */
  --zwe-live: #15803d;     /* en curso; texto blanco AA (5.0:1) */
  --zwe-soon: #b45309;     /* próximos 7 días; texto blanco AA (5.0:1) */
  --zwe-radius: 14px;
  margin: 0 0 1.5em;
}

/* ---------- Encabezado de mes ---------- */
.zwe-month {
  display: flex;
  align-items: center;
  gap: .75em;
  margin: 1.75em 0 .75em;
  font-size: .85em;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.zwe-month:first-child { margin-top: .5em; }
.zwe-month span { font-weight: 400; opacity: .7; }
.zwe-month::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--zwe-line);
}

/* ---------- Lista ---------- */
.zwe-list {
  display: grid;
  gap: .75em;
  margin: 0;
  padding: 0;
  list-style: none;
}

.zwe-item {
  position: relative;                 /* el enlace del título cubre toda la tarjeta */
  display: grid;
  grid-template-columns: 5em minmax(0, 1fr) auto;
  gap: 1em;
  align-items: start;
  padding: 1em;
  border: 1px solid var(--zwe-line);
  border-radius: var(--zwe-radius);
  background: var(--zwe-soft);
  transition: box-shadow .15s ease;
}
.zwe-item:hover { box-shadow: 0 6px 18px rgba(0, 0, 0, .14); }
@media (prefers-reduced-motion: no-preference) {
  .zwe-item { transition: box-shadow .15s ease, transform .15s ease; }
  .zwe-item:hover { transform: translateY(-2px); }
}
.zwe-item[data-state="ended"] { opacity: .65; }

/* ---------- Fecha (calendario) ---------- */
.zwe-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--zwe-line);
  border-radius: 10px;
  text-align: center;
  line-height: 1;
}
.zwe-dow {
  align-self: stretch;
  padding: .3em 0;
  background: var(--zwe-accent);
  color: #fff;
  font-size: .72em;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.zwe-day {
  padding: .35em 0 .1em;
  font-size: 2em;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.zwe-mon {
  padding-bottom: .45em;
  font-size: .78em;
  text-transform: uppercase;
  opacity: .75;
}
/* Eventos de varios días: la finalización debajo, separada por una línea punteada */
.zwe-end {
  display: flex;
  flex-direction: column;
  align-items: center;
  align-self: stretch;
  padding-top: .3em;
  border-top: 1px dashed var(--zwe-line);
}
.zwe-end-lbl { font-size: .68em; letter-spacing: .06em; text-transform: uppercase; opacity: .7; }
.zwe-end-day { padding: .15em 0 .05em; font-size: 1.35em; font-weight: 700; font-variant-numeric: tabular-nums; }
.zwe-item[data-state="live"] .zwe-dow { background: var(--zwe-live); }
.zwe-item[data-state="ended"] .zwe-dow { background: rgba(127, 127, 127, .6); }

/* ---------- Cuerpo ---------- */
.zwe-body {
  display: flex;
  flex-direction: column;
  gap: .4em;
  min-width: 0;
}
.zwe-body p { margin: 0; }

.zwe-when {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .25em .5em;
  font-size: .85em;
  font-variant-numeric: tabular-nums;
}
.zwe-until { opacity: .75; }
.zwe-chip {
  display: inline-block;
  padding: .15em .55em;
  border-radius: 999px;
  background: rgba(127, 127, 127, .16);
  font-size: .72em;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.zwe-item[data-state="today"] .zwe-chip { background: var(--zwe-accent); color: #fff; }
.zwe-item[data-state="live"] .zwe-chip  { background: var(--zwe-live); color: #fff; }
.zwe-item[data-state="soon"] .zwe-chip  { background: var(--zwe-soon); color: #fff; }

.zwe-item .zwe-title {
  margin: 0;
  font-size: 1.2em;
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.zwe-title a { color: inherit; text-decoration: none; }
.zwe-title a::after {                 /* toda la tarjeta es clicable */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--zwe-radius);
}
.zwe-item:hover .zwe-title a { text-decoration: underline; text-underline-offset: 3px; }
.zwe-title a:focus { outline: none; }
.zwe-title a:focus-visible::after { outline: 2px solid currentColor; outline-offset: 2px; }

.zwe-desc {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  font-size: .92em;
  line-height: 1.45;
  opacity: .85;
}

.zwe-where {
  display: flex;
  align-items: flex-start;
  gap: .35em;
  font-size: .88em;
}
.zwe-where svg, .zwe-empty svg {
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.zwe-where svg { width: 1em; height: 1em; margin-top: .1em; opacity: .7; }

.zwe-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .3em .9em;
  margin-top: .15em;
  font-size: .8em;
  opacity: .8;
}
.zwe-stars { letter-spacing: .05em; }
.zwe-meta .label { font-weight: 400; }

/* Enlaces internos por encima del enlace que cubre la tarjeta */
.zwe-where a, .zwe-meta a, .zwe-poster { position: relative; z-index: 1; }

/* ---------- Póster ---------- */
.zwe-poster {
  display: block;
  width: 12em;                        /* más grande: el cartel es lo que más informa del evento */
  overflow: hidden;
  border-radius: 10px;
  background: rgba(127, 127, 127, .12);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .1);
}
.zwe-poster img {
  display: block;
  width: 100%;
  height: auto;                       /* proporción natural del cartel (antes recortado a 3:4) */
  max-height: 20em;
  object-fit: cover;
  object-position: top;
}

/* ---------- Vacío / pie ---------- */
.zwe-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75em;
  padding: 2.5em 1em;
  border: 1px dashed var(--zwe-line);
  border-radius: var(--zwe-radius);
  text-align: center;
}
.zwe-empty svg { width: 2.5em; height: 2.5em; opacity: .6; }
.zwe-empty p { margin: 0; font-size: 1.05em; }
.zwe-add { margin: 1em 0 1.5em; text-align: center; }

/* ---------- Móvil ---------- */
@media (max-width: 599px) {
  .zwe-item {
    grid-template-columns: 4em minmax(0, 1fr);
    grid-template-rows: auto auto;
    gap: .75em;
    padding: .85em;
  }
  .zwe-day { font-size: 1.6em; }
  /* el póster va abajo a todo el ancho de la tarjeta, completo (sin recortar) */
  .zwe-date   { grid-column: 1; grid-row: 1; }
  .zwe-body   { grid-column: 2; grid-row: 1; }
  .zwe-poster { grid-column: 1 / -1; grid-row: 2; width: 100%; }
  .zwe-poster img { max-height: 28em; object-fit: contain; }
  .zwe-item .zwe-title { font-size: 1.05em; }
}

/* ============================================================
   Ficha del evento  (article.zwe-detail, getListing())
   ============================================================ */
.zwe-detail {
  --zwe-line: rgba(127, 127, 127, .28);
  --zwe-soft: rgba(127, 127, 127, .07);
  --zwe-accent: #b91c1c;
  --zwe-live: #15803d;
  --zwe-soon: #b45309;
  --zwe-radius: 14px;
  margin: 0 0 2em;
}
.zwe-detail[data-state="today"] .zwe-chip { background: var(--zwe-accent); color: #fff; }
.zwe-detail[data-state="live"] .zwe-chip  { background: var(--zwe-live); color: #fff; }
.zwe-detail[data-state="soon"] .zwe-chip  { background: var(--zwe-soon); color: #fff; }
.zwe-detail[data-state="live"] .zwe-dow   { background: var(--zwe-live); }
.zwe-detail[data-state="ended"] .zwe-dow  { background: rgba(127, 127, 127, .6); }

/* Cabecera: cartel a la izquierda (si hay) y los datos a la derecha */
.zwe-hero { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.5em; margin: 0 0 1.75em; }
@media (min-width: 768px) {
  .zwe-hero--poster { grid-template-columns: minmax(14em, 2fr) minmax(0, 3fr); align-items: start; }
}
.zwe-hero-poster {
  display: block;
  overflow: hidden;
  border-radius: var(--zwe-radius);
  background: var(--zwe-soft);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .12);
}
.zwe-hero-poster img { display: block; width: 100%; height: auto; max-height: 75vh; object-fit: contain; }
.zwe-hero-main { display: flex; flex-direction: column; gap: .9em; min-width: 0; }
.zwe-hero-main .zwe-when { margin: 0; }
.zwe-detail .zwe-detail-title {
  margin: 0;
  font-size: clamp(1.6em, 4vw, 2.4em);
  font-weight: 700;
  line-height: 1.15;
  overflow-wrap: anywhere;
}
.zwe-edit { font-size: .5em; vertical-align: middle; }

/* Calendario + datos */
.zwe-facts { display: grid; grid-template-columns: 5em minmax(0, 1fr); gap: 1em; align-items: start; }
.zwe-detail .zwe-dl { margin: 0; border-top: 1px solid var(--zwe-line); }
.zwe-row {
  display: grid;
  grid-template-columns: 6em minmax(0, 1fr);
  gap: .75em;
  padding: .6em 0;
  border-bottom: 1px solid var(--zwe-line);
}
.zwe-row dt { margin: 0; font-size: .9em; font-weight: 400; opacity: .7; }
.zwe-row dd { margin: 0; overflow-wrap: anywhere; }

.zwe-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6em; }
.zwe-actions .btn { min-height: 2.75em; padding: .55em 1.1em; border-radius: 10px; }
.zwe-actions .label { font-size: .8em; font-weight: 400; }
.zwe-hero-main .zwe-meta { margin: 0; font-size: .85em; }

/* Descripción + QR */
.zwe-detail-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.5em; margin: 0 0 1.75em; }
@media (min-width: 768px) {
  .zwe-detail-body { grid-template-columns: minmax(0, 1fr) 13em; align-items: start; }
}
.zwe-detail-desc { line-height: 1.65; overflow-wrap: anywhere; }
.zwe-detail-desc img { max-width: 100%; height: auto; }
.zwe-side {
  padding: 1em;
  border: 1px solid var(--zwe-line);
  border-radius: var(--zwe-radius);
  background: var(--zwe-soft);
  text-align: center;
}
.zwe-side p { margin: .5em 0 0; opacity: .8; }
.zwe-qr { display: flex; justify-content: center; min-height: 100px; }
.zwe-qr img, .zwe-qr canvas { max-width: 100%; height: auto; }
.zwe-social { margin-top: .75em; }

.zwe-h2 { margin: 0 0 .6em; font-size: 1.15em; font-weight: 600; }
.zwe-venue { margin: 0 0 1.75em; padding: 1em 1.25em; border: 1px solid var(--zwe-line); border-radius: var(--zwe-radius); }
.zwe-detail .zwe-admin { margin: 0 0 1.5em; padding: .5em 1em; border: 1px dashed var(--zwe-line); border-radius: 10px; font-size: .85em; }
.zwe-comments { margin: 0 0 1.75em; }

/* Evento anterior / siguiente */
.zwe-pn { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75em; margin: 0 0 1.75em; }
.zwe-pn a {
  display: flex;
  flex-direction: column;
  gap: .2em;
  padding: .8em 1em;
  border: 1px solid var(--zwe-line);
  border-radius: 12px;
  color: inherit;
  text-decoration: none;
}
.zwe-pn a:hover { border-color: currentColor; background: var(--zwe-soft); text-decoration: none; }
.zwe-pn a:focus-visible { outline: 3px solid var(--g-accent, #0b6fd6); outline-offset: 2px; }
.zwe-pn small { font-size: .78em; letter-spacing: .04em; text-transform: uppercase; opacity: .7; }
.zwe-pn span { font-weight: 600; overflow-wrap: anywhere; }
.zwe-pn-prev small::before { content: "‹ "; }
.zwe-pn-next { text-align: right; }
.zwe-pn-next small::after { content: " ›"; }

@media (max-width: 599px) {
  .zwe-facts { grid-template-columns: 4em minmax(0, 1fr); }
  .zwe-row { grid-template-columns: minmax(0, 1fr); gap: .1em; }
  .zwe-pn { grid-template-columns: minmax(0, 1fr); }
  .zwe-pn-next { text-align: left; }
}


/* ============================================================
   Paginador  (nav.zwd-pager) — mismo estilo que el directorio
   ============================================================ */
.zwd-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .5em 1em;
  margin: 1.5em 0;
}
.zwd-pager .zwd-pager-info { margin: 0; font-size: .85em; opacity: .8; }
.zwd-pager ul { display: flex; flex-wrap: wrap; gap: .35em; margin: 0; padding: 0; list-style: none; }
.zwd-pager li { margin: 0; padding: 0; }
.zwd-pager a, .zwd-pager [aria-current] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5em;
  height: 2.5em;
  padding: 0 .65em;
  border: 1px solid var(--zwd-line, rgba(127, 127, 127, .3));
  border-radius: 10px;
  color: inherit;
  text-decoration: none;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.zwd-pager a:hover { border-color: currentColor; background: var(--zwd-soft, rgba(127, 127, 127, .07)); }
.zwd-pager a:focus-visible { outline: 3px solid var(--g-accent, #0b6fd6); outline-offset: 2px; }
.zwd-pager [aria-current="page"] {
  border-color: var(--g-accent, #0b6fd6);
  background: var(--g-accent, #0b6fd6);
  color: #fff;
  font-weight: 700;
}
.zwd-pager .zwd-gap { display: flex; align-items: center; padding: 0 .25em; opacity: .6; }
