:root {
  color-scheme: light dark;
  --page: #f7f5ef;
  --surface: #fffefa;
  --surface-soft: #eeeee7;
  --ink: #202a26;
  --muted: #4d5b55;
  --green: #2f7d6d;
  --green-deep: #245f53;
  --button-ink: #ffffff;
  --line: #d7ddd5;
  --callout: #e8f0eb;
  --shadow: 0 14px 36px rgb(28 47 39 / 6%);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #171b19;
    --surface: #202724;
    --surface-soft: #282f2b;
    --ink: #f0f3ef;
    --muted: #c0cbc4;
    --green: #5fb8a5;
    --green-deep: #8bd1c0;
    --button-ink: #15231f;
    --line: #3c4741;
    --callout: #263a33;
    --shadow: 0 16px 36px rgb(0 0 0 / 16%);
  }
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.65;
}
img { display: block; max-width: 100%; }
a { color: var(--green-deep); text-decoration-thickness: 0.08em; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 0.13em; }
a:focus-visible, button:focus-visible, [tabindex="0"]:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 4px;
  border-radius: 4px;
}
.shell { width: min(100% - 2rem, 72rem); margin-inline: auto; }
.skip-link {
  position: absolute;
  z-index: 5;
  top: 0.5rem;
  left: 0.5rem;
  min-height: 44px;
  padding: 0.65rem 0.9rem;
  transform: translateY(-160%);
  background: var(--surface);
  color: var(--ink);
  border: 2px solid var(--green);
  border-radius: 0.6rem;
}
.skip-link:focus { transform: translateY(0); }

.site-header { border-bottom: 1px solid var(--line); }
.header-inner {
  min-height: 4.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.site-wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--ink);
  font-size: 1.2rem;
  font-weight: 750;
  letter-spacing: -0.045em;
  text-decoration: none;
  min-height: 44px;
}
.site-wordmark span {
  color: var(--green);
  font-size: 0.98rem;
  font-weight: 500;
  letter-spacing: 0;
}
.primary-nav, .footer-links { display: flex; align-items: center; gap: clamp(0.75rem, 3vw, 2rem); }
.primary-nav a, .footer-links a { min-height: 44px; display: inline-flex; align-items: center; font-weight: 600; }
.primary-nav a { color: var(--muted); text-decoration: none; }
.primary-nav a:hover, .footer-links a:hover { color: var(--green-deep); text-decoration: underline; }
.main-content { padding-block: clamp(2rem, 5vw, 4.5rem) clamp(4rem, 8vw, 7rem); }
.app-crumb {
  width: min(100% - 2rem, 72rem);
  margin: 0.7rem auto 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  color: var(--muted);
  font-size: 0.92rem;
}
.app-crumb a { min-height: 44px; display: inline-flex; align-items: center; }
.app-crumb a[aria-current="page"] { color: var(--ink); text-decoration: none; font-weight: 700; }

