/* ============================================================
   MAIN CSS — Sacred Scriptures Bible App
   Aesthetic: Ancient Hebrew manuscript, aged parchment
   ============================================================ */

:root {
  --parchment:       #f4e4c1;
  --parchment-dark:  #e8d5a0;
  --parchment-aged:  #d4b896;
  --ink:             #2a1a0a;
  --ink-fade:        #4a3520;
  --ink-light:       #6b4c2a;
  --red-letter:      #8b1a1a;
  --gold:            #b8860b;
  --gold-light:      #d4a017;
  --gold-shine:      #f0c040;
  --border-color:    #8b6914;
  --shadow:          rgba(0,0,0,0.45);
  --spine-color:     #5c3d1e;
  --leather:         #3e2208;

  --font-title:      'UnifrakturMaguntia', cursive;
  --font-body:       'IM Fell English', serif;
  --font-sc:         'IM Fell English SC', serif;
  --font-hebrew:     'Noto Serif Hebrew', serif;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  background: #1a0e05;
  background-image:
    radial-gradient(ellipse at 20% 20%, #2d1a08 0%, transparent 60%),
    radial-gradient(ellipse at 80% 80%, #2d1a08 0%, transparent 60%),
    url("data:image/svg+xml,%3Csvg width='100' height='100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.08'/%3E%3C/svg%3E");
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--ink);
  overflow-x: hidden;
}

/* ============================================================
   PARCHMENT OVERLAY (texture over everything)
   ============================================================ */
.parchment-overlay {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23p)' opacity='0.04'/%3E%3C/svg%3E");
}

/* ============================================================
   HEADER
   ============================================================ */
