/*
 * Mobile navigation panel (the "offcanvas" menu used below the xl breakpoint).
 *
 * Everything is scoped to .tp-mnav, which assets/templates/section-offcanvas.php puts on the panel,
 * so the static landing pages (their own offcanvas markup, styled by main-2.css) are not affected.
 * The behaviour lives in assets/js/main.js, section "02. Mobile menu js" (the .tp-mnav branch).
 *
 * Logical properties (inline-start/end) are used so the panel also works right-to-left.
 */

/* ---- page behind the panel ---- */
html.tp-mnav-lock,
html.tp-mnav-lock body {
  overflow: hidden;
}
body:has(.offcanvas__area.tp-mnav.offcanvas-opened) .body-overlay.opened {
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

/* ---- the panel ---- */
.offcanvas__area.tp-mnav {
  width: min(88vw, 380px);
  height: 100vh;
  height: 100dvh;
  background: #fff;
  box-shadow: -14px 0 40px rgba(15, 18, 30, 0.18);
  transform: translateX(calc(100% + 40px));
  visibility: hidden; /* closed: keep the links out of the tab order and away from screen readers */
  transition: transform 0.35s cubic-bezier(0.22, 0.8, 0.3, 1), visibility 0s linear 0.35s;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.offcanvas__area.tp-mnav.offcanvas-opened {
  transform: translateX(0);
  visibility: visible;
  transition: transform 0.35s cubic-bezier(0.22, 0.8, 0.3, 1), visibility 0s;
}
.tp-mnav .offcanvas__wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: 18px 20px 0;
}
.tp-mnav .offcanvas__content {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
}
.tp-mnav .offcanvas__top {
  margin-bottom: 14px !important;
  padding-inline-end: 52px; /* room for the close button */
}
.tp-mnav .offcanvas__logo img {
  display: block;
  width: 118px;
  height: auto;
}
.tp-mnav .offcanvas-main {
  flex: 1 1 auto;
}

/* close button: a round, quiet control instead of a red square */
.tp-mnav .offcanvas__close {
  top: 14px;
  right: auto;
  left: auto;
  inset-inline-end: 16px;
}
.tp-mnav .offcanvas__close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  line-height: 1;
  border-radius: 50%;
  background: #f1f2f5;
  color: #1b1b1f;
  transition: background-color 0.2s, color 0.2s;
}
.tp-mnav .offcanvas__close-btn svg,
.tp-mnav .offcanvas__close-btn:hover svg {
  width: 14px;
  height: 14px;
  transform: none;
}
.tp-mnav .offcanvas__close-btn:active {
  background: var(--tp-theme-primary, #ab0c2f);
  color: #fff;
  opacity: 1;
}

/* ---- the list ---- */
.tp-mnav .tp-main-menu-mobile {
  display: block;
}
.tp-mnav .tp-main-menu-mobile .tp-main-menu-content {
  margin: 0;
}
.tp-mnav .tp-main-menu-mobile ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.tp-mnav .tp-main-menu-mobile li {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0;
}

/* top-level rows */
.tp-mnav .tp-main-menu-mobile .tp-main-menu-content > ul > li > a {
  display: flex;
  align-items: center;
  min-height: 56px;
  padding-block: 0;
  padding-inline: 4px 56px;
  font-size: 17px;
  font-weight: 500;
  line-height: 1.3;
  color: #1b1b1f;
  border-bottom: 1px solid #eceef2;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.tp-mnav .tp-main-menu-mobile .tp-main-menu-content > ul > li:not(.has-dropdown) > a {
  padding-inline-end: 4px;
}

/* the expand button: a real button next to the link (not inside it), 56x56 touch target */
.tp-mnav .tp-mnav-toggle {
  position: absolute;
  top: 0;
  inset-inline-end: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: #1b1b1f;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.tp-mnav .tp-mnav-toggle::before {
  content: "";
  width: 9px;
  height: 9px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform 0.25s ease;
}
.tp-mnav li.is-open > .tp-mnav-toggle::before {
  transform: translateY(2px) rotate(-135deg);
}
.tp-mnav li.is-open > .tp-mnav-toggle,
.tp-mnav li.is-open > a,
.tp-mnav .tp-main-menu-mobile .is-current {
  color: var(--tp-theme-primary, #ab0c2f);
}
.tp-mnav .tp-main-menu-mobile .tp-main-menu-content > ul > li.is-open > a {
  border-bottom-color: transparent;
}

/* ---- sub menus and the Services mega menu: reset the desktop dropdown styling ---- */
.tp-mnav .tp-main-menu-mobile .tp-submenu,
.tp-mnav .tp-main-menu-mobile .tp-megamenu-main {
  display: none; /* opened by slideToggle() */
  position: static;
  top: auto;
  left: auto;
  right: auto;
  width: auto;
  min-width: 0;
  margin: 0 0 14px 6px;
  margin-inline: 6px 0;
  padding: 2px 0 2px 14px;
  padding-inline: 14px 0;
  border: 0;
  border-inline-start: 2px solid rgba(171, 12, 47, 0.22);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: none;
  overflow: visible;
}
.tp-mnav .tp-main-menu-mobile .tp-submenu li a,
.tp-mnav .tp-main-menu-mobile .tp-megamenu-fullwidth-list ul li a {
  display: block;
  padding: 11px 4px;
  padding-inline: 0 4px;
  font-size: 15.5px;
  font-weight: 400;
  line-height: 1.35;
  color: #4b4e57;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.tp-mnav .tp-main-menu-mobile .tp-submenu li a::before,
.tp-mnav .tp-main-menu-mobile .tp-megamenu-fullwidth-list ul li a::before {
  display: none;
}
.tp-mnav .tp-main-menu-mobile .tp-submenu li:not(:last-child),
.tp-mnav .tp-main-menu-mobile .tp-megamenu-fullwidth-list ul li:not(:last-child) {
  margin: 0;
}

/* Services mega menu: flatten the desktop grid into labelled groups */
.tp-mnav .tp-main-menu-mobile .tp-megamenu-main .row {
  display: block;
  margin: 0;
}
.tp-mnav .tp-main-menu-mobile .tp-megamenu-main .row > * {
  width: 100%;
  max-width: 100%;
  padding: 0;
}
.tp-mnav .tp-main-menu-mobile .tp-megamenu-fullwidth-list-wrapper {
  padding: 0;
}
.tp-mnav .tp-main-menu-mobile .tp-megamenu-fullwidth-list {
  margin: 0 0 10px;
}
.tp-mnav .tp-main-menu-mobile .tp-megamenu-fullwidth-title {
  margin: 12px 0 2px;
  padding: 0;
  border: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8a8d97;
}
.tp-mnav .tp-main-menu-mobile .tp-megamenu-fullwidth-title a {
  color: inherit;
  text-decoration: none;
}
.tp-mnav .tp-main-menu-mobile .tp-megamenu-fullwidth-list-wrap .row > * + * ul {
  margin-top: 0;
}

/* the current page */
.tp-mnav .tp-main-menu-mobile a.is-current {
  font-weight: 600;
}

/* ---- footer: Apply now + quick contact, pinned to the bottom of the panel ---- */
.tp-mnav-foot {
  position: sticky;
  bottom: 0;
  z-index: 3;
  margin: 18px -20px 0;
  padding: 14px 20px calc(16px + env(safe-area-inset-bottom, 0px));
  background: #fff;
  box-shadow: 0 -10px 18px -10px rgba(15, 18, 30, 0.12);
}
.tp-mnav-apply {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  border-radius: 10px;
  background: var(--tp-theme-primary, #ab0c2f);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.tp-mnav-apply::after {
  content: "";
  width: 8px;
  height: 8px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  transform: rotate(45deg); /* points right */
}
[dir="rtl"] .tp-mnav-apply::after {
  transform: rotate(-135deg); /* points left */
}
.tp-mnav-apply:active {
  filter: brightness(0.9);
}
.tp-mnav-quick {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}
.tp-mnav-quick a {
  display: flex;
  flex: 1 1 0;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid #dfe2e8;
  border-radius: 10px;
  color: #1b1b1f;
  font-size: 14.5px;
  font-weight: 500;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.tp-mnav-quick a:active {
  background: #f1f2f5;
}

/* ---- keyboard focus ---- */
.tp-mnav a:focus-visible,
.tp-mnav button:focus-visible {
  outline: 2px solid var(--tp-theme-primary, #ab0c2f);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---- hover only where there is a real pointer (touch screens keep :hover after a tap) ---- */
@media (hover: hover) {
  .tp-mnav .tp-main-menu-mobile a:hover,
  .tp-mnav .tp-mnav-toggle:hover {
    color: var(--tp-theme-primary, #ab0c2f);
  }
  .tp-mnav .offcanvas__close-btn:hover {
    background: var(--tp-theme-primary, #ab0c2f);
    color: #fff;
    opacity: 1;
  }
  .tp-mnav-apply:hover {
    color: #fff;
    filter: brightness(0.92);
  }
  .tp-mnav-quick a:hover {
    background: #f1f2f5;
    color: #1b1b1f;
  }
}

@media (prefers-reduced-motion: reduce) {
  .offcanvas__area.tp-mnav,
  .offcanvas__area.tp-mnav.offcanvas-opened,
  .tp-mnav .tp-mnav-toggle::before {
    transition: none;
  }
}
