@import url('https://fonts.cdnfonts.com/css/sf-pro-display');

/* =========================================================================
   ALETHEIA - PREMIUM GLASSMORPHIC ACADEMIC DESIGN
   ========================================================================= */

@font-face {
    font-family: 'KFGQPC Uthmanic Script Ver18';
    src: url('https://verses.quran.foundation/fonts/quran/hafs/uthmanic_hafs/UthmanicHafs1Ver18.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

:root {
    --bg-main: #060709;
    --bg-panel: rgba(18, 20, 26, 0.65);
    --bg-hover: rgba(255, 255, 255, 0.05);
    
    --border-light: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.16);
    
    --text-primary: #f8fafc;     /* Slate-50 */
    --text-secondary: #cbd5e1;   /* Slate-300 */
    --text-tertiary: #94a3b8;    /* Slate-400 */
    
    --accent: #34d399;           /* Propagated active religion color (default Islam) */
    --accent-dim: rgba(52, 211, 153, 0.1);
    --accent-border: rgba(52, 211, 153, 0.25);
    --orb-color: rgba(52, 211, 153, 0.05);
    
    --font-heading: 'SF Pro Display', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-ui: 'SF Pro Display', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-arabic: 'KFGQPC Uthmanic Script Ver18', 'Amiri', 'Traditional Arabic', serif;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.5);
    --shadow-hover: 0 20px 50px rgba(0, 0, 0, 0.7);
    
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Global Styles ── */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-weight: 700; /* Apple Bold UI text default */
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Ensure all form elements, buttons, and options inherit SF Pro Display Bold */
input, select, button, textarea, option {
    font-family: var(--font-ui);
    font-weight: 700;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    border: 2px solid var(--bg-main);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* Focus states */
*:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
}

/* ── Background Elements (Floating Glassmorphism Orbs) ── */
.bg-layer {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: -2;
    pointer-events: none;
    overflow: hidden;
}

.bg-grain {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: url('data:image/svg+xml,%3Csvg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"%3E%3Cfilter id="noiseFilter"%3E%3CfeTurbulence type="fractalNoise" baseFrequency="0.65" numOctaves="3" stitchTiles="stitch"/%3E%3C/filter%3E%3Crect width="100%25" height="100%25" filter="url(%23noiseFilter)"/%3E%3C/svg%3E');
    opacity: 0.02;
    z-index: 1;
}

.bg-gradient {
    position: absolute;
    top: -20%; left: -20%; right: -20%; bottom: -20%;
    background: radial-gradient(circle at 50% 30%, var(--orb-color) 0%, transparent 60%);
    transition: background 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.8;
}

#particles {
    display: block;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    z-index: 0;
}

/* ── Header ── */
.header {
    position: sticky;
    top: 0;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom: none;
    z-index: 100;
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.25rem 2.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    min-height: 2.2rem;
}

.logo-group {
    display: flex;
    align-items: center;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
}

.logo-mark {
    width: 2.2rem;
    height: 2.2rem;
    display: inline-block;
    stroke: currentColor;
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    color: var(--accent);
    filter: drop-shadow(0 0 8px var(--accent-dim));
    transition: transform 0.3s ease;
}
.header.scrolled .logo-mark {
    transform: scale(0.7);
}

.header-meta {
    display: flex;
    gap: 1rem;
    transition: opacity 0.3s ease, visibility 0.3s;
    margin-left: auto;
}

.header.scrolled .header-meta {
    opacity: 0;
    visibility: hidden;
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

.header-pill {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    padding: 0.45rem 1rem;
    border-radius: 999px;
    background: var(--accent-dim);
    color: var(--accent);
    border: 1px solid var(--accent-border);
    box-shadow: 0 2px 10px var(--accent-dim);
    transition: var(--transition);
}

.header-pill--dim {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
    box-shadow: none;
}

/* ── Main Layout ── */
.main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 4rem 2.5rem 6rem;
    display: grid;
    grid-template-columns: 320px 1fr;
    grid-template-areas: 
        "hero hero"
        "sidebar results";
    gap: 3rem;
}

