/* UAE e-invoicing readiness site — one stylesheet, mobile first, no web fonts.
   Uses logical properties (inline-start/end) so right-to-left pages (Arabic, dir="rtl") mirror without extra rules. */

:root {
  --bg: #ffffff;
  --surface: #f4f6f6;
  --text: #1a1f1e;
  --muted: #4b5654;
  --border: #d3dad8;
  --accent: #0d6b57;
  --accent-bg: #e3f2ee;
  --accent-text: #ffffff;
  --good: #136c34;
  --good-bg: #e7f4ec;
  --warn: #7a4b00;
  --warn-bg: #fff3dc;
  --bad: #a1251b;
  --bad-bg: #fdecea;
  --focus: #ffbf47;
  --radius: 10px;
  --max: 52rem;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131716;
    --surface: #1c2220;
    --text: #eaefed;
    --muted: #b0bcb8;
    --border: #38423f;
    --accent: #6fd3b6;
    --accent-bg: #16302a;
    --accent-text: #0b1210;
    --good: #7fd69c;
    --good-bg: #16301f;
    --warn: #f3c66b;
    --warn-bg: #33280f;
    --bad: #ff9a90;
    --bad-bg: #3a1916;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 1.0625rem/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
/* Arabic script reads better a little larger and with more line height. */
:lang(ar) body, body:lang(ar) { font-size: 1.125rem; line-height: 1.7; }

a { color: var(--accent); text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 2px; }

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

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

.skip-link {
  position: absolute; inset-inline-start: 1rem; top: -3rem;
  background: var(--accent); color: var(--accent-text);
  padding: 0.5rem 0.9rem; border-radius: var(--radius); z-index: 10;
}
.skip-link:focus { top: 0.5rem; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 1rem; }

/* Header */
.site-header { border-bottom: 1px solid var(--border); }
.site-header .wrap {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 0.5rem 1rem; padding-top: 0.75rem; padding-bottom: 0.75rem;
}
.brand { display: inline-flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--text); }
.brand-mark { width: 2rem; height: 2rem; flex: none; }
.brand-name { display: block; font-weight: 700; letter-spacing: -0.01em; line-height: 1.15; }
.brand-tag { display: none; font-size: 0.8rem; color: var(--muted); line-height: 1.2; }
@media (min-width: 34rem) { .brand-tag { display: block; } }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; }
.site-nav a { text-decoration: none; }
.site-nav a:hover, .site-nav a[aria-current] { text-decoration: underline; }
.lang-switch {
  display: inline-block; padding: 0.3rem 0.7rem; border: 1px solid var(--border);
  border-radius: 999px; text-decoration: none; font-size: 0.95rem;
}

/* Main */
main { padding: 1.5rem 0 2.5rem; }
h1 { font-size: 1.75rem; line-height: 1.2; margin: 0 0 0.5rem; letter-spacing: -0.015em; }
h2 { font-size: 1.3rem; margin: 2rem 0 0.75rem; }
h3 { font-size: 1.05rem; margin: 1.5rem 0 0.5rem; }
.lead { color: var(--muted); margin-top: 0; }
.updated { display: inline-block; font-size: 0.85rem; color: var(--muted); margin: 0 0 0.75rem; }

/* Home page: hero, trust points, tools */
.hero { padding: 0.5rem 0 0.25rem; }
.hero h1 { font-size: 1.6rem; }
@media (min-width: 40rem) { .hero h1 { font-size: 2rem; } }
.eyebrow {
  display: inline-block; font-size: 0.85rem; font-weight: 600; color: var(--accent);
  background: var(--accent-bg); border-radius: 999px; padding: 0.2rem 0.75rem; margin: 0 0 0.75rem;
}
.trust { list-style: none; padding: 0; margin: 1.25rem 0 0.5rem; display: grid; gap: 0.75rem; }
@media (min-width: 40rem) { .trust { grid-template-columns: repeat(3, 1fr); } }
.trust li { display: flex; gap: 0.6rem; align-items: flex-start; font-size: 0.95rem; }
.trust svg { width: 1.4rem; height: 1.4rem; flex: none; color: var(--accent); margin-top: 0.1rem; }
.trust strong { display: block; }
.trust span { color: var(--muted); }
.group-title { font-size: 1rem; color: var(--muted); font-weight: 600; margin: 1.75rem 0 0.25rem; }

.calc-list { list-style: none; padding: 0; margin: 1rem 0; display: grid; gap: 0.75rem; }
@media (min-width: 40rem) { .calc-list--grid { grid-template-columns: 1fr 1fr; } }
.calc-list a {
  display: block; padding: 1rem; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); text-decoration: none; color: var(--text); height: 100%;
}
.calc-list a:hover { border-color: var(--accent); }
.calc-list strong { display: block; color: var(--accent); font-size: 1.1rem; }
.calc-list span { color: var(--muted); }

/* Key dates timeline */
.timeline { list-style: none; padding: 0; margin: 1rem 0; border-inline-start: 3px solid var(--accent-bg); }
.timeline li { position: relative; padding: 0 0 1rem 0; padding-inline-start: 1.25rem; }
.timeline li::before {
  content: ""; position: absolute; inset-inline-start: -0.5rem; top: 0.45rem;
  width: 0.8rem; height: 0.8rem; border-radius: 50%; background: var(--accent);
}
.timeline li.past::before { background: var(--border); }
.timeline time { display: block; font-weight: 700; }
.timeline span { color: var(--muted); }

