/* QShelf site — design tokens copied from the app (theme/tokens.ts, light + dark palettes) */

/* ---------- fonts: same families as the app (Lora + Source Sans 3), self-hosted, SIL OFL 1.1 ---------- */
/* Arabic glyphs: Lora and Source Sans 3 have none, so Arabic falls back to Noto Naskh / Noto Sans Arabic */
@font-face { font-family: "Lora"; font-weight: 600; font-display: swap; src: url("fonts/lora-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Lora"; font-weight: 700; font-display: swap; src: url("fonts/lora-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Source Sans 3"; font-weight: 400; font-display: swap; src: url("fonts/source-sans-3-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Source Sans 3"; font-weight: 600; font-display: swap; src: url("fonts/source-sans-3-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Source Sans 3"; font-weight: 700; font-display: swap; src: url("fonts/source-sans-3-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Noto Naskh Arabic"; font-weight: 600; font-display: swap; src: url("fonts/noto-naskh-arabic-arabic-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Noto Naskh Arabic"; font-weight: 700; font-display: swap; src: url("fonts/noto-naskh-arabic-arabic-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Noto Sans Arabic"; font-weight: 400; font-display: swap; src: url("fonts/noto-sans-arabic-arabic-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Noto Sans Arabic"; font-weight: 600; font-display: swap; src: url("fonts/noto-sans-arabic-arabic-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Noto Sans Arabic"; font-weight: 700; font-display: swap; src: url("fonts/noto-sans-arabic-arabic-700-normal.woff2") format("woff2"); }

:root {
  /* light palette (tokens.ts → light) */
  --bg: #EEE9E1;
  --page: #FFFDF8;
  --raise: #F5F0E8;
  --ink: #2A2420;
  --soft: #4A413A;
  --muted: #6F645A;
  --line: #E0D8CC;
  --shelf: #CDBFAD;
  --accent: #6E4A2F;
  --on-accent: #FFFFFF;
  --tint: #F1E6DA;
  --warn-wash: #FCF3D9;
  --warn-edge: #C4A970;
  --foot: #E9E3DA;
  --press: rgba(42,36,32,0.1);

  /* elevation (tokens.ts → elevation) */
  --shadow-card: 0 1px 2px rgba(60,40,20,0.08);
  --shadow-page: 0 1px 2px rgba(0,0,0,0.07), 0 6px 18px rgba(60,40,20,0.07);

  /* radius (tokens.ts → radius) */
  --r-control: 8px;
  --r-box: 12px;
  --r-sheet: 16px;

  --serif: "Lora", "Noto Naskh Arabic", Georgia, serif;
  --sans: "Source Sans 3", "Noto Sans Arabic", -apple-system, "Segoe UI", Tahoma, sans-serif;
  --ease: cubic-bezier(.2,.7,.2,1);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; overflow-y: scroll; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
}
html[lang="ar"] body { line-height: 1.75; }

/* language switching: content for the inactive language is hidden */
html[lang="ar"] [data-l="en"],
html[lang="en"] [data-l="ar"] { display: none !important; }

a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }

.wrap { max-width: 760px; margin: 0 auto; padding: 0 20px; }

/* ---------- header ---------- */
header {
  background: var(--page);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.bar { display: flex; align-items: center; gap: 12px; min-height: 64px; flex-wrap: wrap; padding-block: 8px; }
.brand {
  display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink);
  font-family: var(--serif); font-weight: 700; font-size: 20px; direction: ltr;
}
/* brand mark = a small book cover like the app's shelf: spine on the left, rounder open edge */
.brand-mark {
  width: 24px; height: 32px;
  background: var(--accent);
  border-radius: 3px 6px 6px 3px;
  box-shadow: inset 4px 0 0 rgba(0,0,0,0.18), 0 2px 6px rgba(0,0,0,0.18);
  position: relative;
}
.brand-mark::after {
  content: ""; position: absolute; left: 8px; right: 5px; top: 8px; height: 2px;
  background: rgba(255,255,255,0.55); border-radius: 2px;
  box-shadow: 0 5px 0 rgba(255,255,255,0.35);
}
nav { display: flex; gap: 4px; flex-wrap: wrap; margin-inline-start: auto; align-items: center; }
nav a {
  line-height: 1.5; display: inline-block;
  text-decoration: none; color: var(--muted); padding: 6px 12px; border-radius: var(--r-control);
  font-size: 15px; transition: background .2s var(--ease), color .2s var(--ease);
}
nav a:hover { background: var(--press); color: var(--ink); }
nav a[aria-current="page"] { color: var(--accent); background: var(--tint); }
.lang-btn {
  border: 1px solid var(--line); background: var(--raise); color: var(--ink);
  border-radius: 999px; padding: 6px 14px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  margin-inline-start: 4px;
}
.lang-btn:hover { border-color: var(--shelf); }

/* ---------- content ---------- */
main.wrap { padding-block: 40px 64px; }
h1, h2, h3 { font-family: var(--serif); color: var(--ink); font-weight: 700; }
h1 { font-size: 28px; line-height: 1.25; margin: 0 0 8px; }
h2 { font-size: 20px; line-height: 1.3; margin: 36px 0 8px; font-weight: 600; }
h3 { font-size: 18px; line-height: 1.3; margin: 24px 0 8px; font-weight: 600; }
html[lang="ar"] h1, html[lang="ar"] h2, html[lang="ar"] h3 { line-height: 1.5; }
p, ul, ol { margin: 0 0 12px; color: var(--soft); }
strong { color: var(--ink); }
ul, ol { padding-inline-start: 24px; }
li { margin-bottom: 4px; }
.meta { color: var(--muted); font-size: 14px; margin-bottom: 28px; }

/* the "paper": long text sits on a page like the question sheet */
.paper {
  background: var(--page); border: 1px solid var(--line); border-radius: var(--r-sheet);
  box-shadow: var(--shadow-page); padding: 32px 32px 24px;
}
.card {
  background: var(--page); border: 1px solid var(--line); border-radius: var(--r-box);
  box-shadow: var(--shadow-card); padding: 20px; margin-block: 16px;
}
.paper .card { background: var(--raise); box-shadow: none; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.note {
  background: var(--warn-wash); border: 1px solid var(--warn-edge); border-radius: var(--r-box);
  padding: 14px 18px; margin-block: 20px 0; font-size: 15px; color: var(--ink);
}
.mail { display: inline-block; font-weight: 600; direction: ltr; unicode-bidi: embed; }
.mail.big { font-size: 18px; }

table { width: 100%; border-collapse: collapse; font-size: 15px; margin-block: 8px 16px; }
th, td { text-align: start; padding: 12px 8px; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--soft); }
td:first-child { color: var(--ink); font-weight: 600; white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 13px; letter-spacing: .02em; }

/* ---------- home ---------- */
.hero { padding-block: 16px 8px; display: flex; gap: 28px; align-items: center; flex-wrap: wrap; }
.hero-text { flex: 1 1 320px; }
.hero h1 { font-size: 28px; }
.hero p { font-size: 18px; color: var(--muted); margin: 0; }

/* the shelf: three book covers on a wooden board, colours from tokens.ts → cover */
.shelf { flex: 0 0 auto; direction: ltr; padding-top: 8px; }
.books { display: flex; gap: 10px; align-items: flex-end; padding: 0 12px; }
.book {
  width: 56px; border-radius: 3px 6px 6px 3px;
  box-shadow: inset 4px 0 0 rgba(0,0,0,0.18), 0 2px 6px rgba(0,0,0,0.18);
  position: relative;
}
.book::before {
  content: ""; position: absolute; left: 12px; right: 8px; top: 12px; height: 3px;
  background: rgba(255,255,255,0.55); border-radius: 2px; box-shadow: 0 7px 0 rgba(255,255,255,0.32);
}
.book:nth-child(1) { height: 78px; background: #2F5D8A; }
.book:nth-child(2) { height: 88px; background: #A4502E; transform: translateY(-8px); box-shadow: inset 4px 0 0 rgba(0,0,0,0.18), 0 10px 16px rgba(0,0,0,0.22); }
.book:nth-child(3) { height: 72px; background: #3D7A57; }
.board {
  height: 10px; border-radius: 3px; background: var(--shelf);
  box-shadow: 0 4px 6px -3px rgba(0,0,0,0.25);
}

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-top: 36px; }
.grid a.card {
  text-decoration: none; margin: 0; display: block;
  transition: border-color .2s var(--ease), transform .2s var(--ease);
}
.grid a.card:hover { border-color: var(--shelf); transform: translateY(-2px); }
.grid a.card strong { display: block; margin-bottom: 4px; font-family: var(--serif); font-size: 18px; }
.grid a.card span { color: var(--muted); font-size: 15px; }

/* ---------- FAQ ---------- */
.faq { background: var(--page); border: 1px solid var(--line); border-radius: var(--r-box); box-shadow: var(--shadow-card); }
details { border-bottom: 1px solid var(--line); }
details:last-child { border-bottom: 0; }
summary {
  cursor: pointer; font-weight: 600; color: var(--ink); padding: 14px 20px; min-height: 52px;
  list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; color: var(--muted); font-size: 20px; line-height: 1; transition: transform .2s var(--ease); }
details[open] summary::after { transform: rotate(45deg); }
summary:hover { background: var(--press); }
details > div { padding: 0 20px 14px; }
.paper summary { padding-inline: 0; }
.paper summary:hover { background: none; color: var(--accent); }
.paper details > div { padding-inline: 0; }

/* ---------- footer ---------- */
footer { background: var(--foot); border-top: 1px solid var(--line); padding-block: 24px; color: var(--muted); font-size: 14px; }
footer .wrap { display: flex; gap: 16px; flex-wrap: wrap; justify-content: space-between; align-items: center; }
footer a { color: var(--muted); }
footer nav { margin: 0; gap: 16px; }
footer nav a { padding: 0; }
footer nav a:hover { background: none; color: var(--ink); }

@media (max-width: 560px) {
  .wrap { padding-inline: 16px; }
  .bar { padding-block: 8px 12px; row-gap: 6px; }
  main.wrap { padding-block: 24px 48px; }
  h1, .hero h1 { font-size: 24px; }
  .paper { padding: 22px 16px 14px; border-radius: var(--r-box); }
  nav { margin-inline-start: 0; width: 100%; }
  nav a { padding: 4px 10px; font-size: 14px; }
  .lang-btn { margin-inline-start: auto; }
  .shelf { margin-inline: auto; }
  td:first-child { white-space: normal; }
}
