/* =========================================================
   قصة PixMatic مع الـ scroll: الصفحة ثابتة، وwire واحد في النص
   بيتلوّى يمين وشمال وبيترسم مع الـ scroll، وعند كل لفّة بيمسك مشهد بيشرح خطوة.
   ========================================================= */
.story { position: relative; }
.story-pin { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; }
.story-pin::before { /* ورق ناعم بنقط خفيفة */
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0.55;
  background-image: radial-gradient(rgba(32, 38, 32, 0.09) 1px, transparent 1.2px); background-size: 26px 26px;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 12%, #000 88%, transparent);
          mask-image: linear-gradient(180deg, transparent, #000 12%, #000 88%, transparent);
}
.story-track { position: absolute; left: 0; top: 0; width: 100%; will-change: transform; }
.story-wire { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.story-wire .sw-base { fill: none; stroke: #202620; stroke-opacity: 0.08; stroke-width: 2; stroke-dasharray: 2 9; stroke-linecap: round; }
.story-wire .sw-main { fill: none; stroke: #202620; stroke-opacity: 0.85; stroke-width: 2.6; stroke-linecap: round; }
.story-wire .sw-glow { fill: none; stroke: #fcb017; stroke-opacity: 0.45; stroke-width: 10; stroke-linecap: round; filter: blur(6px); }
.story-wire .sw-flow { fill: none; stroke: #fcb017; stroke-width: 3.4; stroke-linecap: round; stroke-dasharray: 18 150; animation: swFlow 2.4s linear infinite; }
.story-wire .sw-flow.f2 { stroke: #fff; stroke-width: 2.4; stroke-dasharray: 6 162; animation-duration: 1.9s; animation-delay: -0.7s; }
@keyframes swFlow { from { stroke-dashoffset: 168; } to { stroke-dashoffset: 0; } }
.story-wire .sw-branch { fill: none; stroke: #e39a0b; stroke-width: 2.4; stroke-linecap: round; transition: stroke-dashoffset 0.8s cubic-bezier(0.45, 0, 0.2, 1); }
.story-wire .sw-pin { fill: #e39a0b; stroke: #fffdf7; stroke-width: 2.5; transform-box: fill-box; transform-origin: center; transform: scale(0); transition: transform 0.45s cubic-bezier(0.3, 1.6, 0.5, 1); }
.story-wire .sw-pin.is-on { transform: scale(1); }
.story-head { position: absolute; left: 0; top: 0; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; pointer-events: none; z-index: 5;
  background: radial-gradient(circle, #fff 0 22%, #fcb017 30% 60%, rgba(252, 176, 23, 0) 62%); box-shadow: 0 0 22px 6px rgba(252, 176, 23, 0.55); will-change: transform; }
.story-head::after { content: ''; position: absolute; inset: -8px; border-radius: 50%; border: 1.5px solid rgba(227, 154, 11, 0.6); animation: swHead 1.8s ease-out infinite; }
@keyframes swHead { from { transform: scale(0.5); opacity: 1; } to { transform: scale(2.2); opacity: 0; } }

/* أول الـ wire: نقطة PixMatic */
.story-start { position: absolute; display: flex; align-items: center; gap: 10px; padding: 9px 16px 9px 9px; border-radius: 999px; transform: translate(-50%, 0);
  background: #fffdf7; border: 1.5px solid #202620; box-shadow: 4px 4px 0 #202620; font: 700 12px/1 Inter, sans-serif; letter-spacing: 0.14em; color: #202620; }
.story-start img { width: 26px; height: 26px; }

/* كل مشهد: صورة + كلام على الناحية التانية من الـ wire */
.st-visual, .st-caption { position: absolute; opacity: 0; will-change: transform, opacity; }
.st-caption { max-width: 420px; }
.st-num { display: inline-flex; align-items: center; gap: 10px; font: 700 12px/1 Inter, sans-serif; letter-spacing: 0.2em; color: #995900; margin-bottom: 14px; }
.st-num::before { content: ''; width: 26px; height: 1.5px; background: currentColor; }
.st-title { font-family: 'Instrument Serif', Georgia, serif; font-weight: 400; font-size: clamp(34px, 3.6vw, 54px); line-height: 1.02; letter-spacing: -0.01em; color: #202620; }
.st-title em { font-style: italic; color: #995900; }
.st-body { margin-top: 14px; font-size: 16px; line-height: 1.65; color: #5b564c; max-width: 380px; }
body[dir="rtl"] .st-title { font-family: 'Cairo', sans-serif; font-weight: 800; font-size: clamp(28px, 2.8vw, 42px); line-height: 1.25; }
body[dir="rtl"] .st-title em { font-style: normal; }
body[dir="rtl"] .st-num { letter-spacing: 0.05em; font-family: 'Cairo', sans-serif; }

/* كروت المشاهد */
.sv-card { border-radius: 22px; background: #fffdf7; border: 1.5px solid #202620; box-shadow: 8px 8px 0 #202620; overflow: hidden; }
.sv-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1.5px solid #202620; font: 600 13px/1 Inter, sans-serif; color: #202620; background: #fff; }
.sv-head small { margin-inline-start: auto; color: #8a8478; font-weight: 500; }
.sv-ico { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; font: 800 11px/1 Inter, sans-serif; color: #fff; }
.sv-ico.xl { background: #1d7a45; } .sv-ico.ps { background: #001e36; color: #31a8ff; }

/* 1. الشيت */
.sv-table { width: 100%; border-collapse: collapse; font: 500 12.5px/1.2 Inter, sans-serif; color: #202620; }
.sv-table th { text-align: start; font-weight: 700; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: #6b665b; padding: 10px 14px; background: #f6f1e6; border-bottom: 1px solid #e6dfd0; }
.sv-table td { padding: 9px 14px; border-bottom: 1px solid #efe9dc; white-space: nowrap; }
.sv-table tr.row { opacity: 0; transform: translateY(8px); transition: opacity 0.45s, transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1); }
.sv-table tr.row.is-on { opacity: 1; transform: none; }
.sv-table td.ph img { width: 22px; height: 22px; vertical-align: middle; }
.sv-table td.pr { font-weight: 700; color: #995900; }
.sv-more { padding: 10px 14px; font: 600 12px/1 Inter, sans-serif; color: #8a8478; }

/* 2 و 3. شكل البرنامج نفسه: كارت الشيت وجنبه كارت الـ PSD والـ wires بينهم */
.sa-fit { position: relative; direction: ltr; }
.sa-app { position: absolute; left: 0; top: 0; width: 620px; transform-origin: 0 0; border-radius: 26px; padding: 0 0 6px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(250, 246, 237, 0.85)), radial-gradient(rgba(32, 38, 32, 0.12) 1px, transparent 1.2px) 0 0 / 18px 18px;
  border: 1.5px solid #202620; box-shadow: 8px 8px 0 #202620; font-family: Inter, -apple-system, 'Segoe UI', sans-serif; color: #202620; }
.sa-bar { display: flex; align-items: center; gap: 12px; margin: 12px 12px 0; padding: 9px 10px 9px 14px; border-radius: 16px;
  background: rgba(255, 255, 255, 0.85); border: 1px solid rgba(32, 38, 32, 0.08); box-shadow: 0 8px 22px -14px rgba(32, 38, 32, 0.4); font-size: 12px; }
.sa-logo { display: flex; align-items: center; gap: 6px; font-weight: 800; letter-spacing: 0.04em; font-size: 11px; }
.sa-logo img { width: 18px; height: 18px; }
.sa-logo i { font-style: normal; font-size: 8.5px; letter-spacing: 0.12em; padding: 3px 6px; border-radius: 999px; border: 1px solid rgba(32, 38, 32, 0.25); color: #6b665b; }
.sa-space { font-weight: 600; color: #202620; }
.sa-row { margin-left: auto; display: flex; align-items: center; gap: 10px; padding: 5px 10px; border-radius: 999px; background: #f6f1e6; font-weight: 600; font-variant-numeric: tabular-nums; }
.sa-row b { color: #8a8478; font-weight: 500; }
.sa-rowtxt { min-width: 104px; text-align: center; }
.sa-export { padding: 7px 12px; border-radius: 10px; background: #202620; color: #fff; font-weight: 700; font-size: 11.5px; }
.sa-canvas { position: relative; display: flex; justify-content: space-between; align-items: flex-start; padding: 18px; }
.sa-wires { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; z-index: 3; }
.sa-w { fill: none; stroke: #202620; stroke-width: 1.6; stroke-linecap: round; stroke-opacity: 0.85; transition: stroke-dashoffset 0.25s linear; }
.sa-w.gold { stroke: #e39a0b; stroke-width: 1.9; }
.sa-wf { fill: none; stroke: #fcb017; stroke-width: 2.6; stroke-linecap: round; stroke-dasharray: 10 400; opacity: 0; transition: opacity 0.3s; }
.sa-wf.is-on { opacity: 1; animation: saFlow 1.8s cubic-bezier(0.5, 0, 0.6, 1) infinite; }
@keyframes saFlow { from { stroke-dashoffset: 410; } to { stroke-dashoffset: 0; } }
.sa-node { position: relative; border-radius: 20px; background: linear-gradient(rgba(255, 255, 255, 0.82), rgba(255, 253, 247, 0.6));
  border: 1px solid rgba(255, 255, 255, 0.9); box-shadow: inset 0 1px 0 #fff, 0 20px 44px -16px rgba(32, 38, 32, 0.28), 0 2px 6px rgba(32, 38, 32, 0.06); }
.sa-sheet { width: 236px; }
.sa-psd { width: 250px; }
.sa-nh { display: flex; align-items: center; gap: 9px; padding: 10px 12px; border-bottom: 1px solid rgba(32, 38, 32, 0.08); }
.sa-ni { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: rgba(255, 255, 255, 0.85); border: 1px solid rgba(32, 38, 32, 0.08); color: #3a413a; flex: none; }
.sa-ni svg { width: 15px; height: 15px; }
.sa-nh h4 { font-size: 12px; font-weight: 600; line-height: 1.3; margin: 0; }
.sa-nh small { display: block; font-size: 9.5px; color: #9a9385; }
.sa-cols { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 8px; }
.sa-col { position: relative; padding: 7px 22px 7px 10px; border-radius: 8px; background: #fff; border: 1px solid rgba(32, 38, 32, 0.1); transition: background 0.35s, border-color 0.35s; }
.sa-col.is-linked { background: rgba(252, 176, 23, 0.14); border-color: rgba(227, 154, 11, 0.32); }
.sa-cn { display: flex; align-items: center; gap: 6px; }
.sa-cn b { font-size: 11.5px; font-weight: 600; }
.sa-badge { font-size: 7.5px; font-weight: 700; padding: 2px 5px; border-radius: 4px; color: #6b665b; background: #f6f0e2; border: 1px solid rgba(32, 38, 32, 0.12); letter-spacing: 0.04em; }
.sa-val { display: block; font-size: 10.5px; color: #6b665b; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sa-link { display: block; font-size: 10px; font-weight: 500; color: #9a5b00; margin-top: 3px; opacity: 0; transform: translateY(-3px); transition: opacity 0.35s, transform 0.35s; }
.sa-col.is-linked .sa-link { opacity: 1; transform: none; }
.sa-sock { position: absolute; right: 7px; top: 50%; width: 10px; height: 10px; margin-top: -5px; border-radius: 50%; background: #fff; border: 1.5px solid #202620; transition: background 0.3s; }
.sa-col.is-linked .sa-sock { background: #202620; }
.sa-prev { position: relative; padding: 10px; }
.sa-tpl { position: relative; aspect-ratio: 4 / 5; border-radius: 12px; overflow: hidden; background: linear-gradient(165deg, #fff7e6, #f1e1bf); border: 1px solid #e6d6b4; }
.sa-store { position: absolute; left: 9%; top: 6%; font-size: 8.5px; font-weight: 800; letter-spacing: 0.22em; color: #202620; }
.sa-ly { position: absolute; border: 1.2px dashed rgba(153, 89, 0, 0.6); border-radius: 6px; background: rgba(255, 255, 255, 0.4); transition: border-color 0.35s, background 0.35s; }
.sa-ly em { position: absolute; inset: 0; display: grid; place-items: center; font-style: normal; font-size: 9px; font-weight: 600; color: #995900; transition: opacity 0.3s; }
.sa-ly span, .sa-ly img { opacity: 0; transition: opacity 0.4s, transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1); transform: translateY(4px); }
.sa-ly.is-filled { border-color: rgba(227, 154, 11, 0.55); border-style: solid; background: transparent; }
.sa-ly.is-filled em { opacity: 0; }
.sa-ly.is-filled span, .sa-ly.is-filled img { opacity: 1; transform: none; }
.sa-dot { position: absolute; left: -4px; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: #fff; border: 1.5px solid #202620; z-index: 2; }
.sa-ly.is-filled .sa-dot { background: #202620; }
.ly-img .sa-dot { border-color: #e39a0b; } .ly-img.is-filled .sa-dot { background: #e39a0b; }
.ly-img { left: 18%; right: 18%; top: 13%; height: 44%; display: grid; place-items: center; }
.ly-img img { width: 78%; max-height: 92%; filter: drop-shadow(0 10px 10px rgba(32, 38, 32, 0.18)); }
.ly-brand { left: 9%; width: 42%; top: 62%; height: 7%; }
.ly-brand span { position: absolute; left: 6px; top: 50%; margin-top: -6px; font-size: 9px; font-weight: 700; letter-spacing: 0.18em; color: #995900; line-height: 12px; }
.ly-model { left: 9%; right: 9%; top: 71%; height: 10%; }
.ly-model span { position: absolute; left: 6px; top: 50%; margin-top: -10px; font-family: 'Instrument Serif', Georgia, serif; font-size: 17px; line-height: 20px; color: #202620; white-space: nowrap; }
.ly-price { right: 8%; width: 42%; bottom: 5%; height: 10%; }
.ly-price.is-filled { background: #202620; border-color: #202620; }
.ly-price span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 3px; white-space: nowrap; font-size: 12px; font-weight: 800; color: #fff; }
.ly-price span small { font-size: 7px; color: #fcb017; }
.sa-tpl.is-swap .sa-ly span, .sa-tpl.is-swap .sa-ly img { animation: saSwap 0.45s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes saSwap { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.sa-toast { position: absolute; left: 50%; bottom: -18px; transform: translate(-50%, 10px); display: flex; align-items: center; gap: 8px; white-space: nowrap;
  padding: 9px 14px; border-radius: 12px; background: #202620; color: #fff; font-size: 11.5px; font-weight: 600; box-shadow: 0 14px 30px -12px rgba(32, 38, 32, 0.6);
  opacity: 0; transition: opacity 0.4s, transform 0.5s cubic-bezier(0.3, 1.4, 0.5, 1); }
.sa-toast i { width: 8px; height: 8px; border-radius: 50%; background: #fcb017; box-shadow: 0 0 0 4px rgba(252, 176, 23, 0.25); }
.sa-app.is-saved .sa-toast { opacity: 1; transform: translate(-50%, 0); }
body[dir="rtl"] .sa-toast span { font-family: 'Cairo', sans-serif; }

/* 4. التصميم اللي بيتغير */
.sv-design { position: relative; aspect-ratio: 4 / 5; border-radius: 22px; overflow: hidden; border: 1.5px solid #202620; box-shadow: 8px 8px 0 #202620; background: linear-gradient(165deg, #fffaf0, #f5e6c8); }
.sv-slide { position: absolute; inset: 0; padding: 22px; display: flex; flex-direction: column; opacity: 0; transform: scale(1.03); transition: opacity 0.45s, transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1); }
.sv-slide.is-on { opacity: 1; transform: none; }
.sv-slide .store { font: 800 13px/1 Inter, sans-serif; letter-spacing: 0.24em; color: #202620; }
.sv-slide .img { flex: 1; display: grid; place-items: center; }
.sv-slide .img img { width: 62%; max-height: 100%; filter: drop-shadow(0 18px 18px rgba(32, 38, 32, 0.18)); }
.sv-slide .brand { font: 700 11px/1 Inter, sans-serif; letter-spacing: 0.18em; color: #995900; }
.sv-slide .model { font-family: 'Instrument Serif', Georgia, serif; font-size: 30px; line-height: 1.05; color: #202620; margin-top: 6px; }
.sv-slide .price { position: absolute; right: 18px; bottom: 18px; padding: 8px 12px; border-radius: 10px; background: #202620; color: #fff; font: 800 20px/1 Inter, sans-serif; }
.sv-slide .price small { font-size: 11px; color: #fcb017; margin-left: 3px; }
.sv-rowtag { position: absolute; top: -14px; inset-inline-end: 18px; z-index: 2; padding: 8px 12px; border-radius: 999px; background: #fcb017; border: 1.5px solid #202620; font: 700 12px/1 Inter, sans-serif; color: #202620; box-shadow: 3px 3px 0 #202620; font-variant-numeric: tabular-nums; }

/* 5. مئات التصاميم */
.sv-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 7px; }
.sv-mini { aspect-ratio: 4 / 5; border-radius: 8px; border: 1px solid rgba(32, 38, 32, 0.18); background: linear-gradient(165deg, #fffaf0, #f3e3c3); display: grid; place-items: center; position: relative; overflow: hidden;
  opacity: 0; transform: translateY(10px) scale(0.85); transition: opacity 0.35s, transform 0.45s cubic-bezier(0.3, 1.4, 0.5, 1); }
.sv-mini.is-on { opacity: 1; transform: none; }
.sv-mini img { width: 58%; }
.sv-mini::after { content: ''; position: absolute; left: 12%; right: 30%; bottom: 10%; height: 9%; border-radius: 3px; background: #202620; }
.sv-count { display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px; }
.sv-count b { font: 800 clamp(46px, 5vw, 72px)/1 Inter, sans-serif; letter-spacing: -0.03em; color: #202620; font-variant-numeric: tabular-nums; }
.sv-count span { font: 600 15px/1.3 Inter, sans-serif; color: #6b665b; }

/* 6. التصدير */
.sv-out { text-align: center; }
.sv-formats { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.sv-fmt { min-width: 92px; padding: 16px 18px; border-radius: 16px; background: #fffdf7; border: 1.5px solid #202620; box-shadow: 4px 4px 0 #202620; font: 800 16px/1 Inter, sans-serif; color: #202620;
  opacity: 0; transform: translateY(16px); transition: opacity 0.4s, transform 0.5s cubic-bezier(0.3, 1.4, 0.5, 1); }
.sv-fmt.is-on { opacity: 1; transform: none; }
.sv-fmt small { display: block; margin-top: 6px; font: 500 11px/1 Inter, sans-serif; color: #8a8478; }
.sv-fmt { position: relative; transition: opacity 0.4s, transform 0.5s cubic-bezier(0.3, 1.4, 0.5, 1), background 0.3s, box-shadow 0.3s; }
.sv-fmt .ck { position: absolute; top: -8px; right: -8px; width: 20px; height: 20px; border-radius: 50%; background: #202620; transform: scale(0); transition: transform 0.35s cubic-bezier(0.3, 1.6, 0.5, 1); }
.sv-fmt .ck::after { content: ''; position: absolute; left: 7px; top: 4px; width: 5px; height: 9px; border: solid #fcb017; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.sv-fmt.is-sel { background: #fcb017; }
.sv-fmt.is-sel small { color: #4a3a12; }
.sv-fmt.is-sel .ck { transform: scale(1); }
.sv-cta { display: flex; justify-content: center; gap: 14px; margin-top: 34px; flex-wrap: wrap; opacity: 0; transform: translateY(12px); transition: opacity 0.5s, transform 0.5s; }
.sv-cta.is-on { opacity: 1; transform: none; }

/* موبايل: الـ wire على الجنب، والمشاهد جنبه */
@media (max-width: 899px) {
  .st-caption { max-width: none; }
  .st-title { font-size: 34px; }
  .st-body { font-size: 15px; }
  .sv-grid { grid-template-columns: repeat(6, 1fr); }
  .sv-fmt { min-width: 74px; padding: 12px 12px; font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .story-wire .sw-flow, .story-head::after { animation: none; }
}
body[dir="rtl"] .sv-count span, body[dir="rtl"] .sv-more, body[dir="rtl"] .sv-head span, body[dir="rtl"] .sv-head small, body[dir="rtl"] .sv-rowtag { font-family: 'Cairo', sans-serif; }
@media (max-width: 899px) { .sv-mini:nth-child(n+25) { display: none; } }
