/* ============================================================
   WOW.ZNAHIDKA — BASE DESIGN SYSTEM
   Premium Dark Sneaker Marketplace
   ============================================================ */

:root {
  /* ── Backgrounds (Luxury Light — Farfetch / Apple Store) ── */
  --bg:        #ffffff;
  --bg2:       #f5f5f7;
  --bg3:       #ebebed;
  --bg4:       #e0e0e2;
  --bg5:       #d5d5d7;
  --bg-glass:  rgba(255,255,255,0.92);
  --bg-card:   #ffffff;

  /* ── Text (Apple Ink) ── */
  --text:        #1d1d1f;
  --text-dim:    rgba(29,29,31,0.60);
  --text-muted:  rgba(29,29,31,0.35);

  /* ── Accents ── */
  --accent:      #1d1d1f;
  --accent-inv:  #ffffff;
  --red:         #2742d6;
  --red-dim:     rgba(39,66,214,0.08);
  --red-glow:    rgba(39,66,214,0.22);
  --orange:      #ff4500;
  --orange-dim:  rgba(255,69,0,0.08);
  --green:       #00a86b;
  --green-dim:   rgba(0,168,107,0.08);
  --blue:        #0071e3;
  --blue-dim:    rgba(0,113,227,0.08);
  --gold:        #f5a623;

  /* ── Borders ── */
  --border:        rgba(0,0,0,0.07);
  --border-hover:  rgba(0,0,0,0.14);
  --border-accent: rgba(0,0,0,0.22);

  /* ── Shadows ── */
  --shadow-sm:  0 1px 4px  rgba(0,0,0,0.08);
  --shadow:     0 2px 16px rgba(0,0,0,0.10);
  --shadow-lg:  0 8px 40px rgba(0,0,0,0.16);
  --shadow-red: 0 6px 24px rgba(39,66,214,0.22);
  --shadow-glow:0 0 0 1px rgba(0,0,0,0.05);

  /* ── Radius ── */
  --r-xs:   6px;
  --r-sm:   10px;
  --r:      14px;
  --r-lg:   20px;
  --r-xl:   28px;
  --r-full: 100px;

  /* ── Layout ── */
  --nav-h:       64px;
  --header-h:    58px;
  --gender-h:    44px;
  --max-w:       480px;
  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* ── Transitions ── */
  --ease:      cubic-bezier(.16,1,.3,1);
  --ease-out:  cubic-bezier(.4,0,.6,1);
  --t-fast:    .14s;
  --t-base:    .24s;
  --t-slow:    .4s;

  /* ── Typography Scale ── */
  --fs-xs:   10px;
  --fs-sm:   12px;
  --fs-base: 14px;
  --fs-md:   16px;
  --fs-lg:   20px;
  --fs-xl:   24px;
  --fs-2xl:  30px;
  --fs-3xl:  38px;

  /* ── Font Weights ── */
  --fw-regular:   400;
  --fw-medium:    500;
  --fw-semibold:  600;
  --fw-bold:      700;
  --fw-extrabold: 800;
  --fw-black:     900;

  /* ── Letter Spacing ── */
  --ls-tight:     -0.02em;
  --ls-normal:     0em;
  --ls-wide:       0.04em;
  --ls-wider:      0.08em;
  --ls-ultrawide:  0.14em;

  /* ── Z-Index Scale ── */
  --z-header:  200;
  --z-gender:  201;
  --z-overlay: 300;
  --z-sheet:   301;
  --z-pwa:     400;
  --z-success: 600;
  --z-toast:   9000;
  --z-splash:  9999;

  /* ── Blur ── */
  --blur-sm:  8px;
  --blur-md:  16px;
  --blur-lg:  24px;
  --blur-xl:  40px;

  /* ── Card Shadows (cards float on --bg2 grey canvas) ── */
  --shadow-card:       0 1px 3px rgba(0,0,0,0.05), 0 4px 14px rgba(0,0,0,0.07);
  --shadow-card-hover: 0 6px 28px rgba(0,0,0,0.11), 0 2px 8px rgba(0,0,0,0.05);
  --shadow-card-lift:  0 16px 48px rgba(0,0,0,0.16), 0 4px 12px rgba(0,0,0,0.07);
}

/* ── DESKTOP: widen app to 600px ───────────────── */
@media (min-width: 640px) {
  :root { --max-w: 600px; }
}

/* ── RESET ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  text-rendering: optimizeLegibility;
}

@media (hover: hover) and (pointer: fine) {
  html { cursor: default; }
  .product-card:hover { transform: translateY(-5px) scale(1.01); }
  .hdr-btn:hover { background: var(--bg4) !important; }
  .nav-item:hover { color: var(--text-dim); }
  .g-btn:hover:not(.active), .g-chip:hover:not(.active) {
    color: var(--text) !important;
    background: rgba(0,0,0,0.07) !important;
  }
  .sec-link:hover { opacity: .7; }
  .social-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
  ::-webkit-scrollbar { width: 8px; height: 8px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.18); border-radius: 4px; }
  ::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.32); }
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display',
               'Segoe UI', Roboto, Helvetica, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  /* Дозволяємо select на тексті (назви/ціни товарів);
     для chrome-елементів (кнопки, navs) — окремо в layout.css */
  user-select: text;
  -webkit-user-select: text;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img    { max-width: 100%; height: auto; display: block; }
