:root {
  /* Color Palette */
  --color-background: #f7f3ee; /* soft beige */
  --color-surface: #ffffff; /* crisp white */
  --color-surface-muted: #f1ede8; /* subtle panel/bg */
  --color-text: #1c1c1a; /* primary text */
  --color-text-muted: #6b6a66; /* secondary text */
  --color-border-subtle: #ded7cf; /* light separators */

  --color-primary: #6c7a37; /* olive green accent */
  --color-primary-soft: rgba(108, 122, 55, 0.08);
  --color-primary-strong: #55602b;

  --color-success: #3f7c4b;
  --color-warning: #b88029;
  --color-danger: #b6483a;

  --color-gray-50: #faf7f3;
  --color-gray-100: #f1ede8;
  --color-gray-200: #e4ddd4;
  --color-gray-300: #d3c9bd;
  --color-gray-400: #b7aa9a;
  --color-gray-500: #998c7a;
  --color-gray-600: #7c7060;
  --color-gray-700: #5f5547;
  --color-gray-800: #423a30;
  --color-gray-900: #27221b;

  /* Typography */
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-serif: "Playfair Display", "Times New Roman", serif;
  --font-mono: "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  --font-size-xs: 0.75rem;   /* 12px */
  --font-size-sm: 0.875rem;  /* 14px */
  --font-size-md: 1rem;      /* 16px */
  --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-snug: 1.35;
  --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;

  /* Radii */
  --radius-none: 0;
  --radius-xs: 2px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-pill: 999px;

  /* Shadows - soft, premium */
  --shadow-xs: 0 1px 2px rgba(15, 14, 11, 0.06);
  --shadow-sm: 0 4px 12px rgba(15, 14, 11, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 14, 11, 0.08);
  --shadow-lg: 0 16px 40px rgba(15, 14, 11, 0.10);

  /* Transitions */
  --transition-fast: 120ms ease-out;
  --transition-normal: 200ms ease-out;
  --transition-slow: 280ms ease-out;

  /* Layout */
  --container-max-width: 1200px;
  --container-padding-x: 20px;
}

/* Prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  :root {
    --transition-fast: 0.01ms linear;
    --transition-normal: 0.01ms linear;
    --transition-slow: 0.01ms linear;
  }

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

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

html,
body {
  margin: 0;
  padding: 0;
}

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

body {
  min-height: 100vh;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

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

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

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

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

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

textarea {
  resize: vertical;
}

:focus {
  outline: none;
}

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

main {
  display: block;
}

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

h1 { font-size: var(--font-size-4xl); margin-bottom: var(--space-16); }
 h2 { font-size: var(--font-size-3xl); margin-bottom: var(--space-12); }
 h3 { font-size: var(--font-size-2xl); margin-bottom: var(--space-10); }
 h4 { font-size: var(--font-size-xl);  margin-bottom: var(--space-8); }
 h5 { font-size: var(--font-size-lg);  margin-bottom: var(--space-6); }
 h6 { font-size: var(--font-size-sm);  margin-bottom: var(--space-4); text-transform: uppercase; letter-spacing: 0.08em; }

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

strong,
 b {
  font-weight: 600;
}

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

a {
  color: var(--color-primary);
  text-decoration: none;
  text-underline-offset: 0.15em;
  transition: color var(--transition-normal);
}

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

a:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
}

hr {
  border: 0;
  border-top: 1px solid var(--color-border-subtle);
  margin: var(--space-16) 0;
}

code,
 pre {
  font-family: var(--font-mono);
}

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

/* Screen reader only utility */
.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;
}

