/* ITS - Nivel Primario: ajustes de diseño sobre la estética de la HOME */

/* Banner principal con carrusel de imágenes del Nivel Primario */
.primary-top-banner {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: #fff;
  line-height: 0;
}

.primary-slider {
  position: relative;
  width: 100%;
  aspect-ratio: 918 / 201;
  min-height: 200px;
  overflow: hidden;
}

.primary-slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity .8s ease-in-out;
  pointer-events: none;
}

.primary-slide.active {
  opacity: 1;
  pointer-events: auto;
}

.primary-slide img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.primary-slider-arrow {
  position: absolute;
  z-index: 5;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: rgba(0,0,0,.28);
  color: #fff;
  font-size: 34px;
  line-height: 38px;
  cursor: pointer;
  opacity: .8;
  transition: opacity .2s ease, background .2s ease;
}

.primary-slider-arrow:hover {
  opacity: 1;
  background: rgba(0,0,0,.45);
}

.primary-slider-prev { left: 20px; }
.primary-slider-next { right: 20px; }

.primary-slider-dots {
  position: absolute;
  z-index: 6;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  line-height: normal;
}

.primary-slider-dots button {
  width: 10px;
  height: 10px;
  padding: 0;
  border: 1px solid rgba(255,255,255,.9);
  border-radius: 50%;
  background: rgba(255,255,255,.55);
  cursor: pointer;
}

.primary-slider-dots button.active {
  background: #fff;
  transform: scale(1.2);
}

.primary-content {
  width: min(1180px, calc(100% - 40px));
  margin: auto;
  padding: 65px 0 85px;
}

.primary-contact-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 55px;
  padding: 28px 30px;
  border: 1px solid var(--its-border);
  border-radius: 12px;
  background: var(--its-soft);
}

.primary-contact-box h2 {
  margin: 0 0 6px;
  font-size: 28px;
}

.primary-contact-box p {
  margin: 0;
  color: var(--its-muted);
}

.gallery-block {
  scroll-margin-top: 105px;
}

.content-block {
  margin-top: 55px;
  padding-top: 10px;
}

.content-heading {
  margin-bottom: 25px;
}

.content-heading h2 {
  margin: 0;
  font-size: clamp(25px, 3vw, 34px);
  line-height: 1.25;
}

.video-frame {
  width: min(820px, 100%);
  margin: auto;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--its-border);
  border-radius: 12px;
  box-shadow: var(--its-shadow);
}

.video-frame video {
  display: block;
  width: 100%;
  height: auto;
  max-height: 600px;
  border-radius: 7px;
}

.primary-gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.primary-gallery img {
  display: block;
  width: 100%;
  height: 230px;
  object-fit: cover;
  border-radius: 9px;
  border: 1px solid var(--its-border);
  background: #f5f7f8;
  box-shadow: 0 8px 22px rgba(24,60,75,.08);
  transition: transform .2s ease, box-shadow .2s ease;
}

.primary-gallery img:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 30px rgba(24,60,75,.13);
}