button { cursor: pointer; border: none; background: none; font-family: inherit; color: inherit; }
input, textarea { font-family: inherit; -webkit-appearance: none; appearance: none; color: inherit; }
a     { text-decoration: none; color: inherit; }

::-webkit-scrollbar { width: 0; height: 0; }

/* ── UTILITIES ─────────────────────────────────── */
.hidden  { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ── ICON ARROWS (CSS chevrons, inherit currentColor) ── */
.i-arr, .i-arr-lg, .i-arr-back {
  display: inline-block; flex-shrink: 0;
  border-radius: 1.5px; vertical-align: middle;
}
.i-arr {
  width: 6px; height: 6px;
  border-right: 1.8px solid currentColor;
  border-top:   1.8px solid currentColor;
  transform: rotate(45deg) translate(-1px, 1px);
}
.i-arr-lg {
  width: 8px; height: 8px;
  border-right: 2px solid currentColor;
  border-top:   2px solid currentColor;
  transform: rotate(45deg) translate(-1px, 1px);
}
.i-arr-back {
  width: 6px; height: 6px;
  border-left: 1.8px solid currentColor;
  border-top:  1.8px solid currentColor;
  transform: rotate(-45deg) translate(1px, 1px);
}

/* ── LOADING SPINNER ───────────────────────────── */
.loading-wrap { display: flex; align-items: center; justify-content: center; padding: 48px; }
.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2.5px solid rgba(0,0,0,0.08);
  border-top-color: rgba(0,0,0,0.55);
  animation: spin .7s linear infinite;
}

/* ── SKELETON ──────────────────────────────────── */
.skel {
  background: var(--bg3);
  border-radius: var(--r-sm);
  position: relative;
  overflow: hidden;
}
.skel::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg, transparent 0%, rgba(255,255,255,0.52) 50%, transparent 100%
  );
  transform: translateX(-100%);
  animation: skelShimmer 1.6s ease-in-out infinite;
}
.skel-card {
  min-width: 148px; width: 148px;
  background: var(--bg-card); border-radius: var(--r); overflow: hidden; flex-shrink: 0;
  box-shadow: var(--shadow-card);
}
.skel-card.sk-grid { min-width: 0; width: 100%; }
.skel-card-img   { width: 100%; aspect-ratio: 1/1; }
.skel-card-line  { height: 9px;  margin: 11px 11px 5px; }
.skel-card-line2 { height: 12px; margin: 0 11px; }
.skel-card-price { height: 15px; margin: 7px 11px 13px; width: 55%; }

/* ── BADGE ─────────────────────────────────────── */
.badge {
  position: absolute; top: 3px; right: 3px;
  min-width: 17px; height: 17px;
  background: var(--red); color: #fff;
  border-radius: var(--r-full);
  font-size: 10px; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px; line-height: 1;
}

/* ── TOAST ─────────────────────────────────────── */
#toasts {
  position: fixed;
  top: calc(var(--header-h) + var(--safe-top) + 10px);
  left: 50%; transform: translateX(-50%);
  z-index: 9000;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
  width: 90%; max-width: 360px;
}
.toast {
  background: rgba(29,29,31,0.96);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: var(--r);
  padding: 12px 16px;
  font-size: 13px; font-weight: 600; color: #f5f5f7;
  box-shadow: 0 4px 24px rgba(0,0,0,0.22);
  backdrop-filter: blur(var(--blur-md)); -webkit-backdrop-filter: blur(var(--blur-md));
  animation: toastIn .3s var(--ease), toastOut .3s ease 2.7s forwards;
  display: flex; align-items: center; gap: 10px;
  pointer-events: auto;
  line-height: 1.4;
}
.toast a { color: #ffffff; font-weight: 800; text-decoration: underline; }

/* ── CHROME — без виділення (header, nav, кнопки) ── */
#header, #bottom-nav, #desktop-nav, .header-actions,
.nav-item, .hdr-btn, .g-btn, .g-chip,
.m-action, .sz-btn, .sz-chip, .price-chip,
.dd-timer, .sh-handle, .badge, .cat-story {
  user-select: none;
  -webkit-user-select: none;
}

/* ── FOCUS-VISIBLE (тільки клавіатура) ─────────── */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--accent, #2742d6);
  outline-offset: 2px;
  border-radius: 4px;
}
button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent, #2742d6);
  outline-offset: 3px;
}

/* ── REDUCED MOTION ─────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  body::before, body::after { animation: none !important; }
}
