/* ==========================================================================
   Darija+ website — design system
   Brand: terracotta + teal + sand, serif headings, clean sans body.
   Light theme by default, full dark theme via [data-theme="dark"].
   ========================================================================== */

:root {
  --bg: #faf7f2;
  --bg-alt: #f2ebe1;
  --surface: #ffffff;
  --surface-2: #fbf8f3;
  --text: #12233a;
  --text-2: #2b3d51;
  --muted: #5c6b7b;
  --line: #e6dccf;
  --line-strong: #d5c8b6;
  --primary: #c1440e;
  --primary-2: #a53609;
  --primary-soft: #fbe9e0;
  --teal: #0e8578;
  --teal-2: #0a6d62;
  --teal-soft: #e1f2ef;
  --gold: #a9780a;
  --gold-soft: #fbf1d6;
  --navy: #10233b;
  --navy-2: #1a3556;
  --danger: #b3261e;
  --success: #176b3a;
  --radius: 18px;
  --radius-sm: 12px;
  --radius-lg: 28px;
  --shadow-sm: 0 1px 2px rgba(16, 35, 59, 0.05), 0 10px 30px -24px rgba(16, 35, 59, 0.45);
  --shadow-md: 0 28px 70px -40px rgba(16, 35, 59, 0.55);
  --shadow-lg: 0 40px 100px -50px rgba(16, 35, 59, 0.6);
  --font-body: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-head: "Fraunces", Georgia, "Times New Roman", serif;
  --font-ar: "Noto Naskh Arabic", "Segoe UI", Tahoma, serif;
  --font-tif: "Noto Sans Tifinagh", "Segoe UI", sans-serif;
  --container: 1160px;
  --header-h: 72px;
}

[data-theme="dark"] {
  --bg: #0b1118;
  --bg-alt: #101821;
  --surface: #141d27;
  --surface-2: #18222d;
  --text: #f3eadf;
  --text-2: #d9e1ea;
  --muted: #a4b0bd;
  --line: #25313d;
  --line-strong: #35424f;
  --primary: #e0612a;
  --primary-2: #f07a44;
  --primary-soft: #2d1a11;
  --teal: #35b8a8;
  --teal-2: #4cc9b9;
  --teal-soft: #102c2a;
  --gold: #e0b64a;
  --gold-soft: #2c2411;
  --navy: #f3eadf;
  --navy-2: #d9e1ea;
  --danger: #ff8a80;
  --success: #6fd49a;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 30px -24px rgba(0, 0, 0, 0.8);
  --shadow-md: 0 28px 70px -40px rgba(0, 0, 0, 0.9);
  --shadow-lg: 0 40px 100px -50px rgba(0, 0, 0, 0.95);
}

/* ---------- Reset & base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 20px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.65 var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(900px 520px at 88% -10%, rgba(193, 68, 14, 0.10), transparent 62%),
    radial-gradient(760px 520px at -12% 26%, rgba(14, 133, 120, 0.08), transparent 60%);
}
[data-theme="dark"] body::before {
  background:
    radial-gradient(900px 520px at 88% -10%, rgba(224, 97, 42, 0.16), transparent 62%),
    radial-gradient(760px 520px at -12% 26%, rgba(53, 184, 168, 0.10), transparent 60%);
}

img, svg { max-width: 100%; }
img { height: auto; }
a { color: var(--primary); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--primary-2); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.015em;
  margin: 0 0 0.55em;
  color: var(--text);
}
h1 { font-size: clamp(2.5rem, 5.2vw, 4.35rem); }
h2 { font-size: clamp(1.85rem, 3.6vw, 2.75rem); }
h3 { font-size: 1.3rem; }
h4 { font-size: 1.08rem; }
p { margin: 0 0 1em; }
ul, ol { margin: 0 0 1em; padding-left: 1.25em; }
code, kbd, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

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

::selection { background: rgba(193, 68, 14, 0.22); }

.container {
  width: min(var(--container), 100% - 40px);
  margin-inline: auto;
}
@media (max-width: 520px) {
  .container { width: min(var(--container), 100% - 28px); }
}

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: fixed;
  top: -100px; left: 16px;
  z-index: 999;
  background: var(--primary);
  color: #fff;
  padding: 12px 18px;
  border-radius: 999px;
  font-weight: 700;
  transition: top 0.2s;
}
.skip-link:focus { top: 12px; color: #fff; }

.ar { font-family: var(--font-ar); direction: rtl; }
.tif { font-family: var(--font-tif); }
.muted { color: var(--muted); }
.center { text-align: center; }
.nowrap { white-space: nowrap; }

/* ---------- Announcement + header ---------- */
.announce {
  background: var(--navy);
  color: #f4eadf;
  font-size: 0.82rem;
}
[data-theme="dark"] .announce { background: #071019; }
.announce-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 36px;
}
.announce a { color: #fff; font-weight: 700; text-decoration: none; white-space: nowrap; }
.announce a:hover { color: #ffd9c6; }
.dot-live {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #42d392;
  box-shadow: 0 0 0 3px rgba(66, 211, 146, 0.2);
  margin-right: 7px;
  vertical-align: 1px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  border-bottom: 1px solid var(--line);
  transition: box-shadow 0.25s;
}
.site-header.scrolled { box-shadow: var(--shadow-sm); }
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: var(--header-h);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  flex: none;
}
.brand img { width: 40px; height: 40px; border-radius: 11px; }
.brand-name {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.42rem;
  letter-spacing: -0.02em;
  line-height: 1;
}
.brand-plus { color: var(--primary); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}
.nav-links a {
  position: relative;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.94rem;
  font-weight: 500;
  transition: color 0.18s, background 0.18s;
}
.nav-links a:hover { color: var(--text); background: var(--surface-2); }
.nav-links a.active { color: var(--primary); font-weight: 700; }
.nav-links a.active::after {
  content: "";
  position: absolute;
  left: 12px; right: 12px; bottom: 2px;
  height: 2px;
  border-radius: 2px;
  background: var(--primary);
}

.nav-actions { display: flex; align-items: center; gap: 10px; flex: none; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px; height: 40px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  color: var(--text-2);
  transition: background 0.18s, border-color 0.18s, transform 0.18s;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--line-strong); }
