/* ==========================================================
   مفردات الايلتس — shared styles
   Visual language mirrors the iOS app: soft lavender canvas,
   borderless rounded cards, ink pill buttons, violet accents.
   ========================================================== */

:root {
  /* Tokens mirror kalimat/Theme/KalimaTheme.swift */
  --violet: #6D5BE8;
  --violet-strong: #3C3488;   /* violetDark */
  --violet-mid: #5A4FB5;
  --violet-soft: #ECEAFB;     /* violetLight */
  --lavender: #ECEAFB;
  --lavender-2: #A79BFF;      /* badgeColor */
  --teal: #0F9D96;
  --teal-soft: #7DD6CF;
  --cream: #FDF6E9;           /* beige */
  --note-text: #7A5B18;
  --amber-soft: #FBE7BE;
  --coral: #E85D3D;
  --ink: #0E1120;             /* textPrimary */
  --bg: #FBFAFF;              /* lighter than the app's #F3F5FA, per site request */
  --bg-alt: #F3F5FA;          /* app background */
  --fill-muted: #E3E7F0;
  --card: #FFFFFF;
  --text: #0E1120;
  --muted: #646A7C;           /* textSecondary */
  --border: #E2E6F0;          /* cardBorder */
  --hairline: rgba(14, 17, 32, .08);
  --good: #12B76A;
  --good-soft: #EAF7EF;
  --good-text: #0B6B41;
  --shadow-sm: 0 4px 12px rgba(40, 44, 90, .05);
  --shadow-md: 0 8px 28px -6px rgba(40, 44, 90, .12);
  --shadow-lg: 0 40px 80px -30px rgba(40, 44, 90, .35), 0 16px 32px -16px rgba(14, 17, 32, .18);
  --radius: 28px;             /* heroCardRadius */
  --radius-compact: 22px;     /* compactCardRadius */
  --font-display: 'IBM Plex Sans Arabic', -apple-system, 'SF Arabic', 'Geeza Pro', sans-serif;
  --font-body: 'IBM Plex Sans Arabic', -apple-system, 'SF Arabic', 'Geeza Pro', 'Helvetica Neue', sans-serif;
  --font-latin: 'Archivo', 'IBM Plex Sans Arabic', -apple-system, 'Helvetica Neue', Arial, sans-serif;
  --font-num: 'Archivo', 'IBM Plex Sans Arabic', sans-serif;
  --font-mono: 'IBM Plex Mono', 'IBM Plex Sans Arabic', ui-monospace, Menlo, monospace;
  color-scheme: light;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; overflow-x: clip; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.8;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: var(--violet); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 4px; }
:focus-visible { outline: 3px solid var(--violet); outline-offset: 3px; border-radius: 8px; }
[dir="ltr"], .ltr { direction: ltr; unicode-bidi: isolate; }

.wrap { max-width: 1140px; margin: 0 auto; padding: 0 20px; }
.wrap-narrow { max-width: 780px; margin: 0 auto; padding: 0 20px; }

.skip { position: absolute; top: 8px; inset-inline-start: 16px; transform: translateY(-200%); background: var(--ink); color: #fff; padding: 8px 16px; border-radius: 999px; z-index: 100; }
.skip:focus { transform: none; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s, background .2s;
}
.site-header.scrolled { border-bottom-color: var(--border); }
.nav { display: flex; align-items: center; gap: 4px; height: 70px; }
.brand {
  display: flex; align-items: center; gap: 10px; margin-left: auto;
  font-family: var(--font-display); font-size: 20px; font-weight: 700; color: var(--ink);
}
.brand:hover { text-decoration: none; }
.brand img { width: 38px; height: 38px; border-radius: 11px; box-shadow: var(--shadow-sm); }
.nav-link {
  font-size: 15px; font-weight: 500; color: var(--muted); padding: 6px 14px; border-radius: 999px;
  transition: color .15s, background .15s;
}
.nav-link:hover, .nav-link[aria-current="page"] { color: var(--ink); background: var(--card); text-decoration: none; }
.nav-cta {
  margin-right: 8px; font-size: 14.5px; font-weight: 600;
  background: var(--ink); color: #fff; padding: 8px 20px; border-radius: 999px;
  transition: transform .15s, background .15s;
}
.nav-cta:hover { text-decoration: none; transform: translateY(-1px); background: #23243a; }

/* ---------- Buttons ---------- */
.btn-store {
  display: inline-flex; align-items: center; gap: 12px;
  background: var(--ink); color: #fff; border-radius: 999px;
  padding: 12px 30px 12px 32px; font-weight: 600; font-size: 16px;
  box-shadow: 0 14px 30px -14px rgba(15, 16, 32, .6);
  transition: transform .18s, box-shadow .18s;
}
.btn-store:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 20px 36px -16px rgba(15, 16, 32, .65); }
.btn-store:active { transform: scale(.98); }
.btn-store svg { width: 26px; height: 26px; fill: currentColor; flex: none; }
.btn-store small { display: block; font-size: 11.5px; font-weight: 400; opacity: .7; line-height: 1.3; }
.btn-store b { display: block; line-height: 1.2; font-size: 18px; font-family: var(--font-latin); font-weight: 700; letter-spacing: -.01em; }
.btn-ghost {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--ink); font-weight: 600; padding: 12px 22px; border-radius: 999px;
  border: 1.5px solid var(--border); background: var(--card);
  transition: border-color .15s, transform .15s;
}
.btn-ghost:hover { text-decoration: none; border-color: var(--lavender-2); transform: translateY(-1px); }

