/* SECTION Objekti Grid */
/* #region OBJEKTI - grid */

.objekti {
  position: relative;
  background: var(--color-primary);
  padding: 2rem 0;
}

/* MAIN GRID (Desktop & Tablet) */
.grid-objekti {
  margin: auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(19rem, 20%));
  grid-template-rows:
    minmax(22.5rem, 37.5vh) minmax(5rem, 6rem) minmax(22.5rem, 37.5vh);
  justify-content: center;
  align-items: center;
  gap: 1rem;
}

@media screen and (min-width: 1921px) {
  .grid-objekti {
    grid-template-columns: repeat(4, minmax(19rem, 15%));
  }
}

@media screen and (min-width: 768px) and (max-width: 1279px) {
  .grid-objekti {
    grid-template-columns: repeat(2, minmax(19rem, 24rem));
    grid-template-rows: auto;
  }
}

/* Heading in grid */
.grid-objekti > h2 {
  grid-column: 1 / -1;
  text-align: center;
}

@media screen and (min-width: 1280px) {
  .grid-objekti > h2 {
    grid-row: 2;
  }
}

@media screen and (min-width: 768px) and (max-width: 1279px) {
  .grid-objekti > h2 {
    grid-row: 1;
    margin-top: 20px;
  }
}

/* Desktop & tablet: carousel track unwraps seamlessly into parent grid */
.objekti-carousel-track {
  display: contents;
}

/* Carousel controls hidden on desktop & tablet (>= 768px) */
.objekti-carousel-controls {
  display: none;
}

/* ------------------------------------------------- */
/* SMARTPHONE CAROUSEL (< 768px) */
/* ------------------------------------------------- */
@media screen and (max-width: 767px) {
  .objekti {
    padding: 2rem 0 2.5rem;
    overflow: hidden;
  }

  /* Dismantle CSS grid into vertical flex container */
  .grid-objekti {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 100vw;
    gap: 0;
    margin: 0 auto;
    padding: 0;
  }

  .grid-objekti > h2 {
    width: 100%;
    padding: 0 1.25rem;
    margin: 0.5rem 0 1.5rem;
    font-size: var(--font-size-text-lg);
    line-height: 1.35;
    text-align: center;
  }

  /* Carousel track with horizontal scroll-snap */
  .objekti-carousel-track {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    gap: 1.25rem;
    padding: 0.5rem 1.5rem 1.25rem;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .objekti-carousel-track::-webkit-scrollbar {
    display: none;
  }

  /* Mobile card styling */
  .objekti-carousel-track .objekti-card {
    flex: 0 0 82vw;
    max-width: 320px;
    min-width: 250px;
    scroll-snap-align: center;
    scroll-snap-stop: normal;
    border-radius: 12px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
  }

  /* Mobile navigation controls */
  .objekti-carousel-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    margin-top: 0.75rem;
    width: 100%;
    padding: 0 1rem;
    user-select: none;
  }

  .objekti-carousel-btn {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.16);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #ffffff;
    font-size: 1.1rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
  }

  .objekti-carousel-btn:hover,
  .objekti-carousel-btn:focus-visible {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.7);
    transform: scale(1.06);
    outline: none;
  }

  .objekti-carousel-btn:active {
    transform: scale(0.94);
  }

  .objekti-carousel-dots {
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }

  .objekti-dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.35);
    border: none;
    padding: 0;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-tap-highlight-color: transparent;
  }

  .objekti-dot:focus-visible {
    outline: 2px solid white;
    outline-offset: 2px;
  }

  .objekti-dot.is-active {
    width: 26px;
    background: var(--color-accent);
    box-shadow: 0 0 10px rgba(196, 160, 106, 0.7);
  }
}

/* WHOLE CARD WRAPPER */
/* contains clickable image area + non-clickable info area */
.objekti-card {
  height: 100%;
  display: grid;
  grid-template-rows: 230px 1fr;
  overflow: hidden;
  background: white;
  border: 2px solid white;
}

/* CLICKABLE IMAGE AREA */
.objekti-cell {
  cursor: pointer;
  position: relative;
  text-align: center;
  height: 100%;
  overflow: hidden;
}

