/**
 * Voidlust — site navigation menu + install card (NOT PWA)
 * Scoped: body.crave-site-mode:not(.crave-pwa-mode)
 */

/* ── Site menu overlay ── */
body.crave-site-mode:not(.crave-pwa-mode) .site-menu-overlay {
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(2, 1, 3, 0.62);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

body.crave-site-mode:not(.crave-pwa-mode).site-menu-open {
    overflow: hidden;
}

body.crave-site-mode:not(.crave-pwa-mode) .site-menu-panel {
    width: min(360px, calc(100vw - 32px));
    max-width: 360px;
    margin: 0;
    padding: 22px 18px 18px !important;
    text-align: left;
    border-radius: 22px !important;
    background:
        radial-gradient(ellipse 90% 60% at 50% 0%, rgba(143, 18, 56, 0.14), transparent 58%),
        linear-gradient(160deg, rgba(12, 8, 12, 0.96), rgba(4, 2, 5, 0.99)) !important;
    border: 1px solid rgba(216, 168, 91, 0.28) !important;
    box-shadow:
        0 24px 80px rgba(0, 0, 0, 0.58),
        0 0 34px rgba(143, 18, 56, 0.16) !important;
    transform: translateY(8px) scale(0.98);
    opacity: 0;
}

body.crave-site-mode:not(.crave-pwa-mode) .site-menu-overlay.active .site-menu-panel {
    transform: translateY(0) scale(1);
    opacity: 1;
}

body.crave-site-mode:not(.crave-pwa-mode) .site-menu-close {
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(220, 210, 200, 0.8);
    font-size: 1.2rem;
    line-height: 1;
}

body.crave-site-mode:not(.crave-pwa-mode) .site-menu-brand {
    display: flex !important;
    align-items: center;
    justify-content: center;
    margin: 0 0 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(120, 20, 20, 0.22);
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: #f0ebe4;
}

body.crave-site-mode:not(.crave-pwa-mode) .site-menu-profile {
    display: none;
    flex-direction: row !important;
    align-items: center !important;
    gap: 12px !important;
    margin-bottom: 14px !important;
    padding: 12px 12px 14px !important;
    border-radius: 16px;
    border: 1px solid rgba(201, 167, 106, 0.16);
    background: rgba(8, 5, 8, 0.55);
    text-align: left !important;
}

body.crave-site-mode:not(.crave-pwa-mode) .site-menu-profile.is-visible {
    display: flex !important;
}

body.crave-site-mode:not(.crave-pwa-mode) .site-menu-profile .portal-menu-profile__avatar {
    width: 44px;
    height: 44px;
    margin-bottom: 0 !important;
    flex-shrink: 0;
}

body.crave-site-mode:not(.crave-pwa-mode) .site-menu-profile__copy {
    min-width: 0;
    flex: 1;
}

body.crave-site-mode:not(.crave-pwa-mode) .site-menu-profile .portal-menu-profile__name {
    font-size: 1.05rem !important;
    line-height: 1.2;
    margin: 0 !important;
}

body.crave-site-mode:not(.crave-pwa-mode) .site-menu-profile .portal-menu-profile__meta {
    margin: 2px 0 0 !important;
    font-size: 0.62rem !important;
    letter-spacing: 0.08em;
    text-transform: none;
}

body.crave-site-mode:not(.crave-pwa-mode) .site-menu-nav {
    gap: 4px !important;
    align-items: stretch;
    width: 100%;
}

body.crave-site-mode:not(.crave-pwa-mode) .site-menu-row,
body.crave-site-mode:not(.crave-pwa-mode) .site-menu-item {
    display: grid !important;
    grid-template-columns: 44px 1fr auto;
    align-items: center;
    gap: 14px;
    width: 100%;
    margin-bottom: 0 !important;
    padding: 12px 12px !important;
    border-radius: 14px !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    background: rgba(255, 255, 255, 0.02) !important;
    font-family: 'Inter', system-ui, sans-serif !important;
    font-size: 0.84rem !important;
    font-weight: 500 !important;
    color: rgba(244, 237, 245, 0.9) !important;
    text-align: left !important;
    text-decoration: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    justify-content: unset !important;
    justify-items: start;
    box-sizing: border-box;
}

body.crave-site-mode:not(.crave-pwa-mode) button.site-menu-row,
body.crave-site-mode:not(.crave-pwa-mode) button.site-menu-item {
    text-align: left !important;
}

body.crave-site-mode:not(.crave-pwa-mode) .site-menu-row:hover,
body.crave-site-mode:not(.crave-pwa-mode) .site-menu-row:focus-visible,
body.crave-site-mode:not(.crave-pwa-mode) .site-menu-item:hover,
body.crave-site-mode:not(.crave-pwa-mode) .site-menu-item:focus-visible {
    background: rgba(111, 8, 24, 0.2) !important;
    border-color: rgba(201, 167, 106, 0.2) !important;
    transform: none !important;
    box-shadow: none !important;
}

body.crave-site-mode:not(.crave-pwa-mode) .site-menu-row .link-icon,
body.crave-site-mode:not(.crave-pwa-mode) .site-menu-item__icon {
    grid-column: 1;
    width: 44px;
    height: 44px;
    display: grid !important;
    place-items: center;
    flex-shrink: 0;
    margin: 0;
    border-radius: 9px;
    background: rgba(8, 6, 10, 0.65);
    border: 1px solid rgba(201, 167, 106, 0.12);
    font-size: 0.82rem;
    line-height: 1;
    justify-self: start;
}

body.crave-site-mode:not(.crave-pwa-mode) .site-menu-row .link-icon img {
    display: block;
    width: 18px;
    height: auto;
    max-height: 20px;
    object-fit: contain;
}

body.crave-site-mode:not(.crave-pwa-mode) .site-menu-row .site-menu-label,
body.crave-site-mode:not(.crave-pwa-mode) .site-menu-item__text {
    grid-column: 2;
    min-width: 0;
    text-align: left !important;
    justify-self: start;
    align-self: center;
}

body.crave-site-mode:not(.crave-pwa-mode) .site-menu-row .site-menu-item__title,
body.crave-site-mode:not(.crave-pwa-mode) .site-menu-label {
    display: block;
    text-align: left !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.crave-site-mode:not(.crave-pwa-mode) .site-menu-arrow,
body.crave-site-mode:not(.crave-pwa-mode) .site-menu-item__arrow {
    grid-column: 3;
    margin: 0 !important;
    padding: 0;
    color: rgba(201, 167, 106, 0.55);
    font-size: 1rem;
    line-height: 1;
    flex-shrink: 0;
    justify-self: end;
    align-self: center;
}

body.crave-site-mode:not(.crave-pwa-mode) .portal-menu-footer {
    margin-top: 14px !important;
    padding-top: 12px;
    border-top: 1px solid rgba(120, 20, 20, 0.18);
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.68rem;
    color: rgba(180, 170, 165, 0.45);
    text-align: center;
}

/* Desktop: dropdown near menu button */
@media (min-width: 769px) {
    body.crave-site-mode:not(.crave-pwa-mode) .site-menu-overlay {
        align-items: flex-start;
        justify-content: flex-start;
        padding: 0;
        background: rgba(0, 0, 0, 0.35);
    }

    body.crave-site-mode:not(.crave-pwa-mode) .site-menu-panel {
        position: absolute;
        top: calc(56px + env(safe-area-inset-top, 0px));
        left: max(16px, env(safe-area-inset-left, 0px));
        width: min(340px, calc(100vw - 32px));
        transform: translateY(-6px) scale(0.98);
    }

    body.crave-site-mode:not(.crave-pwa-mode) .site-menu-overlay.active .site-menu-panel {
        transform: translateY(0) scale(1);
    }
}

/* Mobile: bottom sheet + strict menu row grid */
@media (max-width: 768px) {
    body.crave-site-mode:not(.crave-pwa-mode) .site-menu-overlay {
        align-items: flex-end;
        justify-content: center;
        padding: 0;
    }

    body.crave-site-mode:not(.crave-pwa-mode) .site-menu-panel {
        position: relative;
        top: auto;
        left: auto;
        width: 100%;
        max-width: 100%;
        border-radius: 22px 22px 0 0 !important;
        padding: 20px 16px calc(18px + env(safe-area-inset-bottom, 0px)) !important;
        transform: translateY(100%);
    }

    body.crave-site-mode:not(.crave-pwa-mode) .site-menu-overlay.active .site-menu-panel {
        transform: translateY(0);
    }

    body.crave-site-mode:not(.crave-pwa-mode) .site-menu-nav .portal-link.site-menu-row,
    body.crave-site-mode:not(.crave-pwa-mode) .site-menu-nav button.portal-link.site-menu-row {
        display: grid !important;
        grid-template-columns: 44px 1fr auto !important;
        align-items: center !important;
        gap: 14px !important;
        width: 100% !important;
        text-align: left !important;
        justify-content: unset !important;
        justify-items: start !important;
    }

    body.crave-site-mode:not(.crave-pwa-mode) .site-menu-nav .site-menu-row .link-icon {
        width: 44px !important;
        height: 44px !important;
    }

    body.crave-site-mode:not(.crave-pwa-mode) .site-menu-nav .site-menu-row .site-menu-label {
        text-align: left !important;
        justify-self: start !important;
    }

    body.crave-site-mode:not(.crave-pwa-mode) .site-menu-nav .site-menu-row .site-menu-arrow {
        justify-self: end !important;
        margin-left: 0 !important;
    }
}

/* ── Install prompt (site only) ── */
.voidlust-install-card {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: min(360px, calc(100vw - 32px));
    z-index: 1200;
    display: none;
    opacity: 0;
    transform: translateY(14px) scale(0.98);
    pointer-events: none;
    transition: opacity 0.35s ease, transform 0.38s cubic-bezier(0.22, 1, 0.36, 1);

    background:
        radial-gradient(circle at 20% 0%, rgba(143, 18, 56, 0.26), transparent 45%),
        linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.025));
    border: 1px solid rgba(216, 168, 91, 0.28);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55), 0 0 34px rgba(143, 18, 56, 0.22);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    border-radius: 24px;
    padding: 18px;
}