/* Highlighted word in page headings */
.tag {
  display: inline-block; padding: 0 .3em; border-radius: .3em; white-space: nowrap;
  background: var(--lavender); color: var(--ink);
}
.tag.violet { background: none; color: var(--violet); padding: 0; }

/* ---------- Sections ---------- */
section { padding: 104px 0 0; scroll-margin-top: 70px; }

/* Steps */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; counter-reset: s; position: relative; }
.step { position: relative; padding: 30px; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow-sm); }
.step::before {
  counter-increment: s; content: counter(s, decimal);
  display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%;
  background: var(--ink); color: #fff; font-family: var(--font-num); font-size: 20px; font-weight: 800; margin-bottom: 18px;
}
.step h3 { font-weight: 600; font-size: 20px; margin-bottom: 6px; }
.step p { color: var(--muted); font-size: 15.5px; }

/* FAQ (shared with support page) */
.faq { display: grid; gap: 10px; }
.faq details { background: var(--card); border-radius: 22px; box-shadow: var(--shadow-sm); }
.faq summary {
  list-style: none; cursor: pointer; padding: 18px 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  font-weight: 600; color: var(--ink); font-size: 16.5px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; flex: none; width: 30px; height: 30px; border-radius: 50%;
  background: var(--violet-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236C5CE7' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M12 6v12M6 12h12'/%3E%3C/svg%3E") center / 14px no-repeat;
  transition: transform .2s;
}
.faq details[open] summary::after { transform: rotate(45deg); }
.faq .ans { padding: 0 24px 20px; color: var(--muted); }
.faq .ans p + p, .faq .ans ul { margin-top: 8px; }
.faq .ans ul { padding-right: 20px; }
.faq .ans li { margin-bottom: 4px; }
.faq-more { margin-top: 18px; text-align: center; }

/* ---------- Footer ---------- */
.site-footer { margin-top: 104px; border-top: 1px solid var(--border); padding: 64px 0 36px; color: var(--muted); font-size: 15px; background: var(--card); }
.foot { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 40px; align-items: start; }
.foot-brand .brand { margin: 0 0 14px; font-size: 22px; }
.foot-brand .brand img { width: 40px; height: 40px; border-radius: 11px; }
.foot-brand p { max-width: 340px; line-height: 1.8; }
.foot-col { display: flex; flex-direction: column; gap: 12px; padding-top: 6px; }
.foot-col a { color: var(--text); width: fit-content; }
.foot-col a:hover, .foot-col a[aria-current="page"] { color: var(--violet); }
.foot-bottom { margin-top: 48px; padding-top: 22px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 13.5px; }

/* ---------- Doc pages (privacy / terms / support) ---------- */
.doc-hero { padding: 56px 0 36px; position: relative; }
.doc-hero::before {
  content: ""; position: absolute; inset: -80px 0 auto auto; width: 60vw; height: 420px; z-index: -1;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--violet) 14%, transparent), transparent 72%);
}
.doc-hero h1 { font-size: clamp(32px, 4.6vw, 48px); font-weight: 700; line-height: 1.3; margin-bottom: 8px; }
.doc-hero p { color: var(--muted); font-size: 17px; }
.meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.pill { font-size: 13px; background: var(--card); padding: 3px 12px; border-radius: 999px; color: var(--muted); box-shadow: var(--shadow-sm); }

.doc-layout { display: grid; grid-template-columns: 230px 1fr; gap: 48px; align-items: start; }
.toc { position: sticky; top: 90px; font-size: 14.5px; }
.toc b { display: block; color: var(--ink); font-size: 13px; margin-bottom: 8px; }
.toc ol { list-style: none; border-right: 2px solid var(--border); }
.toc a { display: block; color: var(--muted); padding: 5px 14px; margin-right: -2px; border-right: 2px solid transparent; line-height: 1.6; }
.toc a:hover { color: var(--ink); text-decoration: none; }
.toc a.active { color: var(--violet); border-right-color: var(--violet); font-weight: 600; }

