/* أساسيات عامة: RTL، موبايل أول، logical properties فقط. */

/* خطوط self-hosted — ملفات woff2 في ../fonts/ (تُضاف في Phase 7).
   لحد ما تتوفر، fallback لخطوط النظام العربي. */
@font-face {
  font-family: "Brand Head";
  src: local("Cairo"), local("Tahoma");
  font-weight: 800 900;
  font-display: swap;
}

@font-face {
  font-family: "Brand Body";
  src: local("Segoe UI"), local("Tahoma"), local("Arial");
  font-weight: 400 600;
  font-display: swap;
}

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

/* تحديث 0005: خاصية hidden لازم تغلب أي display مكتوب في CSS (زي .lightbox { display: grid })،
   وإلا العنصر «المخفي» يفضل ظاهر — ده كان سبب الطبقة السودا فوق صفحة الهدية. */
[hidden] { display: none !important; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Brand Body", "Segoe UI", Tahoma, Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.8;
  min-height: 100vh;
}

h1, h2, h3 {
  font-family: "Brand Head", "Segoe UI", Tahoma, sans-serif;
  line-height: 1.15;
  margin-block: 0 0.5em;
}

h1 { font-size: clamp(2rem, 7vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 4.5vw, 2.2rem); }
h3 { font-size: 1.25rem; }

p { margin-block: 0 1em; }

a { color: var(--brand); }
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

.container {
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: 16px;
}

.narrow { max-width: 44em; }
.muted { color: var(--ink-soft); }
.legal h2 { margin-block-start: 1.75em; }
.legal ul { padding-inline-start: 1.25em; }

@media (min-width: 768px) {
  .container { padding-inline: 24px; }
}

/* شريط البريد الجوي أعلى الصفحة */
.airmail-strip {
  height: 8px;
  background: repeating-linear-gradient(
    -45deg,
    var(--brand) 0 12px,
    var(--gold) 12px 24px
  );
}

/* أزرار */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  min-height: 44px;
  min-width: 44px;
  padding: 14px 24px;
  border-radius: var(--radius-m);
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  cursor: pointer;
  border: 2px solid transparent;
}

.btn-primary {
  background: var(--brand);
  color: var(--brand-ink);
  box-shadow: var(--shadow-press);
}

.btn-primary:hover { filter: brightness(1.04); }
.btn-primary:active {
  transform: translateY(3px);
  box-shadow: none;
}

.btn-outline {
  background: transparent;
  border-color: var(--ink);
  color: var(--ink);
}

/* حقول */
.field { margin-block-end: 1em; }

.field label {
  display: block;
  font-weight: 600;
  margin-block-end: 0.35em;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 48px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 0.65em 0.9em;
  font: inherit;
  color: var(--ink);
}

.field .hint {
  color: var(--ink-soft);
  font-size: 0.875rem;
  margin-block-start: 0.3em;
}

.field .error {
  color: var(--danger);
  font-size: 0.875rem;
  margin-block-start: 0.3em;
}

.field input[aria-invalid="true"] { border-color: var(--danger); }

/* كروت */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-card);
  padding: 1.25em;
}

/* صفحات الأخطاء */
.error-page {
  display: grid;
  place-items: center;
  padding-block: clamp(56px, 9vw, 120px);
}

.error-card {
  text-align: center;
  max-width: 34em;
}

.error-mark { font-size: 3rem; }

/* هيدر بسيط */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 1em;
}

.logo { font-weight: 800; font-size: 1.25rem; }

/* لوجو StoryGiftly الأفقي: الرمز + الاسم (LTR دايمًا حتى في RTL). */
.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  text-decoration: none;
  min-width: 120px;
  min-height: 44px;
}
.brand-logo img { width: 32px; height: 32px; flex: none; }
.brand-logo .wordmark {
  font-family: "Brand Head", "Segoe UI", Tahoma, sans-serif;
  font-weight: 800;
  font-size: 1.25rem;
  line-height: 1;
  white-space: nowrap;
}
.brand-logo .w1 { color: var(--ink); }
.brand-logo .w2 { color: var(--brand-strong); }

.hero { padding-block: clamp(40px, 8vw, 96px); }

/* احترام تقليل الحركة */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* مشغّل يوتيوب المخفي للأغنية (تحديث 0010) */
.yt-audio {
  /* يوتيوب بيرفض/بيوقف المشغّل لو أصغر من 200×200 أو مش جوه الشاشة، فبنسيبه بالحجم ده شبه شفاف ورا المحتوى. */
  position: fixed;
  inset-block-end: 0;
  inset-inline-start: 0;
  width: 200px;
  height: 200px;
  border: 0;
  opacity: 0.01;
  pointer-events: none;
  z-index: -1;
}

/* شريط «القفل شغال» للأدمن على الصفحات العامة (تحديث 0008) */
.gate-admin-bar {
  background: var(--ink);
  color: var(--surface);
  font-size: 0.875rem;
  text-align: center;
  padding: 0.4em 1em;
}
