/* 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; }
.zwd-amen { display: flex; flex-wrap: wrap; gap: .4em; margin: 0; padding: 0; list-style: none; }
.zwd-amen li {
  display: inline-flex;
  align-items: center;
  gap: .45em;
  padding: .3em .75em .3em .55em;
  border: 1px solid var(--zwd-line, rgba(127, 127, 127, .3));
  border-radius: 999px;
  font-size: .88em;
  line-height: 1.3;
}
.zwd-amen svg {
  flex: none;
  width: 1.3em;
  height: 1.3em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* ---------- Lista | Calendario (viewNav()) ---------- */
.zwe-vh { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.zwe-views { display: flex; justify-content: flex-end; margin: 0 0 1em; }
.zwe-views ul { display: inline-flex; gap: .2em; margin: 0; padding: .25em; list-style: none; border: 1px solid rgba(127, 127, 127, .28); border-radius: 999px; background: rgba(127, 127, 127, .07); }
.zwe-views li { margin: 0; }
.zwe-views a {
  display: inline-flex; align-items: center; gap: .45em; min-height: 2.4em; padding: .25em 1em;
  border-radius: 999px; color: inherit; font-weight: 600; text-decoration: none; white-space: nowrap;
}
.zwe-views a:hover { background: rgba(127, 127, 127, .1); }
.zwe-views a[aria-current] { background: #b91c1c; color: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.zwe-views svg, .zwe-cal-nav svg { width: 1.1em; height: 1.1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.zwe-views a:focus-visible, .zwe-cal a:focus-visible { outline: 3px solid var(--zwe-accent, #b91c1c); outline-offset: 2px; }

/* ---------- Calendario del mes (calendar()) ---------- */
.zwe-cal-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5em 1em; margin: 0 0 .9em; }
.zwe-cal-title { margin: 0; font-size: 1.6em; font-weight: 700; line-height: 1.2; }
.zwe-cal-nav { display: flex; align-items: center; gap: .35em; }
.zwe-cal-nav a {
  display: inline-grid; place-items: center; min-width: 2.6em; height: 2.6em; padding: 0 .9em;
  border: 1px solid var(--zwe-line); border-radius: 999px; color: inherit; font-weight: 600; text-decoration: none;
}
.zwe-cal-nav a[rel] { padding: 0; }
.zwe-cal-nav a:hover { background: var(--zwe-soft); border-color: currentColor; }

.zwe-cal-dows, .zwe-cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); margin: 0; padding: 0; list-style: none; }
.zwe-cal-dows li { margin: 0; padding: .4em .5em; font-size: .78em; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; opacity: .7; }
.zwe-cal-dows abbr { text-decoration: none; border: 0; cursor: default; }
.zwe-cal-grid { border-top: 1px solid var(--zwe-line); border-left: 1px solid var(--zwe-line); border-radius: var(--zwe-radius); overflow: hidden; }
.zwe-cal-day {
  display: flex; flex-direction: column; gap: .3em; min-width: 0; min-height: 7.5em; margin: 0; padding: .4em;
  border-right: 1px solid var(--zwe-line); border-bottom: 1px solid var(--zwe-line);
}
.zwe-cal-day.is-weekend { background: var(--zwe-soft); }
.zwe-cal-day.is-out { background: none; }
.zwe-cal-day.is-out .zwe-cal-num { opacity: .3; }
.zwe-cal-num { display: flex; font-size: .9em; font-weight: 600; font-variant-numeric: tabular-nums; }
.zwe-cal-num time { display: inline-flex; align-items: center; justify-content: center; gap: .35em; min-width: 1.9em; height: 1.9em; border-radius: 999px; }
.zwe-cal-wd { display: none; }
.zwe-cal-day.is-today .zwe-cal-num time { padding: 0 .5em; background: var(--zwe-accent); color: #fff; }
.zwe-cal-day.is-past .zwe-cal-num { opacity: .55; }

.zwe-cal-evs { display: grid; gap: .25em; margin: 0; padding: 0; list-style: none; }
.zwe-cal-evs li { margin: 0; min-width: 0; }
.zwe-cal-ev {
  display: block; overflow: hidden; padding: .2em .45em; border-left: 3px solid var(--zwe-accent); border-radius: .35em;
  background: color-mix(in srgb, var(--zwe-accent) 10%, transparent); color: inherit; font-size: .8em; line-height: 1.35;
  text-decoration: none; white-space: nowrap; text-overflow: ellipsis;
}
.zwe-cal-ev:hover { background: color-mix(in srgb, var(--zwe-accent) 18%, transparent); }
.zwe-cal-ev:hover .zwe-cal-name { text-decoration: underline; }
.zwe-cal-ev.is-multi { border-left-color: var(--zwe-live); background: color-mix(in srgb, var(--zwe-live) 10%, transparent); }
.zwe-cal-ev.is-multi:hover { background: color-mix(in srgb, var(--zwe-live) 18%, transparent); }
.zwe-cal-ev.is-cont { border-left-style: dashed; }
.zwe-cal-time { font-weight: 700; font-variant-numeric: tabular-nums; }
.zwe-cal-day.is-past .zwe-cal-ev { opacity: .6; }
.zwe-cal-empty { margin: 1em 0 0; padding: 1.25em; border: 1px dashed var(--zwe-line); border-radius: var(--zwe-radius); text-align: center; opacity: .8; }

/* Móvil: agenda, solo los días con eventos */
@media (max-width: 599px) {
  .zwe-views { justify-content: center; }
  .zwe-cal-title { font-size: 1.3em; }
  .zwe-cal-dows { display: none; }
  .zwe-cal-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: .5em; border: 0; border-radius: 0; overflow: visible; }
  .zwe-cal-day { display: none; }
  .zwe-cal-day.has-ev {
    display: grid; grid-template-columns: 3.4em minmax(0, 1fr); align-items: start; gap: .75em; min-height: 0; padding: .65em;
    border: 1px solid var(--zwe-line); border-radius: var(--zwe-radius); background: var(--zwe-soft);
  }
  .zwe-cal-num time { flex-direction: column; gap: 0; width: 3.4em; height: auto; padding: .3em 0; border-radius: .6em; background: rgba(127, 127, 127, .12); line-height: 1.15; }
  .zwe-cal-day.is-today .zwe-cal-num time { padding: .3em 0; }
  .zwe-cal-wd { display: block; font-size: .72em; letter-spacing: .06em; text-transform: uppercase; }
  .zwe-cal-num time > span[aria-hidden]:not(.zwe-cal-wd) { font-size: 1.35em; font-weight: 700; }
  .zwe-cal-ev { padding: .45em .6em; font-size: .95em; white-space: normal; }
}
