/* =========================================================
   Variables
   ========================================================= */
:root {
  /* Color Palette - Urban, cool blue & gray */
  --color-background: #f4f6f9;
  --color-surface: #ffffff;
  --color-surface-alt: #f0f2f5;
  --color-text: #111827;
  --color-text-muted: #6b7280;

  --color-primary: #2563eb; /* cool, trustworthy blue */
  --color-primary-soft: #dbeafe;
  --color-primary-strong: #1d4ed8;

  --color-success: #16a34a;
  --color-warning: #f59e0b;
  --color-danger: #dc2626;

  --color-border-subtle: #e5e7eb;
  --color-border-strong: #9ca3af;

  /* Neutral Grays */
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2933;
  --gray-900: #111827;

  /* Typography */
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji",
    "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  --font-heading: "Inter", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --font-size-xs: 0.75rem;   /* 12px */
  --font-size-sm: 0.875rem;  /* 14px */
  --font-size-base: 1rem;    /* 16px */
  --font-size-md: 1.0625rem; /* 17px - subtle refinement */
  --font-size-lg: 1.125rem;  /* 18px */
  --font-size-xl: 1.25rem;   /* 20px */
  --font-size-2xl: 1.5rem;   /* 24px */
  --font-size-3xl: 1.875rem; /* 30px */
  --font-size-4xl: 2.25rem;  /* 36px */

  --line-height-tight: 1.2;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.7;

  /* Spacing Scale (px) */
  --space-0: 0;
  --space-1: 2px;
  --space-2: 4px;
  --space-3: 6px;
  --space-4: 8px;
  --space-5: 10px;
  --space-6: 12px;
  --space-8: 16px;
  --space-10: 20px;
  --space-12: 24px;
  --space-16: 32px;
  --space-20: 40px;
  --space-24: 48px;
  --space-32: 64px;
  --space-40: 80px;
  --space-48: 96px;

  /* Radius */
  --radius-xs: 2px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 18px;
  --radius-pill: 999px;

  /* Shadows - subtle, urban depth */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08),
    0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.10);
  --shadow-lg: 0 12px 30px rgba(15, 23, 42, 0.18);

  /* Transitions */
  --transition-fast: 120ms ease-out;
  --transition-base: 180ms ease-out;
  --transition-slow: 260ms ease-out;
}

/* =========================================================
   Reset / Normalize
   ========================================================= */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body,
h1,
h2,
h3,
h4,
h5,
h6,
p,
figure,
blockquote,
dl,
dd {
  margin: 0;
}

ul[role="list"],
ol[role="list"] {
  list-style: none;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  text-rendering: optimizeLegibility;
}

img,
svg,
video,
canvas,
audio,
iframe,
embed,
object {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  border: none;
  background: none;
  padding: 0;
}

textarea {
  resize: vertical;
}

a {
  text-decoration: none;
  color: inherit;
}

:focus {
  outline: none;
}

/* Remove default number input spinners */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
}

/* =========================================================
   Base Styles
   ========================================================= */
body {
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  background-color: var(--color-background);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
}

main {
  min-height: 60vh;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: var(--line-height-tight);
  color: var(--color-text);
}

h1 {
  font-size: var(--font-size-4xl);
  letter-spacing: -0.03em;
}

h2 {
  font-size: var(--font-size-3xl);
  letter-spacing: -0.02em;
}

h3 {
  font-size: var(--font-size-2xl);
}

h4 {
  font-size: var(--font-size-xl);
}

h5 {
  font-size: var(--font-size-lg);
}

h6 {
  font-size: var(--font-size-base);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

p {
  margin-top: 0;
  margin-bottom: var(--space-8);
  font-size: var(--font-size-md);
  line-height: var(--line-height-relaxed);
  color: var(--color-text-muted);
  }

strong {
  font-weight: 600;
}

small {
  font-size: var(--font-size-xs);
}

a {
  color: var(--color-primary);
  transition: color var(--transition-base);
}

a:hover {
  color: var(--color-primary-strong);
}

hr {
  border: none;
  border-top: 1px solid var(--gray-200);
  margin: var(--space-16) 0;
}

code,
pre {
  font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
  font-size: 0.95em;
}

/* =========================================================
   Accessibility & Motion
   ========================================================= */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* =========================================================
   Utilities
   ========================================================= */
/* Layout Containers */
.container {
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-16);
  padding-right: var(--space-16);
  max-width: 1200px; /* comfortable for marketplace grids */
}

