/* ==========================================================================
   Sección "Próximas Actividades" — Universidad Arturo Prat
   Todas las clases van con prefijo .upa- para no colisionar con el portal.
   ========================================================================== */

.upa-seccion {
  width: 100%;
  box-sizing: border-box;
  padding: clamp(32px, 5vw, 56px) clamp(16px, 3vw, 24px) clamp(40px, 6vw, 72px);
  background: #ffffff;
  font-family: Montserrat, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  color: #3d4450;
}
.upa-seccion *,
.upa-seccion *::before,
.upa-seccion *::after { box-sizing: border-box; }

.upa-inner { max-width: 1320px; margin: 0 auto; }

/* --- Encabezado y conmutador de vista ----------------------------------- */
.upa-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}
.upa-titulo {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
  color: #0d5da9;
}
.upa-vistas { display: flex; align-items: center; gap: 8px; }
.upa-vista {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid #0d5da9;
  border-radius: 4px;
  background: #ffffff;
  color: #0d5da9;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}
.upa-vista:hover { background: #f4f8fc; }
.upa-vista[aria-pressed="true"] { background: #0d5da9; color: #ffffff; }
.upa-vista[aria-pressed="true"]:hover { background: #0b5296; }
.upa-vista svg { flex: none; }

/* --- Carrusel ----------------------------------------------------------- */
.upa-panel[hidden] { display: none; }

.upa-track {
  display: flex;
  gap: 24px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.upa-track::-webkit-scrollbar { display: none; }

.upa-card {
  flex: 0 0 calc((100% - 72px) / 4);
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 1px solid #e6e8ec;
  border-radius: 2px;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.06);
  overflow: hidden;
  transition: box-shadow 180ms ease, transform 180ms ease;
}
.upa-card:hover {
  box-shadow: 0 10px 24px rgba(16, 24, 40, 0.12);
  transform: translateY(-3px);
}

@media (max-width: 1180px) { .upa-card { flex-basis: calc((100% - 48px) / 3); } }
@media (max-width: 900px)  { .upa-card { flex-basis: calc((100% - 24px) / 2); } }
@media (max-width: 620px)  { .upa-card { flex-basis: calc(100% - 34px); } }

.upa-card-media { position: relative; }
.upa-card-media > a {
  display: block;
  position: relative;
  width: 100%;
  aspect-ratio: 5 / 4;
  background: #f2f3f5;
}
.upa-card-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.upa-fecha {
  position: absolute;
  left: 16px;
  bottom: -28px;
  width: 68px;
  padding: 8px 0 10px;
  background: #0d5da9;
  color: #ffffff;
  text-align: center;
}
.upa-fecha-dia { font-size: 26px; font-weight: 700; line-height: 1.05; }
.upa-fecha-mes { font-size: 17px; font-weight: 500; line-height: 1.2; text-transform: uppercase; }

.upa-card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 52px 20px 20px;
}
.upa-card-titulo {
  display: block;
  min-height: 66px;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.45;
  color: #0d5da9;
  text-decoration: none;
  text-wrap: pretty;
}
.upa-card-titulo:hover { color: #084b8a; }
.upa-card-sep { height: 1px; background: #0d5da9; margin: 22px 0 14px; }

.upa-datos {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 62px;
}
.upa-dato {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13.5px;
  font-weight: 400;
  color: #3d4450;
}
.upa-dato svg { flex: none; margin-top: 3px; }

/* --- Etiquetas ---------------------------------------------------------- */
.upa-etiquetas {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}
.upa-etiqueta {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border: 1px solid #0d5da9;
  border-radius: 999px;
  background: #ffffff;
  color: #0d5da9;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}
.upa-etiqueta--presencial {
  border-color: #8cbde6;
  background: #e6f2fb;
  color: #0d5da9;
}
.upa-etiqueta--virtual {
  border-color: #72c4ca;
  background: #e0f5f6;
  color: #0a6b73;
}
.upa-etiqueta--sm { padding: 3px 7px; font-size: 8.5px; letter-spacing: 0.07em; line-height: 1.2; }

/* --- Controles de paginación ------------------------------------------- */
.upa-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 32px;
}
.upa-dots-inner {
  display: flex;
  align-items: center;
  gap: 6px;
  width: min(180px, 40%);
}
.upa-dot {
  height: 18px;
  padding: 4px 0;
  border: 0;
  border-radius: 999px;
  background-color: #d3d9e0;
  background-clip: content-box;
  cursor: pointer;
  flex: 1 1 0%;
  transition: flex-grow 420ms cubic-bezier(0.4, 0, 0.2, 1), background-color 300ms ease;
}
.upa-dot[aria-current="true"] { flex-grow: 3; background-color: #0d5da9; }

/* --- Calendario -------------------------------------------------------- */
.upa-cal { display: flex; flex-direction: column; gap: 18px; }
.upa-cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.upa-cal-btn {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #d3d9e0;
  border-radius: 50%;
  background: #ffffff;
  color: #0d5da9;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease;
}
.upa-cal-btn:hover { border-color: #0d5da9; background: #f4f8fc; }
.upa-cal-btn[disabled] { opacity: 0.35; cursor: default; }
.upa-cal-btn[disabled]:hover { border-color: #d3d9e0; background: #ffffff; }
.upa-cal-mes {
  font-size: clamp(18px, 2.4vw, 24px);
  font-weight: 500;
  color: #0d5da9;
  text-align: center;
}

.upa-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  background: #e6e8ec;
  border: 1px solid #e6e8ec;
}
.upa-grid-head {
  padding: 10px 6px;
  background: #ffffff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #8a919c;
  text-align: center;
}
.upa-celda {
  min-height: 96px;
  padding: 8px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.upa-celda--fuera { background: #fafbfc; }
.upa-celda-dia { font-size: 12px; font-weight: 600; color: #3d4450; }
.upa-celda--fuera .upa-celda-dia { color: #c3c9d1; }
.upa-evento {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  text-decoration: none;
  transition: opacity 160ms ease;
}
.upa-evento:hover { opacity: 0.75; }
.upa-evento-nombre {
  font-size: 10.5px;
  font-weight: 500;
  line-height: 1.3;
  color: #0d5da9;
  text-wrap: pretty;
}

/* --- Agenda (móvil) ---------------------------------------------------- */
.upa-agenda { display: flex; flex-direction: column; gap: 10px; }
.upa-agenda-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px;
  border: 1px solid #e6e8ec;
  border-radius: 2px;
  background: #ffffff;
  text-decoration: none;
}
.upa-agenda-item:hover { border-color: #0d5da9; }
.upa-agenda-fecha {
  flex: none;
  width: 52px;
  padding: 7px 0;
  background: #0d5da9;
  color: #ffffff;
  text-align: center;
  border-radius: 2px;
}
.upa-agenda-dia { display: block; font-size: 19px; font-weight: 700; line-height: 1.05; }
.upa-agenda-mes { display: block; font-size: 11px; font-weight: 500; text-transform: uppercase; }
.upa-agenda-texto {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
}
.upa-agenda-nombre {
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.35;
  color: #0d5da9;
  text-wrap: pretty;
}
.upa-vacio {
  padding: 22px 14px;
  border: 1px dashed #dfe3e8;
  border-radius: 2px;
  font-size: 13px;
  color: #8a919c;
  text-align: center;
}

/* La grilla se cambia por la agenda bajo 700 px */
.upa-grid-wrap { display: block; }
.upa-agenda-wrap { display: none; }
@media (max-width: 699px) {
  .upa-grid-wrap { display: none; }
  .upa-agenda-wrap { display: block; }
}

/* --- Animación de cambio de mes ---------------------------------------- */
@keyframes upaEntraDer { from { opacity: 0; transform: translateX(26px); } to { opacity: 1; transform: none; } }
@keyframes upaEntraIzq { from { opacity: 0; transform: translateX(-26px); } to { opacity: 1; transform: none; } }
.upa-anim-next { animation: upaEntraDer 420ms cubic-bezier(0.22, 0.61, 0.36, 1) both; }
.upa-anim-prev { animation: upaEntraIzq 420ms cubic-bezier(0.22, 0.61, 0.36, 1) both; }

@media (prefers-reduced-motion: reduce) {
  .upa-card, .upa-dot, .upa-anim-next, .upa-anim-prev { transition: none; animation: none; }
}