/* ── Hero ── */
.hero {
    grid-area: hero;
    text-align: center;
    max-width: 800px;
    margin: 0 auto 3rem;
    justify-self: center;
}

.hero-title {
    font-family: var(--font-heading);
    font-size: 5.5rem;
    line-height: 1;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-weight: 700; /* Bold */
    text-transform: lowercase;
}

.hero-pronunciation {
    font-family: var(--font-heading);
    font-size: 1.85rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    letter-spacing: 0.02em;
}

.hero-pronunciation em {
    font-family: var(--font-heading);
    font-style: italic;
    color: var(--text-tertiary);
    font-weight: 700; /* Bold */
}

.hero-desc {
    font-family: var(--font-heading);
    font-size: 1.65rem;
    color: var(--text-secondary);
    line-height: 1.5;
    font-weight: 700; /* Bold Description */
}

/* ── Sidebar selectors ── */
.sidebar {
    grid-area: sidebar;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    align-self: start;
    position: sticky;
    top: 6.5rem;
    max-height: calc(100vh - 8rem);
    overflow-y: auto;
}

/* ── Panels ── */
.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 2rem;
    backdrop-filter: blur(12px) saturate(160%);
    -webkit-backdrop-filter: blur(12px) saturate(160%);
}

.panel-header {
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-light);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.panel-label {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    color: var(--text-primary);
    font-weight: 700;
}

/* ── Scripture Selector (Tabs) ── */
.scripture-tabs {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.scripture-tab {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid rgba(255, 255, 255, 0.04);
    padding: 1.25rem;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 1.25rem;
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
    position: relative;
    overflow: hidden;
    color: var(--text-secondary);
    outline: none;
}

.scripture-tab:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.08);
}

.scripture-tab.active {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--text-primary);
    box-shadow: 0 4px 24px -4px var(--accent-dim);
}

.tab-indicator {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent);
    opacity: 0;
    transition: var(--transition);
}

.scripture-tab.active .tab-indicator {
    opacity: 1;
}

.tab-symbol {
    width: 2rem;
    height: 2rem;
    display: inline-block;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    color: var(--accent);
    filter: drop-shadow(0 0 8px var(--accent-dim));
    opacity: 0.8;
}

.tab-text {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.tab-name {
    font-family: var(--font-heading);
    font-size: 1.45rem;
    color: var(--text-primary);
}

.tab-sub {
    font-size: 0.85rem;
    color: var(--text-tertiary);
}

.tab-count {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    min-width: 2rem;
    text-align: center;
}

/* ── Category Selector ── */
.category-selector-container {
    width: 100%;
    margin-top: 1rem;
}

.category-nav {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.cat-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.cat-group-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    color: var(--text-tertiary);
    min-width: 70px;
}

.cat-chip {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 0.5rem 1rem;
    border-radius: 999px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-family: var(--font-ui);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-secondary);
    transition: var(--transition);
    outline: none;
    width: auto;
}

.cat-chip:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.12);
}

.cat-chip.active {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--text-primary);
    box-shadow: 0 2px 12px -2px var(--accent-dim);
}

.cat-chip-icon {
    width: 1.25rem;
    height: 1.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}
.cat-chip-icon svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Vector icon formatting resets */
.stats-icon {
    width: 0.95rem;
    height: 0.95rem;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.copy-icon {
    width: 1rem;
    height: 1rem;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.empty-state-icon {
    width: 4.5rem;
    height: 4.5rem;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    margin-bottom: 1.5rem;
    opacity: 0.7;
    filter: drop-shadow(0 0 8px var(--accent-dim));
}

.cat-chip:hover .cat-chip-icon {
    transform: scale(1.15);
}

.cat-chip:active {
    transform: scale(0.98);
}

.cat-chip-name {
    font-weight: 700;
}

.cat-chip-count {
    font-size: 0.7rem;
    opacity: 0.6;
    background: rgba(255, 255, 255, 0.06);
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
}

.mobile-category-dropdown {
    display: none;
}

.mobile-category-dropdown select {
    width: 100%;
    padding: 0.9rem 2.5rem 0.9rem 1.25rem;
    font-size: 1rem;
    font-family: var(--font-ui);
    border-radius: var(--radius-sm);
    background: #12141a url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23cbd5e1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 1rem center;
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    transition: var(--transition);
}

.mobile-category-dropdown select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-border);
}

