/* Paleta institucional: colores tomados del escudo del colegio y variables reutilizables. */
:root {
  --blue-950: #10154a;
  --blue-900: #17216d;
  --blue-700: #243c99;
  --blue-100: #eef1ff;
  --red-700: #c1121f;
  --red-600: #df1f2d;
  --white: #ffffff;
  --ink: #151936;
  --muted: #626a83;
  --line: #dce1f2;
  --gold: #d9a441;
  --shadow: 0 18px 45px rgba(16, 21, 74, 0.16);
}

/* Reset basico: evita calculos inesperados de ancho y mantiene un scroll suave entre secciones. */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

/* Elementos globales: estilos compartidos por toda la pagina. */
body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  line-height: 1.6;
  background: var(--white);
}

img {
  display: block;
  width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Contenedor reutilizable: limita el ancho maximo y mantiene margen lateral responsive. */
.container {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
}

/* Header y hero: area inicial con imagen de fondo, filtro institucional y mensaje principal. */
.site-header {
  min-height: 100vh;
  color: var(--white);
  background:
    linear-gradient(90deg, rgba(16, 21, 74, 0.93), rgba(23, 33, 109, 0.68), rgba(193, 18, 31, 0.32)),
    url("../assets/img/galeria/banner-principal.png") center/cover;
}

/* Navegacion fija: permanece visible y cambia de estado al hacer scroll. */
.navbar {
  position: fixed;
  z-index: 10;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 18px clamp(20px, 5vw, 64px);
  transition: background 0.3s ease, box-shadow 0.3s ease, padding 0.3s ease;
}

.navbar.scrolled {
  padding-block: 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 12px 35px rgba(16, 21, 74, 0.12);
  backdrop-filter: blur(16px);
}

/* Marca institucional: controla el escudo y el texto del colegio en navbar y footer. */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 190px;
}

.brand-logo {
  width: 54px;
  height: 54px;
  padding: 3px;
  object-fit: contain;
  background: var(--white);
  border: 2px solid rgba(217, 164, 65, 0.75);
  border-radius: 50%;
  box-shadow: 0 8px 20px rgba(16, 21, 74, 0.16);
}

.navbar.scrolled .brand-logo,
.footer .brand-logo {
  border-color: rgba(193, 18, 31, 0.3);
}

.brand strong,
.brand small {
  display: block;
  line-height: 1.15;
}

.brand small {
  opacity: 0.78;
}

/* Menu principal: version de escritorio con subrayado animado para hover y enlace activo. */
.nav-menu {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0;
  margin: 0;
  list-style: none;
  font-size: 0.95rem;
  font-weight: 700;
}

.nav-menu a {
  position: relative;
  display: inline-block;
  padding: 8px 0;
}

.nav-menu a::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  content: "";
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}

.nav-menu a:hover::after,
.nav-menu a.active::after {
  transform: scaleX(1);
}

/* Enlace especial al portal de notas: destaca una accion externa al contenido informativo. */
.nav-link-portal {
  padding: 8px 13px !important;
  color: var(--white);
  background: var(--red-700);
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-radius: 8px;
}

.navbar.scrolled .nav-link-portal {
  color: var(--white);
}

.nav-link-portal::after {
  display: none;
}

/* Boton hamburguesa: solo se muestra en pantallas pequenas y se anima al abrir. */
.menu-toggle {
  display: none;
  width: 44px;
  height: 44px;
  padding: 10px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 8px;
}

