/* گام به گام — warm & calm design system
   One place for the palette and the base styling. RTL/LTR both work via
   logical properties (padding-inline, margin-inline, border-inline-start). */

:root {
  --bg: #FBF7F1;
  --card: #FFFFFF;
  --card-alt: #F4EEE4;
  --ink: #33302B;
  --ink-soft: #6B655C;
  --border: #E8E0D3;
  --accent: #C2683D;
  --accent-ink: #A0522E;
  --accent-tint: #FCF1EA;
  --done: #5E8C61;
  --done-soft: #E6EFE4;

  --radius: 18px;
  --radius-lg: 22px;
  --tap: 56px;

  --font-fa: 'Vazirmatn', system-ui, sans-serif;
  --font-en: 'Nunito', 'Vazirmatn', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-fa);
  font-size: 18px;
  line-height: 1.7;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

html[lang="en"] body { font-family: var(--font-en); }

h1, h2, p { margin: 0; }

a { color: var(--accent); }
a:hover { color: var(--accent-ink); }

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

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

/* ---- app frame ---------------------------------------------------------- */

.app {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  max-width: 480px;
  margin-inline: auto;
  background: var(--bg);
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 20px 12px;
  padding-top: calc(22px + env(safe-area-inset-top));
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  font-weight: 700;
  font-size: 22px;
}
.brand__mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--accent-tint);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}
.brand__mark svg { width: 24px; height: 24px; display: block; }

.lang {
  display: flex;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  font-size: 14px;
}
.lang__btn {
  border: 0;
  background: none;
  padding: 8px 14px;
  color: var(--ink-soft);
  min-height: 40px;
}
.lang__btn[aria-pressed="true"] {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

/* ---- screens ---------------------------------------------------------- */

.main { flex: 1; }

.screen { padding: 8px 20px 16px; }
.screen[hidden] { display: none; }

.greeting { padding-block: 8px 4px; }
.greeting__title { font-size: 27px; font-weight: 700; }
.greeting__sub { margin-top: 8px; font-size: 17px; color: var(--ink-soft); }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.progress { margin-top: 20px; }
.progress__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}
.progress__label { font-size: 15px; color: var(--ink-soft); }
.progress__count { font-size: 16px; font-weight: 700; }

.track {
  height: 12px;
  border-radius: 999px;
  background: var(--card-alt);
  overflow: hidden;
}
.track__fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}

/* ---- lesson list (home) --------------------------------------------- */

.lessons {
  list-style: none;
  margin: 20px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.lesson {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-decoration: none;
  color: inherit;
}
.lesson--current { border-color: var(--accent); background: var(--accent-tint); }
.lesson--later { opacity: 0.55; }

.lesson__badge {
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  background: var(--card-alt);
  color: var(--ink-soft);
}
.lesson__badge svg { width: 24px; height: 24px; display: block; }
.lesson__badge--done { background: var(--done); color: #fff; }
.lesson__badge--now { background: var(--accent); color: #fff; }

.lesson__info { flex: 1; min-width: 0; }
.lesson__title { display: block; font-size: 18px; font-weight: 700; }
.lesson__desc { display: block; margin-top: 3px; font-size: 15px; color: var(--ink-soft); }

.tag {
  flex: none;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  background: #fff;
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 4px 10px;
}

/* ---- home: all-done note ------------------------------------------- */

.alldone {
  margin-top: 18px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--done-soft);
  border: 1px solid #CFE1CB;
  color: var(--done);
  font-weight: 700;
  text-align: center;
}
.alldone[hidden] { display: none; }

/* ---- back link + placeholder screens ------------------------------- */

.topback {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: none;
  padding: 10px 0;
  color: var(--ink-soft);
  font-size: 15px;
  font-weight: 700;
}
.chevron { width: 22px; height: 22px; display: block; flex: none; }
html[dir="ltr"] .chevron { transform: scaleX(-1); }
.chevron--flip { transform: scaleX(-1); }
html[dir="ltr"] .chevron--flip { transform: none; }

.soon { margin-top: 12px; }
.soon h2 { font-size: 22px; font-weight: 700; }
.soon p { margin-top: 8px; color: var(--ink-soft); }

/* ---- lesson screen ---------------------------------------------- */

.lesson-head { padding-top: 6px; }
.kicker { font-size: 15px; font-weight: 700; color: var(--accent); }
#lesson-title { margin-top: 5px; font-size: 25px; font-weight: 700; line-height: 1.4; }

.lesson-content { margin-top: 16px; }
#lesson-intro { font-size: 18px; line-height: 1.85; }

.lesson-steps {
  list-style: none;
  margin: 20px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.lesson-steps li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  font-size: 17px;
  line-height: 1.7;
}
.lesson-steps .n {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--accent-tint);
  color: var(--accent);
  font-weight: 700;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.readaloud {
  width: 100%;
  min-height: 52px;
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
}
.readaloud[hidden] { display: none; }
.readaloud .icon { width: 24px; height: 24px; display: block; }
.readaloud[aria-pressed="true"] {
  background: var(--accent-tint);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.actions {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.actions[hidden] { display: none; }

#lesson-done .btn__icon { display: none; }
#lesson-done.btn--check .btn__icon { display: block; }

.nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.nav__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: none;
  padding: 10px 0;
  color: var(--ink-soft);
  font-size: 15px;
  font-weight: 700;
}
.nav__link.is-disabled { opacity: 0.3; pointer-events: none; }

/* ---- footer button --------------------------------------------------- */

.footer {
  padding: 16px 20px 20px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
  background: var(--bg);
  border-top: 1px solid var(--border);
}
.footer[hidden] { display: none; }

.btn {
  width: 100%;
  min-height: var(--tap);
  border: 0;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
}
.btn--primary { background: var(--accent); color: #fff; }
.btn--secondary {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--border);
}
.btn__icon { width: 24px; height: 24px; display: block; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
