/* ==========================================================================
   Digital Library — bilingual landing page
   ========================================================================== */

:root {
  --bg:        #f7f4ed;
  --bg-soft:   #efe9dd;
  --ink:       #17150f;
  --ink-soft:  #514a3d;
  --muted:     #7b7362;
  --line:      #ddd4c2;
  --card:      #fffdf8;
  --forest:    #173d31;
  --forest-2:  #0f2b23;
  --amber:     #b9761f;
  --amber-soft:#f0d9b4;
  --ok:        #1f6b4a;
  --warn:      #9a6212;
  --bad:       #9c2f2f;
  --info:      #2a5570;
  --radius:    18px;
  --shadow:    0 1px 2px rgba(23,21,15,.05), 0 18px 40px -28px rgba(23,21,15,.35);
  --font-ar:   "Tajawal", "Segoe UI", Tahoma, sans-serif;
  --font-en:   "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-ui:   "Inter", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ar);
  font-size: 17px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

html[lang="en"] body { font-family: var(--font-ui); }

h1, h2, h3, h4 {
  font-family: var(--font-ar);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -.01em;
  margin: 0 0 .5em;
}
html[lang="en"] h1,
html[lang="en"] h2,
html[lang="en"] h3 { font-family: var(--font-en); font-weight: 600; letter-spacing: -.02em; }

p { margin: 0 0 1em; }
a { color: inherit; }
img { max-width: 100%; display: block; }

.wrap { width: min(1180px, 100% - 40px); margin-inline: auto; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(247,244,237,.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex; align-items: center; gap: 20px;
  min-height: 72px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 800; font-size: 18px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--forest); color: #f7f4ed;
  display: grid; place-items: center; font-size: 15px; font-weight: 800;
  letter-spacing: .02em;
}
.brand small { display: block; font-size: 11px; font-weight: 500; color: var(--muted); letter-spacing: .06em; }

.nav { display: flex; gap: 4px; margin-inline-start: auto; }
.nav a {
  text-decoration: none; color: var(--ink-soft); font-weight: 600; font-size: 15px;
  padding: 8px 12px; border-radius: 10px;
}
.nav a:hover { background: var(--bg-soft); color: var(--ink); }
.nav a.is-active { background: var(--forest); color: #f7f4ed; }

.header-actions { display: flex; align-items: center; gap: 8px; }

.btn {
  border: 0; cursor: pointer; font: inherit; font-weight: 700;
  border-radius: 999px; padding: 12px 22px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none; transition: transform .12s ease, background .15s ease, box-shadow .15s;
  line-height: 1;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--forest); color: #f8f4ea; box-shadow: 0 10px 24px -14px rgba(23,61,49,.9); }
.btn-primary:hover { background: var(--forest-2); }
.btn-amber { background: var(--amber); color: #fff8ec; }
.btn-amber:hover { background: #a36617; }
.btn-ghost { background: transparent; color: var(--ink-soft); border: 1px solid var(--line); }
.btn-ghost:hover { border-color: var(--ink-soft); color: var(--ink); }
.btn-sm { padding: 9px 14px; font-size: 14px; }
.btn-block { width: 100%; }

.lang-btn {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 999px; padding: 9px 14px; font: inherit; font-weight: 700; font-size: 13px;
  cursor: pointer; letter-spacing: .04em;
}
.lang-btn:hover { border-color: var(--ink-soft); }

.menu-btn { display: none; border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 6px 12px; font-size: 18px; cursor: pointer; }

/* ---------- views ---------- */
.view { display: none; animation: fade .35s ease; }
.view.is-active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.section { padding: 72px 0; }
.section-tight { padding: 48px 0; }
.section-head { max-width: 720px; margin-bottom: 36px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12.5px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--amber); font-weight: 700; margin-bottom: 14px;
}
.eyebrow::before { content: ""; width: 26px; height: 1px; background: var(--amber); }
.section h2 { font-size: clamp(27px, 3.4vw, 40px); }
.lead { color: var(--ink-soft); font-size: 18px; }

/* ---------- hero ---------- */
.hero { padding: 64px 0 40px; position: relative; overflow: hidden; }
.hero::after {
  content: ""; position: absolute; inset-inline-end: -160px; top: -120px;
  width: 520px; height: 520px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(185,118,31,.16), transparent 65%);
  pointer-events: none;
}
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 56px; align-items: center; position: relative; }
.hero h1 { font-size: clamp(34px, 5vw, 62px); margin-bottom: 18px; }
.hero h1 em { font-style: normal; color: var(--amber); }
.hero p.lead { max-width: 52ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.hero-note { margin-top: 18px; font-size: 14px; color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-top: 40px; }
.stat { background: var(--card); padding: 20px 18px; }
.stat b { display: block; font-size: 26px; font-weight: 800; color: var(--forest); }
.stat span { font-size: 13px; color: var(--muted); }

.hero-card {
  background: var(--forest); color: #f3efe4; border-radius: 24px; padding: 30px;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.hero-card::before {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(135deg, rgba(255,255,255,.05) 0 1px, transparent 1px 14px);
}
.hero-card > * { position: relative; }
.hero-card h3 { color: #fff; font-size: 20px; }
.hero-card ul { margin: 0 0 22px; padding: 0; list-style: none; }
.hero-card li { display: flex; gap: 10px; padding: 7px 0; font-size: 15px; color: #e7e1d2; border-bottom: 1px solid rgba(255,255,255,.08); }
.hero-card li:last-child { border: 0; }
.hero-card .tick { color: #e9b872; font-weight: 800; }
.price-line { display: flex; align-items: baseline; gap: 10px; margin-bottom: 16px; }
.price-line b { font-size: 40px; font-weight: 800; color: #fff; }
.price-line s { color: #a9a08d; font-size: 16px; }
.price-line span { font-size: 13px; color: #cfc7b6; }

/* ---------- bundles ---------- */
.bundle-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.bundle {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
  transition: transform .18s ease, box-shadow .2s ease, border-color .2s;
}
.bundle:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: #cbbfa6; }
.bundle-cover { position: relative; background: var(--forest); aspect-ratio: 16 / 10; overflow: hidden; }
.bundle-cover img { width: 100%; height: 100%; object-fit: cover; object-position: center; opacity: .95; }
.bundle-num {
  position: absolute; inset-inline-start: 14px; top: 14px;
  background: rgba(247,244,237,.94); color: var(--forest);
  font-weight: 800; font-size: 12px; letter-spacing: .1em;
  padding: 5px 10px; border-radius: 999px;
}
.bundle-body { padding: 20px 20px 22px; display: flex; flex-direction: column; flex: 1; }
.bundle-body h3 { font-size: 19px; margin-bottom: 4px; }
.bundle-sub { color: var(--muted); font-size: 14px; margin-bottom: 14px; }
.bundle-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.chip {
  font-size: 12px; font-weight: 600; color: var(--ink-soft);
  background: var(--bg-soft); border-radius: 999px; padding: 4px 10px;
}
.bundle-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.bundle-price { font-size: 22px; font-weight: 800; color: var(--forest); }
.bundle-price small { font-size: 12px; color: var(--muted); font-weight: 600; }

/* library band */
.library-band {
  margin-top: 34px; border-radius: 24px; padding: 34px;
  background: linear-gradient(120deg, var(--forest-2), var(--forest) 55%, #1d4a3c);
  color: #f2eee2; display: grid; grid-template-columns: 1.4fr auto; gap: 26px; align-items: center;
}
.library-band h3 { color: #fff; font-size: 26px; margin-bottom: 6px; }
.library-band p { margin: 0; color: #cfd8cd; font-size: 15px; }
.library-price { text-align: center; }
.library-price b { display: block; font-size: 44px; font-weight: 800; color: #f5c884; line-height: 1; }
.library-price s { color: #a5b3a7; font-size: 15px; }

/* steps / faq */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.step { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.step b { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--amber-soft); color: var(--amber); font-weight: 800; margin-bottom: 12px; }
.step h4 { margin: 0 0 6px; font-size: 17px; }
.step p { margin: 0; color: var(--muted); font-size: 14.5px; }

.faq { border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); padding: 18px 0; }
.faq summary { cursor: pointer; font-weight: 700; font-size: 17px; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--amber); font-weight: 800; }
.faq details[open] summary::after { content: "–"; }
.faq p { margin: 12px 0 0; color: var(--ink-soft); }

/* ---------- about / policies ---------- */
.prose { max-width: 760px; }
.prose h3 { margin-top: 32px; font-size: 21px; }
.prose p { color: var(--ink-soft); }
.card-list { display: grid; gap: 16px; margin-top: 24px; }
.info-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; }
.info-card h4 { margin: 0 0 8px; font-size: 17px; }
.info-card p { margin: 0; color: var(--ink-soft); font-size: 15.5px; }
.info-card ul { margin: 8px 0 0; padding-inline-start: 20px; color: var(--ink-soft); font-size: 15.5px; }

.note {
  border-inline-start: 3px solid var(--amber); background: var(--card);
  padding: 14px 18px; border-radius: 0 12px 12px 0; color: var(--ink-soft); font-size: 15px;
}
html[dir="rtl"] .note { border-radius: 12px 0 0 12px; }

/* ---------- forms ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--forest); box-shadow: 0 0 0 3px rgba(23,61,49,.1);
}
.field textarea { min-height: 96px; resize: vertical; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.error-text { color: var(--bad); font-size: 13.5px; margin-top: 8px; display: none; }
.error-text.is-visible { display: block; }

/* ---------- order dialog ---------- */
dialog.modal {
  border: 0; padding: 0; border-radius: 22px; width: min(720px, 92vw);
  background: var(--bg); color: var(--ink); box-shadow: 0 40px 80px -30px rgba(0,0,0,.5);
  max-height: 90vh; overflow: auto;
}
dialog.modal::backdrop { background: rgba(15,25,20,.55); backdrop-filter: blur(3px); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 24px 26px 8px; }
.modal-head h3 { margin: 0; font-size: 22px; }
.modal-body { padding: 8px 26px 26px; }
.close-x { border: 0; background: var(--bg-soft); width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-size: 18px; line-height: 1; color: var(--ink-soft); }

.pick-list { display: grid; gap: 8px; margin-bottom: 18px; }
.pick {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 10px 14px;
  cursor: pointer; font-size: 15px;
}
.pick:hover { border-color: #c3b79d; }
.pick input { width: 18px; height: 18px; accent-color: var(--forest); }
.pick .pick-name { flex: 1; font-weight: 600; }
.pick .pick-price { color: var(--forest); font-weight: 800; }
.pick.is-lib { border-color: var(--amber); background: #fff8ec; }

.total-bar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--forest); color: #f5f1e6; border-radius: 14px; padding: 14px 18px; margin-bottom: 18px;
}
.total-bar b { font-size: 24px; }

/* success */
.success-box { text-align: center; padding: 10px 0 4px; }
.success-box .code {
  display: inline-block; font-family: var(--font-ui); letter-spacing: .12em; font-weight: 800;
  background: var(--amber-soft); color: #6d4409; padding: 10px 18px; border-radius: 12px; font-size: 20px;
  margin: 8px 0 16px;
}
.pay-box { background: var(--card); border: 1px dashed var(--line); border-radius: 14px; padding: 16px 18px; text-align: start; font-size: 15px; }
.pay-box b { display: inline-block; min-width: 92px; color: var(--muted); font-weight: 600; font-size: 13px; }

/* ---------- track ---------- */
.track-grid { display: grid; grid-template-columns: 380px 1fr; gap: 28px; align-items: start; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.timeline { list-style: none; margin: 22px 0 0; padding: 0; }
.timeline li { position: relative; padding-inline-start: 30px; padding-bottom: 22px; }
.timeline li::before {
  content: ""; position: absolute; inset-inline-start: 0; top: 6px;
  width: 13px; height: 13px; border-radius: 50%; background: var(--line); border: 3px solid var(--card);
  box-shadow: 0 0 0 1px var(--line);
}
.timeline li.is-done::before { background: var(--forest); box-shadow: 0 0 0 1px var(--forest); }
.timeline li::after {
  content: ""; position: absolute; inset-inline-start: 6px; top: 24px; bottom: 0; width: 1px; background: var(--line);
}
.timeline li:last-child { padding-bottom: 0; }
.timeline li:last-child::after { display: none; }
.timeline b { display: block; font-size: 15.5px; }
.timeline span { font-size: 13.5px; color: var(--muted); }

.badge { display: inline-block; font-size: 12.5px; font-weight: 700; padding: 4px 11px; border-radius: 999px; }
.badge.ok { background: #e2f0e7; color: var(--ok); }
.badge.warn { background: #fbeed3; color: var(--warn); }
.badge.bad { background: #f7e2e2; color: var(--bad); }
.badge.info { background: #e4eef5; color: var(--info); }

/* ---------- admin ---------- */
.admin-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 20px; }
.admin-bar input[type="search"] {
  flex: 1; min-width: 180px; font: inherit; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff;
}
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; }
.kpi b { display: block; font-size: 26px; color: var(--forest); font-weight: 800; }
.kpi span { font-size: 13px; color: var(--muted); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; min-width: 860px; }
th, td { padding: 12px 14px; text-align: start; border-bottom: 1px solid var(--line); }
th { background: var(--bg-soft); font-size: 12.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-soft); }
tr:last-child td { border-bottom: 0; }
td select, td input { font: inherit; font-size: 13.5px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 9px; background: #fff; width: 100%; }
td .mono { font-family: var(--font-ui); font-weight: 700; letter-spacing: .04em; font-size: 13px; }

.login-wrap { max-width: 420px; margin: 40px auto; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--bg-soft); padding: 44px 0 30px; margin-top: 40px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 30px; }
.footer-grid h4 { font-size: 14px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.footer-grid a { display: block; text-decoration: none; color: var(--ink-soft); font-size: 14.5px; padding: 3px 0; }
.footer-grid a:hover { color: var(--forest); }
.footer-bottom { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-top: 1px solid var(--line); margin-top: 28px; padding-top: 18px; font-size: 13px; color: var(--muted); }

.toast {
  position: fixed; inset-inline: 0; bottom: 26px; margin-inline: auto; width: max-content; max-width: 90vw;
  background: var(--forest); color: #f6f2e7; padding: 12px 20px; border-radius: 999px;
  font-size: 14.5px; font-weight: 600; box-shadow: 0 18px 40px -18px rgba(0,0,0,.5);
  opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity .2s, transform .2s; z-index: 90;
}
.toast.is-visible { opacity: 1; transform: none; }

.demo-banner {
  background: #fbeed3; color: #6d4a10; font-size: 13.5px; text-align: center;
  padding: 8px 16px; border-bottom: 1px solid #edd9b3;
}
.demo-banner[hidden] { display: none; }

/* ---------- new badges & file index ---------- */
.bundle-cover { position: relative; }
.bundle-new {
  position: absolute; top: 10px; inset-inline-start: 10px; z-index: 2;
  background: var(--amber); color: #fff8ec; font-size: 12px; font-weight: 800;
  padding: 4px 10px; border-radius: 999px; letter-spacing: .02em;
}
.file-tools { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.file-search {
  flex: 1 1 280px; max-width: 420px; padding: 12px 16px; border: 1px solid var(--line);
  border-radius: 999px; font: inherit; font-size: 14.5px; background: var(--card); color: var(--ink);
}
.file-search:focus { outline: 2px solid var(--amber); outline-offset: 2px; }
.file-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-chip {
  border: 1px solid var(--line); background: var(--card); color: var(--ink-soft);
  border-radius: 999px; padding: 8px 14px; font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.filter-chip:hover { border-color: var(--ink-soft); }
.filter-chip[aria-pressed="true"] { background: var(--forest); color: #f7f4ed; border-color: var(--forest); }
.file-count { font-size: 13.5px; color: var(--muted); margin: 0 0 14px; }
.file-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.file-row {
  display: flex; align-items: center; gap: 12px; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
}
.file-no { font: 600 12px/1 var(--font-ui); color: var(--muted); min-width: 34px; }
.file-main { flex: 1; min-width: 0; }
.file-main h4 { font-size: 14.5px; margin: 0 0 2px; font-weight: 700; line-height: 1.4; }
.file-main p { font-size: 12px; color: var(--muted); margin: 0; }
.file-format { font-size: 11px; font-weight: 700; color: var(--forest); background: var(--bg-soft); border-radius: 6px; padding: 4px 8px; white-space: nowrap; }
.file-new { font-size: 10px; font-weight: 800; color: #fff8ec; background: var(--amber); border-radius: 999px; padding: 2px 7px; vertical-align: middle; }
.file-empty { padding: 24px; color: var(--muted); }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; gap: 34px; }
  .bundle-grid { grid-template-columns: repeat(2, 1fr); }
  .track-grid { grid-template-columns: 1fr; }
  .library-band { grid-template-columns: 1fr; text-align: center; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .nav { display: none; position: absolute; top: 72px; inset-inline: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 10px; flex-direction: column; box-shadow: var(--shadow); }
  .nav.is-open { display: flex; }
  .menu-btn { display: block; }
  .bundle-grid, .steps, .stats, .file-list { grid-template-columns: 1fr; }
  .stats { gap: 1px; }
  .header-actions .btn-primary { display: none; }
  .section { padding: 52px 0; }
  .hero { padding: 40px 0 24px; }
  .footer-grid { grid-template-columns: 1fr; }
}
