/* ==========================================================
   ESCUELA DE GIMNASIA — EVENTOS / GALERÍA
   Estilos aislados de la página. El modal se monta en <body>.
   ========================================================== */

/* ==========================================================
   01. HERO
   ========================================================== */

.eg-page-eventos .eg-events-hero {
  overflow: hidden;
  padding: 0;
  background: linear-gradient(118deg, #102d59 0%, #102d59 58%, #173d72 100%);
  color: #fff;
}

.eg-page-eventos .eg-events-hero-grid {
  display: grid;
  grid-template-columns: .93fr 1.07fr;
  gap: clamp(45px, 6vw, 90px);
  align-items: stretch;
  min-height: 590px;
}

.eg-page-eventos .eg-events-hero-copy {
  align-self: center;
  padding: 90px 0 96px;
}

.eg-page-eventos .eg-events-hero .eyebrow {
  margin-bottom: 19px;
  color: var(--cyan);
}

.eg-page-eventos .eg-events-hero h1 {
  max-width: 620px;
  margin: 0 0 26px;
  color: #fff;
  font-size: clamp(3.45rem, 5.4vw, 5.6rem);
  line-height: .9;
  letter-spacing: -.075em;
}

.eg-page-eventos .eg-events-hero-copy > p:not(.eyebrow) {
  max-width: 475px;
  margin-bottom: 29px;
  color: rgba(255,255,255,.76);
  font-size: 1rem;
  line-height: 1.68;
}

.eg-page-eventos .eg-events-hero-link {
  display: inline-flex;
  align-items: center;
  gap: 22px;
  border-bottom: 1px solid rgba(255,255,255,.48);
  padding: 0 0 10px;
  color: #fff;
  font-size: .84rem;
  font-weight: 850;
  transition: color .2s ease, border-color .2s ease;
}

.eg-page-eventos .eg-events-hero-link span {
  color: var(--cyan);
  font-size: 1.15rem;
}

.eg-page-eventos .eg-events-hero-link:hover,
.eg-page-eventos .eg-events-hero-link:focus-visible {
  border-color: var(--cyan);
  color: var(--cyan);
}

.eg-page-eventos .eg-events-hero-media {
  position: relative;
  min-height: 590px;
  border-radius: 210px 0 0 0;
  background:
    linear-gradient(90deg, rgba(16,45,89,.3), rgba(16,45,89,0) 55%),
    url('/wp-content/plugins/escuela-gimnasia-core/assets/images/editorial-gymnast.png') center / cover;
}

.eg-page-eventos .eg-events-hero-orb {
  position: absolute;
  top: 32px;
  right: -30px;
  width: 94px;
  height: 94px;
  border-radius: 50%;
  background: var(--pink);
}

.eg-page-eventos .eg-events-hero-line {
  position: absolute;
  right: 32px;
  bottom: 31px;
  width: 75px;
  height: 8px;
  background: var(--cyan);
}

/* ==========================================================
   02. CABECERA Y GRID DE EVENTOS
   ========================================================== */

.eg-page-eventos .eg-events-section {
  padding: 105px 0 120px;
  background: #fff;
  scroll-margin-top: 85px;
}

.eg-page-eventos .eg-events-heading {
  display: grid;
  grid-template-columns: 1.25fr .75fr;
  gap: 48px;
  align-items: end;
  margin-bottom: 45px;
}

.eg-page-eventos .eg-events-heading h2 {
  max-width: 730px;
  margin-bottom: 0;
  color: var(--navy);
  font-size: clamp(2.9rem, 4.8vw, 4.8rem);
  line-height: .94;
  letter-spacing: -.067em;
}

.eg-page-eventos .eg-events-heading > p {
  max-width: 340px;
  margin: 0 0 5px auto;
  color: var(--muted);
  font-size: .96rem;
  line-height: 1.62;
}

.eg-page-eventos .eg-events-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 34px 24px;
}

.eg-page-eventos .eg-event-card {
  min-width: 0;
}

.eg-page-eventos .eg-event-card-button {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: #fff;
  color: var(--navy);
  text-align: left;
  cursor: pointer;
}

.eg-page-eventos .eg-event-card-image {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 1.2;
  border-radius: 0 66px 0 0;
  background: linear-gradient(145deg, #173d72, #102d59 67%, #e7377d);
}

.eg-page-eventos .eg-event-card-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .45s ease;
}

.eg-page-eventos .eg-event-card-image-fallback {
  display: flex;
  height: 100%;
  align-items: flex-end;
  padding: 24px;
  color: rgba(255,255,255,.87);
  font-size: 1rem;
  font-weight: 900;
}

.eg-page-eventos .eg-event-card-image::after {
  position: absolute;
  right: 19px;
  bottom: 19px;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  color: var(--navy);
  font-size: 1.3rem;
  font-weight: 650;
  content: '+';
  box-shadow: 0 8px 20px rgba(8,28,57,.16);
  transition: background .2s ease, color .2s ease;
}

