/* Design tokens (docs/WEBSITE_AND_ADMIN_PORTAL.md §11). Logical properties only, so the
   same rules serve Arabic (rtl) and English (ltr). No inline styles: CSP style-src 'self'. */

:root {
  --bg: #f6f8fc;
  --surface: #ffffff;
  --surface-2: #eef2f9;
  --text: #0d1729;
  --text-muted: #55627a;
  --border: #dce3ee;
  --accent: #0b5fd8;
  --accent-strong: #084aa8;
  --accent-soft: #e5eeff;
  --on-accent: #ffffff;
  --success: #1d7a3e;
  --success-soft: #e3f4e8;
  --warning: #8a5a00;
  --warning-soft: #fdf1d8;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --info-soft: #e3f3fc;
  --focus: #2563eb;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 4px 16px rgb(0 0 0 / 0.04);
  --font: "IBM Plex Sans Arabic", "IBM Plex Sans", system-ui, -apple-system, "Segoe UI",
          "Noto Sans Arabic", "Geeza Pro", Tahoma, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #060c1a;
    --surface: #0c1528;
    --surface-2: #131f38;
    --text: #eef3fb;
    --text-muted: #a9b6cb;
    --border: #22304b;
    --accent: #3d9bff;
    --accent-strong: #74b8ff;
    --accent-soft: #0f2548;
    --on-accent: #031025;
    --success: #5fcf86;
    --success-soft: #16301f;
    --warning: #f2b54a;
    --warning-soft: #33280f;
    --danger: #ff8a7a;
    --danger-soft: #3a1714;
    --info-soft: #0f2a3c;
    --focus: #7aa7ff;
    --shadow: none;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
}
:lang(ar) body, body:lang(ar) { line-height: 1.8; }
img, svg { max-width: 100%; height: auto; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-strong); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 0.5em; letter-spacing: -0.01em; }
:lang(ar) h1, :lang(ar) h2, :lang(ar) h3 { letter-spacing: 0; line-height: 1.4; }
h1 { font-size: clamp(1.9rem, 4vw + 1rem, 3rem); }
h2 { font-size: clamp(1.4rem, 1.5vw + 1rem, 2rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
.muted { color: var(--text-muted); }
.small { font-size: 0.9rem; }
.ltr { direction: ltr; unicode-bidi: isolate; }

.container { width: 100%; max-width: 1120px; margin-inline: auto; padding-inline: 16px; }
.narrow { max-width: 720px; }
.section { padding-block: 56px; }
.section-alt { background: var(--surface-2); }
.section-head { max-width: 680px; margin-block-end: 28px; }
.center { text-align: center; margin-inline: auto; }
.stack > * + * { margin-block-start: 16px; }

.skip-link { position: absolute; inset-inline-start: -9999px; }
.skip-link:focus { inset-inline-start: 16px; top: 8px; z-index: 10; background: var(--surface); padding: 8px 12px; }

/* Header */
.site-header { background: var(--surface); border-block-end: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.header-inner { display: flex; align-items: center; gap: 16px; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; font-size: 1.1rem; }
.brand img { width: 32px; height: 32px; border-radius: 7px; }
.primary-nav { display: flex; gap: 4px; margin-inline-start: 12px; }
.primary-nav a, .mobile-nav a { color: var(--text); text-decoration: none; padding: 8px 10px; border-radius: var(--radius-sm); }
.primary-nav a:hover, .mobile-nav a:hover { background: var(--surface-2); }
.primary-nav a[aria-current="page"] { color: var(--accent); font-weight: 600; }
.header-actions { display: flex; align-items: center; gap: 8px; margin-inline-start: auto; }
.lang-switch { font-weight: 600; text-decoration: none; padding: 8px 10px; border-radius: var(--radius-sm); }
.lang-switch:hover { background: var(--surface-2); }
.inline-form { display: inline; margin: 0; }
.mobile-menu { display: none; }
.mobile-menu summary { list-style: none; cursor: pointer; padding: 8px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.mobile-menu summary::-webkit-details-marker { display: none; }
.mobile-nav { position: absolute; inset-inline: 0; top: 64px; background: var(--surface); border-block-end: 1px solid var(--border); padding: 8px 16px 16px; display: grid; gap: 2px; }
@media (max-width: 900px) {
  .primary-nav { display: none; }
  .mobile-menu { display: block; }
  .header-actions .hide-mobile { display: none; }
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--on-accent); }
.btn-danger { color: var(--danger); }
.btn-small { min-height: 36px; padding: 6px 12px; font-size: 0.9rem; }
.btn-link { background: none; border: none; color: var(--accent); padding: 0; min-height: 0; font-weight: 600; }
.btn-link:hover { background: none; text-decoration: underline; color: var(--accent-strong); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

/* Messages and banners */
.messages { padding-block-start: 16px; }
.alert { padding: 12px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); margin-block-end: 12px; }
.alert-success { background: var(--success-soft); border-color: transparent; }
.alert-error { background: var(--danger-soft); border-color: transparent; }
.alert-warning { background: var(--warning-soft); border-color: transparent; }
.alert-info { background: var(--info-soft); border-color: transparent; }
.alert p:last-child { margin-block-end: 0; }
.draft-banner { background: var(--warning-soft); padding: 12px 16px; border-radius: var(--radius-sm); margin-block-end: 24px; font-weight: 600; }

/* Hero */
.hero { padding-block: 64px 48px; }
.hero-grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 48px; align-items: center; }
.hero .lead { font-size: 1.2rem; color: var(--text-muted); max-width: 560px; }
.eyebrow { display: inline-block; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 4px 10px; border-radius: 999px; font-size: 0.85rem; margin-block-end: 16px; }
.platforms { display: flex; flex-wrap: wrap; gap: 8px; margin-block-start: 20px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); font-size: 0.85rem; background: var(--surface); }
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; } }