/* DISABLED CARD CURSOR */
.objekti-cell.objekti-cell--disabled {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cline x1='5' y1='5' x2='19' y2='19' stroke='%23ff0000' stroke-width='3' stroke-linecap='round'/%3E%3Cline x1='19' y1='5' x2='5' y2='19' stroke='%23ff0000' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E") 12 12, not-allowed;
}

/* CELL IMAGES */
.objekti-cell::before {
  position: absolute;
  z-index: 1;
  content: "";
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  opacity: 1;
  transition: opacity 1s;
}

.objekti-cell:hover::before {
  opacity: 0;
}

.objekti-cell.objekti-cell--disabled:hover::before {
  opacity: 1;
}

.objekti-cell::after {
  position: absolute;
  content: "";
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  opacity: 1;
}

/* CELL HEADING */
.objekti-cell h3 {
  position: relative;
  z-index: 2;
  height: 100%;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: ease-in 1s;
  padding: 0 0.625rem;
  color: white;
  font-size: var(--font-size-cell-heading);
  line-height: 1.2;
  font-weight: 500;
  text-shadow: 2px 2px 2px #000000;
}

.objekti-cell h3:hover {
  transition: ease-in 0.5s;
  opacity: 0;
}

.objekti-cell.objekti-cell--disabled h3:hover {
  opacity: 1;
}

/* keyboard focus only on clickable image cards */
.objekti-cell[role="button"] h3 {
  pointer-events: none;
}

.objekti-cell[role="button"]:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.85);
  outline-offset: 0.25rem;
}

/* #endregion grid */
/* *!SECTION */

/* ---------------------------------------------- */
/* CELL INFO */
/* ---------------------------------------------- */
.objekti-cell__info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 10px;
  line-height: 1.2;
}

/* ---------------------------------------------- */
/* LOCATION */
/* ---------------------------------------------- */
.location {
  text-align: center;
  border-left: 1px solid grey;
  padding-left: 10px;
}

/* icon */
.objekti-cell__info .fa-location-dot {
  color: rgb(78, 75, 99);
  font-size: 2rem;

}

/* ---------------------------------------------- */

/* SECTION Objekti - backgrounds */
/* #region OBJEKTI - backgrounds */

.o-1::before {
  background: url(/img/objekti-glavna_zgrada-before.jpg ) no-repeat 10%/cover;
}

.o-1::after {
  background: url(/img/objekti-glavna_zgrada-after.jpg) no-repeat 70%/cover;
}

.o-2::before {
  background: url(/img/objekti-lapidarijum-before.jpg) no-repeat 100%/cover;
}

.o-2::after {
  background: url(/img/objekti-lapidarijum_after.jpg) no-repeat 30%/cover;
}

.o-3::before {
  background: url(/img/objekti-legat-before.jpg) no-repeat left/cover;
}

.o-3::after {
  background: url(/img/objekti-legat_enterijer-after.jpg) no-repeat center/cover;
}

.o-4::before {
  background: url(/img/objekti-sator-before.jpg) no-repeat center/cover;
}

.o-4::after {
  background: url(/img/objekti-sator-after.jpg) no-repeat center/cover;
}

.o-5::before {
  background: url(/img/objekti-tulba_before.jpg) no-repeat center/cover;
}

.o-5::after {
  background: url(/img/objekti-tulba_after.jpg) no-repeat 0%/cover;
}

.o-6::before {
  background: url(/img/objekti-gnmp-before.jpg) no-repeat center/cover;
}

.o-6::after {
  background: url(/img/objekti-gnmp-after.jpg) no-repeat center/cover;
}

.o-7::before {
  background: url(/img/mki-ex.webp) no-repeat center/cover;
}

.o-7::after {
  background: url(/img/objekti-mki_after.jpg) no-repeat center/cover;
}

.o-8::before {
  background: url(/img/objekti-kuca_dobrnjcevih-before.jpg) no-repeat center/cover;
}

.o-8::after {
  background: url(/img/objekti-kuca_dobrnjcevih-before.jpg) no-repeat 35%/cover;
}

