/* AS 002089 v5 modern compatibility layer (Bootstrap 5 / Joomla 5.4-6.x). */
html { scroll-behavior: smooth; }
img { max-width: 100%; height: auto; }

/* Parameter-driven logo layout (1-12 Bootstrap columns). */
#logo .site-logo-link {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  max-width: 100%;
}

#logo .site-logo-image {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

#logo .site-logo-slogan {
  display: block;
}

@media (min-width: 768px) {
  #menu-row #logo {
    flex: 0 0 calc(100% * var(--as-logo-columns, 3) / 12);
    width: calc(100% * var(--as-logo-columns, 3) / 12);
    max-width: calc(100% * var(--as-logo-columns, 3) / 12);
  }
}
[hidden] { display: none !important; }

/* Preserve legacy selector hooks while Bootstrap 5 owns the actual grid. */
.row.row-fluid { --bs-gutter-x: 30px; display: flex; flex-wrap: wrap; }
.row.row-fluid > [class*="col-"] { float: none; min-height: 1px; }
.row-fluid:before, .row-fluid:after { display: none !important; }

/* Old helper names used by the design CSS. */
.pull-left { float: left !important; }
.pull-right { float: right !important; }
.btn-small, .btn-mini { --bs-btn-padding-y: .25rem; --bs-btn-padding-x: .5rem; --bs-btn-font-size: .875rem; }
.well { min-height: 20px; padding: 19px; margin-bottom: 20px; background: rgba(0,0,0,.025); border: 1px solid rgba(0,0,0,.12); border-radius: .375rem; }

/* Bootstrap 5 modal bridge for the original template look. */
.modal.loginPopup { position: fixed; inset: 0; width: auto; height: auto; margin: 0; background: transparent; border: 0; box-shadow: none; }
.modal.loginPopup .modal-dialog { max-width: 520px; }
.modal.loginPopup .modal-content { overflow: hidden; }
.modal.loginPopup .modal-header { position: relative; }
.modal.loginPopup .modalClose { margin-left: auto; }
html[dir="rtl"] .modal.loginPopup .modalClose { margin-left: 0; margin-right: auto; }

/* Modern reveal animation, replacing jQuery scroll effects. */
.js .row-wrapper, .js .page-featured .items-row { opacity: 0; transform: translateY(18px); transition: opacity .45s ease, transform .45s ease; }
.js .row-wrapper.as-visible, .js .page-featured .items-row.as-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
  .js .row-wrapper, .js .page-featured .items-row { opacity: 1; transform: none; }
}

/* Back to top. */
#back-top { opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .2s ease; }
#back-top.is-visible { opacity: 1; visibility: visible; pointer-events: auto; }
#back-top a { align-items: center; display: inline-flex; gap: .45rem; }
#back-top .back-top-label { font-size: .8rem; line-height: 1.1; }

/* Native gallery/filter implementation replacing MixItUp + Magnific Popup. */
.page-gallery .filters a, .page-gallery .sorting a, .page-gallery .layout-mode a,
.mod-newsflash-adv.portfolio .filter { cursor: pointer; }
#isotopeContainer.grid { display: flex; flex-wrap: wrap; }
#isotopeContainer.list { display: block; }
#isotopeContainer.list > .gallery-item { display: block; width: 100% !important; }
#isotopeContainer.grid > .gallery-item { display: inline-block; }
.gallery-item[hidden], .mix[hidden] { display: none !important; }

/* CSS-grid masonry replacement. */
.as-css-masonry { display: grid !important; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 30px; }
.as-css-masonry > .item { width: auto !important; margin: 0 !important; }