.sr-only-focusable:focus {
  position: static;
  width: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

/* =========================================
   Utilities
   ====================================== */
.container {
  width: 100%;
  max-width: var(--container-max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--container-padding-x);
  padding-right: var(--container-padding-x);
}

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

/* 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-xs { gap: var(--space-4); }
.gap-sm { gap: var(--space-6); }
.gap-md { gap: var(--space-8); }
.gap-lg { gap: var(--space-12); }

/* Grid helpers */
.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-gap-sm { gap: var(--space-8); }
.grid-gap-md { gap: var(--space-12); }
.grid-gap-lg { gap: var(--space-16); }

/* Simple spacing utilities (y-axis only to stay light) */
.mt-0 { margin-top: 0; }
.mt-xs { margin-top: var(--space-4); }
.mt-sm { margin-top: var(--space-8); }
.mt-md { margin-top: var(--space-12); }
.mt-lg { margin-top: var(--space-16); }
.mt-xl { margin-top: var(--space-24); }

.mb-0 { margin-bottom: 0; }
.mb-xs { margin-bottom: var(--space-4); }
.mb-sm { margin-bottom: var(--space-8); }
.mb-md { margin-bottom: var(--space-12); }
.mb-lg { margin-bottom: var(--space-16); }
.mb-xl { margin-bottom: var(--space-24); }

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

/* =========================================
   Components: Buttons
   ====================================== */
.button,
button.button,
input[type="submit"].button,
input[type="button"].button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.4rem;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font-size: var(--font-size-sm);
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background-color: var(--color-primary);
  color: #ffffff!important;
  box-shadow: var(--shadow-xs);
  transition:
    background-color var(--transition-normal),
    color var(--transition-normal),
    box-shadow var(--transition-normal),
    transform var(--transition-fast),
    border-color var(--transition-normal);
}

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

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

.button:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
}

.button--ghost {
  background-color: transparent;
  color: var(--color-text)!important;
  border-color: var(--color-border-subtle);
  box-shadow: none;
}

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

.button--secondary {
  background-color: #ffffff;
  color: var(--color-text)!important;
  border-color: var(--color-border-subtle);
}

.button--secondary:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-sm);
   color: #ffffff!important;
}

.button[disabled],
.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* =========================================
   Components: Form Controls
   ====================================== */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="search"],
select,
textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border-subtle);
  background-color: #ffffff;
  color: var(--color-text);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-normal);
  transition:
    border-color var(--transition-normal),
    box-shadow var(--transition-normal),
    background-color var(--transition-normal);
}

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

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 1px var(--color-primary-soft);
  outline: 2px solid transparent;
}

input[disabled],
select[disabled],
textarea[disabled] {
  background-color: var(--color-gray-50);
  cursor: not-allowed;
  opacity: 0.7;
}

label {
  display: inline-block;
  margin-bottom: var(--space-4);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text);
}

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

.form-help {
  margin-top: var(--space-2);
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.form-error {
  margin-top: var(--space-2);
  font-size: var(--font-size-xs);
  color: var(--color-danger);
}

/* =========================================
   Components: Card
   ====================================== */
.card {
  background-color: var(--color-surface);
  border-radius: var(--radius-md);
  border: 1px solid rgba(0, 0, 0, 0.02);
  box-shadow: var(--shadow-sm);
  padding: var(--space-16);
}

.card--muted {
  background-color: var(--color-surface-muted);
  box-shadow: var(--shadow-xs);
}

.card__header {
  margin-bottom: var(--space-10);
}

.card__title {
  font-size: var(--font-size-lg);
  font-weight: 600;
}

.card__body {
  font-size: var(--font-size-sm);
  color: var(--color-text);
}

.card__footer {
  margin-top: var(--space-12);
}

/* =========================================
   E-commerce Specific Helpers (Lightweight)
   ====================================== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.6rem;
  border-radius: var(--radius-pill);
  font-size: var(--font-size-xs);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background-color: var(--color-primary-soft);
  color: var(--color-primary-strong);
}

.badge--sale {
  background-color: rgba(182, 72, 58, 0.08);
  color: var(--color-danger);
}

.price {
  font-weight: 600;
  font-size: var(--font-size-lg);
}

.price--old {
  font-size: var(--font-size-sm);
  text-decoration: line-through;
  color: var(--color-text-muted);
}

/* Responsive tweaks for smaller screens */
@media (max-width: 768px) {
  h1 { font-size: 1.9rem; }
  h2 { font-size: 1.6rem; }
  h3 { font-size: 1.4rem; }

  .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);
  }
}
