/* ==========================================================================
   Variables
   ========================================================================== */
:root {
  /* Colors - soft neutrals & warm accents */
  --color-background: #f7f5f2;
  --color-surface: #ffffff;
  --color-text: #2b2b30;
  --color-text-muted: #6f6f77;
  --color-border-subtle: #e2e0db;

  --color-primary: #d47b3b;          /* warm accent (terracotta-like) */
  --color-primary-soft: #f7e3d4;
  --color-primary-strong: #b96023;

  --color-success: #2f8f5b;
  --color-success-soft: #e0f3e9;

  --color-warning: #c98a1b;
  --color-warning-soft: #fff3d8;

  --color-danger: #bf3b3b;
  --color-danger-soft: #fde1e1;

  --color-neutral-50: #faf9f7;
  --color-neutral-100: #f1efea;
  --color-neutral-200: #e2dfd7;
  --color-neutral-300: #cfcbc1;
  --color-neutral-400: #a7a39a;
  --color-neutral-500: #817d75;
  --color-neutral-600: #5e5a55;
  --color-neutral-700: #44413d;
  --color-neutral-800: #2f2c29;
  --color-neutral-900: #1f1d1a;

  /* Typography */
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-serif: "Georgia", "Times New Roman", serif;
  --font-mono: "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  --text-xs: 0.75rem;   /* 12px */
  --text-sm: 0.875rem;  /* 14px */
  --text-base: 1rem;    /* 16px */
  --text-lg: 1.125rem;  /* 18px */
  --text-xl: 1.25rem;   /* 20px */
  --text-2xl: 1.5rem;   /* 24px */
  --text-3xl: 1.875rem; /* 30px */
  --text-4xl: 2.25rem;  /* 36px */

  --leading-tight: 1.2;
  --leading-normal: 1.5;
  --leading-relaxed: 1.7;

  /* Spacing scale (0–96px) */
  --space-0: 0;
  --space-1: 0.25rem;  /* 4px */
  --space-2: 0.5rem;   /* 8px */
  --space-3: 0.75rem;  /* 12px */
  --space-4: 1rem;     /* 16px */
  --space-5: 1.25rem;  /* 20px */
  --space-6: 1.5rem;   /* 24px */
  --space-8: 2rem;     /* 32px */
  --space-10: 2.5rem;  /* 40px */
  --space-12: 3rem;    /* 48px */
  --space-16: 4rem;    /* 64px */
  --space-20: 5rem;    /* 80px */
  --space-24: 6rem;    /* 96px */

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

  /* Shadows - soft & subtle for trust and calm */
  --shadow-sm: 0 1px 3px rgba(15, 10, 5, 0.08);
  --shadow-md: 0 8px 20px rgba(15, 10, 5, 0.08);
  --shadow-lg: 0 18px 45px rgba(15, 10, 5, 0.12);

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

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  :root {
    --transition-fast: 0ms;
    --transition-base: 0ms;
    --transition-slow: 0ms;
  }

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

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

html,
body,
div,
span,
applet,
object,
iframe,
 h1,
 h2,
 h3,
 h4,
 h5,
 h6,
 p,
 blockquote,
 pre,
 a,
 abbr,
 acronym,
 address,
 big,
 cite,
 code,
 del,
 dfn,
 em,
 img,
 ins,
 kbd,
 q,
 s,
 samp,
 small,
 strike,
 strong,
 sub,
 sup,
 tt,
 var,
 b,
 u,
 i,
 center,
 dl,
 dt,
 dd,
 ol,
 ul,
 li,
 fieldset,
 form,
 label,
 legend,
 table,
 caption,
 tbody,
 tfoot,
 thead,
 tr,
 th,
 td,
 article,
 aside,
 canvas,
 details,
 embed,
 figure,
 figcaption,
 footer,
 header,
 hgroup,
 menu,
 nav,
 output,
 ruby,
 section,
 summary,
 time,
 mark,
 audio,
 video {
  margin: 0;
  padding: 0;
  border: 0;
  font: inherit;
  vertical-align: baseline;
}

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

body {
  min-height: 100vh;
}

article,
aside,
footer,
header,
nav,
section,
main {
  display: block;
}

ol,
ul {
  list-style: none;
}

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

img {
  height: auto;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  background: none;
  border-radius: 0;
}

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

textarea {
  resize: vertical;
}

[hidden] {
  display: none !important;
}

abbr[title] {
  border-bottom: none;
  text-decoration: underline dotted;
}

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

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 600;
  line-height: var(--leading-tight);
  color: var(--color-neutral-900);
}

