/* The Arabic Academy: site styles
   Colours and fonts follow the YouTube series branding. */

:root {
  --bg: #f6f4f3;
  --ink: #0c0a08;
  --ink-soft: #4a4542;
  --box: #d4d0cd;
  --box-soft: #e7e4e2;
  --accent: #f3c083;
  --accent-deep: #c98a3e;
  --white: #fffdfb;
  --radius: 14px;
  --max: 1120px;
  --font-head: "Roboto", system-ui, sans-serif;
  --font-body: "Open Sans", system-ui, sans-serif;
  --font-ar: "Scheherazade New", "Amiri", serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

img { max-width: 100%; display: block; }

a { color: inherit; }

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

.ar {
  font-family: var(--font-ar);
  direction: rtl;
  unicode-bidi: isolate;
  line-height: 1.6;
}

/* ---------- Headings ---------- */
h1, h2, h3, .eyebrow, .btn, .nav a, .brand {
  font-family: var(--font-head);
}
h1, h2, h3 { text-transform: uppercase; letter-spacing: 0.02em; line-height: 1.15; margin: 0 0 0.5em; }
h1 { font-size: clamp(2.1rem, 4.6vw, 3.4rem); font-weight: 700; }
h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 700; }
h3 { font-size: 1.1rem; font-weight: 700; letter-spacing: 0.04em; }
p { margin: 0 0 1em; }
.lead { font-size: 1.15rem; color: var(--ink-soft); max-width: 36em; }
.subtitle { font-family: var(--font-head); text-transform: uppercase; letter-spacing: 0.12em; font-weight: 500; color: var(--ink-soft); margin: -6px 0 18px; }

.eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 14px;
}
.eyebrow::before {
  content: "";
  display: inline-block;
  width: 22px; height: 3px;
  background: var(--accent);
  vertical-align: middle;
  margin-right: 10px;
  border-radius: 2px;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(246, 244, 243, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--box);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  height: 68px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.95rem;
}
.brand img { width: 34px; height: 34px; flex: none; }
.nav { display: flex; gap: 6px; align-items: center; }
.nav a {
  text-decoration: none; font-size: 0.85rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.08em;
  padding: 8px 12px; border-radius: 8px;
}
.nav a:hover { background: var(--box-soft); }
.nav a[aria-current="page"] { background: var(--box); }
.nav .btn { margin-left: 6px; }
.nav-toggle {
  display: none; background: none; border: 0; padding: 8px; cursor: pointer;
}
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--ink); margin: 5px 0; }

