/* ============================================================
   606 STORE — Design System
   Dark-mode digital marketplace. Palette derived from brief:
   deep slate base, slate surface, mauve accent, cool light text.
   ============================================================ */

:root {
  /* --- Palette anchors (from provided swatch) --- */
  --slate-deep:   #2b2b35;   /* band 1 */
  --slate-mid:    #44454f;   /* band 2 */
  --mauve-raw:    #75605f;   /* band 3 */
  --light-cool:   #d6dbdb;   /* band 4 */

  /* --- Backgrounds / surfaces (layered) --- */
  --bg-base:      #16161c;
  --bg-deep:      #1b1b22;
  --surface-1:    #22222b;
  --surface-2:    #2a2b35;
  --surface-3:    #33343f;
  --surface-hi:   #3c3d49;

  /* --- Borders / hairlines --- */
  --border:       rgba(214, 219, 219, 0.08);
  --border-soft:  rgba(214, 219, 219, 0.05);
  --border-strong:rgba(214, 219, 219, 0.14);

  /* --- Text tiers --- */
  --text-1: #e7eaeb;
  --text-2: #a6abb1;
  --text-3: #71757e;
  --text-on-accent: #1b1417;

  /* --- Accent (mauve family) --- */
  --accent:        #9c7e7c;   /* brightened CTA mauve */
  --accent-hi:     #b69391;
  --accent-dim:    #6f5a59;
  --accent-glow:   rgba(156, 126, 124, 0.45);
  --accent-soft:   rgba(156, 126, 124, 0.14);
  --accent-line:   rgba(156, 126, 124, 0.32);

  /* CTA color — switched by tweak (mauve vs light). Default mauve. */
  --cta-bg:   var(--accent);
  --cta-bg-hi:var(--accent-hi);
  --cta-fg:   var(--text-on-accent);

  /* --- Semantic (muted, palette-friendly) --- */
  --success:     #6fae8a;
  --success-bg:  rgba(111, 174, 138, 0.13);
  --success-line:rgba(111, 174, 138, 0.30);
  --warning:     #c9a86a;
  --warning-bg:  rgba(201, 168, 106, 0.13);
  --warning-line:rgba(201, 168, 106, 0.30);
  --danger:      #c47d72;
  --danger-bg:   rgba(196, 125, 114, 0.13);
  --danger-line: rgba(196, 125, 114, 0.30);
  --info:        #7f93b8;
  --info-bg:     rgba(127, 147, 184, 0.13);
  --info-line:   rgba(127, 147, 184, 0.30);

  /* --- Glow intensity (tweakable, 0..1.4) --- */
  --glow: 1;

  /* --- Radii --- */
  --r-xs: 6px;
  --r-sm: 9px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-pill: 999px;

  /* --- Shadows --- */
  --sh-1: 0 1px 2px rgba(0,0,0,0.4);
  --sh-2: 0 6px 20px -8px rgba(0,0,0,0.55);
  --sh-3: 0 18px 50px -16px rgba(0,0,0,0.65);
  --sh-glow: 0 0 0 1px var(--accent-line), 0 8px 30px -10px var(--accent-glow);

  /* --- Type --- */
  --font-sans: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ============================================================
   Reset / base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-1);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv01";
  letter-spacing: -0.01em;
  overflow-x: hidden;
}

/* App background: deep base + faint dot-grid + radial accent glow */
.app-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(1100px 620px at 78% -8%, rgba(156,126,124, calc(0.16 * var(--glow))), transparent 60%),
    radial-gradient(900px 500px at 8% 0%, rgba(127,147,184, calc(0.07 * var(--glow))), transparent 55%);
}
.app-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(214,219,219,0.05) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: radial-gradient(1200px 800px at 50% 0%, #000 30%, transparent 80%);
  opacity: 0.6;
}

::selection { background: var(--accent-soft); color: var(--text-1); }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; }

/* Scrollbar */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-hi); border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #4a4b58; background-clip: padding-box; border: 3px solid transparent; }

/* ============================================================
   Type scale
   ============================================================ */
