/* atropi-scope: .atropi-page-download-app */
/* =====================================================================================================
   DOWNLOAD APP — page styles (page-templates/download-app.php), scoped under #hero #facts #download #mobile or
   .atropi-page-download-app. Signature: phone + QR scan laser (hero) — a 540×560 design canvas scaled by --k
   (download-app.js measures the column; media queries are the no-JS fallback). The composition is a decorative
   device scene and does not mirror in fa/ar (rtl:ignore); the copy around it does.
   Steps (data-step on .da-scan): scan → lock → store → done.
   ===================================================================================================== */

/* ---------------------------------------------------------------- hero: copy */
#hero .ac-hero-actions .link-arrow { align-self: center; margin-inline-start: 6px; }
#hero .ac-hero-actions .btn .ico:not(.btn-arrow) { width: 18px; height: 18px; }
#hero .ac-hero-meta:has(.da-redirect[hidden]) { display: none; }
#hero .da-redirect {
  position: relative; display: grid; grid-template-columns: 34px minmax(0, 1fr); align-items: center; gap: 14px;
  padding: 14px 16px; border-radius: var(--r-md); overflow: hidden;
  background: var(--surface-glass); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border: 1px solid color-mix(in srgb, var(--brand) 32%, var(--line)); box-shadow: var(--shadow-md);
}
#hero .da-redirect[hidden] { display: none; }
#hero .da-redirect-spin { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--brand-100); border-top-color: var(--brand); animation: da-spin .9s linear infinite; }
@keyframes da-spin { to { transform: rotate(360deg); } }
#hero .da-redirect-t { font-size: 16px; font-weight: 700; color: var(--ink); line-height: 1.3; }
#hero .da-redirect-x { margin-top: 3px; font-size: 14px; color: var(--muted); line-height: 1.45; }
#hero .da-redirect-bar { position: absolute; inset-inline: 0; bottom: 0; height: 3px; background: var(--grad-brand); transform-origin: 0 50%; transform: scaleX(0); }
/*rtl:raw:
[dir="rtl"] #hero .da-redirect-bar { transform-origin: 100% 50%; }
*/
#hero .da-redirect.is-on .da-redirect-bar { animation: da-count 5s linear forwards; }
@keyframes da-count { to { transform: scaleX(1); } }

/* ---------------------------------------------------------------- hero: the scan scene (540 × 560 design px) */
/*rtl:ignore*/#hero .ac-hero-visual { max-width: 540px; }
#hero .da-scan {
  --k: 1;
  position: relative; width: 100%; height: calc(560px * var(--k));
  /*rtl:ignore*/direction: ltr;
}
/*rtl:ignore*/#hero .da-scan > * { transform-origin: 0 0; }
/*rtl:ignore*/#hero .da-plate {
  position: absolute; left: calc(4px * var(--k)); top: calc(96px * var(--k)); width: 236px;
  padding: 16px 16px 18px; border-radius: 24px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg);
  transform: scale(var(--k)) rotate(-4deg); transform-origin: 0 0;
}
#hero .da-plate-qr { position: relative; width: 100%; aspect-ratio: 1; padding: 12px; border-radius: 16px; background: #fff; box-shadow: inset 0 0 0 1px rgba(10, 22, 40, .08); }
:root[data-theme="dark"] #hero .da-plate-qr { box-shadow: inset 0 0 0 1px rgba(44, 12, 59, .08); } /* brand Night */
#hero .da-plate-qr img { display: block; width: 100%; height: 100%; object-fit: contain; border-radius: 6px; }
#hero .da-plate-corners i, #hero .da-frame-corners i { position: absolute; width: 22px; height: 22px; border: 2.5px solid var(--brand); transition: border-color .35s ease, transform .5s var(--ease-out); }
/*rtl:ignore*/#hero .da-plate-corners i:nth-child(1), #hero .da-frame-corners i:nth-child(1) { left: -5px; top: -5px; border-right: 0; border-bottom: 0; border-top-left-radius: 9px; }
/*rtl:ignore*/#hero .da-plate-corners i:nth-child(2), #hero .da-frame-corners i:nth-child(2) { right: -5px; top: -5px; border-left: 0; border-bottom: 0; border-top-right-radius: 9px; }
/*rtl:ignore*/#hero .da-plate-corners i:nth-child(3), #hero .da-frame-corners i:nth-child(3) { left: -5px; bottom: -5px; border-right: 0; border-top: 0; border-bottom-left-radius: 9px; }
/*rtl:ignore*/#hero .da-plate-corners i:nth-child(4), #hero .da-frame-corners i:nth-child(4) { right: -5px; bottom: -5px; border-left: 0; border-top: 0; border-bottom-right-radius: 9px; }
#hero .da-plate-k { display: flex; align-items: center; gap: 6px; margin-top: 14px; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--brand-ink); }
#hero .da-plate-t { margin-top: 6px; font-size: 14px; line-height: 1.4; font-weight: 600; color: var(--ink); text-wrap: balance; }
[dir="rtl"] #hero .da-plate-k, [dir="rtl"] #hero .da-plate-t { direction: rtl; text-align: right; font-family: var(--font-sans); letter-spacing: 0; text-transform: none; }