.icon-btn:active { transform: scale(0.96); }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

.menu-toggle { display: none; }
.menu-toggle span {
  display: block;
  width: 18px; height: 2px;
  margin: 3.5px auto;
  border-radius: 2px;
  background: currentColor;
  transition: transform 0.22s, opacity 0.22s;
}
.menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 14px 26px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.18s, border-color 0.18s, color 0.18s, transform 0.18s, box-shadow 0.18s;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 16px 30px -18px rgba(193, 68, 14, 0.75);
}
.btn-primary:hover { background: var(--primary-2); color: #fff; transform: translateY(-2px); }
.btn-ghost {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-2px); }
.btn-teal { background: var(--teal); color: #fff; box-shadow: 0 16px 30px -18px rgba(14, 133, 120, 0.7); }
.btn-teal:hover { background: var(--teal-2); color: #fff; transform: translateY(-2px); }
.btn-sm { padding: 10px 18px; font-size: 0.9rem; }
.btn-lg { padding: 17px 32px; font-size: 1.06rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; transform: none !important; }

/* ---------- Typographic helpers ---------- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.eyebrow.teal { color: var(--teal); }
.highlight {
  background: linear-gradient(transparent 64%, rgba(193, 68, 14, 0.18) 64%);
  padding: 0 0.06em;
}
[data-theme="dark"] .highlight { background: linear-gradient(transparent 64%, rgba(224, 97, 42, 0.30) 64%); }
.lead { font-size: 1.16rem; color: var(--muted); max-width: 40em; }

/* ---------- Sections ---------- */
section { padding: 86px 0; }
section.tight { padding: 54px 0; }
section.alt { background: var(--bg-alt); border-block: 1px solid var(--line); }
.section-head { max-width: 700px; margin-bottom: 46px; }
.section-head.center { margin-inline: auto; text-align: center; }
.section-head p { color: var(--muted); font-size: 1.06rem; margin-bottom: 0; }
.section-head h2 { margin-bottom: 0.35em; }

/* ---------- Hero ---------- */
.hero { position: relative; padding: 72px 0 56px; overflow: hidden; }
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.55;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72'%3E%3Cg fill='none' stroke='%23c1440e' stroke-opacity='.13' stroke-width='1'%3E%3Crect x='16' y='16' width='40' height='40'/%3E%3Crect x='16' y='16' width='40' height='40' transform='rotate(45 36 36)'/%3E%3C/g%3E%3C/svg%3E");
}
[data-theme="dark"] .hero::before { opacity: 0.22; }
.hero-grid {
  display: grid;
  grid-template-columns: 1.06fr 0.94fr;
  gap: 56px;
  align-items: center;
}
.hero h1 { margin-bottom: 0.32em; }
.hero .lead { font-size: 1.2rem; max-width: 33em; margin-bottom: 1.5em; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 26px; }
.hero-points {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  padding: 0;
  margin: 0 0 26px;
  list-style: none;
  color: var(--muted);
  font-size: 0.93rem;
}
.hero-points li { display: flex; align-items: center; gap: 7px; }
.hero-points svg { color: var(--teal); flex: none; }

.trust-row {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.trust-item { display: flex; align-items: center; gap: 10px; }
.trust-item strong { display: block; font-size: 0.98rem; line-height: 1.2; }
.trust-item span { display: block; font-size: 0.78rem; color: var(--muted); }
.trust-ic {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  flex: none;
}
.trust-ic.teal { background: var(--teal-soft); color: var(--teal); }

/* ---------- Phone mockup ---------- */
.hero-visual { position: relative; display: flex; justify-content: center; }
.hero-visual::before {
  content: "";
  position: absolute;
  width: 360px; height: 360px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(193, 68, 14, 0.18), transparent 66%);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: -1;
}
.phone {
  width: min(320px, 82vw);
  background: #0a0e13;
  border: 2px solid #2c2621;
  border-radius: 46px;
  padding: 11px;
  box-shadow: 0 50px 90px -44px rgba(16, 35, 59, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  transform: rotate(2.5deg);
}
.phone-screen {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 560px;
  padding: 18px 14px 14px;
  border-radius: 36px;
  background: #111821;
  color: #f5eee6;
  overflow: hidden;
}
.phone-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid #26313d;
  font-size: 0.84rem;
  font-weight: 700;
}
.phone-avatar {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #d4a017, #c1440e);
  font-size: 1rem;
}
.phone-top small { display: block; color: #93a1af; font-weight: 400; font-size: 0.7rem; }
.bubble {
  max-width: 86%;
  padding: 10px 13px;
  border-radius: 16px;
  font-size: 0.82rem;
  line-height: 1.45;
}
.bubble small { display: block; margin-top: 3px; color: #93a1af; font-size: 0.7rem; }
.bubble.bot { align-self: flex-start; background: #1b242f; border-bottom-left-radius: 5px; }
.bubble.user { align-self: flex-end; background: #c1440e; border-bottom-right-radius: 5px; color: #fff; }
.bubble.user small { color: #ffd9c6; }
.bubble .arabic { font-family: var(--font-ar); direction: rtl; font-size: 1.02rem; display: block; margin-bottom: 3px; }
.correction {
  align-self: flex-start;
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid rgba(53, 184, 168, 0.4);
  background: rgba(53, 184, 168, 0.10);
  color: #8fe3d8;
  font-size: 0.74rem;
  line-height: 1.4;
}
.phone-mic {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding: 7px 7px 7px 15px;
  border-radius: 999px;
  background: #1b242f;
  color: #93a1af;
  font-size: 0.76rem;
}
.phone-mic b {
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  margin-left: auto;
  border-radius: 50%;
  background: #c1440e;
  color: #fff;
  font-size: 1rem;
}

.float-card {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
}
.float-card small { display: block; color: var(--muted); font-weight: 500; font-size: 0.72rem; }
.float-card.one { top: 11%; left: -8px; transform: rotate(-2deg); }
.float-card.two { bottom: 9%; right: -10px; transform: rotate(2deg); }
.float-ic { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--teal-soft); color: var(--teal); flex: none; }
.float-ic.gold { background: var(--gold-soft); color: var(--gold); }

/* ---------- Stats ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.stat { padding: 26px 22px; text-align: center; border-right: 1px solid var(--line); }
.stat:last-child { border-right: 0; }
.stat strong { display: block; font-family: var(--font-head); font-size: 2rem; line-height: 1; color: var(--primary); }
.stat span { display: block; margin-top: 6px; color: var(--muted); font-size: 0.84rem; }

/* ---------- Cards & grids ---------- */
.grid { display: grid; gap: 22px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.card {
  position: relative;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform 0.22s, border-color 0.22s, box-shadow 0.22s;
}
.card:hover { transform: translateY(-4px); border-color: var(--line-strong); box-shadow: var(--shadow-md); }
.card h3 { margin-bottom: 0.4em; }
.card p:last-child { margin-bottom: 0; }
.card .muted { color: var(--muted); }

.icon-badge {
  display: grid;
  place-items: center;
  width: 50px; height: 50px;
  margin-bottom: 18px;
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary);
}
.icon-badge.teal { background: var(--teal-soft); color: var(--teal); }
.icon-badge.gold { background: var(--gold-soft); color: var(--gold); }
.icon-badge svg { width: 25px; height: 25px; }

.card-link { text-decoration: none; color: inherit; display: block; }
.card-link:hover { color: inherit; }
.card-arrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
  color: var(--primary);
  font-weight: 700;
  font-size: 0.9rem;
}
.card-link:hover .card-arrow { gap: 10px; }
.card-arrow { transition: gap 0.18s; }

/* ---------- Feature split ---------- */
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 56px;
  align-items: center;
}
.split.reverse .split-media { order: -1; }
.split-media { position: relative; }
.split-copy h2 { margin-bottom: 0.4em; }
.check-list { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 13px; }
.check-list li { display: flex; gap: 11px; align-items: flex-start; color: var(--text-2); }
.check-list svg { flex: none; margin-top: 4px; color: var(--teal); }

/* ---------- Screenshot gallery ---------- */
.shots {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(230px, 1fr);
  gap: 18px;
  overflow-x: auto;
  padding: 6px 4px 20px;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
}
.shot { scroll-snap-align: start; }
.shot-frame {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #0b1118;
  padding: 8px;
  box-shadow: var(--shadow-sm);
}
.shot-frame img { display: block; width: 100%; border-radius: 18px; }
.shot p { margin: 10px 0 0; text-align: center; color: var(--muted); font-size: 0.82rem; }

/* ---------- Steps ---------- */
.steps { counter-reset: step; display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.step { position: relative; padding-top: 12px; }
.step::before {
  counter-increment: step;
  content: counter(step);
  display: grid;
  place-items: center;
  width: 46px; height: 46px;
  margin-bottom: 16px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-family: var(--font-head);
  font-size: 1.2rem;
  font-weight: 700;
  box-shadow: 0 12px 24px -12px rgba(193, 68, 14, 0.7);
}

/* ---------- CTA banner ---------- */
.cta-banner {
  position: relative;
  overflow: hidden;
  padding: clamp(38px, 6vw, 68px);
  border-radius: var(--radius-lg);
  background: linear-gradient(120deg, #c1440e, #8c2f08 55%, #6d2405);
  color: #fff;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.cta-banner::before {
  content: "";
  position: absolute;
  inset: -40%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='90' height='90'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.16'%3E%3Crect x='20' y='20' width='50' height='50'/%3E%3Crect x='20' y='20' width='50' height='50' transform='rotate(45 45 45)'/%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}
.cta-banner > * { position: relative; }
.cta-banner h2 { color: #fff; margin-bottom: 0.3em; }
.cta-banner p { max-width: 36em; margin: 0 auto 26px; color: #ffe6da; font-size: 1.06rem; }
.cta-banner .btn-primary { background: #fff; color: var(--primary); box-shadow: none; }
.cta-banner .btn-primary:hover { background: #fff4ee; color: var(--primary-2); }
.cta-banner .btn-ghost { background: transparent; border-color: rgba(255, 255, 255, 0.5); color: #fff; }
.cta-banner .btn-ghost:hover { border-color: #fff; color: #fff; }
.cta-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.cta-note { margin-top: 18px; font-size: 0.82rem; color: #ffd9c6; }

/* ---------- FAQ ---------- */
.faq { max-width: 820px; margin-inline: auto; }
.faq details {
  border-bottom: 1px solid var(--line);
  padding: 18px 0;
}
.faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  cursor: pointer;
  font-weight: 700;
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  flex: none;
  display: grid;
  place-items: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--primary);
  font-size: 1.1rem;
  line-height: 1;
  transition: transform 0.2s;
}
.faq details[open] summary::after { content: "–"; transform: rotate(180deg); }
.faq details p { margin: 12px 0 0; color: var(--muted); max-width: 62ch; }

/* ---------- Lesson library ---------- */
.page-hero {
  padding: 58px 0 42px;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(700px 300px at 80% 0%, rgba(193, 68, 14, 0.10), transparent 66%),
    var(--bg-alt);
}
.page-hero h1 { margin-bottom: 0.28em; }
.page-hero p { max-width: 54ch; color: var(--muted); font-size: 1.08rem; margin-bottom: 0; }
.breadcrumb { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; color: var(--muted); font-size: 0.84rem; }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb span { color: var(--line-strong); }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}
.search-field {
  position: relative;
  flex: 1 1 260px;
}
.search-field svg { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-field input { width: 100%; padding-left: 44px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
  transition: 0.18s;
}
.chip:hover { border-color: var(--line-strong); color: var(--text); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

input[type="text"], input[type="email"], input[type="search"], select, textarea {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
  transition: border-color 0.18s, box-shadow 0.18s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(193, 68, 14, 0.14);
}
textarea { min-height: 130px; resize: vertical; }
label { display: block; margin-bottom: 6px; font-size: 0.88rem; font-weight: 700; }
.field { margin-bottom: 18px; }
.form-note { color: var(--muted); font-size: 0.82rem; }
.form-status { margin-top: 14px; padding: 12px 15px; border-radius: var(--radius-sm); font-size: 0.9rem; }
.form-status.ok { background: var(--teal-soft); color: var(--teal); border: 1px solid rgba(14, 133, 120, 0.3); }
.form-status.err { background: #fdecea; color: var(--danger); border: 1px solid rgba(179, 38, 30, 0.25); }
[data-theme="dark"] .form-status.err { background: #2c1414; }

.lesson-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.lesson-card { display: flex; flex-direction: column; }
.lesson-emoji {
  display: grid;
  place-items: center;
  width: 54px; height: 54px;
  margin-bottom: 16px;
  border-radius: 15px;
  background: var(--primary-soft);
  font-size: 1.7rem;
}
.lesson-card h3 { margin-bottom: 0.25em; }
.lesson-ar { font-family: var(--font-ar); color: var(--primary); font-size: 1.1rem; margin-bottom: 8px; }
.lesson-meta { display: flex; align-items: center; gap: 12px; margin-top: auto; padding-top: 16px; color: var(--muted); font-size: 0.82rem; }
.lesson-meta .bar { flex: 1; height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.lesson-meta .bar i { display: block; height: 100%; border-radius: 99px; background: var(--teal); }

/* ---------- Lesson detail ---------- */
.lesson-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 40px; align-items: start; }
.lesson-aside {
  position: sticky;
  top: calc(var(--header-h) + 24px);
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.lesson-aside h3 { font-size: 1rem; }
.progress-ring { display: flex; align-items: center; gap: 14px; margin: 16px 0 20px; }
.progress-ring .circle {
  --p: 0;
  display: grid;
  place-items: center;
  width: 66px; height: 66px;
  border-radius: 50%;
  background: conic-gradient(var(--teal) calc(var(--p) * 1%), var(--surface-2) 0);
  flex: none;
}
.progress-ring .circle span {
  display: grid;
  place-items: center;
  width: 50px; height: 50px;
  border-radius: 50%;
  background: var(--surface);
  font-weight: 700;
  font-size: 0.82rem;
}
.aside-nav { display: grid; gap: 4px; }
.aside-nav a {
  display: block;
  padding: 9px 12px;
  border-radius: 9px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.88rem;
}
.aside-nav a:hover { background: var(--surface-2); color: var(--text); }
.aside-nav a.active { background: var(--primary-soft); color: var(--primary); font-weight: 700; }

.phrase-list { display: grid; gap: 12px; }
.phrase-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color 0.18s, box-shadow 0.18s;
}
.phrase-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.phrase-card .arabic { font-family: var(--font-ar); direction: rtl; font-size: 1.5rem; line-height: 1.5; color: var(--text); }
.phrase-card .latin { font-weight: 700; color: var(--primary); font-size: 0.95rem; }
.phrase-card .english { color: var(--muted); font-size: 0.9rem; }
.phrase-actions { display: flex; gap: 8px; }
.audio-btn {
  display: inline-grid;
  place-items: center;
  width: 40px; height: 40px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--primary);
  transition: 0.18s;
}
.audio-btn:hover { background: var(--primary-soft); border-color: var(--primary); }
.audio-btn.playing { background: var(--primary); color: #fff; border-color: var(--primary); animation: pulse 1.2s infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(193, 68, 14, 0.4); } 50% { box-shadow: 0 0 0 8px rgba(193, 68, 14, 0); } }
.learned-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}
.learned-btn.on { background: var(--teal-soft); border-color: var(--teal); color: var(--teal); }

.flash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.flash {
  height: 176px;
  perspective: 1000px;
  border: 0;
  padding: 0;
  background: none;
  color: inherit;
  text-align: center;
}
.flash-inner { position: relative; display: block; height: 100%; transition: transform 0.55s; transform-style: preserve-3d; }
.flash.on .flash-inner { transform: rotateY(180deg); }
.flash-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  backface-visibility: hidden;
  box-shadow: var(--shadow-sm);
}
.flash-face.back { transform: rotateY(180deg); background: linear-gradient(145deg, var(--primary), #8c2f08); color: #fff; border-color: transparent; }
.flash-face .big-ar { font-family: var(--font-ar); font-size: 2rem; direction: rtl; }
.flash-face .big-tif { font-family: var(--font-tif); font-size: 2rem; }
.flash-face .translit { font-family: var(--font-head); font-size: 1.3rem; font-weight: 700; }
.flash-face small { color: var(--muted); font-size: 0.72rem; }
.flash-face.back small { color: #ffd9c6; }

/* ---------- Phrasebook ---------- */
.phrasebook-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.pb-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.pb-card:hover { border-color: var(--line-strong); }
.pb-card .arabic { font-family: var(--font-ar); direction: rtl; font-size: 1.35rem; line-height: 1.5; }
.pb-card .tif { font-family: var(--font-tif); font-size: 1.3rem; line-height: 1.6; }
.pb-card .latin { font-weight: 700; color: var(--primary); font-size: 0.9rem; }
.pb-card .english { color: var(--muted); font-size: 0.85rem; }
.pb-tag { display: inline-block; margin-top: 4px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.fav-btn { color: var(--muted); border: 0; background: none; padding: 6px; border-radius: 50%; }
.fav-btn.on { color: var(--gold); }
.empty-state { padding: 60px 20px; text-align: center; color: var(--muted); }

/* ---------- Amazigh ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); width: fit-content; max-width: 100%; }
.tab {
  padding: 9px 18px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--primary); color: #fff; }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeUp 0.35s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.alpha-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.alpha-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 8px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  text-align: center;
  transition: 0.18s;
}
.alpha-cell:hover { border-color: var(--primary); transform: translateY(-3px); box-shadow: var(--shadow-sm); }
.alpha-cell .tif { font-size: 2rem; line-height: 1; color: var(--primary); }
.alpha-cell .lat { font-weight: 700; font-size: 0.82rem; }
.alpha-cell .ipa { color: var(--muted); font-size: 0.72rem; }

.vocab-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.vocab {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  text-align: left;
  transition: 0.18s;
}
.vocab:hover { border-color: var(--teal); }
.vocab .tif { font-size: 1.32rem; line-height: 1.5; color: var(--teal); }
.vocab .lat { font-weight: 700; font-size: 0.9rem; }
.vocab .ar { font-family: var(--font-ar); color: var(--muted); font-size: 0.86rem; }
.vocab .fr { color: var(--muted); font-size: 0.78rem; }
.vocab .note { color: var(--muted); font-size: 0.7rem; font-style: italic; }

.data-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.data-table th, .data-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.data-table th { color: var(--muted); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.07em; }
.data-table td.tif { font-size: 1.2rem; color: var(--teal); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }

.note-box {
  display: flex;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  border-radius: 10px;
  background: var(--gold-soft);
  color: var(--text-2);
  font-size: 0.88rem;
}
.note-box svg { flex: none; color: var(--gold); margin-top: 2px; }
.note-box p { margin: 0; }

/* ---------- AI practice chat ---------- */
.chat-shell {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  min-height: 620px;
}
.chat-side { padding: 24px; border-right: 1px solid var(--line); background: var(--surface-2); }
.chat-side h3 { font-size: 1rem; margin-bottom: 12px; }
.chat-side .field { margin-bottom: 16px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.seg button { padding: 8px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 0.84rem; font-weight: 700; }
.seg button.active { background: var(--primary); color: #fff; }
.scenario-list { display: grid; gap: 6px; margin-top: 4px; }
.scenario-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 0.84rem;
  text-align: left;
}
.scenario-btn:hover { background: var(--surface); color: var(--text); }
.scenario-btn.active { background: var(--surface); border-color: var(--line); color: var(--text); font-weight: 700; }
.chat-main { display: flex; flex-direction: column; min-width: 0; }
.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
}
.chat-header .avatar { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, var(--gold), var(--primary)); color: #fff; }
.chat-header strong { display: block; font-size: 0.94rem; }
.chat-header span { display: block; color: var(--muted); font-size: 0.76rem; }
.chat-header .remaining { margin-left: auto; padding: 6px 12px; border-radius: 999px; background: var(--teal-soft); color: var(--teal); font-size: 0.74rem; font-weight: 700; }
.chat-log { flex: 1; display: flex; flex-direction: column; gap: 12px; padding: 22px; overflow-y: auto; max-height: 430px; background: var(--bg); }
.chat-msg { max-width: 80%; padding: 11px 15px; border-radius: 16px; font-size: 0.9rem; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.chat-msg.bot { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.chat-msg.user { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 5px; }
.chat-msg .msg-meta { display: block; margin-top: 4px; color: var(--muted); font-size: 0.7rem; }
.chat-msg.user .msg-meta { color: #ffd9c6; }
.chat-msg.typing { display: flex; gap: 4px; align-items: center; }
.chat-msg.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: bounce 1.2s infinite; }
.chat-msg.typing i:nth-child(2) { animation-delay: 0.15s; }
.chat-msg.typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-5px); } }
.chat-empty { margin: auto; text-align: center; color: var(--muted); max-width: 330px; font-size: 0.9rem; }
.chat-empty strong { display: block; color: var(--text); font-family: var(--font-head); font-size: 1.3rem; margin-bottom: 6px; }
.quick-prompts { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 22px 12px; }
.quick-prompts button { padding: 7px 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 0.76rem; }
.quick-prompts button:hover { border-color: var(--primary); color: var(--primary); }
.chat-form { display: flex; gap: 10px; padding: 14px 18px 18px; border-top: 1px solid var(--line); }
.chat-form input { flex: 1; }
.chat-form .send-btn { display: grid; place-items: center; width: 46px; height: 46px; flex: none; border: 0; border-radius: 50%; background: var(--primary); color: #fff; }
.chat-form .send-btn:hover { background: var(--primary-2); }
.chat-form .send-btn:disabled { opacity: 0.5; }
.chat-disclaimer { margin: 0; padding: 0 18px 14px; color: var(--muted); font-size: 0.72rem; }

/* ---------- Quiz ---------- */
.quiz-wrap { max-width: 720px; margin-inline: auto; }
.quiz-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; color: var(--muted); font-size: 0.85rem; }
.quiz-progress { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-bottom: 26px; border: 1px solid var(--line); }
.quiz-progress i { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--primary), var(--gold)); transition: width 0.35s; }
.quiz-card { padding: 30px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-md); }
.quiz-q { font-family: var(--font-head); font-size: 1.5rem; font-weight: 600; margin-bottom: 6px; }
.quiz-sub { color: var(--muted); font-size: 0.86rem; margin-bottom: 22px; }
.quiz-options { display: grid; gap: 10px; }
.option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 17px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface-2);
  text-align: left;
  font-size: 0.95rem;
  transition: 0.18s;
}
.option:hover:not(:disabled) { border-color: var(--primary); background: var(--primary-soft); }
.option .key { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); font-size: 0.78rem; font-weight: 700; flex: none; }
.option.correct { border-color: var(--teal); background: var(--teal-soft); color: var(--teal); }
.option.correct .key { background: var(--teal); color: #fff; border-color: var(--teal); }
.option.wrong { border-color: var(--danger); background: #fdecea; color: var(--danger); }
[data-theme="dark"] .option.wrong { background: #2c1414; }
.option.wrong .key { background: var(--danger); color: #fff; border-color: var(--danger); }
.option:disabled { cursor: default; }
.quiz-feedback { margin-top: 18px; padding: 14px 16px; border-radius: 12px; font-size: 0.9rem; display: none; }
.quiz-feedback.show { display: block; }
.quiz-feedback.ok { background: var(--teal-soft); color: var(--teal); }
.quiz-feedback.no { background: #fdecea; color: var(--danger); }
[data-theme="dark"] .quiz-feedback.no { background: #2c1414; }
.quiz-actions { display: flex; justify-content: flex-end; margin-top: 20px; }
.quiz-result { text-align: center; padding: 18px 6px; }
.quiz-result .score { font-family: var(--font-head); font-size: 4rem; line-height: 1; color: var(--primary); }
.quiz-result p { color: var(--muted); }
.quiz-result .best { display: inline-block; margin-top: 6px; padding: 6px 13px; border-radius: 999px; background: var(--gold-soft); color: var(--gold); font-size: 0.8rem; font-weight: 700; }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 52px; align-items: start; }
.about-card { padding: 28px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.about-stats { display: grid; gap: 14px; }
.about-stat { display: flex; align-items: center; gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.about-stat strong { display: block; font-family: var(--font-head); font-size: 1.5rem; line-height: 1; color: var(--primary); }
.about-stat span { color: var(--muted); font-size: 0.82rem; }
.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 24px 26px; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--primary); border: 3px solid var(--bg); }
.timeline strong { display: block; }
.timeline span { color: var(--muted); font-size: 0.84rem; }

/* ---------- Blog ---------- */
.post-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.post-card { display: flex; flex-direction: column; overflow: hidden; padding: 0; }
.post-cover { height: 168px; display: grid; place-items: center; background: linear-gradient(135deg, var(--primary-soft), var(--gold-soft)); color: var(--primary); font-family: var(--font-head); font-size: 2.4rem; }
.post-cover.teal { background: linear-gradient(135deg, var(--teal-soft), var(--primary-soft)); color: var(--teal); }
.post-body { display: flex; flex-direction: column; flex: 1; padding: 22px; }
.post-meta { display: flex; gap: 10px; color: var(--muted); font-size: 0.76rem; margin-bottom: 8px; }
.post-card h3 { font-size: 1.18rem; margin-bottom: 0.35em; }
.post-card p { color: var(--muted); font-size: 0.9rem; }
.post-card .card-arrow { margin-top: auto; }
.article { max-width: 760px; margin-inline: auto; }
.article header { margin-bottom: 34px; }
.article h1 { font-size: clamp(2.1rem, 4.5vw, 3.1rem); }
.article .article-meta { color: var(--muted); font-size: 0.86rem; }
.article h2 { font-size: 1.65rem; margin-top: 1.8em; }
.article h3 { font-size: 1.22rem; margin-top: 1.5em; }
.article p, .article li { color: var(--text-2); }
.article blockquote { margin: 24px 0; padding: 16px 22px; border-left: 4px solid var(--primary); background: var(--surface); border-radius: 0 10px 10px 0; color: var(--muted); font-style: italic; }
.article .phrase-table { margin: 22px 0; }
.article .callout { padding: 18px 22px; border-radius: 12px; background: var(--teal-soft); border: 1px solid rgba(14, 133, 120, 0.25); color: var(--text-2); }
.article .callout strong { color: var(--teal); }

/* ---------- Download page ---------- */
.download-grid { display: grid; grid-template-columns: 1fr 0.9fr; gap: 52px; align-items: center; }
.download-box { padding: 32px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-md); }
.download-box .btn { margin-bottom: 12px; }
.file-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--muted); font-size: 0.8rem; margin-top: 14px; }
.install-steps { counter-reset: inst; list-style: none; padding: 0; margin: 0; display: grid; gap: 18px; }
.install-steps li { position: relative; padding-left: 44px; }
.install-steps li::before { counter-increment: inst; content: counter(inst); position: absolute; left: 0; top: 0; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: 0.84rem; }
.install-steps strong { display: block; }

/* ---------- Legal ---------- */
.legal { max-width: 780px; margin-inline: auto; padding: 56px 0 30px; }
.legal h1 { font-size: clamp(2.1rem, 4.5vw, 3rem); }
.legal h2 { font-size: 1.5rem; margin-top: 1.9em; }
.legal p, .legal li { color: var(--text-2); }
.legal ul { padding-left: 1.2em; }
.legal .updated { color: var(--muted); font-size: 0.86rem; margin-bottom: 32px; }
.legal .toc { padding: 18px 22px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); margin-bottom: 30px; }
.legal .toc ol { margin: 0; }

/* ---------- Contact ---------- */
.contact-grid { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 48px; align-items: start; }
.contact-card { padding: 30px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.contact-item { display: flex; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.contact-item:last-child { border-bottom: 0; }
.contact-item .icon-badge { width: 42px; height: 42px; margin: 0; border-radius: 11px; flex: none; }
.contact-item strong { display: block; }
.contact-item a { font-size: 0.9rem; }

/* ---------- CTA strip / footer ---------- */
.footer-cta { padding: 60px 0; }
.site-footer {
  padding: 58px 0 28px;
  background: var(--navy);
  color: #d8e1ea;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
[data-theme="dark"] .site-footer { background: #071019; }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 38px; }
.footer-brand .brand { color: #fff; margin-bottom: 14px; }
.footer-brand .brand-name { color: #fff; }
.footer-brand p { color: #a9b7c5; font-size: 0.9rem; max-width: 34em; }
.footer-made { color: #d8e1ea !important; font-size: 0.84rem !important; }
.footer-col h3 { color: #fff; font-family: var(--font-body); font-size: 0.78rem; letter-spacing: 0.09em; text-transform: uppercase; margin-bottom: 14px; }
.footer-col a { display: block; padding: 4px 0; color: #a9b7c5; text-decoration: none; font-size: 0.88rem; }
.footer-col a:hover { color: #fff; }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px; margin-top: 40px; padding-top: 22px; border-top: 1px solid rgba(255, 255, 255, 0.1); color: #8fa0b0; font-size: 0.8rem; }
.footer-bottom a { color: #d8e1ea; }
.footer-note { max-width: 50ch; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 200;
  transform: translate(-50%, 20px);
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--navy);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  max-width: calc(100vw - 32px);
  text-align: center;
}
[data-theme="dark"] .toast { background: #f3eadf; color: #0b1118; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Reveal ---------- */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity 0.65s ease, transform 0.65s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Tables & misc ---------- */
.divider { height: 1px; background: var(--line); margin: 40px 0; border: 0; }
.pill-list { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; list-style: none; }
.pill { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 0.8rem; }
.kicker { display: block; color: var(--primary); font-weight: 700; font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 10px; }

/* ---------- Responsive ---------- */
@media (max-width: 1020px) {
  .nav-links { gap: 0; }
  .nav-links a { padding: 9px 9px; font-size: 0.9rem; }
  .hero-grid { gap: 36px; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 900px) {
  section { padding: 64px 0; }
  .hero { padding: 48px 0 40px; }
  .hero-grid, .split, .download-grid, .about-grid, .contact-grid { grid-template-columns: 1fr; }
  .split.reverse .split-media { order: 0; }
  .hero-visual { order: -1; }
  .phone { transform: rotate(0); width: min(290px, 78vw); }
  .phone-screen { min-height: 500px; }
  .float-card.one { left: 0; top: 6%; }
  .float-card.two { right: 0; bottom: 6%; }
  .grid-3, .lesson-grid, .post-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(2) { border-right: 0; }
  .stat:nth-child(-n + 2) { border-bottom: 1px solid var(--line); }
  .steps { grid-template-columns: 1fr; }
  .chat-shell { grid-template-columns: 1fr; }
  .chat-side { border-right: 0; border-bottom: 1px solid var(--line); }
  .scenario-list { grid-template-columns: 1fr 1fr; }
  .lesson-layout { grid-template-columns: 1fr; }
  .lesson-aside { position: static; order: 2; }
  .phrasebook-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .nav-links {
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 12px 20px 20px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-md);
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 11px 12px; font-size: 1rem; }
  .nav-links a.active::after { display: none; }
  .menu-toggle { display: inline-grid; }
  .nav-download { display: none; }
  .announce-inner { justify-content: center; font-size: 0.76rem; }
  .announce-inner > span { display: none; }
  .hero h1 { font-size: clamp(2.2rem, 9vw, 3.2rem); }
  .hero .lead { font-size: 1.05rem; }
  .float-card { font-size: 0.72rem; padding: 9px 11px; }
  .float-ic { width: 28px; height: 28px; }
  .grid-3, .lesson-grid, .post-grid, .grid-2, .grid-4 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .copyright { text-align: center; }
  .footer-bottom { justify-content: center; text-align: center; }
}

@media (max-width: 480px) {
  .container { width: calc(100% - 24px); }
  .hero-cta .btn, .cta-actions .btn { width: 100%; }
  .phone { width: 250px; }
  .phone-screen { min-height: 440px; }
  .float-card { display: none; }
  .stats { grid-template-columns: 1fr; }
  .stat { border-right: 0; border-bottom: 1px solid var(--line); }
  .stat:last-child { border-bottom: 0; }
  .scenario-list { grid-template-columns: 1fr; }
  .chat-log { max-height: 360px; padding: 16px; }
  .chat-msg { max-width: 90%; }
  .quiz-card { padding: 20px; }
  .footer-grid { grid-template-columns: 1fr; gap: 28px; }
}

/* ---------- Motion & print ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .reveal { opacity: 1; transform: none; }
}

@media print {
  .announce, .site-header, .site-footer, .cta-banner, .toast { display: none !important; }
  body { background: #fff; color: #000; }
  a { color: #000; }
}
