/*
File: themes/kayefi-confession/style.css
Theme Name: Kayefi Confession
Theme URI: https://kayefi.com
Author: Kayefi Dev Team
Description: Enterprise-grade hybrid theme. Features JIT architecture, deep a11y support, and hardware-accelerated animations.
Version: 1.2.0
License: Proprietary
Text Domain: kayefi
*/

/* ==========================================================================
   1. CORE ARCHITECTURE & Z-INDEX LAYERING
   ========================================================================== */
:root {
    /* Layer Management - Single Source of Truth */
    --z-negative: -1;
    --z-normal: 1;
    --z-sticky: 40;
    --z-header: 50;
    --z-modal-backdrop: 60;
    --z-modal: 70;
    --z-mobile-menu-backdrop: 90;
    --z-mobile-menu: 100;
    --z-pwa-bubble: 110;  /* Always accessible */
    --z-pwa-card: 120;    /* Highest priority interaction */
    
    /* Variables (Fallback if Tailwind fails) */
    --color-primary-500: #6366f1;
    --color-primary-600: #4f46e5;
    --text-body: #0f172a;
    --text-muted: #64748b;
    --radius-lg: 1rem;
    
    /* PWA Specifics */
    --pwa-accent: #4f46e5;
    --pwa-glass: rgba(255, 255, 255, 0.95);
    --pwa-muted: #64748b;
    --pwa-shadow: 0 8px 28px rgba(0,0,0,0.15);
}

.dark {
    --pwa-glass: rgba(30, 41, 59, 0.95);
    --pwa-muted: #94a3b8;
}

@layer base {
    html {
        scroll-behavior: smooth;
        -webkit-tap-highlight-color: transparent;
    }
    body {
        @apply antialiased text-slate-900 bg-slate-50 dark:bg-[#0f172a] dark:text-slate-100 transition-colors duration-300;
        overflow-x: hidden;
    }
    /* Lock body scroll when menu is open */
    body.menu-open {
        overflow: hidden !important;
        height: 100vh;
    }
    h1, h2, h3, h4, h5, h6 {
        @apply font-display tracking-tight text-slate-900 dark:text-white;
    }
    :focus-visible {
        @apply outline-none ring-2 ring-primary-500 ring-offset-2 ring-offset-white dark:ring-offset-slate-900;
    }
}

/* ==========================================================================
   2. MOBILE MENU SPECIFICS (Robust Fallbacks)
   ========================================================================== */
/* Ensure menu sits above everything else */
#mobile-menu-overlay {
    z-index: 90; /* Matches --z-mobile-menu-backdrop */
}
#mobile-menu {
    z-index: 100; /* Matches --z-mobile-menu */
}

/* ==========================================================================
   3. WORKER NG LITE APP STYLES (PWA)
   ========================================================================== */

/* Floating Bubble */
#pwa-fly-bubble {
    position: fixed;
    left: 20px;
    bottom: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--pwa-accent), #4338ca);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4);
    z-index: 110; /* Matches --z-pwa-bubble */
    border: none;
    cursor: pointer;
    transform: translateY(12px) scale(0.9);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(.2,.9,.3,1), opacity 0.3s ease;
    font-size: 20px;
}
#pwa-fly-bubble.pwa-bubble-entrance {
    transform: translateY(0) scale(1);
    opacity: 1;
}
#pwa-fly-bubble.pwa-bubble-pulse {
    animation: pwa-pulse 2s infinite;
}
@keyframes pwa-pulse {
    0% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(79, 70, 229, 0); }
    100% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0); }
}

/* Install Card */
#pwa-install-card {
    position: fixed;
    left: 16px;
    bottom: 90px;
    width: calc(100% - 32px);
    max-width: 400px;
    background: var(--pwa-glass);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    box-shadow: var(--pwa-shadow);
    display: flex;
    gap: 16px;
    padding: 16px;
    align-items: center;
    z-index: 120; /* Matches --z-pwa-card */
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(.2,.9,.3,1);
    border: 1px solid rgba(0,0,0,0.05);
}
.dark #pwa-install-card {
    border: 1px solid rgba(255,255,255,0.05);
}
#pwa-install-card.pwa-card-show {
    opacity: 1;
    transform: translateY(0);
}

.pwa-card-left {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
}
.pwa-logo-placeholder {
    width: 100%;
    height: 100%;
    background: #eef2ff;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #4f46e5;
}
.dark .pwa-logo-placeholder {
    background: #334155;
}

.pwa-card-body {
    flex: 1;
}
.pwa-card-title {
    font-weight: 700;
    margin-bottom: 4px;
    color: #0f172a;
    font-size: 15px;
}
.dark .pwa-card-title {
    color: white;
}
.pwa-card-desc {
    font-size: 13px;
    color: var(--pwa-muted);
    margin-bottom: 10px;
    line-height: 1.3;
}

.pwa-card-actions {
    display: flex;
    gap: 8px;
}
.pwa-card-actions button {
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
}
#pwa-card-install {
    background: var(--pwa-accent);
    color: white;
}
#pwa-card-later {
    background: transparent;
    border: 1px solid rgba(0,0,0,0.1);
    color: var(--pwa-muted);
}
.dark #pwa-card-later {
    border-color: rgba(255,255,255,0.1);
}

.pwa-card-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px;
}