/* Native <dialog> image viewer. */
.as-lightbox { max-width: min(94vw, 1400px); max-height: 94vh; padding: 0; border: 0; border-radius: .4rem; background: #111; color: #fff; box-shadow: 0 20px 70px rgba(0,0,0,.55); }
.as-lightbox::backdrop { background: rgba(0,0,0,.82); }
.as-lightbox figure { margin: 0; display: grid; max-height: 94vh; }
.as-lightbox img { max-width: 92vw; max-height: 86vh; object-fit: contain; display: block; }
.as-lightbox figcaption { padding: .75rem 1rem; }
.as-lightbox-close { position: absolute; z-index: 2; top: .5rem; right: .5rem; width: 2.5rem; height: 2.5rem; border-radius: 50%; border: 0; background: rgba(0,0,0,.65); color: #fff; font-size: 1.75rem; line-height: 1; cursor: pointer; }

/* Forms from legacy overrides use these Bootstrap 2 names. */
.control-group { margin-bottom: 1rem; }
.controls input:not([type="checkbox"]):not([type="radio"]), .controls select, .controls textarea,
.inputbox { max-width: 100%; }

/* Desktop/mobile switch now uses a viewport override without UA sniffing. */
#to-desktop { display: none; }
@media (pointer: coarse), (max-width: 1199.98px) { #to-desktop { display: block; } }
#to-desktop .to_mobile { display: none; }
#to-desktop.desktop-active .to_desktop { display: none; }
#to-desktop.desktop-active .to_mobile { display: inline; }

/* Correct common old menu assumptions while preserving template selectors. */
.nav-collapse.collapse { visibility: visible; }
.dropdown-menu { z-index: 1050; }

@media (max-width: 767.98px) {
  .row.row-fluid > [class*="col-md-"] { width: 100%; }
  .pull-left, .pull-right { float: none !important; }
}


/* Native guided tour replacing the missing Intro.js dependency. */
.as-tour-overlay { position: fixed; inset: 0; z-index: 1090; background: rgba(0,0,0,.62); }
.as-tour-panel { position: fixed; z-index: 1100; left: 50%; bottom: 2rem; transform: translateX(-50%); width: min(92vw, 560px); padding: 1rem; border-radius: .5rem; background: #fff; color: #212529; box-shadow: 0 1rem 3rem rgba(0,0,0,.35); }
.as-tour-actions { display: flex; gap: .5rem; align-items: center; margin-top: 1rem; }
.as-tour-count { margin-right: auto; }
.as-tour-focus { position: relative; z-index: 1095 !important; outline: 4px solid rgba(255,255,255,.92); outline-offset: 4px; }


/* Native parallax and video-background replacements. */
.parallax[data-url] { background-position: 50% 50%; will-change: background-position; }
.video-container { position: relative; overflow: hidden; }
.video-container .as-background-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; }
.video-container .video-content { position: relative; z-index: 1; }

@media (min-width: 768px) {
  .row.row-fluid > .col-md-1.span1 { width: 8.33333333%; margin-left: 0; }
  .row.row-fluid > .col-md-2.span2 { width: 16.66666667%; margin-left: 0; }
  .row.row-fluid > .col-md-3.span3 { width: 25.00000000%; margin-left: 0; }
  .row.row-fluid > .col-md-4.span4 { width: 33.33333333%; margin-left: 0; }
  .row.row-fluid > .col-md-5.span5 { width: 41.66666667%; margin-left: 0; }
  .row.row-fluid > .col-md-6.span6 { width: 50.00000000%; margin-left: 0; }
  .row.row-fluid > .col-md-7.span7 { width: 58.33333333%; margin-left: 0; }
  .row.row-fluid > .col-md-8.span8 { width: 66.66666667%; margin-left: 0; }
  .row.row-fluid > .col-md-9.span9 { width: 75.00000000%; margin-left: 0; }
  .row.row-fluid > .col-md-10.span10 { width: 83.33333333%; margin-left: 0; }
  .row.row-fluid > .col-md-11.span11 { width: 91.66666667%; margin-left: 0; }
  .row.row-fluid > .col-md-12.span12 { width: 100.00000000%; margin-left: 0; }
 }
/* Native Joomla menu override: version-independent submenu controls. */
.mod-menu li.parent,
.mod-menu li.deeper {
  position: relative;
}

.mod-menu__toggle-sub {
  align-items: center;
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  display: inline-flex;
  justify-content: center;
  min-height: 2.25rem;
  min-width: 2.25rem;
  padding: .25rem;
}

.mod-menu__toggle-sub .icon-chevron-down {
  transition: transform .2s ease;
}

.mod-menu__toggle-sub[aria-expanded="true"] .icon-chevron-down {
  transform: rotate(180deg);
}

.mod-menu__sub[hidden] {
  display: none !important;
}

/* Theme palette bridge for Joomla 5/6 native mod_menu markup. */
.mod-menu > li.active > a,
.mod-menu > li.current > a,
.mod-menu > li > a:hover,
.mod-menu > li > .mod-menu__toggle-sub:hover {
  color: var(--as-accent, #1bbc9c);
}

.mod-menu__sub li.active > a,
.mod-menu__sub li.current > a,
.mod-menu__sub li > a:hover,
.mod-menu__sub li > .mod-menu__toggle-sub:hover {
  background-color: var(--as-accent, #1bbc9c);
  color: #fff;
}
