:root {
  --orange: #d9771e;
  --orange-dark: #a94f0b;
  --orange-soft: #fff3e6;
  --ink: #211a15;
  --muted: #6c625b;
  --line: #eadfd6;
  --surface: #ffffff;
  --surface-alt: #fbf8f5;
  --danger: #b42318;
  --danger-soft: #fff0ee;
  --success: #16794b;
  --success-soft: #eaf8f1;
  --shadow: 0 18px 45px rgba(79, 43, 16, .10);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, rgba(217,119,30,.12), transparent 30rem),
    linear-gradient(180deg, #fffaf5 0, #fff 22rem);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  line-height: 1.65;
}
html[dir="rtl"] body { font-family: Tahoma, Arial, sans-serif; }
a { color: var(--orange-dark); }
a:hover { color: var(--orange); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
.hidden { display: none !important; }

.site-shell { min-height: 100vh; display: flex; flex-direction: column; }
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px clamp(16px, 4vw, 54px);
  background: rgba(255,255,255,.92);
  border-bottom: 1px solid rgba(234,223,214,.9);
  backdrop-filter: blur(14px);
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 800; }
.brand img { width: 110px; height: 42px; object-fit: contain; object-position: left center; }
html[dir="rtl"] .brand img { object-position: right center; }
.header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.lang-switcher {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 8px 34px 8px 12px;
  color: var(--ink);
}
html[dir="rtl"] .lang-switcher { padding: 8px 12px 8px 34px; }
.nav-link { text-decoration: none; font-weight: 700; font-size: .92rem; padding: 8px 10px; border-radius: 10px; }
.nav-link:hover { background: var(--orange-soft); }

main { width: min(1120px, calc(100% - 32px)); margin: 0 auto; flex: 1; }
.hero { padding: clamp(50px, 8vw, 92px) 0 36px; display: grid; grid-template-columns: 1.25fr .75fr; gap: 42px; align-items: center; }
.hero.compact { padding-bottom: 18px; }
.hero h1 { margin: 0 0 16px; font-size: clamp(2rem, 5vw, 4rem); line-height: 1.05; letter-spacing: -.04em; }
html[dir="rtl"] .hero h1 { letter-spacing: 0; }
.hero p { margin: 0; color: var(--muted); font-size: clamp(1rem, 2vw, 1.2rem); max-width: 760px; }
.hero-mark { display: grid; place-items: center; }
.hero-mark img { width: min(260px, 55vw); filter: drop-shadow(0 18px 24px rgba(128,69,17,.16)); }
.eyebrow { margin: 0 0 8px; color: var(--orange-dark); font-weight: 800; text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; }
html[dir="rtl"] .eyebrow { letter-spacing: 0; }

.grid { display: grid; gap: 18px; }
.grid.cards { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 20px 0 60px; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: clamp(20px, 4vw, 30px);
  box-shadow: var(--shadow);
}
.card h2, .card h3 { margin-top: 0; line-height: 1.25; }
.card p:last-child { margin-bottom: 0; }
.card-link { text-decoration: none; color: inherit; transition: transform .15s ease, border-color .15s ease; }
.card-link:hover { transform: translateY(-2px); border-color: #e2ba94; }
.icon-badge { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--orange-soft); color: var(--orange-dark); font-size: 1.25rem; margin-bottom: 14px; }