.menu-toggle span {
  display: block;
  height: 2px;
  margin: 5px 0;
  background: currentColor;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.menu-toggle.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.menu-toggle.open span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Banner principal: organiza logo, titulo, texto de apoyo y botones de accion. */
.hero {
  display: flex;
  align-items: center;
  min-height: 100vh;
  padding: 130px clamp(20px, 6vw, 80px) 70px;
}

.hero-content {
  width: min(760px, 100%);
}

/* Etiqueta superior reutilizable para introducir secciones con tono institucional. */
.eyebrow {
  margin: 0 0 12px;
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero-logo {
  width: clamp(96px, 12vw, 150px);
  height: clamp(96px, 12vw, 150px);
  padding: 6px;
  margin-bottom: 24px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.96);
  border: 3px solid var(--gold);
  border-radius: 50%;
  box-shadow: 0 24px 55px rgba(0, 0, 0, 0.22);
}

.hero h1 {
  max-width: 780px;
  margin: 0;
  font-size: clamp(3rem, 7vw, 6.5rem);
  line-height: 0.95;
}

.hero-copy {
  max-width: 650px;
  margin: 24px 0 0;
  font-size: clamp(1.05rem, 2vw, 1.3rem);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 34px;
}

/* Botones: base compartida y variantes para acciones principales/secundarias. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 20px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 8px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.btn.primary {
  color: var(--white);
  background: var(--red-700);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.68;
  transform: none;
  box-shadow: none;
}

.btn.secondary {
  color: var(--white);
  background: rgba(255, 255, 255, 0.13);
  border-color: rgba(255, 255, 255, 0.5);
}

/* Secciones generales: espaciado vertical y alternancia suave de fondos. */
.section {
  padding: 86px 0;
  content-visibility: auto;
  contain-intrinsic-size: 1px 720px;
}

.section:nth-child(even) {
  background: var(--blue-100);
}

/* Titulos de seccion: mantiene jerarquia visual consistente en todo el sitio. */
.section-heading {
  max-width: 720px;
  margin-bottom: 34px;
}

.section h2 {
  margin: 0;
  color: var(--blue-950);
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1.05;
}

.section h3 {
  margin: 0 0 12px;
  color: var(--blue-950);
  font-size: 1.35rem;
}

.section p {
  color: var(--muted);
}

/* Layouts de dos columnas: usados en bienvenida y contacto. */
.split,
.contact-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 48px;
  align-items: center;
}

.contact-grid > * {
  min-width: 0;
}

.section-text p:not(.eyebrow) {
  max-width: 680px;
  font-size: 1.06rem;
}

.stats {
  display: grid;
  gap: 16px;
}

/* Tarjetas destacadas: comparten borde, sombra y fondo para mantener coherencia visual. */
.stats article,
.info-card,
.program-card,
.news-card,
.contact-form {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 14px 30px rgba(16, 21, 74, 0.08);
}

.stats article {
  padding: 22px;
}

.stats strong {
  display: block;
  color: var(--blue-700);
  font-size: 1.45rem;
}

.stats span {
  color: var(--muted);
  font-weight: 700;
}

/* Grillas de contenido: distribuyen mision/vision, oferta academica y noticias. */
.identity-grid,
.academic-grid,
.news-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

.academic-grid,
.news-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

.info-card,
.program-card,
.news-card {
  padding: 26px;
}

.card-number {
  display: inline-block;
  margin-bottom: 28px;
  color: var(--gold);
  font-weight: 800;
}

/* Oferta academica: franja superior multicolor inspirada en el escudo. */
.program-card {
  position: relative;
  overflow: hidden;
}

.program-card::before {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 5px;
  content: "";
  background: linear-gradient(90deg, var(--blue-700), var(--red-700), var(--gold));
}

/* Galeria: composicion visual con una imagen principal y dos imagenes secundarias. */
.gallery-grid {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 18px;
}

