@font-face {
  font-family: "Vazirmatn";
  src: url("/fonts/Vazirmatn-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

/* ---------- Material 3: توکن‌ها ----------
   پالت تونال سبز-دریایی (رنگ برند) با نقش‌های رنگی Material 3.
   شکل‌ها، سایه‌ها و دکمه‌ها مطابق راهنمای Material 3 هستند. */
:root {
  --primary: #006b5c;
  --primary-hover: #005146;
  --on-primary: #ffffff;
  --primary-container: #8cf5dd;
  --on-primary-container: #00201a;

  --surface: #f5fbf8;
  --surface-container-low: #eff5f2;
  --surface-container: #e9f0ec;
  --surface-container-high: #e3eae6;
  --surface-container-highest: #dee5e1;
  --on-surface: #171d1b;
  --on-surface-variant: #3f4945;
  --outline: #6f7974;
  --outline-variant: #bec9c4;

  --shape-m: 12px;
  --shape-l: 16px;
  --shape-xl: 28px;
  --shape-full: 999px;

  --elev-1: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 3px 1px rgba(0, 0, 0, 0.15);
  --elev-2: 0 1px 2px rgba(0, 0, 0, 0.3), 0 2px 6px 2px rgba(0, 0, 0, 0.15);

  --motion: cubic-bezier(0.2, 0, 0, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; color-scheme: light; }

body {
  margin: 0;
  overflow-x: clip;
  background: var(--surface);
  color: var(--on-surface);
  font-family: Vazirmatn, Roboto, Tahoma, "Segoe UI", sans-serif;
  font-size: 1rem;
  line-height: 1.95;
}

/* ---------- قاب صفحه ---------- */
main, .breadcrumb {
  max-width: 960px;
  margin: 0 auto;
  padding-inline: 1.25rem;
}
main p {
  max-width: 66ch;
  margin-inline: auto;
}

/* ---------- Top app bar ---------- */
header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.6rem max(1rem, calc(50% - 480px));
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--on-surface);
  text-decoration: none;
}
.brand::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 3px var(--surface), 0 0 0 4.5px var(--primary);
}
header ul, footer ul, .breadcrumb ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}
header a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0.4rem 0.9rem;
  border-radius: var(--shape-full);
  color: var(--on-surface-variant);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.2s var(--motion);
}
header a:hover {
  background: rgba(0, 107, 92, 0.1);
  color: var(--on-surface);
}

/* ---------- مسیر صفحه ---------- */
.breadcrumb {
  padding-block: 1rem 0;
  font-size: 0.875rem;
  color: var(--on-surface-variant);
  text-align: start;
}
.breadcrumb ol li + li::before {
  content: "‹";
  margin-inline: 0.4rem;
}

/* ---------- لینک، فوکوس، لینک پرش ---------- */
a { color: var(--primary); }
a:hover { text-decoration: underline; }
a:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
  border-radius: 4px;
}
.skip-link {
  position: absolute;
  inset-inline-start: 1rem;
  top: -4rem;
  z-index: 20;
  background: var(--on-surface);
  color: var(--surface);
  padding: 0.6rem 1rem;
  border-radius: var(--shape-full);
}
.skip-link:focus { top: 1rem; }

/* ---------- تیتر و متن (Material type scale) ---------- */
h1 {
  margin: 0 auto 1.25rem;
  max-width: 20ch;
  font-size: clamp(2.1rem, 1.5rem + 2.2vw, 2.8rem);
  line-height: 1.2;
  font-weight: 700;
}
h2 {
  margin: 0 0 1rem;
  font-size: clamp(1.5rem, 1.3rem + 0.6vw, 1.75rem);
  line-height: 1.3;
  font-weight: 700;
}
h3 {
  margin: 2rem 0 0.5rem;
  font-size: 1.25rem;
  line-height: 1.4;
  font-weight: 600;
}