.home-hero {
  position: relative;
  overflow: hidden;
  padding: clamp(2rem, 6vw, 5.5rem) clamp(1.4rem, 7vw, 6.5rem);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 1.75rem;
  box-shadow: var(--shadow);
}
.hero-wordmark { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0.7rem; color: var(--green); font-size: clamp(1.35rem, 3vw, 1.8rem); font-weight: 750; letter-spacing: -0.05em; }
.hero-wordmark .persian { font-size: 1.15em; font-weight: 500; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { color: var(--ink); line-height: 1.16; letter-spacing: -0.035em; }
.home-hero h1 { max-width: 13ch; margin: 0.85rem 0 1rem; font-size: clamp(2.5rem, 7vw, 5.6rem); }
.hero-copy { max-width: 58ch; color: var(--muted); font-size: clamp(1.05rem, 1.5vw, 1.2rem); line-height: 1.75; }
.hero-copy p:last-child { margin-bottom: 0; }
.hero-copy em { color: var(--ink); font-style: normal; font-weight: 650; }
.section-block { margin-top: clamp(4rem, 9vw, 7.5rem); }
.section-heading { margin-bottom: 1.5rem; }
.section-heading h2 { margin-bottom: 0; font-size: clamp(2rem, 4vw, 3.15rem); }
.eyebrow { margin-bottom: 0.35rem; color: var(--green-deep); font-size: 0.78rem; font-weight: 750; letter-spacing: 0.1em; text-transform: uppercase; }
.app-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.app-card { min-width: 0; display: flex; flex-direction: column; overflow: hidden; padding: 1.25rem; background: var(--surface); border: 1px solid var(--line); border-radius: 1.25rem; box-shadow: var(--shadow); }
.app-card-main { min-width: 0; flex: 1; display: grid; grid-template-columns: 3.5rem minmax(0, 1fr) auto; align-items: start; gap: 0.9rem; color: var(--ink); text-decoration: none; border-radius: 0.5rem; }
.app-card-main img { width: 3.5rem; height: auto; aspect-ratio: 1; object-fit: cover; border-radius: 22.5%; }
.app-card-copy { min-width: 0; display: flex; flex-direction: column; }
.app-card-title { font-size: 1.12rem; font-weight: 750; line-height: 1.3; }
.app-kind { margin-top: 0.16rem; color: var(--green-deep); font-size: 0.88rem; font-weight: 650; }
.app-summary { margin-top: 0.65rem; color: var(--muted); font-size: 0.94rem; line-height: 1.55; }
.card-arrow { color: var(--green); font-size: 1.1rem; }
.app-card-main:hover .app-card-title { text-decoration: underline; text-decoration-thickness: 0.08em; text-underline-offset: 0.15em; }
.app-card-links { display: flex; gap: 1.2rem; margin: 1.1rem 0 0 4.4rem; padding-top: 0.8rem; border-top: 1px solid var(--line); }
.app-card-links a { min-height: 44px; display: inline-flex; align-items: center; font-size: 0.9rem; font-weight: 650; }
.promise-section { padding: clamp(1.5rem, 4vw, 3rem); border: 1px solid var(--line); border-radius: 1.5rem; background: var(--surface-soft); }
.promise-section .section-heading { margin-bottom: 1.4rem; }
.promise-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.8rem; }
.promise-card { min-width: 0; padding: 1.2rem; background: var(--surface); border: 1px solid var(--line); border-radius: 1rem; }
.promise-card h3 { margin-bottom: 0.6rem; font-size: 1.05rem; }
.promise-card p { margin-bottom: 0; color: var(--muted); font-size: 0.94rem; line-height: 1.6; }

.app-hero { display: grid; grid-template-columns: clamp(6rem, 16vw, 10rem) minmax(0, 1fr); align-items: center; gap: clamp(1.2rem, 4vw, 3rem); padding-bottom: clamp(2rem, 5vw, 4rem); border-bottom: 1px solid var(--line); }
.app-icon { width: 100%; height: auto; aspect-ratio: 1; border-radius: 22.5%; box-shadow: var(--shadow); }
.app-hero-copy { min-width: 0; }
.app-hero h1 { margin: 0 0 0.55rem; font-size: clamp(2rem, 5vw, 4rem); overflow-wrap: anywhere; }
.app-hero .eyebrow { margin-bottom: 0.4rem; }
.app-hero-summary { max-width: 52ch; margin-bottom: 1.2rem; color: var(--muted); font-size: 1.08rem; }
.app-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.9rem 1.2rem; }
.store-button { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; padding: 0.65rem 1rem; border: 1px solid var(--green); border-radius: 0.75rem; font-weight: 700; }
.store-button { background: var(--green); color: var(--button-ink); text-decoration: none; }
.store-button:hover { background: var(--green-deep); }
.store-status { display: inline-flex; align-items: center; gap: 0.45rem; color: var(--muted); font-size: 0.92rem; font-weight: 600; }
.quick-links { display: flex; flex-wrap: wrap; gap: 0 1rem; }
.quick-links a { min-height: 44px; display: inline-flex; align-items: center; font-weight: 650; }
.app-prose { margin-top: clamp(2rem, 5vw, 4rem); }

