/* Tipografias corporativas */
@font-face {
  font-family: "Tipo UBB";
  src: url("./fonts/Tipo-UBB-Light_Condensed.otf") format("opentype");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Tipo UBB";
  src: url("./fonts/Tipo-UBB-Bold_Condensed.otf") format("opentype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Tipo UBB";
  src: url("./fonts/Tipo-UBB-Black_Condensed.otf") format("opentype");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

/* Tokens base */
:root {
  --font-display: "Tipo UBB", "Arial Narrow", sans-serif;
  --font-body: "Segoe UI", "Fira Sans", Arial, sans-serif;
  --bg: #174a55;
  --surface: #ffffff;
  --surface-alt: #f7fafc;
  --text: #39485d;
  --text-soft: rgba(57, 72, 93, 0.78);
  --blue: #1d3c71;
  --green-soft: #9fbe79;
  --poster-ink: #174a55;
  --poster-green: #8eb670;
  --line: rgba(29, 60, 113, 0.12);
  --line-strong: rgba(159, 190, 121, 0.84);
  --shadow-soft: 0 18px 40px rgba(29, 60, 113, 0.06);
  --radius: 4px;
  --radius-small: 4px;
}

/* Reset */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scrollbar-color: rgba(198, 218, 183, 0.92) rgba(23, 74, 85, 0.72);
  scrollbar-width: thin;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.5;
}

body::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

body::-webkit-scrollbar-track {
  background: rgba(23, 74, 85, 0.74);
}

body::-webkit-scrollbar-thumb {
  border: 2px solid rgba(23, 74, 85, 0.74);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(198, 218, 183, 0.95), rgba(83, 128, 99, 0.96));
}

body::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(198, 218, 183, 1), rgba(83, 128, 99, 1));
}

body::before,
body::after {
  content: "";
  position: fixed;
  z-index: 0;
  pointer-events: none;
  background-repeat: no-repeat;
}

/* Formas decorativas del fondo */
body::before {
  top: -300px;
  left: -300px;
  width: 780px;
  height: 780px;
  background-image:
    radial-gradient(circle at 300px 300px, transparent 0 210px, rgba(83, 128, 99, 0.96) 210px 252px, transparent 252px),
    radial-gradient(circle at 300px 300px, transparent 0 282px, rgba(83, 128, 99, 0.78) 282px 366px, transparent 366px);
}

body::after {
  right: -286px;
  bottom: -286px;
  width: 760px;
  height: 760px;
  background-image:
    radial-gradient(circle at calc(100% - 286px) calc(100% - 286px), transparent 0 214px, rgba(83, 128, 99, 0.92) 214px 256px, transparent 256px),
    radial-gradient(circle at calc(100% - 286px) calc(100% - 286px), transparent 0 284px, rgba(83, 128, 99, 0.72) 284px 368px, transparent 368px);
}

.program-shell {
  position: relative;
  z-index: 1;
  width: min(1220px, calc(100% - 32px));
  margin: 24px auto;
  padding: 26px;
  border: 1px solid rgba(29, 60, 113, 0.12);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

/* Cabecera */
.hero {
  display: grid;
  gap: 16px;
  padding: 30px 8px 24px;
  text-align: center;
}

.hero__institution {
  display: flex;
  justify-content: center;
  width: 100%;
  padding-bottom: 30px;
}

.hero__header {
  display: grid;
  grid-template-columns: minmax(100px, 140px) minmax(0, 1fr);
  align-items: center;
  gap: 30px;
  width: 100%;
  max-width: 940px;
  margin: 0 auto;
}

.hero__brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.hero__brand--program {
  justify-content: flex-start;
  justify-self: start;
}

.hero__brand img {
  display: block;
  height: auto;
  object-fit: contain;
}

.hero__brand--program img {
  width: min(132px, 40vw);
  max-height: 184px;
}

.hero__institution img {
  width: min(184px, 31vw);
  max-height: 122px;
  height: auto;
  object-fit: contain;
}

.hero__copy {
  display: grid;
  gap: 10px;
  text-align: left;
}

.hero__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 7vw, 4.5rem);
  font-weight: 900;
  line-height: 0.9;
  text-transform: uppercase;
  color: var(--blue);
}

