/* ═══════════════════════════════════════════════════════════
   ALIYAH Homes — شاشة عرض
   الهوية اللونية مستخرجة من الشعار: خمري عميق #300C16
   ═══════════════════════════════════════════════════════════ */

/* ── الخطوط مضمّنة داخل الحزمة ──────────────────────────────
   تلفزيونات LG لا تضمن وجود خط عربي مناسب، والتطبيق يعمل من الملفات
   المحلية بلا إنترنت وقت الإقلاع. مولَّدة بـ tools/generate-fonts.py */
@font-face { font-family: "Noto Naskh Arabic"; src: url("assets/fonts/naskh-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Noto Naskh Arabic"; src: url("assets/fonts/naskh-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Noto Sans Arabic";  src: url("assets/fonts/sans-400.woff2")  format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Noto Sans Arabic";  src: url("assets/fonts/sans-700.woff2")  format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Noto Serif";        src: url("assets/fonts/serif-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Noto Serif";        src: url("assets/fonts/serif-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --ink:        #300C16;
  --ink-soft:   #5A2131;
  --gold:       #A8875B;
  --gold-soft:  #D9C6A6;
  --bg:         #FAF6F1;
  --bg-deep:    #F1E9E0;
  --muted:      #8B7A75;
  --line:       rgba(48, 12, 22, .10);

  --font-display: "Noto Naskh Arabic", "Amiri", "Times New Roman", serif;
  --font-ui:      "Noto Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-latin:   "Noto Serif", Georgia, "Times New Roman", serif;

  --ease: cubic-bezier(.22, .61, .36, 1);

  /* Capacitor 8 يحقن --safe-area-inset-* ديناميكياً؛ env() احتياط للمتصفح */
  --pad-top:    var(--safe-area-inset-top,    env(safe-area-inset-top, 0px));
  --pad-bottom: var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
}

body {
  font-family: var(--font-ui);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -webkit-user-select: none;
  user-select: none;
  overscroll-behavior: none;
}

/* ── الخلفية: تدرّج عاجي ناعم ────────────────────────────── */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(120% 70% at 50% -10%, #FFFDFB 0%, var(--bg) 45%, var(--bg-deep) 100%),
    var(--bg);
}

/* ═══════════ نظام الشاشات ═══════════ */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity .5s var(--ease), transform .5s var(--ease), visibility .5s;
}

.screen[data-active] {
  opacity: 1;
  visibility: visible;
  transform: none;
}

/* ═══════════ الحالة الافتراضية: الشعار ═══════════ */
#screen-idle { align-items: center; justify-content: center; }

.splash-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(22px, 2.4vw, 48px);
  padding: 0 32px;
}

.splash-logo {
  width: clamp(min(60vw, 268px), 34vw, 660px);
  height: auto;
  opacity: 0;
  transform: scale(.94);
  animation: logoIn 1.15s var(--ease) .15s forwards;
}

@keyframes logoIn {
  to { opacity: 1; transform: scale(1); }
}

/* خط ذهبي يمرّ أسفل الشعار */
.splash-rule {
  width: clamp(min(46vw, 190px), 24vw, 470px);
  height: max(1px, .1vw);
  background: var(--line);
  overflow: hidden;
  opacity: 0;
  animation: fadeIn .5s var(--ease) .8s forwards;
}

.splash-rule i {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  transform: translateX(-100%);
  animation: sweep 2.6s var(--ease) .9s infinite;
}

@keyframes sweep {
  to { transform: translateX(100%); }
}

.splash-tagline {
  text-align: center;
  opacity: 0;
  animation: riseIn .7s var(--ease) 1s forwards;
}

.splash-tagline p {
  font-family: var(--font-display);
  font-size: clamp(15px, 1.65vw, 34px);
  letter-spacing: .06em;
  color: var(--muted);
}

.splash-tagline .en {
  margin-top: 7px;
  font-family: var(--font-latin);
  font-size: clamp(10px, 1.05vw, 22px);
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--gold);
}

@keyframes fadeIn  { to { opacity: 1; } }
@keyframes riseIn  { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ═══════════ شاشة الترحيب بالاسم ═══════════ */
.page {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.welcome-page {
  align-items: center;
  justify-content: center;
  padding: calc(var(--pad-top) + 24px) clamp(22px, 3vw, 64px) calc(var(--pad-bottom) + 24px);
  overflow: hidden;
}

.welcome-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.welcome-logo {
  width: clamp(min(38vw, 156px), 17vw, 330px);
  height: auto;
  opacity: .9;
  margin-bottom: clamp(30px, 3vw, 60px);
}

.welcome-badge {
  width: clamp(88px, 9.5vw, 186px);
  height: clamp(88px, 9.5vw, 186px);
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(150deg, var(--ink) 0%, var(--ink-soft) 100%);
  color: #FDF8F3;
  font-family: var(--font-display);
  font-size: clamp(38px, 4.1vw, 80px);
  font-weight: 700;
  line-height: 1;
  padding-top: 3px;
  margin-bottom: clamp(24px, 2.5vw, 50px);
  box-shadow: 0 14px 34px -14px rgba(48,12,22,.7);
}

.welcome-greeting {
  font-family: var(--font-display);
  font-size: clamp(17px, 1.85vw, 38px);
  letter-spacing: .04em;
  color: var(--gold);
  margin-bottom: 6px;
}

.welcome-greeting .sep { opacity: .45; margin: 0 4px; }

.welcome-greeting .en {
  font-family: var(--font-latin);
  font-size: clamp(12px, 1.25vw, 26px);
  letter-spacing: .2em;
}

.welcome-name {
  font-family: var(--font-display);
  font-size: clamp(32px, 4.6vw, 96px);
  font-weight: 700;
  line-height: 1.4;
  color: var(--ink);
}

.welcome-name-en {
  margin-top: 5px;
  font-family: var(--font-latin);
  font-size: clamp(16px, 2.1vw, 44px);
  letter-spacing: .04em;
  color: var(--ink-soft);
  opacity: .72;
}

/* فاصل زخرفي */
.ornament {
  display: flex;
  align-items: center;
  gap: clamp(12px, 1.3vw, 26px);
  margin: clamp(22px, 2.3vw, 46px) 0 clamp(16px, 1.7vw, 34px);
  color: var(--gold);
}

.ornament i {
  display: block;
  width: clamp(46px, 5vw, 100px);
  height: max(1px, .1vw);
  background: linear-gradient(90deg, transparent, var(--gold-soft));
}

.ornament i:last-of-type { background: linear-gradient(90deg, var(--gold-soft), transparent); }
.ornament span { font-size: clamp(9px, .95vw, 20px); opacity: .8; }

.welcome-note {
  font-size: clamp(14px, 1.55vw, 32px);
  line-height: 1.8;
  color: var(--muted);
  max-width: 24ch;
}

.welcome-note-en {
  margin-top: 4px;
  font-family: var(--font-latin);
  font-size: clamp(11.5px, 1.2vw, 25px);
  line-height: 1.6;
  color: var(--muted);
  opacity: .8;
  max-width: 32ch;
}

/* حركة دخول عناصر شاشة الترحيب */
#screen-welcome[data-active] .welcome-logo,
#screen-welcome[data-active] .welcome-badge,
#screen-welcome[data-active] .welcome-greeting,
#screen-welcome[data-active] .welcome-name,
#screen-welcome[data-active] .welcome-name-en,
#screen-welcome[data-active] .ornament,
#screen-welcome[data-active] .welcome-note,
#screen-welcome[data-active] .welcome-note-en {
  opacity: 0;
  animation: riseIn .6s var(--ease) forwards;
}

#screen-welcome[data-active] .welcome-logo     { animation-delay: .05s; }
#screen-welcome[data-active] .welcome-badge    { animation-delay: .14s; }
#screen-welcome[data-active] .welcome-greeting { animation-delay: .22s; }
#screen-welcome[data-active] .welcome-name     { animation-delay: .28s; }
#screen-welcome[data-active] .welcome-name-en  { animation-delay: .33s; }
#screen-welcome[data-active] .ornament         { animation-delay: .40s; }
#screen-welcome[data-active] .welcome-note     { animation-delay: .46s; }
#screen-welcome[data-active] .welcome-note-en  { animation-delay: .51s; }

/* ═══════════ مؤشّر انقطاع الاتصال ═══════════ */
.link-status {
  position: fixed;
  inset-inline-start: clamp(14px, 2.2vw, 46px);
  bottom: calc(var(--pad-bottom) + clamp(14px, 2.2vw, 46px));
  z-index: 20;
  display: flex;
  align-items: center;
  gap: clamp(7px, .75vw, 15px);
  padding: clamp(7px, .75vw, 15px) clamp(13px, 1.4vw, 28px);
  border-radius: 999px;
  background: rgba(255,255,255,.78);
  backdrop-filter: blur(6px);
  border: 1px solid var(--line);
  font-size: clamp(11px, 1.15vw, 24px);
  color: var(--muted);
  animation: riseIn .4s var(--ease);
}

.link-status[hidden] { display: none; }

.link-dot {
  width: clamp(7px, .75vw, 15px);
  height: clamp(7px, .75vw, 15px);
  border-radius: 50%;
  background: #A33A3A;
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse { 50% { opacity: .3; } }

/* احترام تفضيل تقليل الحركة */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-delay: 0ms !important;
    transition-duration: .01ms !important;
  }
  .splash-logo, .splash-rule, .splash-tagline { opacity: 1; transform: none; }
}

/* ═══════════ زرّ ملء الشاشة ═══════════ */
/* يظهر فقط حين تُفتح الصفحة بمتصفّح — يخفي شريط العنوان كما يفعل F11.
   يبهت بعد سكون قصير كي لا يبقى ثابتاً على شاشة عرض. */
.fullscreen-btn {
  position: fixed;
  inset-inline-end: clamp(14px, 2.2vw, 46px);
  bottom: calc(var(--pad-bottom) + clamp(14px, 2.2vw, 46px));
  z-index: 20;
  display: flex;
  align-items: center;
  gap: clamp(8px, .85vw, 17px);
  padding: clamp(7px, .75vw, 15px) clamp(14px, 1.5vw, 30px);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .78);
  backdrop-filter: blur(6px);
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: clamp(11px, 1.15vw, 24px);
  line-height: 1.3;
  cursor: pointer;
  transition: opacity .5s var(--ease), transform .18s var(--ease),
              border-color .2s var(--ease), color .2s var(--ease);
}

.fullscreen-btn[hidden] { display: none; }
.fullscreen-btn[data-idle] { opacity: 0; pointer-events: none; }

.fullscreen-btn:hover { border-color: var(--gold-soft); color: var(--ink); }
.fullscreen-btn:active { transform: scale(.96); }

/* الريموت ينقّل التركيز بالأسهم — لا بدّ من حلقة تركيز واضحة */
.fullscreen-btn:focus-visible {
  opacity: 1;
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  color: var(--ink);
}

.fullscreen-btn svg {
  flex: none;
  width:  clamp(13px, 1.35vw, 28px);
  height: clamp(13px, 1.35vw, 28px);
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fullscreen-label {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
}

.fullscreen-label .en {
  font-family: var(--font-latin);
  font-size: .76em;
  letter-spacing: .12em;
  text-transform: uppercase;
  opacity: .7;
}

/* ═══════════ تلفزيونات LG ═══════════ */
/* الريموت السحري يُظهر مؤشّراً — لا مكان له على شاشة عرض */
body[data-webos] { cursor: none; }
body[data-webos] * { cursor: none; }
