/**
 * ==============================================================================
 * SADRA VISUALS — ARTBOOK PHOTOGRAPHY GALLERY & STUDIO PORTFOLIO
 * LAYER 6.7: CUSTOM CONTEXT MENU & TOUCH ACTION SHEET STYLES
 * ==============================================================================
 *
 * Design System Specifications:
 * 1. Desktop: Luxury glassmorphic floating context menu with boundary collision detection
 * 2. Mobile: Ergonomic touch action bottom-sheet (< 768px) with visual drag handle
 * 3. Tactile hotkey badges (I, L, F) with JetBrains Mono typography
 * 4. Safe-area insets (env(safe-area-inset-bottom)) and zero horizontal overflow
 * 5. Touch ergonomics: >= 44px tap targets on all interactive items
 */

/* ------------------------------------------------------------------------------
 * 1. DISMISSAL BACKDROP
 * ------------------------------------------------------------------------------ */

.sadra-context-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10500;
    background: transparent;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1),
                visibility 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.sadra-context-backdrop.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* ------------------------------------------------------------------------------
 * 2. DESKTOP FLOATING CONTEXT MENU
 * ------------------------------------------------------------------------------ */

.sadra-context-menu {
    position: fixed;
    z-index: 10550;
    width: 280px;
    max-width: calc(100vw - 32px);
    background: var(--bg-card, #0f1115);
    background: linear-gradient(145deg, rgba(20, 22, 28, 0.96), rgba(12, 14, 18, 0.98));
    border: 1px solid var(--border-glass, rgba(255, 255, 255, 0.12));
    border-radius: var(--radius-lg, 14px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7),
                0 0 0 1px rgba(212, 175, 55, 0.1),
                0 0 24px rgba(212, 175, 55, 0.06);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    color: var(--text-primary, #f5f5f7);
    padding: 6px;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: scale(0.94) translateY(4px);
    transform-origin: top left;
    transition: opacity 0.18s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.18s cubic-bezier(0.16, 1, 0.3, 1),
                visibility 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
}

.sadra-context-menu.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: scale(1) translateY(0);
}

/* ------------------------------------------------------------------------------
 * 3. MENU HEADER & ATTRIBUTION
 * ------------------------------------------------------------------------------ */

.context-menu-header {
    padding: 10px 12px 8px 12px;
    border-bottom: 1px solid var(--border-glass, rgba(255, 255, 255, 0.08));
    margin-bottom: 4px;
}

.context-menu-title {
    font-family: var(--font-display, 'Space Grotesk', sans-serif);
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary, #ffffff);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0 0 2px 0;
}

.context-menu-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: 0.68rem;
    color: var(--text-muted, #9ca3af);
    letter-spacing: 0.02em;
}

.context-menu-brand {
    color: var(--gold-primary, #d4af37);
    font-weight: 500;
}

/* ------------------------------------------------------------------------------
 * 4. INTERACTIVE MENU ITEMS
 * ------------------------------------------------------------------------------ */

.context-menu-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.context-menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 42px;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm, 8px);
    color: var(--text-secondary, #d1d5db);
    font-family: var(--font-body, 'Plus Jakarta Sans', sans-serif);
    font-size: 0.84rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
    box-sizing: border-box;
}

.context-menu-item:hover,
.context-menu-item:focus-visible {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary, #ffffff);
    outline: none;
}

.context-menu-item:active {
    transform: scale(0.98);
}

.context-item-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.context-item-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    color: var(--text-muted, #9ca3af);
    transition: color 0.15s ease;
}

.context-menu-item:hover .context-item-icon,
.context-menu-item:focus-visible .context-item-icon {
    color: var(--gold-primary, #d4af37);
}

.context-item-icon svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Tactile Hotkey Keycap Badges */
.context-shortcut-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 18px;
    padding: 0 5px;
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted, #9ca3af);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 4px;
}

.context-menu-item:hover .context-shortcut-badge {
    color: var(--gold-primary, #d4af37);
    border-color: rgba(212, 175, 55, 0.3);
    background: rgba(212, 175, 55, 0.08);
}

/* Divider separator */
.context-menu-separator {
    height: 1px;
    background: var(--border-glass, rgba(255, 255, 255, 0.08));
    margin: 4px 6px;
}

/* ------------------------------------------------------------------------------
 * 5. MOBILE TOUCH ACTION SHEET (< 768px)
 * ------------------------------------------------------------------------------ */

.context-sheet-handle {
    display: none;
    width: 44px;
    height: 4px;
    background: rgba(255, 255, 255, 0.28);
    border-radius: 2px;
    margin: 10px auto 6px auto;
}

@media (max-width: 768px) {
    .sadra-context-backdrop {
        background: rgba(5, 6, 8, 0.65);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
    }

    .sadra-context-menu {
        top: auto !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 22px 22px 0 0;
        border-left: none;
        border-right: none;
        border-bottom: none;
        padding: 8px 16px max(20px, env(safe-area-inset-bottom)) 16px;
        transform: translateY(100%);
        transform-origin: bottom center;
        box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.7);
    }

    .sadra-context-menu.is-open {
        transform: translateY(0);
    }

    .context-sheet-handle {
        display: block;
    }

    .context-menu-header {
        padding: 6px 4px 12px 4px;
        text-align: center;
    }

    .context-menu-title {
        font-size: 1rem;
    }

    .context-menu-meta {
        justify-content: center;
        gap: 12px;
        margin-top: 4px;
    }

    .context-menu-item {
        min-height: 48px;
        padding: 10px 14px;
        font-size: 0.92rem;
    }

    .context-item-icon svg {
        width: 18px;
        height: 18px;
    }

    .context-shortcut-badge {
        display: none; /* Hide desktop keyboard hints on touch devices */
    }
}

@media (max-width: 480px) {
    .context-menu-item {
        min-height: 50px;
        padding: 12px 14px;
    }
}
