@font-face {
  font-family: 'Amiri';
  src: url('../fonts/Amiri-Regular.ttf') format('truetype');
  font-weight: normal;
}
@font-face {
  font-family: 'Amiri';
  src: url('../fonts/Amiri-Bold.ttf') format('truetype');
  font-weight: bold;
}

:root {
  --bg: #0e0c0a;
  --bg-alt: #18140f;
  --bg-card: #1c1712;
  --ink: #f2ead9;
  --muted: #a89a80;
  --gold: #cba053;
  --gold-bright: #e0b866;
  --border: #332c22;
  --serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', -apple-system, Segoe UI, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

.font-arabic, .font-arabic .chapter-content, .font-arabic .description, .font-arabic h1, .font-arabic h2 {
  font-family: 'Amiri', serif;
  line-height: 1.9;
}

h1, h2, h3, .brand, .hero-title { font-family: var(--serif); font-weight: 700; letter-spacing: 0.3px; }

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-bright); text-decoration: underline; }

/* ---------- Header ---------- */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.4rem 3rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: relative;
  z-index: 20;
}
html[dir="rtl"] .brand,
html[dir="rtl"] .footer-brand {
  font-family: 'Amiri', serif;
  font-style: normal;
}
.site-header .brand {
  font-size: 1.4rem;
  color: var(--ink);
  font-style: italic;
}
.site-header nav { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem 0.9rem; }
.site-header nav a {
  color: var(--ink);
  font-size: 0.98rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-family: var(--sans);
}
.site-header nav a:hover { color: var(--gold-bright); text-decoration: none; }
.site-header nav a.nav-cta {
  color: var(--bg);
  background: var(--gold);
  padding: 0.5rem 1rem;
  border-radius: 2px;
}
.site-header nav a.nav-cta:hover { background: var(--gold-bright); color: var(--bg); }
.lang-switch {
  margin-inline-start: 0.5rem;
  padding-inline-start: 1rem;
  border-inline-start: 1px solid var(--border);
  font-size: 0.98rem;
  font-weight: 500;
}
.lang-switch a { color: var(--ink); text-transform: none; letter-spacing: normal; margin: 0 0.25rem; }
.lang-switch a.lang-active { color: var(--gold-bright); font-weight: 700; }
.lang-switch .lang-sep { color: var(--muted); }
.site-header--transparent nav a,
.site-header--transparent .lang-switch a,
.site-header--transparent .lang-switch .lang-sep,
.site-header--transparent .brand {
  text-shadow: 0 1px 6px rgba(0,0,0,0.85), 0 0 2px rgba(0,0,0,0.6);
}
.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--ink);
  font-size: 1.3rem;
  padding: 0.3rem 0.7rem;
  cursor: pointer;
}

.site-header--transparent {
  position: absolute;
  top: 0; left: 0; right: 0;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  background: linear-gradient(to bottom, rgba(0,0,0,0.55), transparent);
}

/* ---------- Hero ---------- */

.book-hero-banner-link {
  display: block;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
}
.book-hero-banner {
  width: 100%;
  aspect-ratio: 1920 / 796;
  background-size: cover;
  background-position: center;
}

.hero-banner {
  position: relative;
  min-height: 92vh;
  display: flex;
  align-items: flex-end;
  background-size: cover;
  background-position: center 15%;
  color: var(--ink);
}
.hero-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, var(--bg) 5%, rgba(14,12,10,0.35) 55%, rgba(14,12,10,0.55) 100%);
}
.hero-content {
  position: relative;
  z-index: 2;
  max-width: 720px;
  padding: 0 3rem 5rem;
}
.hero-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.25em;
  font-size: 1rem;
  font-weight: 600;
  color: var(--gold-bright);
  margin-bottom: 1rem;
}
.font-arabic .hero-eyebrow {
  text-transform: none;
  letter-spacing: normal;
  font-size: 1.3rem;
}
.hero-title {
  font-size: clamp(2.6rem, 6vw, 4.4rem);
  line-height: 1.05;
  margin: 0 0 1rem;
}
.hero-subtitle {
  font-family: var(--serif);
  font-style: italic;
  color: var(--muted);
  font-size: 1.3rem;
  margin: 0 0 1.8rem;
}
.hero-cta-row { display: flex; gap: 1rem; flex-wrap: wrap; }

/* ---------- Layout shells ---------- */

main { max-width: 1100px; margin: 0 auto; padding: 3.5rem 3rem; }
body.has-hero main { max-width: none; margin: 0; padding: 0; }
.section-narrow { max-width: 760px; margin: 0 auto; }
.hero-banner + .section-narrow { padding: 3.5rem 3rem; }

.section-heading {
  font-size: 2rem;
  margin-bottom: 0.4rem;
}
.section-kicker {
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gold);
  margin-bottom: 0.6rem;
}
.font-arabic .section-kicker {
  text-transform: none;
  letter-spacing: normal;
  font-size: 1.15rem;
}

/* ---------- About-me (homepage) ---------- */