@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .nav {
    position: absolute; top: 68px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--box);
    padding: 8px 20px 16px; display: none;
  }
  .nav.open { display: flex; }
  .nav a { padding: 12px; }
  .nav .btn { margin: 8px 0 0; text-align: center; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 0.85rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em;
  text-decoration: none; cursor: pointer;
  padding: 14px 24px; border-radius: 10px; border: 2px solid var(--ink);
  transition: transform 0.15s ease, background 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-primary:hover { background: #2a2420; }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: var(--box-soft); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--ink); }
.btn-accent:hover { background: #f0b46c; border-color: #f0b46c; }
.btn-small { padding: 9px 16px; font-size: 0.75rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }

/* ---------- Sections ---------- */
section { padding: 84px 0; }
.section-alt { background: var(--white); border-block: 1px solid var(--box); }
.section-head { max-width: 640px; margin-bottom: 44px; }
.center { text-align: center; margin-inline: auto; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding: 72px 0 90px; }
.hero::before {
  content: ""; position: absolute; inset: 0;
  background-image: url("pattern.svg");
  background-size: 120px 120px;
  opacity: 0.5;
  mask-image: linear-gradient(to left, #000 10%, transparent 70%);
  -webkit-mask-image: linear-gradient(to left, #000 10%, transparent 70%);
  pointer-events: none;
}
.hero .wrap { position: relative; display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 56px; align-items: center; }
@media (max-width: 900px) { .hero .wrap { grid-template-columns: 1fr; } }
.hero h1 em { font-style: normal; background: linear-gradient(transparent 62%, var(--accent) 62%); padding: 0 4px; }

/* Root card in the hero */
.root-card {
  background: var(--white);
  border: 1px solid var(--box);
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 24px 60px -28px rgba(12, 10, 8, 0.28);
}
.root-card .label { font-family: var(--font-head); font-size: 0.75rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-soft); }
.root-letters { display: flex; justify-content: center; gap: 14px; margin: 14px 0 8px; direction: rtl; }
.root-letters span {
  font-family: var(--font-ar); font-size: 2.6rem; line-height: 1;
  width: 72px; height: 72px; display: grid; place-items: center;
  background: var(--accent); border-radius: 14px;
  padding-bottom: 8px;
}
.root-meaning { text-align: center; color: var(--ink-soft); margin-bottom: 18px; }
.root-words { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.root-words li {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  background: var(--bg); border-radius: 10px; padding: 8px 16px;
  opacity: 0; transform: translateY(8px);
  animation: rise 0.5s ease forwards;
}
.root-words li:nth-child(1) { animation-delay: 0.2s; }
.root-words li:nth-child(2) { animation-delay: 0.45s; }
.root-words li:nth-child(3) { animation-delay: 0.7s; }
.root-words li:nth-child(4) { animation-delay: 0.95s; }
.root-words .ar { font-size: 1.7rem; }
.root-words .en { font-size: 0.92rem; color: var(--ink-soft); }
@keyframes rise { to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .root-words li { animation: none; opacity: 1; transform: none; }
  .btn:hover { transform: none; }
}

/* ---------- Steps ---------- */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; counter-reset: step; }
@media (max-width: 820px) { .steps { grid-template-columns: 1fr; } }
.step {
  background: var(--bg); border: 1px solid var(--box); border-radius: var(--radius);
  padding: 28px;
}
.step::before {
  counter-increment: step; content: counter(step);
  font-family: var(--font-head); font-weight: 700;
  display: grid; place-items: center;
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--ink); color: var(--bg); margin-bottom: 16px;
}
.step p { margin: 0; color: var(--ink-soft); }

/* ---------- Book feature ---------- */
.book-feature { display: grid; grid-template-columns: 0.8fr 1.2fr; gap: 64px; align-items: center; }
@media (max-width: 860px) { .book-feature { grid-template-columns: 1fr; gap: 40px; } }

/* Light cover, after the book's title page */
.cover {
  width: min(330px, 100%); margin-inline: auto; aspect-ratio: 2 / 3;
  background: var(--white); border: 1px solid var(--box);
  border-radius: 4px 12px 12px 4px;
  box-shadow: inset 6px 0 0 -2px var(--box-soft), 0 30px 60px -28px rgba(12, 10, 8, 0.35);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 30px 24px; text-decoration: none; color: var(--ink);
  position: relative;
}
.cover-ar { font-size: 2.6rem; line-height: 1.5; color: var(--accent-deep); }
.cover-title { font-family: "Charis SIL", Georgia, serif; font-size: 1.75rem; line-height: 1.15; margin-top: 4px; }
.cover-sub { font-size: 0.62rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-soft); margin: 12px 0 18px; }
.cover-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; width: 100%; }
.cover-stats strong { display: block; font-family: "Charis SIL", Georgia, serif; font-size: 1.7rem; font-weight: 400; line-height: 1.1; color: var(--accent-deep); }
.cover-stats span { display: block; font-size: 0.68rem; line-height: 1.35; color: var(--ink-soft); margin-top: 4px; }
.cover-rule { width: 55%; height: 2px; background: var(--accent); margin: 20px 0 14px; border-radius: 1px; }
.cover-foot { font-size: 0.6rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-soft); }

.facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 26px 0 8px; }
@media (max-width: 560px) { .facts { grid-template-columns: repeat(2, 1fr); } }
.fact { background: var(--box-soft); border-radius: 12px; padding: 14px 16px; }
.fact strong { display: block; font-family: var(--font-head); font-size: 1.6rem; line-height: 1.1; }
.fact span { font-size: 0.82rem; color: var(--ink-soft); }

/* ---------- Lists & cards ---------- */
.check-list { list-style: none; padding: 0; margin: 0 0 1em; }
.check-list li { position: relative; padding-left: 30px; margin-bottom: 10px; }
.check-list li::before {
  content: ""; position: absolute; left: 0; top: 0.45em;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.2l2.6 2.6L12 5.4' fill='none' stroke='%230c0a08' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/12px no-repeat;
}

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.cards-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) { .cards-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .cards-3 { grid-template-columns: 1fr; } }
.card {
  background: var(--white); border: 1px solid var(--box); border-radius: var(--radius); padding: 26px;
}
.section-alt .card { background: var(--bg); }
.card p { color: var(--ink-soft); margin: 0; }
.card .ar { font-size: 1.25em; }
.card .tag {
  display: inline-block; font-family: var(--font-head); font-size: 0.7rem; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase;
  background: var(--box-soft); border-radius: 6px; padding: 3px 8px; margin-bottom: 12px;
}

.chapter-flow { display: grid; gap: 12px; counter-reset: part; padding: 0; margin: 0; }
.chapter-flow li {
  list-style: none; display: grid; grid-template-columns: 44px 1fr; gap: 16px; align-items: start;
  background: var(--white); border: 1px solid var(--box); border-radius: 12px; padding: 18px 20px;
}
.chapter-flow li::before {
  counter-increment: part; content: counter(part);
  font-family: var(--font-head); font-weight: 700;
  width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center;
  background: var(--accent);
}
.chapter-flow h3 { margin: 2px 0 4px; }
.chapter-flow p { margin: 0; color: var(--ink-soft); }

