/* ==========================================================================
   Direct Homes – Mobile menu drawer (includes/header.php, #dhMenu)
   Same class names and behaviour as the Bootstrap 5 Offcanvas
   (.offcanvas, .offcanvas-end, .show, .offcanvas-backdrop). The site runs
   Bootstrap 4.5, which has no Offcanvas, so the styles live here and the
   script in js/directhomes-offcanvas.js.
   The drawer slides in OVER the page from the right; the page does not move.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Offcanvas base (Bootstrap 5 behaviour)
   -------------------------------------------------------------------------- */
.offcanvas {
  position: fixed;
  top: 0;
  bottom: 0;
  z-index: 100100;
  display: flex;
  flex-direction: column;
  max-width: 100%;
  visibility: hidden;
  background-clip: padding-box;
  outline: 0;
  transition: transform 0.5s cubic-bezier(0.22, 0.75, 0.2, 1), visibility 0.5s;
}

.offcanvas-end {
  right: 0;
  width: min(400px, 88vw);
  transform: translateX(100%);
}

.offcanvas.show {
  visibility: visible;
  transform: none;
}

.offcanvas-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100090;
  background: rgba(10, 30, 24, 0.45);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.offcanvas-backdrop.show {
  opacity: 1;
}

/* page stays where it is, it only stops scrolling */
body.dh-offcanvas-open {
  overflow: hidden;
}

.mm-menu,
.mmenu-init {
  display: none !important;
}

/* --------------------------------------------------------------------------
   2. Directhomes look
   -------------------------------------------------------------------------- */
.dh-offcanvas {
  background: var(--dh-bg, #F6F4EE);
  border-left: 1px solid var(--dh-sand, #E9DFCE);
  box-shadow: -30px 0 60px rgba(var(--dh-primary-rgb), 0.18);
  font-family: var(--dh-font-body);
}

.dh-offcanvas .offcanvas-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--dh-sand);
}

.dh-offcanvas__logo {
  display: block;
  min-width: 0;
}

.dh-offcanvas__logo img {
  display: block;
  width: auto;
  max-width: 100%;
  height: 30px;
  object-fit: contain;
}

.dh-offcanvas__close {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--dh-sand);
  border-radius: 50%;
  background: #fff;
  color: var(--dh-primary);
  cursor: pointer;
  transition: background-color 0.3s ease, color 0.3s ease, transform 0.4s ease;
}

.dh-offcanvas__close:hover,
.dh-offcanvas__close:focus-visible {
  background: var(--dh-primary);
  color: #fff;
  transform: rotate(90deg);
}

.dh-offcanvas .offcanvas-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  padding: 26px 22px 28px;
  overflow-y: auto;
}

/* links */
.dh-offcanvas__nav ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.dh-offcanvas__nav li + li {
  margin-top: 6px;
}

.dh-offcanvas__nav a {
  position: relative;
  display: flex;
  align-items: center;
  padding: 10px 4px;
  font-family: var(--dh-font-heading);
  font-size: 24px;
  line-height: 1.2;
  color: var(--dh-primary);
  text-decoration: none;
  transition: color 0.3s ease, padding-left 0.35s ease;
}

.dh-offcanvas__nav a:hover,
.dh-offcanvas__nav a:focus-visible {
  padding-left: 10px;
  color: var(--dh-accent);
  text-decoration: none;
}

/* current page: gold text with a short gold bar */
.dh-offcanvas__nav li.is-active a {
  padding-left: 16px;
  color: var(--dh-accent);
}

.dh-offcanvas__nav li.is-active a::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  width: 4px;
  height: 22px;
  border-radius: 4px;
  background: var(--dh-accent);
  transform: translateY(-50%);
}

/* links slide in one after the other when the drawer opens */
.dh-offcanvas__nav li,
.dh-offcanvas__foot {
  opacity: 0;
  transform: translateX(24px);
  transition: opacity 0.45s ease, transform 0.5s cubic-bezier(0.22, 0.75, 0.2, 1);
}

.dh-offcanvas.show .dh-offcanvas__nav li,
.dh-offcanvas.show .dh-offcanvas__foot {
  opacity: 1;
  transform: none;
}

.dh-offcanvas.show .dh-offcanvas__nav li {
  transition-delay: calc(0.08s + var(--i, 0) * 0.05s);
}