/* ---------- هیرو: کانتینر بزرگ با گوشه‌های گرد ---------- */
main > section:first-of-type {
  position: relative;
  overflow: hidden;
  margin-top: 1.5rem;
  padding: 5rem 2.5rem 4.5rem;
  border-top: 0;
  border-radius: var(--shape-xl);
  background: var(--primary-container);
  color: var(--on-primary-container);
}
main > section:first-of-type h1 {
  color: var(--on-primary-container);
  font-size: clamp(2.2rem, 1.4rem + 2.6vw, 3.2rem);
  font-weight: 700;
}
main > section:first-of-type p.lead {
  max-width: 56ch;
  margin-inline: auto;
  font-size: 1.125rem;
  color: var(--on-primary-container);
  opacity: 0.9;
}
main > section:first-of-type :focus-visible {
  outline-color: var(--on-primary-container);
}

/* ---------- بخش‌ها: همه‌چیز وسط‌چین ---------- */
main > section,
main > aside {
  padding: 4.5rem 0;
  border-top: 1px solid var(--outline-variant);
  text-align: center;
}
main > section:first-of-type { border-top: 0; }

/* ---------- فهرست‌ها: کارت‌های فهرست Material ---------- */
main ul,
main ol {
  list-style: none;
  padding: 0;
  margin: 2rem auto 0;
  max-width: 720px;
  display: grid;
  gap: 0.9rem;
}
main ul li,
main ol > li {
  padding: 1.1rem 1.5rem;
  background: var(--surface-container-low);
  border-radius: var(--shape-l);
}

/* مراحل واقعی (ترتیبی) با شماره‌ی شناور روی کارت */
main ol {
  counter-reset: step;
  gap: 1.75rem;
  margin-top: 2.5rem;
}
main ol > li {
  counter-increment: step;
  position: relative;
  padding-top: 2rem;
  box-shadow: var(--elev-1);
}
main ol > li::before {
  content: counter(step);
  position: absolute;
  top: -0.9rem;
  left: 50%;
  transform: translateX(-50%);
  width: 1.9rem;
  height: 1.9rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--primary);
  color: var(--on-primary);
  font-size: 0.9rem;
  font-weight: 700;
}

/* فهرست اشتباهات غیرترتیبی است: بدون شماره */
section[aria-labelledby="causes-heading"] ol > li {
  padding-top: 0.9rem;
  box-shadow: none;
}
section[aria-labelledby="causes-heading"] ol > li::before { display: none; }

/* ---------- ویژگی‌ها: کارت‌های سطح‌دار با آیکون ---------- */
#features ul {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  max-width: none;
  margin-top: 2.5rem;
  gap: 1.25rem;
}
#features ul li {
  padding: 2.25rem 1.5rem 2rem;
  box-shadow: var(--elev-1);
}
#features ul li::before {
  content: "";
  position: static;
  display: block;
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  background: var(--icon) center / 28px no-repeat, var(--primary-container);
}
#features ul li:nth-child(1) {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40' fill='none' stroke='%23006b5c' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='7' cy='30' r='4'/%3E%3Ccircle cx='33' cy='10' r='4'/%3E%3Cpath d='M11 29 L17 22 H23 L29 12'/%3E%3C/svg%3E");
}
#features ul li:nth-child(2) {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40' fill='none' stroke='%23006b5c' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M2 22 C6 12 10 32 14 22 S22 12 26 22 S34 32 38 22'/%3E%3C/svg%3E");
}
#features ul li:nth-child(3) {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40' fill='none' stroke='%23006b5c' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='8' width='22' height='16' rx='2'/%3E%3Crect x='28' y='16' width='8' height='16' rx='1.5'/%3E%3Cpath d='M12 30 H18'/%3E%3C/svg%3E");
}
#features ul li:nth-child(4) {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40' fill='none' stroke='%23006b5c' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='20' cy='20' r='15'/%3E%3Cpath d='M13 20.5 L18 25 L27 15'/%3E%3C/svg%3E");
}
#features ul li:nth-child(5) {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40' fill='none' stroke='%23006b5c' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 28 A14 14 0 1 1 34 28'/%3E%3Cpath d='M20 28 L28 16'/%3E%3Ccircle cx='20' cy='28' r='2'/%3E%3C/svg%3E");
}

