/* ============ Sahara Publishing — Desert Futurism ============ */
:root {
  --ink: #0E0C14;
  --dusk: #191524;
  --dusk-2: #221C30;
  --gold: #D9A441;
  --gold-hi: #F0C86E;
  --sand: #EDE2CC;
  --sand-dim: #A99F8C;
  --teal: #3E8F82;
  --line: rgba(217, 164, 65, 0.18);
  --radius: 18px;
  --font-body: "Readex Pro", system-ui, sans-serif;
  --font-display-ar: "Noto Kufi Arabic", "Readex Pro", sans-serif;
  --font-display-en: "Space Grotesk", "Readex Pro", sans-serif;
  --display: var(--font-display-ar);
}
html[lang="en"] { --display: var(--font-display-en); }

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--ink);
  color: var(--sand);
  font-family: var(--font-body);
  font-weight: 300;
  line-height: 1.85;
  overflow-x: hidden;
}
img, svg, video, canvas { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--gold); color: var(--ink); }

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

/* ---------- shared ---------- */
.wrap { max-width: 1200px; margin-inline: auto; padding-inline: clamp(20px, 5vw, 48px); }
.wrap-narrow { max-width: 860px; }
.section { padding-block: clamp(72px, 12vh, 140px); position: relative; }
.section-alt { background: linear-gradient(180deg, var(--ink), var(--dusk) 30%, var(--dusk) 70%, var(--ink)); }

.eyebrow {
  font-size: 0.8rem; letter-spacing: 0.14em; color: var(--gold);
  text-transform: uppercase; margin-bottom: 14px; font-weight: 500;
}
html[dir="rtl"] .eyebrow { letter-spacing: 0.05em; }
.section-title {
  font-family: var(--display);
  font-size: clamp(1.9rem, 4.5vw, 3.2rem);
  font-weight: 700; line-height: 1.35; margin-bottom: 24px; color: var(--sand);
}
.section-hint { color: var(--sand-dim); max-width: 640px; margin-bottom: 36px; }

