/* ==========================================================================
   QURAN MODULE STYLES
   Uses the site's existing design tokens (--gold, --cream, --charcoal, etc.)
   defined globally in assets/css/style.css -- no colors are redefined here.
   ========================================================================== */

/* Authentic Uthmani Mushaf script, officially licensed by the King Fahd
   Quran Printing Complex -- the same style used by quran.com, myislam.org,
   and most major Quran platforms. Served via jsDelivr from the archived
   qpc-fonts repository. */
@font-face {
    font-family: 'Uthman Hafs';
    src: url('https://cdn.jsdelivr.net/gh/quranwbw/qpc-fonts@master/various-woff2/UthmanicHafs1%20Ver09.woff2') format('woff2'),
         url('https://cdn.jsdelivr.net/gh/quranwbw/qpc-fonts@master/various-woff/UthmanicHafs1%20Ver09.woff') format('woff');
    font-display: swap;
}

:root {
    --quran-font-scale: 1;
}

/* ---- Controls bar (font size / dark mode) ---- */
.controls-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}
.control-btn {
    padding: 8px 18px;
    border-radius: 50px;
    border: 2px solid var(--gold);
    background: transparent;
    color: var(--gold);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: var(--transition);
}
.control-btn:hover {
    background: var(--gold);
    color: #fff;
}

/* ---- Hero sections (match .about-hero pattern: 160px top clears fixed navbar) ---- */
.quran-hero,
.quran-read-hero {
    padding: 160px 0 40px;
    background: linear-gradient(135deg, var(--cream) 0%, var(--beige) 60%, rgba(212, 180, 131, 0.3) 100%);
    text-align: center;
    position: relative;
    overflow: hidden;
}
.quran-hero::before,
.quran-read-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.06;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%238B6B4A' fill-opacity='1'%3E%3Cpath d='M30 0l8.66 5v10L30 20l-8.66-5V5zm0 40l8.66 5v10L30 60l-8.66-5V45z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.quran-hero .container,
.quran-read-hero .container {
    position: relative;
    z-index: 2;
}
.quran-list-section,
.quran-read-section {
    padding: 60px 0 80px;
    background: var(--white);
}

.back-link {
    display: inline-block;
    margin-bottom: 16px;
    color: var(--gold);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
}
.back-link:hover { text-decoration: underline; }

