:root {
    --bg: #0a0c0b;
    --bg2: #0f1210;
    --bg3: #141a16;
    --surface: #1a2219;
    --surface2: #1f2b1e;
    --gold: #c9a84c;
    --gold-dim: #8a6f2e;
    --gold-pale: #e8d49a;
    --green: #3a7d44;
    --green-soft: #2d5c35;
    --green-pale: #a8c5ac;
    --text: #e8e4dc;
    --text-dim: #8a8680;
    --text-muted: #4a4844;
    --border: #222e22;
    --border-gold: #3a2e14;
    --white: #f5f2eb;
    --transition: 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  }

  [data-theme="light"] {
    --bg: #f5f2eb;
    --bg2: #eee9df;
    --bg3: #e8e3d8;
    --surface: #ede8dd;
    --surface2: #e4dfd4;
    --gold: #8a6f2e;
    --gold-dim: #b8952c;
    --gold-pale: #5a4510;
    --green: #2d6b36;
    --green-soft: #3a7d44;
    --green-pale: #1a4020;
    --text: #1a1a18;
    --text-dim: #5a5650;
    --text-muted: #9a9690;
    --border: #d8d2c4;
    --border-gold: #c8b882;
    --white: #1a1a18;
  }

  * { margin: 0; padding: 0; box-sizing: border-box; }

  html { scroll-behavior: smooth; }

  body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
    transition: background var(--transition), color var(--transition);
  }

  /* ── PRELOADER ── */
  #preloader {
    position: fixed; inset: 0; z-index: 9999;
    background: #060807;
    display: flex; align-items: center; justify-content: center;
    transition: opacity 0.9s ease;
  }

  #preloader.fade-out { opacity: 0; pointer-events: none; }

  #preloader::after {
    content: '';
    position: absolute; inset: 0;
    background: radial-gradient(ellipse 55% 45% at 50% 50%, rgba(201,168,76,0.055) 0%, transparent 68%);
    pointer-events: none;
    z-index: 1;
  }

  #preloader canvas {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    opacity: 0.18;
  }

  .pl-content {
    position: relative; z-index: 2;
    display: flex; flex-direction: column;
    align-items: center; gap: 28px;
  }

  .pl-ring {
    width: 140px; height: 140px; position: relative;
  }

  .pl-ring svg {
    position: absolute; top: 0; left: 0;
    width: 140px; height: 140px;
  }

  .ring-bg   { fill:none; stroke:rgba(201,168,76,0.1); stroke-width:1; }
  .ring-draw {
    fill:none; stroke:#c9a84c; stroke-width:1.2; stroke-linecap:round;
    stroke-dasharray:408; stroke-dashoffset:408;
    animation: plDrawRing 1.6s cubic-bezier(.4,0,.2,1) .2s forwards;
  }
  .ring-i-bg { fill:none; stroke:rgba(201,168,76,0.07); stroke-width:.6; }
  .ring-i-dr {
    fill:none; stroke:rgba(201,168,76,0.45); stroke-width:.6;
    stroke-dasharray:283; stroke-dashoffset:283;
    animation: plDrawRing 1.2s cubic-bezier(.4,0,.2,1) .8s forwards;
  }

  @keyframes plDrawRing { to { stroke-dashoffset: 0; } }

  .moon-g { opacity:0; animation: plFadeIn .7s ease 1.5s forwards; }

  .moon-path {
    stroke-dasharray: 260; stroke-dashoffset: 260;
    animation: plDrawMoon 1.1s cubic-bezier(.3,0,.1,1) 1.6s forwards;
  }
  @keyframes plDrawMoon { to { stroke-dashoffset: 0; } }

  .pl-arabic {
    font-family: 'Scheherazade New', 'Georgia', serif;
    font-size: 34px; color: #c9a84c;
    letter-spacing: .04em; opacity: 0;
    animation: plRiseIn .8s ease 2.4s forwards;
    text-align: center; line-height: 1;
  }

  .pl-label-name {
    font-family: 'Georgia', serif;
    font-size: 11px; letter-spacing: .52em;
    color: rgba(201,168,76,.45); text-transform: uppercase;
    opacity: 0; animation: plRiseIn .7s ease 2.8s forwards;
    text-align: center;
  }

  @keyframes plRiseIn {
    from { opacity:0; transform:translateY(8px); }
    to   { opacity:1; transform:translateY(0); }
  }

  @keyframes plFadeIn { to { opacity: 1; } }

  .pl-bar-wrap {
    width: 120px; height: 1px;
    background: rgba(201,168,76,.12);
    position: relative; overflow: hidden;
    opacity: 0; animation: plFadeIn .4s ease 3s forwards;
  }

  .pl-bar {
    position: absolute; top: 0; left: 0; height: 100%; width: 0%;
    background: linear-gradient(to right, transparent, #c9a84c, transparent);
    animation: plBarFill 2.6s ease .4s forwards;
  }
  @keyframes plBarFill { to { width: 100%; } }

  .pl-sub-label {
    font-family: 'Georgia', serif;
    font-size: 9px; letter-spacing: .35em;
    color: rgba(90,88,84,1); text-transform: uppercase;
    opacity: 0; animation: plRiseIn .6s ease 3.1s forwards;
    text-align: center; margin-top: -18px;
  }

  .pl-dots { display:flex; gap:8px; opacity:0; animation: plFadeIn .4s ease 3.2s forwards; }
  .pl-dot  {
    width:3px; height:3px; border-radius:50%;
    background:rgba(201,168,76,.4);
    animation: plDotPulse 1.5s ease-in-out infinite;
  }
  .pl-dot:nth-child(1){animation-delay:3.2s}
  .pl-dot:nth-child(2){animation-delay:3.4s}
  .pl-dot:nth-child(3){animation-delay:3.6s}
  @keyframes plDotPulse {
    0%,100%{background:rgba(201,168,76,.2);transform:scale(1)}
    50%    {background:rgba(201,168,76,.9);transform:scale(1.4)}
  }

  /* ── NAV ── */
  nav {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    padding: 0 40px;
    height: 64px;
    display: flex; align-items: center; justify-content: space-between;
    background: transparent;
    transition: background 0.4s ease, backdrop-filter 0.4s ease;
    border-bottom: 1px solid transparent;
  }

  nav.scrolled {
    background: rgba(10,12,11,0.88);
    backdrop-filter: blur(20px);
    border-bottom-color: var(--border);
  }

  [data-theme="light"] nav.scrolled {
    background: rgba(245,242,235,0.88);
  }

  .nav-logo {
    font-family: 'Cormorant Garamond', serif;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--gold);
    text-decoration: none;
    cursor: pointer;
  }

  .nav-logo span {
    color: var(--text-dim);
    font-weight: 300;
    font-size: 12px;
    display: block;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    margin-top: -2px;
  }

  .nav-links {
    display: flex; align-items: center; gap: 36px;
    list-style: none;
  }

  .nav-links a {
    color: var(--text-dim);
    text-decoration: none;
    font-size: 11px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    font-weight: 400;
    transition: color 0.3s ease;
    cursor: pointer;
  }

  .nav-links a:hover { color: var(--gold); }

  .nav-right { display: flex; align-items: center; gap: 20px; }

  .theme-toggle {
    width: 36px; height: 36px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-dim);
    transition: all 0.3s ease;
    font-size: 14px;
  }

  .theme-toggle:hover {
    border-color: var(--gold);
    color: var(--gold);
  }

  .nav-menu-btn {
    display: none;
    flex-direction: column; gap: 5px;
    cursor: pointer; background: none; border: none; padding: 6px;
  }

  .nav-menu-btn span {
    width: 22px; height: 1px;
    background: var(--text-dim);
    display: block;
    transition: all 0.3s ease;
  }

  /* Mobile Nav */
  .mobile-nav {
    position: fixed; inset: 0; z-index: 99;
    background: var(--bg);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none;
    transition: opacity 0.4s ease;
  }

  .mobile-nav.open { opacity: 1; pointer-events: all; }

  .mobile-nav ul {
    list-style: none;
    text-align: center;
  }

  .mobile-nav ul li { margin: 20px 0; }

  .mobile-nav ul a {
    font-family: 'Cormorant Garamond', serif;
    font-size: 32px;
    color: var(--text);
    text-decoration: none;
    letter-spacing: 0.05em;
    transition: color 0.3s;
    cursor: pointer;
  }

  .mobile-nav ul a:hover { color: var(--gold); }

  /* ── HERO ── */
  #hero {
    min-height: 100vh;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    text-align: center;
    padding: 120px 40px 80px;
    position: relative;
    overflow: hidden;
  }

  .hero-bg {
    position: absolute; inset: 0;
    background: radial-gradient(ellipse 70% 50% at 50% 60%, rgba(42,90,50,0.12) 0%, transparent 70%);
    pointer-events: none;
  }

  .hero-pattern {
    position: absolute; inset: 0;
    opacity: 0.03;
    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='%23c9a84c' fill-opacity='1'%3E%3Cpath d='M30 0L60 30L30 60L0 30z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  }

  .hero-eyebrow {
    font-size: 10px;
    letter-spacing: 0.4em;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 28px;
    font-weight: 400;
    opacity: 0;
    animation: fadeUp 0.8s ease 0.3s forwards;
  }

  .hero-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(56px, 10vw, 130px);
    font-weight: 300;
    line-height: 0.9;
    letter-spacing: -0.02em;
    color: var(--text);
    margin-bottom: 16px;
    opacity: 0;
    animation: fadeUp 0.8s ease 0.5s forwards;
  }

  .hero-title em {
    font-style: italic;
    color: var(--gold);
  }

  .hero-subtitle {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(16px, 2.5vw, 24px);
    font-weight: 300;
    font-style: italic;
    color: var(--text-dim);
    margin-bottom: 48px;
    max-width: 600px;
    line-height: 1.6;
    opacity: 0;
    animation: fadeUp 0.8s ease 0.7s forwards;
  }

  .hero-arabic {
    font-family: 'Scheherazade New', serif;
    font-size: clamp(24px, 4vw, 44px);
    color: var(--gold);
    opacity: 0.6;
    letter-spacing: 0.05em;
    margin-bottom: 60px;
    opacity: 0;
    animation: fadeUp 0.8s ease 0.9s forwards;
  }

  .hero-scroll {
    position: absolute;
    bottom: 40px; left: 50%;
    transform: translateX(-50%);
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    color: var(--text-muted);
    font-size: 9px;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    opacity: 0;
    animation: fadeUp 0.8s ease 1.2s forwards;
  }

  .scroll-line {
    width: 1px; height: 40px;
    background: linear-gradient(to bottom, var(--gold), transparent);
    animation: scrollPulse 2s ease-in-out infinite;
  }

  @keyframes scrollPulse {
    0%, 100% { opacity: 0.3; transform: scaleY(1); }
    50% { opacity: 0.8; transform: scaleY(1.1); }
  }

  @keyframes fadeUp {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
  }

  /* ── SECTION BASE ── */
  .section {
    padding: 120px 40px;
    max-width: 1400px;
    margin: 0 auto;
  }

  .section-label {
    font-size: 9px;
    letter-spacing: 0.4em;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 20px;
    font-weight: 400;
  }

  .section-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(36px, 5vw, 64px);
    font-weight: 300;
    line-height: 1.1;
    color: var(--text);
    margin-bottom: 20px;
  }

  .section-desc {
    font-size: 14px;
    line-height: 1.8;
    color: var(--text-dim);
    max-width: 560px;
    font-weight: 300;
  }

  .divider {
    width: 60px; height: 1px;
    background: linear-gradient(to right, var(--gold), transparent);
    margin: 28px 0;
  }

  /* ── REVEAL ANIMATION ── */
  .reveal {
    opacity: 0;
    transform: translateY(32px);
    transition: opacity 0.8s ease, transform 0.8s ease;
  }

  .reveal.visible {
    opacity: 1;
    transform: translateY(0);
  }

  /* ── ABOUT SECTION ── */
  #about {
    border-top: 1px solid var(--border);
    padding-top: 120px;
  }

  .about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 80px;
    align-items: start;
    margin-top: 60px;
  }

  .about-text p {
    font-size: 15px;
    line-height: 1.9;
    color: var(--text-dim);
    margin-bottom: 20px;
    font-weight: 300;
  }

  .about-text p strong {
    color: var(--gold);
    font-weight: 400;
  }

  .about-quote {
    border-left: 2px solid var(--gold);
    padding-left: 24px;
    margin: 40px 0;
  }

  .about-quote blockquote {
    font-family: 'Cormorant Garamond', serif;
    font-size: 22px;
    font-style: italic;
    color: var(--text);
    font-weight: 300;
    line-height: 1.6;
  }

  .about-quote cite {
    display: block;
    font-size: 10px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-top: 12px;
  }

  .about-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
  }

  .stat-item {
    background: var(--bg);
    padding: 36px 28px;
    transition: background 0.3s ease;
  }

  .stat-item:hover { background: var(--bg3); }

  .stat-number {
    font-family: 'Cormorant Garamond', serif;
    font-size: 52px;
    font-weight: 300;
    color: var(--gold);
    line-height: 1;
    margin-bottom: 8px;
  }

  .stat-label {
    font-size: 10px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--text-muted);
  }

  /* ── 12 IMAMS ── */
  #imams {
    background: var(--bg2);
    padding: 120px 0;
  }

  #imams .inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 40px;
  }

  .imams-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 60px;
    gap: 40px;
    flex-wrap: wrap;
  }

  .imams-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
  }

  .imam-card {
    background: var(--bg2);
    padding: 40px 28px;
    cursor: pointer;
    transition: background 0.4s ease;
    position: relative;
    overflow: hidden;
  }

  .imam-card::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(to right, var(--gold), transparent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
  }

  .imam-card:hover { background: var(--surface); }
  .imam-card:hover::after { transform: scaleX(1); }

  .imam-num {
    font-family: 'Cormorant Garamond', serif;
    font-size: 48px;
    font-weight: 300;
    color: var(--border-gold);
    line-height: 1;
    margin-bottom: 24px;
    transition: color 0.3s ease;
  }

  .imam-card:hover .imam-num { color: var(--gold-dim); }

  .imam-arabic {
    font-family: 'Scheherazade New', serif;
    font-size: 20px;
    color: var(--gold);
    margin-bottom: 8px;
    display: block;
  }

  .imam-name {
    font-family: 'Cormorant Garamond', serif;
    font-size: 18px;
    font-weight: 400;
    color: var(--text);
    margin-bottom: 6px;
  }

  .imam-title {
    font-size: 10px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 16px;
  }

  .imam-years {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 300;
  }

  /* ── MARJA SECTION ── */
  #marja {
    padding: 120px 40px;
    max-width: 1400px;
    margin: 0 auto;
  }

  .marja-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-top: 60px;
  }

  .marja-card {
    border: 1px solid var(--border);
    padding: 48px 36px;
    cursor: pointer;
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
  }

  .marja-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--gold), transparent);
    transform: scaleX(0);
    transition: transform 0.5s ease;
  }

  .marja-card:hover {
    border-color: var(--border-gold);
    background: var(--surface);
    transform: translateY(-4px);
  }

  .marja-card:hover::before { transform: scaleX(1); }

  .marja-avatar {
    width: 80px; height: 80px;
    border-radius: 50%;
    border: 1px solid var(--border-gold);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 28px;
    font-family: 'Scheherazade New', serif;
    font-size: 28px;
    color: var(--gold);
    background: var(--surface);
  }

  .marja-eyebrow {
    font-size: 9px;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 12px;
  }

  .marja-name {
    font-family: 'Cormorant Garamond', serif;
    font-size: 26px;
    font-weight: 400;
    color: var(--text);
    margin-bottom: 6px;
    line-height: 1.2;
  }

  .marja-arabic-name {
    font-family: 'Scheherazade New', serif;
    font-size: 18px;
    color: var(--gold-dim);
    margin-bottom: 20px;
    display: block;
  }

  .marja-bio {
    font-size: 13px;
    line-height: 1.8;
    color: var(--text-dim);
    font-weight: 300;
    margin-bottom: 28px;
  }

  .marja-tags {
    display: flex; flex-wrap: wrap; gap: 8px;
  }

  .tag {
    font-size: 9px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    padding: 5px 12px;
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: 2px;
    transition: all 0.3s ease;
  }

  .marja-card:hover .tag {
    border-color: var(--border-gold);
    color: var(--gold-dim);
  }

  /* ── LIBRARY / KNOWLEDGE GRID ── */
  #library {
    background: var(--bg3);
    padding: 120px 0;
  }

  #library .inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 40px;
  }

  .knowledge-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    margin-top: 60px;
  }

  .knowledge-item {
    background: var(--bg3);
    padding: 48px 36px;
    cursor: pointer;
    transition: background 0.4s ease;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 260px;
  }

  .knowledge-item:hover { background: var(--surface); }

  .ki-icon {
    font-size: 28px;
    margin-bottom: 4px;
    display: block;
  }

  .ki-label {
    font-size: 9px;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--gold);
  }

  .ki-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 24px;
    font-weight: 400;
    color: var(--text);
    line-height: 1.2;
    flex: 1;
  }

  .ki-count {
    font-size: 11px;
    color: var(--text-muted);
    padding-top: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .ki-arrow {
    color: var(--gold);
    font-size: 16px;
    transition: transform 0.3s ease;
  }

  .knowledge-item:hover .ki-arrow { transform: translateX(4px); }

  /* ── CALENDAR / PRAYER ── */
  #calendar-prayer {
    padding: 120px 40px;
    max-width: 1400px;
    margin: 0 auto;
  }

  .cp-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-top: 60px;
  }

  .cp-panel {
    border: 1px solid var(--border);
    padding: 48px 36px;
  }

  .cp-panel-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 28px;
    font-weight: 400;
    color: var(--text);
    margin-bottom: 32px;
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .cp-panel-title span { font-size: 22px; }

  .prayer-list { list-style: none; }

  .prayer-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    transition: all 0.3s ease;
  }

  .prayer-item:hover { padding-left: 8px; }
  .prayer-item:last-child { border-bottom: none; }

  .prayer-name {
    font-size: 13px;
    color: var(--text-dim);
    letter-spacing: 0.05em;
  }

  .prayer-time {
    font-family: 'Cormorant Garamond', serif;
    font-size: 20px;
    color: var(--gold);
  }

  .calendar-month {
    font-size: 10px;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 20px;
  }

  .calendar-events { list-style: none; }

  .cal-event {
    display: flex;
    gap: 20px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
    align-items: flex-start;
    transition: all 0.3s ease;
    cursor: pointer;
  }

  .cal-event:hover { padding-left: 8px; }
  .cal-event:last-child { border-bottom: none; }

  .cal-day {
    font-family: 'Cormorant Garamond', serif;
    font-size: 32px;
    font-weight: 300;
    color: var(--gold);
    line-height: 1;
    min-width: 40px;
  }

  /* ── FULL INTERACTIVE CALENDAR ── */
  .cal-wrap { width: 100%; }

  .cal-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
  }
  .cal-nav-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-dim);
    width: 32px; height: 32px;
    cursor: pointer; font-size: 14px;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.3s;
  }
  .cal-nav-btn:hover { border-color: var(--gold); color: var(--gold); }

  .cal-month-label {
    font-family: 'Cormorant Garamond', serif;
    font-size: 22px; font-weight: 400;
    color: var(--text); text-align: center;
  }
  .cal-month-label small {
    display: block; font-size: 9px; letter-spacing: 0.3em;
    text-transform: uppercase; color: var(--text-muted);
    font-family: 'Inter', sans-serif; font-weight: 300; margin-top: 2px;
  }

  .cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px; background: var(--border);
    border: 1px solid var(--border); margin-bottom: 20px;
  }
  .cal-weekday {
    background: var(--bg2); text-align: center;
    font-size: 9px; letter-spacing: 0.15em;
    text-transform: uppercase; color: var(--text-muted); padding: 9px 2px;
  }
  .cal-cell {
    background: var(--bg); min-height: 48px;
    padding: 6px; cursor: default; transition: background 0.2s; position: relative;
  }
  .cal-cell.has-event { cursor: pointer; }
  .cal-cell.has-event:hover { background: var(--surface); }
  .cal-cell.empty { background: var(--bg2); opacity: 0.3; }
  .cal-cell.selected { background: var(--surface2); }
  .cal-cell.today .cal-cell-num {
    background: var(--gold); color: #0a0c0b;
    border-radius: 50%; width: 22px; height: 22px;
    display: flex; align-items: center; justify-content: center;
  }
  .cal-cell-num {
    font-family: 'Cormorant Garamond', serif;
    font-size: 14px; color: var(--text-muted);
    width: 22px; height: 22px;
    display: flex; align-items: center; justify-content: center;
  }
  .cal-cell.has-event .cal-cell-num { color: var(--text); }

  .cal-dots { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 4px; }
  .cal-dot { width: 4px; height: 4px; border-radius: 50%; }
  .cal-dot.birth { background: #4a9d5a; }
  .cal-dot.death { background: #9d4a4a; }
  .cal-dot.feast { background: #c9a84c; }
  .cal-dot.other { background: #4a7a9d; }

  .cal-events-panel {
    border-top: 1px solid var(--border);
    padding-top: 20px; min-height: 100px;
  }
  .cal-events-heading {
    font-size: 9px; letter-spacing: 0.3em;
    text-transform: uppercase; color: var(--gold); margin-bottom: 14px;
  }
  .cal-ev-item {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 11px 0; border-bottom: 1px solid var(--border);
    transition: padding-left 0.25s;
  }
  .cal-ev-item:last-child { border-bottom: none; }
  .cal-ev-item:hover { padding-left: 6px; }
  .cal-ev-dot { width: 6px; height: 6px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
  .cal-ev-name { font-size: 13px; color: var(--text); line-height: 1.5; }
  .cal-ev-type { font-size: 9px; letter-spacing: 0.15em; text-transform: uppercase; color: var(--text-muted); margin-top: 2px; }
  .cal-no-events { font-family: 'Cormorant Garamond', serif; font-size: 15px; font-style: italic; color: var(--text-muted); padding: 8px 0; }

  .cal-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 18px; }
  .cal-legend-item { display: flex; align-items: center; gap: 6px; font-size: 9px; letter-spacing: 0.15em; text-transform: uppercase; color: var(--text-muted); }
  .cal-legend-dot { width: 6px; height: 6px; border-radius: 50%; }

  .cal-info-name {
    font-size: 13px;
    color: var(--text);
    margin-bottom: 4px;
    font-weight: 400;
  }

  .cal-info-type {
    font-size: 10px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-muted);
  }

  /* ── QURAN FEATURE ── */
  #quran {
    background: var(--bg2);
    padding: 120px 40px;
    text-align: center;
  }

  .quran-inner {
    max-width: 800px;
    margin: 0 auto;
  }

  .quran-ayah {
    font-family: 'Scheherazade New', serif;
    font-size: clamp(28px, 4vw, 48px);
    color: var(--gold);
    line-height: 1.8;
    margin: 48px 0 24px;
    opacity: 0.85;
  }

  .quran-translation {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(16px, 2vw, 22px);
    font-style: italic;
    color: var(--text-dim);
    line-height: 1.7;
    font-weight: 300;
    margin-bottom: 16px;
  }

  .quran-ref {
    font-size: 10px;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--text-muted);
  }

  /* ── DUA SECTION ── */
  #dua {
    padding: 120px 40px;
    max-width: 1400px;
    margin: 0 auto;
  }

  .dua-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 60px;
  }

  .dua-card {
    border: 1px solid var(--border);
    padding: 36px 28px;
    cursor: pointer;
    transition: all 0.4s ease;
  }

  .dua-card:hover {
    border-color: var(--border-gold);
    background: var(--surface);
    transform: translateY(-2px);
  }

  .dua-arabic {
    font-family: 'Scheherazade New', serif;
    font-size: 22px;
    color: var(--gold);
    margin-bottom: 16px;
    display: block;
    line-height: 1.6;
  }

  .dua-name {
    font-family: 'Cormorant Garamond', serif;
    font-size: 20px;
    color: var(--text);
    margin-bottom: 10px;
  }

  .dua-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.7;
    font-weight: 300;
  }

  /* ── LECTURES ── */
  #lectures {
    background: var(--bg3);
    padding: 120px 0;
  }

  #lectures .inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 40px;
  }

  .lectures-list {
    margin-top: 60px;
    display: flex;
    flex-direction: column;
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
  }

  .lecture-item {
    background: var(--bg3);
    padding: 28px 36px;
    display: flex;
    align-items: center;
    gap: 32px;
    cursor: pointer;
    transition: background 0.3s ease;
  }

  .lecture-item:hover { background: var(--surface); }

  .lecture-num {
    font-family: 'Cormorant Garamond', serif;
    font-size: 36px;
    font-weight: 300;
    color: var(--border-gold);
    min-width: 56px;
    transition: color 0.3s ease;
  }

  .lecture-item:hover .lecture-num { color: var(--gold-dim); }

  .lecture-info { flex: 1; }

  .lecture-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 20px;
    color: var(--text);
    margin-bottom: 6px;
  }

  .lecture-meta {
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0.1em;
    display: flex;
    gap: 16px;
  }

  .lecture-meta span { text-transform: uppercase; font-size: 9px; letter-spacing: 0.2em; }

  .lecture-duration {
    font-family: 'Cormorant Garamond', serif;
    font-size: 18px;
    color: var(--text-muted);
  }

  .lecture-play {
    width: 44px; height: 44px;
    border: 1px solid var(--border);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted);
    font-size: 14px;
    transition: all 0.3s ease;
  }

  .lecture-item:hover .lecture-play {
    border-color: var(--gold);
    color: var(--gold);
  }

  /* ── Q&A SECTION ── */
  #qa {
    padding: 120px 40px;
    max-width: 1400px;
    margin: 0 auto;
  }

  .qa-list {
    margin-top: 60px;
    display: flex;
    flex-direction: column;
    gap: 0;
  }

  .qa-item {
    border-bottom: 1px solid var(--border);
    overflow: hidden;
  }

  .qa-question {
    padding: 24px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    transition: color 0.3s ease;
  }

  .qa-question:hover { color: var(--gold); }

  .qa-q-text {
    font-family: 'Cormorant Garamond', serif;
    font-size: 19px;
    color: var(--text);
    font-weight: 400;
    transition: color 0.3s ease;
  }

  .qa-question:hover .qa-q-text { color: var(--gold); }

  .qa-toggle {
    width: 28px; height: 28px;
    border: 1px solid var(--border);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted);
    font-size: 16px;
    flex-shrink: 0;
    transition: all 0.3s ease;
  }

  .qa-item.open .qa-toggle {
    border-color: var(--gold);
    color: var(--gold);
    transform: rotate(45deg);
  }

  .qa-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
  }

  .qa-item.open .qa-answer { max-height: 200px; }

  .qa-answer p {
    padding: 0 0 24px;
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.8;
    font-weight: 300;
    max-width: 720px;
  }

  /* ── FOOTER ── */
  footer {
    border-top: 1px solid var(--border);
    padding: 80px 40px 40px;
  }

  .footer-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 80px;
    margin-bottom: 60px;
  }

  .footer-brand .nav-logo { margin-bottom: 16px; display: block; }

  .footer-brand p {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.7;
    font-weight: 300;
    max-width: 240px;
  }

  .footer-links-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
  }

  .footer-col-title {
    font-size: 9px;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 20px;
  }

  .footer-col ul { list-style: none; }

  .footer-col ul li { margin-bottom: 10px; }

  .footer-col ul a {
    font-size: 12px;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.3s ease;
    cursor: pointer;
    font-weight: 300;
  }

  .footer-col ul a:hover { color: var(--text-dim); }

  .footer-bottom {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 32px;
    border-top: 1px solid var(--border);
  }

  .footer-bottom p {
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 0.1em;
  }

  .footer-arabic {
    font-family: 'Scheherazade New', serif;
    font-size: 18px;
    color: var(--gold);
    opacity: 0.4;
  }

  /* ── MODAL ── */
  .modal-overlay {
    position: fixed; inset: 0; z-index: 200;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center;
    padding: 40px;
    opacity: 0; pointer-events: none;
    transition: opacity 0.4s ease;
  }

  .modal-overlay.open { opacity: 1; pointer-events: all; }

  .modal {
    background: var(--bg2);
    border: 1px solid var(--border);
    max-width: 640px; width: 100%;
    max-height: 80vh; overflow-y: auto;
    padding: 48px;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.4s ease;
  }

  .modal-overlay.open .modal { transform: translateY(0); }

  .modal-close {
    position: absolute; top: 20px; right: 20px;
    background: none; border: none;
    color: var(--text-muted); cursor: pointer;
    font-size: 20px; line-height: 1;
    transition: color 0.3s ease;
  }

  .modal-close:hover { color: var(--gold); }

  .modal-eyebrow {
    font-size: 9px;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 12px;
  }

  .modal-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 32px;
    color: var(--text);
    margin-bottom: 6px;
    font-weight: 400;
  }

  .modal-arabic {
    font-family: 'Scheherazade New', serif;
    font-size: 20px;
    color: var(--gold);
    margin-bottom: 24px;
    display: block;
  }

  .modal-divider {
    width: 40px; height: 1px;
    background: var(--gold-dim);
    margin: 20px 0;
  }

  .modal-body {
    font-size: 14px;
    color: var(--text-dim);
    line-height: 1.8;
    font-weight: 300;
  }

  .modal-body p { margin-bottom: 14px; }


  .dua-read-link {
    font-size: 10px;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--gold-dim);
    margin-top: 16px;
    transition: color 0.3s ease;
  }
  .dua-card:hover .dua-read-link { color: var(--gold); }

  /* DUA PAGE */
  .dua-page-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(36px, 5vw, 58px);
    font-weight: 300;
    color: var(--text);
    line-height: 1.1;
    margin-bottom: 8px;
  }
  .dua-page-arabic-title {
    font-family: 'Scheherazade New', serif;
    font-size: 32px;
    color: var(--gold);
    display: block;
    margin-bottom: 32px;
    opacity: 0.8;
  }
  .dua-page-desc {
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.8;
    max-width: 600px;
    font-weight: 300;
    margin-bottom: 60px;
    padding-bottom: 40px;
    border-bottom: 1px solid var(--border);
  }
  .dua-verse {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0;
    border-bottom: 1px solid var(--border);
    padding: 20px 0;
    transition: background 0.2s;
  }
  .dua-verse:hover { background: var(--surface); margin: 0 -20px; padding: 20px 20px; }
  .dua-verse-ar {
    font-family: 'Scheherazade New', serif;
    font-size: 20px;
    color: var(--gold);
    line-height: 1.7;
    text-align: right;
    direction: rtl;
    padding-right: 20px;
  }
  .dua-verse-trans {
    font-size: 12px;
    color: var(--text-dim);
    line-height: 1.7;
    font-style: italic;
    padding: 0 16px;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    font-family: 'Cormorant Garamond', serif;
    font-size: 14px;
  }
  .dua-verse-ru {
    font-size: 13px;
    color: var(--text);
    line-height: 1.7;
    font-weight: 300;
    padding-left: 20px;
  }
  .dua-section-divider {
    text-align: center;
    font-size: 9px;
    letter-spacing: 0.4em;
    text-transform: uppercase;
    color: var(--gold);
    padding: 32px 0 24px;
    border-bottom: 1px solid var(--border-gold);
    margin-bottom: 4px;
  }
  .dua-col-headers {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
  }
  .dua-col-header {
    font-size: 8px;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--text-muted);
  }
  .dua-col-header:nth-child(1) { text-align: right; padding-right: 20px; }
  .dua-col-header:nth-child(2) { text-align: center; }
  .dua-col-header:nth-child(3) { padding-left: 20px; }
  @media (max-width: 640px) {
    .dua-verse { grid-template-columns: 1fr; gap: 8px; }
    .dua-verse-ar { text-align: right; padding-right: 0; }
    .dua-verse-trans { border: none; padding: 0; border-top: 1px solid var(--border); padding-top: 8px; }
    .dua-verse-ru { padding-left: 0; border-top: 1px solid var(--border); padding-top: 8px; }
    .dua-col-headers { display: none; }
  }

  @keyframes spin { to { transform: rotate(360deg); } }

  /* ── LIBRARY ── */
  .lib-stats {
    display: flex;
    gap: 40px;
    margin: 48px 0 40px;
    flex-wrap: wrap;
  }

  .lib-stat {
    display: flex;
    flex-direction: column;
  }

  .lib-stat-num {
    font-family: 'Cormorant Garamond', serif;
    font-size: 40px;
    font-weight: 300;
    color: var(--gold);
    line-height: 1;
  }

  .lib-stat-label {
    font-size: 9px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-top: 6px;
  }

  /* Language tabs */
  .lib-lang-tabs {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 28px;
    overflow-x: auto;
  }

  .lib-lang-tab {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 12px 22px;
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    white-space: nowrap;
    position: relative;
    transition: color 0.3s;
  }

  .lib-lang-tab::after {
    content: '';
    position: absolute;
    bottom: -1px; left: 0; right: 0;
    height: 2px;
    background: var(--gold);
    transform: scaleX(0);
    transition: transform 0.3s;
  }

  .lib-lang-tab:hover { color: var(--text-dim); }
  .lib-lang-tab.active { color: var(--gold); }
  .lib-lang-tab.active::after { transform: scaleX(1); }

  .lib-lang-tab .count {
    color: var(--text-muted);
    font-size: 9px;
    margin-left: 4px;
  }

  /* Search + category row */
  .lib-controls {
    display: flex;
    gap: 20px;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
  }

  .lib-search {
    position: relative;
    flex: 1;
    min-width: 220px;
    max-width: 340px;
  }

  .lib-search-icon {
    position: absolute;
    left: 0; top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
    pointer-events: none;
  }

  .lib-search input {
    width: 100%;
    background: none;
    border: none;
    border-bottom: 1px solid var(--border);
    padding: 8px 0 8px 22px;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    color: var(--text);
    outline: none;
    transition: border-color 0.3s;
  }

  .lib-search input:focus { border-bottom-color: var(--gold); }
  .lib-search input::placeholder { color: var(--text-muted); font-weight: 300; }

  .lib-cat-select {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 8px 14px;
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    outline: none;
    transition: border-color 0.3s;
  }

  .lib-cat-select:focus, .lib-cat-select:hover { border-color: var(--gold-dim); }

  /* Book grid — cover-style cards */
  .lib-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
  }

  .lib-book {
    cursor: pointer;
    display: flex;
    flex-direction: column;
    animation: bookFadeIn 0.4s ease both;
  }

  @keyframes bookFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  .lib-cover {
    aspect-ratio: 3 / 4.2;
    background: linear-gradient(160deg, var(--surface2) 0%, var(--bg2) 100%);
    border: 1px solid var(--border);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 16px;
    text-align: center;
    overflow: hidden;
    transition: all 0.35s ease;
  }

  .lib-book:hover .lib-cover {
    border-color: var(--border-gold);
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.35);
  }

  .lib-cover::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--gold);
    opacity: 0.7;
  }

  .lib-cover-ornament {
    font-size: 22px;
    color: var(--gold-dim);
    opacity: 0.5;
    margin-bottom: 14px;
  }

  .lib-cover-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 15px;
    font-weight: 500;
    color: var(--text);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .lib-cover-lang-badge {
    position: absolute;
    top: 10px; right: 10px;
    font-size: 8px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--gold-dim);
    background: var(--bg);
    border: 1px solid var(--border-gold);
    padding: 2px 6px;
    opacity: 0.85;
  }

  .lib-book-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 2px 0;
    font-size: 10px;
    color: var(--text-muted);
  }

  .lib-book-cat {
    letter-spacing: 0.05em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 70%;
  }

  .lib-book-size { flex-shrink: 0; }

  .lib-empty {
    text-align: center;
    padding: 80px 20px;
    grid-column: 1 / -1;
  }

  .lib-empty-icon { font-size: 30px; opacity: 0.3; margin-bottom: 16px; }

  .lib-empty-text {
    font-family: 'Cormorant Garamond', serif;
    font-size: 17px;
    color: var(--text-dim);
    font-style: italic;
    font-weight: 300;
  }

  .lib-count {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    text-align: center;
    font-size: 10px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-top: 8px;
  }

  .lib-more-btn {
    background: none;
    border: 1px solid var(--border-gold);
    color: var(--gold);
    padding: 12px 32px;
    font-size: 11px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.3s;
  }

  .lib-more-btn:hover {
    background: var(--gold);
    color: #0a0c0b;
  }

  [data-theme="light"] .lib-more-btn:hover { color: var(--white); }

  /* ── BOOK READER MODAL ── */
  .lib-reader-overlay {
    position: fixed; inset: 0; z-index: 400;
    background: rgba(6,8,7,0.92);
    backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
    opacity: 0; pointer-events: none;
    transition: opacity 0.35s ease;
  }

  .lib-reader-overlay.open { opacity: 1; pointer-events: all; }

  .lib-reader {
    width: 100%; max-width: 920px; height: 88vh;
    background: var(--bg2);
    border: 1px solid var(--border-gold);
    display: flex; flex-direction: column;
    transform: translateY(16px);
    transition: transform 0.35s ease;
  }

  .lib-reader-overlay.open .lib-reader { transform: translateY(0); }

  .lib-reader-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
  }

  .lib-reader-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 18px;
    color: var(--text);
    font-weight: 400;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .lib-reader-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
  }

  .lib-reader-dl {
    font-size: 10px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--gold);
    text-decoration: none;
    border: 1px solid var(--border-gold);
    padding: 7px 14px;
    transition: all 0.3s;
    white-space: nowrap;
  }

  .lib-reader-dl:hover { background: var(--gold); color: #0a0c0b; }

  .lib-reader-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
    transition: color 0.3s;
  }

  .lib-reader-close:hover { color: var(--gold); }

  .lib-reader-body {
    flex: 1;
    overflow: hidden;
    position: relative;
    background: var(--bg);
  }

  .lib-pdf-pages {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    overflow-x: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 16px;
  }

  .lib-pdf-canvas {
    display: block;
    max-width: 100%;
    box-shadow: 0 4px 24px rgba(0,0,0,0.4);
    background: #fff;
  }

  .lib-reader-error {
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 16px;
    background: var(--bg2);
    padding: 40px;
    text-align: center;
  }

  .lib-reader-error-icon { font-size: 28px; opacity: 0.4; }

  .lib-reader-error-text {
    font-family: 'Cormorant Garamond', serif;
    font-size: 16px;
    color: var(--text-dim);
    font-style: italic;
  }

  .lib-reader-footer {
    padding: 14px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
  }

  .lib-page-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-dim);
    width: 38px; height: 38px;
    cursor: pointer;
    font-size: 15px;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.3s;
  }

  .lib-page-btn:hover:not(:disabled) { border-color: var(--gold); color: var(--gold); }
  .lib-page-btn:disabled { opacity: 0.25; cursor: default; }

  .lib-page-info {
    font-family: 'Cormorant Garamond', serif;
    font-size: 15px;
    color: var(--text-dim);
    min-width: 80px;
    text-align: center;
    letter-spacing: 0.05em;
  }

  .lib-reader-loading {
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 16px;
    background: var(--bg2);
  }

  .lib-reader-spinner {
    width: 26px; height: 26px;
    border: 1px solid var(--border);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
  }

  .lib-reader-loading-text {
    font-family: 'Cormorant Garamond', serif;
    font-size: 14px;
    color: var(--text-muted);
    font-style: italic;
  }

  @media (max-width: 900px) {
    .lib-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
  }

  @media (max-width: 640px) {
    .lib-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .lib-controls { flex-direction: column; align-items: stretch; }
    .lib-search { max-width: none; }
    .lib-stats { gap: 24px; }
    .lib-stat-num { font-size: 30px; }
    .lib-reader { height: 92vh; max-width: 100%; }
    .lib-reader-header { padding: 14px 16px; }
    .lib-reader-title { font-size: 15px; }
  }




  /* ── SCROLLBAR ── */
  ::-webkit-scrollbar { width: 4px; }
  ::-webkit-scrollbar-track { background: var(--bg); }
  ::-webkit-scrollbar-thumb { background: var(--border-gold); border-radius: 2px; }

  /* ── RESPONSIVE ── */
  @media (max-width: 1100px) {
    .imams-grid { grid-template-columns: repeat(3, 1fr); }
  }

  @media (max-width: 900px) {
    .about-grid { grid-template-columns: 1fr; gap: 48px; }
    .imams-grid { grid-template-columns: repeat(2, 1fr); }
    .marja-grid { grid-template-columns: 1fr 1fr; }
    .knowledge-grid { grid-template-columns: 1fr 1fr; }
    .cp-grid { grid-template-columns: 1fr; }
    .footer-inner { grid-template-columns: 1fr; gap: 48px; }
    .footer-links-grid { grid-template-columns: 1fr 1fr; }
    .dua-grid { grid-template-columns: 1fr 1fr; }
  }

  @media (max-width: 640px) {
    nav { padding: 0 20px; }
    .nav-links { display: none; }
    .nav-menu-btn { display: flex; }
    .section { padding: 80px 20px; }
    #about { padding-top: 80px; }
    .imams-grid { grid-template-columns: 1fr 1fr; }
    .marja-grid { grid-template-columns: 1fr; }
    .knowledge-grid { grid-template-columns: 1fr; }
    .dua-grid { grid-template-columns: 1fr; }
    #hero { padding: 100px 20px 60px; }
    .footer-links-grid { grid-template-columns: 1fr; }
    .footer-inner { grid-template-columns: 1fr; }
    .about-stats { grid-template-columns: 1fr 1fr; }
    .lecture-item { gap: 16px; padding: 20px; }
    .modal { padding: 32px 24px; }
    .modal-overlay { padding: 20px; }
  }

  /* ══════ MOBILE REFINEMENTS ══════ */
  @media (max-width: 640px) {
    /* Tighter vertical rhythm — sections were far too tall */
    .section { padding: 56px 22px; }
    #about { padding-top: 56px; }
    #imams, #library, #lectures { padding: 56px 0; }
    #imams .inner, #library .inner, #lectures .inner { padding: 0 22px; }
    #marja, #dua, #calendar-prayer, #qa { padding: 56px 22px; }
    #quran { padding: 56px 22px; }

    /* Hero — reduce dead space */
    #hero { min-height: auto; padding: 120px 22px 72px; }
    .hero-title { font-size: clamp(46px, 15vw, 68px); }
    .hero-subtitle { font-size: 15px; margin-bottom: 32px; }
    .hero-arabic { margin-bottom: 32px; }
    .hero-eyebrow { font-size: 9px; letter-spacing: 0.28em; margin-bottom: 20px; }
    .hero-scroll { bottom: 24px; }
    .scroll-line { height: 28px; }

    /* Section headings */
    .section-title { font-size: clamp(30px, 8.5vw, 40px); }
    .section-desc { font-size: 13px; }
    .divider { margin: 20px 0; }

    /* About */
    .about-grid { margin-top: 36px; gap: 36px; }
    .about-text p { font-size: 14px; line-height: 1.8; }
    .about-quote { margin: 28px 0; padding-left: 18px; }
    .about-quote blockquote { font-size: 19px; }
    .stat-item { padding: 26px 20px; }
    .stat-number { font-size: 40px; }

    /* Imams — one per row reads far better than cramped pairs */
    .imams-grid { grid-template-columns: 1fr; }
    .imam-card { padding: 26px 22px; }
    .imam-num { font-size: 34px; margin-bottom: 14px; }
    .imams-header { margin-bottom: 36px; gap: 24px; }

    /* Quran */
    .quran-ayah { font-size: clamp(24px, 7vw, 32px); margin: 32px 0 20px; line-height: 1.9; }
    .quran-translation { font-size: 15px; }

    /* Dua cards */
    .dua-grid { gap: 14px; margin-top: 36px; }
    .dua-card { padding: 24px 20px; }
    .dua-arabic { font-size: 20px; }
    .dua-name { font-size: 18px; }

    /* Dua reading page */
    #duaPage > div { padding: 24px 20px 80px !important; }
    .dua-page-title { font-size: clamp(28px, 8vw, 34px); }
    .dua-page-arabic-title { font-size: 24px; margin-bottom: 22px; }
    .dua-page-desc { font-size: 13px; margin-bottom: 36px; padding-bottom: 28px; }
    .dua-verse { padding: 16px 0; }
    .dua-verse:hover { margin: 0; padding: 16px 0; background: none; }
    .dua-verse-ar { font-size: 21px; line-height: 1.95; }
    .dua-verse-trans { font-size: 13px; opacity: 0.85; }
    .dua-verse-ru { font-size: 14px; }
    .dua-section-divider { padding: 26px 0 18px; font-size: 8px; }

    /* Marja */
    .marja-grid { gap: 14px; margin-top: 36px; }
    .marja-card { padding: 30px 22px; }
    .marja-avatar { width: 62px; height: 62px; font-size: 22px; margin-bottom: 20px; }
    .marja-name { font-size: 22px; }
    .marja-bio { font-size: 12.5px; margin-bottom: 20px; }

    /* Library */
    .lib-stats { gap: 26px; margin: 32px 0 28px; }
    .lib-stat-num { font-size: 30px; }
    .lib-lang-tabs {
      margin-bottom: 20px;
      -webkit-overflow-scrolling: touch;
      scrollbar-width: none;
    }
    .lib-lang-tabs::-webkit-scrollbar { display: none; }
    .lib-lang-tab { padding: 11px 15px; font-size: 10px; }
    .lib-controls { gap: 12px; margin-bottom: 20px; }
    .lib-cat-select { width: 100%; }
    .lib-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
    .lib-cover { padding: 16px 12px; }
    .lib-cover-title { font-size: 13px; -webkit-line-clamp: 4; }
    .lib-cover-ornament { font-size: 18px; margin-bottom: 10px; }
    .lib-cover-lang-badge { font-size: 7px; padding: 2px 5px; top: 8px; right: 8px; }
    .lib-book-meta { font-size: 9px; padding-top: 8px; }
    .lib-more-btn { width: 100%; padding: 14px 20px; }

    /* Reader — full-bleed on phones */
    .lib-reader-overlay { padding: 0; }
    .lib-reader { height: 100vh; max-width: 100%; border: none; }
    .lib-reader-header { padding: 14px 16px; }
    .lib-reader-title { font-size: 14px; }
    .lib-reader-dl { padding: 6px 10px; font-size: 9px; }
    .lib-pdf-pages { padding: 8px; }
    .lib-reader-footer { padding: 12px 16px; gap: 18px; }
    .lib-page-btn { width: 42px; height: 42px; }

    /* Lectures */
    .lectures-list { margin-top: 36px; }
    .lecture-item { flex-wrap: wrap; gap: 12px; padding: 20px; }
    .lecture-num { font-size: 26px; min-width: 40px; }
    .lecture-info { flex: 1 1 auto; min-width: 60%; }
    .lecture-title { font-size: 17px; }
    .lecture-meta { flex-wrap: wrap; gap: 6px; }
    .lecture-duration { font-size: 15px; }
    .lecture-play { width: 38px; height: 38px; }

    /* Prayer + Calendar */
    .cp-grid { gap: 20px; margin-top: 36px; }
    .cp-panel { padding: 0; }
    .cp-panel-title { font-size: 22px; margin-bottom: 22px; padding: 26px 22px 0; }
    #calendar-prayer .cp-panel:last-child { padding: 26px 22px; }
    #calendar-prayer .cp-panel:last-child .cp-panel-title { padding: 0; }

    .cal-grid { gap: 1px; }
    .cal-cell { min-height: 42px; padding: 4px; }
    .cal-cell-num { font-size: 12px; width: 19px; height: 19px; }
    .cal-weekday { font-size: 8px; padding: 7px 1px; letter-spacing: 0.05em; }
    .cal-dot { width: 3px; height: 3px; }
    .cal-month-label { font-size: 19px; }
    .cal-nav { margin-bottom: 18px; }
    .cal-events-heading { font-size: 8px; }
    .cal-ev-name { font-size: 12.5px; }
    .cal-legend { gap: 12px; font-size: 8px; }
    .cal-legend-item { font-size: 8px; }

    /* Q&A */
    .qa-list { margin-top: 36px; }
    .qa-question { padding: 20px 0; gap: 14px; }
    .qa-q-text { font-size: 16px; }
    .qa-answer p { font-size: 13px; padding-bottom: 20px; }

    /* Footer */
    footer { padding: 56px 22px 28px; }
    .footer-inner { gap: 32px; margin-bottom: 36px; }
    .footer-bottom { flex-direction: column; gap: 14px; text-align: center; }

    /* Modals */
    .modal { padding: 30px 22px; max-height: 86vh; }
    .modal-overlay { padding: 16px; }
    .modal-title { font-size: 26px; }
    .modal-arabic { font-size: 18px; margin-bottom: 20px; }
    .modal-body { font-size: 13.5px; }

    /* Nav */
    nav { height: 58px; padding: 0 22px; }
    .nav-logo { font-size: 16px; }
    .nav-logo span { font-size: 10px; letter-spacing: 0.16em; }
    .mobile-nav ul a { font-size: 26px; }
    .mobile-nav ul li { margin: 15px 0; }
  }

  /* Very small phones */
  @media (max-width: 380px) {
    .lib-grid { grid-template-columns: 1fr; }
    .lib-stats { gap: 20px; }
    .lib-stat-num { font-size: 26px; }
    .about-stats { grid-template-columns: 1fr; }
    .cal-cell { min-height: 38px; }
  }

  /* ══════ DESKTOP REFINEMENTS ══════ */
  @media (min-width: 1400px) {
    .section, #marja, #dua, #calendar-prayer, #qa,
    #imams .inner, #library .inner, #lectures .inner,
    .footer-inner, .footer-bottom { max-width: 1280px; }
    .quran-inner { max-width: 760px; }
  }

  @media (min-width: 1024px) {
    /* Slightly tighter sections so the page reads as a continuous archive */
    .section { padding: 100px 40px; }
    #imams, #library, #lectures { padding: 100px 0; }
    #marja, #dua, #calendar-prayer, #qa, #quran { padding: 100px 40px; }

    /* Cap over-wide reading measures */
    .about-text p, .dua-page-desc { max-width: 62ch; }
    .section-desc { max-width: 54ch; }
  }

  @media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
  }