/* ==========================================================================
   Punjabi Books — matches English Books design system (books.mrjatt.online)
   Dark theme, Swiss Modernism 2.0, Cinzel + Cormorant Garamond + Inter
   ========================================================================== */

:root {
  --bg: #0f172a;
  --card: #111827;
  --card-hover: #1e293b;
  --border: #334155;
  --text: #f8fafc;
  --muted: #cbd5e1;
  --muted-soft: #94a3b8;
  --accent: #d97706;
  --accent-hover: #b45309;
  --primary: #78716c;
  --shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
  --radius: 16px;
  --radius-sm: 9px;
  --wrap: 1200px;
  --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: 'Cormorant Garamond', ui-serif, Georgia, serif;
  --font-display: 'Cinzel', ui-serif, Georgia, serif;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

h1, h2, h3 { font-family: var(--font-serif); line-height: 1.22; margin: 0 0 0.5em; letter-spacing: -0.015em; }
h1 { font-weight: 700; }
h2 { font-weight: 600; }
h3 { font-weight: 600; }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: 20px; }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent); color: #000; padding: 10px 16px; border-radius: 0 0 8px 0;
  text-decoration: none; font-weight: 600;
}
.skip:focus { left: 0; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------- header ---------- */
.site-head {
  position: sticky; top: 0; z-index: 50;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.head-inner {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center;
  gap: 18px; min-height: 66px;
}
.head-inner > * { min-width: 0; }

@media (max-width: 720px) {
  .head-inner {
    display: flex; flex-wrap: wrap; align-items: center;
    gap: 10px 12px; min-height: 0; padding: 10px 0;
  }
  .brand { order: 1; flex: 0 0 auto; white-space: nowrap; }
  .head-inner .search { order: 3; flex: 1 1 100%; max-width: none; }
  .head-inner .site-nav { order: 2; flex: 1 1 0; min-width: 0;
    justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto;
    overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    mask-image: linear-gradient(to right, #000 calc(100% - 18px), transparent);
  }
  .site-nav::-webkit-scrollbar { display: none; }
  .site-nav > a, .drop > button {
    min-height: 44px; white-space: nowrap; padding-inline: 10px;
  }
  .is-home .search { display: none; }
}

@media (max-width: 560px) {
  .head-inner .brand span { display: none; }
  .head-inner .brand .brand-mark { width: 30px; height: 30px; }
  .head-inner .site-nav > a, .head-inner .drop > button { padding-inline: 8px; }
}

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text);
  font-family: var(--font-display); font-weight: 700; font-size: 1.5rem; letter-spacing: 1px; }
.brand:hover { text-decoration: none; }
.head-inner .brand .brand-mark {
  display: inline-grid; place-items: center; width: 34px; height: 34px;
  border-radius: 8px; background: linear-gradient(135deg, #d946ef, #4f46e5);
  color: #fff; font-weight: 600; font-size: 0.8rem; letter-spacing: 0.03em;
}

.search { display: flex; gap: 8px; justify-self: center; width: 100%; max-width: 460px; }
.search input {
  flex: 1; min-width: 0; font: inherit; font-size: 0.92rem; color: var(--text);
  background: rgba(18, 18, 31, 0.7); border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px; padding: 9px 16px;
}
.search input::placeholder { color: var(--muted-soft); }
.search input:focus { background: rgba(18, 18, 31, 0.95); border-color: var(--accent);
  outline: none; box-shadow: 0 0 0 4px rgba(217, 119, 6, 0.12); }
.search button {
  font: inherit; font-size: 0.9rem; font-weight: 600; color: #000; cursor: pointer;
  background: var(--accent); border: 0; border-radius: 999px; padding: 9px 20px;
}
.search button:hover { background: var(--accent-hover); }

.site-nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.site-nav > a, .drop > button {
  font: inherit; font-size: 0.92rem; font-weight: 500; color: var(--muted-soft);
  background: none; border: 0; cursor: pointer; padding: 8px 12px; border-radius: var(--radius-sm);
}
.site-nav > a:hover, .drop > button:hover, .site-nav .on { color: var(--text);
  background: rgba(255, 255, 255, 0.05); text-decoration: none; }
.drop { position: relative; }
.drop-menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 268px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 6px; display: none; z-index: 60;
}
.drop:hover .drop-menu, .drop:focus-within .drop-menu { display: block; }
.drop-menu a {
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
  padding: 8px 12px; border-radius: var(--radius-sm); color: var(--text); font-size: 0.9rem;
}
.drop-menu a:hover { background: rgba(217, 119, 6, 0.15); text-decoration: none; }
.n { font-size: 0.76rem; color: var(--muted-soft); font-variant-numeric: tabular-nums; }

/* ---------- hero ---------- */
.hero {
  position: relative; padding: clamp(28px, 5vw, 56px) 1rem;
  overflow: hidden; background: radial-gradient(ellipse 80% 50% at 50% -20%,
    rgba(217, 119, 6, 0.15), transparent 70%), var(--bg);
  text-align: center;
}
.hero .hero-inner { position: relative; z-index: 1; }
.hero .tag-free {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem 1rem; background: rgba(217, 119, 6, 0.15);
  border: 1px solid rgba(217, 119, 6, 0.3); color: var(--accent);
  font-family: var(--font-display); font-size: 0.85rem; letter-spacing: 2px;
  text-transform: uppercase; border-radius: 50px; font-weight: 600;
  margin-bottom: 1.5rem;
}
.hero h1 { font-size: clamp(3rem, 7vw, 5rem); font-weight: 700; line-height: 1.1;
  margin-bottom: 1.25rem; letter-spacing: -1px; }
.hero h1 .accent { color: var(--accent); }
.hero p { font-size: clamp(1.1rem, 1.5vw, 1.35rem); color: var(--muted);
  max-width: 640px; margin: 0 auto 2rem; line-height: 1.7; }

.hero-search { max-width: 700px; margin: 0 auto 3rem; position: relative; z-index: 1; }
.hero-search-box {
  display: flex; gap: 0; background: var(--card); border: 2px solid var(--border);
  border-radius: 50px; overflow: hidden; box-shadow: var(--shadow);
  transition: all 0.3s ease;
}
.hero-search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(217, 119, 6, 0.15), var(--shadow);
  transform: translateY(-2px);
}
.hero-search-box input {
  flex: 1; padding: 1rem 1.75rem; background: transparent; border: none;
  color: var(--text); font-family: var(--font-sans); font-size: 1.05rem; outline: none;
}
.hero-search-box input::placeholder { color: var(--muted-soft); }
.hero-search-box button {
  padding: 1rem 1.75rem; background: var(--accent); color: #000;
  border: none; font-weight: 700; font-size: 1rem; cursor: pointer;
  transition: all 0.2s; display: flex; align-items: center; justify-content: center; gap: 0.5rem;
}
.hero-search-box button:hover { background: var(--accent-hover); transform: scale(1.02); }