.container-wide {
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-16);
  padding-right: var(--space-16);
  max-width: 1440px;
}

.section {
  padding-top: var(--space-24);
  padding-bottom: var(--space-24);
}

/* Flex Helpers */
.flex {
  display: flex;
}

.inline-flex {
  display: inline-flex;
}

.flex-row {
  flex-direction: row;
}

.flex-column {
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

.items-center {
  align-items: center;
}

.items-start {
  align-items: flex-start;
}

.items-end {
  align-items: flex-end;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.justify-end {
  justify-content: flex-end;
}

.gap-4 {
  gap: var(--space-4);
}

.gap-8 {
  gap: var(--space-8);
}

.gap-12 {
  gap: var(--space-12);
}

/* Grid Helpers */
.grid {
  display: grid;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-16);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-16);
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-16);
}

@media (max-width: 1024px) {
  .grid-4 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Text Alignment */
.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-muted {
  color: var(--color-text-muted);
}

/* Screen Reader Only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Elevation Utilities */
.shadow-xs {
  box-shadow: var(--shadow-xs);
}

.shadow-sm {
  box-shadow: var(--shadow-sm);
}

.shadow-md {
  box-shadow: var(--shadow-md);
}

.shadow-lg {
  box-shadow: var(--shadow-lg);
}

.rounded-sm {
  border-radius: var(--radius-sm);
}

.rounded-md {
  border-radius: var(--radius-md);
}

.rounded-lg {
  border-radius: var(--radius-lg);
}

.rounded-xl {
  border-radius: var(--radius-xl);
}

.rounded-pill {
  border-radius: var(--radius-pill);
}

/* Spacing Utilities (margin-bottom, commonly used in sections) */
.mb-0 {
  margin-bottom: 0;
}

.mb-4 {
  margin-bottom: var(--space-4);
}

.mb-8 {
  margin-bottom: var(--space-8);
}

.mb-12 {
  margin-bottom: var(--space-12);
}

.mb-16 {
  margin-bottom: var(--space-16);
}

.mt-16 {
  margin-top: var(--space-16);
}

/* =========================================================
   Components
   ========================================================= */
/* Buttons - primary action focus, subtle urban hover */
.button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  padding: 0.6rem 1.4rem;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  background-color: var(--color-primary);
  color: #ffffff;
  font-weight: 500;
  font-size: var(--font-size-sm);
  letter-spacing: 0.02em;
  text-transform: none;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition:
    background-color var(--transition-base),
    color var(--transition-base),
    box-shadow var(--transition-base),
    transform var(--transition-fast),
    border-color var(--transition-base);
}

.button:hover,
.btn:hover {
  background-color: var(--color-primary-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.button:active,
.btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-xs);
}

.button:disabled,
.btn:disabled,
.button[aria-disabled="true"],
.btn[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.6;
  box-shadow: none;
  transform: none;
}

.button-secondary,
.btn-secondary {
  background-color: #ffffff;
  color: var(--color-text);
  border-color: var(--color-border-subtle);
  box-shadow: var(--shadow-xs);
}

.button-secondary:hover,
.btn-secondary:hover {
  background-color: var(--color-surface-alt);
  border-color: var(--color-border-strong);
}

.button-ghost,
.btn-ghost {
  background-color: transparent;
  color: var(--color-text);
  border-color: transparent;
  box-shadow: none;
}

.button-ghost:hover,
.btn-ghost:hover {
  background-color: rgba(15, 23, 42, 0.04);
}

.button-outline,
.btn-outline {
  background-color: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary-soft);
  box-shadow: none;
}

.button-outline:hover,
.btn-outline:hover {
  border-color: var(--color-primary);
  background-color: var(--color-primary-soft);
}