/* ---------- نمودار مسیر (هیرو) ---------- */
.route {
  margin: 3.5rem auto 0;
}
.route svg {
  display: block;
  width: 100%;
  height: auto;
  transform: scaleX(-1);
  overflow: visible;
}
.route-bg path {
  fill: none;
  stroke: rgba(0, 32, 26, 0.08);
  stroke-width: 2;
}
.route-default {
  fill: none;
  stroke: rgba(0, 32, 26, 0.55);
  stroke-width: 2;
  stroke-dasharray: 5 7;
}
.route-lf {
  fill: none;
  stroke: var(--primary);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: draw-route 1.4s 0.2s var(--motion) both;
}
@keyframes draw-route {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}
.hops circle {
  fill: var(--primary-container);
  stroke: rgba(0, 32, 26, 0.6);
  stroke-width: 2;
}
.stop {
  fill: var(--primary-container);
  stroke: var(--primary);
  stroke-width: 3;
}
.end-you { fill: var(--on-primary-container); }
.end-server {
  fill: var(--primary);
  stroke: var(--primary-container);
  stroke-width: 3;
}
.route-ends {
  display: flex;
  justify-content: space-between;
  max-width: none;
  margin: 0.5rem 0 0;
  color: var(--on-primary-container);
  font-size: 0.875rem;
  font-weight: 600;
}
.route figcaption {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.5rem 1.5rem;
  margin-top: 1rem;
  font-size: 0.875rem;
  color: var(--on-primary-container);
  opacity: 0.85;
}
.key {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
.key::before {
  content: "";
  width: 28px;
  border-top: 2px dashed currentColor;
}
.key-lf::before {
  border-top: 5px solid var(--primary);
  border-radius: 2px;
}

/* ---------- نمودار نوسان (Jitter) ---------- */
.wave {
  margin: 3rem auto 0;
}
.wave svg {
  display: block;
  width: 100%;
  height: auto;
  background: var(--surface-container-high);
  border-radius: var(--shape-l);
}
.wave-before {
  fill: none;
  stroke: var(--outline);
  stroke-width: 2.5;
  stroke-linejoin: round;
}
.wave-after {
  fill: none;
  stroke: var(--primary);
  stroke-width: 4;
  stroke-linecap: round;
}
.wave figcaption {
  margin-top: 0.8rem;
  font-size: 0.875rem;
  color: var(--on-surface-variant);
}

/* ---------- دکمه‌ها: Material filled و outlined ---------- */
.btns {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin: 2.5rem 0 0;
}
a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.6rem 1.6rem;
  border-radius: var(--shape-full);
  background: var(--primary);
  color: var(--on-primary);
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.2s var(--motion), box-shadow 0.2s var(--motion);
}
a.btn:hover {
  background: var(--primary-hover);
  color: var(--on-primary);
  box-shadow: var(--elev-1);
  text-decoration: none;
}
a.btn + a.btn {
  background: transparent;
  color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--outline);
}
a.btn + a.btn:hover {
  background: rgba(0, 107, 92, 0.08);
  color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--outline);
}
main > section:first-of-type a.btn + a.btn {
  color: var(--on-primary-container);
  box-shadow: inset 0 0 0 1px rgba(0, 32, 26, 0.45);
}
main > section:first-of-type a.btn + a.btn:hover {
  background: rgba(0, 32, 26, 0.08);
  color: var(--on-primary-container);
  box-shadow: inset 0 0 0 1px rgba(0, 32, 26, 0.45);
}