.app-header {
  position: relative; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px;
  background: linear-gradient(180deg, #1a0e05 0%, #2a1a08 50%, #1a0e05 100%);
  border-bottom: 3px double var(--gold);
  box-shadow: 0 4px 20px rgba(0,0,0,0.6);
}

.header-center { text-align: center; flex: 1; }

.header-hebrew {
  font-family: var(--font-hebrew);
  font-size: 1.8rem;
  color: var(--gold-light);
  letter-spacing: 0.2em;
  text-shadow: 0 0 12px rgba(212,160,23,0.5);
  line-height: 1;
  margin-bottom: 2px;
  direction: rtl;
}

.header-title {
  font-family: var(--font-title);
  font-size: clamp(1.2rem, 3vw, 2rem);
  color: var(--parchment);
  text-shadow: 2px 2px 6px rgba(0,0,0,0.7);
  letter-spacing: 0.04em;
  line-height: 1.2;
}

.header-sub {
  font-family: var(--font-sc);
  font-size: 0.75rem;
  color: var(--parchment-aged);
  letter-spacing: 0.1em;
  margin-top: 2px;
}

.yahuah {
  font-family: var(--font-hebrew);
  color: var(--gold-shine);
  font-size: 1.1em;
  direction: rtl;
}

/* ============================================================
   BREADCRUMB
   ============================================================ */
.breadcrumb {
  position: relative; z-index: 10;
  text-align: center;
  padding: 6px 20px;
  background: #150c03;
  border-bottom: 1px solid var(--border-color);
  font-family: var(--font-sc);
  font-size: 0.8rem;
  color: var(--gold-light);
  letter-spacing: 0.15em;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-icon {
  background: none; border: 1px solid var(--gold);
  color: var(--gold-light); font-size: 1.1rem;
  width: 36px; height: 36px;
  border-radius: 4px; cursor: pointer;
  transition: all 0.2s;
  display: flex; align-items: center; justify-content: center;
}
.btn-icon:hover { background: var(--gold); color: var(--ink); }

.btn-primary {
  background: linear-gradient(135deg, #8b6914, #b8860b);
  color: var(--parchment);
  border: 1px solid var(--gold-shine);
  padding: 8px 20px;
  font-family: var(--font-sc);
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-primary:hover { background: linear-gradient(135deg, #b8860b, #d4a017); transform: translateY(-1px); }

/* ============================================================
   BOOK CONTAINER
   ============================================================ */
.book-container {
  position: relative; z-index: 5;
  display: flex; justify-content: center;
  padding: 20px 10px 10px;
  min-height: calc(100vh - 200px);
}

.book-spread {
  display: flex;
  max-width: 1200px;
  width: 100%;
  box-shadow:
    -20px 0 40px rgba(0,0,0,0.5),
    20px 0 40px rgba(0,0,0,0.5),
    0 20px 60px rgba(0,0,0,0.7);
  border-radius: 2px 2px 0 0;
  position: relative;
}

/* ============================================================
   PAGE NAVIGATION
   ============================================================ */
.page-nav {
  position: relative; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  gap: 10px; padding: 10px 20px;
  background: #150c03;
  border-top: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.nav-btn {
  background: linear-gradient(180deg, #2e1c08, #1a0e05);
  color: var(--gold-light);
  border: 1px solid var(--border-color);
  padding: 7px 16px;
  font-family: var(--font-sc);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  cursor: pointer;
  border-radius: 3px;
  transition: all 0.2s;
}
.nav-btn:hover { background: linear-gradient(180deg, #4a2e0e, #2e1c08); border-color: var(--gold); color: var(--gold-shine); }
.nav-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.page-indicator {
  font-family: var(--font-sc);
  font-size: 0.78rem;
  color: var(--parchment-aged);
  letter-spacing: 0.1em;
  min-width: 100px;
  text-align: center;
}

/* ============================================================
   CHAPTER BAR
   ============================================================ */
.chapter-bar {
  position: relative; z-index: 10;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 20px;
  background: #1a0e05;
  border-top: 1px solid rgba(184,134,11,0.3);
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--gold) transparent;
}

.chapter-bar-label {
  font-family: var(--font-sc);
  font-size: 0.72rem;
  color: var(--gold-light);
  letter-spacing: 0.12em;
  white-space: nowrap;
}

.chapter-nums {
  display: flex; gap: 5px; flex-wrap: nowrap;
}

.chapter-num-btn {
  background: none;
  color: var(--parchment-aged);
  border: 1px solid rgba(184,134,11,0.4);
  width: 28px; height: 28px;
  border-radius: 3px;
  font-family: var(--font-sc);
  font-size: 0.7rem;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}
.chapter-num-btn:hover { background: rgba(184,134,11,0.2); color: var(--gold-shine); border-color: var(--gold); }
.chapter-num-btn.active { background: var(--gold); color: var(--ink); border-color: var(--gold-shine); }

/* ============================================================
   LOADING SCREEN
   ============================================================ */
.loading-screen {
  position: fixed; inset: 0; z-index: 999;
  background: #0e0804;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column;
  transition: opacity 0.8s;
}
.loading-screen.fade-out { opacity: 0; pointer-events: none; }

.loading-content { text-align: center; }

.loading-hebrew {
  font-family: var(--font-hebrew);
  font-size: 5rem;
  color: var(--gold-light);
  text-shadow: 0 0 40px rgba(212,160,23,0.6);
  animation: pulse-glow 2s ease-in-out infinite;
  direction: rtl;
}

.loading-text {
  font-family: var(--font-sc);
  color: var(--parchment-aged);
  letter-spacing: 0.2em;
  font-size: 0.85rem;
  margin: 16px 0 24px;
}

.loading-bar {
  width: 240px; height: 3px;
  background: rgba(184,134,11,0.2);
  border-radius: 2px;
  margin: 0 auto;
  overflow: hidden;
}

.loading-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold), var(--gold-shine));
  border-radius: 2px;
  transition: width 0.3s ease;
  box-shadow: 0 0 10px var(--gold);
}

@keyframes pulse-glow {
  0%, 100% { text-shadow: 0 0 40px rgba(212,160,23,0.6); }
  50% { text-shadow: 0 0 80px rgba(212,160,23,1), 0 0 120px rgba(212,160,23,0.4); }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .book-spread { flex-direction: column; }
  .spine-area { display: none; }
  .page { border-radius: 4px !important; }
  .page-right { margin-top: 8px; }
  .page-nav { gap: 6px; }
  .nav-btn { padding: 6px 10px; font-size: 0.7rem; }
}
