/* Google Fonts Imports for Urdu Nastaliq, Hindi Devanagari, and English Serif */
@import url('https://fonts.googleapis.com/css2?family=Gulzar&family=Noto+Nastaliq+Urdu:wght@400;500;600;700&family=Noto+Sans+Devanagari:wght@400;500;600;700&family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
    --primary-global: #8e1b1b;
    --primary-dark: #660e0e;
    --gold-accent: #c59b27;
    --gold-light: #f59e0b;
    --parchment-bg: #fcfaf7;
    --card-bg: #ffffff;
    --text-primary: #1c1917;
    --text-secondary: #78716c;
}

html {
    overflow-x: hidden;
    max-width: 100%;
    box-sizing: border-box;
}

*, *:before, *:after {
    box-sizing: border-box;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--parchment-bg);
    color: var(--text-primary);
    overflow-x: hidden;
    max-width: 100%;
    width: 100%;
    position: relative;
}

/* Hide scrollbars for clean touch-scrolling */
.scrollbar-none::-webkit-scrollbar {
    display: none;
}
.scrollbar-none {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Typography Script Classes */
.font-urdu {
    font-family: 'Noto Nastaliq Urdu', 'Gulzar', serif;
    line-height: 2.3 !important;
    letter-spacing: 0px;
}

.font-hindi {
    font-family: 'Noto Sans Devanagari', sans-serif;
    line-height: 1.8 !important;
}

.font-serif-global {
    font-family: 'Playfair Display', Georgia, serif;
}

/* Nastaliq Fine-tuning */
[dir="rtl"] {
    text-align: right;
}

/* Luxury Gold & Crimson Accents */
.gold-gradient-text {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 50%, #b45309 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.gold-border-glow {
    border: 1px solid rgba(217, 119, 6, 0.35);
    box-shadow: 0 4px 20px -2px rgba(217, 119, 6, 0.15);
}

.gold-ring-hover {
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border: 3px solid #d97706;
}
.gold-ring-hover:hover {
    border-color: #f59e0b;
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.5);
    transform: scale(1.05);
}

/* Interactive Dictionary Popover */
.dict-word {
    position: relative;
    border-bottom: 2px dotted #d97706;
    transition: all 0.2s ease;
    cursor: help;
}

.dict-word:hover, .dict-word:focus {
    background-color: rgba(217, 119, 6, 0.15);
    color: #b45309;
    border-bottom-color: #b45309;
    border-radius: 4px;
    padding: 0 4px;
}

#dict-popover {
    position: absolute;
    z-index: 1050;
    max-width: 330px;
    width: 90vw;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(217, 119, 6, 0.25);
    padding: 18px;
    opacity: 0;
    transform: translateY(10px) scale(0.95);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

#dict-popover.show {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Card Hover Elevation */
.global-card-hover {
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s ease;
}

.global-card-hover:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 35px -10px rgba(142, 27, 27, 0.12), 0 0 0 1px rgba(217, 119, 6, 0.3);
}

/* Book Cover 3D Illusion */
.book-cover-3d {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: -4px 6px 15px rgba(0, 0, 0, 0.25), inset 4px 0 6px rgba(255, 255, 255, 0.2);
}
.book-cover-3d:hover {
    transform: rotateY(-8deg) scale(1.03);
    box-shadow: -8px 12px 25px rgba(0, 0, 0, 0.35);
}

/* Poetry Line Rhythm */
.poetry-line {
    transition: background-color 0.2s, transform 0.2s;
    border-radius: 8px;
    padding: 3px 12px;
}
.poetry-line:hover {
    background-color: rgba(217, 119, 6, 0.08);
}

/* Bottom Audio Player Bar */
#global-audio-player {
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
#global-audio-player.hidden-player {
    transform: translateY(100%);
}

/* 3-Color Tiered Cards UI/UX Architecture */
.card-tier-container {
    background-color: #ffffff;
    border-radius: 1.5rem;
    border: 1px solid rgba(217, 119, 6, 0.22);
    box-shadow: 0 10px 25px -5px rgba(28, 25, 23, 0.08), 0 8px 10px -6px rgba(28, 25, 23, 0.04);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.card-tier-container:hover {
    transform: translateY(-6px);
    box-shadow: 0 25px 35px -10px rgba(110, 24, 24, 0.18), 0 0 0 1.5px rgba(217, 119, 6, 0.45);
}

/* Color 1: Card Header (Deep Velvet Crimson / Charcoal) */
.card-tier-header {
    background: linear-gradient(135deg, #2b1114 0%, #3e161c 50%, #200a0d 100%);
    color: #f5f5f4;
    padding: 1.1rem 1.4rem;
    border-bottom: 2px solid rgba(217, 119, 6, 0.35);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

/* Color 2: Card Body (Warm Vintage Parchment / Alabaster) */
.card-tier-body {
    background: linear-gradient(180deg, #fdfbf7 0%, #f7f2e8 100%);
    padding: 1.4rem 1.4rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
}
.card-tier-body::before {
    content: "صفحہ";
    position: absolute;
    right: 1rem;
    bottom: 0.5rem;
    font-family: 'Noto Nastaliq Urdu', serif;
    font-size: 5rem;
    color: rgba(217, 119, 6, 0.04);
    pointer-events: none;
    line-height: 1;
    user-select: none;
}

/* Color 3: Card Footer (Warm Sandstone / Gold-Tinted Slate) */
.card-tier-footer {
    background: linear-gradient(90deg, #eae4d8 0%, #e0d7c7 100%);
    padding: 0.85rem 1.4rem;
    border-top: 1px solid rgba(217, 119, 6, 0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #44403c;
}

/* ==========================================================================
   Mobile & Touch Screen Optimizations (Responsive Breakpoints)
   ========================================================================== */
@media (max-width: 640px) {
    /* Responsive Nastaliq & Hindi Typography */
    .font-urdu {
        line-height: 2.1 !important;
    }
    
    .font-hindi {
        line-height: 1.7 !important;
    }

    /* Card Padding Refinement on Small Screens */
    .card-tier-header {
        padding: 0.85rem 1rem;
    }
    .card-tier-body {
        padding: 1rem 1rem;
    }
    .card-tier-footer {
        padding: 0.75rem 1rem;
    }

    /* Mobile Dictionary Bottom-Sheet Modal */
    #dict-popover {
        position: fixed !important;
        bottom: 16px !important;
        left: 50% !important;
        top: auto !important;
        transform: translate(-50%, 20px) scale(0.95) !important;
        width: 92vw !important;
        max-width: 400px !important;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(217, 119, 6, 0.4) !important;
        z-index: 9999 !important;
    }
    
    #dict-popover.show {
        transform: translate(-50%, 0) scale(1) !important;
    }

    /* Mobile Audio Player Drawer */
    #global-audio-player {
        padding: 0.6rem 0.8rem;
    }
    #global-audio-player .max-w-7xl {
        gap: 0.5rem;
    }

    /* Quote Card Generator Canvas */
    #card-canvas {
        max-height: 48vh !important;
        max-width: 100% !important;
    }

    /* Prevent horizontal page shifting */
    article, .script-container {
        word-break: break-word;
        overflow-wrap: break-word;
    }

    /* Touch-friendly buttons (minimum 40px target height) */
    button, a.btn, select, input[type="text"], input[type="email"], textarea {
        touch-action: manipulation;
    }
}

/* Progressive Batch Lazy-Scroll Transitions */
.progressive-item-hidden {
    display: none !important;
}

.progressive-item {
    will-change: opacity, transform;
}