/*rtl:ignore*/#hero .da-beam { position: absolute; left: calc(232px * var(--k)); top: calc(150px * var(--k)); width: calc(108px * var(--k)); height: calc(150px * var(--k)); overflow: visible; transform: none; opacity: .7; transition: opacity .4s ease; }
#hero .da-beam path { fill: none; stroke: var(--brand); stroke-width: 1.2; stroke-dasharray: 3 5; vector-effect: non-scaling-stroke; }
html.js #hero .da-beam path { animation: da-dash 1.2s linear infinite; }
@keyframes da-dash { to { stroke-dashoffset: -16; } }
#hero .da-scan[data-step="store"] .da-beam, #hero .da-scan[data-step="done"] .da-beam { opacity: 0; }

/* phone */
/*rtl:ignore*/#hero .da-phone {
  position: absolute; left: calc(268px * var(--k)); top: 0; width: 266px; height: 548px;
  padding: 8px; border-radius: 46px;
  transform: scale(var(--k)); transform-origin: 0 0;
  background: linear-gradient(150deg, #FDFEFF 0%, #D5DBE4 22%, #F4F6F9 48%, #C3CAD5 78%, #EEF1F5 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .9), inset 0 0 0 2px rgba(10, 22, 40, .1), 0 40px 70px -24px rgba(17, 52, 120, .42), 0 14px 28px -14px rgba(10, 22, 40, .28);
}
[data-theme="dark"] #hero .da-phone { background: linear-gradient(150deg, #715B7B 0%, #3E1F4C 24%, #533960 50%, #300F3F 78%, #61496D 100%); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14), inset 0 0 0 2px rgba(0, 0, 0, .5), 0 50px 90px -28px rgba(0, 0, 0, .9), 0 0 60px -20px rgba(153, 117, 176, .35); }
#hero .da-screen { position: relative; height: 100%; overflow: hidden; border-radius: 38px; background: #0A1220; box-shadow: inset 0 0 0 1px rgba(10, 22, 40, .2); }
:root[data-theme="dark"] #hero .da-screen { box-shadow: inset 0 0 0 1px rgba(44, 12, 59, .2); } /* brand Night */
#hero .da-island { position: absolute; left: 50%; top: 10px; width: 78px; height: 22px; margin-left: -39px; border-radius: 12px; background: #05080F; z-index: 6; }
#hero .da-home { position: absolute; left: 50%; bottom: 8px; width: 92px; height: 4px; margin-left: -46px; border-radius: 4px; background: rgba(255, 255, 255, .8); z-index: 6; }