/* ---------- Banner ---------- */
.banner {
  background: var(--ink); color: var(--bg); border-radius: 22px;
  padding: 48px; display: grid; grid-template-columns: 1fr auto; gap: 32px; align-items: center;
  position: relative; overflow: hidden;
}
.banner::after {
  content: ""; position: absolute; right: -60px; top: -60px; width: 260px; height: 260px;
  background-image: url("pattern-light.svg"); background-size: 70px 70px; opacity: 0.12;
}
.banner p { color: #cfc9c5; margin: 0; }
.banner .btn-ghost { color: var(--bg); border-color: var(--bg); }
.banner .btn-ghost:hover { background: #2a2420; }
@media (max-width: 760px) { .banner { grid-template-columns: 1fr; padding: 34px 26px; } }

/* ---------- Book page ---------- */
.price-box {
  background: var(--white); border: 1px solid var(--box); border-radius: 18px; padding: 24px 26px; margin-top: 26px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
}
.price-box .price { font-family: var(--font-head); font-size: 2rem; font-weight: 700; line-height: 1; }
.price-box small { display: block; color: var(--ink-soft); margin-top: 6px; font-size: 0.85rem; }

.faq { max-width: 760px; }
.faq details {
  background: var(--white); border: 1px solid var(--box); border-radius: 12px; margin-bottom: 10px; padding: 0 22px;
}
.faq summary {
  cursor: pointer; list-style: none; padding: 18px 0; font-weight: 600;
  display: flex; justify-content: space-between; gap: 16px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--font-head); font-size: 1.3rem; line-height: 1; }
.faq details[open] summary::after { content: "\2212"; }
.faq details p { color: var(--ink-soft); padding-bottom: 18px; margin: 0; }

/* ---------- Quiz ---------- */
.quiz-shell { max-width: 720px; margin-inline: auto; }
.mode-picker { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.mode {
  text-align: left; cursor: pointer; font: inherit; color: inherit;
  background: var(--white); border: 2px solid var(--box); border-radius: var(--radius); padding: 24px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.mode:hover, .mode:focus-visible { border-color: var(--ink); transform: translateY(-2px); outline: none; }
.mode .ar { font-size: 1.8rem; display: block; margin-bottom: 6px; }
.mode h3 { margin-bottom: 4px; }
.mode p { margin: 0; color: var(--ink-soft); font-size: 0.95rem; }

.quiz-card {
  background: var(--white); border: 1px solid var(--box); border-radius: 20px; padding: 32px;
  box-shadow: 0 24px 60px -34px rgba(12, 10, 8, 0.3);
}
.quiz-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; font-family: var(--font-head); font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-soft); }
.progress { height: 6px; background: var(--box-soft); border-radius: 3px; overflow: hidden; margin-bottom: 26px; }
.progress div { height: 100%; background: var(--accent-deep); width: 0; transition: width 0.3s ease; }
.prompt { text-align: center; margin-bottom: 24px; }
.prompt .q-label { color: var(--ink-soft); margin-bottom: 6px; }
.prompt .q-main { font-family: var(--font-ar); font-size: 3.2rem; line-height: 1.5; direction: rtl; }
.prompt .q-main.roots { word-spacing: 0.35em; }
.prompt .q-hint { color: var(--ink-soft); font-size: 0.92rem; }
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .options { grid-template-columns: 1fr; } }
.option {
  font: inherit; color: inherit; cursor: pointer;
  background: var(--bg); border: 2px solid var(--box); border-radius: 12px;
  padding: 14px 16px; min-height: 60px; text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.option .ar { font-size: 1.8rem; word-spacing: 0.35em; }
.option:hover:not(:disabled), .option:focus-visible { border-color: var(--ink); outline: none; }
.option:disabled { cursor: default; }
.option.correct { background: #e3f0dc; border-color: #4f8a3a; }
.option.wrong { background: #f7dfdc; border-color: #b4483c; }
.feedback {
  margin-top: 20px; padding: 16px 18px; border-radius: 12px; background: var(--box-soft);
  display: none;
}
.feedback.show { display: block; }
.feedback strong { font-family: var(--font-head); text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.85rem; }
.feedback .ar { font-size: 1.4rem; }
.quiz-actions { display: flex; justify-content: flex-end; margin-top: 20px; }
.result { text-align: center; }
.result .score { font-family: var(--font-head); font-size: 4rem; font-weight: 700; line-height: 1; margin: 10px 0; }
.review { text-align: left; margin-top: 24px; display: grid; gap: 8px; }
.review div { display: grid; grid-template-columns: 90px 1fr auto; gap: 14px; padding: 8px 14px; border-radius: 10px; background: var(--bg); align-items: center; }
.review .ar { font-size: 1.4rem; word-spacing: 0.2em; text-align: right; }
.review .meaning { color: var(--ink-soft); }
.review .mark { font-family: var(--font-head); font-weight: 700; }
.review .ok { color: #3f7a2c; }
.review .no { color: #a33a2f; }
[hidden] { display: none !important; }

/* ---------- Footer ---------- */
.site-footer { padding: 54px 0 40px; border-top: 1px solid var(--box); color: var(--ink-soft); font-size: 0.92rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 24px; }
.site-footer nav { display: flex; gap: 18px; flex-wrap: wrap; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

/* ---------- 404 ---------- */
.notfound { min-height: 60vh; display: grid; place-items: center; text-align: center; }
.notfound .ar { font-size: 4rem; color: var(--accent-deep); }

:focus-visible { outline: 3px solid var(--accent-deep); outline-offset: 2px; }
