/* The platform as an app on phones (contract 3: «منصة ويب (Web App)»): bottom tab bar instead of the top menu, the
   phone's safe areas (notch, home indicator), and the installed app's own look. */
.app-tabbar { display: none; }

@media (max-width: 768px), (display-mode: standalone) and (max-width: 1024px) {
  .site-nav { display: none; }
  body.has-site-header { padding-bottom: calc(78px + env(safe-area-inset-bottom)); }
  .app-tabbar { display: flex; position: fixed; inset-inline: 0; bottom: 0; z-index: 950; justify-content: space-around; align-items: stretch;
    padding: 0.35rem 0.4rem calc(0.35rem + env(safe-area-inset-bottom));
    background: var(--bg-top); border-top: 1px solid var(--glass-border);
    -webkit-backdrop-filter: blur(24px) saturate(170%); backdrop-filter: blur(24px) saturate(170%);
    box-shadow: 0 -8px 28px var(--shadow-dark); }

  .app-tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.18rem; min-height: 52px;
    border-radius: 14px; text-decoration: none; color: var(--text-secondary); font-size: 0.7rem; font-weight: 600;
    -webkit-tap-highlight-color: transparent; transition: color 0.25s, background 0.25s; }
  .app-tab svg { width: 1.45rem; height: 1.45rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .app-tab.is-current { color: var(--primary-light); background: var(--primary-glow); }
  html[data-theme="light"] .app-tab.is-current { color: var(--primary); }
  .app-tab.is-current svg { fill: var(--primary-glow); }
  .app-tab:active { transform: scale(0.94); }
  .footer { padding-bottom: 1.2rem; }
}

/* notch and status bar */
.site-header { padding-top: max(0.4rem, env(safe-area-inset-top)); }
body.has-site-header { padding-top: calc(52px + env(safe-area-inset-top)); }

/* the installed app: no text selection on controls, no overscroll glow, and the tab bar on tablets too */
html.is-installed-app { overscroll-behavior-y: none; }
html.is-installed-app .app-tab, html.is-installed-app .btn, html.is-installed-app .chip { -webkit-user-select: none; user-select: none; }

@media (prefers-reduced-motion: no-preference) {
  @keyframes section-arrive {
    from { opacity: .35; translate: 0 14px; }
    to { opacity: 1; translate: 0 0; }
  }
  @keyframes product-arrive {
    from { opacity: .55; translate: 0 8px; }
    to { opacity: 1; translate: 0 0; }
  }
  .admin-panel:not([hidden]), main > .page-title {
    animation: section-arrive .38s cubic-bezier(.2,.7,.2,1) both;
  }
  .cards-grid > :is(.product-card, .partner-card) { animation: product-arrive .26s ease-out backwards; }
  .cards-grid > :nth-child(2) { animation-delay: 40ms; }
  .cards-grid > :nth-child(3) { animation-delay: 80ms; }
  :is(.btn,.design-action-button,.app-tab,.like-btn) { transition-property: background-color, box-shadow, transform, scale; transition-duration: .16s; }
  :is(.btn,.design-action-button,.app-tab,.like-btn):active { scale: .965; }
}

:is(button[aria-busy="true"], .empty-state[aria-busy="true"], #searchCount[data-pending])::after {
  content: ""; display: inline-block; vertical-align: middle; margin-inline-start: .5em;
  width: .8em; height: .8em; border: 2px solid currentColor; border-inline-end-color: transparent; border-radius: 50%;
}
@media (prefers-reduced-motion: no-preference) {
  @keyframes busy-spin { to { rotate: 1turn; } }
  :is(button[aria-busy="true"], .empty-state[aria-busy="true"], #searchCount[data-pending])::after {
    animation: busy-spin .7s linear infinite;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .appearance-transition::view-transition-old(root) { animation: none; mix-blend-mode: normal; }
  .appearance-transition::view-transition-new(root) { mix-blend-mode: normal; animation: reveal-appearance .36s cubic-bezier(.22,.68,.16,1) both; }
  @keyframes reveal-appearance {
    from { clip-path: circle(0 at var(--reveal-origin)); }
    to { clip-path: circle(var(--reveal-radius) at var(--reveal-origin)); }
  }
}
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .card-image-link { overflow: hidden; }
  .card-image-link img { transition: scale .26s ease-out; }
  .card-image-link:hover img { scale: 1.12; }
}