h1 {
  font-size: clamp(2rem, 4vw, var(--text-4xl));
  margin-bottom: var(--space-4);
}

h2 {
  font-size: clamp(1.75rem, 3vw, var(--text-3xl));
  margin-bottom: var(--space-3);
}

h3 {
  font-size: var(--text-2xl);
  margin-bottom: var(--space-3);
}

h4 {
  font-size: var(--text-xl);
  margin-bottom: var(--space-2);
}

h5 {
  font-size: var(--text-lg);
  margin-bottom: var(--space-2);
}

h6 {
  font-size: var(--text-base);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-1);
}

p {
  margin-bottom: var(--space-4);
  color: var(--color-text);
}

strong,
b {
  font-weight: 600;
}

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

a {
  color: var(--color-primary-strong);
  text-decoration: none;
  transition: color var(--transition-base);
}

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

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

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

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

/* ==========================================================================
   Accessibility & Focus
   ========================================================================== */
:focus {
  outline: none;
}

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

/* 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;
}

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

/* ==========================================================================
   Utilities
   ========================================================================== */
/* Layout helpers */
.container {
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}

@media (min-width: 1280px) {
  .container {
    max-width: 1320px;
  }
}

.flex {
  display: flex;
}

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

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

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

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

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

.grid {
  display: grid;
}

.grid-auto-fit {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-6);
}

.w-full {
  width: 100%;
}

.max-w-full {
  max-width: 100%;
}

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

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

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

/* Spacing utilities (example subset for common use) */
.mt-0 { margin-top: 0; }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }

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

.py-2 {
  padding-top: var(--space-2);
  padding-bottom: var(--space-2);
}

.py-4 {
  padding-top: var(--space-4);
  padding-bottom: var(--space-4);
}

.p-4 {
  padding: var(--space-4);
}

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

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

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

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

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

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

/* ==========================================================================
   Components
   ========================================================================== */
/* Buttons - primary action for add-to-cart, checkout, etc. */
.button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.65rem 1.4rem;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  background-color: var(--color-primary);
  color: #fff;
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.2;
  text-decoration: none;
  transition:
    background-color var(--transition-base),
    color var(--transition-base),
    border-color var(--transition-base),
    box-shadow var(--transition-fast),
    transform var(--transition-fast);
  cursor: pointer;
}

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

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

.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: var(--color-surface);
  color: var(--color-neutral-800);
  border-color: var(--color-border-subtle);
}

.button--secondary:hover,
.btn--secondary:hover {
  background-color: var(--color-neutral-100);
  border-color: var(--color-neutral-300);
  color: var(--color-neutral-800);
}

.button--ghost,
.btn--ghost {
  background-color: transparent;
  border-color: transparent;
  color: var(--color-primary-strong);
}

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

/* Form elements - consistent input styling for search, checkout, etc. */
.input,
select,
textarea,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="tel"],
input[type="number"],
input[type="url"] {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-subtle);
  background-color: var(--color-surface);
  color: var(--color-text);
  font-size: var(--text-sm);
  line-height: 1.4;
  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="number"]:focus-visible,
input[type="url"]:focus-visible {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 1px var(--color-primary-soft);
  outline: 2px solid transparent;
  outline-offset: 1px;
}

input[disabled],
select[disabled],
textarea[disabled] {
  background-color: var(--color-neutral-50);
  color: var(--color-text-muted);
  cursor: not-allowed;
}

/* Card - for product tiles, content sections, trust blocks */
.card {
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-4);
  border: 1px solid rgba(0, 0, 0, 0.02);
}

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

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

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

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

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

.card-footer {
  margin-top: var(--space-4);
}

/* Badges for stock info / promotions */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.15rem 0.6rem;
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge--success {
  background-color: var(--color-success-soft);
  color: var(--color-success);
}

.badge--warning {
  background-color: var(--color-warning-soft);
  color: var(--color-warning);
}

.badge--danger {
  background-color: var(--color-danger-soft);
  color: var(--color-danger);
}

/* Helper component: subtle section wrapper for home & category pages */
.section {
  padding-top: var(--space-10);
  padding-bottom: var(--space-10);
}

.section--muted {
  background-color: var(--color-neutral-50);
}

.section-header {
  margin-bottom: var(--space-6);
  text-align: left;
}

.section-header--center {
  text-align: center;
}
