/* Agenda: página clara; el mapa es un trozo de escenario que sale de la banda oscura. */
.banda { padding-bottom: clamp(120px, 14vw, 170px); }

.ag-mapa { position: relative; z-index: 2; margin-top: clamp(-120px, -10vw, -80px); padding: 0 var(--gutter); display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 0.8fr); gap: 28px; align-items: start; }
.mapa-card { background: var(--escena-2); color: var(--luz); border-radius: 22px; padding: clamp(16px, 2vw, 24px); position: relative; box-shadow: 0 30px 60px rgba(11, 10, 12, 0.28), inset 0 0 0 1px #2e2a33; }
.mapa-card svg { width: 100%; height: auto; display: block; }
.mapa-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.contador { font-weight: 900; font-stretch: 112%; font-variation-settings: "wdth" 112; font-size: clamp(2.6rem, 4.6vw, 3.8rem); line-height: 0.9; color: var(--albero); font-variant-numeric: tabular-nums; }
.contador small { display: block; font: 500 0.875rem/1.3 "Archivo", sans-serif; color: var(--luz-2); margin-top: 6px; }
.mapa-card .chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.mapa-card .chip { color: var(--luz); border-color: #4a4550; }
.mapa-card .chip[aria-pressed="true"] { background: var(--luz); color: var(--escena); border-color: var(--luz); }
.mapa-tip {
  position: absolute; pointer-events: none; background: var(--luz); color: var(--escena); border-radius: 8px; padding: 10px 12px;
  font-size: 0.8125rem; line-height: 1.35; box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4); max-width: 260px; opacity: 0; transform: translateY(4px);
  transition: opacity 120ms ease, transform 120ms ease; z-index: 5;
}
.mapa-tip.on { opacity: 1; transform: none; }
.mapa-tip b { display: block; font-size: 0.875rem; margin-bottom: 2px; }
.mapa-nota { font-size: 0.8125rem; color: #aaa3b0; margin: 10px 0 0; }
/* Las ciudades se encienden una a una, por orden de la primera función */
@media (prefers-reduced-motion: no-preference) {
  .city.entra circle { transform-box: fill-box; transform-origin: center; animation: enciende 560ms var(--ease-out) both; animation-delay: var(--d, 0ms); }
}
@keyframes enciende { 0% { opacity: 0; transform: scale(0.2); } 70% { opacity: 1; transform: scale(1.3); } 100% { transform: scale(1); } }

.ag-proximas { background: #fff; border-radius: 22px; padding: 24px; box-shadow: inset 0 0 0 1px var(--linea), 0 30px 60px rgba(11, 10, 12, 0.12); }
.ag-proximas h2 { font-weight: 900; font-size: 1.5rem; margin: 0 0 14px; }
.fechas { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--tinta); }
.fechas li { display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 13px 0; border-bottom: 1px solid var(--linea); }
.fecha { font-weight: 900; font-stretch: 80%; font-variation-settings: "wdth" 80; font-size: 1.8rem; line-height: 0.95; }
.fecha small { display: block; font: 600 0.8125rem "Archivo", sans-serif; color: var(--tinta-2); }
.fechas .lugar b { display: block; font-weight: 700; }
.fechas .lugar span { color: var(--tinta-2); font-size: 0.9375rem; }
.tag-show { font: 700 0.75rem/1 "Archivo", sans-serif; padding: 6px 9px; border-radius: 999px; color: var(--tinta); background: var(--c, var(--papel-2)); white-space: nowrap; }
.ejemplo { font-size: 0.8125rem; color: var(--tinta-2); margin: 10px 0 0; }

.ag-sec { padding: clamp(64px, 9vw, 112px) var(--gutter) 0; }
.ag-sec:last-of-type { padding-bottom: 96px; }
.ag-sec-cab { display: flex; justify-content: space-between; align-items: end; gap: 16px 40px; flex-wrap: wrap; margin-bottom: 26px; }
.ag-sec-cab h2 { margin: 0; font-weight: 900; font-stretch: 85%; font-variation-settings: "wdth" 85; font-size: clamp(2.2rem, 4.6vw, 4rem); line-height: 0.95; }
.ag-sec-cab p { margin: 0; max-width: 46ch; color: var(--tinta-2); }

.dispo { display: grid; grid-template-columns: repeat(var(--ver, 4), minmax(0, 1fr)); gap: 28px; }
.dispo-nav { display: flex; align-items: center; gap: 12px; }
.dispo-nav[hidden] { display: none; }
.dispo-rango { min-width: 15ch; text-align: center; font-weight: 700; font-size: 1rem; font-variant-numeric: tabular-nums; }
.dispo-btn { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid var(--tinta); background: #fff; color: var(--tinta); cursor: pointer; transition: transform 160ms var(--ease-out, ease-out), background-color 160ms ease, color 160ms ease; }
.dispo-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.dispo-btn:active:not(:disabled) { transform: scale(0.94); }
.dispo-btn:disabled { opacity: 0.35; cursor: default; }
@media (hover: hover) and (pointer: fine) { .dispo-btn:hover:not(:disabled) { background: var(--tinta); color: #fff; } }
@media (prefers-reduced-motion: no-preference) {
  .dispo[data-dir="1"] .mes { animation: mes-entra-d 320ms var(--ease-out, ease-out) both; }
  .dispo[data-dir="-1"] .mes { animation: mes-entra-i 320ms var(--ease-out, ease-out) both; }
}
@keyframes mes-entra-d { from { opacity: 0.4; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes mes-entra-i { from { opacity: 0.4; transform: translateX(-24px); } to { opacity: 1; transform: none; } }
.mes h3 { font-weight: 800; font-size: 1.35rem; margin: 0 0 10px; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal .dow { font-size: 0.75rem; color: var(--tinta-2); text-align: center; padding-bottom: 4px; }
.cal .d { aspect-ratio: 1; display: grid; place-items: center; border-radius: 50%; font-size: 0.875rem; font-weight: 600; background: #fff; box-shadow: inset 0 0 0 1px var(--linea); font-variant-numeric: tabular-nums; }
.cal .d.ocupado { background: var(--tinta); color: var(--papel); box-shadow: none; }
.cal .d.color { background: var(--fondo); color: #1c1a1f; font-weight: 800; box-shadow: inset 0 0 0 2px rgba(28, 26, 31, 0.18); }
.cal .d.vacio { background: none; box-shadow: none; }
@media (prefers-reduced-motion: no-preference) {
  .js-anima .dispo .d { opacity: 0; transform: scale(0.6); }
  .js-anima .dispo.visto .d { animation: sello 360ms var(--ease-out) both; animation-delay: calc(var(--i, 0) * 9ms); }
}
@keyframes sello { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: none; } }
.leyenda { display: flex; gap: 18px; flex-wrap: wrap; font-size: 0.875rem; margin-top: 18px; color: var(--tinta-2); }
.leyenda span::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; background: #fff; box-shadow: inset 0 0 0 1px var(--linea); }
.leyenda .l-ocupado::before { background: var(--tinta); box-shadow: none; }
.leyenda .l-show::before { background: var(--c); box-shadow: none; }

.filtros { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tabla-wrap { overflow-x: auto; background: #fff; border-radius: 18px; padding: 6px 20px 10px; box-shadow: inset 0 0 0 1px var(--linea); }
.historico { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.historico th { text-align: left; font-weight: 700; color: var(--tinta-2); padding: 14px 12px 10px 0; border-bottom: 2px solid var(--tinta); }
.historico td { padding: 11px 12px 11px 0; border-bottom: 1px solid var(--linea); vertical-align: top; }
.historico tr:last-child td { border-bottom: 0; }
.historico td:first-child { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--tinta-2); }
@media (hover: hover) and (pointer: fine) { .historico tbody tr.fila:hover { background: var(--papel); } }
/* Histórico por años: cada año se pliega y se despliega */
.historico .anio-cab th { padding: 0; border-bottom: 1px solid var(--linea); }
.historico .anio-btn { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 56px; padding: 10px 0; background: none; border: 0; font: inherit; color: var(--tinta); text-align: left; cursor: pointer; }
.historico .anio-n { font-weight: 800; font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.historico .anio-c { color: var(--tinta-2); font-weight: 600; font-size: 0.9375rem; }
.historico .anio-btn svg { width: 22px; height: 22px; margin-left: auto; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform 200ms var(--ease-out, ease-out); }
.historico .anio.abierto .anio-btn svg { transform: rotate(180deg); }
.historico .anio:not(.abierto) tr.fila { display: none; }
.historico .anio:last-of-type .anio-cab th { border-bottom: 0; }
.historico .anio.abierto:last-of-type .anio-cab th { border-bottom: 1px solid var(--linea); }
/* En el móvil cada función son dos líneas: fecha y espectáculo; lugar y ciudad */
@media (max-width: 620px) {
  .tabla-wrap { padding: 4px 16px 8px; }
  .historico thead { display: none; }
  .historico tr.fila { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; padding: 12px 0; border-bottom: 1px solid var(--linea); }
  .historico .anio:not(.abierto) tr.fila { display: none; }
  .historico tr.fila td { padding: 0; border: 0; }
  .historico .h-show { justify-self: end; }
  .historico .h-lugar { grid-column: 1 / -1; grid-row: 2; }
  .historico .h-ciudad { grid-column: 1 / -1; grid-row: 2; justify-self: start; }
  .historico .h-lugar:empty { display: none; }
  .historico .h-lugar:not(:empty) + .h-ciudad { grid-row: 3; color: var(--tinta-2); font-size: 0.875rem; }
  .historico .h-ciudad { font-weight: 700; }
}

@media (max-width: 960px) { .ag-mapa { grid-template-columns: 1fr; } }