.t-display { font-size: clamp(38px, 5.4vw, 68px); font-weight: 600; line-height: 1.02; letter-spacing: -0.035em; }
.t-h1 { font-size: clamp(30px, 3.6vw, 44px); font-weight: 600; line-height: 1.06; letter-spacing: -0.03em; }
.t-h2 { font-size: 28px; font-weight: 600; line-height: 1.12; letter-spacing: -0.025em; }
.t-h3 { font-size: 21px; font-weight: 600; line-height: 1.2; letter-spacing: -0.02em; }
.t-h4 { font-size: 17px; font-weight: 600; line-height: 1.25; letter-spacing: -0.015em; }
.t-body { font-size: 15px; font-weight: 400; line-height: 1.6; color: var(--text-2); }
.t-sm { font-size: 13.5px; line-height: 1.5; color: var(--text-2); }
.t-cap { font-size: 12px; line-height: 1.4; color: var(--text-3); }
.t-label { font-size: 11px; font-weight: 600; letter-spacing: 0.13em; text-transform: uppercase; color: var(--text-3); }
.mono { font-family: var(--font-mono); font-feature-settings: "zero"; letter-spacing: -0.02em; }

.text-1 { color: var(--text-1); }
.text-2 { color: var(--text-2); }
.text-3 { color: var(--text-3); }
.text-accent { color: var(--accent-hi); }

/* ============================================================
   Layout helpers
   ============================================================ */
.container { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 28px; }
.container-wide { max-width: 1440px; }
.row { display: flex; align-items: center; }
.col { display: flex; flex-direction: column; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.gap-5 { gap: 20px; } .gap-6 { gap: 24px; } .gap-8 { gap: 32px; }
.between { justify-content: space-between; }
.center { justify-content: center; align-items: center; }
.wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.divider { height: 1px; background: var(--border); width: 100%; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  --btn-h: 42px;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  height: var(--btn-h); padding: 0 18px;
  border-radius: var(--r-md);
  font-size: 14px; font-weight: 600; letter-spacing: -0.01em;
  white-space: nowrap; position: relative; isolation: isolate;
  transition: transform .14s var(--ease), background .18s var(--ease), box-shadow .2s var(--ease), border-color .18s var(--ease), color .18s var(--ease);
  user-select: none;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:disabled, .btn.is-disabled { opacity: 0.45; pointer-events: none; }
.btn svg { width: 17px; height: 17px; }

.btn-primary {
  background: var(--cta-bg); color: var(--cta-fg);
  box-shadow: 0 1px 0 rgba(255,255,255,0.12) inset, 0 8px 24px -10px var(--accent-glow);
}
.btn-primary:hover { background: var(--cta-bg-hi); box-shadow: 0 1px 0 rgba(255,255,255,0.16) inset, 0 10px 30px -8px var(--accent-glow); transform: translateY(-1px); }

.btn-secondary {
  background: var(--surface-3); color: var(--text-1);
  box-shadow: inset 0 0 0 1px var(--border-strong);
}
.btn-secondary:hover { background: var(--surface-hi); box-shadow: inset 0 0 0 1px var(--border-strong); transform: translateY(-1px); }

.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text-1); }

.btn-danger { background: var(--danger-bg); color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger-line); }
.btn-danger:hover { background: rgba(196,125,114,0.2); transform: translateY(-1px); }

.btn-lg { --btn-h: 52px; padding: 0 26px; font-size: 15px; border-radius: var(--r-lg); }
.btn-sm { --btn-h: 34px; padding: 0 13px; font-size: 13px; border-radius: var(--r-sm); }
.btn-icon { width: var(--btn-h); padding: 0; }
.btn-block { width: 100%; }

.btn-spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.3); border-top-color: currentColor; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   Inputs
   ============================================================ */
