/* ==========
   1. Reset / Normalize
   ========== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: #0f172a;
  background-color: #f9fafb;
}

img {
  max-width: 100%;
  height: auto;
  border-style: none;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover,
a:focus-visible {
  text-decoration: underline;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
}

ul,
ol {
  margin: 0;
  padding-left: 1.25rem;
}

h1,
h2,
h3,
h4,
h5,
h6,
p {
  margin: 0;
}

/* ==========
   2. Root tokens
   ========== */

:root {
  --sg-color-bg: #f9fafb;
  --sg-color-surface: #ffffff;
  --sg-color-border: #e5e7eb;
  --sg-color-border-strong: #d1d5db;
  --sg-color-text: #0f172a;
  --sg-color-text-muted: #6b7280;
  --sg-color-primary: #16a34a;
  --sg-color-primary-dark: #15803d;
  --sg-color-primary-soft: #ecfdf3;
  --sg-color-accent: #22c55e;
  --sg-color-danger: #dc2626;
  --sg-radius-sm: 6px;
  --sg-radius-md: 10px;
  --sg-radius-lg: 14px;
  --sg-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.08);
  --sg-shadow-md: 0 8px 24px rgba(15, 23, 42, 0.12);
  --sg-shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.12);
  --sg-spacing-xs: 4px;
  --sg-spacing-sm: 8px;
  --sg-spacing-md: 12px;
  --sg-spacing-lg: 16px;
  --sg-spacing-xl: 24px;
  --sg-spacing-2xl: 32px;
  --sg-max-width: 1120px;
  --sg-transition-fast: 150ms ease-out;
}

/* ==========
   3. Layout primitives
   ========== */

.container {
  width: 100%;
  max-width: var(--sg-max-width);
  margin: 0 auto;
  padding: 0 var(--sg-spacing-lg);
}

.main {
  padding: var(--sg-spacing-2xl) 0;
}

body.home-page .main {
  padding-top: 40px;
}

body.listing-page .main,
body.product-page .main {
  padding-top: 32px;
}

/* ==========
   4. Typography helpers
   ========== */

.text-muted {
  color: var(--sg-color-text-muted);
}

.text-center {
  text-align: center;
}

.text-sm {
  font-size: 0.875rem;
  line-height: 1.4;
}

.text-xs {
  font-size: 0.75rem;
  line-height: 1.3;
}

h1,
.h1 {
  font-size: 2rem;
  line-height: 1.2;
  font-weight: 700;
}

h2,
.h2 {
  font-size: 1.5rem;
  line-height: 1.3;
  font-weight: 600;
}

h3,
.h3 {
  font-size: 1.25rem;
  line-height: 1.3;
  font-weight: 600;
}

/* ==========
   5. Generic utility classes
   ========== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  line-height: 1.3;
  background-color: var(--sg-color-primary-soft);
  color: var(--sg-color-primary-dark);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--sg-color-border);
  background-color: #ffffff;
  font-size: 0.75rem;
  color: var(--sg-color-text-muted);
}

.surface {
  background-color: var(--sg-color-surface);
  border-radius: var(--sg-radius-lg);
  box-shadow: var(--sg-shadow-sm);
}

/* ==========
   6. Accessibility helpers
   ========== */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  border: 0;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

:focus-visible {
  outline: 2px solid var(--sg-color-primary);
  outline-offset: 2px;
}
