/* ==========================================================================
   Scrap Group design system - core
   Tokens, base, typography, buttons, forms, feedback.
   Shared by every page. One accent (ice), one neutral family (cool graphite),
   one shape rule: cards 20px, fields 14px, buttons and chips fully round.
   ========================================================================== */
:root {
  color-scheme: dark;

  /* surfaces: blue-tinted graphite, never pure black */
  --ink-0: #0a0b0e;
  --ink-1: #101217;
  --ink-2: #171a21;
  --ink-3: #1f232c;

  /* hairlines */
  --line: rgba(205, 218, 232, .09);
  --line-2: rgba(205, 218, 232, .17);
  --line-3: rgba(205, 218, 232, .30);

  /* text (all pass WCAG AA on ink-0) */
  --tx: #e9edf2;
  --tx-2: #a9b2bf;
  --tx-3: #7b8493;

  /* the single accent */
  --ice: #9cc2dc;
  --ice-2: #c6dcec;
  --ice-dim: rgba(156, 194, 220, .14);

  /* primary action: polished chrome */
  --chrome: #eef2f6;

  /* semantic states only */
  --ok: #7fcfa4;
  --warn: #e4b867;
  --bad: #ec8f98;

  /* type */
  --f-display: "El Messiri", "IBM Plex Sans Arabic", system-ui, sans-serif;
  --f-body: "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* shape */
  --r-card: 16px;
  --r-field: 12px;
  --r-pill: 999px;

  /* motion */
  --ease: cubic-bezier(.16, 1, .3, 1);
  --t-fast: .18s;
  --t: .35s;

  /* layers */
  --z-nav: 100;
  --z-menu: 90;
  --z-fab: 80;
  --z-modal: 200;
  --z-toast: 300;

  /* layout */
  --nav-h: 68px;
  --wrap: 1240px;
  --gutter: clamp(20px, 4vw, 48px);

  /* direction helpers for gradients */
  --to-start: to left;
  --to-end: to right;
}
[dir="rtl"] {
  --to-start: to right;
  --to-end: to left;
}
/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);
  background: var(--ink-0);
}
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--ink-0);
  color: var(--tx);
  font: 400 16px/1.75 var(--f-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--f-display);
  font-weight: 600;
  line-height: 1.18;
  text-wrap: balance;
}
html[lang="en"] h1,
html[lang="en"] h2 { letter-spacing: -.015em; }
p { margin: 0; text-wrap: pretty; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
img, svg, video { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden], .hidden { display: none !important; }
/* show-by-language helpers for static labels that have no script behind them */
html[lang="ar"] .en-only, html[lang="en"] .ar-only { display: none !important; }
:focus-visible {
  outline: 2px solid var(--ice);
  outline-offset: 3px;
  border-radius: 6px;
}
::selection { background: var(--ice); color: var(--ink-0); }
.skip {
  position: fixed;
  inset-block-start: 12px;
  inset-inline-start: 12px;
  z-index: calc(var(--z-toast) + 1);
  padding: 10px 18px;
  border-radius: var(--r-pill);
  background: var(--chrome);
  color: var(--ink-0);
  font-weight: 600;
  transform: translateY(-160%);
  transition: transform var(--t-fast) var(--ease);
}
.skip:focus { transform: none; }
/* ---------- buttons ---------- */
.btn, .nav-cta, button.sub, .cfm, .cp, .paypal-link-btn, .otp-btn, .ft-open {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 26px;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  font: 600 15px/1 var(--f-body);
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
  transition: transform var(--t-fast) var(--ease), background var(--t-fast), border-color var(--t-fast),
    color var(--t-fast), box-shadow var(--t-fast), opacity var(--t-fast);
}
.btn-s, .nav-cta, button.sub, .cfm, .paypal-link-btn {
  background: var(--chrome);
  color: var(--ink-0);
}
@media (hover: hover) and (pointer: fine) { /* gated */
  .btn-s:hover,
  .nav-cta:hover,
  button.sub:hover,
  .cfm:hover,
  .paypal-link-btn:hover {
  background: #fff;
  transform: translateY(-1px);
  box-shadow: 0 10px 24px -10px rgba(0, 0, 0, .6);
}
}
.btn-g, .cp, .otp-btn, .ft-open {
  background: transparent;
  color: var(--tx);
  border-color: var(--line-2);
}
@media (hover: hover) and (pointer: fine) { /* gated */
  .btn-g:hover,
  .cp:hover,
  .otp-btn:hover,
  .ft-open:hover {
  background: rgba(255, 255, 255, .05);
  border-color: var(--line-3);
}
}
.btn:active, .nav-cta:active, button.sub:active, .cfm:active, .cp:active, .paypal-link-btn:active,
.otp-btn:active, .ft-open:active { transform: scale(.98); }
.btn:disabled, button.sub:disabled, .cfm:disabled, .cp:disabled, .paypal-link-btn:disabled, .otp-btn:disabled,
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
button.sub, .cfm, .paypal-link-btn { width: 100%; }
.cp, .otp-btn, .ft-open { min-height: 40px; padding: 0 18px; font-size: 13.5px; }
/* ---------- language switch (shared by every page) ---------- */
.lang-switch, .term-lang {
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-pill);
}
.lang-btn, .term-lang button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--tx-2);
  font: 600 12.5px/1 var(--f-body);
  transition: background var(--t-fast), color var(--t-fast);
}
@media (hover: hover) and (pointer: fine) { /* gated */
  .lang-btn:hover,
  .term-lang button:hover { color: var(--tx); }
}
.lang-btn.is-on, .term-lang button.on { background: var(--tx); color: var(--ink-0); }
.lang-flag, .term-lang img { display: none; }
/* ---------- forms ---------- */
.fg { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.fl { font: 500 13.5px/1.4 var(--f-body); color: var(--tx-2); }
.fi {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  background: var(--ink-0);
  border: 1px solid var(--line-2);
  border-radius: var(--r-field);
  color: var(--tx);
  font: 400 16px/1.4 var(--f-body);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
textarea.fi { min-height: 104px; padding: 14px 16px; line-height: 1.6; resize: vertical; }
.fi::placeholder { color: var(--tx-3); opacity: 1; }
@media (hover: hover) and (pointer: fine) { /* gated */
  .fi:hover { border-color: var(--line-3); }
}
.fi:focus { outline: none; border-color: var(--ice); box-shadow: 0 0 0 4px var(--ice-dim); }
.fi[readonly] { background: var(--ink-1); color: var(--tx-2); cursor: default; }
.fi:disabled { opacity: .5; cursor: not-allowed; }
select.fi {
  appearance: none;
  padding-inline-end: 44px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--tx-2) 50%),
    linear-gradient(135deg, var(--tx-2) 50%, transparent 50%);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  background-position: calc(100% - 22px) 50%, calc(100% - 16px) 50%;
}
[dir="rtl"] select.fi { background-position: 22px 50%, 16px 50%; }
input[type="checkbox"] { accent-color: var(--ice); width: 18px; height: 18px; flex: 0 0 auto; }
/* ---------- feedback ---------- */
.toast {
  position: fixed;
  inset-inline: 0;
  bottom: 28px;
  z-index: var(--z-toast);
  width: max-content;
  max-width: min(92vw, 520px);
  margin-inline: auto;
  padding: 14px 24px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-pill);
  background: var(--ink-3);
  color: var(--tx);
  font: 500 14.5px/1.5 var(--f-body);
  text-align: center;
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
  transition: opacity var(--t) var(--ease), transform var(--t) var(--ease);
}
.toast.on { opacity: 1; transform: none; }
.support-empty {
  padding: 28px 22px;
  border: 1px dashed var(--line-2);
  border-radius: var(--r-card);
  color: var(--tx-2);
  font-size: 15px;
  line-height: 1.7;
  text-align: center;
}
/* ---------- motion ---------- */
@media (scripting: enabled) and (prefers-reduced-motion: no-preference) {
  [data-r] {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity .6s var(--ease), transform .6s var(--ease);
  }
  [data-r].in { opacity: 1; transform: none; }
  [data-r][data-d="1"] { transition-delay: .08s; }
  [data-r][data-d="2"] { transition-delay: .16s; }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(26px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* ---------- platform layer: touch, native feel, scroll containment ---------- */

html { -webkit-tap-highlight-color: transparent; }

button, a, [role="button"], summary, label, select,
input[type="checkbox"], input[type="radio"], input[type="range"] { touch-action: manipulation; }

button, [role="button"], .fil, .cm-tab, .lang-btn, .tab, .nav-links a, .navlink {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* iOS zooms the page when a focused field is under 16px */
@media (pointer: coarse) {
  input, textarea, select { font-size: 16px; }
}

/* overlays keep their own scroll instead of chaining to the page */
.modal, .subs-modal, .modal-card, .support-widget, .support-body, .mob, .rv-list { overscroll-behavior: contain; }

/* origin used by popovers so they grow from their trigger corner */
:root { --origin-end: top right; }
[dir="rtl"] { --origin-end: top left; }

/* one-shot entrances for overlays (keyframes are fine here: they mount once) */
@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px) scale(.96); } to { opacity: 1; transform: none; } }

