/* The7 homepage drawer. No rules apply until JS confirms the sidebar exists. */
#yds-hd-toggle,
#yds-hd-backdrop,
.yds-hd-subtoggle {
  display: none;
}

@media (min-width: 768px) {
  html.yds-hd-ready body.home {
    --yds-hd-width: min(330px, calc(100vw - 90px));
    --yds-hd-toggle-top: clamp(240px, 30vh, 360px);
    --yds-hd-panel-top: 0px;
  }

  /* Keep the WordPress admin bar accessible when the owner is signed in. */
  html.yds-hd-ready body.home.admin-bar {
    --yds-hd-panel-top: 32px;
  }

  /* Reclaim the width that The7 usually reserves for its right sidebar. */
  html.yds-hd-ready body.home #main.sidebar-right .wf-container-main {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-areas: "content" !important;
  }

  html.yds-hd-ready body.home #main.sidebar-right #content {
    width: 100% !important;
    min-width: 0;
    grid-column: 1 / -1;
  }

  html.yds-hd-ready body.home #main.sidebar-right #sidebar {
    position: fixed !important;
    display: block !important;
    top: var(--yds-hd-panel-top) !important;
    right: 0 !important;
    bottom: 0 !important;
    left: auto !important;
    box-sizing: border-box;
    width: var(--yds-hd-width) !important;
    max-width: calc(100vw - 90px) !important;
    height: calc(100vh - var(--yds-hd-panel-top)) !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 18px 15px 20px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    scrollbar-width: thin;
    scrollbar-color: #b7cbc3 transparent;
    overscroll-behavior: contain;
    background: #fbfaf6 !important;
    border: 1px solid #e2eae3;
    border-radius: 14px 0 0 14px;
    box-shadow: 0 14px 42px rgba(31, 58, 49, 0.16);
    z-index: 10051;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: none;
    transform: translate3d(calc(100% + 24px), 0, 0) !important;
    transition: transform 260ms ease !important;
    -webkit-overflow-scrolling: touch;
  }

  /* The7's sticky-sidebar script can otherwise move the panel's contents. */
  html.yds-hd-ready body.home #sidebar .sidebar-content {
    position: static !important;
    top: auto !important;
    transform: none !important;
    width: auto !important;
    height: auto !important;
    max-height: none !important;
  }

  html.yds-hd-open body.home #main.sidebar-right #sidebar {
    pointer-events: auto;
    transform: translate3d(0, 0, 0) !important;
  }

  html.yds-hd-ready body.home #yds-hd-toggle {
    position: fixed;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    top: var(--yds-hd-toggle-top);
    right: 0;
    left: auto;
    width: auto;
    min-width: 86px;
    min-height: 44px;
    box-sizing: border-box;
    padding: 10px 12px;
    margin: 0;
    color: #285b4d;
    background: #fbfaf6;
    border: 1px solid #e2eae3;
    border-radius: 14px 0 0 14px;
    box-shadow: 0 4px 18px rgba(31, 58, 49, 0.13);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
    letter-spacing: 0.01em;
    text-decoration: none;
    cursor: pointer;
    z-index: 10052;
    transition: right 260ms ease, color 150ms ease, background 150ms ease;
  }

  html.yds-hd-ready body.home #yds-hd-toggle:hover {
    color: #173e35;
    background: #eff5f0;
  }

  html.yds-hd-ready body.home #yds-hd-toggle:focus-visible,
  html.yds-hd-ready body.home #sidebar .yds-hd-subtoggle:focus-visible {
    outline: 3px solid #397a65;
    outline-offset: 3px;
  }

  html.yds-hd-ready body.home #yds-hd-toggle .yds-hd-toggle-icon {
    display: inline-block;
    min-width: 18px;
    font-size: 18px;
    line-height: 1;
    text-align: center;
  }

  html.yds-hd-open body.home #yds-hd-toggle {
    right: calc(var(--yds-hd-width) + 12px);
  }

  html.yds-hd-ready body.home #yds-hd-backdrop {
    position: fixed;
    display: block;
    inset: 0;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    background: rgba(22, 43, 34, 0.12);
    z-index: 10050;
    transition: opacity 260ms ease, visibility 260ms ease;
  }

  html.yds-hd-open body.home #yds-hd-backdrop {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  /* Explicit, independent arrow buttons: they work even if The7 JS is delayed. */
  html.yds-hd-ready body.home #sidebar .custom-nav li.has-children {
    position: relative;
  }

  html.yds-hd-ready body.home #sidebar .custom-nav li.has-children > a .arrow,
  html.yds-hd-ready body.home #sidebar .custom-nav li.has-children > a svg.arrow {
    display: none !important;
  }

  html.yds-hd-ready body.home #sidebar .custom-nav li.has-children > a {
    padding-right: 42px !important;
  }

  html.yds-hd-ready body.home #sidebar .custom-nav li.has-children > .yds-hd-subtoggle {
    position: absolute;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    top: 5px;
    right: 3px;
    width: 34px;
    height: 34px;
    padding: 0;
    margin: 0;
    color: #285b4d;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 9px;
    box-shadow: none;
    cursor: pointer;
    z-index: 2;
  }

  html.yds-hd-ready body.home #sidebar .custom-nav li.has-children > .yds-hd-subtoggle:hover {
    background: #eaf1ea;
    border-color: #e2eae3;
  }

  html.yds-hd-ready body.home #sidebar .custom-nav .yds-hd-chevron {
    display: block;
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
    transition: transform 160ms ease;
  }

  html.yds-hd-ready body.home #sidebar .custom-nav li.yds-hd-sub-open > .yds-hd-subtoggle .yds-hd-chevron {
    transform: rotate(225deg) translate(-1px, -1px);
  }

  html.yds-hd-ready body.home #sidebar .custom-nav li.has-children > ul.custom-menu {
    display: none !important;
    height: auto !important;
  }

  html.yds-hd-ready body.home #sidebar .custom-nav li.yds-hd-sub-open > ul.custom-menu {
    display: block !important;
    height: auto !important;
    opacity: 1 !important;
    visibility: visible !important;
  }

  html.yds-hd-ready body.home #sidebar .widget,
  html.yds-hd-ready body.home #sidebar .widget a,
  html.yds-hd-ready body.home #sidebar .yds-hd-subtoggle {
    font-size: max(14px, 1em);
  }
}

@media (min-width: 768px) and (prefers-reduced-motion: reduce) {
  html.yds-hd-ready body.home #main.sidebar-right #sidebar,
  html.yds-hd-ready body.home #yds-hd-toggle,
  html.yds-hd-ready body.home #yds-hd-backdrop,
  html.yds-hd-ready body.home #sidebar .yds-hd-chevron {
    transition: none !important;
  }
}

/* Tablet drawer stays off-canvas, but uses a compact width and smaller tab. */
@media (min-width:768px) and (max-width:1199px) {
 html.yds-hd-ready body.home { --yds-hd-width:min(285px, calc(100vw - 54px)); --yds-hd-toggle-top:clamp(255px, 38vh, 390px) }
 html.yds-hd-ready body.home #yds-hd-toggle {min-width:72px;min-height:42px;padding:8px 10px;font-size:14px}
 html.yds-hd-ready body.home #main.sidebar-right #sidebar {padding:12px 12px 16px!important;border-radius:14px 0 0 14px}
}