.hero__month {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 4.2vw, 2.8rem);
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
  color: var(--green-soft);
}

/* Tarjeta principal */
.program-card {
  border: 2px solid rgba(29, 60, 113, 0.18);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.program-card__bar {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr) minmax(236px, 232px);
  align-items: center;
  gap: 20px;
  padding: 30px 22px 28px;
  border-bottom: 1px solid rgba(29, 60, 113, 0.14);
  background: var(--surface-alt);
}

.program-card__copy {
  min-width: 0;
}

/* Texto de apoyo de la agenda */
.program-card__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--blue);
}

.program-card__hint {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--text-soft);
  text-align: left;
}

/* Selector de vista */
.view-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  justify-self: end;
}

.view-switch__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid rgba(29, 60, 113, 0.16);
  border-radius: var(--radius);
  background: rgba(247, 250, 252, 0.86);
  color: var(--text-soft);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease;
}

.view-switch__icon {
  display: inline-flex;
  width: 14px;
  height: 14px;
}

.view-switch__icon svg {
  width: 100%;
  height: 100%;
}

.view-switch__button.is-active {
  border-color: rgba(29, 60, 113, 0.28);
  background: rgba(29, 60, 113, 0.08);
  color: var(--blue);
}

.program-view {
  display: none;
}

.program-view.is-active {
  display: block;
}

/* Vista timeline */
.agenda-editorial {
  display: grid;
  gap: 36px;
  padding: 36px 34px 34px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(250, 252, 253, 0.98));
}

.agenda-month {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 34px;
  align-items: start;
}

.agenda-month + .agenda-month {
  padding-top: 36px;
  border-top: 1px solid var(--line);
}

.agenda-month__intro {
  position: sticky;
  top: 22px;
  display: grid;
  gap: 6px;
  align-content: start;
}

/* Línea base del timeline */
.agenda-month__eyebrow {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(29, 60, 113, 0.48);
}

.agenda-month__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 0.92;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--green-soft);
}

.agenda-month__meta {
  margin: 0;
  font-size: 0.86rem;
  color: var(--text-soft);
}

.agenda-month__timeline {
  position: relative;
  display: grid;
  gap: 30px;
  padding-left: 28px;
}

.agenda-month__timeline::before {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 13px;
  width: 2px;
  background: linear-gradient(180deg, rgba(159, 190, 121, 0.42), rgba(29, 60, 113, 0.24));
}

/* Punto de cada día sobre la línea */
.agenda-day {
  position: relative;
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}

.agenda-day::before {
  content: "";
  position: absolute;
  top: 35px;
  left: -24px;
  width: 13px;
  height: 13px;
  border: 3px solid rgba(159, 190, 121, 0.88);
  border-radius: 999px;
  background: var(--surface);
}

.agenda-day--featured::before {
  border-color: var(--blue);
}

.agenda-day__date {
  display: grid;
  gap: 8px;
  justify-items: start;
  padding-top: 14px;
  padding-left: 10px;
}

.agenda-day__weekday {
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(57, 72, 93, 0.56);
}

.agenda-day__number {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 0.85;
  color: var(--blue);
}

.agenda-day__content {
  display: grid;
  gap: 18px;
}

.agenda-events {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
}