.voidlust-install-card.is-visible,
.voidlust-install-card.is-entering {
    display: block;
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.voidlust-install-card.is-leaving {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
    pointer-events: none;
}

.voidlust-install-card__inner {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    align-items: center;
    gap: 12px;
}

.voidlust-install-card__icon {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: linear-gradient(145deg, rgba(90, 12, 12, 0.55), rgba(30, 6, 6, 0.75));
    border: 1px solid rgba(203, 169, 110, 0.24);
}

.voidlust-install-card__icon img {
    width: 22px;
    height: 22px;
    object-fit: contain;
    filter: drop-shadow(0 0 8px rgba(80, 140, 255, 0.35));
}

.voidlust-install-card__title {
    display: block;
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: 0.9rem;
    font-weight: 700;
    color: #e8dcc8;
    letter-spacing: 0.03em;
    line-height: 1.25;
}

.voidlust-install-card__sub {
    display: block;
    margin-top: 2px;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.72rem;
    color: rgba(200, 198, 198, 0.58);
    line-height: 1.3;
}

.voidlust-install-card__cta {
    flex-shrink: 0;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid rgba(139, 21, 25, 0.45);
    background: linear-gradient(180deg, rgba(120, 20, 24, 0.9), rgba(70, 10, 14, 0.95));
    color: #f4ece8;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
}

.voidlust-install-card__close {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(180, 175, 175, 0.8);
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
}

@media (max-width: 768px) {
    body.crave-site-mode:not(.crave-pwa-mode) .voidlust-install-card {
        left: 16px;
        right: 16px;
        bottom: max(18px, env(safe-area-inset-bottom));
        width: auto;
        border-radius: 22px;
    }
}

body.crave-pwa-mode .voidlust-install-card,
body.crave-pwa-mode .pwa-install-toast {
    display: none !important;
}