main:focus { outline: none; }

html { scrollbar-color: var(--ink-3) var(--ink-0); scrollbar-width: thin; }

input, textarea, select { caret-color: var(--ice); }

/* ---------- drawn glyphs: close, check and overflow marks come from shapes, not Unicode ---------- */

.mx, .sclose, .kebab-btn { position: relative; font-size: 0 !important; }

.mx::before, .mx::after, .sclose::before, .sclose::after {
  content: "";
  position: absolute;
  inset-block-start: 50%;
  left: 50%;
  width: 16px;
  height: 1.5px;
  border-radius: 2px;
  background: currentColor;
  transform: translate(-50%, -50%) rotate(45deg);
}
.mx::after, .sclose::after { transform: translate(-50%, -50%) rotate(-45deg); }

.kebab-btn::before {
  content: "";
  position: absolute;
  inset-block-start: 50%;
  left: 50%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 -7px 0 currentColor, 0 7px 0 currentColor;
  transform: translate(-50%, -50%);
}

.ap-ok-i, .mdone-i, .co-result.is-ok .co-result-i { position: relative; font-size: 0 !important; }
.ap-ok-i::after, .mdone-i::after, .co-result.is-ok .co-result-i::after {
  content: "";
  position: absolute;
  inset-block-start: 50%;
  left: 50%;
  width: 11px;
  height: 20px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translate(-50%, -62%) rotate(45deg);
}

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