/* ---------- stats ---------- */
.stats-bar { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap;
  margin-bottom: 3rem; }
.stat {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  padding: 1rem 1.5rem; display: flex; align-items: center; gap: 0.75rem;
  min-width: 140px; transition: transform 0.2s, border-color 0.2s;
}
.stat:hover { transform: translateY(-3px); border-color: var(--accent); }
.stat i { color: var(--accent); font-size: 1.5rem; }
.stat-info b { display: block; font-size: 1.5rem; font-family: var(--font-display);
  color: var(--text); }
.stat-info span { font-size: 0.8rem; color: var(--muted-soft);
  text-transform: uppercase; letter-spacing: 1px; }

/* ---------- sections ---------- */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 2rem; flex-wrap: wrap; gap: 1rem;
}
.section-header h2 { font-size: 2rem; font-weight: 700; margin: 0;
  letter-spacing: -0.5px; }
.section-header .view-all { color: var(--accent); font-weight: 600; font-size: 0.95rem;
  display: inline-flex; align-items: center; gap: 0.5rem; transition: all 0.2s; }
.section-header .view-all:hover { color: var(--accent-hover); transform: translateX(4px); }

.sec { margin-bottom: 54px; }
.sec-h {
  font-family: var(--font-serif);
  font-size: 0.74rem; font-weight: 500; letter-spacing: 0.15em;
  text-transform: uppercase; color: var(--muted-soft);
  padding-bottom: 10px; border-bottom: 1px solid var(--border);
  margin: 0 0 24px;
}
.sec-note {
  font-family: var(--font-sans); font-size: 0.85rem; color: var(--muted-soft);
  margin: 10px 0 24px;
}
.more-link { margin: 16px 0 0; }