.glass {
  background: rgba(34, 28, 48, 0.55);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 30px; border-radius: 999px; border: 1px solid transparent;
  font-family: var(--font-body); font-size: 0.95rem; font-weight: 500;
  cursor: pointer; transition: transform 0.25s, box-shadow 0.25s, background 0.25s, color 0.25s;
}
.btn:hover { transform: translateY(-2px); }
.btn-gold { background: linear-gradient(120deg, var(--gold), var(--gold-hi)); color: #241A08; box-shadow: 0 6px 26px rgba(217, 164, 65, 0.25); }
.btn-gold:hover { box-shadow: 0 10px 34px rgba(217, 164, 65, 0.4); }
.btn-ghost { border-color: var(--line); color: var(--sand); background: rgba(237, 226, 204, 0.04); }
.btn-ghost:hover { border-color: var(--gold); color: var(--gold-hi); }
.btn-small { padding: 9px 20px; font-size: 0.85rem; }

/* reveal on scroll */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity 0.8s ease, transform 0.8s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- nav ---------- */
.nav {
  position: fixed; inset-inline: 0; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 14px clamp(20px, 4vw, 44px);
  transition: background 0.35s, box-shadow 0.35s, backdrop-filter 0.35s;
}
.nav.scrolled { background: rgba(14, 12, 20, 0.82); backdrop-filter: blur(16px); box-shadow: 0 1px 0 var(--line); }
.nav-brand { display: flex; align-items: center; gap: 12px; font-family: var(--display); font-weight: 700; font-size: 1.05rem; white-space: nowrap; }
.nav-mark { width: 30px; height: 30px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 32% 30%, var(--gold-hi), var(--gold) 55%, #7A5518); position: relative; overflow: hidden; }
.nav-mark::after { content: ""; position: absolute; inset-inline: 0; bottom: 6px; height: 8px;
  background: var(--ink); border-radius: 60% 40% 0 0 / 100% 100% 0 0; }
.nav-links { display: flex; gap: clamp(14px, 2.4vw, 30px); font-size: 0.92rem; color: var(--sand-dim); }
.nav-links a { transition: color 0.2s; }
.nav-links a:hover { color: var(--gold-hi); }
.nav-actions { display: flex; align-items: center; gap: 12px; }
.lang-toggle {
  border: 1px solid var(--line); background: none; color: var(--gold);
  font-family: var(--font-body); font-weight: 600; font-size: 0.9rem;
  width: 42px; height: 42px; border-radius: 50%; cursor: pointer; transition: background 0.2s, color 0.2s;
}
.lang-toggle:hover { background: var(--gold); color: var(--ink); }
.nav-burger { display: none; background: none; border: none; cursor: pointer; padding: 8px; }
.nav-burger span { display: block; width: 22px; height: 2px; background: var(--sand); margin-block: 5px; border-radius: 2px; transition: 0.3s; }
.nav-mobile {
  position: fixed; inset-inline: 0; top: 0; z-index: 49; padding: 90px 32px 32px;
  background: rgba(14, 12, 20, 0.97); backdrop-filter: blur(18px);
  display: flex; flex-direction: column; gap: 20px; font-size: 1.15rem;
  transform: translateY(-110%); transition: transform 0.4s ease;
}
.nav-mobile.open { transform: none; }

/* ---------- hero ---------- */
.hero { position: relative; min-height: 100svh; display: grid; place-items: center; overflow: hidden; }
.hero-video, .hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero-video { display: none; }
.hero-video.on { display: block; }
.hero-video.on + .hero-canvas { opacity: 0.3; }
.hero-veil { position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 100%, rgba(217,164,65,0.14), transparent 55%),
              linear-gradient(180deg, rgba(14,12,20,0.55), rgba(14,12,20,0.28) 45%, var(--ink) 96%); }
.hero-inner { position: relative; z-index: 2; text-align: center; padding: 120px 24px 140px; max-width: 900px; }
.hero-title {
  font-family: var(--display); font-weight: 900;
  font-size: clamp(2.4rem, 7vw, 5rem); line-height: 1.3; margin-block: 10px 22px;
}
.hero-title span { display: block; }
.hero-title .gold {
  background: linear-gradient(100deg, var(--gold-hi), var(--gold) 55%, #B77F22);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub { color: var(--sand-dim); max-width: 620px; margin: 0 auto 36px; font-size: 1.05rem; }
.hero-ctas { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.hero-scroll {
  position: absolute; bottom: 26px; inset-inline-start: 50%; transform: translateX(-50%); z-index: 2;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  color: var(--sand-dim); font-size: 0.78rem; letter-spacing: 0.1em;
}
html[dir="rtl"] .hero-scroll { transform: translateX(50%); }
.hero-scroll-line { width: 1px; height: 44px; background: linear-gradient(var(--gold), transparent); animation: drip 2.2s infinite; }
@keyframes drip { 0% { transform: scaleY(0); transform-origin: top; } 55% { transform: scaleY(1); transform-origin: top; } 100% { transform: scaleY(0); transform-origin: bottom; } }

/* ---------- dune divider ---------- */
.dune-divider { height: 60px; overflow: hidden; margin-block: -1px; }
.dune-divider svg { width: 100%; height: 100%; }
.dune-divider path { fill: var(--dusk); }
.dune-divider.flip { transform: scaleY(-1); }
.dune-divider.flip path { fill: var(--dusk); }

/* ---------- about ---------- */
.about-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: clamp(32px, 6vw, 80px); align-items: start; }
.about-text p { margin-bottom: 18px; font-size: 1.02rem; }
.about-stats { display: grid; gap: 18px; }
.stat { border-inline-start: 2px solid var(--gold); padding-inline-start: 18px; }
.stat-n { display: block; font-family: var(--display); font-size: 2rem; font-weight: 700; color: var(--gold-hi); line-height: 1.4; }
.stat-l { color: var(--sand-dim); font-size: 0.9rem; }

/* ---------- shelf ---------- */
.shelf {
  display: flex; gap: clamp(18px, 3vw, 34px);
  overflow-x: auto; padding: 40px clamp(20px, 8vw, 120px) 60px;
  scroll-snap-type: x proximity; scrollbar-width: thin; scrollbar-color: var(--gold) transparent;
  cursor: grab;
}
.shelf:active { cursor: grabbing; }
.book {
  flex: none; width: 214px; scroll-snap-align: center;
  perspective: 900px; background: none; border: none; padding: 0; cursor: pointer; text-align: inherit;
}
.book-cover {
  width: 214px; height: 320px; border-radius: 6px 14px 14px 6px; position: relative;
  padding: 24px 20px; display: flex; flex-direction: column; justify-content: space-between;
  transform: rotateY(-14deg); transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.5s;
  box-shadow: 14px 22px 40px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(237, 226, 204, 0.12);
  overflow: hidden;
}
html[dir="rtl"] .book-cover { border-radius: 14px 6px 6px 14px; transform: rotateY(14deg); }
.book:hover .book-cover, .book:focus-visible .book-cover { transform: rotateY(0) translateY(-10px); box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6); }
.book-cover::before { content: ""; position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 10px;
  background: rgba(0, 0, 0, 0.28); }
.book-cover::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,0.08) 48%, transparent 60%); pointer-events: none; }
.bc-genre { font-size: 0.68rem; letter-spacing: 0.12em; opacity: 0.75; text-transform: uppercase; }
.bc-title { font-family: var(--display); font-weight: 700; font-size: 1.35rem; line-height: 1.5; }
.bc-foot { display: flex; justify-content: space-between; align-items: baseline; font-size: 0.72rem; opacity: 0.8; }
.book-label { margin-top: 16px; text-align: center; color: var(--sand-dim); font-size: 0.86rem; transition: color 0.3s; }
.book:hover .book-label { color: var(--gold-hi); }

