/* Shared shopper shell: one header and one phone tab bar on every shopper page. */
:root {
  --app-paper: oklch(98.2% 0.006 85);
  --app-surface: oklch(95.7% 0.01 85);
  --app-ink: oklch(27% 0.012 115);
  --app-muted: oklch(49% 0.015 115);
  --app-line: oklch(86.5% 0.012 95);
  --app-accent: oklch(85% 0.145 91);
  --app-green: oklch(40% 0.047 157);
  --app-ease: cubic-bezier(.2, .8, .2, 1);
  --app-font: "Hanken Grotesk", "IBM Plex Sans Arabic", sans-serif;
}
html[lang="ar"] { --app-font: "IBM Plex Sans Arabic", "Hanken Grotesk", sans-serif; }

.app-visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.app-icon {
  width: 22px; height: 22px; flex: 0 0 auto;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
html[dir="rtl"] .app-header-link .app-icon { transform: scaleX(-1); }

/* Header */
.app-header {
  position: sticky; top: 0; z-index: 60;
  padding-top: env(safe-area-inset-top);
  background: color-mix(in oklch, var(--app-paper) 90%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--app-line);
  color: var(--app-ink);
  font-family: var(--app-font);
  transition: transform .26s var(--app-ease), border-color .2s ease;
}
.app-header-inner {
  width: min(1320px, calc(100% - 48px)); min-height: 72px; margin-inline: auto;
  display: flex; align-items: center; gap: 20px;
}
.app-logo {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px;
  color: var(--app-ink); text-decoration: none;
  font: 800 28px/1 "Hanken Grotesk", sans-serif; letter-spacing: -.06em;
}
.app-logo svg { width: 30px; height: 30px; flex: 0 0 auto; }
.app-logo-dot { color: var(--app-ink); }
.app-desktop-nav { display: flex; align-items: center; gap: 2px; margin-inline-start: 12px; }
.app-desktop-nav a {
  position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding-inline: 12px;
  border-radius: 999px; color: var(--app-muted); font-size: .9375rem; font-weight: 550; text-decoration: none;
  transition: color .15s ease, background-color .15s ease;
}
.app-desktop-nav a:hover { color: var(--app-ink); }
.app-desktop-nav a, .app-header-link { white-space: nowrap; }
/* Small laptops: six destinations stay on one line; "For stores" lives on the account page and footer. */
@media (min-width: 861px) and (max-width: 1080px) {
  .app-header-inner { gap: 12px; }
  .app-desktop-nav { margin-inline-start: 4px; }
  .app-desktop-nav a { padding-inline: 9px; font-size: .875rem; }
  .app-header-link { display: none; }
}
@media (min-width: 861px) and (max-width: 960px) {
  .app-header-inner { gap: 8px; }
  .app-desktop-nav a { padding-inline: 7px; }
  .app-header-actions { gap: 6px; }
}
.app-desktop-nav a[aria-current="page"] { color: var(--app-ink); background: var(--app-surface); font-weight: 700; }
.app-count {
  min-width: 20px; height: 20px; padding-inline: 6px; border-radius: 999px;
  background: var(--app-green); color: #fff; font-size: 11px; font-weight: 700; line-height: 20px; text-align: center;
}
.app-header-actions { display: flex; align-items: center; gap: 8px; margin-inline-start: auto; }
.app-header-link {
  display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding-inline: 10px;
  color: var(--app-muted); font-size: .875rem; font-weight: 600; text-decoration: none; white-space: nowrap;
}
.app-header-link:hover { color: var(--app-ink); }
.app-header-link .app-icon { width: 15px; height: 15px; }
.app-icon-button {
  display: grid; place-items: center; width: 44px; height: 44px; padding: 0;
  border: 1px solid var(--app-line); border-radius: 50%; background: transparent; color: var(--app-ink);
  font: 600 15px/1 var(--app-font); text-decoration: none; cursor: pointer;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.app-icon-button .app-icon { width: 20px; height: 20px; }
.app-icon-button[aria-current="page"] { background: var(--app-ink); border-color: var(--app-ink); color: var(--app-paper); }
.app-header :is(a, button):focus-visible,
.app-tabbar a:focus-visible,
.app-more a:focus-visible { outline: 3px solid var(--app-green); outline-offset: 2px; }

/* Phone tab bar (hidden above 860px) */
.app-tabbar { display: none; }

/* "More from FRPPR" grouped list on the account page */
.app-more { margin-block: 8px 48px; font-family: var(--app-font); }
.app-more h2 { margin: 0 0 12px; font-size: 1rem; font-weight: 700; color: var(--app-muted); }
.app-more ul {
  list-style: none; margin: 0; padding: 0; overflow: hidden;
  border: 1px solid var(--app-line); border-radius: 16px; background: #fff;
}
.app-more li + li { border-top: 1px solid var(--app-line); }
.app-more a {
  display: flex; align-items: center; gap: 14px; min-height: 56px; padding: 10px 16px;
  color: var(--app-ink); text-decoration: none;
}
.app-more a > span:not(.app-more-icon) { flex: 1; min-width: 0; display: grid; }
.app-more strong { font-size: .9375rem; font-weight: 650; }
.app-more small { color: var(--app-muted); font-size: .8125rem; line-height: 1.5; }
.app-more-icon {
  display: grid; place-items: center; width: 36px; height: 36px; flex: 0 0 36px;
  border-radius: 10px; background: var(--app-surface); color: var(--app-ink);
}
.app-more-icon .app-icon { width: 19px; height: 19px; }
.app-more a > .app-icon { width: 16px; height: 16px; color: var(--app-muted); }
html[dir="rtl"] .app-more a > .app-icon { transform: scaleX(-1); }
.app-more a:hover { background: var(--app-surface); }

@media (max-width: 860px) {
  body.app-page { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
  .app-header-inner { width: calc(100% - 32px); min-height: 56px; gap: 8px; }
  .app-header.is-hidden { transform: translateY(-100%); }
  .app-header:not(.is-scrolled) { border-bottom-color: transparent; }
  .app-desktop-nav, .app-header-link { display: none; }
  .app-logo { font-size: 24px; gap: 6px; }
  .app-logo svg { width: 26px; height: 26px; }
  .app-header-actions { gap: 6px; }

  .app-tabbar {
    position: fixed; inset-inline: 0; bottom: 0; z-index: 60;
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: end;
    padding: 4px max(6px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(6px, env(safe-area-inset-left));
    background: color-mix(in oklch, var(--app-paper) 93%, transparent);
    -webkit-backdrop-filter: saturate(1.4) blur(16px);
    backdrop-filter: saturate(1.4) blur(16px);
    border-top: 1px solid var(--app-line);
    font-family: var(--app-font);
  }
  .app-tabbar a {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px;
    min-width: 0; min-height: 58px; padding: 6px 2px 6px;
    color: var(--app-muted); font-size: 12px; line-height: 1.3; font-weight: 550; text-decoration: none;
    -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  }
  .app-tab-icon { position: relative; display: grid; }
  .app-tab-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .app-tabbar a[aria-current="page"] { color: var(--app-ink); font-weight: 750; }
  .app-tabbar a[aria-current="page"] .app-icon { stroke-width: 2.2; }
  .app-tabbar a[aria-current="page"]:not(.app-tab-mirror)::before {
    content: ""; position: absolute; top: -4px; width: 24px; height: 3px;
    border-radius: 0 0 3px 3px; background: var(--app-accent);
  }
  .app-tab-badge {
    position: absolute; top: -7px; inset-inline-end: -11px; min-width: 18px; height: 18px; padding-inline: 5px;
    border-radius: 999px; background: var(--app-green); color: #fff; box-shadow: 0 0 0 2px var(--app-paper);
    font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
  }
  .app-mirror {
    position: relative; display: grid; place-items: center; width: 54px; height: 58px; margin-top: -26px;
    border-radius: 27px 27px 14px 14px; color: var(--app-ink);
    background:
      linear-gradient(135deg, transparent 52%, rgb(255 255 255 / 42%) 53% 57%, transparent 58% 63%, rgb(255 255 255 / 30%) 64% 66%, transparent 67%),
      var(--app-accent);
    box-shadow: 0 0 0 4px var(--app-paper), 0 10px 22px -8px rgb(110 82 0 / 55%);
    transition: transform .18s var(--app-ease), box-shadow .18s ease;
  }
  .app-mirror .app-icon { width: 25px; height: 25px; stroke-width: 2; }
  /* The mirror wears a 4px paper ring; a wider gap keeps "Try on" / "جرّب" (and its shadda) clear of it
     while the label stays on the same line as the other tabs. */
  .app-tabbar .app-tab-mirror { gap: 10px; }
  .app-tab-mirror[aria-current="page"] .app-mirror { box-shadow: 0 0 0 4px var(--app-paper), 0 0 0 6px var(--app-ink); }

  .app-more { margin-top: 0; }
}

/* Sheets: grab handle and rounded top on phones */
@media (max-width: 600px) {
  .pt-header, .pl-header { touch-action: none; padding-top: 24px !important; }
  .pt-dialog, .pl-dialog { border-radius: 22px 22px 0 0 !important; }
  .pt-header::before, .pl-header::before, [data-sheet-handle]::before {
    content: ""; position: absolute; top: 8px; left: 50%; width: 40px; height: 5px; margin-left: -20px;
    border-radius: 999px; background: var(--app-line);
  }
}

/* Skeletons: warm surface, shimmering only until the photo settles */
.product-photo, .gallery-slide { background-color: var(--app-surface); }

@media (prefers-reduced-motion: no-preference) {
  .product-photo:not(.is-loaded), .gallery-slide:not(.is-loaded) {
    background-image: linear-gradient(100deg, transparent 30%, rgb(255 255 255 / 60%) 50%, transparent 70%);
    background-size: 220% 100%;
    animation: app-shimmer 1.3s linear infinite;
  }
  .is-popping .icon, .is-popping .app-icon { animation: app-pop .28s var(--app-ease); }
  .is-bumping { animation: app-bump .32s var(--app-ease); }
  .app-tabbar a:active .app-icon, .app-tabbar a:active .app-mirror,
  .app-icon-button:active { transform: scale(.92); }
  /* The dialog's slide is driven by app-shell.js so a rebuilt dialog continues it. */
  .app-sheet-enter { animation: app-fade .2s ease-out; }
  .pt-dialog:not(.is-dragging), .pl-dialog:not(.is-dragging), .catalog-filter-content:not(.is-dragging) { transition: transform .2s var(--app-ease); }
  @view-transition { navigation: auto; }
  .app-header { view-transition-name: app-header; }
  .app-tabbar { view-transition-name: app-tabbar; }
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: .2s; }
}
@keyframes app-shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }
@keyframes app-pop { 0% { transform: scale(1); } 45% { transform: scale(1.28); } 100% { transform: scale(1); } }
@keyframes app-bump { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.25); } }
@keyframes app-fade { from { opacity: 0; } }

@media print { .app-tabbar, .app-header { display: none; } }