/* ── Results Container (Controls panel + cards layout) ── */
.results-panel {
    grid-area: results;
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.results-controls-panel {
    padding: 3rem;
}

.results-header {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-bottom: 2.5rem;
}

.results-header-info {
    margin-bottom: 0;
}

.results-title {
    font-family: var(--font-heading);
    font-size: 3.5rem;
    font-weight: 700; /* Bold results title */
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.results-subtitle {
    font-size: 1.15rem;
    color: var(--text-secondary);
}



/* ── Stats Text Container ── */
.stats-text-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    padding: 2rem 0;
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 3rem;
}

.stats-text-item {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid rgba(255, 255, 255, 0.04);
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: var(--transition);
}

.stats-text-item:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
}

.stats-text-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stats-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.stats-text-item .stat-num {
    font-weight: 700;
    color: var(--accent);
    font-size: 1.15rem;
    text-shadow: 0 0 10px var(--accent-dim);
}

.stats-bar-track {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 999px;
    overflow: hidden;
    margin-top: 0.25rem;
}

.stats-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent);
    border-radius: 999px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Text Type Switcher (Segmented Control) ── */
.text-type-switcher {
    display: inline-flex;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 0.3rem;
    gap: 0.25rem;
    margin-bottom: 2.5rem;
    position: relative;
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(8px);
}

.switcher-btn {
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 0.75rem 1.75rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    min-width: 180px;
    outline: none;
}

.switcher-btn:hover {
    background: var(--bg-hover);
}

.switcher-btn.active {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.06);
    box-shadow: var(--shadow-sm);
}

.switcher-btn-label {
    font-family: var(--font-ui);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
    transition: var(--transition);
}

.switcher-btn.active .switcher-btn-label {
    color: var(--accent);
}

.switcher-btn-sub {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-style: italic;
    color: var(--text-secondary);
    transition: var(--transition);
    margin-top: 0.2rem;
}

.switcher-btn.active .switcher-btn-sub {
    color: var(--text-primary);
}

/* ── Results Layout ── */
.results-layout {
    display: flex;
    flex-direction: column;
    gap: 4rem;
    opacity: 1;
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.results-layout.loading {
    opacity: 0;
}

.results-section {
    display: flex;
    flex-direction: column;
}

.section-title {
    font-family: var(--font-heading);
    font-size: 2.25rem;
    color: var(--text-primary);
    margin-bottom: 2rem;
    font-weight: 700; /* Bold section title */
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-light);
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 2rem;
}

/* ── Claim Card (Premium Design) ── */
.claim-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 2.5rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    
    /* Scroll Reveal Initial State */
    opacity: 0;
    transform: translateY(30px) scale(0.98);
    transition: opacity 1.2s cubic-bezier(0.16, 1, 0.3, 1), 
                transform 1.2s cubic-bezier(0.16, 1, 0.3, 1),
                border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.claim-card.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

@media (prefers-reduced-motion: reduce) {
    .claim-card {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
}

.claim-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    border-radius: var(--radius-md);
    box-shadow: inset 0 0 24px var(--accent-dim);
    border: 1px solid var(--accent);
    opacity: 0;
    transition: var(--transition);
    pointer-events: none;
}

