/* ===== ROOT VARIABLES ===== */
:root {
  --gold: #c9a84c;
  --gold-light: #e8c97a;
  --gold-dark: #a07832;
  --dark: #0d0d0d;
  --dark2: #141414;
  --dark3: #1e1e1e;
  --dark4: #2a2a2a;
  --text: #e8e0d0;
  --text-muted: #9a8e7a;
  --border: rgba(201,168,76,0.2);
  --white: #ffffff;
  --shadow: 0 8px 32px rgba(0,0,0,0.6);
  --radius: 12px;
  --font-display: 'Playfair Display', serif;
  --font-urdu: 'Noto Nastaliq Urdu', serif;
  --font-body: 'Crimson Pro', Georgia, serif;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--dark);
  color: var(--text);
  font-family: var(--font-urdu);
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: 
    radial-gradient(ellipse at 20% 20%, rgba(201,168,76,0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(201,168,76,0.04) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ===== HEADER ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--dark2);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 32px;
  gap: 20px;
}

.header-logo {
  flex-shrink: 0;
}

.logo-img {
  height: 60px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(201,168,76,0.3));
}

.header-meta {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.header-meta.ltr { direction: ltr; }

.separator { color: var(--gold); opacity: 0.5; }

.admin-link {
  color: var(--gold);
  text-decoration: none;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  transition: color 0.2s;
}
.admin-link:hover { color: var(--gold-light); }

/* Edition Nav */
.edition-nav {
  background: var(--dark3);
  border-top: 1px solid var(--border);
  padding: 10px 32px;
  overflow-x: auto;
  scrollbar-width: none;
}
.edition-nav::-webkit-scrollbar { display: none; }

.nav-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: max-content;
  direction: rtl;
}

.nav-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.edition-pills {
  display: flex;
  gap: 8px;
  direction: ltr;
}

.pill {
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-family: var(--font-body);
  color: var(--text-muted);
  border: 1px solid rgba(201,168,76,0.2);
  text-decoration: none;
  transition: all 0.2s;
  background: transparent;
  white-space: nowrap;
}
.pill:hover, .pill.active {
  background: var(--gold);
  color: var(--dark);
  border-color: var(--gold);
}

/* ===== MAIN ===== */
.main-content {
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ===== HERO ===== */
.hero-section {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 48px;
  align-items: center;
  padding: 60px 0;
}

.edition-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: var(--dark);
  padding: 5px 18px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-family: var(--font-urdu);
  margin-bottom: 20px;
  letter-spacing: 0.02em;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 3rem);
  color: var(--white);
  line-height: 1.3;
  margin-bottom: 12px;
  direction: rtl;
}

.hero-sub {
  font-family: var(--font-urdu);
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 32px;
}

.read-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: var(--dark);
  padding: 14px 32px;
  border-radius: 50px;
  text-decoration: none;
  font-family: var(--font-urdu);
  font-size: 1rem;
  font-weight: 700;
  transition: all 0.3s;
  direction: rtl;
  box-shadow: 0 4px 20px rgba(201,168,76,0.4);
}
.read-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(201,168,76,0.5);
}
.read-btn svg { transform: rotate(180deg); }

.hero-preview {
  position: relative;
}

.preview-card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow), 0 0 0 1px var(--border);
  transition: transform 0.3s;
  display: block;
  text-decoration: none;
}
.preview-card:hover { transform: scale(1.02); }

.preview-img {
  width: 100%;
  height: 500px;
  object-fit: cover;
  display: block;
}

.preview-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
  padding: 20px;
  color: var(--gold);
  font-family: var(--font-urdu);
  text-align: center;
}

.preview-placeholder {
  background: var(--dark3);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== PAGES SECTION ===== */
.pages-section {
  padding: 40px 0 60px;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--gold);
  text-align: center;
  margin-bottom: 32px;
  position: relative;
  direction: rtl;
}
.section-title::after {
  content: '';
  display: block;
  width: 60px;
  height: 2px;
  background: var(--gold);
  margin: 12px auto 0;
  opacity: 0.5;
}

.pages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 20px;
}

.page-card {
  cursor: pointer;
  transition: transform 0.25s;
}
.page-card:hover { transform: translateY(-4px); }
.page-card:hover .page-zoom-icon { opacity: 1; }

.page-thumb {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: var(--dark3);
  aspect-ratio: 3/4;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  border: 1px solid var(--border);
}
.page-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.no-page {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 2rem;
  font-family: var(--font-display);
}

.page-zoom-icon {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
  color: var(--gold);
}

.page-label {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 8px;
  font-family: var(--font-urdu);
}

/* ===== ZOOM MODAL ===== */
.zoom-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.95);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.zoom-modal.open { display: flex; }

.zoom-controls {
  position: fixed;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 8px;
  z-index: 1001;
}
.zoom-controls button {
  width: 44px; height: 44px;
  background: var(--dark3);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.2s;
}
.zoom-controls button:hover { background: var(--gold); color: var(--dark); }

.zoom-container {
  max-width: 90vw;
  max-height: 90vh;
  overflow: auto;
  position: relative;
}
#zoomImage {
  display: block;
  transform-origin: center center;
  transition: transform 0.2s;
  max-width: 100%;
  border-radius: 8px;
}
.zoom-page-label {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.8);
  color: var(--gold);
  padding: 4px 16px;
  border-radius: 20px;
  font-family: var(--font-urdu);
  font-size: 0.85rem;
}

/* ===== NO EDITION ===== */
.no-edition {
  text-align: center;
  padding: 100px 20px;
}
.no-edition h2 {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.no-edition p { color: var(--text-muted); }

/* ===== FOOTER ===== */
.site-footer {
  background: var(--dark2);
  border-top: 1px solid var(--border);
  padding: 40px 24px;
  text-align: center;
  margin-top: 60px;
  position: relative;
  z-index: 1;
}
.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.footer-inner p {
  font-family: var(--font-urdu);
  font-size: 0.9rem;
  color: var(--text-muted);
}
.footer-inner a { color: var(--gold); text-decoration: none; }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .hero-section {
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 40px 0;
  }
  .hero-preview { display: none; }
  .header-top { padding: 12px 16px; }
  .logo-img { height: 44px; }
  .pages-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
}

@media (max-width: 480px) {
  .header-meta { display: none; }
  .header-top { justify-content: center; }
  .pages-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-title { font-size: 1.5rem; }
}