/* Illustration of the app (not a screenshot: the app is not built yet) */
.mock { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.mock-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-block-end: 16px; }
.mock-next { background: var(--surface-2); border-radius: var(--radius-sm); padding: 14px 16px; margin-block-end: 12px; }
.mock-next strong { display: block; font-size: 1.1rem; }
.mock-countdown { font-size: 1.6rem; font-weight: 700; color: var(--accent); }
.mock-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-block-start: 1px solid var(--border); font-size: 0.95rem; }
.mock-caption { margin-block-start: 10px; font-size: 0.8rem; color: var(--text-muted); text-align: center; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 0.85rem; font-weight: 600; background: var(--surface-2); }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill-ok { color: var(--success); background: var(--success-soft); }
.pill-warn { color: var(--warning); background: var(--warning-soft); }
.pill-bad { color: var(--danger); background: var(--danger-soft); }
.pill-neutral { color: var(--text-muted); }

/* Cards and grids */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.card h3 { margin-block-end: 6px; }
.card p:last-child { margin-block-end: 0; }
.icon { width: 40px; height: 40px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; margin-block-end: 12px; font-weight: 700; }
.honest { border-inline-start: 4px solid var(--accent); }
.list-check { list-style: none; padding: 0; margin: 0; }
.list-check li { position: relative; padding-inline-start: 28px; margin-block-end: 8px; }
.list-check li::before { content: "✓"; position: absolute; inset-inline-start: 0; color: var(--success); font-weight: 700; }
.list-cross li::before { content: "✕"; color: var(--danger); }

/* Steps */
.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; }
.steps li { counter-increment: step; position: relative; padding-inline-start: 56px; min-height: 40px; }
.steps li::before {
  content: counter(step); position: absolute; inset-inline-start: 0; top: 0;
  width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: var(--on-accent);
  display: grid; place-items: center; font-weight: 700;
}
.steps h3 { margin-block-end: 4px; }

/* Pricing */
.price-card { display: flex; flex-direction: column; gap: 12px; position: relative; }
.price-card.recommended { border: 2px solid var(--accent); }
.badge { position: absolute; top: -12px; inset-inline-start: 22px; background: var(--accent); color: var(--on-accent); font-size: 0.8rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; }
.price { font-size: 2.2rem; font-weight: 700; line-height: 1.1; }
.price small { font-size: 1rem; font-weight: 500; color: var(--text-muted); }
.price-card .list-check { flex: 1; }

