/*
Theme Name:  FoodFarm Child
Theme URI:   https://agrodostatok.com.ua/
Description: Дочірня тема для FoodFarm
Author:      Agrodostatok
Version:     1.0.0
Template:    foodfarm
Text Domain: foodfarm-child
*/

/* Порожньо навмисно. Усі стилі йдуть із батьківської теми. */

/* === Глобальний контролер відступів заголовків (h1–h6) === */
:root{
  --h-space-top: 1.1em;   /* верхній відступ */
  --h-space-bottom: .6em;  /* нижній відступ */
}

/* Базово для всіх заголовків */
h1, h2, h3, h4, h5, h6{
  margin-top: var(--h-space-top);
  margin-bottom: var(--h-space-bottom);
}

/* Зони, де тема/плагіни перебивають марджини */
.entry-content h1, .entry-content h2, .entry-content h3, .entry-content h4, .entry-content h5, .entry-content h6,
.wpb_text_column h1, .wpb_text_column h2, .wpb_text_column h3, .wpb_text_column h4, .wpb_text_column h5, .wpb_text_column h6,
.woocommerce-product-details__short-description h1, .woocommerce-product-details__short-description h2, .woocommerce-product-details__short-description h3, .woocommerce-product-details__short-description h4, .woocommerce-product-details__short-description h5, .woocommerce-product-details__short-description h6,
.woocommerce-Tabs .panel h1, .woocommerce-Tabs .panel h2, .woocommerce-Tabs .panel h3, .woocommerce-Tabs .panel h4, .woocommerce-Tabs .panel h5, .woocommerce-Tabs .panel h6{
  margin-top: var(--h-space-top) !important;
  margin-bottom: var(--h-space-bottom) !important;
}

/* Перший заголовок у блоці — без зайвого верхнього відступу */
.entry-content > h1:first-child,
.entry-content > h2:first-child,
.entry-content > h3:first-child,
.entry-content > h4:first-child,
.entry-content > h5:first-child,
.entry-content > h6:first-child,
.wpb_text_column > h1:first-child,
.wpb_text_column > h2:first-child,
.wpb_text_column > h3:first-child,
.wpb_text_column > h4:first-child,
.wpb_text_column > h5:first-child,
.wpb_text_column > h6:first-child,
.woocommerce-product-details__short-description > h1:first-child,
.woocommerce-product-details__short-description > h2:first-child,
.woocommerce-product-details__short-description > h3:first-child,
.woocommerce-product-details__short-description > h4:first-child,
.woocommerce-product-details__short-description > h5:first-child,
.woocommerce-product-details__short-description > h6:first-child,
.woocommerce-Tabs .panel > h1:first-child,
.woocommerce-Tabs .panel > h2:first-child,
.woocommerce-Tabs .panel > h3:first-child,
.woocommerce-Tabs .panel > h4:first-child,
.woocommerce-Tabs .panel > h5:first-child,
.woocommerce-Tabs .panel > h6:first-child{
  margin-top: 0 !important;
}

/* Трохи щільніше на мобільних (за бажанням) */
@media (max-width: 600px){
  :root{
    --h-space-top: 1.1em;
    --h-space-bottom: .5em;
  }
}

/* Назва товару окремо (якщо треба) */
.single-product .product_title{
  margin-bottom: .6em;
}