/* ---------- جدول داده Material ---------- */
.table-wrap {
  margin: 2.5rem auto 0;
  max-width: 100%;
  overflow-x: auto;
  background: var(--surface-container-low);
  border-radius: var(--shape-l);
  box-shadow: var(--elev-1);
}
table {
  width: 100%;
  min-width: 520px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.9375rem;
  text-align: center;
}
caption {
  caption-side: top;
  padding: 1rem;
  font-weight: 600;
  color: var(--on-surface);
  text-align: center;
}
th, td {
  padding: 1.1rem 1.25rem;
  text-align: center;
  vertical-align: middle;
  border-bottom: 1px solid var(--outline-variant);
}
th {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--on-surface-variant);
}
section[aria-labelledby="comparison-heading"] td:nth-child(2),
section[aria-labelledby="comparison-heading"] th:nth-child(2) {
  background: rgba(140, 245, 221, 0.45);
  color: var(--on-primary-container);
  font-weight: 600;
}

/* ---------- نویسنده ---------- */
section[aria-labelledby="author-heading"] p {
  font-size: 0.9375rem;
  color: var(--on-surface-variant);
}

/* ---------- دعوت به اقدام: کانتینر بزرگ رنگ برند ---------- */
section[aria-labelledby="cta-heading"] {
  position: relative;
  overflow: hidden;
  margin: 4rem 0;
  padding: 4.5rem 2.5rem;
  border: 0;
  border-radius: var(--shape-xl);
  background: var(--primary);
  color: var(--on-primary);
}
section[aria-labelledby="cta-heading"] h2 { color: var(--on-primary); }
section[aria-labelledby="cta-heading"] p {
  color: var(--on-primary);
  opacity: 0.92;
}
section[aria-labelledby="cta-heading"] a { color: var(--on-primary); }
section[aria-labelledby="cta-heading"] :focus-visible { outline-color: var(--on-primary); }
section[aria-labelledby="cta-heading"] a.btn {
  background: #ffffff;
  color: var(--primary);
}
section[aria-labelledby="cta-heading"] a.btn:hover {
  background: var(--primary-container);
  color: var(--on-primary-container);
}
section[aria-labelledby="cta-heading"] a.btn + a.btn {
  background: transparent;
  color: var(--on-primary);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7);
}
section[aria-labelledby="cta-heading"] a.btn + a.btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--on-primary);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7);
}

/* ---------- مطالب مرتبط ---------- */
main > aside h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--on-surface-variant);
}
main > aside ul {
  margin-top: 0.75rem;
}

/* ---------- پاورقی: بخش سطح پایین‌تر ---------- */
footer {
  margin-top: 2rem;
  padding: 2.5rem max(1.25rem, calc(50% - 480px)) 2.25rem;
  background: var(--surface-container);
  color: var(--on-surface-variant);
  font-size: 0.875rem;
  text-align: center;
  border-radius: var(--shape-xl) var(--shape-xl) 0 0;
}
footer ul {
  justify-content: center;
  margin-top: 0.75rem;
}
footer a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0.3rem 0.8rem;
  border-radius: var(--shape-full);
  color: var(--on-surface);
  text-decoration: none;
  font-weight: 500;
  transition: background-color 0.2s var(--motion);
}
footer a:hover {
  background: rgba(0, 107, 92, 0.1);
  color: var(--on-surface);
}

/* ---------- حرکت و دسترس‌پذیری ---------- */
@media (prefers-reduced-motion: reduce) {
  .route-lf { animation: none; }
  * { transition: none !important; }
}

@media (max-width: 640px) {
  body { font-size: 0.975rem; }
  main > section:first-of-type {
    padding: 3rem 1.25rem 2.75rem;
    border-radius: var(--shape-l);
  }
  main > section,
  main > aside { padding-block: 3rem; }
  section[aria-labelledby="cta-heading"] {
    padding: 2.5rem 1.5rem;
    border-radius: var(--shape-l);
  }
  .route-ends { font-size: 0.75rem; }
}