.claim-card:hover {
    transform: translateY(-6px);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: var(--shadow-hover);
    /* Snappy 0.3s transition for hover states */
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.claim-card:hover::after {
    opacity: 0.35;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
}

.verse-ref {
    font-family: var(--font-heading);
    font-weight: 700; /* Bold verse reference */
    font-size: 1.6rem;
    color: var(--accent);
    text-shadow: 0 0 10px var(--accent-dim);
}

.category-tag {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    border: 1px solid var(--border-light);
}

/* Typography in Cards */
.card-original {
    padding: 0.75rem 0;
}

.script-rtl {
    direction: rtl;
    text-align: right;
}

.script-ltr {
    direction: ltr;
    text-align: left;
}

.quran-arabic {
    font-family: 'KFGQPC Uthmanic Script Ver18', 'KFGQPC Uthmanic Script HAFS', 'Amiri', serif;
    font-size: 1.95rem;
    line-height: 2.4; /* Large line-height prevents diacritics clipping */
    color: var(--text-primary);
}

.standard-arabic {
    font-family: 'Amiri', 'Traditional Arabic', serif;
    font-size: 2rem;
    line-height: 2.1;
    color: var(--text-primary);
}

.hebrew-text {
    font-family: 'Taamey David', 'Corsiva Hebrew', 'David', 'Georgia', serif;
    font-size: 1.85rem;
    line-height: 1.8;
    color: var(--text-primary);
}

.greek-text {
    font-family: 'Instrument Serif', 'Georgia', 'Times New Roman', serif;
    font-size: 1.9rem;
    line-height: 1.6;
    color: var(--text-primary);
    font-style: italic;
}

.card-translation {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    color: var(--text-secondary);
    font-style: italic;
    line-height: 1.5;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-light);
}

.card-conflict {
    font-family: var(--font-ui);
    font-size: 0.95rem;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.2);
    padding: 1.5rem;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
    margin-top: auto;
    line-height: 1.6;
}

/* ── Deep Dive Dialog ── */
dialog {
    margin: auto;
    border: none;
    background: transparent;
    padding: 0;
    max-width: 900px;
    width: 95%;
    
    /* Modern dialog exit & backdrop transitions */
    opacity: 0;
    transform: scale(0.95) translateY(15px);
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                overlay 0.3s allow-discrete,
                display 0.3s allow-discrete;
}

dialog[open] {
    opacity: 1;
    transform: scale(1) translateY(0);
}

@starting-style {
    dialog[open] {
        opacity: 0;
        transform: scale(0.95) translateY(15px);
    }
}

dialog::backdrop {
    background: rgba(6, 7, 9, 0);
    backdrop-filter: blur(0px) saturate(100%);
    transition: background-color 0.3s ease,
                backdrop-filter 0.3s ease,
                overlay 0.3s allow-discrete,
                display 0.3s allow-discrete;
}

dialog[open]::backdrop {
    background: rgba(6, 7, 9, 0.8);
    backdrop-filter: blur(12px) saturate(160%);
}

@starting-style {
    dialog[open]::backdrop {
        background: rgba(6, 7, 9, 0);
        backdrop-filter: blur(0px) saturate(100%);
    }
}

.dd-inner {
    background: rgba(18, 20, 26, 0.9);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 32px 64px -12px rgba(0, 0, 0, 0.6), 0 0 32px -4px var(--accent-dim);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(20px);
}

.dd-header {
    background: rgba(255, 255, 255, 0.01);
    padding: 2.5rem 3rem;
    border-bottom: 1px solid var(--border-light);
    position: relative;
}

.dd-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-light);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
    z-index: 10;
}

.dd-close:hover {
    background: var(--accent);
    color: var(--bg-main);
    border-color: var(--accent);
    box-shadow: 0 0 15px var(--accent);
}

.dd-badges {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.dd-badge {
    font-family: var(--font-ui);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    background: var(--accent-dim);
    border: 1px solid var(--accent-border);
    color: var(--accent);
}

.dd-badge--category {
    background: rgba(255, 255, 255, 0.03);
    border-color: var(--border-light);
    color: var(--text-tertiary);
}

.dd-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.dd-title {
    font-family: var(--font-heading);
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
}

.dd-copy-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-light);
    padding: 0.55rem 1.25rem;
    border-radius: 999px;
    color: var(--text-secondary);
    font-family: var(--font-ui);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.dd-copy-btn:hover {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--text-primary);
    box-shadow: 0 0 15px var(--accent-dim);
}