.agenda-events--columns {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.agenda-events--triple {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* Tarjeta base de cada actividad */
.event-item {
  position: relative;
  min-height: 100%;
  padding: 14px 12px 12px;
  border: 2px solid rgba(29, 60, 113, 0.16);
  border-radius: var(--radius-small);
  background: #ffffff;
  box-shadow: 0 8px 16px rgba(23, 74, 85, 0.04);
}

.event-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: 10px;
  width: 26px;
  height: 2px;
  border-radius: var(--radius-small);
  background: rgba(29, 60, 113, 0.18);
}

.event-item--concepcion {
  border-color: rgba(23, 74, 85, 0.16);
  background: rgba(197, 210, 212, 0.22);
}

.event-item--chillan {
  border-color: rgba(142, 182, 112, 0.24);
  background: rgba(198, 218, 183, 0.3);
}

.event-item--concepcion::before {
  background: var(--poster-ink);
}

.event-item--chillan::before {
  background: var(--poster-green);
}

.event-item__title {
  display: block;
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 0.92;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: var(--blue);
}

.event-item__meta {
  display: grid;
  gap: 2px;
}

/* Hora y sede van una debajo de la otra */
.event-item__location,
.event-item__time {
  font-size: 0.88rem;
  line-height: 1.2;
  color: var(--text-soft);
}

.event-item__time {
  font-weight: 700;
  color: var(--text-soft);
  letter-spacing: 0;
}

.event-item__location {
  font-weight: 700;
}

.event-item--concepcion .event-item__location {
  color: var(--poster-ink);
}

.event-item--chillan .event-item__location {
  color: #6d9353;
}

/* Calendario */
.program-table-wrap--calendar {
  padding: 20px 22px 22px;
  overflow-x: auto;
}

.calendar-section + .calendar-section {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.calendar-section__title {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--green-soft);
}

.program-table {
  width: 100%;
  min-width: 980px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.program-table th {
  padding: 12px 12px 14px;
  border-bottom: 2px solid var(--line-strong);
  background: transparent;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--blue);
}

.program-table tbody tr + tr td {
  border-top: 1px solid rgba(29, 60, 113, 0.08);
}

.program-table td {
  padding: 10px;
  vertical-align: top;
}

.day-cell {
  min-height: 172px;
  padding: 10px 8px 12px;
  border: 0;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
}

.day-cell--empty {
  background: rgba(247, 250, 252, 0.58);
}

.day-cell--special {
  background: rgba(187, 191, 196, 0.52);
  border-color: rgba(130, 139, 149, 0.4);
}

.day-cell__date {
  display: inline-block;
  margin-bottom: 10px;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 0.9;
  color: var(--blue);
}

.events-list {
  display: grid;
  gap: 12px;
  align-content: start;
}

/* Ajuste extra cuando hay varios eventos en el mismo día */
.day-cell .events-list {
  gap: 14px;
}

.program-table .events-list .event-item,
.mobile-agenda .events-list .event-item {
  margin-bottom: 2px;
}

.mobile-agenda {
  display: none;
  gap: 18px;
  padding: 20px 18px 20px;
}

/* Calendario simplificado para móvil */
.mobile-month {
  display: grid;
  gap: 10px;
}

.mobile-month + .mobile-month {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.mobile-month__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--green-soft);
}

.mobile-week {
  display: grid;
  gap: 10px;
}

.mobile-week__title {
  margin: 0;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(29, 60, 113, 0.08);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(29, 60, 113, 0.66);
}

.mobile-day {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 2px solid rgba(29, 60, 113, 0.12);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
}

.mobile-day--special {
  background: rgba(187, 191, 196, 0.52);
  border-color: rgba(130, 139, 149, 0.4);
}

.mobile-day__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.mobile-day__weekday {
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(29, 60, 113, 0.62);
}