.button-icon,
.btn-icon {
  padding: 0.45rem;
  border-radius: var(--radius-pill);
  width: 2.25rem;
  height: 2.25rem;
}

/* Inputs - for search, filters, checkout forms */
.input,
select,
textarea,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="tel"],
input[type="url"],
input[type="number"] {
  width: 100%;
  padding: 0.55rem 0.75rem;
  font-size: var(--font-size-sm);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-subtle);
  background-color: #ffffff;
  color: var(--color-text);
  box-shadow: var(--shadow-xs);
  transition:
    border-color var(--transition-base),
    box-shadow var(--transition-base),
    background-color var(--transition-base);
}

.input::placeholder,
input::placeholder,
textarea::placeholder {
  color: var(--color-text-muted);
}

.input:focus-visible,
select:focus-visible,
textarea:focus-visible,
input[type="text"]:focus-visible,
input[type="email"]:focus-visible,
input[type="password"]:focus-visible,
input[type="search"]:focus-visible,
input[type="tel"]:focus-visible,
input[type="url"]:focus-visible,
input[type="number"]:focus-visible {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.25);
}

input[readonly],
.input[readonly] {
  background-color: var(--gray-50);
}

input:disabled,
select:disabled,
textarea:disabled {
  background-color: var(--gray-100);
  color: var(--color-text-muted);
  cursor: not-allowed;
}

/* Card - for product tiles, seller storefronts, banners */
.card {
  position: relative;
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: var(--shadow-sm);
  padding: var(--space-12);
  overflow: hidden;
  transition:
    box-shadow var(--transition-base),
    transform var(--transition-base),
    border-color var(--transition-base),
    background-color var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: rgba(37, 99, 235, 0.30);
}

.card-header {
  margin-bottom: var(--space-8);
}

.card-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  margin-bottom: var(--space-4);
}

.card-subtitle {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.card-body {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.card-footer {
  margin-top: var(--space-8);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-8);
}

/* Tag / Pill - for category labels, promo badges */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.6rem;
  border-radius: var(--radius-pill);
  background-color: var(--gray-100);
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  font-weight: 500;
}

.pill-primary {
  background-color: var(--color-primary-soft);
  color: var(--color-primary-strong);
}

/* Banner base - for hero / promo areas */
.banner {
  position: relative;
  border-radius: var(--radius-xl);
  padding: var(--space-20) var(--space-16);
  overflow: hidden;
  background: radial-gradient(circle at top left, #1e40af 0, #0f172a 45%, #020617 100%);
  color: #f9fafb;
  box-shadow: var(--shadow-lg);
}

.banner-light {
  background: linear-gradient(135deg, #e0f2fe 0%, #f9fafb 55%, #e5e7eb 100%);
  color: var(--color-text);
}

.banner-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(37, 99, 235, 0.35), transparent 55%);
  pointer-events: none;
}

.banner-content {
  position: relative;
  z-index: 1;
}

/* Badges for price / promo highlights */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-pill);
  font-size: var(--font-size-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge-success {
  background-color: rgba(22, 163, 74, 0.12);
  color: #15803d;
}

.badge-danger {
  background-color: rgba(220, 38, 38, 0.12);
  color: #b91c1c;
}

.badge-warning {
  background-color: rgba(245, 158, 11, 0.12);
  color: #b45309;
}

/* Simple chip for filters */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-4);
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--gray-200);
  background-color: #ffffff;
  font-size: var(--font-size-xs);
  color: var(--color-text);
  cursor: pointer;
  transition:
    background-color var(--transition-base),
    border-color var(--transition-base),
    color var(--transition-base),
    box-shadow var(--transition-base);
}

.chip:hover {
  border-color: var(--color-primary);
  background-color: var(--color-primary-soft);
  box-shadow: var(--shadow-xs);
}

.chip-active {
  border-color: var(--color-primary);
  background-color: var(--color-primary);
  color: #ffffff;
}

/* Simple top-level nav link base (for a clean, modern header) */
.nav-link {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.2rem;
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  border-bottom: 2px solid transparent;
  transition:
    color var(--transition-base),
    border-color var(--transition-base);
}

.nav-link:hover {
  color: var(--color-text);
}

.nav-link-active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}