.primary-gallery-wide {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.paginador {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 30px;
}

.paginador a,
.paginador span {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--its-border);
  border-radius: 7px;
  background: #fff;
  color: var(--its-text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}

.paginador a:hover,
.paginador .activo {
  border-color: var(--its-primary);
  background: var(--its-primary);
  color: #fff;
}

.paginador .deshabilitado {
  color: #aab5ba;
  background: #f5f7f8;
}

.paginador .material-icons {
  font-size: 21px;
}

@media (max-width: 900px) {
  .primary-gallery,
  .primary-gallery-wide {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .primary-contact-box {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 700px) {
  .header-inner {
    flex-wrap: wrap;
    padding: 12px 0;
    gap: 12px;
  }

  .brand img {
    width: 145px;
  }

  .main-nav {
    order: 3;
    width: 100%;
    margin-left: 0;
    justify-content: center;
  }

  .social-links {
    margin-left: auto;
  }

  .primary-slider {
    aspect-ratio: 918 / 201;
    min-height: 120px;
  }

  .primary-slider-arrow {
    width: 34px;
    height: 34px;
    font-size: 28px;
    line-height: 30px;
  }

  .primary-slider-prev { left: 10px; }
  .primary-slider-next { right: 10px; }

  .primary-content {
    padding-top: 45px;
  }

  .primary-gallery,
  .primary-gallery-wide {
    grid-template-columns: 1fr;
  }

  .primary-gallery img {
    height: auto;
    max-height: 420px;
  }
}

/* Corrección del slider: respeta la proporción original de los banners
   (918 x 201) y evita recortar el texto de las diapositivas. */
.primario-slider {
    width: 100%;
    height: auto !important;
    overflow: hidden;
    position: relative;
    background: #fff;
}

.primario-slider .slide {
    width: 100%;
    height: auto !important;
    aspect-ratio: 918 / 201;
    display: none;
    position: relative;
}

.primario-slider .slide.active {
    display: block;
}

.primario-slider .slide img {
    display: block;
    width: 100%;
    height: auto !important;
    max-width: 100%;
    object-fit: contain !important;
    object-position: center center;
}

.primario-slider .slider-controls {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 14px;
    z-index: 5;
    display: flex;
    justify-content: center;
    gap: 8px;
}

.primario-slider .slider-dot {
    width: 10px;
    height: 10px;
    padding: 0;
    border: 1px solid #777;
    border-radius: 50%;
    background: rgba(255,255,255,.9);
    cursor: pointer;
}

.primario-slider .slider-dot.active {
    background: #b40000;
}


/* Organización de actividades y galerías por año */
.activities-section {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  margin: 48px 0 60px;
}
.activities-intro {
  grid-column: 1 / -1;
  margin-bottom: 2px;
}
.activities-intro h2 {
  margin: 7px 0 8px;
  color: #173f4f;
  font-size: clamp(26px, 3vw, 36px);
}
.activities-intro p {
  margin: 0;
  color: #66747b;
}
.activity-card {
  margin: 0;
  min-width: 0;
  padding: 22px;
  border: 1px solid #e1e6e8;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 5px 20px rgba(18,63,80,.06);
}
.activity-card .content-heading h2 {
  color: #173f4f;
}
.activity-card .video-frame video {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 10px;
}
.activity-card .primary-gallery-wide {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.activity-card .primary-gallery-wide img {
  display: block;
  width: 100%;
  height: 170px;
  object-fit: cover;
  border-radius: 8px;
}
.year-gallery-block {
  margin-top: 50px;
}
.year-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 22px 0 28px;
}
.year-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid #dce3e6;
  border-radius: 999px;
  color: #173f4f;
  background: #fff;
  text-decoration: none;
  font-weight: 700;
}
.year-chip.active, .year-chip:hover {
  color: #fff;
  background: #bf2028;
  border-color: #bf2028;
}
.year-chip span {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255,255,255,.2);
}
.year-gallery-heading {
  margin: 24px 0 12px;
}
.year-label {
  display: inline-block;
  color: #bf2028;
  font-weight: 800;
  letter-spacing: .1em;
}
.year-gallery-heading h3 {
  margin: 4px 0;
  color: #173f4f;
  font-size: 24px;
}
.year-gallery-note {
  color: #66747b;
  font-size: 14px;
  margin-bottom: 20px;
}
.year-gallery-note code, .year-gallery-empty code {
  padding: 2px 5px;
  background: #eef2f4;
  border-radius: 4px;
  overflow-wrap: anywhere;
}
.year-photo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.year-photo {
  display: block;
  overflow: hidden;
  border: 1px solid #e1e6e8;
  border-radius: 12px;
  color: #173f4f;
  background: #fff;
  text-decoration: none;
  box-shadow: 0 4px 15px rgba(18,63,80,.05);
}
.year-photo img {
  display: block;
  width: 100%;
  height: 220px;
  object-fit: cover;
  transition: transform .25s ease;
}
.year-photo:hover img {
  transform: scale(1.035);
}
.year-photo span {
  display: block;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
}
.year-gallery-empty {
  grid-column: 1 / -1;
  padding: 28px;
  border: 1px dashed #cbd5d9;
  border-radius: 12px;
  background: #f7f9fa;
  color: #526067;
}
.year-gallery-empty p {
  margin-bottom: 0;
}
@media (max-width: 800px) {
  .activities-section { grid-template-columns: 1fr; }
  .year-photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .activity-card { padding: 16px; }
  .activity-card .primary-gallery-wide { grid-template-columns: 1fr; }
  .activity-card .primary-gallery-wide img { height: auto; max-height: 300px; object-fit: contain; background: #f5f7f8; }
  .year-photo-grid { grid-template-columns: 1fr; }
  .year-photo img { height: auto; max-height: 360px; object-fit: contain; background: #f5f7f8; }
}


/* Ajuste de ancho: las pestañas y su contenido ocupan toda la sección */
.activities-section {
  grid-template-columns: minmax(0, 1fr);
}

.activities-intro,
.activity-tabs,
.activity-panels {
  grid-column: 1 / -1;
  width: 100%;
  min-width: 0;
}

.activity-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 8px 0 2px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e1e6e8;
}

.activity-tab {
  appearance: none;
  border: 1px solid #d9e1e5;
  border-radius: 999px;
  padding: 11px 18px;
  background: #fff;
  color: #173f4f;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}

.activity-tab:hover {
  border-color: #bf2028;
  color: #bf2028;
}

.activity-tab.active,
.activity-tab[aria-selected="true"] {
  color: #fff;
  background: #bf2028;
  border-color: #bf2028;
}

.activity-panels {
  display: block;
}

.activity-panel {
  width: 100%;
  box-sizing: border-box;
}

.activity-panel[hidden],
.gallery-tab-panel[hidden] {
  display: none !important;
}

.activity-panel .video-frame {
  width: 100%;
}

.activity-panel .video-frame video {
  width: 100%;
  max-height: 680px;
  object-fit: contain;
  background: #111;
}

@media (max-width: 600px) {
  .activity-tabs {
    gap: 8px;
  }
  .activity-tab {
    padding: 9px 13px;
    font-size: 14px;
  }
}


/* Las galerías 2026 e histórica comparten el mismo diseño y paginación */
.year-photo[hidden] { display: none !important; }
.year-photo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
}
.year-photo {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.year-photo img {
  display: block;
  width: 100%;
  height: 220px;
  object-fit: cover;
}
.year-photo span { margin-top: auto; }
.year-photo-pagination .page-button {
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--its-border, #dce3e6);
  border-radius: 7px;
  background: #fff;
  color: var(--its-text, #173f4f);
  font-weight: 700;
  cursor: pointer;
}
.year-photo-pagination .page-button.active {
  color: #fff;
  border-color: #bf2028;
  background: #bf2028;
}
.year-photo-pagination .page-button:disabled {
  opacity: .4;
  cursor: not-allowed;
}
@media (max-width: 800px) { .year-photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .year-photo-grid { grid-template-columns: 1fr; } }

/* Botones de pestañas y paginación: acabado institucional ITS */
:root {
  --its-button-red: #C4161C;
  --its-button-red-dark: #9F1016;
  --its-button-ink: #1F1F1F;
  --its-button-border: #E0E4E6;
  --its-button-soft: #F7F7F7;
}

/* Pestañas de Actividades y Galería */
.activity-tabs,
.year-selector {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 22px 0 26px;
}

.activity-tab,
.year-chip {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 19px;
  border: 1px solid var(--its-button-border);
  border-radius: 9px;
  background: #fff;
  color: var(--its-button-ink);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(31,31,31,.05);
  transition: color .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.activity-tab:hover,
.year-chip:hover {
  color: var(--its-button-red);
  border-color: var(--its-button-red);
  background: #fffafa;
  box-shadow: 0 4px 12px rgba(196,22,28,.10);
  transform: translateY(-1px);
}

.activity-tab.active,
.activity-tab[aria-selected="true"],
.year-chip.active,
.year-chip[aria-selected="true"] {
  color: #fff;
  background: var(--its-button-red);
  border-color: var(--its-button-red);
  box-shadow: 0 4px 12px rgba(196,22,28,.20);
}

.activity-tab.active:hover,
.activity-tab[aria-selected="true"]:hover,
.year-chip.active:hover,
.year-chip[aria-selected="true"]:hover {
  color: #fff;
  background: var(--its-button-red-dark);
  border-color: var(--its-button-red-dark);
}

.year-chip span {
  display: inline-block;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(196,22,28,.09);
  color: var(--its-button-red);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.year-chip.active span,
.year-chip[aria-selected="true"] span {
  color: var(--its-button-red);
  background: #fff;
}

.activity-tab:focus-visible,
.year-chip:focus-visible,
.year-photo-pagination .page-button:focus-visible,
.paginador a:focus-visible {
  outline: 3px solid rgba(196,22,28,.28);
  outline-offset: 3px;
}

/* Números y flechas de paginación para ambas galerías */
.year-photo-pagination,
.paginador {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 28px 0 8px;
}

.year-photo-pagination .page-button,
.paginador a,
.paginador span {
  appearance: none;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  width: auto;
  height: 42px;
  padding: 0 13px;
  border: 1px solid var(--its-button-border);
  border-radius: 9px;
  background: #fff;
  color: var(--its-button-ink);
  font: inherit;
  font-size: 14px;
  font-weight: 750;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(31,31,31,.05);
  transition: color .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.year-photo-pagination .page-button:hover:not(:disabled),
.paginador a:hover {
  color: var(--its-button-red);
  border-color: var(--its-button-red);
  background: #fffafa;
  box-shadow: 0 4px 12px rgba(196,22,28,.10);
  transform: translateY(-1px);
}

.year-photo-pagination .page-button.active,
.year-photo-pagination .page-button[aria-current="page"],
.paginador .activo {
  color: #fff;
  background: var(--its-button-red);
  border-color: var(--its-button-red);
  box-shadow: 0 4px 12px rgba(196,22,28,.20);
}

.year-photo-pagination .page-button:disabled,
.paginador .deshabilitado {
  color: #9AA1A5;
  background: #F1F2F3;
  border-color: #E5E7E8;
  box-shadow: none;
  opacity: .75;
  cursor: not-allowed;
  transform: none;
}

@media (max-width: 600px) {
  .activity-tabs,
  .year-selector {
    gap: 8px;
  }
  .activity-tab,
  .year-chip {
    min-height: 41px;
    padding: 9px 13px;
    font-size: 14px;
  }
  .year-photo-pagination .page-button,
  .paginador a,
  .paginador span {
    min-width: 38px;
    height: 38px;
    padding: 0 10px;
  }
}
