/* --- ERSI PAGE STRUCTURE: SMALLER SLIDESHOW FIX --- */

.ersi-main {
  align-items: stretch;
}

.ersi-hero,
.ersi-slideshow-section,
.ersi-quick-facts,
.ersi-detail-grid,
.ersi-summary-card {
  width: 90%;
  max-width: 1400px;
  margin: 18px auto;
  box-sizing: border-box;
}

/* Hero */

.ersi-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background:
    linear-gradient(135deg, rgba(242, 204, 96, 0.12), rgba(22, 27, 34, 0.96)),
    #161b22;
  border: 1px solid rgba(242, 204, 96, 0.38);
  border-radius: 18px;
  padding: clamp(22px, 2.7vw, 34px);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.32);
}

.ersi-hero h2 {
  margin: 0 0 8px;
  color: #fff;
  font-size: clamp(1.8rem, 3.3vw, 3.1rem);
  line-height: 1.02;
  text-transform: uppercase;
}

.ersi-hero p {
  max-width: 880px;
  color: #c9d1d9;
  line-height: 1.55;
  margin: 0;
}

/* Smaller slideshow */

.ersi-slideshow-section {
  background:
    radial-gradient(circle at 12% 18%, rgba(0, 212, 255, 0.1), transparent 30%),
    linear-gradient(135deg, rgba(13, 57, 68, 0.94), rgba(22, 27, 34, 0.98));
  border: 1px solid rgba(0, 212, 255, 0.38);
  border-radius: 18px;
  padding: 20px 24px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}

.ersi-slideshow-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
}

.ersi-slideshow-header h3 {
  margin: 0;
  color: #fff;
  font-size: clamp(1.15rem, 1.75vw, 1.55rem);
}

.ersi-slide-counter {
  color: #00d4ff;
  border: 1px solid rgba(0, 212, 255, 0.42);
  background: rgba(0, 212, 255, 0.1);
  border-radius: 999px;
  padding: 6px 10px;
  font-weight: 900;
  white-space: nowrap;
  font-size: 0.76rem;
}

.ersi-slider-shell {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 34px;
  gap: 8px;
  align-items: stretch;
}

.ersi-slide-viewport {
  overflow: hidden;
  border-radius: 14px;
}

.ersi-slide-track {
  display: flex;
  transition: transform 0.35s ease;
  will-change: transform;
}

.ersi-slide {
  flex: 0 0 100%;
  min-height: 245px;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 14px;
  padding: clamp(22px, 2.5vw, 34px);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.ersi-slide-tag {
  display: inline-flex;
  width: fit-content;
  background: rgba(0, 212, 255, 0.12);
  color: #00d4ff;
  border: 1px solid rgba(0, 212, 255, 0.42);
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 0.64rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

.ersi-slide h2 {
  margin: 0 0 12px;
  color: #fff;
  font-size: clamp(1.75rem, 2.75vw, 2.65rem);
  line-height: 1.04;
  letter-spacing: -0.025em;
}

.ersi-slide p {
  max-width: 980px;
  color: #d0d7e2;
  font-size: clamp(0.92rem, 1.05vw, 1.02rem);
  line-height: 1.5;
  margin: 0 0 10px;
}

.ersi-slide ul {
  margin: 6px 0 0;
  padding-left: 20px;
  max-width: 940px;
}

.ersi-slide li {
  color: #a8b3c7;
  font-size: clamp(0.86rem, 0.98vw, 0.95rem);
  line-height: 1.42;
  margin-bottom: 5px;
}

.ersi-slide-arrow {
  width: 34px;
  min-height: 100%;
  border: 1px solid rgba(0, 212, 255, 0.4);
  border-radius: 12px;
  background: rgba(0, 212, 255, 0.07);
  color: #00d4ff;
  cursor: pointer;
  font-size: 1.55rem;
  font-weight: 900;
  transition: 0.2s ease;
}

.ersi-slide-arrow:hover {
  background: rgba(0, 212, 255, 0.16);
}

.ersi-slide-dots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  margin-top: 11px;
}

.ersi-slide-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  border: 1px solid rgba(0, 212, 255, 0.48);
  background: transparent;
  cursor: pointer;
  padding: 0;
}

.ersi-slide-dot.is-active {
  width: 22px;
  background: #00d4ff;
}

/* Quick facts and details */

.ersi-quick-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.ersi-quick-facts article,
.ersi-detail-card,
.ersi-summary-card {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 18px;
  padding: 22px;
  box-sizing: border-box;
}

.ersi-quick-facts h4,
.ersi-detail-card h3,
.ersi-summary-card h2 {
  color: #fff;
  margin: 12px 0 10px;
}

.ersi-quick-facts p,
.ersi-detail-card p,
.ersi-summary-card p {
  color: #a8b3c7;
  line-height: 1.62;
}

.ersi-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.ersi-summary-card {
  border-color: rgba(242, 204, 96, 0.38);
  background:
    linear-gradient(135deg, rgba(242, 204, 96, 0.1), rgba(22, 27, 34, 0.98)),
    #161b22;
}

/* Responsive */