/* #endregion backgrounds */
/* *!SECTION */

/* SECTION Objekti - modal */
/* #region OBJEKTI - modal */
.objekti-modal {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(10, 14, 18, 0.72);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.objekti-modal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.objekti-modal__backdrop {
  position: absolute;
  inset: 0;
  cursor: pointer;
}

.objekti-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(1200px, calc(100vw - 2rem));
  height: min(90dvh, 780px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 1.375rem;
  background: linear-gradient(180deg, rgba(18, 26, 31, 0.98), rgba(30, 30, 30, 0.98));
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.objekti-modal__close {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  z-index: 2;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: white;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.objekti-modal__close:hover {
  background: rgba(255, 255, 255, 0.16);
  transform: scale(1.04);
}

.objekti-modal__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 3.5rem 2rem 2rem;
  color: white;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  position: relative;
  z-index: 1;
}

.objekti-modal__eyebrow {
  font-family: var(--font-family-menu-buttons);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: var(--font-size-text-sm);
  color: rgba(255, 255, 255, 0.72);
  margin-bottom: 0.65rem;
  position: relative;
  z-index: 1;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 1s ease 1s, transform 1s ease 1s;
}

.objekti-modal__body h2 {
  font-family: var(--font-family-heading);
  font-size: clamp(2rem, 3vw, 3.5rem);
  line-height: 1.1;
  margin-bottom: 0.75rem;
  position: relative;
  z-index: 1;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 1s ease 1s, transform 1s ease 1s;
}

.objekti-modal.is-open .objekti-modal__eyebrow,
.objekti-modal.is-open .objekti-modal__body h2 {
  opacity: 1;
  transform: translateY(0);
}

.objekti-modal__status {
  font-size: var(--font-size-base-desktop);
  color: #d7c39a;
  margin-bottom: 1.5rem;
}

.objekti-modal__content {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1rem;
  align-items: start;
  justify-items: center;
  font-family: var(--font-family-body);
  font-size: var(--font-size-base-desktop);
  line-height: 1.7;
  position: relative;
  z-index: 1;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 1s ease 1.5s, transform 1s ease 1.5s;
}

.objekti-modal.is-open .objekti-modal__content {
  opacity: 1;
  transform: translateY(0);
}

.objekti-modal__content p {
  max-width: 50ch;
  color: #ffffff;
  /* Text shadow in 4 directions to create a solid border */
  text-shadow:
    -1px -1px 0 #000,
    1px -1px 0 #000,
    -1px 1px 0 #000,
    1px 1px 0 #000;
}

.objekti-modal__content li {
  list-style: disc;
}

body.modal-open {
  overflow: hidden;
}

.objekti-modal__close:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.9);
  outline-offset: 0.1875rem;
}

.objekti-modal p {
  line-height: normal;
}

/* SECTION Modal - backgrounds */

/* GLAVNA ZGRADA modal background */
.objekti-modal__body--o-1 {
  background:
    url(/img/gz_modal_background.webp) no-repeat bottom right/cover;
}

/* LAPIDARIJUM modal background */
.objekti-modal__body--o-2 {
  background: url(/img/lapidarijum_modal_bgd.jpg) no-repeat center/cover;
}

/* LEGAT modal background */
.objekti-modal__body--o-3 {
  background: url(/img/spomen_zbirka_modal_bgd.jpg) no-repeat center/cover;
}

.objekti-modal__body--o-4 {
  background: url("/img/sator_modal_bgd.jpg") no-repeat center/cover;
}

.objekti-modal__body--o-5 {
  background: url("/img/tulba_modal_bgd.jpg") no-repeat center/cover;
}

.objekti-modal__body--o-6 {
  background: url("/img/gnmp_modal_bgd.jpg") no-repeat center/cover;
}

.objekti-modal__body--o-7 {
  background: url("/img/mki_modal_bgd.jpg") no-repeat center/cover;
}

/**TODO -   OVERLAY for every modal */
.objekti-modal__body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6));
  pointer-events: none;
  opacity: 0;
  transition: opacity 1s ease 1s;
}

