/* ---- Mobile drawer ---------------------------------------------------------------------------------------------------
   A sheet with brand + close on top, big tappable rows with a rotating chevron, sub-items behind an accent rail, then
   the account buttons and the language / theme switches pinned at the bottom. Rules are prefixed with `html` to
   outrank the template's Menu-demo2.css and the generated site-ltr.css mirror; logical properties keep one rule
   correct for both directions. Loaded after site-brand.css. */
html .off-canvas-wrap {
    background: #fff;
    box-shadow: 0 0 40px rgba(7, 21, 37, 0.28);
    color: #071525;
    display: flex;
    flex-direction: column;
    max-width: 92vw;
    overflow: hidden;
    transform: translateX(105%);
    transition: transform 0.35s cubic-bezier(0.22, 0.8, 0.3, 1);
    width: 340px;
}

html[dir="ltr"] .off-canvas-wrap {
    transform: translateX(-105%);
}

html body.mobile-js-menu .off-canvas-wrap {
    overflow: hidden;
    transform: none;
}

html .off-canvas-wrap .close-off-canvas-wrap {
    align-items: center;
    border-bottom: 1px solid #e3e8ef;
    display: flex;
    flex: 0 0 auto;
    gap: 0.75rem;
    justify-content: space-between;
    overflow: visible;
    padding: 0.75rem 1rem;
    text-align: start;
}

html .of-drawer-brand {
    display: inline-flex;
    height: auto;
    width: auto;
}

html .of-drawer-brand img {
    height: auto;
    max-height: 40px;
    max-width: 150px;
    width: auto;
}

.of-logo-on-light { display: none; }
html:not([data-theme="dark"]) .of-logo-on-dark { display: none; }
html:not([data-theme="dark"]) .of-logo-on-light { display: inline-block; }

html .off-canvas-wrap #of-close-off-canvas {
    align-items: center;
    background: #eef3fa;
    border-radius: 50%;
    color: #071525;
    display: inline-flex;
    flex: 0 0 auto;
    height: 2.5rem;
    justify-content: center;
    width: 2.5rem;
}

html .off-canvas-wrap #of-close-off-canvas i {
    font-size: 1.1rem;
    line-height: 1;
    padding: 0;
}

html .off-canvas-wrap .off-canvas-inner {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

html .off-canvas-wrap .mobile-menu-wrap {
    flex: 1 0 auto;
    font-size: inherit !important;
    padding: 0.5rem 0.75rem;
}

html .off-canvas-wrap .mobile-menu-wrap,
html .off-canvas-wrap .mobile-menu,
html .off-canvas-wrap .mobile-menu-wrap ul {
    border: 0;
}

html .off-canvas-wrap .mobile-menu-wrap ul li {
    border: 0;
    line-height: 1.4;
    padding: 0;
}

html .off-canvas-wrap .mobile-menu-wrap ul li:hover {
    padding: 0;
}

html .off-canvas-wrap .mobile-menu-wrap ul li > a {
    align-items: center;
    border-radius: 0.75rem;
    color: #071525;
    display: flex;
    font-size: 1rem;
    justify-content: space-between;
    min-height: 3rem;
    padding: 0.5rem 0.9rem;
}

html .off-canvas-wrap .mobile-menu-wrap ul li > a:hover,
html .off-canvas-wrap .mobile-menu-wrap ul li > a:focus-visible,
html .off-canvas-wrap .mobile-menu-wrap ul li > a.active {
    background: #eef5ff;
    color: #1685ff;
}

/* The arrow: the template stretches it over the whole row; keep it a small end-aligned chip that still takes the click. */
html .off-canvas-wrap .explain-menu {
    align-items: center;
    background: transparent;
    border-radius: 50%;
    color: #6b7a90;
    display: inline-flex;
    flex: 0 0 auto;
    height: 2.25rem;
    inset: auto;
    justify-content: center;
    line-height: 1;
    margin: 0;
    position: static;
    text-align: center;
    transition: transform 0.25s ease;
    width: 2.25rem;
}

html .off-canvas-wrap a.active .explain-menu {
    color: #1685ff;
    transform: rotate(180deg);
}

/* The template swaps the glyph on .active; the rotation above does that job, so keep the glyph fixed. */
html .off-canvas-wrap .active .explain-menu:before {
    content: "\f107";
}

html .off-canvas-wrap .mobile-menu-wrap .sub-menu {
    background: transparent;
    border-inline-start: 2px solid #cfe2ff;
    font-size: 0.95rem;
    margin: 0.15rem 1.1rem 0.4rem;
    padding: 0;
}

html .off-canvas-wrap .mobile-menu-wrap .sub-menu li > a {
    color: #475569;
    font-size: 0.95rem;
    min-height: 2.6rem;
}

html .of-drawer-account {
    display: grid;
    flex: 0 0 auto;
    gap: 0.6rem;
    grid-template-columns: 1fr 1fr;
    padding: 0.75rem 1rem;
}

html .of-drawer-account .of-btn:only-child {
    grid-column: 1 / -1;
}

html .off-canvas-wrap .of-btn {
    align-items: center;
    border-radius: 0.75rem;
    display: inline-flex;
    font-size: 0.95rem;
    font-weight: 600;
    gap: 0.5rem;
    justify-content: center;
    min-height: 3rem;
    padding: 0 0.75rem;
    text-align: center;
    text-decoration: none;
}

html .off-canvas-wrap .of-btn-primary {
    background: #1685ff;
    border: 1px solid #1685ff;
    color: #fff;
}

html .off-canvas-wrap .of-btn-primary:hover {
    background: #0f6fe0;
    color: #fff;
}

html .off-canvas-wrap .of-btn-ghost {
    background: transparent;
    border: 1px solid #1685ff;
    color: #1685ff;
}

html .off-canvas-wrap .of-btn-ghost:hover {
    background: #eef5ff;
    color: #0f6fe0;
}

html .of-drawer-tools {
    align-items: center;
    border-top: 1px solid #e3e8ef;
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: space-between;
    padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom));
}