/* ---- Surah list grid ---- */
.surah-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}
.surah-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    background: var(--white);
    border: 1px solid rgba(212, 180, 131, 0.3);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--charcoal);
    box-shadow: var(--shadow);
    transition: var(--transition);
}
.surah-list a:hover {
    transform: translateY(-2px);
    border-color: var(--gold);
    box-shadow: 0 8px 32px rgba(139, 107, 74, 0.18);
}
.surah-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px; height: 32px;
    border-radius: 50%;
    background: rgba(201, 162, 39, 0.12);
    border: 1px solid rgba(201, 162, 39, 0.4);
    color: var(--gold);
    font-size: 12px;
    font-weight: 700;
    margin-right: 12px;
    flex-shrink: 0;
}
.surah-info { flex: 1; }
.surah-name { font-weight: 600; font-size: 14px; color: var(--charcoal); }
.surah-meta { font-size: 12px; color: #9ca3af; }
.surah-arabic {
    font-family: 'Amiri', serif;
    font-size: 19px;
    color: var(--gold);
    margin-left: 8px;
}

/* ---- Read page ---- */
.quran-wrap {
    max-width: 820px;
    margin: 0 auto;
}
.surah-title h1 {
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.75rem, 4vw, 2.4rem);
    margin: 8px 0 4px;
    color: var(--charcoal);
}
.surah-title-arabic {
    font-family: 'Amiri', serif;
    color: var(--gold);
    margin-left: 10px;
}
.surah-title p { color: #6b7280; margin: 0; }

.bismillah {
    text-align: center;
    font-family: 'Amiri', serif;
    font-size: 28px;
    color: var(--gold);
    background: rgba(201, 162, 39, 0.08);
    border: 1px solid rgba(201, 162, 39, 0.25);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 24px;
    direction: rtl;
}

.verse-card {
    background: var(--white);
    border: 1px solid rgba(212, 180, 131, 0.25);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 22px;
    margin-bottom: 16px;
    scroll-margin-top: 100px;
}
.verse-card:target {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.25), var(--shadow);
}
.verse-num-row {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.verse-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border-radius: 17px;
    background: #fff;
    border: 1px solid rgba(212, 180, 131, 0.4);
    color: var(--gold);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    -webkit-tap-highlight-color: rgba(201, 162, 39, 0.3);
    touch-action: manipulation;
}
.verse-icon-btn.bookmarked {
    background: var(--gold);
    color: #fff;
}
.verse-icon-btn:hover {
    background: var(--gold);
    color: #fff;
}
.verse-icon-btn.playing {
    background: var(--gold);
    color: #fff;
}
.verse-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px; height: 30px;
    border-radius: 50%;
    background: rgba(201, 162, 39, 0.12);
    border: 1px solid rgba(201, 162, 39, 0.4);
    color: var(--gold);
    font-size: 12px;
    font-weight: 700;
}
.arabic-text {
    font-family: 'Amiri', 'Uthman Hafs', 'Noto Naskh Arabic', serif;
    font-size: calc(30px * var(--quran-font-scale)) !important;
    line-height: 2.1;
    text-align: center;
    direction: rtl;
    margin-bottom: 16px;
    color: var(--charcoal);
}
.transliteration-line {
    font-family: 'Inter', sans-serif;
    font-size: calc(13px * var(--quran-font-scale));
    font-style: italic;
    color: #a58a5a;
    text-align: center;
    margin-bottom: 16px;
    line-height: 1.6;
}
.verse-divider {
    height: 1px;
    background: rgba(212, 180, 131, 0.3);
    margin-bottom: 16px;
}
.translation-text {
    font-family: 'Inter', sans-serif;
    font-size: calc(15px * var(--quran-font-scale)) !important;
    line-height: 1.7;
    color: #4b5563;
    font-style: italic;
}
.translation-text.urdu-text {
    direction: rtl;
    text-align: right;
    font-family: 'Noto Nastaliq Urdu', serif;
    font-style: normal;
    font-size: calc(20px * var(--quran-font-scale)) !important;
    line-height: 2.3;
    color: var(--charcoal);
}
.credit-text {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 8px;
    text-align: right;
}

.surah-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 28px;
}
.surah-nav a {
    padding: 10px 22px;
    background: linear-gradient(135deg, var(--gold), #e6b830);
    color: #fff;
    text-decoration: none;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 4px 20px rgba(201, 162, 39, 0.35);
    transition: var(--transition);
}
.surah-nav a:hover:not(.disabled) {
    transform: translateY(-2px);
}
.surah-nav a.disabled {
    background: #e5e7eb;
    color: #9ca3af;
    box-shadow: none;
    pointer-events: none;
}

/* ---- Audio player ---- */
.audio-player {
    margin-bottom: 24px;
    padding: 16px 18px;
    background: var(--cream);
    border: 1px solid rgba(212, 180, 131, 0.3);
    border-radius: var(--radius);
}
.reciter-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--charcoal);
    margin-right: 8px;
}
.reciter-select {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(212, 180, 131, 0.4);
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    background: #fff;
    color: var(--charcoal);
}

