/*!
 * Hamon–Gerdbad Bridge 1.13.0 — لایهٔ ریسپانسیو پایه برای قالب کلاکت (و هر قالب مشابه)
 * فقط افزودنی؛ هیچ قابلیتی از قالب/افزونه‌های کلاکت و پل حذف، کم یا تغییر نمی‌کند.
 * فقط وقتی بارگذاری می‌شود که قالب فعال لایهٔ ریسپانسیو خودش را نداشته باشد.
 * بدون :is/:where/:has/clamp/min()/max() تا روی مرورگرهای قدیمی تلویزیون هم کار کند.
 */
/* ---------- ۱) پایه‌های امن و سازگار ---------- */
html {
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  max-width: 100%;
}

/* جلوگیری از اسکرول افقی ناخواسته، بدون خراب‌کردن position:sticky */
@supports (overflow-x: clip) {
  html,
  body {
    overflow-x: clip;
  }
}

img,
video,
canvas,
svg,
iframe,
embed,
object {
  max-width: 100%;
}

iframe {
  border: 0;
}

/* تصویرهای داخل متن‌ها؛ تصویرهای با ارتفاع ثابت (کارت‌ها) دست‌نخورده می‌مانند */
.entry img,
.entry-content img,
.post-content img,
.single-page-body .content img,
.comment-body img,
.wp-caption {
  max-width: 100%;
  height: auto;
}

.wp-caption {
  width: auto !important;
}

/* متن‌های بلند، آدرس‌ها و کدها از کادر بیرون نزنند */
.entry,
.entry-content,
.post-content,
.comment-body,
.single-page-body,
.news-title,
.list_info {
  overflow-wrap: break-word;
  word-wrap: break-word;
}

pre,
code {
  max-width: 100%;
  overflow-x: auto;
  white-space: pre-wrap;
}

/* جدول‌ها روی صفحهٔ باریک داخل خودشان اسکرول شوند */
.entry table,
.entry-content table,
.post-content table,
.comment-body table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* حذف تأخیر ۳۰۰ms و دبل‌تپ-زوم تصادفی روی کنترل‌ها */
a,
button,
input,
select,
textarea,
label,
summary,
[role="button"],
.menu_switch,
.swiper-button-next,
.swiper-button-prev,
.hamon-nav,
.swiper-pagination-bullet {
  -ms-touch-action: manipulation;
  touch-action: manipulation;
}

/* ---------- ۲) ارتفاع واقعی صفحه (نوار آدرس موبایل/آی‌او‌اس) ---------- */
@supports (height: 100dvh) {
  .dark-box {
    height: 100dvh;
  }
}

.hm-vh-fix .dark-box {
  height: calc(var(--hm-vh, 1vh) * 100);
}

/* ---------- ۳) ورودی‌ها: جلوگیری از زوم خودکار iOS و هدف لمسی مناسب ---------- */
@media (max-width: 1024px) {
  input[type="text"],
  input[type="search"],
  input[type="email"],
  input[type="tel"],
  input[type="url"],
  input[type="password"],
  input[type="number"],
  select,
  textarea {
    font-size: 16px;
  }
}

@media (pointer: coarse) {
  button,
  input[type="submit"],
  input[type="button"],
  select,
  .pagination a,
  .pagination span,
  .header--nav li a,
  .sub-menu li a,
  .hamon-row__more,
  .hamon-nav,
  .swiper-button-next,
  .swiper-button-prev {
    min-height: 44px;
  }

  .hamon-row__more,
  .hamon-nav {
    min-width: 44px;
  }

  .pagination a,
  .pagination span {
    min-width: 44px;
    line-height: 44px;
  }
}

/* ---------- ۴) لمس: هرچه با hover باز می‌شد با فوکوس/لمس هم باز شود ---------- */
.play-slider a:focus .list_info,
.play-slider a:focus-within .list_info,
.play-slider a:active .list_info {
  opacity: 1;
}

.play-slider li:focus-within .tooltiptext,
.mr-base-box li:focus-within .tooltiptext {
  opacity: 1;
}

.hamon-card:focus .hamon-card__poster img,
.hamon-card:focus-within .hamon-card__poster img {
  -webkit-transform: scale(1.04);
  transform: scale(1.04);
}

/* دستگاه‌های لمسی: hover چسبنده نسازد */
@media (hover: none) {
  .hamon-card:hover .hamon-card__poster img {
    -webkit-transform: none;
    transform: none;
  }
}

/* ---------- ۵) فوکوس قابل‌دیدن (کیبورد، ریموت تلویزیون) ---------- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid #a196f6;
  outline-offset: 2px;
}

/* ---------- ۶) جایگزین aspect-ratio برای مرورگرهای قدیمی (تلویزیون‌ها، iOS < 15) ---------- */
@supports not (aspect-ratio: 1 / 1) {
  .hamon-card__poster,
  .hamon-card__poster--video,
  .hamon-video-home-card__media,
  .soon-holder .play-slider .swiper-slide a,
  .soon-holder > .play-slider > a {
    height: 0;
  }

  .hamon-card__poster {
    padding-bottom: 150%;
  }

  .hamon-card__poster--video,
  .hamon-video-home-card__media {
    padding-bottom: 56.25%;
  }

  .soon-holder .play-slider .swiper-slide a,
  .soon-holder > .play-slider > a {
    padding-bottom: 56.25%;
    max-height: none;
  }

  .hamon-card__poster img,
  .hamon-video-home-card__media img {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    bottom: 0;
  }
}

