/* ============================================================
   site-shell + work-showcase + site-footer — الهيكل والتجاوب
   نقاط التوقف: 768px / 992px / 1600px (design.md D3)
   ============================================================ */

/* ---------------- شاشة التحميل ---------------- */
.loader-holder {
  position: fixed;
  inset: 0;
  z-index: var(--z-loader);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-s);
  background: var(--bg);
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.loader-holder.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-ring {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--accent), 0 0 0 8px var(--accent-soft);
  overflow: hidden;
  animation: loader-spin 1.4s linear infinite;
}

.loader-ring span {
  position: absolute;
  top: 0;
  left: 50%;
  width: 50%;
  height: 100%;
  transform-origin: left center;
  background: var(--accent);
  opacity: 0.25;
}

.loader-ring span:nth-child(1) { transform: rotate(0deg); opacity: 0.9; }
.loader-ring span:nth-child(2) { transform: rotate(60deg); opacity: 0.7; }
.loader-ring span:nth-child(3) { transform: rotate(120deg); opacity: 0.5; }
.loader-ring span:nth-child(4) { transform: rotate(180deg); opacity: 0.35; }
.loader-ring span:nth-child(5) { transform: rotate(240deg); opacity: 0.2; }
.loader-ring span:nth-child(6) { transform: rotate(300deg); opacity: 0.1; }

.loader-text {
  font-size: var(--fs-mini);
  letter-spacing: 0.15em;
  color: var(--text-3);
}

@keyframes loader-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------------- المؤشر المخصص ----------------
   طبقة صغيرة (120px) تتحرك بـ transform فقط — لا تُعيد رسم ملء الشاشة
   كل إطار (كان سبباً في 18fps؛ راجع design.md D6 + 5.1) */
.cursor-canvas {
  position: fixed;
  top: 0;
  left: 0;
  z-index: var(--z-cursor);
  width: 120px;
  height: 120px;
  pointer-events: none;
  display: none;
  will-change: transform;
}

/* ---------------- شريط التنقّل ---------------- */
.site-header {
  position: fixed;
  top: 0;
  inset-inline: 0;
  z-index: var(--z-nav);
  padding-inline: var(--pad-x);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-xs);
  max-width: var(--max-width);
  margin: var(--sp-s) auto 0;
  padding: 0.5rem;
  background: var(--surface-glass);
  /* ضبابية 8px: الحل المتّفق عليه بين المظهر الزجاجي والأداء —
     20px كان يسبب p95=50ms أثناء التمرير (مهمة 5.1)، و8px يعطي p95≈33ms */
  backdrop-filter: blur(8px) saturate(1.4);
  -webkit-backdrop-filter: blur(8px) saturate(1.4);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
}

.nav-list {
  display: flex;
  align-items: center;
}

.nav-link {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  font-size: var(--fs-link);
  color: var(--text-2);
  transition: color 0.2s ease, background-color 0.2s ease;
}

.nav-link:hover,
.nav-link.is-active {
  color: var(--text);
  background: var(--accent-soft);
}

.nav-key {
  display: none;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-inline-start: 0.35rem;
  font-size: 0.7rem;
  color: var(--text);
  border: 2px solid var(--border-strong);
  border-radius: 6px;
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1.1rem;
  cursor: pointer;
  transition: transform var(--speed) var(--ease-bounce), background-color 0.2s ease;
}

.theme-toggle:hover {
  transform: rotate(180deg);
}

.lang-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 0.55rem;
  border: 0;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  /* الخط الافتراضي يغطي اللاتينية والعربي معاً */
  font-family: var(--font-body);
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform var(--speed) var(--ease-bounce), background-color 0.2s ease;
}

.lang-toggle:hover {
  transform: translateY(-1px);
  background: var(--accent-soft);
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

@media (min-width: 768px) {
  .nav-link {
    padding: 0.5rem 1.1rem;
  }

  .nav-key {
    display: inline-flex;
  }
}

/* ---------------- المحتوى والقسم البطل ---------------- */
.site-main {
  position: relative;
  z-index: var(--z-content);
  width: 100%;
}

.hero {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 88vh;
  padding: calc(var(--sp-xl) + 2rem) var(--pad-x) var(--sp-l);
  text-align: center;
}

.hero-title {
  font-size: var(--fs-h1);
  line-height: 1.05;
  letter-spacing: -0.02em;
  max-width: var(--max-width);
}

.hero-line {
  display: block;
}

.hero-accent {
  color: var(--accent);
}

/* حركة دخول قصيرة للعنوان (site-interactions) */
.reveal {
  opacity: 0;
  transform: translate3d(0, 1.5rem, 0);
}

.reveal.is-in {
  animation: reveal-in 0.7s var(--ease-bounce) forwards;
}

@keyframes reveal-in {
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

/* ---------------- قسم المشاريع ---------------- */
.work {
  padding-inline: var(--pad-x);
  padding-bottom: var(--sp-xl);
}

.section-head {
  max-width: var(--max-width);
  margin: 0 auto var(--sp-m);
  text-align: center;
}

.section-eyebrow {
  display: inline-block;
  margin-bottom: var(--sp-xs);
  padding: 0.35rem 0.9rem;
  background: var(--card-wip-bg);
  border-radius: 999px;
  font-size: var(--fs-mini);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
}

/* شبكة 25 عموداً على الديسكتوب — عمود واحد تحت 992px */
.cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-s);
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
}

@media (min-width: 992px) {
  .cards {
    grid-template-columns: repeat(25, 1fr);
    gap: var(--sp-m);
  }
}

/* ---------------- التذييل ---------------- */
.site-footer {
  position: relative;
  z-index: var(--z-content);
  padding: var(--sp-l) var(--pad-x) var(--sp-m);
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
}

.footer-inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-m);
  max-width: var(--max-width);
  margin-inline: auto;
}

@media (min-width: 768px) {
  .footer-inner {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--sp-l);
  }
}

.footer-title {
  margin-bottom: var(--sp-xs);
  font-family: var(--font-body);
  font-size: var(--fs-link);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text);
}

.footer-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

/* تفاعل الروابط: ثانوي → أساسي عند التحويم/التركيز (site-footer) */
.footer-list a {
  display: inline-block;
  padding: 0.3rem 0;
  font-size: var(--fs-link);
  color: var(--text-2);
  border-radius: var(--radius-s);
  transition: color 0.2s ease;
}

.footer-list a:hover,
.footer-list a:focus-visible {
  color: var(--text);
}

.footer-note {
  font-size: var(--fs-link);
  color: var(--text-2);
  max-width: 42ch;
}

.footer-bottom {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: var(--max-width);
  margin: var(--sp-l) auto 0;
  padding-top: var(--sp-s);
  border-top: 1px solid var(--border);
}

@media (min-width: 768px) {
  .footer-bottom {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

/* colophon غير تفاعلي: لونه ثانوي ويصبح أساسي عند التحويم فقط */
.colophon,
.legal {
  font-size: var(--fs-mini);
  color: var(--text-2);
}

.colophon {
  cursor: default;
  transition: color 0.2s ease;
}

.colophon:hover {
  color: var(--text);
}