.mobile-day__date {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 0.9;
  color: var(--blue);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Fecha de actualización */
.footer-note {
  padding: 18px 4px 4px;
  color: rgba(57, 72, 93, 0.62);
  font-size: 0.86rem;
  text-align: right;
}

/* Botón para volver arriba */
.scroll-top-link {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(198, 218, 183, 0.42);
  border-radius: 999px;
  background: rgba(23, 74, 85, 0.86);
  color: rgba(255, 255, 255, 0.92);
  font-size: 1.1rem;
  line-height: 1;
  text-decoration: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: transform 180ms ease, background-color 180ms ease, border-color 180ms ease, opacity 180ms ease, visibility 180ms ease;
}

.scroll-top-link.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.scroll-top-link:hover,
.scroll-top-link:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(198, 218, 183, 0.72);
  background: rgba(23, 74, 85, 0.96);
  outline: none;
}

/* Tablet y pantallas medianas */
@media (max-width: 960px) {
  .program-shell {
    width: min(100% - 20px, 1220px);
    margin: 10px auto;
    padding: 18px 14px;
  }

  .hero {
    padding: 28px 6px 18px;
  }

  .hero__header {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .hero__brand {
    justify-content: center;
    justify-self: center;
  }

  .hero__copy {
    text-align: center;
  }

  .program-card__bar {
    grid-template-columns: 1fr;
    align-items: flex-start;
  }

  .program-card__hint {
    max-width: none;
  }

  .view-switch {
    justify-self: start;
  }

  .agenda-editorial {
    padding: 26px 22px 22px;
  }

  .agenda-month {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .agenda-month__intro {
    position: static;
  }

  .agenda-month__timeline {
    padding-left: 26px;
  }

  .agenda-day {
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 24px;
  }

  .agenda-day__number {
    font-size: 2rem;
  }

  .agenda-events--columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .agenda-events--triple {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .program-table-wrap--calendar {
    display: none;
  }

  .mobile-agenda {
    display: grid;
  }

  .footer-note {
    text-align: center;
  }

  .scroll-top-link {
    right: 14px;
    bottom: 14px;
    width: 40px;
    height: 40px;
  }
}

/* Móvil */
@media (max-width: 520px) {
  body::before,
  body::after {
    opacity: 1;
  }

  body::before {
    top: -190px;
    left: -190px;
    width: 500px;
    height: 500px;
    background-image:
      radial-gradient(circle at 190px 190px, transparent 0 126px, rgba(83, 128, 99, 0.96) 126px 162px, transparent 162px),
      radial-gradient(circle at 190px 190px, transparent 0 172px, rgba(83, 128, 99, 0.78) 172px 244px, transparent 244px);
  }

  body::after {
    right: -182px;
    bottom: -182px;
    width: 488px;
    height: 488px;
    background-image:
      radial-gradient(circle at calc(100% - 182px) calc(100% - 182px), transparent 0 132px, rgba(83, 128, 99, 0.92) 132px 168px, transparent 168px),
      radial-gradient(circle at calc(100% - 182px) calc(100% - 182px), transparent 0 178px, rgba(83, 128, 99, 0.72) 178px 250px, transparent 250px);
  }

  .hero__title {
    font-size: clamp(2.2rem, 11vw, 3.2rem);
  }

  .hero__month {
    font-size: clamp(1.45rem, 7vw, 2rem);
  }

  .hero__brand--program img {
    width: 160px;
    max-height: 86px;
  }

  .hero__institution img {
    width: 152px;
  }

  .agenda-editorial {
    padding-inline: 12px;
  }

  .view-switch {
    padding-inline: 0;
  }

  .agenda-month__timeline {
    padding-left: 20px;
  }

  .agenda-day {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .agenda-day::before {
    top: 16px;
    left: -18px;
  }

  .agenda-day__date {
    padding-top: 0;
    padding-left: 26px;
  }

  .agenda-day__content {
    margin-left: 20px;
    gap: 14px;
  }

  .agenda-events {
    gap: 14px;
    grid-template-columns: 1fr;
  }

  .agenda-events--triple {
    grid-template-columns: 1fr;
  }

  .event-item {
    padding: 15px 13px 13px;
  }
}

/* Respeta usuarios con menos animación */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