/* ---------- book dialog ---------- */
.book-dialog {
  margin: auto; border: none; border-radius: var(--radius); padding: 0;
  background: var(--dusk-2); color: var(--sand); max-width: 640px; width: calc(100% - 40px);
  box-shadow: 0 40px 90px rgba(0, 0, 0, 0.6);
}
.book-dialog::backdrop { background: rgba(10, 8, 16, 0.75); backdrop-filter: blur(6px); }
.book-dialog-inner { display: grid; grid-template-columns: 180px 1fr; }
.bd-cover { padding: 26px 20px; display: flex; flex-direction: column; justify-content: space-between; min-height: 270px; }
.bd-cover .bc-title { font-size: 1.15rem; }
.bd-body { padding: 28px; direction: inherit; }
.bd-body h3 { font-family: var(--display); font-size: 1.5rem; margin-bottom: 4px; }
.bd-sub { color: var(--gold); font-size: 0.85rem; margin-bottom: 16px; }
.bd-blurb { color: var(--sand-dim); font-size: 0.95rem; margin-bottom: 20px; }
.bd-meta { display: flex; gap: 22px; flex-wrap: wrap; font-size: 0.82rem; border-top: 1px solid var(--line); padding-top: 16px; }
.bd-meta b { display: block; color: var(--gold); font-weight: 500; font-size: 0.72rem; }
.bd-close { position: absolute; top: 12px; inset-inline-end: 14px; background: none; border: none;
  color: var(--sand-dim); font-size: 1.7rem; cursor: pointer; line-height: 1; }
.bd-close:hover { color: var(--gold); }

/* ---------- author ---------- */
.author-grid { display: grid; grid-template-columns: 320px 1fr; gap: clamp(36px, 6vw, 90px); align-items: start; }
.portrait-frame {
  aspect-ratio: 3 / 4; border-radius: var(--radius); position: sticky; top: 110px;
  background:
    radial-gradient(circle at 70% 20%, rgba(217, 164, 65, 0.35), transparent 55%),
    linear-gradient(160deg, var(--dusk-2), var(--ink));
  border: 1px solid var(--line); display: grid; place-items: center; overflow: hidden;
}
.portrait-glyph {
  font-family: var(--font-display-ar); font-size: clamp(7rem, 14vw, 11rem); font-weight: 900;
  background: linear-gradient(150deg, var(--gold-hi), #8A6120);
  -webkit-background-clip: text; background-clip: text; color: transparent; line-height: 1;
}
.author-role { color: var(--gold); margin-bottom: 18px; font-weight: 400; }
.author-body p { margin-bottom: 16px; }
.timeline-title { font-family: var(--display); font-size: 1.2rem; margin: 30px 0 18px; color: var(--sand); }
.timeline { list-style: none; border-inline-start: 1px solid var(--line); }
.timeline li { position: relative; padding-inline-start: 26px; padding-bottom: 22px; }
.timeline li::before {
  content: ""; position: absolute; inset-inline-start: -5px; top: 10px;
  width: 9px; height: 9px; border-radius: 50%; background: var(--gold);
  box-shadow: 0 0 0 4px rgba(217, 164, 65, 0.15);
}
.tl-year { display: block; color: var(--gold-hi); font-weight: 600; font-size: 0.85rem; }
.tl-text { color: var(--sand-dim); font-size: 0.95rem; }

/* ---------- news ---------- */
.news-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 24px; }
.news-card { border-radius: var(--radius); overflow: hidden; }
.news-card summary {
  list-style: none; cursor: pointer; padding: 26px 26px 22px; position: relative;
}
.news-card summary::-webkit-details-marker { display: none; }
.news-date { color: var(--gold); font-size: 0.75rem; letter-spacing: 0.08em; }
.news-title { font-family: var(--display); font-weight: 600; font-size: 1.12rem; line-height: 1.6; margin-top: 8px; }
.news-cta { color: var(--sand-dim); font-size: 0.8rem; margin-top: 14px; display: inline-block; transition: color 0.2s; }
.news-card summary:hover .news-cta { color: var(--gold-hi); }
.news-body { padding: 0 26px 26px; color: var(--sand-dim); font-size: 0.95rem; }
.news-card[open] .news-cta { display: none; }

