:root {
  --gold: #c5a64a;
  --gold-soft: #e6d7a7;
  --radius: 14px;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #08291f;
  --bg-2: #0c3427;
  --card: rgba(16, 56, 45, .62);
  --text: #f4f0e5;
  --muted: #c4c5b9;
  --line: rgba(197, 166, 74, .32);
  --accent: #c5a64a;
  --btn-text: #08291f;
  --glow: rgba(35, 76, 59, .55);
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f1e4;
  --bg-2: #efe7d2;
  --card: rgba(255, 255, 255, .75);
  --text: #0e3a2c;
  --muted: #4d6258;
  --line: rgba(138, 108, 24, .35);
  --accent: #8a6c18;
  --btn-text: #fff;
  --glow: rgba(197, 166, 74, .22);
}
* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; overflow-x: hidden; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse at 50% 30%, var(--glow), transparent 60%), var(--bg);
  color: var(--text);
  font-family: "IBM Plex Sans Arabic", Tahoma, sans-serif;
  transition: background .35s ease, color .35s ease;
  position: relative;
  overflow-x: hidden;
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); opacity: 0; pointer-events: none; }
[hidden] { display: none !important; }

/* زخرفة الخلفية: نجوم ثمانية متكررة */
.bg-pattern {
  position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 64 64' fill='none' stroke='%23c5a64a' stroke-opacity='.10' stroke-width='.8'%3E%3Crect x='14' y='14' width='36' height='36'/%3E%3Crect x='14' y='14' width='36' height='36' transform='rotate(45 32 32)'/%3E%3C/svg%3E");
  background-size: 120px 120px;
  -webkit-mask-image: radial-gradient(ellipse at 50% 35%, #000 0%, transparent 75%);
  mask-image: radial-gradient(ellipse at 50% 35%, #000 0%, transparent 75%);
}

/* الشريط العلوي */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px clamp(16px, 4vw, 40px);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
}
.topbar-brand { display: flex; align-items: center; gap: 10px; font: 700 22px "Amiri", serif; color: var(--accent); }
.mini-star { width: 30px; height: 30px; color: var(--accent); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.btn {
  font: 600 14px "IBM Plex Sans Arabic", Tahoma, sans-serif;
  border-radius: 10px; padding: 10px 18px; cursor: pointer;
  border: 1px solid var(--line); transition: transform .15s ease, background .2s ease, color .2s ease, box-shadow .2s ease;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .icon-btn:focus-visible, .site-nav button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-ghost { background: transparent; color: var(--text); }
.btn-ghost:hover { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.btn-gold { background: linear-gradient(135deg, #d9bb5c, #b08f2e); color: #1b1600; border-color: transparent; font-size: 15px; box-shadow: 0 6px 20px rgba(197,166,74,.28); }
.btn-gold:hover { box-shadow: 0 8px 26px rgba(197,166,74,.42); }
.btn-gold:disabled { opacity: .6; cursor: wait; }
.icon-btn {
  width: 42px; height: 42px; display: grid; place-items: center; cursor: pointer;
  border-radius: 10px; border: 1px solid var(--line); background: transparent; color: var(--accent);
}
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
[data-theme="dark"] .i-sun { display: none; }
[data-theme="light"] .i-moon { display: none; }

/* القسم الرئيسي */
main { max-width: 1080px; margin: 0 auto; padding: clamp(24px, 5vw, 56px) clamp(16px, 4vw, 32px) 24px; }
.hero { display: grid; grid-template-columns: 1fr 1.1fr; gap: clamp(24px, 5vw, 56px); align-items: center; animation: appear .8s ease both; }
.logo-frame {
  border: 1px solid var(--line); border-radius: 20px; padding: 10px;
  background: var(--card);
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent) 6%, transparent), 0 24px 60px rgba(0,0,0,.25);
  max-width: 440px; margin-inline: auto;
}
.logo-frame img { display: block; width: 100%; height: auto; border-radius: 12px; }
.logo-fallback { display: block; width: 100%; aspect-ratio: 1; color: var(--accent); }
.logo-fallback text { fill: var(--accent); font: 700 22px "Amiri", serif; }
.hero-text { text-align: center; }
.eyebrow { margin: 0 0 8px; color: var(--accent); font-size: 13px; letter-spacing: .08em; }
h1 { margin: 0; font: 700 clamp(40px, 7vw, 62px)/1.3 "Amiri", serif; }
.gold-line { height: 1px; width: 110px; margin: 18px auto 22px; position: relative; background: linear-gradient(90deg, transparent, var(--accent), transparent); }
.gold-line span { position: absolute; width: 6px; height: 6px; background: var(--accent); transform: rotate(45deg); top: -2.5px; left: calc(50% - 3px); }
.status {
  display: inline-flex; align-items: center; gap: 9px; border: 1px solid var(--line);
  border-radius: 6px; padding: 8px 16px; font-size: 14px; color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: pulse 2s infinite; }
.description { max-width: 500px; margin: 18px auto 26px; color: var(--muted); line-height: 2; font-size: 16px; }

/* العداد التنازلي */
.countdown { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; direction: rtl; max-width: 440px; margin: 0 auto; }
.cd-box {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 4px 10px; display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.cd-box b { font: 700 clamp(28px, 6vw, 40px)/1.1 "IBM Plex Sans Arabic", sans-serif; color: var(--accent); font-variant-numeric: tabular-nums; direction: ltr; }
.cd-box span { font-size: 12px; color: var(--muted); }
.progress { height: 6px; max-width: 440px; margin: 16px auto 10px; background: color-mix(in srgb, var(--accent) 16%, transparent); border-radius: 99px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #b08f2e, #e6d7a7); border-radius: 99px; transition: width 1s ease; }
.launch-note { margin: 0; font-size: 13px; color: var(--muted); }
.launch-note strong { color: var(--accent); }

/* الاشتراك */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; backdrop-filter: blur(6px); }
.subscribe { max-width: 640px; margin: clamp(32px, 6vw, 64px) auto 0; padding: clamp(22px, 4vw, 36px); text-align: center; }
.subscribe h2 { margin: 0 0 8px; font: 700 28px "Amiri", serif; color: var(--accent); }
.subscribe p { margin: 0 0 18px; color: var(--muted); line-height: 1.9; font-size: 15px; }
#sub-form { display: flex; gap: 10px; }
#sub-form input[type="email"] {
  flex: 1; min-width: 0; padding: 12px 16px; font: 500 15px "IBM Plex Sans Arabic", sans-serif;
  border-radius: 10px; border: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 60%, transparent); color: var(--text);
}
.form-msg { min-height: 24px; margin: 12px 0 0 !important; font-size: 14px !important; }
.form-msg.ok { color: #5fcf8f !important; }
.form-msg.err { color: #ff8a80 !important; }
[data-theme="light"] .form-msg.ok { color: #1a7f4b !important; }
[data-theme="light"] .form-msg.err { color: #b3261e !important; }

/* التواصل */
.contact { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 40px; }
.contact-label { color: var(--muted); font-size: 13px; }
.email-link { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; direction: ltr; font-size: 15px; border-bottom: 1px solid var(--line); padding-bottom: 6px; transition: color .2s, border-color .2s; }
.email-link:hover, .email-link:focus-visible { color: var(--accent); border-color: var(--accent); outline: none; }
.mail-icon { color: var(--accent); font-size: 17px; }

/* لوحة الإحصائيات */
.stats { max-width: 1080px; margin: 32px auto 0; padding: 0 clamp(16px, 4vw, 32px); }
.stats-inner { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: 18px; background: var(--card); overflow: hidden; }
.stat { padding: 20px 10px; text-align: center; display: flex; flex-direction: column; gap: 4px; }
.stat + .stat { border-inline-start: 1px solid var(--line); }
.stat b { font: 700 clamp(24px, 5vw, 34px)/1.1 "IBM Plex Sans Arabic", sans-serif; color: var(--accent); direction: ltr; font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--muted); }
.stats-note { text-align: center; font-size: 12px; color: var(--muted); margin: 10px 0 0; }

footer { display: flex; justify-content: center; align-items: center; gap: 10px; padding: 28px 16px 34px; color: var(--muted); font-size: 12px; }
.footer-separator { color: var(--accent); }

/* ===== الوضع التجريبي ===== */
.demo { position: fixed; inset: 0; z-index: 100; background: var(--bg); display: flex; flex-direction: column; }
.demo-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--bg-2); font-size: 14px; }
.demo-scroll { flex: 1; overflow-y: auto; padding: clamp(8px, 2vw, 24px); }
.demo-site { max-width: 1180px; margin: 0 auto; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--bg); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.site-head img { display: block; width: 100%; height: auto; }
.site-head-fallback { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 36px 16px; background: linear-gradient(135deg, #0b3a2b, #08291f); color: var(--gold); }
.site-head-fallback svg { width: 64px; height: 64px; }
.sh-title { font: 700 40px "Amiri", serif; }
.sh-sub { font-size: 14px; color: var(--gold-soft); }
.site-nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding: 12px; background: #0a3023; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.site-nav button { font: 600 14px "IBM Plex Sans Arabic", sans-serif; color: #f4f0e5; background: transparent; border: 1px solid transparent; padding: 10px 16px; border-radius: 10px; cursor: pointer; transition: all .2s; }
.site-nav button:hover { border-color: var(--gold); color: var(--gold); }
.site-nav button.active { background: var(--gold); color: #1b1600; }
.demo-body { padding: 36px 20px 44px; text-align: center; }
.demo-note { max-width: 560px; margin: 0 auto 14px; color: var(--muted); line-height: 2; font-size: 15px; }
.demo-section { color: var(--accent); font-weight: 600; margin: 0; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #10382d; color: #f4f0e5; border: 1px solid var(--gold); padding: 12px 20px; border-radius: 10px; font-size: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.4); z-index: 120; max-width: 90vw; text-align: center; }

@keyframes appear { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); } 50% { box-shadow: 0 0 0 7px transparent; } }

@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; }
  .logo-frame { max-width: 340px; }
}
@media (max-width: 520px) {
  #sub-form { flex-direction: column; }
  .btn-ghost#demo-open { padding: 9px 12px; font-size: 13px; }
  .topbar-brand span { display: none; }
  .site-nav button { padding: 9px 12px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ترويسة الوضع التجريبي: شريط الصورة العلوي */
.site-head img { min-height: 64px; object-fit: cover; object-position: center; background: #0a2d22; }

/* ===== الواجهة الرئيسية التجريبية ===== */
.form-hint { font-size: 12px !important; margin: 4px 0 0 !important; opacity: .8; }
.site-head img.head-brand { display: none; }
.site-head { background: #0a2d22; }
.demo-banner { text-align: center; padding: 9px 12px; font-size: 13px; font-weight: 600; color: #1b1600; background: linear-gradient(90deg, #b08f2e, #e6d7a7, #b08f2e); }
.portal { padding: clamp(14px, 3vw, 28px); display: flex; flex-direction: column; gap: 26px; background: radial-gradient(ellipse at 50% 0, var(--glow), transparent 60%); }
.portal-group h3 { margin: 0 0 12px; font: 700 22px "Amiri", serif; color: var(--accent); display: flex; align-items: center; gap: 12px; }
.portal-group h3::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line), transparent); }
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.tile {
  display: flex; align-items: center; gap: 12px; text-align: start; cursor: pointer;
  padding: 14px; border-radius: 14px; border: 1px solid var(--line); color: var(--text);
  background: linear-gradient(160deg, var(--card), color-mix(in srgb, var(--accent) 7%, transparent));
  border-bottom: 3px solid var(--accent); font-family: inherit;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.tile:hover { transform: translateY(-3px); box-shadow: 0 10px 26px rgba(0,0,0,.22); }
.tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tile-ic { flex: none; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 12px; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.tile-ic svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tile-tx { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.tile-tx strong { font-size: 15px; font-weight: 600; }
.tile-tx small { font-size: 12px; color: var(--muted); line-height: 1.6; }
.tile-featured { padding: 20px; border: 1px solid var(--accent); border-bottom-width: 3px; background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 22%, var(--bg)), var(--card)); }
.tile-featured .tile-ic { width: 58px; height: 58px; }
.tile-featured .tile-ic svg { width: 30px; height: 30px; }
.tile-featured strong { font: 700 clamp(20px, 4vw, 28px)/1.4 "Amiri", serif; color: var(--accent); }
.tile-featured small { font-size: 13px; }
.toast { display: flex; flex-direction: column; gap: 4px; }
.toast b { color: var(--gold); font-size: 15px; }
@media (max-width: 640px) {
  .site-head img.head-wide { display: none; }
  .site-head img.head-brand { display: block; height: 70px; width: auto; margin: 0 auto; min-height: 0; }
  .tile-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tile { flex-direction: column; text-align: center; padding: 14px 8px; }
  .tile-featured { flex-direction: row; text-align: start; }
}