.eg-page-eventos .eg-event-card-button:hover .eg-event-card-image img,
.eg-page-eventos .eg-event-card-button:focus-visible .eg-event-card-image img {
  transform: scale(1.045);
}

.eg-page-eventos .eg-event-card-button:hover .eg-event-card-image::after {
  background: var(--pink);
  color: #fff;
}

.eg-page-eventos .eg-event-card-copy {
  display: block;
  padding-top: 19px;
}

.eg-page-eventos .eg-event-card-date {
  display: block;
  margin-bottom: 9px;
  color: var(--pink);
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .085em;
  text-transform: uppercase;
}

.eg-page-eventos .eg-event-card-title {
  display: block;
  margin: 0 0 12px;
  color: var(--navy);
  font-size: clamp(1.22rem, 1.9vw, 1.65rem);
  font-weight: 900;
  line-height: 1.19;
  letter-spacing: -.045em;
}

.eg-page-eventos .eg-event-card-description {
  display: -webkit-box;
  overflow: hidden;
  margin: 0 0 18px;
  color: var(--muted);
  font-size: .88rem;
  line-height: 1.6;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.eg-page-eventos .eg-event-card-link {
  display: inline-flex;
  gap: 9px;
  align-items: center;
  border-bottom: 1px solid rgba(16,45,89,.2);
  padding-bottom: 6px;
  color: var(--navy);
  font-size: .81rem;
  font-weight: 850;
}

.eg-page-eventos .eg-event-card-link::after {
  color: var(--pink);
  font-size: 1.08rem;
  content: '→';
}

.eg-page-eventos .eg-event-card-button:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 5px;
}

/* Estado vacío / fallo de carga */

.eg-page-eventos .eg-events-state {
  display: flex;
  min-height: 350px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 0 80px 0 0;
  padding: 45px 26px;
  background: #f5fafd;
  text-align: center;
}

.eg-page-eventos .eg-events-state-mark {
  display: grid;
  width: 58px;
  height: 58px;
  margin-bottom: 22px;
  place-items: center;
  border-radius: 50%;
  background: var(--navy);
  color: var(--cyan);
  font-size: 1.7rem;
}

.eg-page-eventos .eg-events-state h3 {
  max-width: 580px;
  margin: 0 0 12px;
  color: var(--navy);
  font-size: clamp(1.6rem, 2.6vw, 2.25rem);
  line-height: 1.12;
}

.eg-page-eventos .eg-events-state p {
  max-width: 470px;
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.eg-page-eventos .eg-events-retry {
  margin-top: 22px;
}

/* ==========================================================
   03. CIERRE
   ========================================================== */

.eg-page-eventos .eg-events-outro {
  position: relative;
  overflow: hidden;
  padding: 80px 0 85px;
  background: #f0f8fc;
}

.eg-page-eventos .eg-events-outro::before {
  position: absolute;
  top: -220px;
  right: -175px;
  width: 420px;
  height: 420px;
  border: 48px solid rgba(49,197,233,.12);
  border-radius: 50%;
  content: '';
}

.eg-page-eventos .eg-events-outro-inner {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 30px;
  align-items: center;
}

.eg-page-eventos .eg-events-outro .eyebrow {
  margin-bottom: 13px;
}

.eg-page-eventos .eg-events-outro h2 {
  max-width: 680px;
  margin: 0;
  color: var(--navy);
  font-size: clamp(2.35rem, 3.6vw, 3.7rem);
  line-height: .98;
}

.eg-page-eventos .eg-events-outro .button {
  flex-shrink: 0;
  min-height: 52px;
  padding: 0 26px;
}

/* ==========================================================
   04. MODAL — ANEXADO AL BODY POR EVENTOS.JS
   ========================================================== */

.eg-event-dialog {
  position: fixed;
  z-index: 10050;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
}

.eg-event-dialog[hidden] {
  display: none;
}

.eg-event-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 19, 40, .82);
  backdrop-filter: blur(6px);
}

.eg-event-dialog-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 1040px);
  max-height: min(900px, calc(100dvh - 40px));
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: 0 62px 0 0;
  padding: 42px;
  background: #fff;
  color: var(--navy);
  box-shadow: 0 28px 90px rgba(0,0,0,.3);
}

.eg-event-dialog-close {
  position: absolute;
  z-index: 2;
  top: 22px;
  right: 22px;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--navy);
  font-size: 1.65rem;
  cursor: pointer;
}

.eg-event-dialog-copy {
  max-width: 780px;
  padding-right: 58px;
}

