/* ==========================================================================
   CEICOTOL — Capa de alineación con las referencias visuales aprobadas
   Se carga después de design-tokens/layout/components/pages y sobreescribe
   lo necesario para acercar la interfaz a los diseños entregados.
   ========================================================================== */

html,
body {
  overflow-x: hidden;
}

:root {
  /* Separación lateral uniforme de 15px en todas las vistas */
  --page-gutter: 15px;

  /* Verde institucional de referencia (validar contra el manual SENA) */
  --color-brand: #39a900;
  --color-brand-dark: #2e7d00;
  --color-brand-soft: #f1f8e9;
  --color-brand-border: #d8e9c3;
  --color-surface: #f6f9f2;
  --color-surface-dark: #343a40;
  --color-text: #2b2f33;
  --color-text-muted: #5f676e;
  --color-border: #e3e8df;
  --radius-md: 16px;
  --radius-lg: 24px;
  --shadow-card: 0 10px 26px rgba(20, 40, 10, 0.10);
}

/* Gutter uniforme en contenedores (público y panel) */
.container {
  --bs-gutter-x: calc(var(--page-gutter) * 2);
}

/* ============================ Utilidades ============================ */

/* Contención horizontal: evita desbordes y desplazamientos laterales */
.site-header,
.site-main,
.site-footer {
  max-width: 100%;
}

img {
  max-width: 100%;
}

/* Sangrado sin 100vw: el bloque llega hasta el borde del contenedor y
   conserva el contenido separado del borde con --page-gutter. Al no usar
   viewport units ni márgenes negativos basados en 100vw, no genera
   desbordes ni barras horizontales en ningún ancho de pantalla. */
.bleed {
  width: auto;
  max-width: 100%;
  margin-left: calc(var(--page-gutter) * -1);
  margin-right: calc(var(--page-gutter) * -1);
  padding-left: var(--page-gutter);
  padding-right: var(--page-gutter);
}

.text-brand {
  color: var(--color-brand) !important;
}

/* ============================ Encabezado ============================ */

.site-header {
  border-bottom: 1px solid #eef1ec;
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.06);
}

.site-header__inner {
  min-height: 86px;
  gap: 1rem;
}

.site-brand {
  gap: 1rem;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}

.site-nav-toggle {
  flex: 0 0 auto;
}

.site-brand__mark {
  width: auto;
  height: auto;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0 1rem 0 0;
  border-right: 2px solid #e5e9e3;
}

.site-brand__mark img {
  max-height: 54px;
  width: auto;
  height: auto;
}

.site-brand__name {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #2b2f33;
}

.site-brand__text {
  flex: 1 1 auto;
  min-width: 0;
}

.site-brand__name,
.site-brand__sub {
  overflow-wrap: break-word;
}

.site-brand__sub {
  font-size: 0.78rem;
  color: #5f676e;
  white-space: normal;
  line-height: 1.25;
}

.site-nav__link {
  position: relative;
  border-radius: 0;
  padding: 0.55rem 0.8rem;
  color: #2b2f33;
  font-weight: 600;
  background: transparent;
}

.site-nav__link:hover,
.site-nav__link:focus-visible {
  background: transparent;
  color: var(--color-brand-dark);
}

.site-nav__link.is-active {
  background: transparent;
  color: var(--color-brand-dark);
  box-shadow: inset 0 -3px 0 var(--color-brand);
}

.site-nav-search {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: #2b2f33;
  text-decoration: none;
}

.site-nav-search:hover,
.site-nav-search:focus-visible {
  background: var(--color-brand-soft);
  color: var(--color-brand-dark);
}

.site-nav__cta .btn {
  border-radius: 999px;
}

.site-header--admin .site-brand__mark {
  padding-right: 0;
  border-right: 0;
}

.site-header--admin .site-brand__mark img {
  max-height: 42px;
}

/* ============================ Hero ============================ */

.hero {
  background: var(--color-bg);
  border-bottom: 0;
  padding: 0;
}

.hero.bleed {
  padding-top: 3rem;
  padding-bottom: 4.5rem;
}

.hero__grid {
  grid-template-columns: 1.05fr 0.95fr;
  gap: 3rem;
  align-items: center;
}

.hero__eyebrow {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  margin-bottom: 1.1rem;
  color: var(--color-brand-dark);
  font-size: 0.82rem;
  letter-spacing: 0.14em;
}

.hero__eyebrow::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 1.1em;
  background: var(--color-brand);
  transform: skew(-12deg);
  margin-right: 0.2rem;
}