/* The dimmed, blurred backdrop: the template's mask ignored pointer events, so tapping outside never closed the drawer. */
html body.mobile-js-menu .of-site-mask {
    backdrop-filter: blur(3px);
    background: rgba(7, 21, 37, 0.55);
    pointer-events: auto;
    transform: none;
    z-index: 9998;
}

/* The logo in the mobile bar is a link home now. */
.mobile-nav-logo {
    display: inline-block;
}

html[data-theme="dark"] .off-canvas-wrap { background: #0d131a; }
html[data-theme="dark"] .off-canvas-wrap .close-off-canvas-wrap,
html[data-theme="dark"] .of-drawer-tools { border-color: var(--sd-border); }
html[data-theme="dark"] .off-canvas-wrap #of-close-off-canvas { background: var(--sd-surface-2); color: var(--sd-text); }
html[data-theme="dark"] .off-canvas-wrap .mobile-menu-wrap ul li > a:hover,
html[data-theme="dark"] .off-canvas-wrap .mobile-menu-wrap ul li > a:focus-visible,
html[data-theme="dark"] .off-canvas-wrap .mobile-menu-wrap ul li > a.active { background: var(--sd-surface-2); color: #4aa3ff; }
html[data-theme="dark"] .off-canvas-wrap .mobile-menu-wrap .sub-menu { border-color: var(--sd-border); }
html[data-theme="dark"] .off-canvas-wrap .mobile-menu-wrap .sub-menu li > a { color: var(--sd-muted); }
html[data-theme="dark"] .off-canvas-wrap .of-btn-primary { color: #fff; }
html[data-theme="dark"] .off-canvas-wrap .of-btn-ghost { color: #4aa3ff; border-color: #4aa3ff; }
html[data-theme="dark"] .off-canvas-wrap .of-btn-ghost:hover { background: var(--sd-surface-2); }

/* .mobile-nav-button a is pinned and sized as the menu button; the logo link inside it is not that button. */
html .mnav-reset,
html .mobnav .mobile-nav-button a.mobile-nav-logo,
html .mobile-nav-button a.mobile-nav-logo {
    align-items: center !important;
    display: inline-flex !important;
    height: auto !important;
    inset: auto !important;
    padding: 0 !important;
    position: static !important;
    transform: none !important;
    width: auto !important;
}

/* Dark theme: the light-theme link colour above (#071525) is more specific than site-dark.css's generic drawer rule,
   which left the menu rows dark-on-dark. These repeat the selector so the light text wins. */
html[data-theme="dark"] .off-canvas-wrap .mobile-menu-wrap ul li > a {
    color: var(--sd-text-strong);
}

html[data-theme="dark"] .off-canvas-wrap .mobile-menu-wrap .sub-menu li > a {
    color: var(--sd-text);
}

html[data-theme="dark"] .off-canvas-wrap .mobile-menu-wrap ul li > a:hover,
html[data-theme="dark"] .off-canvas-wrap .mobile-menu-wrap ul li > a:focus-visible,
html[data-theme="dark"] .off-canvas-wrap .mobile-menu-wrap ul li > a.active {
    color: #4aa3ff;
}

html[data-theme="dark"] .off-canvas-wrap .explain-menu {
    color: var(--sd-muted);
}

html[data-theme="dark"] .off-canvas-wrap a.active .explain-menu {
    color: #4aa3ff;
}

html[data-theme="dark"] .off-canvas-wrap .of-btn-primary,
html[data-theme="dark"] .off-canvas-wrap .of-btn-primary:hover {
    color: #fff;
}

html[data-theme="dark"] .off-canvas-wrap .site-lang {
    border-color: var(--sd-border);
    color: var(--sd-text);
}

html[data-theme="dark"] .off-canvas-wrap .site-lang:hover,
html[data-theme="dark"] .off-canvas-wrap .site-lang:focus-visible {
    background: var(--sd-surface-2);
    color: var(--sd-text-strong);
}

html[data-theme="dark"] .off-canvas-wrap .site-lang[aria-pressed="true"] {
    background: var(--site-accent);
    border-color: var(--site-accent);
    color: #fff;
}

html[data-theme="dark"] .off-canvas-wrap .site-theme-toggle {
    border-color: var(--sd-border);
    color: var(--sd-text);
}

/* The selected language pill: white text on the accent in every theme and place. The drawer's generic pill colour
   (#555, for the unselected pills on its white panel) has the same specificity as the selected rule in site.css and comes
   later, so it won and left grey text on the blue pill; the header strip used dark navy, which reads weakly on the accent. */
html .site-lang[aria-pressed="true"],
html .off-canvas-wrap .site-lang[aria-pressed="true"],
html .off-canvas-wrap .site-lang[aria-pressed="true"]:hover,
html .off-canvas-wrap .site-lang[aria-pressed="true"]:focus-visible {
    background: var(--site-accent);
    border-color: var(--site-accent);
    color: #fff;
}