/* Download */
.download-card { display: flex; flex-direction: column; gap: 10px; }
.download-card.is-recommended { border: 2px solid var(--accent); }
.download-card .recommended-note { display: none; color: var(--accent); font-weight: 600; font-size: 0.9rem; }
.download-card.is-recommended .recommended-note { display: block; }
.hash { font-family: var(--mono); font-size: 0.8rem; word-break: break-all; direction: ltr; unicode-bidi: isolate; }

/* FAQ */
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 18px; margin-block-end: 10px; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details[open] summary { margin-block-end: 8px; }

/* Prose (legal pages) */
.prose h2 { font-size: 1.3rem; margin-block-start: 1.8em; }
.prose ul { padding-inline-start: 1.4em; }
.prose li { margin-block-end: 0.4em; }

/* Forms */
.form-card { max-width: 480px; margin-inline: auto; }
.field { margin-block-end: 18px; }
.field label { display: block; font-weight: 600; margin-block-end: 6px; }
.field input[type="text"], .field input[type="email"], .field input[type="password"],
.field input[type="datetime-local"], .field select, .field textarea {
  width: 100%; padding: 10px 12px; min-height: 44px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit;
}
.field textarea { min-height: 140px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 3px solid var(--focus); outline-offset: 0; border-color: transparent; }
.field.checkbox { display: flex; gap: 10px; align-items: flex-start; }
.field.checkbox label { font-weight: 500; margin: 0; }
.field.checkbox input { margin-block-start: 6px; width: 18px; height: 18px; }
.help { color: var(--text-muted); font-size: 0.875rem; margin-block-start: 4px; }
.errorlist { list-style: none; padding: 0; margin: 6px 0 0; color: var(--danger); font-size: 0.9rem; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); }
.form-errors { margin-block-end: 16px; }
.honeypot { position: absolute; inset-inline-start: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Portal */
.portal-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-block-end: 24px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin-block-end: 20px; }
.panel h2 { font-size: 1.2rem; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px 24px; margin: 16px 0; }
.kv div { min-width: 0; }
.kv dt { color: var(--text-muted); font-size: 0.85rem; }
.kv dd { margin: 0; font-weight: 600; }
.license-key { font-family: var(--mono); font-size: 1.05rem; direction: ltr; unicode-bidi: isolate; letter-spacing: 0.02em; }
.key-reveal { font-family: var(--mono); font-size: clamp(1rem, 2.5vw, 1.5rem); direction: ltr; unicode-bidi: isolate; background: var(--surface-2); border: 1px dashed var(--accent); border-radius: var(--radius-sm); padding: 16px; text-align: center; word-break: break-all; user-select: all; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: start; padding: 10px 8px; border-block-end: 1px solid var(--border); vertical-align: middle; }
th { color: var(--text-muted); font-weight: 600; font-size: 0.85rem; }
.rename-form { display: flex; gap: 6px; flex-wrap: wrap; }
.rename-form input { padding: 6px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; min-width: 0; }
.empty { color: var(--text-muted); padding: 12px 0; }

/* Footer */
.site-footer { border-block-start: 1px solid var(--border); background: var(--surface); padding-block: 32px; margin-block-start: 56px; font-size: 0.92rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-block-end: 16px; }
.footer-links a { color: var(--text-muted); }
.disclaimer { color: var(--text-muted); max-width: 820px; }

/* Development outbox */
.mail-item pre { white-space: pre-wrap; word-break: break-word; background: var(--surface-2); padding: 12px; border-radius: var(--radius-sm); font-family: var(--font); font-size: 0.95rem; text-align: start; margin: 0; }

.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.center .actions { justify-content: center; }
h4 { margin: 20px 0 8px; font-size: 1rem; }
.key-reveal + .actions { margin-block: 16px; }
.grid + p { margin-block-start: 20px; }
.mobile-nav .btn-link { padding: 8px 10px; justify-content: flex-start; }
