/*!
 * Gozideh mobile CSS (Divi-child). EVERY rule below lives inside a max-width media query,
 * so desktop (>= 981px) rendering is unaffected. Loaded with media="(max-width: 980px)".
 * 1) Endless-scroll feed cards (phones, <= 767px)
 * 2) Mobile fixes (<= 980px)
 */

/* ---------- 0. feed container is inert unless the phone media query matches ---------- */
.shm-feed { display: none; }

/* ---------- 1. Endless scroll feed (phones) ---------- */
@media (max-width: 767px) {
  .shm-orig-hidden { display: none !important; }

  .shm-feed {
    display: block;
    direction: rtl;
    text-align: right;
    box-sizing: border-box;
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
    padding: 20px 14px 36px;
    background: transparent;
    font-family: inherit;
  }
  .shm-feed *, .shm-feed *::before, .shm-feed *::after { box-sizing: border-box; }

  .shm-feed__heading {
    margin: 8px 0 18px;
    padding: 0;
    font-size: 22px;
    line-height: 1.5;
    font-weight: 700;
    color: #222;
    text-align: center;
  }

  .shm-card {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 2px 14px rgba(0, 0, 0, .09);
    margin: 0 0 22px;
    overflow: hidden;
  }
  .shm-card__media { display: block; background: #eee; line-height: 0; }
  .shm-card__media img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    margin: 0;
    border-radius: 0;
  }
  .shm-card__body { padding: 14px 16px 18px; }
  .shm-card__title {
    margin: 0 0 6px;
    padding: 0;
    font-size: 19px;
    line-height: 1.75;
    font-weight: 700;
    color: #1d1d1d;
  }
  .shm-card__title a { color: inherit; text-decoration: none; }
  .shm-card__date {
    display: block;
    margin: 0 0 8px;
    font-size: 13px;
    line-height: 1.6;
    color: #7a7a7a;
  }
  .shm-card__excerpt {
    margin: 0 0 10px;
    padding: 0;
    font-size: 15px;
    line-height: 1.95;
    color: #444;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    overflow: hidden;
  }
  .shm-card__more {
    display: inline-block;
    padding: 6px 0;
    font-size: 14px;
    font-weight: 700;
    color: #d9541e;
    text-decoration: none;
  }
  .shm-card__more::after { content: " ←"; }

  .shm-feed__status {
    min-height: 28px;
    padding: 6px 0;
    text-align: center;
    font-size: 14px;
    color: #777;
  }
  .shm-feed__status:empty { min-height: 0; padding: 0; }
  .shm-feed__status.is-error { color: #b32d2e; }
  .shm-feed__btn {
    display: block;
    margin: 4px auto 0;
    padding: 10px 22px;
    min-height: 44px;
    font-family: inherit;
    font-size: 15px;
    color: #fff;
    background: #d9541e;
    border: 0;
    border-radius: 24px;
    cursor: pointer;
  }
  .shm-feed__sentinel { height: 1px; }

  /* on category/tag pages the original paginated list is replaced by the feed */
  .shm-feed.is-active { padding-top: 6px; }
}

/* ---------- 2. Mobile fixes (tablet + phone) ---------- */
@media (max-width: 980px) {
  /*
   * 2a. Divi dynamic CSS is sometimes generated WITHOUT the Menu module styles (seen on
   * category/tag/author pages: whole menu printed twice as bullet lists inside a fixed,
   * ~900px-tall sticky header). These are the stock Divi menu-module mobile rules, so when
   * Divi does output them nothing changes.
   */
  .et_pb_menu .et_pb_menu__wrap { flex: 1 1 auto; display: flex; justify-content: flex-start; align-items: stretch; flex-wrap: wrap; opacity: 1; }
  .et_pb_menu .et_pb_menu__menu { display: none; }
  .et_pb_menu .et_mobile_nav_menu { float: none; margin: 0 6px; display: flex; align-items: center; }
  .et_pb_menu .et_pb_menu__search-container--disabled { display: none; }
  .et_pb_menu .et_pb_menu__search-container { position: absolute; display: flex; justify-content: stretch; align-content: stretch; left: 0; bottom: 0; width: 100%; height: 100%; opacity: 0; z-index: 999; }
  .et_pb_menu .et_pb_menu__search-container--visible { opacity: 1; }
  .et_pb_menu_inner_container { position: relative; }
  .mobile_menu_bar { position: relative; display: block; line-height: 0; }
  .mobile_menu_bar:before { content: "a"; font-size: 32px; position: relative; left: 0; top: 0; cursor: pointer; }
  .et_pb_module .mobile_menu_bar:before { top: 2px; }
  .mobile_nav .select_page { display: none; }
  .et_pb_menu .et_mobile_menu { top: 100%; padding: 5%; }
  .et_pb_menu .et_mobile_menu, .et_pb_menu .et_mobile_menu ul { list-style: none !important; }
  .et_pb_menu .et_mobile_menu ul { padding: 0; }
  .et_pb_menu .mobile_nav.closed .et_mobile_menu { display: none; }
  button.et_pb_menu__icon { display: flex; align-items: center; padding: 0; margin: 0 11px; font-size: 17px; line-height: normal; background: none; border: 0; cursor: pointer; flex-direction: row-reverse; }
  button.et_pb_menu__icon:after { font-family: ETmodules; }
  .et_pb_menu__search-button:after { content: "U"; }

  /* 2b. touch targets for the header icons */
  .et_pb_menu .et_pb_menu__icon, .et_pb_menu .mobile_menu_bar { min-width: 40px; min-height: 40px; justify-content: center; }
  .et_pb_menu .mobile_menu_bar { display: flex; align-items: center; }

  /* 2c. article-list teaser text was 11px on phones */
  .et_pb_posts .post-content, .et_pb_posts .post-content p, .et_pb_posts .post-content-inner, .et_pb_posts .post-content-inner p { font-size: 14px !important; line-height: 1.9 !important; }

  /* 2d. newsletter form: keep inputs/labels aligned with the RTL layout */
  footer.et-l--footer input[type="text"], footer.et-l--footer input[type="email"] { text-align: right; max-width: 100%; }
}

/* =====================================================================
 * Round 2 (2026-10-03): off-canvas menu, home = chips + feed, source logo, Lottie dividers
 * Everything below is inside max-width media queries except the inert defaults.
 * ===================================================================== */
.shm-drawer, .shm-drawer-overlay, .shm-chips, .shm-lottie, .shm-about, .shm-related { display: none; }

/* ---------- off-canvas menu (<= 980px) ---------- */
@media (max-width: 980px) {
  /* Divi's own mobile dropdown is replaced by the drawer */
  .et_pb_menu .et_mobile_menu, #et_mobile_nav_menu .et_mobile_menu, .mobile_nav .et_mobile_menu { display: none !important; }
  .et_slide_in_menu_container { display: none !important; }
  .mobile_menu_bar { cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .mobile_menu_bar:focus-visible { outline: 2px solid #d9541e; outline-offset: 2px; }

  /* ROUND 3 ROOT-CAUSE FIX: the Divi search overlay (.et_pb_menu__search-container, z-index 999, opacity 0)
     covered the whole menu module incl. the hamburger and search icon, so real taps hit an invisible input.
     (headless JS .click() tests passed, real taps did not) */
  .et_pb_menu .et_pb_menu__search-container--disabled { display: none !important; }
  .et_pb_menu .et_pb_menu__search-container:not(.et_pb_menu__search-container--visible) { pointer-events: none !important; }
  /* own hamburger (inline in footer) replaces Divi's */
  .shm-has-btn .mobile_nav, .shm-has-btn .et_mobile_nav_menu, .shm-has-btn .mobile_menu_bar { display: none !important; }   /* R4: also the default Divi header toggle on article pages */
  /* drawer/overlay/button + critical CSS now live inline in the footer (wp_footer, gozideh-menu-inline.css) */
}

/* ---------- phones (<= 767px): home = chips + feed, source logo, Lottie dividers ---------- */
@media (max-width: 767px) {
  /* mobile home: no About / Latest / category sections; the feed replaces them */
  body.home .et-l--post .et_pb_section { display: none !important; }

  /* wrapped grid: every category visible, 2 per row at 320px, 3 per row at >=360px */
  .shm-chips { display: block; margin: 0 0 14px; padding: 0; overflow: visible; direction: rtl; }
  .shm-chips__row { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; width: 100%; padding: 4px 2px 8px; box-sizing: border-box; }
  .shm-chip { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 42px; min-width: 0; padding: 6px 8px; border-radius: 22px; background: #fff; color: #222 !important; font-size: 14px; line-height: 1.5; font-weight: 600; text-decoration: none; box-shadow: 0 1px 6px rgba(0, 0, 0, .12); box-sizing: border-box; }
  .shm-chip:active { background: #fdeee6; }
  .shm-feed--home { padding-top: 12px; }

  /* ---- Round 5 (<= 767px only) ---- */
  /* default Divi header (article pages): compact visible logo bar, linked to home (hamburger is our fixed round button) */
  #main-header { position: absolute !important; top: 0 !important; left: 0 !important; right: 0 !important; width: 100% !important; height: 63px !important; min-height: 0 !important; background: #fff !important; box-shadow: none !important; }
  #main-header .container { width: 100% !important; max-width: 100% !important; padding: 0 !important; }
  #main-header .logo_container { display: block !important; position: static !important; float: none !important; width: 100% !important; height: 63px !important; padding: 8px 0 !important; text-align: center; opacity: 1 !important; visibility: visible !important; animation: none !important; }
  #main-header .logo_helper { display: none !important; }
  #main-header #logo { display: inline-block !important; float: none !important; height: 46px !important; max-height: 46px !important; width: auto !important; margin: 0 !important; vertical-align: top; }
  #main-header #et-top-navigation { display: none !important; }

  /* related articles block (article pages): dark full-width band like the slider below it, horizontal scroll-snap row */
  .shm-related { display: block; direction: rtl; text-align: right; box-sizing: border-box; width: 100%; max-width: 100vw; margin: 28px 0 0; padding: 28px 0 22px; background: #2d2d2d; color: #fff; font-family: inherit; overflow: hidden; }
  /* R7: newest-10 dark slider section is replaced by the related band on mobile single posts */
  body.single .et_pb_section.shm-slider-sec { display: none !important; }
  body.single .et_pb_section:has(.et_pb_fullwidth_post_slider) { display: none !important; }
  .shm-related[hidden] { display: none !important; }
  .shm-related *, .shm-related *::before, .shm-related *::after { box-sizing: border-box; }
  .shm-related__title { margin: 0 0 18px; padding: 0 16px; font-size: 22px; line-height: 1.5; font-weight: 700; color: #fff; text-align: center; }
  .shm-related__list { display: flex; flex-wrap: nowrap; gap: 12px; direction: rtl; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scroll-padding: 0 16px; padding: 4px 16px 14px; margin: 0; scrollbar-width: none; touch-action: pan-x pan-y; }
  .shm-related__list::-webkit-scrollbar { display: none; }
  .shm-related .shm-card { flex: 0 0 82%; width: 82%; max-width: 340px; margin: 0; display: flex; flex-direction: column; scroll-snap-align: start; background: #3b3b3b; box-shadow: 0 2px 10px rgba(0, 0, 0, .35); }
  .shm-related .shm-card__media { background: #222; }
  .shm-related .shm-card__body { flex: 1 1 auto; }
  .shm-related .shm-card__title, .shm-related .shm-card__title a { color: #fff; font-size: 17px; }
  .shm-related .shm-card__date { color: #b5b5b5; }
  .shm-related .shm-card__excerpt { color: #d6d6d6; font-size: 14px; -webkit-line-clamp: 3; }
  .shm-related .shm-card__more { color: #ff9a6c; }
  .shm-related .shm-card__foot { margin-top: auto; }
  .shm-related .shm-card__source { background: #fff; border-radius: 8px; padding: 4px 8px; }
  .shm-related .shm-card__source-name { color: #222; }

  /* article image captions: below the image (static), small muted RTL text - not an overlay */
  .wp-caption { position: static !important; width: 100% !important; max-width: 100% !important; padding: 0 !important; margin: 0 0 20px !important; background: transparent !important; border: 0 !important; box-shadow: none !important; float: none !important; }
  .wp-caption img { display: block !important; width: 100% !important; max-width: 100% !important; height: auto !important; margin: 0 !important; }
  .wp-caption .wp-caption-text, .wp-caption p.wp-caption-text, .wp-caption-dd, figure.wp-block-image figcaption, .gallery-caption { position: static !important; top: auto !important; right: auto !important; bottom: auto !important; left: auto !important; transform: none !important; display: block !important; width: auto !important; max-width: 100% !important; margin: 0 !important; padding: 8px 4px 0 !important; background: none !important; box-shadow: none !important; border: 0 !important; color: #6b6b6b !important; font-size: 13.5px !important; line-height: 1.9 !important; font-weight: 400 !important; text-align: right !important; direction: rtl; opacity: 1 !important; overflow: visible !important; height: auto !important; }

  /* ---- Round 4 (<= 767px only) ---- */
  /* no visible search box/icon and no social icons in the header/page on phones (search lives in the off-canvas menu) */
  .et-l--header .et_pb_row--with-menu, .et-l--header .et_pb_menu, .et_pb_social_media_follow { display: none !important; }
  .et_social_networks, .et_social_inline, .et_social_sidebar_networks, .et_social_mobile { display: none !important; }

  /* compact About block (above chips): animation + short text */
  .shm-about { display: block; background: #fff; border-radius: 14px; box-shadow: 0 2px 14px rgba(0, 0, 0, .09); margin: 0 0 14px; padding: 4px 16px 8px; text-align: center; direction: rtl; overflow: hidden; }
  .shm-about .shm-lottie--about { height: 200px; margin: 0 0 2px; }
  .shm-about .shm-lottie--about.is-static { height: 2px; margin: 8px 24% 12px; }
  .shm-about__title { margin: 0 0 4px; padding: 0; font-size: 19px; line-height: 1.6; font-weight: 700; color: #1d1d1d; }
  .shm-about__body { margin: 0 0 2px; padding: 0; font-size: 14px; line-height: 1.85; color: #444; }
  .shm-about__more { display: inline-block; padding: 6px 0; font-size: 14px; font-weight: 700; color: #d9541e; text-decoration: none; }
  .shm-about__more::after { content: " ←"; }

  .shm-card__body { padding: 14px 16px 8px; }
  .shm-card__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 16px 14px; }
  .shm-card__foot .shm-card__more { padding: 6px 0; }
  .shm-card__source { display: flex; align-items: center; flex: 0 1 auto; min-width: 0; line-height: 0; text-decoration: none; }
  .shm-card__source img { display: block; width: auto; height: auto; max-height: 26px; max-width: 120px; margin: 0; }
  .shm-card__source-name { font-size: 12px; line-height: 1.6; color: #666; }

  .shm-lottie { display: block; position: relative; width: 100%; height: 320px; margin: 10px 0 30px; padding: 0; overflow: hidden; opacity: 0; transition: opacity .4s ease; contain: layout paint; pointer-events: none; }
  .shm-lottie.is-ready { opacity: 1; }
  .shm-lottie svg { display: block !important; margin: 0 auto; width: 100% !important; height: 100% !important; max-width: 100%; }
  .shm-lottie.is-static { height: 2px; margin: 4px 24% 26px; opacity: 1; background: linear-gradient(90deg, transparent, #d9541e, transparent); }
}
@media (max-width: 400px) { .shm-lottie { height: 280px; } }
@media (max-width: 767px) and (prefers-reduced-motion: reduce) {
  .shm-lottie { transition: none; }
}
