/*
 * WebPlus — Chapter 3: Build Scene Styles (مشهد البناء المثبّت)
 * قسم مثبّت (pin) 520vh بست مراحل تفاعلية وكود PHP حي وعدّادات
 * بادئة الأصناف: wx-
 */

.wx-build-section {
  position: relative;
  background-color: var(--wx-ink);
  color: var(--wx-snow);
  min-height: 100vh;
  overflow: hidden;
}

.wx-build-pin-container {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  position: relative;
  padding-block: 40px var(--wx-sec-pad-bottom, clamp(96px, 9.5vw, 150px));
}

.wx-build-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.35fr;
  gap: clamp(32px, 5vw, 64px);
  align-items: center;
  width: 100%;
}

/* ── عمود قائمة المراحل (يمين) ─────────────────────── */
.wx-build-sidebar {
  display: flex;
  flex-direction: column;
}

.wx-build-progress-bar {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  margin-block: 16px 28px;
  overflow: hidden;
}

.wx-build-progress-fill {
  height: 100%;
  width: 16.66%;
  background: var(--wx-gradient-accent);
  transition: width 0.2s linear;
}

.wx-build-stages-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.wx-build-stage-nav-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 14px 18px;
  background: rgba(7, 21, 48, 0.4);
  border: 1px solid var(--wx-border-dark);
  border-radius: var(--wx-radius-md);
  transition: all 0.35s var(--wx-ease-smooth);
  cursor: pointer;
}

.wx-build-stage-nav-item:hover {
  background: rgba(18, 48, 107, 0.5);
}

.wx-build-stage-nav-item.is-active {
  background: rgba(0, 102, 255, 0.16);
  border-color: var(--wx-blue);
  box-shadow: 0 0 24px rgba(0, 102, 255, 0.25);
  transform: translateX(-6px);
}

[dir="ltr"] .wx-build-stage-nav-item.is-active {
  transform: translateX(6px);
}

.wx-stage-num {
  font-family: var(--wx-font-lat);
  font-size: 16px;
  font-weight: 800;
  color: var(--wx-sky);
  line-height: 1.2;
}

.wx-stage-content h4 {
  font-size: 15px;
  font-weight: 700;
  color: var(--wx-snow);
  margin-bottom: 4px;
}

.wx-stage-content p {
  font-size: 13px;
  color: var(--wx-slate-400);
  line-height: 1.6;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.35s ease, opacity 0.35s ease, margin-top 0.35s ease;
  margin: 0;
}

.wx-build-stage-nav-item.is-active .wx-stage-content p {
  max-height: 80px;
  opacity: 1;
  margin-top: 4px;
}

/* ── عمود المتصفح الحاوي الكبير (يسار) ─────────────── */
.wx-build-stage-col {
  width: 100%;
}

.wx-stage-browser {
  width: 100%;
  background: rgba(7, 21, 48, 0.95);
  border: 1px solid var(--wx-border-dark);
  border-radius: var(--wx-radius-xl);
  box-shadow: var(--wx-shadow-deep);
  overflow: hidden;
  position: relative;
  transition: box-shadow 0.5s ease, transform 0.5s ease;
  container-type: inline-size;
}

.wx-stage-browser.is-live {
  box-shadow: 0 30px 90px rgba(0, 102, 255, 0.35), 0 0 50px rgba(56, 189, 248, 0.25);
  transform: translateY(-6px);
}

.wx-stage-browser-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: rgba(5, 14, 36, 0.9);
  border-bottom: 1px solid var(--wx-border-dark);
}