.field { display: flex; flex-direction: column; gap: 7px; }
.field-label { font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.input, .select, .textarea {
  width: 100%; height: 44px; padding: 0 14px;
  background: var(--bg-deep); color: var(--text-1);
  border-radius: var(--r-md);
  box-shadow: inset 0 0 0 1px var(--border-strong);
  font-size: 14.5px; outline: none;
  transition: box-shadow .18s var(--ease), background .18s var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.textarea { height: auto; min-height: 96px; padding: 12px 14px; resize: vertical; line-height: 1.55; }
.input:focus, .select:focus, .textarea:focus {
  background: var(--surface-1);
  box-shadow: inset 0 0 0 1px var(--accent-line), 0 0 0 3px var(--accent-soft), 0 0 18px -6px var(--accent-glow);
}
.input.has-error, .textarea.has-error { box-shadow: inset 0 0 0 1px var(--danger-line), 0 0 0 3px var(--danger-bg); }
.field-error { font-size: 12px; color: var(--danger); display: flex; align-items: center; gap: 5px; }
.field-hint { font-size: 12px; color: var(--text-3); }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .input { padding-right: 42px; }
.input-affix { position: absolute; right: 6px; display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: var(--r-sm); color: var(--text-3); }
.input-affix:hover { color: var(--text-1); background: var(--surface-2); }
.input-lead { position: absolute; left: 14px; color: var(--text-3); display: flex; pointer-events: none; }
.input-wrap.has-lead .input { padding-left: 40px; }

select.select { appearance: none; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2371757e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 38px; }

/* Checkbox */
.checkbox { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; font-size: 13.5px; color: var(--text-2); }
.checkbox input { display: none; }
.checkbox .box { width: 18px; height: 18px; border-radius: 5px; box-shadow: inset 0 0 0 1.5px var(--border-strong); display: grid; place-items: center; transition: all .15s var(--ease); color: transparent; }
.checkbox input:checked + .box { background: var(--accent); box-shadow: none; color: var(--text-on-accent); }
.checkbox .box svg { width: 12px; height: 12px; }

/* ============================================================
   Pills / Badges / Tags
   ============================================================ */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 10px; border-radius: var(--r-pill);
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.01em;
  white-space: nowrap;
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.pill-success { background: var(--success-bg); color: var(--success); box-shadow: inset 0 0 0 1px var(--success-line); }
.pill-warning { background: var(--warning-bg); color: var(--warning); box-shadow: inset 0 0 0 1px var(--warning-line); }
.pill-danger { background: var(--danger-bg); color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger-line); }
.pill-info { background: var(--info-bg); color: var(--info); box-shadow: inset 0 0 0 1px var(--info-line); }
.pill-muted { background: var(--surface-2); color: var(--text-3); box-shadow: inset 0 0 0 1px var(--border); }
.pill-accent { background: var(--accent-soft); color: var(--accent-hi); box-shadow: inset 0 0 0 1px var(--accent-line); }

.tag {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px;
  border-radius: var(--r-sm); font-size: 11.5px; font-weight: 500; color: var(--text-2);
  background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border);
}

.badge-instant {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px 0 7px;
  border-radius: var(--r-sm); font-size: 11px; font-weight: 600; letter-spacing: 0.01em;
  color: var(--success); background: var(--success-bg); box-shadow: inset 0 0 0 1px var(--success-line);
}
.badge-instant svg { width: 12px; height: 12px; }

/* ============================================================
   Cards / surfaces
   ============================================================ */
.card {
  background: linear-gradient(180deg, var(--surface-1), var(--bg-deep));
  border-radius: var(--r-lg);
  box-shadow: inset 0 0 0 1px var(--border), var(--sh-2);
}
.glass {
  background: linear-gradient(180deg, rgba(42,43,53,0.72), rgba(27,27,34,0.72));
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  box-shadow: inset 0 0 0 1px var(--border-strong), var(--sh-3);
}
.elev { box-shadow: inset 0 0 0 1px var(--border-strong), var(--sh-3); }

.icon-tile {
  display: grid; place-items: center; border-radius: var(--r-md);
  background: linear-gradient(150deg, var(--surface-3), var(--surface-1));
  box-shadow: inset 0 0 0 1px var(--border-strong);
  position: relative; overflow: hidden;
}
.icon-tile::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(60% 60% at 30% 20%, rgba(214,219,219,0.06), transparent 70%);
}

/* ============================================================
   Tabs
   ============================================================ */
.tabs { display: inline-flex; gap: 3px; padding: 4px; background: var(--bg-deep); border-radius: var(--r-md); box-shadow: inset 0 0 0 1px var(--border); }
.tab {
  height: 34px; padding: 0 16px; border-radius: var(--r-sm); font-size: 13.5px; font-weight: 500;
  color: var(--text-2); transition: all .16s var(--ease); position: relative;
}
.tab:hover { color: var(--text-1); }
.tab.active { color: var(--text-1); background: var(--surface-3); box-shadow: var(--sh-1), inset 0 0 0 1px var(--border-strong); }

/* ============================================================
   Toast
   ============================================================ */