/* ---------- submit form ---------- */
.submit-form { padding: clamp(24px, 4vw, 44px); display: grid; gap: 20px; }
.f-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; }
.f-field { display: grid; gap: 8px; font-size: 0.88rem; color: var(--sand-dim); }
.f-field input, .f-field select, .f-field textarea {
  background: rgba(14, 12, 20, 0.6); border: 1px solid var(--line); border-radius: 10px;
  color: var(--sand); font-family: var(--font-body); font-size: 0.95rem; padding: 13px 16px;
  transition: border-color 0.2s; width: 100%;
}
.f-field textarea { resize: vertical; }
.f-field input:focus, .f-field select:focus, .f-field textarea:focus { outline: none; border-color: var(--gold); }
.f-field.invalid input, .f-field.invalid textarea { border-color: #C0563B; }
.f-msg { min-height: 1.4em; font-size: 0.9rem; }
.f-msg.ok { color: #7FC79B; }
.f-msg.err { color: #E08A72; }

/* ---------- footer ---------- */
.footer { background: linear-gradient(180deg, var(--ink), #0A0810); padding: clamp(70px, 10vh, 120px) 0 40px; border-top: 1px solid var(--line); }
.contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; margin-block: 36px 70px; }
.contact-card { padding: 26px; display: grid; gap: 8px; transition: border-color 0.25s, transform 0.25s; }
.contact-card:hover { border-color: var(--gold); transform: translateY(-3px); }
.contact-card > span:first-child { color: var(--sand); font-weight: 500; }
.contact-mail { color: var(--gold); font-size: 0.88rem; }
.footer-base { text-align: center; color: var(--sand-dim); }
.footer-line { font-family: var(--display); color: var(--sand); margin-bottom: 10px; }
.footer-rights { font-size: 0.8rem; }

/* ---------- chat ---------- */
.chat-fab {
  position: fixed; bottom: 22px; inset-inline-end: 22px; z-index: 60;
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(120deg, var(--teal), #2A6B60); color: #EAF5F0;
  border: none; border-radius: 999px; padding: 14px 22px;
  font-family: var(--font-body); font-size: 0.9rem; font-weight: 500; cursor: pointer;
  box-shadow: 0 12px 34px rgba(62, 143, 130, 0.35); transition: transform 0.25s, box-shadow 0.25s;
}
.chat-fab:hover { transform: translateY(-3px); box-shadow: 0 16px 44px rgba(62, 143, 130, 0.5); }
.chat-panel[hidden] { display: none; }
.chat-panel {
  position: fixed; bottom: 88px; inset-inline-end: 22px; z-index: 60;
  width: min(400px, calc(100vw - 44px)); height: min(560px, calc(100svh - 130px));
  background: var(--dusk-2); border: 1px solid var(--line); border-radius: 20px;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}
.chat-head { display: flex; justify-content: space-between; align-items: start; padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line); background: rgba(62, 143, 130, 0.08); }
.chat-title { font-family: var(--display); font-weight: 600; }
.chat-sub { color: var(--sand-dim); font-size: 0.78rem; }
.chat-close { background: none; border: none; color: var(--sand-dim); font-size: 1.6rem; cursor: pointer; line-height: 1; }
.chat-log { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 85%; padding: 12px 16px; border-radius: 16px; font-size: 0.92rem; line-height: 1.7; white-space: pre-wrap; overflow-wrap: break-word; }
.msg.bot { background: rgba(62, 143, 130, 0.14); border: 1px solid rgba(62, 143, 130, 0.25); align-self: flex-start; border-start-start-radius: 4px; }
.msg.user { background: rgba(217, 164, 65, 0.14); border: 1px solid rgba(217, 164, 65, 0.3); align-self: flex-end; border-start-end-radius: 4px; }
.msg.typing { color: var(--sand-dim); font-style: italic; }
.chat-input { display: flex; gap: 10px; padding: 14px; border-top: 1px solid var(--line); }
.chat-input input {
  flex: 1; background: rgba(14, 12, 20, 0.6); border: 1px solid var(--line); border-radius: 999px;
  color: var(--sand); font-family: var(--font-body); font-size: 0.92rem; padding: 11px 18px;
}
.chat-input input:focus { outline: none; border-color: var(--teal); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .nav-links { display: none; }
  .nav-burger { display: block; }
  .nav-actions .btn { display: none; }
  .about-grid, .author-grid { grid-template-columns: 1fr; }
  .portrait-frame { position: static; max-width: 280px; }
  .book-dialog-inner { grid-template-columns: 1fr; }
  .bd-cover { min-height: 150px; }
  .about-stats { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 560px) {
  .about-stats { grid-template-columns: 1fr; }
  .chat-fab span { display: none; }
  .chat-fab { padding: 16px; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .hero-scroll-line { animation: none; }
  .btn, .book-cover, .contact-card { transition: none; }
}