.about-me-section { background: var(--bg-alt); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.about-me-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 4.5rem 3rem;
  display: flex;
  align-items: center;
  gap: 3.5rem;
  flex-wrap: wrap;
}
.about-me-photo-wrap {
  position: relative;
  width: 320px;
  flex-shrink: 0;
  display: flex;
  justify-content: center;
}
.about-me-photo-wrap::before {
  content: "";
  position: absolute;
  inset: -10%;
  background: radial-gradient(circle, rgba(203,160,83,0.28) 0%, rgba(203,160,83,0) 70%);
  z-index: 0;
}
.about-me-photo {
  width: 280px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.about-me-photo.about-me-cutout {
  border-radius: 0;
  filter: drop-shadow(0 18px 30px rgba(0,0,0,0.6));
}
.about-me-text { flex: 1; min-width: 300px; }
.about-me-quote {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.3rem;
  color: var(--gold-bright);
  margin: 0.8rem 0 1.2rem;
  line-height: 1.5;
}
.about-me-text p { color: #ddd2ba; }
.about-me-text .about-me-quote { color: var(--gold-bright); }

/* ---------- Book grid / cards ---------- */

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 2.5rem;
  margin-top: 2.5rem;
}
.book-card {
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.5rem;
  text-align: center;
  background: var(--bg-card);
  transition: transform 0.18s ease, border-color 0.18s ease;
}
.book-card:hover { transform: translateY(-4px); border-color: var(--gold); text-decoration: none; }
.book-card img { width: 100%; max-width: 210px; box-shadow: 0 12px 30px rgba(0,0,0,0.5); margin-bottom: 1rem; }
.book-card h2 { font-size: 1.3rem; margin: 0.3rem 0; }
.book-card .subtitle { color: var(--muted); font-size: 1rem; margin: 0.2rem 0; font-style: italic; }
.book-card .price { font-size: 1.05rem; font-weight: 600; color: var(--gold-bright); font-family: var(--sans); margin-top: 0.6rem; }
.book-card .cta-inline { color: var(--gold); font-weight: 600; font-size: 1rem; }

/* ---------- Buttons ---------- */

.cta-row { display: flex; gap: 0.9rem; flex-wrap: wrap; margin: 1.2rem 0; }
.btn {
  display: inline-block;
  padding: 0.75rem 1.7rem;
  border-radius: 2px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--gold);
  font-family: var(--sans);
  font-size: 1rem;
  letter-spacing: 0.03em;
}
.btn-primary { background: var(--gold); color: #14110d; }
.btn-primary:hover { background: var(--gold-bright); text-decoration: none; color: #14110d; }
.btn-secondary { background: transparent; color: var(--ink); border-color: var(--muted); }
.btn-secondary:hover { border-color: var(--gold); color: var(--gold-bright); text-decoration: none; }

/* ---------- Book detail ---------- */

.book-detail { display: flex; align-items: flex-start; gap: 3rem; flex-wrap: wrap; }
.book-detail .cover { width: 280px; height: auto; flex-shrink: 0; box-shadow: 0 20px 50px rgba(0,0,0,0.55); position: sticky; top: 2rem; }
.book-detail .book-info { flex: 1; min-width: 300px; }
.book-detail h1 { font-size: 2.4rem; margin-bottom: 0.2rem; }
.book-detail .subtitle { color: var(--muted); font-family: var(--serif); font-style: italic; font-size: 1.1rem; }
.book-detail .author { color: var(--muted); margin-top: 0.3rem; }
.book-detail .price { font-size: 1.25rem; color: var(--gold-bright); font-weight: 600; margin: 1.2rem 0; }
.print-links { color: var(--muted); font-size: 1rem; }
.description p { margin: 0.9em 0; text-align: justify; color: #ddd2ba; }

/* ---------- Forms ---------- */

.auth-form, .contact-form-wrap { max-width: 440px; margin: 0 auto; }
.auth-form h1, .contact-form-wrap h1 { text-align: center; }
form.stacked-form { display: flex; flex-direction: column; gap: 1.1rem; margin: 1.8rem 0; }
form.stacked-form label { display: flex; flex-direction: column; gap: 0.4rem; font-size: 0.98rem; color: var(--ink); }
form.stacked-form input, form.stacked-form textarea, form.stacked-form select {
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 2px;
  font-size: 1rem;
  background: var(--bg-alt);
  color: var(--ink);
  font-family: var(--sans);
}
form.stacked-form input:focus, form.stacked-form textarea:focus, form.stacked-form select:focus { outline: none; border-color: var(--gold); }
.inline-form { display: inline; }
.error { color: #e07a6b; }
.notice { background: var(--bg-card); border: 1px solid var(--border); padding: 0.9rem 1.1rem; border-radius: 2px; color: var(--gold-bright); }

/* ---------- Reader ---------- */

.reader { max-width: 720px; margin: 0 auto; position: relative; }
.reader h1 { text-align: center; margin-bottom: 1.8rem; }
.chapter-content p { text-align: justify; text-indent: 1.5em; margin: 0 0 1em 0; color: #e6dcc4; }
.font-arabic .chapter-content p { text-align: justify; text-indent: 0; }
.sample-badge {
  display: inline-block;
  background: var(--gold);
  color: #14110d;
  padding: 0.3rem 1rem;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 1.2rem;
}

.gated-reader { user-select: none; -webkit-user-select: none; }
.reader-breadcrumb { color: var(--muted); font-size: 0.95rem; }
.chapter-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 3rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 0.75rem;
}
.chapter-progress { color: var(--muted); font-size: 0.95rem; }

.watermark-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-repeat: repeat;
  z-index: 5;
}

.library h1, .about-page h1, .news-page h1, .contact-form-wrap h1 { font-size: 2.2rem; }

/* ---------- About page ---------- */

.about-page { max-width: 760px; margin: 0 auto; }
.about-page .lede { font-family: var(--serif); font-style: italic; font-size: 1.25rem; color: var(--gold-bright); margin-bottom: 1.5rem; }
.about-page p { color: #ddd2ba; margin: 1em 0; text-align: justify; }
.about-page .timeline { border-inline-start: 2px solid var(--border); padding-inline-start: 1.5rem; margin: 2.5rem 0; }
.about-page .timeline-item { margin-bottom: 1.4rem; }
.about-page .timeline-year { color: var(--gold); font-weight: 600; font-size: 1rem; letter-spacing: 0.05em; }

/* ---------- News page ---------- */

.news-list { display: flex; flex-direction: column; gap: 2.2rem; margin-top: 2rem; }
.news-item { border-bottom: 1px solid var(--border); padding-bottom: 2.2rem; }
.news-date { color: var(--gold); font-size: 0.92rem; letter-spacing: 0.05em; text-transform: uppercase; }
.news-item h2 { margin: 0.4rem 0 0.6rem; font-size: 1.5rem; }
.news-item p { color: #ddd2ba; }

/* ---------- Contact page ---------- */

.contact-info { text-align: center; color: var(--muted); margin-bottom: 2rem; }
.newsletter-box {
  border: 1px solid var(--border);
  background: var(--bg-card);
  padding: 2rem;
  border-radius: 4px;
  margin-top: 3rem;
  text-align: center;
}
.newsletter-box h2 { margin-top: 0; }
.newsletter-box form { display: flex; gap: 0.6rem; max-width: 420px; margin: 1.2rem auto 0; flex-wrap: wrap; justify-content: center; }
.newsletter-box input[type="email"] {
  flex: 1;
  min-width: 220px;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--ink);
  border-radius: 2px;
}

/* ---------- Admin dashboard ---------- */

.admin-page h2 { margin-top: 2.5rem; font-size: 1.4rem; }
.admin-page .promo-form { max-width: 480px; }
.admin-stats { display: flex; gap: 1.5rem; flex-wrap: wrap; margin: 1.5rem 0 1rem; }
.admin-stat {
  flex: 1;
  min-width: 180px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.5rem;
  text-align: center;
}
.admin-stat-value { font-family: var(--serif); font-size: 1.8rem; color: var(--gold-bright); font-weight: 700; }
.admin-stat-label { color: var(--muted); font-size: 0.9rem; margin-top: 0.3rem; }
.admin-table { width: 100%; border-collapse: collapse; margin-top: 1rem; font-size: 0.95rem; }
.admin-table th, .admin-table td {
  text-align: start;
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--border);
}
.admin-table th { color: var(--gold); font-weight: 600; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; }
.admin-table td { color: #ddd2ba; }
.admin-page { overflow-x: auto; }

/* ---------- Footer ---------- */

.site-footer { border-top: 1px solid var(--border); background: var(--bg-alt); margin-top: 2rem; }
.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 3rem 3rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 2.5rem;
  justify-content: space-between;
}
.footer-col { display: flex; flex-direction: column; gap: 0.6rem; }
.footer-brand { font-family: var(--serif); font-size: 1.2rem; font-style: italic; margin: 0; }
.footer-tagline { color: var(--muted); font-size: 0.98rem; margin: 0; }
.footer-col a { color: var(--muted); font-size: 0.98rem; }
.footer-col a:hover { color: var(--gold-bright); }
.footer-copy { text-align: center; color: var(--muted); font-size: 0.9rem; padding: 1.2rem 0 2rem; margin: 0; }

/* ---------- Responsive ---------- */

@media (max-width: 820px) {
  .site-header { padding: 1rem 1.25rem; }
  .nav-toggle { display: inline-block; }
  .site-header nav {
    display: none;
    position: absolute;
    top: 100%; left: 0; right: 0;
    background: var(--bg);
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem 1.5rem 1.5rem;
    border-bottom: 1px solid var(--border);
  }
  .site-header nav.nav-open { display: flex; }
  .site-header nav a { margin: 0.4rem 0; }
  main, .section-narrow { padding: 2.5rem 1.25rem; }
  .hero-content { padding: 0 1.25rem 3rem; }
  .book-detail { gap: 2rem; }
  .about-me-inner { padding: 3rem 1.25rem; gap: 2rem; }
  .about-me-photo-wrap { width: 220px; }
  .about-me-photo { width: 200px; }
  .footer-inner { padding: 2.5rem 1.25rem 1rem; }
}