.dd-body {
    padding: 3rem;
    max-height: 70vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.dd-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--accent);
    margin-bottom: 1.25rem;
    font-weight: 700;
    text-shadow: 0 0 10px var(--accent-dim);
}

.dd-quote {
    background: rgba(0, 0, 0, 0.15);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    border-left: 4px solid var(--accent);
    padding: 2.5rem;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.3);
}

/* Modal formatted original text and translation */
.modal-original {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.modal-translation {
    font-family: var(--font-heading);
    font-size: 1.65rem;
    color: var(--text-secondary);
    font-style: italic;
    line-height: 1.6;
    direction: ltr;
    text-align: left;
}

.dd-conflict {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.2);
    padding: 2rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.3);
}

.dd-proof {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-secondary);
}

.dd-proof p {
    margin-bottom: 1.5rem;
}

.dd-sources {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.dd-source-link {
    display: flex;
    align-items: center;
    padding: 1.1rem 1.5rem;
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 700;
    transition: var(--transition);
}

.dd-source-link:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    box-shadow: var(--shadow-sm);
    transform: translateX(4px);
    color: var(--accent);
}

/* Media Gallery inside Dialogue */
.dd-media {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.dd-media-item {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.dd-media-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-bottom: 1px solid var(--border-light);
}

.dd-media-caption {
    padding: 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: center;
}

.dd-media-fallback {
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-tertiary);
    font-size: 0.85rem;
    text-align: center;
    padding: 1rem;
}

/* ── Loader ── */
.loader {
    display: none;
    text-align: center;
    padding: 6rem 2rem;
}

.loader-ring {
    width: 45px;
    height: 45px;
    border: 3px solid rgba(255, 255, 255, 0.05);
    border-top: 3px solid var(--accent);
    border-radius: 50%;
    animation: spin 0.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    box-shadow: 0 0 15px var(--accent-dim);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loader-text {
    margin-top: 1rem;
    color: var(--text-secondary);
    font-style: italic;
    font-size: 0.95rem;
}

/* ── Empty State ── */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 6rem 2rem;
    background: rgba(255, 255, 255, 0.01);
    border: 1px dashed rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
}

.empty-state-icon {
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
    opacity: 0.7;
    filter: drop-shadow(0 0 8px var(--accent-dim));
}

.empty-state h3 {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.empty-state p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* ── Footer ── */
.footer {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-tertiary);
    font-size: 0.85rem;
    border-top: 1px solid var(--border-light);
    background: rgba(6, 7, 9, 0.95);
}

/* ── Responsiveness ── */
@media (max-width: 1024px) {
    .main {
        grid-template-columns: 1fr;
        grid-template-areas: 
            "hero"
            "sidebar"
            "results";
        gap: 2rem;
        padding: 2.5rem 5vw;
        box-sizing: border-box;
    }
    
    .sidebar {
        position: static;
        width: 100%;
        flex-direction: row;
        align-items: stretch;
    }
    
    .sidebar .panel {
        flex: 1;
        margin: 0;
    }
    
    .hero-title {
        font-size: 3.5rem;
    }
}

