@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&family=Noto+Naskh+Arabic:wght@500;600;700&family=Playfair+Display:wght@500;600;700&display=swap');

:root {
  color-scheme: light;
  --paper: #f4f2ec;
  --paper-deep: #ebe7dd;
  --ink: #19241f;
  --muted: #68716a;
  --line: rgba(25, 36, 31, .12);
  --white: #fffefa;
  --font-body: 'Montserrat', Arial, sans-serif;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-arabic: 'Noto Naskh Arabic', 'Times New Roman', serif;
  --content: 1120px;
  --radius-lg: 28px;
  --radius-md: 18px;
  --shadow: 0 24px 70px rgba(33, 38, 33, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
body[data-theme='navy'] { --theme: #152744; --theme-dark: #101d32; --theme-soft: #dce3ec; --theme-glow: rgba(152, 179, 209, .17); }
body[data-theme='emerald'] { --theme: #145746; --theme-dark: #103d34; --theme-soft: #d9e8df; --theme-glow: rgba(133, 201, 166, .18); }
body[data-theme='burgundy'] { --theme: #682e40; --theme-dark: #482333; --theme-soft: #eddee2; --theme-glow: rgba(219, 151, 173, .17); }
body[data-theme='sand'] { --theme: #79602f; --theme-dark: #554321; --theme-soft: #eee6d1; --theme-glow: rgba(235, 207, 132, .19); }
body[data-theme='graphite'] { --theme: #384047; --theme-dark: #252d34; --theme-soft: #e1e4e5; --theme-glow: rgba(176, 193, 204, .17); }
body[data-theme='teal'] { --theme: #145b62; --theme-dark: #0d3e47; --theme-soft: #dce9e8; --theme-glow: rgba(132, 204, 204, .17); }
body[data-theme='plum'] { --theme: #504064; --theme-dark: #382b48; --theme-soft: #e5dfec; --theme-glow: rgba(194, 165, 219, .17); }
body[data-theme='terracotta'] { --theme: #804537; --theme-dark: #5d3028; --theme-soft: #efe1da; --theme-glow: rgba(230, 171, 139, .18); }
body[data-theme='cobalt'] { --theme: #31527d; --theme-dark: #203955; --theme-soft: #dfe6ef; --theme-glow: rgba(148, 182, 222, .18); }
body[data-theme='olive'] { --theme: #566141; --theme-dark: #3b452f; --theme-soft: #e5e8d9; --theme-glow: rgba(186, 199, 132, .18); }

a { color: inherit; }
a:focus-visible, button:focus-visible { outline: 3px solid #bd8b43; outline-offset: 4px; }
button { font: inherit; }
::selection { background: #d8c69e; color: #17231f; }

.skip-link {
  position: absolute;
  z-index: 20;
  top: 10px;
  left: 10px;
  padding: 10px 14px;
  transform: translateY(-160%);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
}
.skip-link:focus { transform: translateY(0); }
.site-shell { width: min(calc(100% - 32px), var(--content)); margin-inline: auto; }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 78px;
  padding-block: 12px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
}
.brand__mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(25, 36, 31, .16);
  border-radius: 50%;
  background: rgba(255, 254, 250, .7);
  font-family: var(--font-arabic);
  font-size: 28px;
  line-height: 1;
}
.brand__text { display: grid; gap: 1px; }
.brand__name { font-family: var(--font-display); font-size: 16px; line-height: 1.25; }
.brand__caption { color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .15em; text-transform: uppercase; }
.header-note { display: none; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }

.page-nav-wrap { padding: 0 0 17px; }
.page-nav {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 2px 2px 7px;
  scrollbar-width: thin;
  scrollbar-color: #b7b3a9 transparent;
  -webkit-overflow-scrolling: touch;
}
.page-nav__link {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  min-height: 39px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 254, 250, .66);
  color: #47514a;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .025em;
  text-decoration: none;
  transition: background .2s ease, color .2s ease, border-color .2s ease, transform .2s ease;
}
.page-nav__link:hover { transform: translateY(-1px); border-color: rgba(25, 36, 31, .25); background: var(--white); }
.page-nav__link[aria-current='page'] { border-color: var(--ink); background: var(--ink); color: var(--white); }

.hero {
  position: relative;
  display: grid;
  min-height: 415px;
  overflow: hidden;
  align-items: center;
  padding: 34px 27px;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(ellipse at 82% 23%, var(--theme-glow), transparent 39%),
    radial-gradient(ellipse at 10% 110%, rgba(255,255,255,.07), transparent 42%),
    linear-gradient(130deg, var(--theme), var(--theme-dark));
  color: #fffdf7;
  isolation: isolate;
}
.hero::before, .hero::after { position: absolute; z-index: -1; content: ''; pointer-events: none; }
.hero::before {
  top: -38%; right: -18%;
  width: min(76vw, 670px); aspect-ratio: 1;
  border: 1px solid rgba(255,255,255,.14); border-radius: 50%;
  box-shadow: 0 0 0 34px rgba(255,255,255,.025), 0 0 0 68px rgba(255,255,255,.025), 0 0 0 102px rgba(255,255,255,.018);
}
.hero::after {
  right: 13%; bottom: 7%;
  width: 48px; height: 48px;
  border: 1px solid rgba(255,255,255,.2);
  transform: rotate(45deg);
}
.hero__inner { display: grid; gap: 24px; }
.hero__copy { position: relative; z-index: 1; max-width: 660px; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 17px;
  color: rgba(255,255,255,.72);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .18em;
  line-height: 1.5;
  text-transform: uppercase;
}
.eyebrow::before { width: 25px; height: 1px; background: #d7bf88; content: ''; }
.hero h1 {
  max-width: 720px;
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(39px, 10vw, 76px);
  font-weight: 500;
  letter-spacing: -.045em;
  line-height: 1.04;
  text-wrap: balance;
}
.hero__description { max-width: 520px; margin: 18px 0 0; color: rgba(255,255,255,.75); font-size: 13px; line-height: 1.8; }
.hero__art {
  display: flex;
  position: relative;
  z-index: 0;
  align-items: center;
  justify-content: center;
  min-height: 93px;
  gap: clamp(0px, 4vw, 26px);
  color: rgba(255,255,255,.86);
  font-family: var(--font-arabic);
  font-size: clamp(50px, 14vw, 105px);
  line-height: 1;
  direction: rtl;
  user-select: none;
}
.hero__art span { display: inline-block; transform: translateY(var(--offset, 0)); text-shadow: 0 8px 30px rgba(0,0,0,.18); }
.hero__art span:nth-child(2) { --offset: 13px; opacity: .74; }
.hero__art span:nth-child(3) { --offset: -8px; opacity: .53; }
.hero__art span:nth-child(4) { --offset: 9px; opacity: .34; }
.hero__index {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-top: 21px;
  color: rgba(255,255,255,.7);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.hero__index::before { width: 6px; height: 6px; border-radius: 50%; background: #d7bf88; content: ''; }
.hero--home { min-height: 510px; }
.hero--home .hero__description { font-size: 14px; }
.hero--home .button { margin-top: 24px; }

.button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 11px;
  padding: 11px 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: #f2e3c1;
  color: #1b2922;
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
  transition: transform .2s ease, background .2s ease, box-shadow .2s ease;
}
.button:hover { transform: translateY(-2px); background: #fff0ce; box-shadow: 0 9px 24px rgba(0,0,0,.14); }
.button__arrow { font-size: 16px; line-height: 1; }
.button--light { border-color: rgba(255,255,255,.25); background: rgba(255,255,255,.09); color: white; }
.button--light:hover { background: rgba(255,255,255,.18); }

.section { padding-block: 54px; }
.section--compact { padding-block: 38px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 21px; }
.section-heading__label { display: block; margin-bottom: 6px; color: #7e8279; font-size: 9px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.section-heading h2 { margin: 0; font-family: var(--font-display); font-size: clamp(28px, 7vw, 40px); font-weight: 500; letter-spacing: -.035em; line-height: 1.15; }
.section-heading p { max-width: 410px; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.75; }

.progress-card {
  display: grid;
  gap: 17px;
  padding: 21px;
  border: 1px solid rgba(25,36,31,.08);
  border-radius: var(--radius-md);
  background: rgba(255,254,250,.78);
  box-shadow: 0 10px 35px rgba(33,38,33,.035);
}
.progress-card__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.progress-card__title { margin: 0; font-family: var(--font-display); font-size: 21px; font-weight: 500; }
.progress-card__count { color: var(--muted); font-size: 10px; font-weight: 700; white-space: nowrap; }
.progress-track { height: 6px; overflow: hidden; border-radius: 10px; background: #e7e4db; }
.progress-track__fill { width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #c4a66b, #748b6e); transition: width .35s ease; }
.progress-card__note { margin: -7px 0 0; color: var(--muted); font-size: 10px; }

.alphabet-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.alphabet-tile {
  display: grid;
  min-height: 76px;
  align-content: center;
  justify-items: center;
  gap: 1px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255,254,250,.64);
  text-decoration: none;
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
}
.alphabet-tile:hover { transform: translateY(-2px); border-color: rgba(25,36,31,.28); background: var(--white); }
.alphabet-tile__glyph { font-family: var(--font-arabic); font-size: 29px; line-height: 1.15; }
.alphabet-tile__name { color: var(--muted); font-size: 8px; }

.letter-list { display: grid; gap: 13px; }
.letter-card {
  display: grid;
  position: relative;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(25,36,31,.09);
  border-radius: 21px;
  background: rgba(255,254,250,.84);
  box-shadow: 0 10px 32px rgba(33,38,33,.035);
  transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
  scroll-margin-top: 20px;
}
.letter-card:hover { transform: translateY(-2px); border-color: rgba(25,36,31,.17); box-shadow: var(--shadow); }
.letter-card.is-learned { border-color: rgba(51,105,75,.35); background: #f8fbf6; }
.letter-card__glyph-wrap {
  display: grid;
  min-height: 112px;
  align-content: center;
  justify-items: center;
  border-radius: 15px;
  background: var(--theme-soft);
  color: var(--theme-dark);
}
.letter-card__glyph { font-family: var(--font-arabic); font-size: 68px; line-height: 1.1; }
.letter-card__latin { margin-top: 2px; color: var(--muted); font-size: 8px; font-weight: 600; letter-spacing: .11em; text-transform: uppercase; }
.letter-card__body { min-width: 0; padding-block: 1px; }
.letter-card__number { display: block; margin-bottom: 3px; color: #858a81; font-size: 8px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.letter-card h2 { margin: 0; font-family: var(--font-display); font-size: 25px; font-weight: 500; letter-spacing: -.02em; line-height: 1.15; }
.letter-card__transcription { margin: 3px 0 10px; color: var(--theme); font-size: 10px; font-weight: 700; }
.example { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.example__arabic { color: var(--theme-dark); font-family: var(--font-arabic); font-size: 25px; font-weight: 600; line-height: 1.25; direction: rtl; unicode-bidi: isolate; }
.example__latin { color: var(--muted); font-size: 9px; }
.example__meaning { margin-left: auto; color: var(--ink); font-size: 9px; font-weight: 600; }
.learn-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #59635b;
  cursor: pointer;
  font-size: 9px;
  font-weight: 700;
}
.learn-button::before { display: grid; width: 17px; height: 17px; place-items: center; border: 1px solid #a6aca4; border-radius: 50%; content: ''; font-size: 11px; line-height: 1; }
.learn-button[aria-pressed='true'] { color: #34704e; }
.learn-button[aria-pressed='true']::before { border-color: #34704e; background: #34704e; color: white; content: '✓'; }

.lesson-intro { display: flex; align-items: center; gap: 12px; margin: 27px 0 18px; color: var(--muted); font-size: 11px; }
.lesson-intro__rule { flex: 1; height: 1px; background: var(--line); }
.lesson-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding-bottom: 47px; }
.pager-link {
  display: grid;
  min-height: 82px;
  align-content: center;
  gap: 4px;
  padding: 12px 15px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255,254,250,.66);
  text-decoration: none;
  transition: background .2s ease, transform .2s ease;
}
.pager-link:hover { transform: translateY(-2px); background: var(--white); }
.pager-link--next { text-align: right; }
.pager-link--disabled { visibility: hidden; }
.pager-link__direction { color: var(--muted); font-size: 8px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.pager-link__title { font-family: var(--font-display); font-size: 15px; }

.info-strip { display: grid; gap: 14px; padding: 22px; border-radius: 19px; background: #e9e6dc; }
.info-strip__number { color: #716b5f; font-family: var(--font-display); font-size: 27px; line-height: 1; }
.info-strip h3 { margin: 0 0 5px; font-family: var(--font-display); font-size: 19px; font-weight: 500; }
.info-strip p { margin: 0; color: #646a62; font-size: 10px; line-height: 1.8; }

.site-footer { display: flex; flex-direction: column; gap: 10px; padding-block: 20px 32px; border-top: 1px solid var(--line); color: var(--muted); font-size: 9px; }
.site-footer__brand { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-display); font-size: 13px; color: var(--ink); }
.site-footer__mark { font-family: var(--font-arabic); font-size: 19px; }
.site-footer a { text-underline-offset: 3px; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; overflow: hidden !important; clip: rect(1px, 1px, 1px, 1px) !important; white-space: nowrap !important; clip-path: inset(50%) !important; }

@media (min-width: 620px) {
  .site-shell { width: min(calc(100% - 52px), var(--content)); }
  .header-note { display: block; }
  .hero { min-height: 455px; padding: 54px 52px; }
  .hero__inner { grid-template-columns: minmax(0, 1fr) 200px; align-items: center; gap: 15px; }
  .hero__art { flex-direction: column; min-height: 250px; gap: 0; font-size: 83px; }
  .hero__art span:nth-child(2) { --offset: 2px; }
  .hero__art span:nth-child(3) { --offset: -5px; }
  .hero__art span:nth-child(4) { --offset: 1px; }
  .hero--home { min-height: 540px; }
  .hero--home .hero__inner { grid-template-columns: minmax(0, 1fr) 250px; }
  .hero--home .hero__art { font-size: 106px; }
  .section { padding-block: 64px; }
  .progress-card { grid-template-columns: minmax(175px, .7fr) minmax(0, 1.8fr) auto; align-items: center; padding: 22px 26px; }
  .progress-card__note { grid-column: 2 / 4; margin-top: -14px; }
  .alphabet-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 11px; }
  .alphabet-tile { min-height: 90px; }
  .letter-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .letter-card { grid-template-columns: 94px minmax(0, 1fr); padding: 18px; }
  .letter-card__glyph-wrap { min-height: 145px; }
  .letter-card__glyph { font-size: 82px; }
  .info-strip { grid-template-columns: 74px 1fr; align-items: center; gap: 20px; padding: 26px 30px; }
  .site-footer { flex-direction: row; align-items: center; justify-content: space-between; }
  .lesson-pager { gap: 17px; }
}

@media (min-width: 920px) {
  .site-header { min-height: 88px; }
  .hero { min-height: 480px; padding: 62px 70px; }
  .hero__inner { grid-template-columns: minmax(0, 1fr) 260px; }
  .hero__art { font-size: 100px; }
  .hero--home { min-height: 575px; }
  .hero--home .hero__inner { grid-template-columns: minmax(0, 1fr) 320px; }
  .hero--home .hero__art { font-size: 126px; }
  .section-heading { margin-bottom: 25px; }
  .letter-card { grid-template-columns: 112px minmax(0, 1fr); gap: 17px; padding: 21px; }
  .letter-card__glyph-wrap { min-height: 158px; }
  .letter-card__glyph { font-size: 91px; }
  .letter-card__body { padding-block: 4px; }
  .letter-card h2 { font-size: 29px; }
  .lesson-pager { padding-bottom: 58px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
