/* ═══════════════════════════════════════════════════════════
   Shared styles for all hadees book pages (all 5 languages)
   Language-specific overrides live in each page's <style>.
═══════════════════════════════════════════════════════════ */

@font-face {
  font-family: 'MuhammadiQuranic';
  src: url('../fonts/MuhammadiQuranic.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

:root {
  --red-deep: #7a0c0c;
  --red-primary: #991b1b;
  --gold: #f59e0b;
  --gold-light: #fcd34d;
  --muted: #6b3232;
  --bg: #fff9f9;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: #1c0707;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

a {
  color: var(--red-primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.container {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ── Nav ── */
.site-header {
  background: #fff;
  border-bottom: 1px solid rgba(15, 58, 71, 0.10);
  padding: 10px 0;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 2px 14px rgba(15, 58, 71, 0.07);
}

.site-header-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}

.site-logo img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.site-logo-name {
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: #0f3a47;
}

.site-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
}

.site-nav a {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.86rem;
  font-weight: 500;
  color: #5a6e75;
  text-decoration: none;
  padding: 7px 13px;
  border-radius: 999px;
  transition: background 0.15s, color 0.15s;
}

.site-nav a:hover {
  background: rgba(15, 58, 71, 0.07);
  color: #0f3a47;
  text-decoration: none;
}

.site-nav a.nav-cta {
  background: #0e6da8;
  color: #fff;
  font-weight: 600;
}

.site-nav a.nav-cta:hover {
  background: #0a5a8f;
}

@media (max-width: 600px) {
  .site-logo-name {
    display: none;
  }

  .site-nav a:not(.nav-cta) {
    display: none;
  }
}

/* ── Page header ── */
.page-header {
  background: linear-gradient(135deg, #6b0f0f 0%, #991b1b 100%);
  padding: 36px 0 40px;
  text-align: center;
  position: relative;
}

.page-header::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.lang-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid rgba(245, 158, 11, 0.45);
  color: var(--gold);
  padding: 5px 16px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.page-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  margin: 0 0 8px;
}

.page-header p {
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.88rem;
  margin: 0;
}

@media (min-width: 640px) {
  .page-header h1 {
    font-size: 1.7rem;
  }

  .page-header p {
    font-size: 0.95rem;
  }
}

/* ══════════════════════════════════
   BOOK — MOBILE FIRST
══════════════════════════════════ */
.book-section {
  padding: 32px 0 48px;
}

/* Mobile: portrait POV room background — book sits in the cupped hands */
@media (max-width: 639px) {
  body {
    background:
      linear-gradient(rgba(255, 249, 249, 0.10), rgba(255, 249, 249, 0.10)),
      url('../images/flip-book-bg-mobile.jpg') center 30% / cover no-repeat;
  }

  main {
    background:
      linear-gradient(rgba(255, 249, 249, 0.10), rgba(255, 249, 249, 0.10)),
      url('../images/flip-book-bg-mobile.jpg') center 30% / cover no-repeat;
  }

  .book-section {
    padding: 40px 0 56px;
  }
}

/* Tablet & desktop: POV room background — book sits in the cupped hands */
@media (min-width: 640px) {
  body {
    background:
      linear-gradient(rgba(255, 249, 249, 0.10), rgba(255, 249, 249, 0.10)),
      url('../images/flip-book-bg.jpg') center 30% / cover no-repeat;
  }

  main {
    background:
      linear-gradient(rgba(255, 249, 249, 0.10), rgba(255, 249, 249, 0.10)),
      url('../images/flip-book-bg.jpg') center 30% / cover no-repeat;
  }

  .book-section {
    padding: 60px 0 80px;
  }
}

.book-outer {
  width: 100%;
  max-width: 704px;
  margin: 0 auto;
  position: relative;
}

/* Page edge strips */
.book-outer::before {
  content: '';
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: -7px;
  right: -7px;
  border-radius: 6px;
  background: linear-gradient(to right,
      #2d0606 0, #2d0606 3px,
      #4a0d0d 3px, #4a0d0d 7px,
      transparent 7px, transparent calc(100% - 7px),
      #ede3d0 calc(100% - 7px), #ede3d0 calc(100% - 3px),
      #e2d8bc calc(100% - 3px));
}

.book {
  width: 100%;
  height: 290px;
  display: grid;
  grid-template-columns: 1fr 5px 1fr;
  position: relative;
  border-radius: 6px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.38), 0 0 0 1px rgba(0, 0, 0, 0.06);
}

@media (min-width: 640px) {
  .book {
    height: 440px;
  }
}

/* ── LEFT PAGE (Arabic) ── */
.page-left {
  height: 100%;
  background: linear-gradient(160deg, #6b1010 0%, #3d0505 55%, #220202 100%);
  border-radius: 6px 0 0 6px;
  position: relative;
  overflow: hidden;
  z-index: 1;
}

.page-left::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(45deg, rgba(245, 158, 11, 0.05) 0, rgba(245, 158, 11, 0.05) 1px, transparent 0, transparent 14px),
    repeating-linear-gradient(-45deg, rgba(245, 158, 11, 0.05) 0, rgba(245, 158, 11, 0.05) 1px, transparent 0, transparent 14px);
  pointer-events: none;
}

.page-left::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 30px;
  background: linear-gradient(to right, transparent, rgba(0, 0, 0, 0.22));
  pointer-events: none;
}

/* ── SPINE ── */
.book-spine {
  width: 5px;
}

.book-outer::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(50% - 2.5px);
  width: 5px;
  background: linear-gradient(to bottom,
      rgba(245, 158, 11, 0.1),
      rgba(245, 158, 11, 0.6) 30%,
      rgba(245, 158, 11, 0.7) 50%,
      rgba(245, 158, 11, 0.6) 70%,
      rgba(245, 158, 11, 0.1));
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.22), 2px 0 6px rgba(0, 0, 0, 0.12);
  pointer-events: none;
}

/* ── RIGHT PAGE (Translation) ── */
.page-right {
  height: 100%;
  background: #fdf6ec;
  border-radius: 0 6px 6px 0;
  position: relative;
  overflow: hidden;
  z-index: 1;
}

.page-right::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(transparent 0, transparent 24px,
      rgba(180, 140, 100, 0.09) 24px, rgba(180, 140, 100, 0.09) 25px);
  pointer-events: none;
}

