/* ============================================
   drawer.css: the site menu (Layout/_Drawer, Layout/_AccountMenu), an off-canvas panel from the
   right on every width.

   <dialog class="bl-modal bl-drawer" id="site-drawer"> rides on the .bl-modal contract (ui.js:
   showModal, Esc, backdrop click, focus return, scroll lock, .is-closing for the exit), so this
   file only re-places it (".bl-modal.bl-drawer" outranks modal.css's sheet and card rules) and
   swaps the animation for a slide on transform. Under reduced motion it simply appears.

   A real drawer on every width: a panel flush with the right edge of the screen, from the very
   top to the very bottom (100dvh, square corners), over the whole page and its header; the
   backdrop dims everything else. Nearly full width on phones (below 576px: a 48px strip of the
   dimmed page stays visible on the left, so it reads as a menu over the page and a tap there
   closes it), 400px from there. The notch and home bar are padded with the safe-area insets;
   the body scrolls inside the panel, the page behind stays put (scroll lock).
   Without JS the menu button links to #site-drawer and the targeted dialog shows in place.
   Phones with the tab bar hide the entries the tab bar already has (.bl-drawer__in-tabbar).
   ============================================ */

.bl-modal.bl-drawer {
    /* About 280ms in, quicker out, on the motion tokens. */
    --bl-drawer-in: calc(var(--duration-base) + 20ms);
    --bl-drawer-out: var(--duration-fast);

    inset: 0 0 0 auto;
    width: calc(100% - var(--space-12));
    max-width: none;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    margin: 0;
    padding: var(--safe-top) env(safe-area-inset-right, 0px) 0 0;
    border-radius: 0;
    background-color: var(--color-surface);
    color: var(--color-ink);
    /* The dropdowns' height animation (allow-keywords lets block-size run to auto). */
    interpolate-size: allow-keywords;
}

@media (min-width: 576px) {
    .bl-modal.bl-drawer {
        width: 400px;
    }
}

.bl-modal.bl-drawer[open] {
    animation: bl-drawer-in var(--bl-drawer-in) var(--ease-out) both;
}

.bl-modal.bl-drawer.is-closing {
    animation: bl-drawer-out var(--bl-drawer-out) var(--ease-out) both;
}

.bl-modal.bl-drawer[open]::backdrop {
    animation-duration: var(--bl-drawer-in);
}

.bl-modal.bl-drawer.is-closing::backdrop {
    animation-duration: var(--bl-drawer-out);
}

@keyframes bl-drawer-in {
    from { transform: translateX(100%); }
    to { transform: none; }
}

@keyframes bl-drawer-out {
    from { transform: none; }
    to { transform: translateX(100%); }
}

/* --- Header row: title + close --- */
.bl-drawer__header {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    min-height: 56px;
    padding: var(--space-1) var(--space-3) var(--space-1) var(--space-5);
    border-bottom: 1px solid var(--color-border-light);
}

.bl-drawer__title {
    margin: 0;
    color: var(--color-ink);
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.02em;
}

.bl-drawer__close {
    flex: none;
    color: var(--color-ink);
    font-size: 20px;
    text-decoration: none;
}

.bl-drawer__close:hover,
.bl-drawer__close:focus {
    color: var(--color-ink);
    text-decoration: none;
}

/* --- Body: the sections scroll; the page behind stays put (scroll lock). A column, so Log out
   sits at the very bottom when the menu is shorter than the panel. --- */
.bl-drawer__body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    padding: var(--space-2) var(--space-3) calc(var(--space-4) + var(--safe-bottom));
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.bl-drawer__section {
    flex: none;
    padding: var(--space-2) 0;
}

.bl-drawer__section + .bl-drawer__section {
    border-top: 1px solid var(--color-border-light);
}

.bl-drawer__heading {
    margin: var(--space-1) 0 var(--space-2);
    padding: 0 var(--space-3);
    color: var(--color-text-muted);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: 0;
}

.bl-drawer__list,
.bl-drawer__chips {
    margin: 0;
    padding: 0;
    list-style: none;
}

/* Rows: icon + label, 48px tall. */
.bl-drawer__item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    width: 100%;
    min-height: 48px;
    margin: 0;
    padding: 0 var(--space-3);
    border: 0;
    border-radius: var(--radius-lg);
    background: transparent;
    color: var(--color-ink);
    font: inherit;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.3;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background-color var(--duration-fast) var(--ease-out);
}

.bl-drawer__item:hover,
.bl-drawer__item:focus {
    color: var(--color-ink);
    text-decoration: none;
}

.bl-drawer__item > i {
    flex: none;
    width: 22px;
    color: var(--color-text-muted);
    font-size: 17px;
    text-align: center;
}

/* The outline heart is the one regular-weight icon among solid ones: a stroke in its own colour
   thickens its line to sit with them. */
.bl-drawer__item > .fa-regular.fa-heart {
    -webkit-text-stroke: 1px currentColor;
}

.bl-drawer__item[aria-current="page"] {
    background: var(--green-50);
    color: var(--green-700);
    font-weight: 600;
}

.bl-drawer__item[aria-current="page"] > i {
    color: var(--green-600);
}

.bl-drawer__item:active {
    background: var(--color-surface-muted);
}

