/*
 * Sanadat marketing site: one stylesheet, no build step, no external requests.
 * - Mobile first. Layout uses logical properties (inline/block, start/end) so the same rules serve
 *   Arabic (dir="rtl") and English (dir="ltr"). Physical properties appear only where a shape is drawn.
 * - The look is the app's (web/src/styles/base/tokens.css): brand blue, the same ink and lines, small
 *   corners (cards 6px, buttons 2px), Plus Jakarta Sans for Latin and Cairo for Arabic.
 * - Colours are custom properties on :root; the dark theme redefines them under prefers-color-scheme.
 * - The home page is deliberately short: on a laptop everything fits on one screen.
 * - Contrast: body text, muted text, brand text and button labels are all at least 4.5:1 in both themes.
 */

/* ---------- Fonts (SIL OFL, see assets/fonts/OFL.txt) ----------
   Both are variable fonts (one file serves every weight), copied from web/src/styles/fonts. The stack
   resolves per glyph, as in the app: Latin text and digits use Plus Jakarta Sans, Arabic uses Cairo.
   unicode-range keeps each file to the pages that show that script (an English page fetches Cairo
   only for its "العربية" link). */
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("/assets/fonts/PlusJakartaSans-Latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Cairo";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("/assets/fonts/Cairo-Arabic.woff2") format("woff2");
  ascent-override: 100%;
  descent-override: 30%;
  line-gap-override: 0%;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}

/* ---------- Tokens (the app's, light theme) ---------- */
:root {
  color-scheme: light dark;

  --bg: #F5F8FF;
  --bg-alt: #EDF3FF;
  --surface: #FFFFFF;
  --ink: #062A74;
  --muted: #586379;
  --line: #CDD9EE;
  --line-soft: #E2E9F5;

  --brand: #034BE4;
  --brand-strong: #0639A5;
  --brand-tint: rgba(3, 75, 228, 0.12);
  --on-brand: #FFFFFF;

  --mint: #087A58;
  --mint-tint: rgba(61, 210, 157, 0.18);

  --qr-ink: #062A74;
  --focus: #034BE4;

  --warn-bg: rgba(255, 151, 5, 0.22);
  --warn-ink: #7A3600;
  --warn-line: #AD4C00;
  --todo-bg: #fde68a;
  --todo-ink: #422006;

  --radius-card: 6px;
  --radius: 4px;
  --radius-btn: 2px;

  --font: "Plus Jakarta Sans", "Cairo", "Helvetica Neue", system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111318;
    --bg-alt: #0C0E12;
    --surface: #191C22;
    --ink: #F5F7FA;
    --muted: #B9C0CB;
    --line: #373E49;
    --line-soft: #292F38;

    --brand: #6EA3FF;
    --brand-strong: #9BC0FF;
    --brand-tint: rgba(110, 163, 255, 0.18);
    --on-brand: #101318;

    --mint: #3DD29D;
    --mint-tint: rgba(61, 210, 157, 0.18);

    --focus: #9BC0FF;

    --warn-bg: rgba(255, 151, 5, 0.17);
    --warn-ink: #FFD9A0;
    --warn-line: #FFB84C;
    --todo-bg: #6b4e0a;
    --todo-ink: #fff3c4;
  }
}

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

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

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

/* A short page still ends with its footer at the bottom of the window. */
body {
  display: flex;
  flex-direction: column;
  min-block-size: 100vh;
  min-block-size: 100dvh;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

html[lang="en"] body {
  line-height: 1.5;
}

img,
svg {
  max-inline-size: 100%;
}

a {
  color: var(--brand);
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--brand-strong);
}

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

h1,
h2,
h3 {
  line-height: 1.3;
  margin-block: 0 0.5em;
}

h1 {
  font-size: clamp(1.75rem, 4.5vw, 2.6rem);
}

h2 {
  font-size: clamp(1.3rem, 3vw, 1.75rem);
}

h3 {
  font-size: 1.1rem;
}

p {
  margin-block: 0 1em;
}

bdi {
  unicode-bidi: isolate;
}

.container {
  inline-size: 100%;
  max-inline-size: 1160px;
  margin-inline: auto;
  padding-inline: 16px;
}

@media (min-width: 640px) {
  .container {
    padding-inline: 24px;
  }
}

.visually-hidden {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  inset-inline-start: 12px;
  inset-block-start: -120px;
  z-index: 100;
  padding: 10px 18px;
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--brand);
  color: var(--on-brand);
  font-weight: 700;
  text-decoration: none;
}