/* === Жорсткий оверрайд відступів заголовків на мобільних === */
@media (max-width: 600px){
  /* відступ для ВСІХ заголовків у типових зонах контенту */
  h1, h2, h3, h4, h5, h6,
  .entry-content h1, .entry-content h2, .entry-content h3, .entry-content h4, .entry-content h5, .entry-content h6,
  .wpb_text_column h1, .wpb_text_column h2, .wpb_text_column h3, .wpb_text_column h4, .wpb_text_column h5, .wpb_text_column h6,
  .woocommerce-product-details__short-description h1, .woocommerce-product-details__short-description h2, .woocommerce-product-details__short-description h3, .woocommerce-product-details__short-description h4, .woocommerce-product-details__short-description h5, .woocommerce-product-details__short-description h6,
  .woocommerce-Tabs .panel h1, .woocommerce-Tabs .panel h2, .woocommerce-Tabs .panel h3, .woocommerce-Tabs .panel h4, .woocommerce-Tabs .panel h5, .woocommerce-Tabs .panel h6{
    margin-top: var(--h-space-top) !important;
    margin-bottom: var(--h-space-bottom) !important;
  }

  /* перший заголовок у блоці — без верхнього відступу */
  .entry-content > h1:first-child,
  .entry-content > h2:first-child,
  .entry-content > h3:first-child,
  .entry-content > h4:first-child,
  .entry-content > h5:first-child,
  .entry-content > h6:first-child,
  .wpb_text_column .wpb_wrapper > h1:first-child,
  .wpb_text_column .wpb_wrapper > h2:first-child,
  .wpb_text_column .wpb_wrapper > h3:first-child,
  .wpb_text_column .wpb_wrapper > h4:first-child,
  .wpb_text_column .wpb_wrapper > h5:first-child,
  .wpb_text_column .wpb_wrapper > h6:first-child,
  .woocommerce-product-details__short-description > h1:first-child,
  .woocommerce-product-details__short-description > h2:first-child,
  .woocommerce-product-details__short-description > h3:first-child,
  .woocommerce-product-details__short-description > h4:first-child,
  .woocommerce-product-details__short-description > h5:first-child,
  .woocommerce-product-details__short-description > h6:first-child{
    margin-top: 0 !important;
  }

  /* назва товару */
  .single-product .product_title{
    margin-bottom: var(--h-space-bottom) !important;
  }
}

/* === УНІФІКОВАНІ ВІДСТУПИ ТА МІЖРЯДКОВИЙ ДЛЯ ВСІХ H1–H6 === */
:root{
  --h-top: 1.0em;        /* верхній відступ заголовків */
  --h-bottom: .55em;     /* нижній відступ заголовків */
  --h-lh: 1.28;          /* міжрядковий заголовків */
}

/* Базово + підвищена специфічність, щоб перебити стилі теми/плагінів */
html body h1, html body h2, html body h3, html body h4, html body h5, html body h6{
  margin-top: var(--h-top) !important;
  margin-bottom: var(--h-bottom) !important;
  line-height: var(--h-lh) !important;
  word-break: normal;
}

/* Контент сторінок/записів/товарів */
.entry-content h1, .entry-content h2, .entry-content h3, .entry-content h4, .entry-content h5, .entry-content h6,
.woocommerce-product-details__short-description h1, .woocommerce-product-details__short-description h2,
.woocommerce-product-details__short-description h3, .woocommerce-product-details__short-description h4,
.woocommerce-product-details__short-description h5, .woocommerce-product-details__short-description h6,
.woocommerce-Tabs .panel h1, .woocommerce-Tabs .panel h2, .woocommerce-Tabs .panel h3,
.woocommerce-Tabs .panel h4, .woocommerce-Tabs .panel h5, .woocommerce-Tabs .panel h6{
  margin-top: var(--h-top) !important;
  margin-bottom: var(--h-bottom) !important;
  line-height: var(--h-lh) !important;
}

/* Щоб перший заголовок всередині блоку не мав зайвого відступу зверху */
.entry-content > h1:first-child, .entry-content > h2:first-child, .entry-content > h3:first-child,
.entry-content > h4:first-child, .entry-content > h5:first-child, .entry-content > h6:first-child,
.woocommerce-Tabs .panel > h1:first-child, .woocommerce-Tabs .panel > h2:first-child,
.woocommerce-Tabs .panel > h3:first-child, .woocommerce-Tabs .panel > h4:first-child,
.woocommerce-Tabs .panel > h5:first-child, .woocommerce-Tabs .panel > h6:first-child{
  margin-top: 0 !important;
}

/* Мобільні: трохи щільніше, щоб виглядало акуратно */
@media (max-width: 767px){
  :root{ --h-top: .85em; --h-bottom: .5em; --h-lh: 1.32; }
}