.page-right::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 28px;
  background: linear-gradient(to left, transparent, rgba(0, 0, 0, 0.07));
  pointer-events: none;
}

/* ── PAGE INNER ── */
.page-inner {
  position: relative;
  z-index: 2;
  height: 100%;
  padding: 12px 10px 10px;
  display: flex;
  flex-direction: column;
}

@media (min-width: 640px) {
  .page-inner {
    padding: 20px 18px 14px;
  }
}

/* Logo mark (left page) */
.book-logo {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 8px;
  flex-shrink: 0;
}

.book-logo img {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(245, 158, 11, 0.4);
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.4);
  flex-shrink: 0;
}

.book-logo-name {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(245, 158, 11, 0.6);
  white-space: nowrap;
}

@media (min-width: 640px) {
  .book-logo img {
    width: 26px;
    height: 26px;
  }

  .book-logo-name {
    font-size: 0.6rem;
  }
}

/* Right page label */
.page-tag {
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
  flex-shrink: 0;
  color: rgba(155, 100, 60, 0.65);
}

@media (min-width: 640px) {
  .page-tag {
    font-size: 0.6rem;
  }
}

/* Number badge */
.hadees-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 800;
  font-size: 0.75rem;
  color: #3d0505;
  z-index: 3;
}

@media (min-width: 640px) {
  .hadees-badge {
    width: 34px;
    height: 34px;
    top: 14px;
    right: 14px;
    font-size: 0.85rem;
  }
}

/* Arabic intro label */
.arabic-intro {
  font-family: 'MuhammadiQuranic', 'Amiri', serif;
  font-size: 1rem;
  direction: rtl;
  text-align: center;
  color: #fcd34d;
  letter-spacing: 0.02em;
  flex-shrink: 0;
  margin-bottom: 4px;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
}

@media (min-width: 640px) {
  .arabic-intro {
    font-size: 1.8rem;
  }
}

/* Arabic text (left page) */
.arabic-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 2px;
}

.arabic {
  font-family: 'MuhammadiQuranic', 'Amiri', serif;
  font-size: 1.05rem;
  line-height: 2.1;
  direction: rtl;
  text-align: center;
  word-spacing: 0.2em;
  color: #fde68a;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

@media (min-width: 640px) {
  .arabic {
    font-size: 1.38rem;
  }
}

/* Translation (right page) */
.translation-wrap {
  flex: 1;
  min-height: 0;
  padding-top: 2px;
  overflow: hidden;
}

.translation {
  font-size: 0.72rem;
  color: #3a1a00;
  line-height: 1.72;
  margin: 0;
  overflow-wrap: break-word;
}

.translation strong {
  color: #7a3c00;
  font-weight: 600;
}

@media (max-width: 390px) {
  .translation {
    font-size: 0.7rem;
    line-height: 1.55;
  }
}

@media (min-width: 640px) {
  .translation {
    font-size: 1.35rem;
  }
}

/* Divider + reference */
.page-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(180, 130, 60, 0.38), transparent);
  margin: 8px 0 6px;
  flex-shrink: 0;
}