.skip-link:focus {
  inset-block-start: 0;
  color: var(--on-brand);
}

main {
  flex: 1 0 auto;
}

main:focus {
  outline: none;
}

/* Icons come from assets/icons.svg; the stroke is set here so they follow the text colour. */
.icon {
  inline-size: 24px;
  block-size: 24px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-sm {
  inline-size: 16px;
  block-size: 16px;
  stroke-width: 2.5;
}

/* A fact that has not been filled in yet (see site-config.js). Loud on purpose. */
.todo {
  background: var(--todo-bg);
  color: var(--todo-ink);
  padding: 0 0.3em;
  border-radius: var(--radius);
  font-weight: 500;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

/* ---------- Buttons (the app's: flat, 2px corners) ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-block-size: 44px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-btn);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn-primary {
  background: var(--brand);
  color: var(--on-brand);
}

.btn-primary:hover {
  background: var(--brand-strong);
  color: var(--on-brand);
}

.btn-outline {
  background: var(--surface);
  border-color: var(--line);
  color: var(--brand);
}

.btn-outline:hover {
  border-color: var(--brand);
  color: var(--brand-strong);
}

.btn-lg {
  min-block-size: 48px;
  padding-inline: 22px;
  font-size: 1rem;
}

/* ---------- Header ---------- */
.site-header {
  background: var(--surface);
  border-block-end: 1px solid var(--line-soft);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  min-block-size: 60px;
  padding-block: 8px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 1.2rem;
  font-weight: 800;
  text-decoration: none;
}

.brand:hover {
  color: var(--ink);
}

.brand img {
  inline-size: 32px;
  block-size: 32px;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 4px 8px;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  min-block-size: 44px;
  padding-inline: 8px;
  color: var(--muted);
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
}

.lang-switch:hover {
  color: var(--brand);
}

/* On a phone the hero's own button is right below, so the header keeps only Sign in. */
.header-cta {
  display: none;
}

@media (min-width: 520px) {
  .header-cta {
    display: inline-flex;
  }
}

/* ---------- Hero ---------- */
.hero {
  padding-block: 20px 16px;
}

@media (min-width: 900px) {
  .hero {
    padding-block: 32px 20px;
  }
}

.hero-grid {
  display: grid;
  gap: 20px;
}

@media (min-width: 900px) {
  .hero-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 380px);
    gap: 40px;
    align-items: center;
  }
}

.hero-copy {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-inline-size: 0;
}

.hero h1 {
  margin: 0;
  font-weight: 800;
  line-height: 1.35;
}

html[lang="en"] .hero h1 {
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.lead {
  margin: 0;
  max-inline-size: 36em;
  color: var(--muted);
  font-size: 1.0625rem;
}

/* The three facts: free invoices, ZATCA Phase 2, the price. */
.facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 640px) {
  .facts {
    gap: 10px;
  }
}

.fact {
  display: flex;
  flex-direction: column;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  min-inline-size: 0;
}

.fact-value {
  color: var(--brand);
  font-size: clamp(1.2rem, 4.6vw, 1.65rem);
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.fact-unit {
  font-size: 0.875rem;
  font-weight: 700;
}

.fact-label {
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.4;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
}

.cta-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.8125rem;
}

@media (max-width: 519px) {
  .cta-row .btn {
    flex: 1 1 100%;
  }
}

/* ---------- The example invoice (drawn in HTML so it mirrors with the page) ---------- */
.invoice {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}

.invoice-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
}

.invoice-title {
  font-size: 1rem;
  font-weight: 800;
}

.badge-ok {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: var(--radius);
  background: var(--mint-tint);
  color: var(--mint);
  font-size: 0.75rem;
  font-weight: 700;
}

.invoice-body {
  display: flex;
  align-items: center;
  gap: 14px;
}

.invoice-rows {
  flex: 1;
  margin: 0;
  font-size: 0.875rem;
}

.invoice-rows div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-block: 4px;
  border-block-end: 1px solid var(--line-soft);
}

.invoice-rows dt,
.invoice-rows dd {
  margin: 0;
}

.invoice-rows .is-muted {
  color: var(--muted);
}

.invoice-rows .is-total {
  border-block-end: 0;
  font-size: 1rem;
  font-weight: 800;
}

/* A QR code is dark on white in both themes, as on paper. */
.qr {
  flex: none;
  inline-size: 72px;
  block-size: 72px;
  padding: 4px;
  background: #FFFFFF;
  border-radius: var(--radius);
  color: var(--qr-ink);
}

