/*========================================================================*/
/* استایل بنر متحرک - با الگوی مربع‌های سبز */
/*========================================================================*/

/* ==========================================
   کانتینر اصلی بنر (زمینه شطرنجی)
   ========================================== */
#banner-container {
  /* ========================================== */
  /* ⭐⭐ اضافه کردن فاصله از کناره‌ها */
  /* ========================================== */
  width: calc(100% - (var(--side-spacing) * 2));
  margin-left: var(--side-spacing);
  margin-right: var(--side-spacing);
  box-sizing: border-box;

  background-color: rgb(18, 197, 197);

  /* ⭐⭐ استفاده از متغیر برای ارتفاع */
  height: var(--banner-height);
  min-height: var(--banner-height);

  display: flex;
  justify-content: center;
  align-items: center;

  /* ⭐⭐ تغییر این خط برای استفاده از متغیر جدید */
  margin-top: var(--header-top-offset) !important;

  position: relative;
  overflow: hidden;

  background-image:
    linear-gradient(
      45deg,
      rgba(0, 0, 0, 0.15) 25%,
      transparent 25%,
      transparent 75%,
      rgba(0, 0, 0, 0.15) 75%,
      rgba(0, 0, 0, 0.15)
    ),
    linear-gradient(
      45deg,
      rgba(0, 0, 0, 0.15) 25%,
      transparent 25%,
      transparent 75%,
      rgba(0, 0, 0, 0.15) 75%,
      rgba(0, 0, 0, 0.15)
    );

  /* ⭐⭐ اندازه شطرنجی با vw - نرم و پیوسته */
  background-size: clamp(12px, 1.5vw, 24px) clamp(12px, 1.5vw, 24px);
  background-position:
    0 0,
    calc(clamp(12px, 1.5vw, 24px) / 2) calc(clamp(12px, 1.5vw, 24px) / 2);

  /* ========================================== */
  /* ⭐⭐ گرد کردن دو طرف بالای بنر با vw */
  /* ========================================== */
  border-radius: clamp(6px, 0.8vw, 14px) clamp(6px, 0.8vw, 14px) 0 0 !important;
  border: none;

  /* ⭐⭐ transition برای نرم شدن */
  transition:
    height 0.6s ease,
    min-height 0.6s ease,
    background-size 0.6s ease;
}

/* ==========================================
   کانتینر داخلی
   ========================================== */
.banner-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 0;
  text-align: center;
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
}

/* ==========================================
   ⭐⭐⭐ کانتینر متن - با جابجایی محدود به نصف ارتفاع
   ========================================== */
.banner-text-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0;
  /* ========================================== */
  /* ⭐⭐ محدودیت: از -نصف ارتفاع تا +نصف ارتفاع */
  /* ========================================== */
  margin-top: clamp(
    calc(-1 * (var(--banner-height) / 2)),
    var(--banner-text-offset),
    calc(var(--banner-height) / 2)
  );

  /* ⭐⭐ transition برای نرم شدن */
  transition: margin-top 0.6s ease;
}

/* ==========================================
   ⭐⭐⭐ خود متن (یک خطی)
   ========================================== */
.banner-text {
  display: inline-block;
  white-space: nowrap;
  animation: scroll-right 40s linear infinite;
  pointer-events: none !important;

  font-family: "Caza", "Shabnam", "IRANSans", "Segoe UI", Tahoma, sans-serif;
  font-weight: 700;

  /* ⭐⭐ اندازه فونت با vw - نرم و پیوسته */
  font-size: clamp(1rem, 2.5vw, 3.5rem);
  color: #000080;

  text-shadow:
    -1px -1px 0 white,
    1px -1px 0 white,
    -1px 1px 0 white,
    1px 1px 0 white,
    7px 7px 0px rgba(0, 0, 0, 0.4),
    8px 8px 0px rgba(0, 0, 0, 0.3),
    9px 9px 0px rgba(0, 0, 0, 0.2),
    10px 10px 0px rgba(0, 0, 0, 0.1);

  /* ⭐⭐ transition برای نرم شدن */
  transition: font-size 0.6s ease;
}

/* ==========================================
   حالت راست‌چین (فارسی، عربی، عبری)
   ========================================== */
.banner-wrapper.rtl .banner-text {
  animation: scroll-right 40s linear infinite;
}