/* ---------- grid / cards ---------- */
.grid {
  display: grid;
  gap: 1.5rem; padding-bottom: 4rem;
}
@media (min-width: 1200px) { .grid { grid-template-columns: repeat(7, 1fr); } }
@media (min-width: 992px) and (max-width: 1199px) { .grid { grid-template-columns: repeat(6, 1fr); } }
@media (min-width: 768px) and (max-width: 991px) { .grid { grid-template-columns: repeat(5, 1fr); } }
@media (min-width: 576px) and (max-width: 767px) { .grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 575px) { .grid { grid-template-columns: repeat(3, 1fr); } }
.book-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; height: 100%;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1); cursor: pointer;
  position: relative;
}
.book-card:hover {
  transform: translateY(-8px); border-color: var(--accent);
  box-shadow: var(--shadow); z-index: 2;
}
.book-card:focus { outline: 3px solid var(--accent); outline-offset: 2px; }
.cover-wrapper {
  position: relative; width: 100%; aspect-ratio: 2/3;
  background: linear-gradient(160deg, #1e293b 0%, #0f172a 100%); overflow: hidden;
}
.cover-wrapper img {
  width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; display: block;
}
.book-card:hover .cover-wrapper img { transform: scale(1.05); }
.book-badge {
  position: absolute; top: 0.75rem; left: 0.75rem;
  background: rgba(217, 119, 6, 0.95); color: #000; font-size: 0.7rem;
  font-weight: 800; padding: 0.3rem 0.7rem; border-radius: 20px;
  letter-spacing: 0.5px; text-transform: uppercase;
}
.book-info { padding: 1rem 1rem 1.25rem; display: flex; flex-direction: column;
  flex-grow: 1; }
.book-title {
  font-family: var(--font-serif); font-size: 1.05rem; font-weight: 600;
  color: var(--text); margin: 0 0 0.4rem; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.book-author { color: var(--muted-soft); font-size: 0.85rem; margin: 0 0 0.75rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.book-tags { display: flex; gap: 0.4rem; margin-top: auto; }
.book-tag {
  font-size: 0.65rem; padding: 0.2rem 0.5rem;
  background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--muted-soft); border-radius: 12px;
}

/* ---------- chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.category-chip {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.75rem 1.5rem; background: var(--card); border: 1px solid var(--border);
  border-radius: 50px; color: var(--muted-soft); text-decoration: none;
  font-size: 0.95rem; font-weight: 500; margin: 0.5rem 0.5rem 0.5rem 0;
  transition: all 0.2s; cursor: pointer;
}
.category-chip:hover, .category-chip.active {
  background: var(--accent); color: #000; border-color: var(--accent);
  transform: translateY(-3px); box-shadow: 0 10px 20px rgba(217, 119, 6, 0.3);
}
.category-chip i { font-size: 1.1rem; }

/* ---------- sortbar ---------- */
.sortbar { display: flex; flex-wrap: wrap; align-items: center; gap: 7px;
  margin: 0 0 20px; }
.sortbar-label { font-size: 0.84rem; color: var(--muted-soft); margin-right: 3px; }
.sortbar button {
  font: inherit; font-size: 0.84rem; color: var(--muted-soft); cursor: pointer;
  background: var(--card); border: 1px solid var(--border); border-radius: 999px;
  padding: 6px 14px; }
.sortbar button:hover { border-color: var(--accent); color: var(--text); }
.sortbar button[aria-pressed="true"] {
  background: var(--accent); border-color: var(--accent); color: #000; font-weight: 700;
}

/* ---------- pager ---------- */
.pagination { justify-content: center; margin-top: 2rem; }
.page-link {
  background: var(--card); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; margin: 0 0.3rem; min-width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center; transition: all 0.2s;
}
.page-link:hover { background: var(--secondary); border-color: var(--accent); color: var(--accent); }
.page-item.active .page-link { background: var(--accent); border-color: var(--accent);
  color: #000; font-weight: 700; }
.page-item.disabled .page-link { color: var(--muted-soft); border-color: var(--border); }

/* ---------- book page ---------- */
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: 0.85rem;
  color: var(--muted-soft); margin: 22px 0; }
.crumbs a { color: var(--muted-soft); }
.crumbs span { color: var(--muted-soft); }

.book { display: grid; grid-template-columns: minmax(0, 300px) 1fr;
  gap: clamp(24px, 4vw, 48px); align-items: start; }
.book-media { background: linear-gradient(160deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); }
.book-media img { width: 100%; }
.book-main h1 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
.book-by { color: var(--muted-soft); margin: 0 0 14px; }

.read-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 22px; }
.read-actions a {
  display: inline-flex; align-items: center; border-radius: 8px; padding: 9px 15px;
  font-size: 0.9rem; font-weight: 600; text-decoration: none;
  border: 1px solid transparent; }
.btn-read { background: var(--accent); border-color: var(--accent); color: #000; }
.btn-read:hover { background: var(--accent-hover); }
.btn-dl { background: #12683a; border-color: #12683a; color: #fff; }
.btn-dl:hover { background: #0d522d; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.05); border-color: rgba(255, 255, 255, 0.3); }

.spec-block { border-top: 1px solid var(--border); padding-top: 14px; margin-top: 18px; }
.spec-block h2 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--muted-soft); margin: 0 0 10px; }
.spec { display: grid; grid-template-columns: auto 1fr; gap: 7px 18px;
  margin: 0; font-size: 0.92rem; }
.spec dt { color: var(--muted-soft); }
.spec dd { margin: 0; color: var(--text); }

.desc, .rel { margin: 48px 0; }
.desc h2, .rel h2 { font-size: 1.2rem; font-family: var(--font-serif); }
.desc p { color: var(--muted-soft); max-width: 78ch; }

.reader { margin: 48px 0 0; }
.reader h2 { font-size: 1.2rem; margin: 0 0 12px; }
.reader p { font-size: 0.85rem; color: var(--muted-soft); margin: 8px 0 0; }
.reader-lede { color: var(--muted-soft); }
.reader-cta { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.subs { margin: 48px 0 0; }
.subs h2 { font-size: 1.2rem; font-family: var(--font-serif); }

/* ---------- search ---------- */
.search-page { max-width: 640px; margin: 0 auto 28px; }
.empty { color: var(--muted-soft); text-align: center; padding: 48px 0;
  grid-column: 1 / -1; }

/* ---------- collections ---------- */
.coll-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.6rem; }
.coll-tile {
  display: flex; flex-direction: column; gap: 0.2rem;
  padding: 0.7rem 0.85rem; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--card);
  color: inherit; text-decoration: none; }
.coll-tile:hover { border-color: var(--accent); }
.coll-tile-h { font-weight: 600; font-size: 0.95rem; line-height: 1.25; }
.coll-tile-n { font-size: 0.78rem; color: var(--muted-soft); font-variant-numeric: tabular-nums; }

/* ---------- footer ---------- */
.site-foot { border-top: 1px solid var(--border); margin-top: 64px; }
.foot-inner { padding: 36px 20px; text-align: center; color: var(--muted-soft);
  font-size: 0.9rem; }
.foot-brand { font-size: 1.3rem; font-weight: 700; color: var(--text);
  margin: 0 0 6px; font-family: var(--font-display); }
.foot-brand em { font-style: normal; color: var(--accent); }
.foot-note { color: var(--muted-soft); font-size: 0.82rem; }

/* ---------- responsive ---------- */
@media (max-width: 768px) {
  .hero { padding-top: 6.5rem; }
  .hero h1 { font-size: 2.5rem; }
  .books-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 1rem; }
  .search-box button { padding: 1rem 1.25rem; font-size: 0.9rem; }
}

