/* base.css — اکانتینو reset, typography and layout utilities (v2) */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 3.5rem);
}

body {
  margin: 0;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--step-body);
  line-height: var(--leading-body);
  direction: rtl;
  text-align: start;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

main { flex: 1 0 auto; display: flex; flex-direction: column; }
main > * { flex-shrink: 0; }

h1, h2, h3, h4, h5, h6, p, figure, blockquote, ul, ol, dl, dd { margin: 0; }
ul[class], ol[class] { padding: 0; list-style: none; }
img, video, svg, canvas { display: block; max-width: 100%; }
img, video { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: 0; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
strong, b { font-weight: 700; }
small { font-size: var(--step-small); }
hr { border: 0; border-block-start: 1px solid var(--border); margin-block: 1.5rem; }
[x-cloak] { display: none !important; }

::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------- Headings: one size per level, everywhere ---------- */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: var(--leading-head);
  color: var(--ink);
  text-wrap: balance;
}
h1 { font-size: var(--step-title); font-weight: 800; }
h2 { font-size: var(--step-head); }
h3 { font-size: var(--step-h3); }
h4, h5, h6 { font-size: var(--step-lead); }

p { max-width: 70ch; text-wrap: pretty; }
p + p { margin-block-start: 0.875rem; }

/* Type helpers (kept for existing markup) */
.step-display { font-size: var(--step-display); line-height: var(--leading-tight); font-weight: 800; }
.step-title   { font-size: var(--step-title); line-height: var(--leading-head); font-weight: 800; }
.step-head    { font-size: var(--step-head); line-height: var(--leading-head); font-weight: 700; }
.step-lead    { font-size: var(--step-lead); line-height: var(--leading-lead); }
.step-body    { font-size: var(--step-body); line-height: var(--leading-body); }
.step-small, .small { font-size: var(--step-small); line-height: 1.7; }
.muted { color: var(--muted); }
.nums  { font-variant-numeric: tabular-nums; }
.fw-bold { font-weight: 700; }
.text-center { text-align: center; }
.user-select-all { user-select: all; }

/* LTR islands (DESIGN.md §3) */
[dir="ltr"], bdi.ltr, .ltr-island {
  direction: ltr;
  unicode-bidi: isolate;
  font-variant-numeric: tabular-nums;
}
input[dir="ltr"], textarea[dir="ltr"] { text-align: left; }

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--margin);
}
.container-narrow { max-width: calc(var(--container-narrow) + 2 * var(--margin)); }

.section { padding-block: var(--section-y); }
.section-tight { padding-block: calc(var(--section-y) * 0.6); }
.section-muted { background: var(--surface); }

/* Section heading row: title (+ optional lead) on the start side, action on the end side */
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  margin-block-end: 1.5rem;
}
.section-head p { color: var(--muted); margin-block-start: 0.25rem; font-size: var(--step-body); }

.stack   { display: flex; flex-direction: column; gap: var(--stack); }
.stack-sm { display: flex; flex-direction: column; gap: 0.5rem; }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }

.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gutter); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gutter); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gutter); }
@media (max-width: 900px) { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .grid > * { grid-column: 1 / -1 !important; }
}

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
.d-none-mobile { display: block; }
.d-only-mobile { display: none; }
@media (max-width: 860px) {
  .d-none-mobile { display: none !important; }
  .d-only-mobile { display: block; }
}

/* Motion: one quiet entrance for page content, respects reduced motion */
@media (prefers-reduced-motion: no-preference) {
  .motion-item { animation: ac-enter var(--t-ui) var(--ease-out) both; }
  @keyframes ac-enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* Spacing utilities (small set; prefer component spacing) */
.mt-0 { margin-block-start: 0 !important; } .mb-0 { margin-block-end: 0 !important; }
.mt-1 { margin-block-start: 0.5rem; }  .mb-1 { margin-block-end: 0.5rem; }
.mt-2 { margin-block-start: 1rem; }    .mb-2 { margin-block-end: 1rem; }
.mt-3 { margin-block-start: 1.5rem; }  .mb-3 { margin-block-end: 1.5rem; }
.d-block { display: block; }