/* Sources box */
.sources { margin-top: 1.5rem; padding: 0.9rem 1rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); font-size: 0.95rem; }
.sources h2 { font-size: 1rem; margin: 0 0 0.4rem; }
.sources ul { margin: 0 0 0.5rem; padding-inline-start: 1.2rem; }
.sources li { margin-bottom: 0.2rem; }
.sources p { margin: 0; color: var(--muted); }

/* Form */
.calc-form { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
.field { margin: 0 0 1rem; }
.field > label, fieldset > legend { display: block; font-weight: 600; margin-bottom: 0.3rem; }
.hint { display: block; color: var(--muted); font-size: 0.92rem; margin: -0.1rem 0 0.35rem; }
fieldset { border: 0; padding: 0; margin: 0 0 1rem; min-width: 0; }
.choices { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; }
.choices--stack { flex-direction: column; gap: 0.5rem; }
.choices label, .field > label.check-label { display: inline-flex; align-items: center; gap: 0.45rem; font-weight: 400; }
input[type="number"], input[type="date"], select {
  width: 100%; max-width: 22rem; min-height: 2.75rem; padding: 0.5rem 0.65rem;
  font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: 8px;
}
input[type="radio"], input[type="checkbox"] { width: 1.25rem; height: 1.25rem; flex: none; accent-color: var(--accent); }
.grid-2 { display: grid; gap: 0 1rem; }
@media (min-width: 34rem) { .grid-2 { grid-template-columns: 1fr 1fr; } }

.button {
  display: inline-block; min-height: 2.75rem; padding: 0.55rem 1.3rem;
  background: var(--accent); color: var(--accent-text);
  border: 0; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer;
}

.button--secondary { background: transparent; color: var(--accent); border: 2px solid var(--accent); }

[hidden] { display: none !important; }

/* Result */
.result { margin-top: 1.5rem; padding: 1.1rem 1rem; border: 2px solid var(--accent); border-radius: var(--radius); }
.result:focus { outline: 3px solid var(--focus); }
.result > h2 { margin-top: 0; }
.answer { font-size: 1.6rem; font-weight: 700; line-height: 1.25; margin: 0.25rem 0 0.25rem; }
.answer--good { color: var(--good); }
.answer--warn { color: var(--warn); }
.answer--bad { color: var(--bad); }
.answer-sub { margin: 0 0 1rem; color: var(--muted); }
.answer--prompt { font-size: 1.2rem; font-weight: 600; color: var(--text); }
.deadline { font-size: 1.3rem; font-weight: 700; margin: 0.25rem 0; }
.note { background: var(--warn-bg); color: var(--text); border-radius: 8px; padding: 0.6rem 0.8rem; }

.breakdown { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.breakdown th, .breakdown td { padding: 0.5rem 0.25rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.breakdown th { text-align: start; font-weight: 400; }
.breakdown td { text-align: end; white-space: nowrap; }
.breakdown tr.total th, .breakdown tr.total td { font-weight: 700; }
.breakdown thead th { font-weight: 700; border-bottom-width: 2px; }
.table-scroll { overflow-x: auto; margin: 1rem 0; }
.row-hint { display: block; color: var(--muted); font-size: 0.88rem; }

.notes { padding-inline-start: 1.2rem; }
.notes li { margin-bottom: 0.4rem; }

/* Readiness checklist (ticks are kept only in this browser) */
.steps { list-style: none; padding: 0; counter-reset: step; }
.steps > li { counter-increment: step; border: 1px solid var(--border); border-radius: var(--radius); padding: 0.75rem 1rem; margin: 0 0 0.75rem; }
.steps > li > label { display: flex; gap: 0.6rem; align-items: flex-start; font-weight: 600; cursor: pointer; }
.steps > li > label input { margin-top: 0.2rem; }
.steps > li > p { margin: 0.35rem 0 0; padding-inline-start: 1.85rem; color: var(--muted); }
.steps > li.done { background: var(--surface); }
.steps > li.done > label > span { text-decoration: line-through; text-decoration-color: var(--muted); }
.progress { font-weight: 600; }

.pill { display: inline-block; padding: 0.15rem 0.6rem; border-radius: 999px; font-weight: 700; font-size: 0.92rem; }
.pill--must { background: var(--bad-bg); color: var(--bad); }
.pill--no { background: var(--good-bg); color: var(--good); }
.pill--soon { background: var(--warn-bg); color: var(--warn); }

/* Explanatory text */
.explain { margin-top: 2rem; }
.explain p, .explain li { max-width: 40rem; }
.figure { margin: 1.25rem 0; max-width: 40rem; }
.figure svg { width: 100%; height: auto; }
.figure figcaption { color: var(--muted); font-size: 0.92rem; margin-top: 0.4rem; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); padding: 1.5rem 0 2rem; color: var(--muted); font-size: 0.95rem; margin-top: 1rem; }
.disclaimer { color: var(--text); font-weight: 600; }
.footer-brand { color: var(--text); font-weight: 700; margin-bottom: 0.25rem; }
.site-footer ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; }
.footer-cols { display: grid; gap: 1rem 2rem; margin-bottom: 1rem; }
@media (min-width: 40rem) { .footer-cols { grid-template-columns: 1.4fr 1fr 0.8fr; } }
.footer-cols h2 { font-size: 0.9rem; color: var(--text); margin: 0 0 0.4rem; }
.site-footer .footer-cols ul { display: block; margin: 0; }
.footer-cols li { margin-bottom: 0.3rem; }
.footer-cols p { margin: 0 0 0.4rem; }
.footer-meta { border-top: 1px solid var(--border); padding-top: 0.75rem; }

/* Tests page */
.test-pass { color: var(--good); }
.test-fail { color: var(--bad); font-weight: 700; }