@media (prefers-reduced-motion: reduce) {
  .book-card, .cover-wrapper img { animation: none !important; transition: none !important; }
}

/* Stagger animation for book cards */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.book-card { animation: fadeUp 0.5s ease-out both; }
.book-card:nth-child(1) { animation-delay: 0.03s; }
.book-card:nth-child(2) { animation-delay: 0.06s; }
.book-card:nth-child(3) { animation-delay: 0.09s; }
.book-card:nth-child(4) { animation-delay: 0.12s; }
.book-card:nth-child(5) { animation-delay: 0.15s; }
.book-card:nth-child(6) { animation-delay: 0.18s; }
.book-card:nth-child(7) { animation-delay: 0.21s; }
.book-card:nth-child(8) { animation-delay: 0.24s; }

/* Placeholder */
.empty-cover { width: 220px; height: 320px; background: #1a1a2e; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; color: var(--muted);
  font-size: 0.9rem; }

.meta-chip {
  display: inline-block; background: var(--secondary); color: #fff;
  padding: 0.25rem 0.6rem; border-radius: 40px; margin: 0.2rem;
  font-size: 0.85rem; }

.file-link { display: block; padding: 0.75rem 1rem; background: var(--card);
  border-radius: 8px; margin-bottom: 0.5rem; color: #fff; text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.1); }
.file-link:hover { background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.3); }
.file-link i { width: 20px; }
.back-link { color: var(--muted); text-decoration: none; }
.back-link:hover { color: #fff; }

/* Loading state */
.skeleton {
  background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
  background-size: 200% 100%; animation: shimmer 1.5s infinite;
  border-radius: 8px; }
.skeleton-lg { height: 200px; width: 100%; }
@keyframes shimmer {
  0% { background-position: 200% 0; } 100% { background-position: -200% 0; }
}
.loading-state, .empty-state { text-align: center; padding: 5rem 1rem;
  color: var(--muted-soft); }
.loading-state .spinner-border { color: var(--accent); }
.empty-state i { font-size: 4rem; color: var(--border); margin-bottom: 1rem;
  display: block; }
.empty-state h3 { color: var(--text); margin-bottom: 0.5rem; }