.eg-event-dialog-date {
  margin: 0 0 10px;
  color: var(--pink);
  font-size: .75rem;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.eg-event-dialog-title {
  max-width: 790px;
  margin: 0 0 15px;
  font-size: clamp(2rem, 3.5vw, 3.3rem);
  line-height: 1;
  letter-spacing: -.06em;
}

.eg-event-dialog-description {
  max-width: 770px;
  margin: 0;
  color: var(--muted);
  font-size: .95rem;
  line-height: 1.65;
  white-space: pre-line;
}

.eg-event-dialog-gallery {
  margin-top: 28px;
}

.eg-event-dialog-featured {
  display: grid;
  overflow: hidden;
  min-height: 240px;
  place-items: center;
  background: #eef6fb;
}

.eg-event-dialog-featured img {
  display: block;
  width: 100%;
  max-height: min(58vh, 560px);
  object-fit: contain;
}

.eg-event-dialog-featured-empty {
  padding: 60px 22px;
  color: var(--muted);
  text-align: center;
}

.eg-event-dialog-gallery-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 20px 0 13px;
}

.eg-event-dialog-gallery-label {
  margin: 0;
  color: var(--navy);
  font-size: .81rem;
  font-weight: 850;
}

.eg-event-dialog-count {
  color: var(--muted);
  font-size: .78rem;
  font-variant-numeric: tabular-nums;
}

.eg-event-dialog-thumbs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.eg-event-dialog-thumb {
  overflow: hidden;
  aspect-ratio: 1.35;
  border: 2px solid transparent;
  border-radius: 0 14px 0 0;
  padding: 0;
  background: #eef6fb;
  cursor: pointer;
}

.eg-event-dialog-thumb[aria-pressed='true'] {
  border-color: var(--pink);
}

.eg-event-dialog-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.eg-event-dialog-close:focus-visible,
.eg-event-dialog-thumb:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 3px;
}

body.eg-events-modal-open {
  overflow: hidden;
}

/* ==========================================================
   05. RESPONSIVE
   ========================================================== */

@media (max-width: 900px) {
  .eg-page-eventos .eg-events-hero-grid {
    grid-template-columns: 1fr;
    gap: 0;
    min-height: 0;
  }

  .eg-page-eventos .eg-events-hero-copy {
    max-width: 690px;
    padding: 80px 0 48px;
  }

  .eg-page-eventos .eg-events-hero-media {
    min-height: 430px;
    border-radius: 170px 0 0 0;
  }

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

  .eg-page-eventos .eg-events-heading {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .eg-page-eventos .eg-events-heading > p {
    max-width: 600px;
    margin: 0;
  }

  .eg-page-eventos .eg-events-outro-inner {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 780px) {
  .eg-page-eventos .eg-events-hero-copy {
    padding: 64px 0 40px;
  }

  .eg-page-eventos .eg-events-hero h1 {
    font-size: clamp(3rem, 11.5vw, 4.5rem);
  }

  .eg-page-eventos .eg-events-hero-media {
    min-height: 340px;
    border-radius: 130px 0 0 0;
  }

  .eg-page-eventos .eg-events-hero-orb {
    top: -18px;
    right: -15px;
    width: 72px;
    height: 72px;
  }

  .eg-page-eventos .eg-events-section {
    padding: 76px 0 90px;
  }

  .eg-page-eventos .eg-events-heading {
    margin-bottom: 32px;
  }

  .eg-page-eventos .eg-events-heading h2 {
    font-size: clamp(2.7rem, 9.5vw, 4rem);
  }

  .eg-page-eventos .eg-events-grid {
    gap: 30px 18px;
  }

  .eg-page-eventos .eg-events-outro {
    padding: 75px 0;
  }

  .eg-event-dialog {
    padding: 12px;
  }

  .eg-event-dialog-panel {
    max-height: calc(100dvh - 24px);
    border-radius: 0 45px 0 0;
    padding: 28px 20px;
  }

  .eg-event-dialog-close {
    top: 14px;
    right: 14px;
    width: 37px;
    height: 37px;
  }

  .eg-event-dialog-copy {
    padding-right: 40px;
  }

  .eg-event-dialog-thumbs {
    grid-template-columns: repeat(4, minmax(0,1fr));
    gap: 8px;
  }
}

@media (max-width: 480px) {
  .eg-page-eventos .eg-events-grid {
    grid-template-columns: 1fr;
    gap: 36px;
  }

  .eg-page-eventos .eg-events-hero-media {
    min-height: 280px;
  }

  .eg-page-eventos .eg-events-outro h2 {
    font-size: clamp(2.3rem, 10vw, 3rem);
  }

  .eg-page-eventos .eg-events-outro .button {
    width: 100%;
  }

  .eg-event-dialog-panel {
    padding: 24px 16px;
  }

  .eg-event-dialog-copy {
    padding-right: 36px;
  }

  .eg-event-dialog-thumbs {
    grid-template-columns: repeat(3, minmax(0,1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  .eg-page-eventos .eg-event-card-image img,
  .eg-page-eventos .eg-event-card-image::after,
  .eg-page-eventos .eg-events-hero-link {
    transition: none;
  }
}