/* iOS Guide */
#pwa-ios-instructions {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: white;
    width: calc(100% - 40px);
    max-width: 320px;
    padding: 24px;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.2);
    z-index: 120;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    text-align: center;
}
.dark #pwa-ios-instructions {
    background: #1e293b;
    border: 1px solid #334155;
}
#pwa-ios-instructions.pwa-ios-show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: auto;
}
.pwa-ios-title {
    font-weight: 800;
    font-size: 18px;
    margin-bottom: 8px;
    color: var(--pwa-accent);
}
.pwa-ios-text {
    font-size: 15px;
    color: var(--pwa-muted);
    margin-bottom: 16px;
    line-height: 1.5;
}
#pwa-ios-close {
    width: 100%;
    padding: 12px;
    background: var(--pwa-accent);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: bold;
    cursor: pointer;
}

/* Exit Intent Modal */
#pwa-exit-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 120;
    pointer-events: none;
}
.pwa-exit-card {
    width: calc(100% - 32px);
    max-width: 480px;
    margin: 16px;
    background: white;
    border-radius: 16px;
    padding: 16px;
    display: flex;
    gap: 16px;
    align-items: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.3s;
    pointer-events: auto;
}
.dark .pwa-exit-card {
    background: #1e293b;
    border: 1px solid #334155;
}
#pwa-exit-modal.pwa-exit-show .pwa-exit-card {
    transform: translateY(0);
    opacity: 1;
}
.pwa-exit-left {
    width: 48px;
    height: 48px;
    background: var(--pwa-accent);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    flex-shrink: 0;
}
.pwa-exit-body {
    flex: 1;
}
.pwa-exit-title {
    font-weight: 700;
    font-size: 16px;
    color: #0f172a;
    margin-bottom: 4px;
}
.dark .pwa-exit-title {
    color: white;
}
.pwa-exit-desc {
    font-size: 13px;
    color: var(--pwa-muted);
    margin-bottom: 8px;
}
.pwa-exit-actions {
    display: flex;
    gap: 8px;
}
.pwa-exit-actions button {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: none;
}
#pwa-exit-install {
    background: var(--pwa-accent);
    color: white;
}
#pwa-exit-dismiss {
    background: transparent;
    color: var(--pwa-muted);
}

/* ==========================================================================
   4. ANIMATIONS & UTILITIES
   ========================================================================== */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.animate-fade-in { animation: fadeIn 0.6s ease-out forwards; }
.animate-slide-up { animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards; }

.glass-panel {
    @apply bg-white/90 dark:bg-slate-800/90 backdrop-blur-xl border border-white/20 dark:border-slate-700/50 shadow-2xl;
}

/* Scrollbar Hide (Clean horizontal scrolling for Vibes) */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* ==========================================================================
   5. COMPONENT OVERRIDES
   ========================================================================== */
.btn {
    @apply inline-flex items-center justify-center px-6 py-3 border border-transparent text-sm font-bold rounded-xl shadow-sm transition-all focus:outline-none focus:ring-2 focus:ring-offset-2;
}
.btn-primary {
    @apply text-white bg-primary-600 hover:bg-primary-700 focus:ring-primary-500 shadow-lg shadow-primary-500/30;
}
.btn-secondary {
    @apply text-slate-700 bg-slate-100 hover:bg-slate-200 focus:ring-slate-500 dark:bg-slate-700 dark:text-slate-200 dark:hover:bg-slate-600;
}

[v-cloak] { display: none !important; }

/* ==========================================================================
   6. CONTENT TYPOGRAPHY (Blog Posts & Pages - Fix)
   ========================================================================== */
.prose {
    max-width: 65ch;
    margin-left: auto;
    margin-right: auto;
    font-size: 1.125rem;
}
.prose p {
    margin-bottom: 1.5em;
    line-height: 1.75;
}
.prose h1, .prose h2, .prose h3, .prose h4 {
    color: var(--text-body);
    font-weight: 800;
    margin-top: 2em;
    margin-bottom: 0.5em;
    line-height: 1.3;
}
.prose h1 { font-size: 2.5em; }
.prose h2 { font-size: 1.75em; }
.prose h3 { font-size: 1.5em; }
.prose ul, .prose ol {
    margin-bottom: 1.5em;
    padding-left: 1.5em;
}
.prose ul { list-style-type: disc; }
.prose ol { list-style-type: decimal; }
.prose li { margin-bottom: 0.5em; }
.prose blockquote {
    border-left: 4px solid var(--color-primary-600);
    padding-left: 1em;
    font-style: italic;
    color: var(--text-muted);
    margin-bottom: 1.5em;
    background: #f8fafc;
    padding: 1rem;
    border-radius: 0 0.5rem 0.5rem 0;
}
.prose img {
    border-radius: var(--radius-lg);
    margin-top: 2em;
    margin-bottom: 2em;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}
.prose a {
    color: var(--color-primary-600);
    text-decoration: underline;
    text-underline-offset: 2px;
    font-weight: 600;
}
.dark .prose h1, .dark .prose h2, .dark .prose h3, .dark .prose h4 { color: white; }
.dark .prose p, .dark .prose li { color: #cbd5e1; }
.dark .prose a { color: var(--color-primary-500); }
.dark .prose blockquote { background: rgba(255,255,255,0.05); }