/* GK Aparts — mobile containment and fullscreen gallery, 2026-09-21 */

/* Every custom GK page uses the same HTML element id inside a Tilda Zero Block.
   On narrow screens Tilda renders that element as a table, so its min-content
   width can grow to several thousand pixels. Force a normal viewport-sized box. */
@media screen and (max-width: 640px) {
  .t396__elem[data-elem-id="1789750059941"][data-elem-type="html"] {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    left: 0 !important;
    right: auto !important;
  }

  .t396__elem[data-elem-id="1789750059941"][data-elem-type="html"] > .tn-atom__html {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  .gk-page,
  .obj {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }

  .gk-page *,
  .obj * {
    min-width: 0;
  }

  .gk-wrap,
  .obj-wrap {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 18px !important;
    padding-right: 18px !important;
  }

  .gk-grid,
  .gk-featuregrid,
  .gk-split,
  .gk-reviewgrid,
  .gk-ownergrid,
  .gk-process,
  .gk-platforms,
  .gk-maplayout,
  .gk-maplist,
  .gk-mapbox,
  .obj-facts,
  .obj-gallery,
  .obj-showcase,
  .obj-moregrid,
  .obj-split,
  .obj-amen,
  .obj-map,
  .obj-mapcopy,
  .obj-mapcanvas,
  .obj-rules,
  .obj-review,
  .obj-cta {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  .gk-card,
  .gk-cardbody,
  .gk-feature,
  .gk-ownercard,
  .gk-platform,
  .gk-mapitem,
  .obj-fact,
  .obj-amen article,
  .obj-rule {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  .gk-page h1,
  .gk-page h2,
  .gk-page h3,
  .gk-page p,
  .gk-page li,
  .gk-page a,
  .obj h1,
  .obj h2,
  .obj h3,
  .obj p,
  .obj li,
  .obj a {
    max-width: 100% !important;
    overflow-wrap: anywhere !important;
  }

  .obj-title,
  .gk-title {
    font-size: clamp(32px, 10.2vw, 42px) !important;
  }

  .gk-card img {
    width: 100% !important;
    height: clamp(185px, 56vw, 220px) !important;
    object-fit: cover !important;
    object-position: center center !important;
  }

  .obj-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .obj-showcase,
  .obj-moregrid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .obj-map,
  .obj-split,
  .obj-review {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  :where(.gk-page,.obj) .gk-mapbox,
  :where(.gk-page,.obj) #gk-allmap,
  :where(.gk-page,.obj) .obj-mapcanvas,
  :where(.gk-page,.obj) .leaflet-container {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  :where(.gk-page,.obj) .leaflet-popup {
    max-width: calc(100vw - 56px) !important;
  }

  :where(.gk-page,.obj) .leaflet-popup-content-wrapper,
  :where(.gk-page,.obj) .leaflet-popup-content {
    width: auto !important;
    max-width: calc(100vw - 76px) !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  :where(.gk-page,.obj) .leaflet-popup-content img {
    width: 100% !important;
    max-width: 100% !important;
    height: 120px !important;
    object-fit: cover !important;
  }

  .obj-back {
    max-width: calc(100vw - 24px) !important;
  }
}

/* GK Aparts — fullscreen object gallery */
.obj :is(.obj-gallery,.obj-showcase,.obj-moregrid) img {
    cursor: zoom-in;
  }

  .gk-lb,
  .gk-lb * {
    box-sizing: border-box;
  }

  .gk-lb[hidden] {
    display: none !important;
  }

  .gk-lb {
    position: fixed;
    z-index: 2147483646;
    inset: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    width: 100%;
    height: 100vh;
    height: 100dvh;
    padding:
      max(10px, env(safe-area-inset-top))
      max(12px, env(safe-area-inset-right))
      max(10px, env(safe-area-inset-bottom))
      max(12px, env(safe-area-inset-left));
    overflow: hidden;
    color: #fff;
    background: rgba(15, 19, 28, .97);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .18s ease, visibility .18s ease;
    overscroll-behavior: contain;
  }

  .gk-lb.is-open {
    opacity: 1;
    visibility: visible;
  }

  .gk-lb__top {
    position: relative;
    z-index: 3;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 2px 8px;
  }

  .gk-lb__counter {
    padding-left: 8px;
    color: rgba(255, 255, 255, .78);
    font: 600 13px/1 Arial, sans-serif;
    letter-spacing: .13em;
    font-variant-numeric: tabular-nums;
  }

  .gk-lb__button {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .25);
    border-radius: 50%;
    color: #fff;
    background: rgba(23, 29, 42, .76);
    box-shadow: 0 8px 28px rgba(0, 0, 0, .18);
    font: 300 34px/1 Arial, sans-serif;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background .18s ease, border-color .18s ease, transform .18s ease;
  }

  .gk-lb__button:hover {
    border-color: #F7C609;
    background: #4E5D7C;
  }

  .gk-lb__button:focus-visible {
    border-color: #F7C609;
    background: #4E5D7C;
    outline: 2px solid #F7C609;
    outline-offset: 2px;
  }

  .gk-lb__button:active {
    transform: scale(.95);
  }

  .gk-lb__button:disabled {
    opacity: .25;
    cursor: default;
  }

  .gk-lb__close {
    font-size: 31px;
  }

  .gk-lb__prev,
  .gk-lb__next {
    position: absolute;
    z-index: 4;
    top: 50%;
    transform: translateY(-50%);
  }

  .gk-lb__prev:active,
  .gk-lb__next:active {
    transform: translateY(-50%) scale(.95);
  }

  .gk-lb__prev {
    left: max(14px, env(safe-area-inset-left));
  }

  .gk-lb__next {
    right: max(14px, env(safe-area-inset-right));
  }

  .gk-lb__stage {
    position: relative;
    z-index: 2;
    min-width: 0;
    min-height: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    place-items: center;
    gap: 10px;
    overflow: hidden;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
  }

  .gk-lb__image {
    position: relative;
    z-index: 1;
    min-width: 0;
    min-height: 0;
    width: auto;
    height: auto;
    max-width: calc(100vw - 156px);
    max-height: 100%;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 18px 64px rgba(0, 0, 0, .28);
    opacity: 1;
    transition: opacity .14s ease;
    -webkit-user-drag: none;
  }

  .gk-lb.is-loading .gk-lb__image {
    opacity: .18;
  }

  .gk-lb__spinner {
    position: absolute;
    z-index: 0;
    top: 50%;
    left: 50%;
    width: 36px;
    height: 36px;
    margin: -18px 0 0 -18px;
    border: 3px solid rgba(255, 255, 255, .22);
    border-top-color: #F7C609;
    border-radius: 50%;
    opacity: 0;
    animation: gk-lb-spin .8s linear infinite;
  }

  .gk-lb.is-loading .gk-lb__spinner {
    opacity: 1;
  }

  .gk-lb__caption {
    position: relative;
    z-index: 1;
    min-height: 20px;
    max-width: min(760px, calc(100vw - 40px));
    padding: 0 12px 2px;
    overflow: hidden;
    color: rgba(255, 255, 255, .82);
    font: 400 14px/1.35 Arial, sans-serif;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .gk-lb__caption:empty {
    display: none;
  }

  @keyframes gk-lb-spin {
    to { transform: rotate(360deg); }
  }

  @media (max-width: 640px) {
    .gk-lb {
      padding-left: max(8px, env(safe-area-inset-left));
      padding-right: max(8px, env(safe-area-inset-right));
    }

    .gk-lb__top {
      min-height: 46px;
    }

    .gk-lb__button {
      width: 44px;
      height: 44px;
      background: rgba(23, 29, 42, .86);
    }

    .gk-lb__prev {
      left: max(8px, env(safe-area-inset-left));
    }

    .gk-lb__next {
      right: max(8px, env(safe-area-inset-right));
    }

    .gk-lb__image {
      max-width: calc(100vw - 16px - env(safe-area-inset-left) - env(safe-area-inset-right));
      border-radius: 8px;
    }

    .gk-lb__caption {
      max-width: calc(100vw - 20px);
      font-size: 13px;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .gk-lb,
    .gk-lb__image,
    .gk-lb__button {
      transition: none;
    }

    .gk-lb__spinner {
      animation-duration: 1.5s;
    }
  }