.content-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 28px; padding: 20px 0 70px; align-items: start; }
.toc { position: sticky; top: 88px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 18px; }
.toc strong { display: block; margin-bottom: 8px; }
.toc a { display: block; padding: 7px 0; text-decoration: none; color: var(--muted); font-size: .92rem; }
.toc a:hover { color: var(--orange-dark); }
.legal { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: clamp(22px, 5vw, 48px); box-shadow: var(--shadow); }
.legal section { scroll-margin-top: 92px; padding-bottom: 24px; margin-bottom: 24px; border-bottom: 1px solid var(--line); }
.legal section:last-child { border-bottom: 0; margin-bottom: 0; }
.legal h2 { font-size: clamp(1.25rem, 2.5vw, 1.7rem); line-height: 1.3; }
.legal h3 { font-size: 1.05rem; }
.legal ul { padding-inline-start: 22px; }
.legal li { margin: 7px 0; }
.updated { color: var(--muted); font-size: .92rem; }
.notice { padding: 14px 16px; border-radius: 14px; background: var(--orange-soft); border: 1px solid #f0ceb0; }
.notice.danger { background: var(--danger-soft); border-color: #f1b9b3; }
.notice.success { background: var(--success-soft); border-color: #bce2cf; }

.form-card { width: min(720px, 100%); margin: 18px auto 70px; }
.form-card h2 { margin-top: 0; }
.form-row { display: grid; gap: 8px; margin: 16px 0; }
.field-help { margin: -8px 0 16px; color: var(--muted); font-size: .9rem; line-height: 1.5; }
label { font-weight: 700; }
input, textarea, select {
  width: 100%;
  border: 1px solid #d8cbc1;
  border-radius: 12px;
  background: #fff;
  padding: 12px 13px;
  color: var(--ink);
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(217,119,30,.16); }
input[disabled] { background: #f4f1ee; color: var(--muted); }
.check-row { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
.check-row input { width: 20px; height: 20px; margin-top: 3px; flex: 0 0 auto; }
.button-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 20px; }
.btn { border: 0; border-radius: 12px; padding: 12px 18px; font-weight: 800; text-decoration: none; display: inline-flex; justify-content: center; align-items: center; gap: 8px; }
.btn-primary { color: #fff; background: var(--orange); }
.btn-primary:hover { color: #fff; background: var(--orange-dark); }
.btn-secondary { color: var(--ink); background: #f2ece7; }
.btn-danger { color: #fff; background: var(--danger); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.status { margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: #f4f1ee; color: var(--muted); white-space: pre-wrap; }
.status.error { background: var(--danger-soft); color: #7b211a; }
.status.success { background: var(--success-soft); color: #11623d; }
.auth-tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.auth-tab { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 14px; font-weight: 700; }
.auth-tab.active { background: var(--orange-soft); border-color: #e8b98e; color: var(--orange-dark); }
.code-input { letter-spacing: .3em; font-size: 1.2rem; text-align: center; }
html[dir="rtl"] .code-input { letter-spacing: .3em; }
.data-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin: 18px 0; }
.data-list div { padding: 12px; background: var(--surface-alt); border: 1px solid var(--line); border-radius: 12px; }

.site-footer { padding: 28px clamp(16px, 4vw, 54px); border-top: 1px solid var(--line); background: #fff; color: var(--muted); }
.footer-inner { width: min(1120px, 100%); margin: 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; }
.footer-links { display: flex; flex-wrap: wrap; gap: 14px; }
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--orange-dark); }

/* Language visibility applies only to content inside the page.
   Do not target the root <html data-lang="..."> element. */
body [data-lang] { display: none; }
html[data-lang="en"] body [data-lang="en"],
html[data-lang="fr"] body [data-lang="fr"],
html[data-lang="ar"] body [data-lang="ar"] { display: block; }
html[data-lang="en"] body span[data-lang="en"],
html[data-lang="fr"] body span[data-lang="fr"],
html[data-lang="ar"] body span[data-lang="ar"],
html[data-lang="en"] body a[data-lang="en"],
html[data-lang="fr"] body a[data-lang="fr"],
html[data-lang="ar"] body a[data-lang="ar"] { display: inline; }

@media (max-width: 820px) {
  .site-header { align-items: flex-start; }
  .header-actions .nav-link { display: none; }
  .hero { grid-template-columns: 1fr; text-align: center; }
  .hero p { margin-inline: auto; }
  .hero-mark { order: -1; }
  .hero-mark img { width: 150px; }
  .content-layout { grid-template-columns: 1fr; }
  .toc { position: static; }
}
@media (max-width: 640px) {
  main { width: min(100% - 22px, 1120px); }
  .site-header { padding: 10px 12px; }
  .brand img { width: 88px; height: 36px; }
  .grid.cards, .data-list { grid-template-columns: 1fr; }
  .hero { padding-top: 34px; }
  .card, .legal { border-radius: 17px; }
  .button-row .btn { width: 100%; }
  .footer-inner { align-items: flex-start; flex-direction: column; }
}