/* camera view (dark in both themes — it is a camera) */
#hero .da-cam { position: absolute; inset: 0; display: grid; place-items: center; }
#hero .da-cam-blur {
  position: absolute; inset: -10%;
  background:
    radial-gradient(40% 30% at 30% 30%, rgba(75, 141, 248, .35), transparent 70%),
    radial-gradient(50% 40% at 70% 75%, rgba(146, 134, 242, .28), transparent 70%),
    radial-gradient(60% 50% at 50% 50%, #1A2740, #0A1220);
  filter: blur(6px);
}
:root[data-theme="dark"] #hero .da-cam-blur { background: radial-gradient(40% 30% at 30% 30%, rgba(163, 131, 184, .35), transparent 70%),
    radial-gradient(50% 40% at 70% 75%, rgba(167, 137, 187, .28), transparent 70%),
    radial-gradient(60% 50% at 50% 50%, #442652, #0A1220); } /* brand Night */
#hero .da-frame { position: relative; width: 168px; height: 168px; padding: 10px; border-radius: 14px; background: #fff; transform: perspective(600px) rotateX(8deg) rotateZ(-3deg); box-shadow: 0 20px 40px -12px rgba(0, 0, 0, .6); transition: transform .6s var(--ease-out); }
#hero .da-frame-qr { display: block; width: 100%; height: 100%; object-fit: contain; }
#hero .da-frame-corners i { width: 28px; height: 28px; border-width: 3px; border-color: #fff; }
#hero .da-frame-corners { position: absolute; inset: -14px; pointer-events: none; }
/*rtl:ignore*/#hero .da-laser { position: absolute; left: 6px; right: 6px; top: 8px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, transparent, #4B8DF8 20%, #9DC0FF 50%, #4B8DF8 80%, transparent); box-shadow: 0 0 12px 2px rgba(75, 141, 248, .7); opacity: 0; }
:root[data-theme="dark"] #hero .da-laser { background: linear-gradient(90deg, transparent, #A383B8 20%, #CBB9D7 50%, #A383B8 80%, transparent); box-shadow: 0 0 12px 2px rgba(163, 131, 184, .7); } /* brand Night */
html.js #hero .da-scan[data-step="scan"] .da-laser { animation: da-laser 1.5s var(--ease-io) infinite; }
@keyframes da-laser { 0% { transform: translateY(0); opacity: 0; } 12% { opacity: 1; } 50% { transform: translateY(150px); opacity: 1; } 62%, 100% { transform: translateY(150px); opacity: 0; } }
#hero .da-scan:not([data-step="scan"]) .da-frame { transform: perspective(600px) rotateX(0deg) rotateZ(0deg) scale(1.04); }
#hero .da-scan:not([data-step="scan"]) .da-frame-corners i { border-color: #22C98E; transform: scale(.86); }
#hero .da-scan:not([data-step="scan"]) .da-plate-corners i { border-color: var(--bull-vivid); }
#hero .da-found {
  position: absolute; left: 50%; bottom: 74px; z-index: 2;
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px 0 8px; border-radius: 999px;
  background: rgba(255, 255, 255, .94); color: #0A1628; box-shadow: 0 10px 24px -8px rgba(0, 0, 0, .5);
  font-size: 12.5px; white-space: nowrap;
  /* an absolutely positioned left:50% box may only take half the camera width: size the pill to its label
     (long labels — "Приложение ATROPI", "تطبيق ATROPI" — spilled the arrow out), capped by the screen */
  width: max-content; max-width: calc(100% - 24px);
  transform: translate(-50%, 16px); opacity: 0; transition: transform .5s var(--ease-spring), opacity .3s ease;
}
:root[data-theme="dark"] #hero .da-found { color: #2C0C3B; } /* brand Night */
#hero .da-found img { width: 16px; height: 16px; border-radius: 4px; flex: none; }
#hero .da-found b { font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
#hero .da-found .ico { color: #1167EB; }
:root[data-theme="dark"] #hero .da-found .ico { color: #885EA3; } /* brand Night */
#hero .da-scan[data-step="lock"] .da-found { transform: translate(-50%, 0); opacity: 1; }
#hero .da-shutter { position: absolute; left: 50%; bottom: 22px; width: 46px; height: 46px; margin-left: -23px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .85); box-shadow: inset 0 0 0 4px rgba(10, 18, 32, .9), inset 0 0 0 30px rgba(255, 255, 255, .85); }