.reference {
  font-size: 0.6rem;
  color: rgba(120, 70, 20, 0.58);
  flex-shrink: 0;
}

@media (min-width: 640px) {
  .reference {
    font-size: 0.68rem;
  }
}

.page-foot {
  display: none;
}

/* ── FLIP LEAF ── */
.flip-leaf {
  position: absolute;
  top: 0;
  height: 100%;
  width: calc(50% - 2.5px);
  transform-style: preserve-3d;
  display: none;
  z-index: 20;
  pointer-events: none;
}

.flip-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
}

.flip-back {
  transform: rotateY(180deg);
}

.left-face {
  background: linear-gradient(160deg, #6b1010 0%, #3d0505 55%, #220202 100%);
  border-radius: 6px 0 0 6px;
}

.left-face::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(45deg, rgba(245, 158, 11, 0.05) 0, rgba(245, 158, 11, 0.05) 1px, transparent 0, transparent 14px),
    repeating-linear-gradient(-45deg, rgba(245, 158, 11, 0.05) 0, rgba(245, 158, 11, 0.05) 1px, transparent 0, transparent 14px);
  pointer-events: none;
}

.right-face {
  background: #fdf6ec;
  border-radius: 0 6px 6px 0;
}

.right-face::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(transparent 0, transparent 24px,
      rgba(180, 140, 100, 0.09) 24px, rgba(180, 140, 100, 0.09) 25px);
  pointer-events: none;
}

/* ── AUDIO BAR ── */
.audio-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 704px;
  margin: 14px auto 0;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid rgba(185, 28, 28, 0.13);
  border-radius: 10px;
  box-shadow: 0 3px 10px rgba(122, 12, 12, 0.07);
}

.audio-bar-label {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 1rem;
  flex-shrink: 0;
  line-height: 1;
}

.audio-play-btn {
  font-family: 'Inter', system-ui, sans-serif;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--red-primary);
  color: #fff;
  font-size: 0.9rem;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(153, 27, 27, 0.35);
  transition: background 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.audio-play-btn:hover {
  background: var(--red-deep);
}

.audio-play-btn:active {
  transform: scale(0.93);
}

.audio-track {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.audio-progress-wrap {
  flex: 1;
  height: 5px;
  background: rgba(185, 28, 28, 0.12);
  border-radius: 3px;
  cursor: pointer;
  position: relative;
}

.audio-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--red-primary);
  border-radius: 3px;
  pointer-events: none;
}

.audio-time {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.6rem;
  color: var(--muted);
  letter-spacing: 0.03em;
}

/* ── NAVIGATION ── */
.book-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 18px;
}

.nav-btn {
  font-family: 'Inter', system-ui, sans-serif;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 16px;
  border-radius: 999px;
  border: 2px solid rgba(185, 28, 28, 0.25);
  background: #fff;
  color: var(--red-primary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  box-shadow: 0 2px 8px rgba(122, 12, 12, 0.09);
  -webkit-tap-highlight-color: transparent;
}

.nav-btn:hover {
  background: var(--red-primary);
  color: #fff;
  border-color: var(--red-primary);
}

.nav-btn:active {
  transform: scale(0.95);
}

.nav-btn:disabled {
  opacity: 0.25;
  cursor: default;
  pointer-events: none;
}

.book-dots {
  display: flex;
  align-items: center;
  gap: 7px;
}

.book-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(185, 28, 28, 0.2);
  border: none;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.2s, transform 0.2s;
}

.book-dot.active {
  background: var(--red-primary);
  transform: scale(1.4);
}

.swipe-hint {
  display: none;
  text-align: center;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 10px;
}

@media (max-width: 640px) {
  .swipe-hint {
    display: block;
  }
}

footer {
  font-family: 'Inter', system-ui, sans-serif;
  background: #3d0505;
  color: rgba(255, 248, 240, 0.55);
  text-align: center;
  padding: 20px;
  font-size: 0.86rem;
}

footer a {
  color: var(--gold);
}