/* Yakiwood: Mobile gallery slider styles */
/* SVARBU: Ant mobilaus telefono - visada horizontalus slajderis */

/* Galerija visada horizontali ant mobilaus */
@media (max-width: 980px) {
  /* Taikoma visiems moduliams */
  .et_pb_gallery,
  .et_pb_gallery_grid,
  .et_pb_gallery.yaki-gallery-enabled,
  .et_pb_gallery_grid.yaki-gallery-enabled,
  .yaki-slider {
    position: relative;
    overflow: visible;
    z-index: 2;
  }
  
  /* Perrašome Divi grid stilius, nes jie trukdo horizontaliam išdėstymui */
  .et_pb_gallery_grid .et_pb_gallery_items,
  .et_pb_gallery .et_pb_gallery_items {
    display: flex !important;
    flex-wrap: nowrap !important;
    flex-direction: row !important;
  }
  /* Turn Divi gallery items container into a horizontal slider - FORCE MODE */
  .et_pb_gallery_grid .et_pb_gallery_items,
  .et_pb_gallery .et_pb_gallery_items,
  .yaki-gallery-slider,
  .et_pb_gallery_grid .gallery-item:first-child, /* Alternative gallery structures */
  .et_pb_gallery_grid .et_pb_gallery_image:first-child {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    gap: 12px;
    padding-bottom: 8px;
    position: relative; /* anchor overlays to image area */
    z-index: 1; /* create stacking context */
    width: 100% !important;
  }

  /* Hide default clearfix artifacts if any */
  .yaki-gallery-slider::after {
    content: none !important;
  }

  /* Each gallery item as a slide - covering all Divi gallery markup patterns */
  .et_pb_gallery_grid .et_pb_gallery_item,
  .et_pb_gallery .et_pb_gallery_item,
  .yaki-gallery-slider > .et_pb_gallery_item,
  .yaki-gallery-slider > .et_pb_gallery_image,
  .yaki-gallery-slider > .gallery-item {
    flex: 0 0 100% !important;
    width: 100% !important; /* override Divi widths */
    max-width: 100% !important;
    margin: 0 !important;   /* control spacing via gap */
    scroll-snap-align: start;
    float: none !important; /* išjungti float, kad galėtų būti flex */
    display: block !important;
  }
  
  /* SVARBU: Panaikinti grid stilius */
  .et_pb_gallery_grid .et_pb_gallery_items {
    display: flex !important;
    grid-template-columns: none !important; 
  }

  /* Optionally, show a bit of next slide when not fullwidth */
  .yaki-gallery-slider.yaki-peek > .et_pb_gallery_item {
    flex-basis: 85%;
  }

  /* Make images responsive inside slides */
  .yaki-gallery-slider .et_pb_gallery_image img,
  .yaki-gallery-slider img,
  .et_pb_gallery_grid img {
    display: block;
    width: 100%;
    height: auto;
  }

  /* Overlay navigation arrows (centered vertically) */
  .yaki-gallery-slider .yaki-gallery-nav {
    position: absolute;
    inset: 0;
    pointer-events: none; /* allow clicks to pass except on buttons */
    z-index: 9999 !important; /* ensure above images and Divi overlays */
  }

  .yaki-gallery-slider .yaki-gallery-nav button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 22px;
    line-height: 44px;
    text-align: center;
    cursor: pointer;
    pointer-events: auto; /* clickable */
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
    z-index: 10000 !important;
  }

  .yaki-gallery-slider .yaki-gallery-nav .yaki-g-prev { left: 8px; }
  .yaki-gallery-slider .yaki-gallery-nav .yaki-g-next { right: 8px; }

  .yaki-gallery-slider .yaki-gallery-nav button[disabled] { opacity: 0.35; cursor: default; }
  .yaki-gallery-slider .yaki-gallery-nav button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

  /* Counter pill */
  .yaki-gallery-slider .yaki-gallery-counter {
    position: absolute;
    right: 10px;
    top: 10px;
    background: rgba(0,0,0,0.55);
    color: #fff;
    font-size: 12px;
    line-height: 1;
    padding: 6px 8px;
    border-radius: 999px;
    z-index: 2;
    pointer-events: none;
  }

  /* Hide any legacy below-controls if they exist */
  .yaki-gallery-controls { display: none !important; }
}