/* store sheet */
#hero .da-sheet {
  position: absolute; left: 0; right: 0; bottom: 0; top: 64px; z-index: 4;
  padding: 10px 16px 24px; border-radius: 24px 24px 0 0;
  background: var(--surface); color: var(--ink);
  transform: translateY(104%); transition: transform .7s var(--ease-out);
}
[data-theme="dark"] #hero .da-sheet { background: var(--surface); }
#hero .da-scan[data-step="store"] .da-sheet, #hero .da-scan[data-step="done"] .da-sheet { transform: none; }
#hero .da-sheet-grab { display: block; width: 40px; height: 4px; margin: 0 auto 16px; border-radius: 4px; background: var(--line-strong); }
#hero .da-app { display: grid; grid-template-columns: 58px minmax(0, 1fr) 40px; align-items: center; gap: 12px; }
#hero .da-app-ico { display: grid; place-items: center; width: 58px; height: 58px; border-radius: 15px; background: var(--grad-ink); box-shadow: var(--shadow-md); }
#hero .da-app-ico img { width: 34px; height: 34px; border-radius: 8px; }
#hero .da-app-t { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
#hero .da-app-t b { font-size: 15px; font-weight: 700; }
#hero .da-app-t span { font-size: 10.5px; color: var(--muted); }
#hero .da-ring { position: relative; display: grid; place-items: center; width: 40px; height: 40px; color: var(--brand); }
#hero .da-ring svg:not(.ico) { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
#hero .da-ring-bg { fill: none; stroke: var(--brand-100); stroke-width: 3; }
#hero .da-ring-fg { fill: none; stroke: var(--brand); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
#hero .da-scan[data-step="store"] .da-ring-fg { stroke-dashoffset: 0; transition: stroke-dashoffset 2.1s var(--ease-io) .5s; }
#hero .da-scan[data-step="done"] .da-ring-fg { stroke-dashoffset: 0; stroke: var(--bull-vivid); }
#hero .da-ring-ok { display: none; color: var(--bull); stroke-width: 2.4; }
#hero .da-scan[data-step="done"] .da-ring-ok { display: block; }
#hero .da-scan[data-step="done"] .da-ring-dl { display: none; }
#hero .da-shots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 18px; }
#hero .da-shots i { display: block; aspect-ratio: 9 / 17; border-radius: 10px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); position: relative; overflow: hidden; }
#hero .da-shots i::before { content: ""; position: absolute; left: 12%; right: 12%; top: 22%; bottom: 34%; background: linear-gradient(transparent 30%, var(--brand-100)); border-top: 2px solid var(--brand); border-radius: 2px; }
#hero .da-shots i:nth-child(2)::before { border-top-color: var(--bull-vivid); background: linear-gradient(transparent 30%, var(--bull-bg)); top: 30%; }
#hero .da-shots i::after { content: ""; position: absolute; left: 12%; right: 12%; bottom: 14%; height: 10%; border-radius: 4px; background: linear-gradient(90deg, var(--bear-bg) 0 48%, transparent 48% 52%, var(--brand) 52%); }
#hero .da-stores { display: flex; gap: 8px; margin-top: 16px; }
#hero .da-stores span { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; border-radius: 9px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); font-size: 11px; font-weight: 650; color: var(--ink); }
html.js #hero.ac-paused .da-laser, html.js #hero.ac-paused .da-beam path, html.js #hero.ac-paused .da-redirect-spin { animation-play-state: paused; }

/* fallback scale without JS */
@media (max-width: 1199px) { #hero .da-scan { --k: .86; } }
@media (max-width: 1023px) { #hero .da-scan { --k: .94; } }
@media (max-width: 600px) { #hero .da-scan { --k: .7; } }
@media (max-width: 420px) { #hero .da-scan { --k: .64; } }
@media (max-width: 370px) { #hero .da-scan { --k: .58; } }

/* ---------------------------------------------------------------- key facts */
#facts .ac-fact-v .num { font-size: clamp(24px, 2.1vw, 34px); }
[dir="rtl"] #facts .ac-fact-v .num { unicode-bidi: plaintext; word-spacing: -.3em; } /* mono spaces are wide around Persian words */

/* ---------------------------------------------------------------- downloads: tiles get a touch more air */
#download .ac-dl { border-top: 0; padding-top: 0; }
#download .ac-dl::before { display: none; }

/* ---------------------------------------------------------------- mobile points */
#mobile .ac-feat-t { font-size: clamp(16.5px, 1.2vw, 18px); }

/* ---------------------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) {
  #hero .da-laser, #hero .da-beam path, #hero .da-redirect-spin { animation: none !important; }
  #hero .da-sheet, #hero .da-found, #hero .da-frame { transition: none; }
}