@media (hover: hover) and (pointer: fine) {
    .bl-drawer__item:hover {
        background: var(--color-surface-muted);
    }

    .bl-drawer__item[aria-current="page"]:hover {
        background: var(--green-50);
        color: var(--green-700);
    }
}

/* --- Account (top): one link to the settings, avatar + greeting + name + chevron --- */
.bl-drawer__account {
    padding-top: var(--space-1);
}

.bl-drawer__account-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-height: 64px;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-lg);
    color: var(--color-ink);
    text-decoration: none;
    transition: background-color var(--duration-fast) var(--ease-out);
}

.bl-drawer__account-link:hover,
.bl-drawer__account-link:focus {
    color: var(--color-ink);
    text-decoration: none;
}

.bl-drawer__account-link:active,
.bl-drawer__account-link[aria-current="page"] {
    background: var(--color-surface-muted);
}

@media (hover: hover) and (pointer: fine) {
    .bl-drawer__account-link:hover {
        background: var(--color-surface-muted);
    }
}

/* The initial on a coloured circle; the profile picture, when there is one, covers it (a
   picture that fails to load has alt="" and leaves the letter). */
.bl-drawer__avatar {
    position: relative;
    display: grid;
    flex: none;
    place-items: center;
    width: 48px;
    height: 48px;
    overflow: hidden;
    border-radius: 50%;
    background: var(--green-700);
    color: var(--color-surface);
    font-size: 19px;
    font-weight: 600;
    line-height: 1;
}

.bl-drawer__avatar-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bl-drawer__account-text {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.bl-drawer__account-greeting {
    color: var(--color-text-muted);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
}

.bl-drawer__account-name {
    overflow: hidden;
    color: var(--color-ink);
    font-size: 17px;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.01em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bl-drawer__account-chevron {
    flex: none;
    color: var(--color-text-muted);
    font-size: 14px;
}

.bl-drawer__note {
    margin: 0 0 var(--space-3);
    padding: 0 var(--space-3);
    color: var(--color-text-muted);
    font-size: 14px;
}

/* Signed out: Log in and Sign up side by side. */
.bl-drawer__auth {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2);
    padding: 0 var(--space-3) var(--space-2);
}

/* --- Categories and Popular areas: <details> dropdowns, closed by default --- */
.bl-drawer__summary {
    list-style: none;
}

.bl-drawer__summary::-webkit-details-marker {
    display: none;
}

.bl-drawer__summary-label {
    flex: 1 1 auto;
}

.bl-drawer__item > .bl-drawer__chevron {
    width: auto;
    font-size: 13px;
    transition: rotate var(--duration-base) var(--ease-out);
}

.bl-drawer__disclosure[open] > .bl-drawer__summary .bl-drawer__chevron {
    rotate: 180deg;
}

/* The smooth open and close, where ::details-content is supported; elsewhere it just opens.
   content-visibility runs discretely so the closed content stays hidden from tab order. */
.bl-drawer__disclosure::details-content {
    block-size: 0;
    overflow: clip;
    transition: block-size var(--duration-base) var(--ease-out),
        content-visibility var(--duration-base) allow-discrete;
}

.bl-drawer__disclosure[open]::details-content {
    block-size: auto;
}

/* The chips inside a dropdown (.bl-chip from chips.css). */
.bl-drawer__chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3) var(--space-2) calc(var(--space-3) + 22px + var(--space-3));
}

.bl-drawer__chips .bl-chip[aria-current="page"] {
    border-color: var(--green-600);
    background: var(--green-50);
    color: var(--green-700);
}

/* --- Log out: last, apart from the rest, at the very bottom of a short menu --- */
.bl-drawer__signout-section {
    margin-top: auto;
}

.bl-drawer__signout {
    margin: 0;
}

/* --- Phones with the tab bar: no duplicates ---
   Below 768px, while the tab bar shows (body.has-tabbar; the booking flow has none), the entries
   it already carries are hidden here: the account block and, on the guest bar, Home and
   Favorites (Layout/_Drawer marks them .bl-drawer__in-tabbar). List your property and the
   Hosting section always show, the Hosting section on /Owner pages too. A max-width query on purpose: from 768px
   there is no tab bar and the drawer is the whole menu, untouched. */
@media (max-width: 767.98px) {
    body.has-tabbar .bl-drawer__in-tabbar {
        display: none;
    }

    /* The account block is first: the section after it then needs no divider on top. */
    body.has-tabbar .bl-drawer__in-tabbar + .bl-drawer__section {
        border-top: 0;
    }
}

/* Reduced motion: no slide, no fade, no height or chevron animation; it is just there. */
@media (prefers-reduced-motion: reduce) {
    .bl-modal.bl-drawer[open],
    .bl-modal.bl-drawer[open]:not(.is-closing),
    .bl-modal.bl-drawer.is-closing,
    .bl-modal.bl-drawer[open]::backdrop,
    .bl-modal.bl-drawer.is-closing::backdrop {
        animation: none;
    }

    .bl-drawer__item > .bl-drawer__chevron,
    .bl-drawer__disclosure::details-content {
        transition: none;
    }
}

/* Without JS: the menu button's #site-drawer link shows the dialog in place (the page is not
   inert then, but every link works); its close link goes back to "#". */
@media (scripting: none) {
    .bl-modal.bl-drawer:target {
        display: flex;
        box-shadow: var(--shadow-3);
    }
}
