/* عتید — بنیادی انداز: ری سیٹ، ٹائپوگرافی، لے آؤٹ شیل (موبائل پہلے) */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs);
  line-height: var(--lh);
  min-height: 100vh;
  padding-bottom: calc(72px + env(safe-area-inset-bottom)); /* نچلی نیویگیشن بار کے لیے */
}

h1, h2, h3 { margin: 0; line-height: 1.5; }
h1 { font-size: var(--fs-xl); }
h2 { font-size: var(--fs-lg); }
h3 { font-size: var(--fs); color: var(--text-muted); font-weight: 600; }
p { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }

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

.skip {
  position: absolute;
  inset-inline-start: var(--space-3);
  top: -100px;
  background: var(--accent);
  color: var(--accent-text);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  z-index: 100;
}
.skip:focus { top: var(--space-3); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* --- شیل ------------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  padding-top: calc(var(--space-3) + env(safe-area-inset-top));
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar .brand { font-size: var(--fs-lg); font-weight: 700; }
.topbar .spacer { flex: 1; }

.nav {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: space-around;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav a {
  position: relative;
  flex: 1; min-height: 60px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--text-muted); text-decoration: none; font-size: var(--fs-sm);
}
.nav a[aria-current="page"] { color: var(--accent); font-weight: 700; }
.nav .badge-count {
  position: absolute; top: 6px; inset-inline-start: 50%;
  min-width: 20px; height: 20px; padding: 0 6px; line-height: 20px;
  border-radius: 999px; background: var(--danger); color: var(--on-strong); font-size: 12px; text-align: center;
}

main {
  max-width: 880px;
  margin: 0 auto;
  padding: var(--space-4);
  display: flex; flex-direction: column; gap: var(--space-4);
}

.page-title { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.page-title .spacer { flex: 1; }

/* بڑی اسکرین: نیویگیشن اوپر کی طرف، نچلی بار نہیں */
@media (min-width: 768px) {
  body { padding-bottom: 0; }
  .nav {
    position: static; inset: auto; background: transparent; border: 0; padding: 0;
    justify-content: flex-start; gap: var(--space-2); order: 2;
  }
  .nav a {
    flex: 0 0 auto; min-height: var(--tap); flex-direction: row; gap: var(--space-2);
    padding: 0 var(--space-4); border-radius: var(--radius-sm);
  }
  .nav a[aria-current="page"] { background: var(--surface-2); }
  .nav .badge-count { position: static; margin-inline-start: var(--space-1); }
  .topbar { gap: var(--space-5); }
}

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