.wx-stage-body {
  position: relative;
  min-height: 440px;
  padding: 28px;
  background: linear-gradient(180deg, #071530 0%, #050E24 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* 1. طبقة الـ Wireframe (منقّط) */
.wx-wireframe-layer {
  position: absolute;
  inset: 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.wx-wf-box {
  border: 1.5px dashed rgba(56, 189, 248, 0.4);
  border-radius: 6px;
}

.wx-wf-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  flex: 1;
}

/* 2. طبقة التصميم والـ Skeletons */
.wx-design-layer {
  position: absolute;
  inset: 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.wx-skel-hero {
  background: linear-gradient(90deg, #12306B 0%, #0B1F44 100%);
  border-radius: 8px;
  padding: 20px;
}

.wx-skel-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  flex: 1;
}

.wx-skel-card {
  background: rgba(18, 48, 107, 0.45);
  border: 1px solid var(--wx-border-dark);
  border-radius: 8px;
  padding: 16px;
}

/* 3. لوحة الكود الحقيقي المنزلقة */
.wx-code-panel {
  position: absolute;
  inset: 20px;
  background: #020817;
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  z-index: 10;
  padding: 20px 24px;
  font-family: var(--wx-font-mono);
  font-size: 13px;
  line-height: 1.65;
  color: #F8FAFC;
  transform: translateY(110%);
  transition: transform 0.45s var(--wx-ease-expo), opacity 0.45s ease;
  opacity: 0;
  direction: ltr;
  text-align: left;
  overflow: hidden;
}

.wx-code-token-kw   { color: #38BDF8; font-weight: 700; }
.wx-code-token-fn   { color: #FBBF24; }
.wx-code-token-str  { color: #34D399; }
.wx-code-token-com  { color: #64748B; font-style: italic; }

/* 4. طبقة المحتوى العربي الحقيقي */
.wx-content-layer {
  position: absolute;
  inset: 28px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: 5;
}

/* 5. طبقة عدّادات السرعة الأربعة */
.wx-speed-gauges-layer {
  position: absolute;
  inset: 0;
  background: rgba(5, 14, 36, 0.88);
  backdrop-filter: blur(8px);
  z-index: 15;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.wx-gauges-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(12px, 3vw, 24px);
}

.wx-gauge-item {
  text-align: center;
}

.wx-gauge-circle {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 4px solid var(--wx-success);
  margin: 0 auto 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--wx-font-lat);
  font-size: 24px;
  font-weight: 900;
  color: var(--wx-success);
  box-shadow: 0 0 20px rgba(34, 197, 94, 0.35);
}

.wx-gauge-label {
  font-size: 11px;
  color: var(--wx-slate-300);
}

/* 6. شارة الإطلاق الحية (LIVE) */
.wx-live-badge-glow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid var(--wx-success);
  color: var(--wx-success);
  font-family: var(--wx-font-lat);
  font-size: 11px;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: var(--wx-radius-pill);
}

.wx-live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--wx-success);
  box-shadow: 0 0 8px var(--wx-success);
  animation: wxPulse 1.5s infinite;
}

/* ════════════════════════════════════════════════
   حالات المراحل (STATE MACHINE CLASSES)
   ════════════════════════════════════════════════ */
/* المرحلة 1: Wireframe */
.wx-stage-step-1 .wx-wireframe-layer { opacity: 1; }

/* المرحلة 2: التصميم */
.wx-stage-step-2 .wx-wireframe-layer { opacity: 0.18; }
.wx-stage-step-2 .wx-design-layer    { opacity: 1; }

/* المرحلة 3: البرمجة (لوحة الكود) */
.wx-stage-step-3 .wx-design-layer    { opacity: 0.35; transform: scale(0.96); }
.wx-stage-step-3 .wx-code-panel      { transform: translateY(0); opacity: 1; }

/* المرحلة 4: المحتوى */
.wx-stage-step-4 .wx-code-panel      { transform: translateY(-110%); opacity: 0; }
.wx-stage-step-4 .wx-content-layer   { opacity: 1; }

/* المرحلة 5: عدّادات السرعة */
.wx-stage-step-5 .wx-content-layer       { opacity: 1; }
.wx-stage-step-5 .wx-speed-gauges-layer  { opacity: 1; }

/* المرحلة 6: الإطلاق */
.wx-stage-step-6 .wx-content-layer       { opacity: 1; }
.wx-stage-step-6 .wx-speed-gauges-layer  { opacity: 0; }
.wx-stage-step-6 .wx-stage-browser       { box-shadow: 0 30px 90px rgba(0, 102, 255, 0.45); transform: translateY(-6px); }

/* ════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .wx-build-grid {
    grid-template-columns: 1fr;
  }
  .wx-stage-browser {
    max-height: 48svh;
  }
  .wx-stage-body {
    min-height: 320px;
    padding: 16px;
  }
  .wx-gauges-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