/* === РОЗМІР ШРИФТУ ДЛЯ h2 (десктоп / мобайл) === */
:root{
  --h2-size-desktop: 28px; /* підкрути як треба (наприклад 28–32px) */
  --h2-size-mobile: 26px;  /* підкрути як треба (наприклад 18–24px) */
  /* опційно: індивідуальний line-height для h2 */
  --h2-lh: 1.28;
}

/* десктоп */
html body h2,
.entry-content h2,
.woocommerce-product-details__short-description h2,
.woocommerce-Tabs .panel h2{
  font-size: var(--h2-size-desktop) !important;
  line-height: var(--h2-lh) !important; /* якщо не треба — можеш прибрати */
}

/* мобільні */
@media (max-width: 767px){
  html body h2,
  .entry-content h2,
  .woocommerce-product-details__short-description h2,
  .woocommerce-Tabs .panel h2{
    font-size: var(--h2-size-mobile) !important;
  }
}

/* ===== FIX: підменю рівно під пунктом меню (RU/UA) ===== */

/* батьківський пункт робимо опорним */
#site-navigation .menu-main-container ul > li,
#site-navigation .right-header ul > li,
#site-navigation .secon_menu_sect ul > li {
  position: relative !important;
}

/* скидаємо будь-яке left:50%/transform, центрування тощо */
#site-navigation .mega-menu > li > ul,
#site-navigation .menu       > li > ul,
#site-navigation .nav-menu   > li > ul,
#site-navigation .menu-main-container ul > li > ul,
#site-navigation .right-header         ul > li > ul,
#site-navigation .secon_menu_sect      ul > li > ul,
#site-navigation .secon_menu_sect .sub-menu,
#site-navigation .secon_menu_sect .dropdown-menu {
  left: 0 !important;
  right: auto !important;
  transform: none !important;
  margin-left: 0 !important;
  top: 100% !important;           /* одразу під пунктом */
  /* опційно: мінімальна ширина, якщо треба */
  /* min-width: 240px !important; */
}

/* на випадок липкого хедера — дублюємо правило */
.is-sticky #site-navigation .menu-main-container ul > li > ul,
.is-sticky #site-navigation .right-header         ul > li > ul,
.is-sticky #site-navigation .secon_menu_sect      ul > li > ul {
  left: 0 !important;
  transform: none !important;
}

/* ============================
   MOBILE: відступ лого/назва в хедері — окремо для UA та RU
   ============================ */
@media (max-width: 767.98px){
  /* спільне вирівнювання контейнерів у шапці */
  #site-navigation .menu-main-container{
    display:flex !important;
    align-items:center !important;
  }
  #site-navigation .menu-main-container > .col-lg-3,
  #site-navigation .menu-main-container > [class*="col-"]:first-child{
    display:flex !important;
    align-items:center !important;
  }

  /* базові параметри (висота лого) */
  html{ --m-logo-max-h: 44px; }

  /* ——— МОВНІ РУЧКИ ———
     UA інколи відлітає трохи вище, тому опускаємо її більше;
     Значення під себе: більше => нижче, від’ємне => вище. */
  html[lang^="uk"], html[lang^="ua"]{ --m-logo-nudge-y: 3px; }  /* UA */
  html[lang^="ru"]{ --m-logo-nudge-y: -25px; }                    /* RU */

  /* сам блок логотипу/назви — застосування нуджу */
  .header-logo,
  .site-branding,
  #site-logo,
  #logo,
  .site-title{
    display:flex !important;
    align-items:center !important;
    margin:0 !important;
    transform: translateY(var(--m-logo-nudge-y, 0)) !important;
  }

  /* якщо логотип — зображення */
  .header-logo img,
  .site-branding img,
  #site-logo img,
  #logo img{
    max-height: var(--m-logo-max-h) !important;
    height:auto !important;
    width:auto !important;
  }
}

/* Відступ після маркованих/нумерованих списків у контенті */
:root{
  --list-gap-m: .9em;   /* мобільний відступ після списку */
  --list-gap-d: 1.2em;  /* десктопний відступ після списку */
}