.hero__title {
  font-size: clamp(2.2rem, 1.5rem + 2.4vw, 3.5rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: #2b2f33;
  /* Las palabras completas pasan a la línea siguiente (sin guiones) */
  word-break: normal;
  overflow-wrap: break-word;
  hyphens: manual;
}

.hero__lead {
  font-size: 1.1rem;
  color: #4b5359;
  max-width: 52ch;
  word-break: normal;
  overflow-wrap: break-word;
  hyphens: manual;
}

/* Imagen del hero completa: sin recorte y sin cortes diagonales */
.hero__media {
  position: relative;
  aspect-ratio: auto;
  width: 100%;
  min-height: 0;
  border-radius: var(--radius-lg);
  box-shadow: none;
  background: transparent;
  clip-path: none;
  overflow: hidden;
}

/* Se elimina el antiguo degradado diagonal verde */
.hero__media::before {
  content: none;
  display: none;
}

.hero__media img {
  width: 100%;
  height: auto;
  min-height: 0;
  max-height: none;
  object-fit: contain;
  display: block;
}

.hero__media .hero__placeholder {
  min-height: 280px;
}

.hero__actions .btn {
  border-radius: 999px;
  padding-inline: 1.4rem;
  max-width: 100%;
  white-space: normal;
}

.hero--compact .hero__media,
.hero--compact .hero__media img {
  min-height: 0;
}

.hero--compact.bleed {
  padding-top: 2.2rem;
  padding-bottom: 3rem;
}

/* ============================ Franja de datos ============================ */

.stats-section {
  margin-top: -2.6rem;
  position: relative;
  z-index: 3;
  background: transparent !important;
  border: 0 !important;
  padding: 0 !important;
}

.stats-strip {
  background: #fff;
  border: 1px solid #eef1ec;
  border-radius: 20px;
  box-shadow: var(--shadow-card);
  padding: 1.1rem 0.5rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
}

.stat {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0.65rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  text-align: left;
}

.stat + .stat {
  border-left: 1px solid #eef1ec;
}

.stat__icon {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--color-brand-soft);
  color: var(--color-brand-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.55rem;
}

.stat__value {
  font-size: 1.8rem;
  font-weight: 800;
  color: #2b2f33;
  line-height: 1;
  text-align: left;
}

.stat__label {
  margin-top: 0.3rem;
  font-size: 0.86rem;
  color: #5f676e;
  text-align: left;
}

.stats-strip .stat__label.text-uppercase {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.86rem;
}

/* ============================ Secciones ============================ */

.section {
  border-bottom: 0;
  padding-block: 4rem;
}

.section__title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: clamp(1.6rem, 1.2rem + 1vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -0.01em;
}

.section__title::before {
  content: "";
  flex: 0 0 auto;
  width: 8px;
  height: 1.15em;
  background: var(--color-brand);
  transform: skew(-12deg);
  border-radius: 2px;
}

.section__eyebrow {
  color: var(--color-brand-dark);
  letter-spacing: 0.12em;
}

.section--dark {
  position: relative;
  border-radius: var(--radius-lg);
  padding: 2.6rem;
  margin-block: 3rem;
  overflow: hidden;
}

.section--dark::after {
  content: "";
  position: absolute;
  right: -60px;
  bottom: -90px;
  width: 220px;
  height: 220px;
  background: linear-gradient(135deg, transparent 50%, rgba(57, 169, 0, 0.55) 50%);
  pointer-events: none;
}

/* ============================ Tarjetas y botones ============================ */

.btn-brand {
  background-color: var(--color-brand-dark);
  border-color: var(--color-brand-dark);
}

.btn-brand:hover,
.btn-brand:focus {
  background-color: #256b00;
  border-color: #256b00;
}

.btn-outline-brand {
  color: var(--color-brand-dark);
  border-color: var(--color-brand);
}

.btn-outline-brand:hover,
.btn-outline-brand:focus {
  background-color: var(--color-brand);
  border-color: var(--color-brand);
}

.btn {
  border-radius: 999px;
}

.program-card {
  border-radius: 16px;
  border: 1px solid #e6ebe2;
  box-shadow: 0 5px 16px rgba(20, 40, 10, 0.07);
}

/* Ficha del programa: se muestra completa, sin recortar la imagen */
.program-card__media {
  aspect-ratio: auto;
  background: #eef2ea;
}

.program-card__media img {
  width: 100%;
  height: auto;
  object-fit: contain;
}

.program-card__media:not(:has(img)),
.program-card__media:empty {
  min-height: 140px;
}

.program-card__body {
  flex: 1 1 auto;
  padding: 1rem;
}

.area-card {
  border-radius: 16px;
  border: 1px solid #e6ebe2;
  box-shadow: 0 4px 14px rgba(20, 40, 10, 0.06);
}

.area-card__body {
  padding: 1.25rem;
}

.badge-brand {
  background: #eaf7dd;
  color: #2e7d00;
  border-color: #d3e8bb;
}

#typeTabs .nav-link {
  border-radius: 999px;
}