.document-heading, .toc, .document-prose { width: 100%; max-width: 70ch; margin-inline: auto; }
.document-heading { margin-bottom: 1.5rem; }
.document-heading.support-heading { margin-bottom: 2.5rem; }
.document-heading h1, .page-prose h1 { margin-bottom: 0.6rem; font-size: clamp(2.1rem, 5vw, 3.5rem); overflow-wrap: anywhere; }
.updated { margin-bottom: 0; color: var(--muted); font-size: 0.96rem; }
.toc { margin-bottom: 2rem; padding: 1.2rem 1.4rem; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 1rem; }
.toc-title { margin: 0 0 0.35rem; color: var(--ink); font-weight: 750; }
.toc ol { margin: 0; padding-left: 1.3rem; columns: 2; column-gap: 2rem; }
.toc li { break-inside: avoid; padding: 0.08rem 0; }
.toc a { display: inline-block; padding: 0.12rem 0; }
.prose { max-width: 70ch; margin-inline: auto; color: var(--ink); font-size: 1rem; line-height: 1.8; overflow-wrap: anywhere; }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose h2 { margin: 2.25em 0 0.65em; font-size: clamp(1.45rem, 3vw, 1.9rem); }
.prose h3 { margin: 1.8em 0 0.45em; font-size: clamp(1.12rem, 2.5vw, 1.35rem); }
.prose p, .prose ul, .prose ol { margin-bottom: 1.1em; }
.prose ul, .prose ol { padding-left: 1.45em; }
.prose li { padding-left: 0.18em; margin: 0.25em 0; }
.prose li > ul, .prose li > ol { margin-top: 0.25em; margin-bottom: 0.4em; }
.prose strong { font-weight: 750; }
.prose code { padding: 0.08em 0.3em; background: var(--surface-soft); border-radius: 0.28rem; font-size: 0.92em; }
.prose .callout { margin: 1.5rem 0; padding: 1.15rem 1.3rem; background: var(--callout); border-left: 4px solid var(--green); border-radius: 0.25rem 0.85rem 0.85rem 0.25rem; }
.prose .callout p { margin: 0; }
.support-question { margin-top: 1.45em !important; padding-top: 1.05em; border-top: 1px solid var(--line); }
.table-scroll { max-width: 100%; margin: 1.4rem 0; overflow-x: auto; overscroll-behavior-inline: contain; border: 1px solid var(--line); border-radius: 0.75rem; background: var(--surface); }
.table-scroll table { width: 100%; min-width: 34rem; border-collapse: collapse; line-height: 1.45; }
.table-scroll th, .table-scroll td { padding: 0.75rem 0.85rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.table-scroll th { color: var(--ink); background: var(--surface-soft); font-size: 0.92rem; }
.table-scroll td { color: var(--muted); }
.table-scroll tr:last-child td { border-bottom: 0; }
.page-prose { padding: clamp(1.3rem, 4vw, 2.5rem); background: var(--surface); border: 1px solid var(--line); border-radius: 1.25rem; box-shadow: var(--shadow); }
.page-prose h1 { margin-bottom: 1.2rem; }

.site-footer { border-top: 1px solid var(--line); background: var(--surface-soft); }
.footer-inner { padding-block: 1.8rem 2.2rem; }
.footer-links { flex-wrap: wrap; gap: 0.25rem 1.5rem; }
.contact-line, .publisher-line { margin: 0.55rem 0 0; color: var(--muted); font-size: 0.92rem; }
.publisher-line a { font-weight: 650; }

@media (max-width: 760px) {
  .shell { width: min(100% - 1.5rem, 72rem); }
  .header-inner { min-height: 4.25rem; }
  .site-wordmark { gap: 0.35rem; font-size: 1.05rem; }
  .site-wordmark span { font-size: 0.88rem; }
  .primary-nav { gap: clamp(0.45rem, 2.8vw, 1rem); }
  .primary-nav a { font-size: 0.9rem; }
  .app-crumb { width: min(100% - 1.5rem, 72rem); }
  .app-grid { grid-template-columns: 1fr; }
  .promise-grid { grid-template-columns: 1fr; }
  .promise-card { padding: 1rem 1.1rem; }
  .app-hero { grid-template-columns: 5.5rem minmax(0, 1fr); gap: 1rem; }
  .toc ol { columns: 1; }
}
@media (max-width: 600px) {
  .app-hero { grid-template-columns: 1fr; align-items: start; gap: 1rem; }
  .app-icon { width: 5.5rem; }
}
@media (max-width: 390px) {
  .shell, .app-crumb { width: calc(100% - 1.25rem); }
  .header-inner { gap: 0.4rem; }
  .site-wordmark { gap: 0.25rem; font-size: 1rem; }
  .site-wordmark span { font-size: 0.82rem; }
  .primary-nav { gap: 0.4rem; }
  .primary-nav a { font-size: 0.84rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
@media print {
  :root { color-scheme: light; --page: #fff; --surface: #fff; --surface-soft: #fff; --ink: #000; --muted: #222; --line: #aaa; --callout: #fff; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .site-header, .site-footer, .skip-link, .app-crumb, .toc { display: none !important; }
  .shell { width: auto; max-width: none; margin: 0; }
  .main-content { padding: 0; }
  .document-heading, .prose { max-width: 68ch; }
  .prose a { color: #000; }
  .prose .callout, .table-scroll, .page-prose { box-shadow: none; background: #fff; }
  .table-scroll { overflow: visible; }
  .table-scroll table { min-width: 0; }
  a { color: #000; }
}