/* Пост/сторінка + Woo: короткий опис і вкладки товару */
.entry-content ul,
.entry-content ol,
.post-content ul,
.post-content ol,
.woocommerce-product-details__short-description ul,
.woocommerce-product-details__short-description ol,
.single-product .woocommerce-Tabs-panel ul,
.single-product .woocommerce-Tabs-panel ol{
  margin-bottom: var(--list-gap-m) !important;
}

@media (min-width: 768px){
  .entry-content ul,
  .entry-content ol,
  .post-content ul,
  .post-content ol,
  .woocommerce-product-details__short-description ul,
  .woocommerce-product-details__short-description ol,
  .single-product .woocommerce-Tabs-panel ul,
  .single-product .woocommerce-Tabs-panel ol{
    margin-bottom: var(--list-gap-d) !important;
  }
}

/* Фолбек: якщо тема «з’їдає» верхній margin абзацу після списку */
.entry-content ul + p,
.entry-content ol + p,
.woocommerce-product-details__short-description ul + p,
.woocommerce-product-details__short-description ol + p{
  margin-top: .6em !important;
}

/* ===== MOBILE (<=768): центр фото, мініатюри під фото, без зуму ===== */
@media (max-width: 767.98px){

  /* Контейнер галереї */
  .single-product div.product div.images{
    display:block !important;
    text-align:center !important;
    padding-left:0 !important;
    padding-right:0 !important;
  }

  /* Внутрішні обгортки — повна ширина, без float */
  .single-product .woocommerce-product-gallery,
  .single-product .woocommerce-product-gallery__wrapper,
  .single-product .flex-viewport{
    width:100% !important;
    max-width:100% !important;
    float:none !important;
  }

  /* Велике фото строго по центру */
  .single-product .woocommerce-product-gallery__image{
    float:none !important;
    display:inline-block !important;
    margin:0 auto !important;
  }
  .single-product .woocommerce-product-gallery__image a,
  .single-product .woocommerce-product-gallery__image img{
    display:block !important;
    margin-left:auto !important;
    margin-right:auto !important;
    max-width:100% !important;
    height:auto !important;

    /* Зручний скрол пальцем по фото */
    pointer-events:none !important;
    touch-action: pan-y !important;
    -webkit-user-select:none; user-select:none;
  }

  /* Мініатюри під фото, по центру */
  .single-product .flex-control-nav.flex-control-thumbs,
  .single-product div.product .images .thumbnails{
    display:flex !important;
    flex-wrap:wrap;
    justify-content:center !important;
    gap:10px;
    width:100%;
    margin:12px 0 0 !important;
    padding:0 !important;
    float:none !important;
    text-align:center !important;
  }
  .single-product .flex-control-nav.flex-control-thumbs li{
    float:none !important;
    width:auto !important;
    margin:0 !important;
  }
  .single-product .flex-control-nav.flex-control-thumbs img{
    width:56px !important;   /* за потреби підкрути */
    height:auto !important;
    pointer-events:auto !important; /* мініатюри лишаються клікабельними */
  }

  /* Прибрати лупу/зум/стрілки */
  .single-product .woocommerce-product-gallery__trigger,
  .single-product .zoomContainer,
  .single-product .zoomWindowContainer,
  .single-product .zoomWindow,
  .single-product .flex-direction-nav,
  .single-product .woocommerce-product-gallery .slick-arrow{
    display:none !important;
  }
}

/* === FIX: UA Home full-width (page-id-18221) === */
html[lang="uk-UA"] body.page-id-18221 #main.wrapper.boxed {
  width: 100% !important;
  max-width: 100% !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

html[lang="uk-UA"] body.page-id-18221 #main.wrapper.boxed > .container {
  width: 100% !important;
  max-width: 100% !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

/* щоб VC-рядки не повертали “внутрішні” бокові зсуви */
html[lang="uk-UA"] body.page-id-18221 #main.wrapper.boxed .vc_row,
html[lang="uk-UA"] body.page-id-18221 #main.wrapper.boxed .wpb_row {
  margin-left: 0 !important;
  margin-right: 0 !important;
}