.filter-pills .nav-link {
  border-radius: 999px;
}

/* ============================ Galería ============================ */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.8rem;
}

.gallery-grid figure {
  margin: 0;
  border-radius: 14px;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: #eef2ea;
}

.gallery-grid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}

.gallery-grid a:hover img,
.gallery-grid a:focus-visible img {
  transform: scale(1.05);
}

/* ============================ Enlaces ============================ */

.links-band {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 1.2rem;
  background: #fff;
  border: 1px solid #e6ebe2;
  border-radius: 16px;
  box-shadow: 0 5px 16px rgba(20, 40, 10, 0.06);
  padding: 1rem 1.25rem;
}

.links-band__title {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  white-space: nowrap;
}

.links-band__items {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.links-band__item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  border: 1px solid var(--color-brand-border);
  background: var(--color-brand-soft);
  border-radius: 999px;
  color: #2b2f33;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
}

.links-band__item:hover,
.links-band__item:focus-visible {
  background: var(--color-brand);
  border-color: var(--color-brand);
  color: #fff;
}

/* ============================ Beneficios ============================ */

.benefits-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1rem;
  background: #f7faf4;
  border: 1px solid #e3ebd8;
  border-radius: 16px;
  padding: 1.2rem;
}

.benefit {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-size: 0.88rem;
  color: #2b2f33;
}

.benefit i {
  color: var(--color-brand);
  font-size: 1.45rem;
}

/* ============================ Detalle de programa ============================ */

.detail-head.bleed {
  padding-top: 2.4rem;
  padding-bottom: 3.5rem;
}

.detail-keydata {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  background: #fff;
  border: 1px solid #e6ebe2;
  border-radius: 18px;
  box-shadow: var(--shadow-card);
  padding: 0.9rem 0.5rem;
  margin-top: -2.4rem;
  position: relative;
  z-index: 3;
}

.detail-keydata .item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 1rem;
}

.detail-keydata .item + .item {
  border-left: 1px solid #eef1ec;
}

.detail-keydata i {
  font-size: 1.6rem;
  color: var(--color-brand);
}

.detail-keydata .label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6b7378;
}

.detail-keydata .value {
  font-weight: 700;
  color: #2b2f33;
  font-size: 0.95rem;
}

.cta-card {
  position: relative;
  overflow: hidden;
  background: var(--color-surface-dark);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 1.8rem;
}

.cta-card::after {
  content: "";
  position: absolute;
  right: -60px;
  bottom: -80px;
  width: 200px;
  height: 200px;
  background: linear-gradient(135deg, transparent 50%, rgba(57, 169, 0, 0.55) 50%);
}

.cta-card h2,
.cta-card .h5,
.cta-card .h6 {
  color: #fff;
}

.cta-card .btn-brand {
  background: var(--color-brand);
  border-color: var(--color-brand);
}

.cta-card .btn-brand:hover {
  background: #2e7d00;
  border-color: #2e7d00;
}

/* ============================ Contacto ============================ */

.contact-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  background: #fff;
  border: 1px solid #e6ebe2;
  border-radius: 14px;
  padding: 1rem;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.04);
}