.toast-stack { position: fixed; bottom: 24px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 10px; max-width: 360px; }
.toast {
  display: flex; align-items: flex-start; gap: 12px; padding: 13px 15px;
  border-radius: var(--r-md); animation: toast-in .35s var(--ease-out);
  box-shadow: inset 0 0 0 1px var(--border-strong), var(--sh-3);
  background: linear-gradient(180deg, var(--surface-2), var(--surface-1));
}
.toast.leaving { animation: toast-out .3s var(--ease) forwards; }
.toast .ti { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; }
.toast .ti svg { width: 17px; height: 17px; }
@keyframes toast-in { from { opacity: 0; transform: translateX(30px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(30px) scale(0.96); } }

/* ============================================================
   Modal / Drawer
   ============================================================ */
.overlay {
  position: fixed; inset: 0; z-index: 150;
  background: rgba(10,10,14,0.62); backdrop-filter: blur(6px);
  display: flex; animation: fade-in .2s var(--ease);
}
.overlay.center { align-items: center; justify-content: center; padding: 24px; }
.overlay.right { justify-content: flex-end; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal { width: 100%; max-width: 480px; border-radius: var(--r-xl); animation: modal-in .3s var(--ease-out); }
@keyframes modal-in { from { opacity: 0; transform: translateY(16px) scale(0.97); } to { opacity: 1; transform: none; } }
.drawer { width: 100%; max-width: 420px; height: 100%; border-radius: 0; animation: drawer-in .32s var(--ease-out); display: flex; flex-direction: column; }
@keyframes drawer-in { from { transform: translateX(40px); opacity: 0.5; } to { transform: none; opacity: 1; } }

/* ============================================================
   Skeleton / shimmer
   ============================================================ */
.skel { position: relative; overflow: hidden; background: var(--surface-2); border-radius: var(--r-sm); }
.skel::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(214,219,219,0.06), transparent);
  transform: translateX(-100%); animation: shimmer 1.4s infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }

/* ============================================================
   Tooltip
   ============================================================ */
.tip { position: relative; display: inline-flex; }
.tip .tip-body {
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%) translateY(4px);
  background: var(--surface-hi); color: var(--text-1); font-size: 12px; font-weight: 500;
  padding: 6px 10px; border-radius: var(--r-sm); white-space: nowrap; pointer-events: none;
  opacity: 0; transition: all .16s var(--ease); box-shadow: var(--sh-2), inset 0 0 0 1px var(--border-strong); z-index: 50;
}
.tip:hover .tip-body { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============================================================
   Animations / utilities
   ============================================================ */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.rise { opacity: 1; }
@media (prefers-reduced-motion: no-preference) {
  .rise { animation: rise .5s var(--ease-out) .05s; }
}
@keyframes pop { 0% { transform: scale(0.8); opacity: 0; } 60% { transform: scale(1.05); } 100% { transform: scale(1); opacity: 1; } }
.focus-ring:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-soft), 0 0 0 1px var(--accent-line); }

/* Keyboard-only focus ring for all interactive elements (mouse clicks stay clean) */
button:focus-visible, a:focus-visible, [role="button"]:focus-visible, [tabindex]:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent-hi);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

.hide-scroll { scrollbar-width: none; }
.hide-scroll::-webkit-scrollbar { display: none; }

.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Quantity stepper */
.qty-btn { display: grid; place-items: center; color: var(--text-2); transition: background .14s var(--ease), color .14s var(--ease); }
.qty-btn:hover { background: var(--surface-2); color: var(--text-1); }
.qty-btn:active { background: var(--surface-3); }
.qty-input { background: transparent; border: none; outline: none; text-align: center; color: var(--text-1); font-weight: 600; box-shadow: inset 1px 0 0 var(--border), inset -1px 0 0 var(--border); }
.qty-input:focus { background: var(--surface-1); }

/* ============================================================
   RTL (Arabic / Persian) — flip directional UI; keep codes/prices LTR
   ============================================================ */
[dir="rtl"] .input-lead { left: auto; right: 14px; }
[dir="rtl"] .input-affix { right: auto; left: 6px; }
[dir="rtl"] .input-wrap .input { padding-right: 14px; padding-left: 42px; }
[dir="rtl"] .input-wrap.has-lead .input { padding-left: 42px; padding-right: 40px; }
[dir="rtl"] select.select { background-position: left 12px center; padding-right: 14px; padding-left: 38px; }
[dir="rtl"] .toast-stack { right: auto; left: 24px; }
[dir="rtl"] .overlay.right { justify-content: flex-start; }
[dir="rtl"] .tg-float-wrap { left: auto; right: 22px; }
[dir="rtl"] .crumb svg, [dir="rtl"] .legal-doc-link svg { transform: scaleX(-1); }
[dir="rtl"] .mono,
[dir="rtl"] .price,
[dir="rtl"] .addr,
[dir="rtl"] .cred-block,
[dir="rtl"] .qty-input,
[dir="rtl"] .pay-address,
[dir="rtl"] input[type="search"],
[dir="rtl"] input[type="email"] { direction: ltr; }
[dir="rtl"] .price, [dir="rtl"] .cart-line-total { text-align: right; }