@media (max-width: 768px) {
    /* Performance Optimization: Disable backdrop filters on mobile and use solid backgrounds */
    .header {
        background: transparent !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        border-bottom: none !important;
    }

    .header-inner {
        padding: 1rem 5vw;
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        box-sizing: border-box;
    }

    .header-meta {
        display: none !important;
    }

    .panel {
        background: #12141a !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        padding: 1.25rem !important; /* Compact panel padding for mobile */
    }



    .main {
        padding: 1rem 5vw;
        box-sizing: border-box;
    }

    .hero {
        margin-bottom: 2rem !important;
    }

    .hero-title {
        font-size: 3.5rem !important;
    }

    .hero-pronunciation {
        font-size: 1.45rem !important;
        margin-bottom: 1rem !important;
    }

    .hero-desc {
        font-size: 1.35rem !important;
        line-height: 1.5 !important;
    }

    .sidebar {
        flex-direction: column;
        gap: 1rem;
        position: static;
        padding-top: 1rem;
    }

    .desktop-only {
        display: none !important;
    }

    .mobile-category-dropdown {
        display: block;
        width: 100%;
    }

    .mobile-category-dropdown select {
        width: 100%;
        padding: 0.9rem 2.5rem 0.9rem 1.25rem;
        font-size: 0.95rem;
        font-family: var(--font-ui);
        border-radius: var(--radius-sm);
        background: #12141a url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23cbd5e1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 1rem center;
        border: 1px solid var(--border-light);
        color: var(--text-primary);
        outline: none;
        appearance: none;
        -webkit-appearance: none;
        cursor: pointer;
        transition: var(--transition);
    }

    .mobile-category-dropdown select:focus {
        border-color: var(--accent);
        box-shadow: 0 0 0 2px var(--accent-border);
    }

    .scripture-tabs {
        gap: 0.25rem;
    }

    .scripture-tab {
        padding: 0.5rem;
        flex-direction: column;
        align-items: center;
        gap: 0.25rem;
    }

    .tab-symbol {
        width: 1.5rem;
        height: 1.5rem;
    }

    .tab-name {
        font-size: 0.8rem;
    }

    .tab-sub, .tab-count {
        display: none;
    }

    /* Stats container: 2 columns layout on mobile */
    .stats-text-container {
        grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)) !important;
        gap: 0.75rem !important;
        padding: 1.25rem 0 !important;
        margin-bottom: 2rem !important;
    }

    .stats-text-item {
        padding: 0.85rem 1rem !important;
        gap: 0.25rem !important;
    }

    .stats-label {
        font-size: 0.7rem !important;
    }

    .stats-text-item .stat-num {
        font-size: 1rem !important;
    }

    /* Segmented switch control: full width and responsive buttons */
    .text-type-switcher {
        width: 100% !important;
        display: flex !important;
        box-sizing: border-box !important;
        background: rgba(0, 0, 0, 0.3) !important;
        margin-bottom: 2rem !important;
    }

    .switcher-btn {
        flex: 1 !important;
        min-width: 0 !important;
        padding: 0.65rem 0.5rem !important;
    }

    .switcher-btn-sub {
        font-size: 1.1rem !important;
    }

    .category-list {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 0.5rem;
        gap: 0.5rem;
        scrollbar-width: none;
    }

    .category-list::-webkit-scrollbar {
        display: none;
    }

    .category-btn {
        white-space: nowrap;
        flex-shrink: 0;
        padding: 0.75rem 1rem;
    }
    
    .results-panel {
        padding: 0 !important;
        gap: 1.5rem !important;
    }
    
    .results-title {
        font-size: 2.25rem !important;
    }

    .results-grid {
        grid-template-columns: 1fr !important;
        gap: 1.25rem !important;
    }

    .claim-card {
        padding: 1.25rem !important;
        gap: 1rem !important;
    }

    .card-translation {
        font-size: 1.35rem !important;
        padding-top: 1rem !important;
    }

    .quran-arabic {
        font-size: 1.6rem !important;
        line-height: 2.2 !important;
    }

    .standard-arabic {
        font-size: 1.65rem !important;
        line-height: 2.0 !important;
    }

    .hebrew-text {
        font-size: 1.5rem !important;
        line-height: 1.6 !important;
    }

    .greek-text {
        font-size: 1.55rem !important;
        line-height: 1.4 !important;
    }

    /* Dialog styling for mobile */
    dialog[open]::backdrop {
        background: rgba(6, 7, 9, 0.95) !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    .dd-inner {
        background: #12141a !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    .dd-header {
        padding: 1.5rem !important;
    }

    .dd-body {
        padding: 1.5rem !important;
        gap: 2rem !important;
    }

    .dd-title {
        font-size: 2.25rem !important;
    }

    .dd-quote {
        padding: 1.5rem !important;
    }



    .modal-translation {
        font-size: 1.35rem !important;
    }

    .dd-conflict, .dd-proof {
        font-size: 0.95rem !important;
        line-height: 1.6 !important;
    }

    .dd-conflict {
        padding: 1.25rem !important;
    }

    .dd-media {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
}