.contact-card__icon {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: var(--color-brand-soft);
  color: var(--color-brand-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.contact-card__title {
  font-weight: 700;
  margin: 0 0 0.2rem;
}

.contact-card__text {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.92rem;
}

/* ============================ Pie de página ============================ */

.site-footer {
  position: relative;
  overflow: hidden;
  background: var(--color-surface-dark);
  margin-top: 4rem;
  padding-top: 3rem;
}

.site-footer::after {
  content: "";
  position: absolute;
  right: -70px;
  bottom: -110px;
  width: 260px;
  height: 260px;
  background: linear-gradient(135deg, transparent 50%, rgba(57, 169, 0, 0.45) 50%);
  pointer-events: none;
}

.site-footer__grid {
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 2rem;
}

.site-footer__brand img {
  max-height: 46px;
  background: #fff;
  border-radius: 10px;
  padding: 4px 6px;
}

.site-footer__title {
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.site-footer__bottom {
  position: relative;
  z-index: 1;
}

/* ============================ Responsive ============================ */

@media (max-width: 1199.98px) {
  .benefits-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .gallery-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 991.98px) {
  .site-brand__mark {
    border-right: 0;
    padding-right: 0;
  }

  .site-brand__text {
    max-width: none;
  }

  .site-brand__sub {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .site-header__inner {
    min-height: 76px;
  }

  /* En pantallas angostas el hero respeta el gutter del contenedor */
  .hero.bleed {
    margin-left: 0;
    margin-right: 0;
    padding-top: 2rem;
    padding-bottom: 3.5rem;
    padding-left: 0;
    padding-right: 0;
  }

  .hero__grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .hero__media {
    clip-path: none;
    border-radius: var(--radius-lg);
    min-height: 0;
  }

  .hero__media img,
  .hero__media .hero__placeholder {
    min-height: 0;
  }

  .stats-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 0.5rem;
  }

  .stat + .stat {
    border-left: 0;
  }

  .stat {
    border-bottom: 1px solid #eef1ec;
  }

  .stats-strip .stat:nth-child(odd) {
    border-right: 1px solid #eef1ec;
  }

  .detail-keydata {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 1.5rem;
  }

  .detail-keydata .item + .item {
    border-left: 0;
  }

  .detail-keydata .item {
    border-bottom: 1px solid #eef1ec;
  }

  .site-footer__grid {
    grid-template-columns: 1fr 1fr;
  }

  .links-band {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 575.98px) {
  .site-brand__mark img {
    max-height: 42px;
  }

  .site-brand__name {
    font-size: 1.05rem;
  }

  .hero__title {
    font-size: 1.9rem;
  }

  .hero__lead {
    font-size: 1rem;
  }

  .stats-strip {
    grid-template-columns: 1fr;
  }

  .stats-strip .stat:nth-child(odd) {
    border-right: 0;
  }

  .detail-keydata {
    grid-template-columns: 1fr;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .benefits-strip {
    grid-template-columns: 1fr;
  }

  .site-footer__grid {
    grid-template-columns: 1fr;
  }

  .section--dark {
    padding: 1.5rem;
    border-radius: 16px;
  }
}

.cta-card__muted {
  color: #cfd6d2;
}

.admin-main .btn { border-radius: 8px; }

/* ============================ Panel: barra lateral ============================ */

.admin-topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 76px;
}

.admin-topbar__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.admin-shell {
  display: flex;
  align-items: stretch;
  min-height: calc(100vh - 86px);
  background: var(--color-surface);
}

.admin-sidebar {
  flex: 0 0 240px;
  width: 240px;
  background: #fff;
  border-right: 1px solid #e3e8df;
}

.admin-nav {
  width: 100%;
}

.admin-nav__list {
  list-style: none;
  margin: 0;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.admin-nav__link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  color: #2b2f33;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.admin-nav__link:hover,
.admin-nav__link:focus-visible {
  background: var(--color-brand-soft);
  color: var(--color-brand-dark);
}

.admin-nav__link.is-active {
  background: var(--color-brand-soft);
  color: var(--color-brand-dark);
  box-shadow: inset 3px 0 0 var(--color-brand);
}

.admin-nav__link i {
  width: 1.25rem;
  font-size: 1.05rem;
  text-align: center;
}

.admin-nav__badge {
  margin-left: auto;
}

.admin-main {
  flex: 1 1 auto;
  min-width: 0;
}

.admin-content {
  max-width: 1400px;
}

.admin-flash .alert:last-child {
  margin-bottom: 0;
}

.admin-filters .card-body {
  padding: 0.85rem 1rem;
}

.admin-filters .form-label {
  font-weight: 600;
  color: #4b5359;
}

@media (min-width: 992px) {
  .admin-sidebar {
    position: sticky;
    top: 0;
    align-self: flex-start;
    height: calc(100vh - 76px);
    overflow-y: auto;
  }
}

@media (max-width: 991.98px) {
  .admin-shell {
    flex-direction: column;
    min-height: 0;
  }

  .admin-sidebar {
    flex: 0 0 auto;
    width: 100%;
    border-right: 0;
    border-bottom: 1px solid #e3e8df;
  }

  .admin-nav__list {
    padding: 0.5rem 0.75rem 1rem;
  }
}