/* ---- Translation tabs ---- */
.translation-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.trans-tab {
    padding: 8px 16px;
    border-radius: 50px;
    border: 1px solid rgba(212, 180, 131, 0.4);
    background: #fff;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    color: #6b7280;
    transition: var(--transition);
}
.trans-tab.active {
    background: linear-gradient(135deg, var(--gold), #e6b830);
    color: #fff;
    border-color: var(--gold);
    box-shadow: 0 4px 14px rgba(201, 162, 39, 0.3);
}

/* ---- Tafsir ---- */
.tafsir-toggle-btn {
    margin-top: 14px;
    padding: 7px 16px;
    border-radius: 50px;
    border: 2px solid var(--gold);
    background: transparent;
    color: var(--gold);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}
.tafsir-toggle-btn:hover {
    background: var(--gold);
    color: #fff;
}
.tafsir-box {
    margin-top: 14px;
    padding: 16px 18px;
    background: var(--cream);
    border: 1px solid rgba(212, 180, 131, 0.3);
    border-radius: var(--radius);
}
.tafsir-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 14px;
    border-bottom: 1px solid rgba(212, 180, 131, 0.3);
    padding-bottom: 12px;
}
.tafsir-tab {
    padding: 6px 14px;
    border-radius: 50px;
    border: 1px solid rgba(212, 180, 131, 0.4);
    background: #fff;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    color: #6b7280;
}
.tafsir-tab.active {
    background: var(--gold);
    color: #fff;
    border-color: var(--gold);
}
.tafsir-group-note {
    font-size: 12px;
    color: #9ca3af;
    font-style: italic;
    margin-bottom: 10px;
}
.tafsir-content {
    font-size: 14px;
    line-height: 1.8;
    color: #4b5563;
}
.tafsir-content h4 {
    font-family: 'Playfair Display', serif;
    font-size: 15px;
    margin: 12px 0 6px;
    color: var(--gold);
}
.tafsir-content p {
    margin: 0 0 12px;
}
.tafsir-unavailable {
    margin-top: 14px;
    font-size: 12px;
    color: #9ca3af;
    font-style: italic;
}

/* ==========================================================================
   DARK MODE (opt-in toggle, unique to the Quran reader)
   Kept in the same warm gold/charcoal family as the site brand,
   rather than a generic blue-gray dark theme.
   ========================================================================== */
html[data-theme="dark"] body {
    background: #1c1a17;
    color: #e8e3da;
}
html[data-theme="dark"] .quran-hero,
html[data-theme="dark"] .quran-read-hero {
    background: linear-gradient(135deg, #22201c 0%, #1c1a17 100%);
}
html[data-theme="dark"] .quran-list-section,
html[data-theme="dark"] .quran-read-section {
    background: #1c1a17;
}
html[data-theme="dark"] .section-header h2,
html[data-theme="dark"] .surah-title h1,
html[data-theme="dark"] .quran-hero h1 {
    color: var(--gold-light);
}
html[data-theme="dark"] .surah-list a,
html[data-theme="dark"] .verse-card,
html[data-theme="dark"] .audio-player,
html[data-theme="dark"] .bismillah,
html[data-theme="dark"] .tafsir-box {
    background: #26231e;
    border-color: rgba(212, 180, 131, 0.2);
}
html[data-theme="dark"] .arabic-text,
html[data-theme="dark"] .surah-name,
html[data-theme="dark"] .translation-text.urdu-text {
    color: #f0ebe1;
}
html[data-theme="dark"] .translation-text {
    color: #c9c2b4;
}
html[data-theme="dark"] .transliteration-line {
    color: #b39b6b;
}
html[data-theme="dark"] .surah-meta,
html[data-theme="dark"] .credit-text,
html[data-theme="dark"] .surah-title p,
html[data-theme="dark"] .tafsir-group-note,
html[data-theme="dark"] .tafsir-unavailable {
    color: #9c9284;
}
html[data-theme="dark"] .control-btn,
html[data-theme="dark"] .trans-tab,
html[data-theme="dark"] .tafsir-tab,
html[data-theme="dark"] .reciter-select {
    background: #26231e;
    border-color: rgba(212, 180, 131, 0.25);
    color: #c9c2b4;
}
html[data-theme="dark"] .trans-tab.active,
html[data-theme="dark"] .tafsir-tab.active {
    background: var(--gold);
    color: #1c1a17;
    border-color: var(--gold);
}
html[data-theme="dark"] .tafsir-content {
    color: #c9c2b4;
}

/* Dark mode also needs to fix the SHARED navbar, since it has no
   background until scrolled and its text/logo colors assume a light
   page behind it. Only applied while data-theme="dark" is active,
   so the rest of the site is completely unaffected. */
html[data-theme="dark"] .nav-logo {
    color: #f0ebe1;
}
html[data-theme="dark"] .nav-links a {
    color: #c9c2b4;
}
html[data-theme="dark"] .navbar.scrolled {
    background: rgba(28, 26, 23, 0.95);
}
html[data-theme="dark"] .nav-icon-btn {
    color: #c9c2b4;
}
html[data-theme="dark"] .hamburger span {
    background: #f0ebe1;
}