@media (max-width: 900px) {
  .ersi-hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .ersi-hero .btn-main {
    width: 100%;
    text-align: center;
  }

  .ersi-slider-shell {
    grid-template-columns: 1fr;
  }

  .ersi-slide-arrow {
    min-height: 40px;
    width: 100%;
  }

  .ersi-slide-viewport {
    order: 1;
  }

  #ersiPrevSlide {
    order: 2;
  }

  #ersiNextSlide {
    order: 3;
  }

  .ersi-quick-facts,
  .ersi-detail-grid {
    grid-template-columns: 1fr;
  }

  .ersi-slide {
    min-height: 340px;
  }
}

@media (max-width: 600px) {
  .ersi-hero,
  .ersi-slideshow-section,
  .ersi-quick-facts,
  .ersi-detail-grid,
  .ersi-summary-card {
    width: 94%;
  }

  .ersi-slideshow-section {
    padding: 18px;
  }

  .ersi-slide {
    padding: 20px;
    min-height: 410px;
  }

  .ersi-slide h2 {
    font-size: 1.85rem;
  }

  .ersi-slideshow-header {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* --- DESKTOP ADAPTIVE WIDTH UPGRADE --- */
:root { --ersi-content-max: 1400px; }
.ersi-main,
.ersi-page,
.ersi-hero,
.ersi-section,
.ersi-grid {
  width: min(94vw, var(--ersi-content-max)) !important;
  max-width: var(--ersi-content-max) !important;
}
@media (min-width: 1500px) { :root { --ersi-content-max: 1640px; } .ersi-main, .ersi-page, .ersi-hero, .ersi-section, .ersi-grid { width: min(92vw, var(--ersi-content-max)) !important; } }
@media (min-width: 1900px) { :root { --ersi-content-max: 1840px; } .ersi-main, .ersi-page, .ersi-hero, .ersi-section, .ersi-grid { width: min(90vw, var(--ersi-content-max)) !important; } }
@media (min-width: 2300px) { :root { --ersi-content-max: 2040px; } }
@media (max-width: 900px) { :root { --ersi-content-max: 1400px; } }


/* --- ERSI BILINGUAL / RTL SUPPORT --- */
html[dir="rtl"] .ersi-hero,
html[dir="rtl"] .ersi-slideshow-header,
html[dir="rtl"] .ersi-detail-card,
html[dir="rtl"] .ersi-summary-card,
html[dir="rtl"] .ersi-slide {
  text-align: right;
}

html[dir="rtl"] .ersi-hero,
html[dir="rtl"] .ersi-slideshow-header,
html[dir="rtl"] .hero-actions {
  direction: rtl;
}

html[dir="rtl"] .ersi-slide-track {
  direction: ltr;
}

html[dir="rtl"] .ersi-slide {
  direction: rtl;
}

html[dir="rtl"] .ersi-slide ul {
  padding-left: 0;
  padding-right: 20px;
}

html[dir="rtl"] .ersi-slide-tag {
  letter-spacing: 0;
}

/* --- ERSI DESKTOP CENTERING + FULL-WIDTH CONTENT RESTORE ---
   Restores the desktop alignment from the ERSI layout fix while keeping
   the bilingual / RTL translation support added later. */
:root {
  --ersi-content-max: 1400px;
}

.main-content.ersi-main,
.ersi-main {
  width: min(94vw, var(--ersi-content-max)) !important;
  max-width: var(--ersi-content-max) !important;
  margin: calc(var(--banner-height, 82px) + 20px) auto 44px auto !important;
  padding: 0 24px !important;
  box-sizing: border-box !important;
  align-items: stretch !important;
}

.ersi-hero,
.ersi-slideshow-section,
.ersi-quick-facts,
.ersi-detail-grid,
.ersi-summary-card {
  width: 100% !important;
  max-width: none !important;
  margin-left: auto !important;
  margin-right: auto !important;
  box-sizing: border-box !important;
}

.ersi-slideshow-section {
  padding: clamp(22px, 2vw, 34px) !important;
}

.ersi-slider-shell {
  grid-template-columns: 44px minmax(0, 1fr) 44px !important;
  gap: 12px !important;
}

.ersi-slide {
  min-height: clamp(260px, 17vw, 360px) !important;
}

.ersi-slide p,
.ersi-slide ul {
  max-width: 1180px !important;
}

@media (min-width: 1500px) {
  :root { --ersi-content-max: 1640px; }
  .main-content.ersi-main,
  .ersi-main {
    width: min(92vw, var(--ersi-content-max)) !important;
  }

  .ersi-quick-facts,
  .ersi-detail-grid {
    gap: 20px !important;
  }
}

@media (min-width: 1900px) {
  :root { --ersi-content-max: 1840px; }
  .main-content.ersi-main,
  .ersi-main {
    width: min(90vw, var(--ersi-content-max)) !important;
  }
}

@media (min-width: 2300px) {
  :root { --ersi-content-max: 2040px; }
}

@media (max-width: 900px) {
  :root { --ersi-content-max: 1400px; }

  .main-content.ersi-main,
  .ersi-main {
    width: 100% !important;
    max-width: 100% !important;
    margin: calc(var(--banner-height, 82px) + 16px) auto 34px auto !important;
    padding: 0 14px !important;
  }

  .ersi-slider-shell {
    grid-template-columns: 1fr !important;
  }
}

/* Keep the brand title readable in Arabic/RTL mode. */
html[dir="rtl"] .banner-title {
  direction: ltr !important;
  unicode-bidi: isolate !important;
  text-align: center !important;
}
