/*
 * shrem.az — responsive.css
 * <head>-ə əlavə olunmalıdır (viewport teqi saytda yoxdur, o da vacibdir):
 * <meta name="viewport" content="width=device-width, initial-scale=1">
 * <link rel="stylesheet" href="https://shrem.az/template/css/responsive.css?v=1.0">
 * <script src="https://shrem.az/template/js/responsive.js?v=1.0" defer></script>
 *
 * Seçicilərin önündəki "html" / "html body" qaydaları gücləndirir ki,
 * fayl harada qoşulsa da style.css onu ləğv etməsin.
 *
 * Breakpoint-lər:
 *   <= 1199px : sabit 1200px en axıcı olur, karusellər barmaqla sürüşdürülən zolağa çevrilir
 *   <=  991px : mobil — hamburger menyu, tək sütun
 *   <=  600px : kiçik telefon
 */

/* responsive.js-in əlavə etdiyi elementlər — kompüterdə gizlidir */
html .menu-toggle,
html .sub-toggle { display: none; }

/* ================= Planşet / kiçik noutbuk ================= */
@media (max-width: 1199px) {
  html, body { overflow-x: hidden; }

  html .header_top,
  html .header_bottom,
  html .menu,
  html .manshet,
  html div#manshet,
  html .center_cont,
  html .announce_main,
  html .news_main,
  html .banner,
  html .footer,
  html .bottom-menu { width: auto; max-width: 100%; }

  html .header_top { padding: 20px 15px 0; }
  html .header_top_left { width: calc(100% - 330px); height: auto; }
  html .logo_text { width: auto; float: none; overflow: hidden; }

  /* Manşet slayderi */
  /* Slayder şəkilləri keçid zamanı üst-üstə düşür, hündürlük sabit nisbətdə qalır
     (yoxsa hər 9 saniyədən bir səhifə aşağı-yuxarı atılır) */
  html .manshet { height: auto; }
  html div#manshet {
    position: relative;
    height: auto;
    aspect-ratio: 1200 / 445;
  }
  html div#manshet > div {
    position: absolute;
    inset: 0;
  }
  html .manshet_body a { display: block; height: 100%; }
  html .manshet_body img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  /* --- Karusellər: JS-in sabit enlərini ləğv edib sürüşdürülən zolaq edirik --- */
  html body .announce_main_cont,
  html body .news_main_cont,
  html body .banner_body {
    width: auto !important;
    margin: 15px 15px 0;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  html body .announce_main_cont > ul,
  html body .news_main_cont > ul,
  html body .banner_body > ul {
    display: flex;
    gap: 14px;
    width: auto !important;
    left: 0 !important;
  }
  html body .announce_main_cont > ul > li,
  html body .news_main_cont > ul > li,
  html body .banner_body > ul > li {
    float: none !important;
    flex: none;
    margin: 0;
    padding: 0;
    scroll-snap-align: start;
  }
  /* jCarouselLite əvvələ və sona surət (clone) əlavə edir — onları gizlədirik */
  html body .announce_main_cont > ul > li:nth-child(-n+4),
  html body .announce_main_cont > ul > li:nth-last-child(-n+4),
  html body .news_main_cont > ul > li:nth-child(-n+5),
  html body .news_main_cont > ul > li:nth-last-child(-n+5),
  html body .banner_body > ul > li:nth-child(-n+6),
  html body .banner_body > ul > li:nth-last-child(-n+6) { display: none; }
  html a#announce_prev,
  html a#announce_next { display: none; }

  /* Elanlar */
  html .announce_main { height: auto; padding-bottom: 20px; }
  html .hovereffect { margin: 0; }
  /* Toxunma ekranında hover yoxdur — başlıq həmişə görünsün */
  html .hovereffect .overlay {
    opacity: 1;
    transform: none;
    top: auto;
    bottom: 0;
    width: 100%;
    height: auto;
    padding: 24px 6px 10px;
    box-sizing: border-box;
    background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, .85));
  }
  html span.announce_date { margin-top: 0; }
  html span.announce_name { margin-top: 6px; }

  /* Xəbərlər */
  html body .news_main_cont > ul > li { height: auto !important; }
  html .news_main_cont { padding-bottom: 10px; }
  html .news_m_cont { overflow-wrap: anywhere; } /* uzun linklər kartdan çıxmasın */

  /* Loqolar */
  html .banner { height: auto; }
  html body .banner_body > ul > li { width: 180px; }

  /* Footer */
  html section.footer { height: auto; padding-bottom: 20px; }
  html ul.bottom-menu-ul {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px 30px;
    margin: 0;
    padding: 21px 15px 0;
  }
  html .bottom-menu ul.bottom-menu-ul > li {
    float: none;
    width: auto;
    margin: 0;
  }
  html li.last_li { float: none !important; }
  html .footer_bottom { margin-top: 20px; display: flow-root; }
  html .footer_bottom_left { width: auto; }

  /* Daxili səhifələr */
  html .link-tree {
    width: auto;
    height: auto;
    margin: 0 15px 15px;
    padding-bottom: 8px;
  }
  html .page-content,
  html .page-text,
  html .page-tools { width: auto; padding: 0 15px; }
  html .page-content img,
  html .page-text img,
  html .page-text iframe,
  html .page-text video { max-width: 100%; height: auto; }
  html .page-text table,
  html .page-content table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
  }
  html .page-content,
  html .page-text { overflow-wrap: anywhere; }
  /* Mətndə inline en yazılmış bloklar (məs. Əlaqə səhifəsindəki xəritə, 1000px) */
  html .page-text div[style*="width"],
  html .page-text #gmap_canvas { max-width: 100%; }
  html .page-text #gmap_canvas { height: 300px !important; }

  /* Xəbərlər siyahısı və qalereyalar: şəbəkə */
  html .page-content > ul {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px 15px;
  }
  html .page-content > ul > li,
  html .page-content > ul#gallery1 > li {
    float: none;
    width: auto;
    height: auto;
    margin: 0;
    padding: 0;
  }
  html .page-content > ul > li img.news_main_img { width: 100%; height: auto; aspect-ratio: 220 / 128; object-fit: cover; }
  html .page-content > ul > li .news_m_cont { width: auto; height: auto; }

  /* AI köməkçi pəncərəsi ekrana sığsın */
  html #ai-chat-box {
    width: auto;
    left: 10px;
    right: 10px;
    max-width: 380px;
    margin-left: auto;
    height: min(500px, calc(100vh - 110px));
  }
  html #ai-chat-messages { height: calc(100% - 120px); }
}