/* ---------- How it works: one slim strip ---------- */
.steps-strip {
  padding-block: 0 20px;
}

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px 16px;
  margin: 0;
  padding: 12px 16px;
  list-style: none;
  counter-reset: step;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  font-size: 0.9375rem;
}

.steps li {
  display: flex;
  align-items: center;
  gap: 10px;
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  flex: none;
  inline-size: 26px;
  block-size: 26px;
  border-radius: var(--radius);
  background: var(--brand);
  color: var(--on-brand);
  font-size: 0.8125rem;
  font-weight: 800;
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--surface);
  border-block-start: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.6;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 20px;
  padding-block: 12px;
}

.footer-inner p {
  margin: 0;
}

.footer-links ul {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-links a {
  display: inline-block;
  padding-block: 4px;
  color: var(--muted);
}

.footer-links a:hover {
  color: var(--brand);
}

.footer-note {
  flex-basis: 100%;
  font-size: 0.75rem;
}

/* ---------- Legal pages ---------- */
.legal {
  padding-block: 28px 56px;
}

.legal-inner {
  max-inline-size: 52rem;
  margin-inline: auto;
}

.draft-banner {
  margin-block-end: 20px;
  padding: 12px 16px;
  border: 1px solid var(--warn-line);
  border-radius: var(--radius-card);
  background: var(--warn-bg);
  color: var(--warn-ink);
  font-weight: 700;
}

.legal h1 {
  margin-block-end: 6px;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
}

.legal-meta {
  margin-block-end: 20px;
  color: var(--muted);
  font-size: 0.9375rem;
}

.toc {
  margin-block: 0 8px;
  padding: 14px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
}

.legal .toc h2 {
  margin-block: 0 8px;
  padding-block-start: 0;
  font-size: 1rem;
}

.legal .toc ol {
  margin: 0;
  padding-inline-start: 1.6em;
  columns: 1;
}

@media (min-width: 720px) {
  .legal .toc ol {
    columns: 2;
    column-gap: 32px;
  }
}

.legal .legal-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
}

.legal-nav li {
  margin: 0;
}

.legal-nav a {
  display: inline-block;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.9375rem;
  text-decoration: none;
}

.legal-nav a:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.legal-nav a[aria-current="page"] {
  border-color: var(--brand);
  background: var(--brand-tint);
  color: var(--brand-strong);
  font-weight: 700;
}

.toc li {
  break-inside: avoid;
  padding-block: 1px;
}

.legal h2 {
  margin-block: 1.8em 0.5em;
  padding-block-start: 0.4em;
  font-size: 1.3rem;
}

.legal h3 {
  margin-block: 1.4em 0.4em;
}

.legal ul,
.legal ol {
  margin-block: 0 1em;
  padding-inline-start: 1.6em;
}

.legal li {
  margin-block-end: 0.35em;
}

.table-wrap {
  margin-block: 0 1.2em;
  overflow-x: auto;
}

.legal table {
  inline-size: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  line-height: 1.6;
}

.legal th,
.legal td {
  padding: 8px 12px;
  border: 1px solid var(--line);
  text-align: start;
  vertical-align: top;
}

.legal th {
  background: var(--bg-alt);
  font-weight: 700;
}

/* ---------- 404 ---------- */
.notfound {
  display: grid;
  place-items: center;
  min-block-size: 70vh;
  padding: 48px 16px;
  text-align: center;
}

.notfound-code {
  margin: 0;
  color: var(--brand);
  font-size: clamp(3.5rem, 14vw, 6rem);
  font-weight: 800;
  line-height: 1;
}

.notfound section {
  max-inline-size: 32rem;
  margin-inline: auto;
}

.notfound section + section {
  margin-block-start: 28px;
  padding-block-start: 28px;
  border-block-start: 1px solid var(--line);
}

/* ---------- Motion, forced colours, print ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (forced-colors: active) {
  .btn,
  .fact,
  .invoice,
  .steps {
    border: 1px solid ButtonText;
  }
}

@media print {
  .site-header,
  .site-footer,
  .skip-link,
  .toc {
    display: none;
  }

  body {
    background: #fff;
    color: #000;
    font-size: 11pt;
    line-height: 1.6;
  }

  .legal {
    padding: 0;
  }

  .draft-banner {
    border: 2px solid #000;
    background: #fff;
    color: #000;
  }

  .todo {
    background: none;
    color: #000;
    border: 1px dashed #000;
  }

  a {
    color: #000;
  }
}