.dh-offcanvas.show .dh-offcanvas__foot {
  transition-delay: 0.45s;
}

/* divider, then the Login button */
.dh-offcanvas__foot {
  margin-top: 26px;
  padding-top: 26px;
  border-top: 1px solid var(--dh-sand);
}

.dh-offcanvas .dh-offcanvas__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 52px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
}

/* the drawer is for small screens only */
@media (min-width: 992px) {
  .dh-offcanvas,
  .offcanvas-backdrop {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .offcanvas,
  .offcanvas-backdrop,
  .dh-offcanvas__nav li,
  .dh-offcanvas__foot {
    transition: none;
  }
}

/* --------------------------------------------------------------------------
   3. Hamburger button in the header
   -------------------------------------------------------------------------- */
.dh-menu-trigger {
  display: none;
  position: relative;
}

.dh-menu-trigger .hamburger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid var(--dh-sand);
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  margin: 0 !important;
  top: 0 !important;
  right: auto !important;
  left: auto !important;
  transform: none !important;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.dh-menu-trigger .hamburger:hover,
.dh-menu-trigger .hamburger:focus-visible {
  border-color: var(--dh-primary);
}

.dh-menu-trigger .hamburger-box {
  width: 20px;
  height: 14px;
}

.dh-menu-trigger .hamburger-inner,
.dh-menu-trigger .hamburger-inner::before,
.dh-menu-trigger .hamburger-inner::after {
  width: 20px;
  height: 2px;
  border-radius: 2px;
  background-color: var(--dh-primary) !important;
}

@media (max-width: 991px) {
  #header .dh-header .dh-menu-trigger {
    display: inline-flex !important;
    margin: 0;
  }
}

/* three thin lines, 6px apart */
.dh-menu-trigger .hamburger-box {
  position: relative;
  display: inline-block;
}

.dh-menu-trigger .hamburger--collapse .hamburger-inner {
  top: auto;
  bottom: 0;
  margin-top: 0;
}

.dh-menu-trigger .hamburger--collapse .hamburger-inner::before {
  top: -6px;
}

.dh-menu-trigger .hamburger--collapse .hamburger-inner::after {
  top: -12px;
  bottom: auto;
}

/* --------------------------------------------------------------------------
   4. Below 992px: header shows only search + menu button; language and Login
      live in the drawer
   -------------------------------------------------------------------------- */
@media (max-width: 991px) {
  #header .dh-header .dh-header__cta {
    display: none !important;
  }
}

/* language: in the header from 600px, in the drawer below 600px */
@media (max-width: 599px) {
  #header .dh-header .dh-lang {
    display: none !important;
  }
}

@media (min-width: 600px) {
  .dh-offcanvas .dh-offcanvas__lang {
    display: none;
  }
}

/* logo scales with the screen (small enough for 320px) */
.dh-offcanvas__logo img {
  height: clamp(22px, 6.5vw, 30px);
}

/* close button never shrinks */
.dh-offcanvas .dh-offcanvas__close {
  flex: 0 0 44px;
  min-width: 44px;
}

/* language buttons */
.dh-offcanvas__lang {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}

.dh-offcanvas__lang a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 14px;
  border: 1px solid var(--dh-sand);
  border-radius: var(--dh-btn-radius, 6px);
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  color: var(--dh-primary);
  text-decoration: none;
  transition: border-color 0.3s ease, background-color 0.3s ease, color 0.3s ease;
}

.dh-offcanvas__lang a:hover {
  border-color: var(--dh-accent);
  color: var(--dh-primary);
  text-decoration: none;
}

.dh-offcanvas__lang a.is-current {
  border-color: var(--dh-primary);
  background: var(--dh-primary);
  color: #fff;
}

.dh-offcanvas__lang .dh-flag svg {
  display: block;
  border-radius: 2px;
}

/* Login: full width on phones, compact and left aligned from 600px */
@media (min-width: 600px) {
  .dh-offcanvas .dh-offcanvas__btn {
    display: inline-flex;
    width: auto;
    min-width: 160px;
    padding: 0 32px;
  }
}

@media (max-width: 380px) {
  .dh-offcanvas .offcanvas-header {
    padding: 16px 16px;
  }

  .dh-offcanvas .offcanvas-body {
    padding: 20px 16px 24px;
  }
}