/* ================= Planşet (992–1199px): üfüqi menyu sıxılır ================= */
@media (min-width: 992px) and (max-width: 1199px) {
  html .menu > ul { display: flex; }
  html .menu > ul > li,
  html .menu > ul > li:first-child,
  html li#ru {
    float: none;
    flex: 1 1 auto;
    padding: 20px 6px;
    margin: 0;
    text-align: center;
  }
  html .menu > ul > li > a { font-size: 13px; }
}

/* ================= Mobil ================= */
@media (max-width: 991px) {
  /* Başlıq: loqo + ad */
  html section.header { background-size: cover; }
  html .header_top { padding: 12px 12px 0; }
  html .header_top_left {
    float: none;
    width: auto;
    height: auto;
    padding: 0;
    display: flow-root;
  }
  html img.logo { width: 64px; margin-right: 12px; }
  html .logo_text { margin-top: 6px; line-height: 1.3; }
  html span.amea { font-size: 13px; }
  html span.amea_sheki { font-size: 17px; margin-top: 2px; }

  /* Sağ blok: xəritə, sosial, dil bir sətirdə; axtarış tam enli altında */
  html .header_top_right {
    float: none;
    width: auto;
    padding: 10px 0 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
  }
  html .header_top_right > .clear { display: none; }
  html a.sitemap { margin: 0 6px 0 0; }
  html .header_top_right a img { padding: 8px 8px; }
  html .lang { float: none; margin: 0 0 0 auto; }
  html .search-tool {
    float: none;
    width: 100%;
    margin: 8px 0 0;
  }
  html .search-tool form { display: flex; }
  html .search-tool .search {
    flex: 1;
    min-width: 0;
    width: auto;
    font-size: 16px; /* iOS avtomatik zoom etməsin */
  }
  html input.src-btn { right: 0; height: 33px; flex: none; }

  /* Menyu zolağı: solda ev ikonu, sağda ☰ */
  html .header_bottom { margin-top: 12px; }
  html .menu {
    height: auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
  }
  html .homemenu { float: none; flex: none; }
  html .homemenu img.home-bg { display: block; }
  html .menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 60px;
    height: 60px;
    margin-left: auto;
    padding: 0 18px;
    border: 0;
    background: transparent;
    cursor: pointer;
  }
  html .menu-toggle span {
    display: block;
    height: 2px;
    background: #fff;
    border-radius: 1px;
    transition: transform .2s, opacity .2s;
  }
  html .menu.is-open .menu-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  html .menu.is-open .menu-toggle span:nth-child(2) { opacity: 0; }
  html .menu.is-open .menu-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  html .menu > ul { width: 100%; }
  /* Skript yüklənibsə menyu bağlı başlayır; yüklənməsə açıq qalır */
  html .menu.has-toggle:not(.is-open) > ul { display: none; }

  html .menu > ul > li,
  html .menu > ul > li:first-child,
  html li#ru {
    float: none;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding: 0;
    margin: 0;
    background: none;
    border-top: 1px solid rgba(255, 255, 255, .2);
  }
  html .menu > ul > li > a {
    display: block;
    flex: 1;
    padding: 13px 16px;
  }

  /* Alt menyular: hover əvəzinə açılıb-bağlanan akkordeon.
     !important — saytın CSS və jQuery hover-i display-i özü idarə edir. */
  html body .menu.has-toggle > ul li ul:not(.__) {
    display: none !important;
    position: static;
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0 12px 6px 24px;
    box-sizing: border-box;
    background: #5b5b5b;
    border: 0;
  }
  html body .menu.has-toggle > ul li.sub-open > ul:not(.__) { display: block !important; }
  html ul.sub_menu > li,
  html ul.sub_menu > li > ul > li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    line-height: 1.35;
    padding: 0 0 0 10px;
    background-position: left 21px; /* "-" işarəsi alt menyu açılanda da birinci sətirdə qalsın */
  }
  html ul.sub_menu li > a {
    display: block;
    flex: 1;
    padding: 10px 0;
  }
  html i.oxhover { display: none; }

  html .sub-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 48px;
    height: 44px;
    padding: 0;
    border: 0;
    border-left: 1px solid rgba(255, 255, 255, .2);
    background: transparent;
    color: #fff;
    cursor: pointer;
  }
  html .sub-toggle::before {
    content: "";
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateY(-2px) rotate(45deg);
    transition: transform .2s;
  }
  html li.sub-open > .sub-toggle::before { transform: translateY(2px) rotate(-135deg); }

  /* Bölmə başlıqları */
  html .announce_main_title,
  html .news_main_title { font-size: 22px; padding-left: 15px; }
  html .announce_main { margin-top: 12px; }

  /* Xəbər (daxili) səhifəsi: şəkil üstdə, mətn altda */
  html .page-content .news-img {
    float: none;
    width: auto;
    padding: 0;
    margin-bottom: 12px;
  }
  html .news-img img,
  html .news-img img.news_in {
    float: none;
    display: block;
    width: 100%;
    height: auto;
  }
  html .news_in_gal { width: auto; }
  html .page-text,
  html .news-text .text { text-align: justify; }

  /* Mətn içindəki float şəkillər */
  html .page-text img[style*="float"],
  html .news-text img[style*="float"] {
    float: none !important;
    display: block;
    margin: 0 auto 12px !important;
  }
}

/* ================= Kiçik telefon ================= */
@media (max-width: 600px) {
  html span.amea { font-size: 12px; }
  html span.amea_sheki { font-size: 15px; }

  html body .banner_body > ul > li { width: 140px; }
  html .banner_body img { width: 100%; height: auto; }

  html .page-content > ul { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 10px; }
  html .footer_bottom_left { font-size: 14px; }
  html ul.bottom-menu-ul { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; }
  html span.footer-head { background-size: 100% auto; }
}