.objekti-modal.is-open .objekti-modal__body::after {
  opacity: 1;
}

/* .objekti-modal__content and its is-open state are defined once,
above, near .objekti-modal__status — was previously duplicated here */

.objekti-modal figure {
  text-align: center;
}

.objekti-modal figure img {
  margin: 0 auto;
  border: 1px solid white;
}

/* Modal gallery (desktop & tablet >= 768px) */
.objekti-modal__gallery {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  width: 100%;
}

.objekti-modal__gallery-item {
  margin: 0;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.objekti-modal__gallery-item img {
  display: block;
  max-width: 100%;
  width: auto;
  height: auto;
  max-height: 380px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
}

.objekti-modal__gallery-item figcaption {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: #ffffff;
  text-align: center;
  text-shadow:
    -1px -1px 0 #000,
    1px -1px 0 #000,
    -1px 1px 0 #000,
    1px 1px 0 #000;
}

.objekti-modal__gallery-dots {
  display: none;
}

/* If modal content has no gallery (e.g. text-only modals) */
.objekti-modal__content:not(:has(.objekti-modal__gallery)) {
  grid-template-columns: 1fr;
}

/* ------------------------------------------------- */
/* SMARTPHONE MODAL (< 768px): DISMANTLE GRID & CAROUSEL */
/* ------------------------------------------------- */
@media screen and (max-width: 767px) {
  .objekti-modal__dialog {
    width: calc(100vw - 1.25rem);
    height: min(92dvh, 740px);
    border-radius: 1.125rem;
  }

  .objekti-modal__body {
    padding: 3rem 1.15rem 1.5rem;
  }

  .objekti-modal__body h2 {
    font-size: clamp(1.6rem, 5.5vw, 2.2rem);
    margin-bottom: 0.5rem;
  }

  /* Dismantle 2-column grid into vertical flex column */
  .objekti-modal__content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    font-size: var(--font-size-base-mobile, 0.95rem);
    line-height: 1.6;
  }

  .objekti-modal__content p {
    max-width: 100%;
  }

  /* Simple image gallery carousel on the bottom */
  .objekti-modal__gallery {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 1rem;
    width: calc(100% + 1rem);
    margin: 0.5rem -0.5rem 0;
    padding: 0.5rem 0.5rem 0.75rem;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y pinch-zoom;
    scrollbar-width: thin;
    scrollbar-color: var(--color-accent, #c4a06a) rgba(255, 255, 255, 0.15);
  }

  .objekti-modal__gallery::-webkit-scrollbar {
    height: 4px;
  }

  .objekti-modal__gallery::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
  }

  .objekti-modal__gallery::-webkit-scrollbar-thumb {
    background: var(--color-accent, #c4a06a);
    border-radius: 4px;
  }

  .objekti-modal__gallery-item {
    flex: 0 0 82%;
    max-width: 320px;
    scroll-snap-align: center;
    scroll-snap-stop: normal;
  }

  .objekti-modal__gallery-item:only-child {
    flex: 0 0 100%;
    max-width: 100%;
  }

  .objekti-modal__gallery-item img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.45);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
  }

  .objekti-modal__gallery-item figcaption {
    margin-top: 0.4rem;
    font-size: 0.8rem;
    line-height: 1.3;
  }

  /* Carousel pagination dots on mobile */
  .objekti-modal__gallery-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin: 0.25rem 0 0.5rem;
  }

  .objekti-modal__gallery-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.35);
    border: none;
    padding: 0;
    cursor: pointer;
    transition: all 0.25s ease;
    -webkit-tap-highlight-color: transparent;
  }

  .objekti-modal__gallery-dot:focus-visible {
    outline: 2px solid white;
    outline-offset: 2px;
  }

  .objekti-modal__gallery-dot.is-active {
    width: 24px;
    background: var(--color-accent, #c4a06a);
    box-shadow: 0 0 8px rgba(196, 160, 106, 0.7);
  }
}

/* !SECTION Modal - backgrounds */

/* #endregion OBJEKTI - modal */
/* !SECTION */