/* ---------- ۷) جایگزین @container برای مرورگرهای بدون container query ---------- */
@supports not (container-type: inline-size) {
  .hamon-cat-swiper .swiper-slide {
    width: calc((100% - 14px) / 2.4);
  }

  .hamon-cat-swiper--video .swiper-slide {
    width: calc((100% - 4px) / 1.4);
  }

  @media (min-width: 540px) {
    .hamon-cat-swiper .swiper-slide {
      width: calc((100% - 26px) / 3.2);
    }

    .hamon-cat-swiper--video .swiper-slide {
      width: calc((100% - 14px) / 2.2);
    }
  }

  @media (min-width: 768px) {
    .hamon-cat-swiper .swiper-slide {
      width: calc((100% - 45px) / 4.2);
    }

    .hamon-cat-swiper--video .swiper-slide {
      width: calc((100% - 30px) / 3.2);
    }
  }

  @media (min-width: 1024px) {
    .hamon-cat-swiper .swiper-slide {
      width: calc((100% - 80px) / 6);
    }

    .hamon-cat-swiper--video .swiper-slide {
      width: calc((100% - 48px) / 4);
    }
  }

  @media (min-width: 1400px) {
    .hamon-cat-swiper .swiper-slide {
      width: calc((100% - 96px) / 7);
    }

    .hamon-cat-swiper--video .swiper-slide {
      width: calc((100% - 64px) / 5);
    }
  }
}

/* اگر grid-gap پشتیبانی نشود، شبکهٔ ویدیوها فاصله‌اش را از دست ندهد */
@supports not (display: grid) {
  .hamon-video-home-grid {
    display: block;
  }

  .hamon-video-home-grid > * {
    display: inline-block;
    vertical-align: top;
    width: 48%;
    margin: 0 1% 14px;
  }
}

/* ---------- ۸) گوشی‌های خیلی کوچک (≤ 359px) ---------- */
@media (max-width: 359px) {
  body {
    font-size: 13px;
  }

  .hamon-row__title {
    font-size: 14px;
  }

  .hamon-card__title {
    font-size: 12px;
  }

  .page-header .logo img {
    max-width: 120px;
  }
}

/* ---------- ۹) موبایل (≤ 767px) ---------- */
@media (max-width: 767px) {
  .container,
  .containera {
    max-width: 100%;
  }

  .page-header .logo img {
    max-width: 150px;
    height: auto;
  }

  .hamon-row {
    margin: 20px 0;
  }

  .hamon-video-home-row__head {
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
  }

  /* نوار تب‌ها/دسته‌ها روی صفحهٔ باریک اسکرول افقی روان داشته باشد */
  .pagination {
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
  }
}

/* گوشی در حالت افقی (landscape): ارتفاع کم → هیرو و منو جمع‌وجور */
@media (max-height: 480px) and (orientation: landscape) {
  .soon-holder .play-slider .swiper-slide a,
  .soon-holder > .play-slider > a {
    max-height: 70vh;
  }

  .header--nav {
    -webkit-overflow-scrolling: touch;
  }
}

/* ---------- ۱۰) تبلت (768–1023px) ---------- */
@media (min-width: 768px) and (max-width: 1023px) {
  .hamon-video-home-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* ---------- ۱۱) صفحهٔ بزرگ و فول‌اچ‌دی (≥ 1600px) ---------- */
@media (min-width: 1600px) {
  body {
    font-size: 15px;
  }

  .hamon-row__title {
    font-size: 18px;
  }

  .hamon-card__title {
    font-size: 14px;
  }
}

/* ---------- ۱۲) تلویزیون / 4K (≥ 1920px یا تشخیص تلویزیون) ---------- */
@media (min-width: 1920px) {
  body {
    font-size: 18px;
  }

  .hamon-row__title {
    font-size: 22px;
  }

  .hamon-card__title {
    font-size: 17px;
  }

  .hamon-nav {
    width: 48px;
    height: 48px;
  }
}

@media (min-width: 2560px) {
  body {
    font-size: 22px;
  }

  .hamon-row__title {
    font-size: 28px;
  }

  .hamon-card__title {
    font-size: 21px;
  }
}

/* تلویزیون (کلاس hm-tv از جاوااسکریپت): متن درشت‌تر برای فاصلهٔ دید + فوکوس بسیار واضح ریموت */
html.hm-tv body {
  font-size: 20px;
  line-height: 1.9;
}

html.hm-tv .hamon-row__title {
  font-size: 24px;
}

html.hm-tv .hamon-card__title {
  font-size: 18px;
}

html.hm-tv .hamon-nav {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  width: 52px;
  height: 52px;
}

html.hm-tv a:focus,
html.hm-tv button:focus,
html.hm-tv input:focus,
html.hm-tv select:focus,
html.hm-tv textarea:focus,
html.hm-tv [tabindex]:focus {
  outline: 4px solid #ffffff;
  outline-offset: 3px;
  box-shadow: 0 0 0 7px #4d458e;
  border-radius: 8px;
}

html.hm-tv .hamon-card:focus,
html.hm-tv .play-slider a:focus {
  -webkit-transform: scale(1.05);
  transform: scale(1.05);
  position: relative;
  z-index: 3;
}

/* ---------- ۱۳) حاشیهٔ امن ناچ/گوشه‌گرد (iPhone/iPad/اندروید) ---------- */
@supports (padding: env(safe-area-inset-left)) {
  body {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
}

/* ---------- ۱۴) کاهش حرکت برای کسانی که در سیستم‌عامل فعال کرده‌اند ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    -webkit-animation-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    -webkit-animation-iteration-count: 1 !important;
    animation-iteration-count: 1 !important;
    -webkit-transition-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- ۱۵) چاپ ---------- */
@media print {
  .hamon-nav,
  .menu_switch,
  .dark-box {
    display: none !important;
  }
}