/* ==========================================
   حالت چپ‌چین (انگلیسی، روسی، چینی)
   ========================================== */
.banner-wrapper:not(.rtl) .banner-text {
  animation: scroll-left 40s linear infinite;
}

/* ==========================================
   انیمیشن‌ها
   ========================================== */

@keyframes scroll-right {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

@keyframes scroll-left {
  0% {
    transform: translateX(100%);
  }
  100% {
    transform: translateX(-100%);
  }
}

/* ==========================================
   توقف حرکت با هاور
   ========================================== */
.banner-wrapper:hover .banner-text {
  animation-play-state: paused;
}

/* ==========================================
   RESPONSIVE - با استفاده از متغیرها و vw
   ========================================== */

/* تبلت */
@media (max-width: 1024px) {
  #banner-container {
    width: calc(100% - (var(--side-spacing) * 2));
    margin-left: var(--side-spacing);
    margin-right: var(--side-spacing);
    height: calc(var(--banner-height) * 0.8);
    min-height: calc(var(--banner-height) * 0.8);
    margin-top: calc(var(--header-top-offset) * 0.8) !important;
    background-size: clamp(10px, 1.2vw, 20px) clamp(10px, 1.2vw, 20px);
    background-position:
      0 0,
      calc(clamp(10px, 1.2vw, 20px) / 2) calc(clamp(10px, 1.2vw, 20px) / 2);
    border-radius: clamp(5px, 0.6vw, 10px) clamp(5px, 0.6vw, 10px) 0 0 !important;
  }
  .banner-text-container {
    margin-top: clamp(
      calc(-1 * (var(--banner-height) * 0.8 / 2)),
      calc(var(--banner-text-offset) * 0.8),
      calc(var(--banner-height) * 0.8 / 2)
    );
  }
  .banner-text {
    font-size: clamp(1rem, 2.2vw, 3rem);
    animation-duration: 35s;
  }
}

/* موبایل */
@media (max-width: 768px) {
  #banner-container {
    width: calc(100% - (var(--side-spacing) * 2));
    margin-left: var(--side-spacing);
    margin-right: var(--side-spacing);
    height: calc(var(--banner-height) * 0.6);
    min-height: calc(var(--banner-height) * 0.6);
    margin-top: calc(var(--header-top-offset) * 0.6) !important;
    background-size: clamp(8px, 1vw, 16px) clamp(8px, 1vw, 16px);
    background-position:
      0 0,
      calc(clamp(8px, 1vw, 16px) / 2) calc(clamp(8px, 1vw, 16px) / 2);
    border-radius: clamp(4px, 0.5vw, 8px) clamp(4px, 0.5vw, 8px) 0 0 !important;
  }
  .banner-text-container {
    margin-top: clamp(
      calc(-1 * (var(--banner-height) * 0.6 / 2)),
      calc(var(--banner-text-offset) * 0.6),
      calc(var(--banner-height) * 0.6 / 2)
    );
  }
  .banner-text {
    font-size: clamp(1rem, 2vw, 2.2rem);
    animation-duration: 30s;
  }
}

/* موبایل خیلی کوچک */
@media (max-width: 480px) {
  #banner-container {
    width: calc(100% - (var(--side-spacing) * 2));
    margin-left: var(--side-spacing);
    margin-right: var(--side-spacing);
    height: calc(var(--banner-height) * 0.4);
    min-height: calc(var(--banner-height) * 0.4);
    margin-top: calc(var(--header-top-offset) * 0.4) !important;
    background-size: clamp(6px, 0.8vw, 12px) clamp(6px, 0.8vw, 12px);
    background-position:
      0 0,
      calc(clamp(6px, 0.8vw, 12px) / 2) calc(clamp(6px, 0.8vw, 12px) / 2);
    border-radius: clamp(3px, 0.4vw, 6px) clamp(3px, 0.4vw, 6px) 0 0 !important;
  }
  .banner-text-container {
    margin-top: clamp(
      calc(-1 * (var(--banner-height) * 0.4 / 2)),
      calc(var(--banner-text-offset) * 0.4),
      calc(var(--banner-height) * 0.4 / 2)
    );
  }
  .banner-text {
    font-size: clamp(1rem, 1.8vw, 1.6rem);
    animation-duration: 25s;
  }
}
