/*
 * Awfar store - base styles: reset, typography, layout helpers and motion.
 * RTL by construction: logical properties only (inline-start / inline-end).
 */

*, *::before, *::after { box-sizing: border-box; }
/* clip (not hidden) so position: sticky keeps working. */
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; overflow-x: clip; }
body {
  margin: 0; font-family: var(--font); font-size: var(--fs-md); line-height: 1.65;
  color: var(--c-text); background: var(--c-surface);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3, h4 { line-height: 1.3; font-weight: 800; }
ul { margin: 0; padding: 0; list-style: none; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--c-primary) 45%, transparent); outline-offset: 2px; border-radius: var(--r-sm); }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--s-4); }
.page { padding-block: var(--s-6) var(--s-12); min-height: 60vh; }
.stack > * + * { margin-block-start: var(--s-8); }

/* Mobile: room for the bottom tab bar (same tabs as the app). */
@media (max-width: 767px) {
  body { padding-block-end: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom)); }
}

/* ---- Motion ---------------------------------------------------------- */

/* Smooth page-to-page transition (Chrome / Edge; other browsers just navigate). */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: vt-out 180ms var(--ease-out) both; }
::view-transition-new(root) { animation: vt-in 260ms var(--ease-out) both; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(8px); } }

/* Entry animation: elements with [data-reveal] fade up when they scroll in.
   store.js adds .is-visible and a per-item delay (--reveal-delay) to stagger
   lists. Without JS everything stays visible (the hidden state needs .js). */
/* An animation with "backwards" fill (not a transition) so nothing stays
   applied afterwards and hover transforms keep working. */
.js [data-reveal]:not(.is-visible) { opacity: 0; }
.js [data-reveal].is-visible { animation: reveal var(--t-slow) var(--ease-out) var(--reveal-delay, 0ms) backwards; }
@keyframes reveal { from { opacity: 0; transform: translateY(18px); } }
/* Printing, full-page captures and visitors who asked for less motion see
   every section at once instead of blank space waiting for a scroll. */
@media print, (prefers-reduced-motion: reduce) {
  .js [data-reveal]:not(.is-visible) { opacity: 1; }
  .js [data-reveal].is-visible { animation: none; }
}

/* Press feedback, like PressableScale in the app. */
.pressable { transition: transform var(--t-fast) var(--ease-out); }
.pressable:active { transform: scale(.96); }

@keyframes bump { 0% { transform: scale(1); } 35% { transform: scale(1.35); } 70% { transform: scale(.92); } 100% { transform: scale(1); } }
.is-bumping { animation: bump 460ms var(--ease-spring); }

@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
  .js [data-reveal]:not(.is-visible) { opacity: 1; }
  @view-transition { navigation: none; }
}