.prose { background: var(--card); border-radius: var(--radius); padding: 40px 44px; box-shadow: var(--shadow-sm); }
.prose h2 {
  font-size: 22px; font-weight: 600; margin: 40px 0 12px; scroll-margin-top: 90px; line-height: 1.5;
  display: flex; align-items: center; gap: 12px;
}
.prose h2:first-child { margin-top: 0; }
.prose h3 { margin: 22px 0 8px; font-size: 18px; }
.prose h2 .n {
  flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: var(--violet-soft); color: var(--violet); font-size: 16px;
}
.prose p, .prose li { margin-bottom: 10px; }
.prose ul { padding-right: 22px; margin-bottom: 10px; }
.prose li::marker { color: var(--violet); }
.prose strong { color: var(--ink); }
.callout { background: var(--violet-soft); border-radius: 18px; padding: 16px 20px; margin: 4px 0 14px; color: var(--ink); }

.contact-card {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  background: var(--card); border-radius: var(--radius); padding: 24px 26px;
  box-shadow: var(--shadow-sm); margin-bottom: 48px;
}
.contact-card .ic { width: 52px; height: 52px; border-radius: 50%; background: var(--violet); display: grid; place-items: center; flex: none; }
.contact-card .ic svg { width: 24px; height: 24px; stroke: #fff; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.contact-card .txt { flex: 1; min-width: 200px; }
.contact-card .txt b { display: block; color: var(--ink); font-size: 17px; }
.contact-card .txt span { color: var(--muted); font-size: 14.5px; }
.contact-card .btn-ghost { direction: ltr; }

.h-sub { font-size: 26px; font-weight: 700; margin: 0 0 18px; }
.doc-links { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 48px; }
.doc-links a {
  display: block; position: relative; background: var(--card); border-radius: 22px; padding: 20px 24px 20px 56px;
  color: var(--ink); font-weight: 600; box-shadow: var(--shadow-sm); transition: box-shadow .15s, transform .15s;
}
.doc-links a::after {
  content: ""; position: absolute; left: 20px; top: 50%; width: 22px; height: 22px; margin-top: -11px; border-radius: 50%;
  background: var(--violet-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236C5CE7' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 6l-6 6 6 6'/%3E%3C/svg%3E") center / 13px no-repeat;
  transition: transform .15s;
}
.doc-links a:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-md); }
.doc-links a:hover::after { transform: translateX(-3px); }
.doc-links span { display: block; font-weight: 400; font-size: 14px; color: var(--muted); margin-top: 2px; }

/* ---------- Reveal on scroll ---------- */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.js .reveal.in { opacity: 1; transform: none; }
.js .reveal.in.step { transition: opacity .6s ease, transform .2s ease, box-shadow .2s ease; }

/* ---------- Word list pages ---------- */
.crumbs { display: flex; gap: 8px; flex-wrap: wrap; font-size: 14px; color: var(--muted); padding-top: 24px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--violet); }
.crumbs [aria-current] { color: var(--ink); font-weight: 600; }
.crumbs + .doc-hero { padding-top: 24px; }
.doc-hero > p { max-width: 720px; }
.tip { background: var(--violet-soft); border-radius: 20px; padding: 14px 20px; margin-bottom: 28px; color: var(--ink); }