.gallery-item {
  position: relative;
  min-height: 260px;
  margin: 0;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.gallery-item.large {
  grid-row: span 2;
}

.gallery-item img {
  height: 100%;
  min-height: inherit;
  object-fit: cover;
  transition: transform 0.45s ease;
}

.gallery-item:hover img {
  transform: scale(1.05);
}

.gallery-item figcaption {
  position: absolute;
  right: 16px;
  bottom: 16px;
  left: 16px;
  padding: 10px 12px;
  color: var(--white);
  font-weight: 800;
  background: rgba(16, 21, 74, 0.78);
  border-radius: 8px;
}

.carousel {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  box-shadow: var(--shadow);
  background: var(--ink);
}

.carousel-frame {
  overflow: hidden;
  min-height: 520px;
}

.carousel-track {
  display: flex;
  transition: transform 0.45s ease;
  width: 100%;
}

.carousel-slide {
  min-width: 100%;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.carousel-slide img {
  max-width: 100%;
  max-height: 520px;
  object-fit: contain;
}

.carousel-caption {
  position: absolute;
  right: 16px;
  bottom: 16px;
  padding: 10px 14px;
  background: rgba(16, 21, 74, 0.72);
  color: var(--white);
  font-weight: 700;
  border-radius: 10px;
}

.carousel-button {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  color: var(--ink);
  font-size: 1.6rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.25s ease, color 0.25s ease;
}

.carousel-button:hover,
.carousel-button:focus-visible {
  background: var(--white);
  color: var(--blue-950);
}

.carousel-button.prev {
  left: 16px;
}

.carousel-button.next {
  right: 16px;
}

.carousel-footer {
  display: flex;
  justify-content: flex-end;
  padding: 14px 18px;
}

.carousel-counter {
  margin: 0;
  color: var(--white);
  font-weight: 700;
  letter-spacing: 0.01em;
}

/* Noticias: fecha destacada para facilitar lectura cronologica. */
.news-card time {
  color: var(--red-700);
  font-size: 0.9rem;
  font-weight: 800;
}

/* Ubicacion: combina informacion de visita con un mapa incrustado en tarjeta destacada. */
.location {
  background:
    radial-gradient(circle at 15% 0%, rgba(217, 164, 65, 0.16), transparent 45%),
    linear-gradient(180deg, #f6f8ff 0%, #eef1ff 100%);
}

.location-grid {
  display: grid;
  grid-template-columns: 0.95fr 1.05fr;
  gap: 28px;
  align-items: stretch;
}

.location-list {
  padding: 0;
  margin: 24px 0 28px;
  list-style: none;
}

.location-list li {
  position: relative;
  padding: 0 0 12px 26px;
  margin-bottom: 10px;
  color: var(--ink);
  font-weight: 700;
  border-bottom: 1px solid rgba(23, 33, 109, 0.14);
}

.location-list li::before {
  position: absolute;
  top: 2px;
  left: 0;
  width: 14px;
  height: 14px;
  content: "";
  background: linear-gradient(180deg, var(--red-700), var(--gold));
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(217, 164, 65, 0.16);
}

.map-card {
  position: relative;
  overflow: hidden;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.map-card::before {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 5px;
  content: "";
  background: linear-gradient(90deg, var(--blue-700), var(--red-700), var(--gold));
}

.map-frame {
  width: 100%;
  min-height: 420px;
  border: 0;
  filter: saturate(1.05) contrast(1.04);
}

/* Contacto: seccion con fondo fotografico y capa de color institucional para legibilidad. */
.contact {
  background:
    linear-gradient(90deg, rgba(16, 21, 74, 0.96), rgba(23, 33, 109, 0.9), rgba(193, 18, 31, 0.5)),
    url("../assets/img/galeria/banner-principal.png") center/cover;
}

.contact h2,
.contact .section-text p,
.contact-list li {
  color: var(--white);
}

.contact .section-text {
  padding: 30px;
  background: rgba(16, 21, 74, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(6px);
}

.contact .section-text p:not(.eyebrow) {
  color: rgba(255, 255, 255, 0.94);
}

.contact-list {
  padding: 0;
  margin: 24px 0 0;
  list-style: none;
}

.contact-list li {
  padding: 10px 0;
  color: #ffffff;
  font-weight: 700;
  border-bottom: 1px solid rgba(255, 255, 255, 0.26);
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Formulario de contacto: campos accesibles con estados de enfoque visibles. */
.contact-form {
  display: grid;
  gap: 10px;
  padding: 28px;
}

.form-honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.contact-form label {
  color: var(--blue-950);
  font-weight: 800;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  min-width: 0;
  padding: 13px 14px;
  color: var(--ink);
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field-help,
.field-error {
  display: block;
  margin-top: -4px;
  font-size: 0.86rem;
  line-height: 1.35;
}

.field-help {
  color: var(--muted);
}

.field-error {
  min-height: 18px;
  color: var(--red-700);
  font-weight: 800;
}

.contact-form input[aria-invalid="true"] {
  border-color: var(--red-700);
  box-shadow: 0 0 0 4px rgba(193, 18, 31, 0.14);
}

.contact-form input:focus,
.contact-form textarea:focus {
  border-color: var(--blue-700);
  box-shadow: 0 0 0 4px rgba(36, 60, 153, 0.16);
}

.form-status {
  min-height: 24px;
  margin: 4px 0 0;
  color: var(--blue-700);
  font-weight: 800;
}

/* Footer: cierre institucional con marca, enlaces internos y horarios. */
.footer {
  padding: 48px 0 20px;
  color: rgba(255, 255, 255, 0.78);
  background: var(--blue-950);
  content-visibility: auto;
  contain-intrinsic-size: 1px 320px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 0.8fr 0.8fr;
  gap: 34px;
}

.footer h2 {
  margin: 0 0 14px;
  color: var(--white);
  font-size: 1rem;
}

.footer a:not(.brand) {
  display: block;
  margin: 8px 0;
}

.footer-brand {
  color: var(--white);
}

.copyright {
  width: min(1120px, calc(100% - 40px));
  padding-top: 20px;
  margin: 34px auto 0;
  font-size: 0.9rem;
  text-align: center;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

/* Animaciones reveal: JavaScript agrega .visible cuando el elemento entra en viewport. */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.65s ease, transform 0.65s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Portal de notas: pagina puente sencilla para enviar al sistema academico externo. */
.portal-page {
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(16, 21, 74, 0.94), rgba(193, 18, 31, 0.62)),
    url("../assets/img/galeria/banner-principal.png") center/cover;
}

.portal-access {
  display: grid;
  min-height: 100vh;
  padding: 32px;
  place-items: center;
}

.portal-card {
  width: min(520px, 100%);
  padding: 38px;
  text-align: center;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.portal-logo {
  width: 140px;
  height: 140px;
  margin: 0 auto 22px;
  object-fit: contain;
}

.portal-card h1 {
  margin: 0;
  color: var(--blue-950);
  font-size: clamp(2.2rem, 6vw, 3.8rem);
  line-height: 1;
}

.portal-card p:not(.eyebrow) {
  margin: 18px 0 28px;
  color: var(--muted);
}

.portal-back {
  display: block;
  margin-top: 18px;
  color: var(--blue-700);
  font-weight: 800;
}

/* Accesibilidad/performance: respeta usuarios que prefieren menos movimiento. */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}

/* Responsive tablet/movil: convierte navegacion y grillas a una sola columna. */
@media (max-width: 920px) {
  .menu-toggle {
    display: block;
  }

  .nav-menu {
    position: absolute;
    top: 76px;
    right: 20px;
    left: 20px;
    display: grid;
    gap: 4px;
    padding: 16px;
    color: var(--ink);
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    transform: translateY(-12px);
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
  }

  .nav-menu.open {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
  }

  .split,
  .contact-grid,
  .location-grid,
  .identity-grid,
  .academic-grid,
  .news-grid,
  .footer-grid {
    grid-template-columns: 1fr;
  }

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

  .carousel-frame {
    min-height: 360px;
  }

  .carousel-slide img {
    max-height: 360px;
  }

  .carousel-button {
    width: 42px;
    height: 42px;
    font-size: 1.35rem;
  }

  .carousel-footer {
    padding: 12px 14px;
    justify-content: center;
  }
}

/* Responsive movil pequeno: ajusta logos, hero, botones y alto minimo de imagenes. */
@media (max-width: 560px) {
  .container {
    width: min(100% - 28px, 1120px);
  }

  .brand {
    min-width: 0;
  }

  .brand-logo {
    width: 46px;
    height: 46px;
  }

  .brand strong {
    font-size: 0.95rem;
  }

  .brand small {
    font-size: 0.78rem;
  }

  .hero {
    padding-top: 118px;
  }

  .hero h1 {
    font-size: 3rem;
  }

  .hero-actions,
  .btn {
    width: 100%;
  }

  .section {
    padding: 64px 0;
  }

  .contact-grid {
    gap: 18px;
  }

  .contact .section-text,
  .contact-form {
    padding: 20px;
  }

  .contact-list li {
    font-size: 0.96rem;
    line-height: 1.45;
  }

  .gallery-item,
  .gallery-item img {
    min-height: 230px;
  }

  .carousel-frame {
    min-height: 260px;
  }

  .carousel-slide img {
    max-height: 260px;
  }

  .map-frame {
    min-height: 320px;
  }
}