.w-grid { list-style: none; display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; counter-reset: w; }
.w-grid[start="31"] { counter-reset: w 30; }
.w-card {
  counter-increment: w; position: relative;
  background: var(--card); border-radius: 24px; box-shadow: var(--shadow-sm);
  padding: 22px 24px 20px;
}
.w-card::before {
  content: counter(w, decimal); position: absolute; top: 28px; right: 24px;
  font-size: 12px; font-weight: 600; color: var(--muted); line-height: 22px;
}
.w-top { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.w-en { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; flex: 1; text-align: left; }
.w-en h3 { font-family: var(--font-latin); font-size: 27px; font-weight: 700; color: var(--ink); line-height: 1.25; letter-spacing: -.01em; }
.w-ipa { color: var(--muted); font-size: 13.5px; font-family: var(--font-mono); }
.w-say {
  flex: none; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; border: 0;
  background: var(--violet); display: grid; place-items: center;
  transition: transform .12s, background .15s;
}
.w-say svg { width: 18px; height: 18px; stroke: #fff; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.w-say:hover { transform: scale(1.06); }
.w-say.playing { background: var(--violet-strong); }
.w-ar { font-family: var(--font-display); font-size: 20px; font-weight: 600; color: var(--ink); margin-bottom: 4px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.w-pos { font-family: var(--font-body); font-size: 12px; font-weight: 600; color: var(--violet); background: var(--violet-soft); border-radius: 999px; padding: 0 10px; line-height: 22px; }
.w-note { background: var(--cream); border-radius: 14px; padding: 8px 14px; font-size: 14.5px; color: var(--note-text); margin: 8px 0; line-height: 1.75; }
.w-ex { color: var(--text); font-size: 15px; line-height: 1.6; text-align: left; background: var(--bg); border-radius: 14px; padding: 10px 14px; margin-top: 10px; }

.app-cta {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap; margin: 40px 0;
  background: var(--lavender); border-radius: var(--radius); padding: 22px 26px;
}
.app-cta img { width: 64px; height: 64px; border-radius: 17px; box-shadow: var(--shadow-sm); }
.app-cta .txt { flex: 1; min-width: 220px; }
.app-cta .txt b { display: block; font-family: var(--font-display); font-size: 20px; font-weight: 600; color: var(--ink); line-height: 1.5; }
.app-cta .txt span { color: var(--text); font-size: 15px; }

.more-lists { padding-top: 24px; }
.more-lists .doc-links { grid-template-columns: repeat(3, 1fr); margin-top: 0; }
.credit { font-size: 13px; color: var(--muted); margin-top: 8px; max-width: 760px; }

.hub-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.hub-card {
  display: flex; flex-direction: column; gap: 6px; color: var(--text);
  background: var(--card); box-shadow: var(--shadow-sm); border-radius: var(--radius); padding: 26px;
  transition: transform .18s, box-shadow .18s;
}
.hub-card:hover { text-decoration: none; transform: translateY(-3px); box-shadow: var(--shadow-md); }
.hub-badge { align-self: flex-start; background: var(--lavender); color: var(--violet-strong); font-weight: 700; font-size: 14px; padding: 1px 14px; border-radius: 999px; }
.hub-card h2 { font-size: 21px; line-height: 1.5; margin-top: 6px; }
.hub-card p { color: var(--muted); font-size: 15px; flex: 1; }
.hub-sample { font-size: 14px; color: var(--violet); font-weight: 600; }
.hub-how { padding-top: 64px; }

.list-links { grid-template-columns: repeat(3, 1fr); margin-top: 0; }
.doc-links a span.inl { display: inline; color: inherit; font-size: inherit; font-weight: inherit; margin: 0; }

/* Tables inside guide pages */
.table-wrap { overflow-x: auto; margin: 6px 0 16px; }
.prose table { width: 100%; border-collapse: collapse; font-size: 15px; }
.prose th, .prose td { text-align: right; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.prose th { color: var(--ink); background: var(--violet-soft); font-weight: 600; }
.prose td:first-child { font-weight: 600; color: var(--ink); }

/* Band score calculator */
.calc { background: var(--card); border-radius: var(--radius); padding: 28px 32px; box-shadow: var(--shadow-sm); margin-bottom: 20px; }
.calc h2 { font-size: 22px; margin-bottom: 18px; }
.calc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.calc-grid-2 { grid-template-columns: repeat(2, 1fr); }
.calc label { display: flex; flex-direction: column; gap: 6px; font-size: 15px; font-weight: 600; color: var(--ink); }
.calc label .ltr { font-size: 13px; font-weight: 400; color: var(--muted); }
.calc select, .calc input { width: 100%; min-height: 48px; padding: 8px 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--card); color: var(--ink); font: inherit; font-size: 17px; }
.calc-result { margin-top: 18px; padding: 16px 20px; border-radius: 18px; background: var(--violet-soft); color: var(--ink); }
.calc-result span { font-size: 14px; }
.calc-result output { display: block; font-family: var(--font-display); font-size: 40px; font-weight: 800; line-height: 1.2; text-align: right; }
.calc-result p { margin: 4px 0 0; font-size: 15px; }
.calc-result p:empty { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .calc { padding: 22px 18px; }
  .calc-grid { grid-template-columns: 1fr 1fr; }
  .calc-grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .doc-layout { grid-template-columns: 1fr; }
  .toc { display: none; }
  .foot { grid-template-columns: 1fr 1fr; }
  .foot-brand { grid-column: 1 / -1; }
  .hub-grid, .more-lists .doc-links, .list-links { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .nav-link.hide-sm { display: none; }
  .steps { grid-template-columns: 1fr; }
  .prose { padding: 26px 22px; }
  .doc-links, .w-grid, .hub-grid, .more-lists .doc-links, .list-links { grid-template-columns: 1fr; }
  section { padding-top: 80px; }
}
@media (max-width: 480px) {
  .nav-cta { display: none; }
  .brand { font-size: 19px; }
  .prose { padding: 22px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .js .reveal { opacity: 1; transform: none; }
}
