/* =========================================================
   Variables: Colors, Typography, Spacing, Radii, Shadows
   ========================================================= */
:root {
  /* Brand palette — cozy, modern, sustainable */
  --color-background: #FAF9F7; /* warm off-white */
  --color-surface: #FFFFFF; /* cards, panels */
  --color-text: #1F2937; /* slate-800 */
  --color-muted: #4B5563; /* slate-600 */
  --color-primary: #2E7D63; /* evergreen */
  --color-primary-contrast: #FFFFFF;
  --color-success: #2F855A;
  --color-warning: #B7791F;
  --color-danger:  #C53030;

  /* Neutral gray scale */
  --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: #1F2937;
  --gray-900: #111827;

  /* Typography */
  --font-sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  --font-serif: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  --text-xs:   12px;
  --text-sm:   14px;
  --text-base: 16px;
  --text-lg:   18px;
  --text-xl:   20px;
  --text-2xl:  24px;
  --text-3xl:  30px;
  --text-4xl:  36px;
  --text-5xl:  48px;

  --leading-tight: 1.25;
  --leading-normal: 1.6;
  --leading-relaxed: 1.75;

  /* Spacing scale (0–96px, 4px steps) */
  --space-0: 0px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 28px;
  --space-8: 32px;
  --space-9: 36px;
  --space-10: 40px;
  --space-11: 44px;
  --space-12: 48px;
  --space-13: 52px;
  --space-14: 56px;
  --space-15: 60px;
  --space-16: 64px;
  --space-17: 68px;
  --space-18: 72px;
  --space-19: 76px;
  --space-20: 80px;
  --space-21: 84px;
  --space-22: 88px;
  --space-23: 92px;
  --space-24: 96px;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-pill: 9999px;

  /* Shadows — soft, cozy */
  --shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.06), 0 1px 1px rgba(17, 24, 39, 0.04);
  --shadow-md: 0 8px 16px rgba(17, 24, 39, 0.08), 0 2px 6px rgba(17, 24, 39, 0.06);
  --shadow-lg: 0 18px 40px rgba(17, 24, 39, 0.12), 0 6px 16px rgba(17, 24, 39, 0.08);

  /* Motion */
  --duration-fast: 120ms;
  --duration-normal: 200ms;
  --duration-slow: 320ms;
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);

  /* Layout */
  --container-max: 1200px;
  --container-pad: var(--space-4);
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-background: #0F1115;
    --color-surface: #161A1E;
    --color-text: #E5E7EB;
    --color-muted: #9CA3AF;
    --color-primary: #59B596; /* brighten evergreen for dark */
    --color-primary-contrast: #0B1210;

    --gray-50:  #111827;
    --gray-100: #1F2937;
    --gray-200: #374151;
    --gray-300: #4B5563;
    --gray-400: #6B7280;
    --gray-500: #9CA3AF;
    --gray-600: #D1D5DB;
    --gray-700: #E5E7EB;
    --gray-800: #F3F4F6;
    --gray-900: #F9FAFB;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 8px 16px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 18px 40px rgba(0, 0, 0, 0.4);
  }
}

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

html:focus-within { scroll-behavior: smooth; }

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

body, h1, h2, h3, h4, h5, h6, input, button, textarea, select { font: inherit; }

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

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

/* Improve text rendering */
body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  html:focus-within { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

/* ===================================
   Base
   =================================== */
body {
  min-height: 100vh;
  background-color: var(--color-background);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
}

main { display: block; }

/* Headings — elegant, scalable */
h1, h2, h3, h4, h5, h6 {
  color: var(--color-text);
  font-family: var(--font-sans);
  font-weight: 650;
  line-height: var(--leading-tight);
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(2rem, 3.5vw + 0.5rem, 3rem); margin-block: var(--space-6) var(--space-4); }
h2 { font-size: clamp(1.5rem, 2.5vw + 0.25rem, 2.25rem); margin-block: var(--space-5) var(--space-3); }
h3 { font-size: clamp(1.375rem, 1.5vw + 0.5rem, 1.75rem); margin-block: var(--space-4) var(--space-2); }
h4 { font-size: 1.25rem; margin-block: var(--space-3) var(--space-2); }
h5 { font-size: 1.125rem; margin-block: var(--space-2) var(--space-2); }
h6 { font-size: 1rem; margin-block: var(--space-2) var(--space-1); }

/* Paragraphs with comfortable measure */
p { max-width: 70ch; color: var(--color-text); }

/* Links */
a { color: var(--color-primary); text-decoration: none; text-underline-offset: 2px; }
a:hover { text-decoration: underline; }
a:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; border-radius: 4px; }

/* Selection */
::selection { background: var(--color-primary); color: var(--color-primary-contrast); }

/* Media softness for cozy feel */
img, picture, video { border-radius: var(--radius-sm); }

/* Form control defaults */
input, textarea, select, button { color: inherit; }

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

@media (min-width: 640px) { .container { padding-inline: calc(var(--container-pad) * 1.5); } }
@media (min-width: 1024px) { .container { padding-inline: calc(var(--container-pad) * 2); } }

.measure { max-width: 70ch; }

/* Flex & Grid helpers */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.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; }
.flex-wrap { flex-wrap: wrap; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }

.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-auto-fit-min-200 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

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

.hidden { display: none !important; }

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

/* ===================================
   Components
   =================================== */
/* Buttons */
.btn {
  --btn-bg: var(--gray-200);
  --btn-fg: var(--color-text);
  --btn-bd: var(--gray-300);

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--btn-bd);
  background-color: var(--btn-bg);
  color: var(--btn-fg);
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background-color var(--duration-normal) var(--ease-standard),
              color var(--duration-normal) var(--ease-standard),
              border-color var(--duration-normal) var(--ease-standard),
              box-shadow var(--duration-normal) var(--ease-standard),
              transform var(--duration-fast) var(--ease-standard);
}

.btn:hover { filter: brightness(0.98); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.btn[disabled], .btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn--primary { --btn-bg: var(--color-primary); --btn-fg: var(--color-primary-contrast); --btn-bd: transparent; color: var(--btn-fg); }
.btn--primary:hover { box-shadow: var(--shadow-sm); filter: brightness(1.03); }

.btn--ghost { --btn-bg: transparent; --btn-bd: var(--gray-300); }

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

/* Inputs */
.input, input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="tel"], input[type="number"], select, textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-300);
  background-color: var(--color-surface);
  color: var(--color-text);
  transition: border-color var(--duration-normal) var(--ease-standard), box-shadow var(--duration-normal) var(--ease-standard), background-color var(--duration-normal) var(--ease-standard);
}

input::placeholder, textarea::placeholder { color: var(--gray-500); }

.input:focus, input:focus, select:focus, textarea:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 4px color-mix(in oklab, var(--color-primary) 20%, transparent); }

select { appearance: none; background-image: linear-gradient(45deg, transparent 49%, var(--gray-500) 50%), linear-gradient(135deg, var(--gray-500) 50%, transparent 51%); background-position: right 12px top 55%, right 6px top 55%; background-size: 6px 6px; background-repeat: no-repeat; }

input[type="checkbox"], input[type="radio"] { width: 1rem; height: 1rem; accent-color: var(--color-primary); }

/* Card */
.card {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid color-mix(in oklab, var(--gray-300) 60%, transparent);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-5);
}

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

/* Badges (for sustainability tags, etc.) */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: color-mix(in oklab, var(--color-primary) 12%, transparent);
  color: var(--color-primary);
  font-size: var(--text-sm);
  font-weight: 600;
}

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

[aria-busy="true"] { cursor: progress; }
[aria-disabled="true"], [disabled] { cursor: not-allowed; }

/* Subtle hover for interactive cards/rows */
[data-hoverable="true"]:hover { background-color: color-mix(in oklab, var(--color-primary) 6%, transparent); transition: background-color var(--duration-normal) var(--ease-standard); }

/* ===================================
   Helper Patterns for Product Grids
   =================================== */
.product-grid { display: grid; gap: var(--space-6); grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.media { position: relative; overflow: hidden; border-radius: var(--radius-md); background: var(--gray-100); }
.media img { width: 100%; height: 100%; object-fit: cover; }

/* ===================================
   Typography Helpers
   =================================== */
.lead { font-size: clamp(1.125rem, 0.5vw + 1rem, 1.375rem); line-height: var(--leading-relaxed); color: var(--color-muted); }
.small { font-size: var(--text-sm); }
.muted { color: var(--color-muted); }

/* ===================================
   Tables (basic normalization)
   =================================== */
table { width: 100%; border-collapse: collapse; }
th, td { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--gray-200); text-align: left; }
th { font-weight: 600; color: var(--color-text); }

/* ===================================
   Toast/Alert (lightweight)
   =================================== */
.alert { padding: var(--space-4); border-radius: var(--radius-md); border: 1px solid transparent; }
.alert--success { background: color-mix(in oklab, var(--color-success) 12%, transparent); color: var(--color-success); border-color: color-mix(in oklab, var(--color-success) 35%, transparent); }
.alert--warning { background: color-mix(in oklab, var(--color-warning) 12%, transparent); color: var(--color-warning); border-color: color-mix(in oklab, var(--color-warning) 35%, transparent); }
.alert--danger { background: color-mix(in oklab, var(--color-danger) 12%, transparent); color: var(--color-danger); border-color: color-mix(in oklab, var(--color-danger) 35%, transparent); }

/* ===================================
   Forms: Helper layout
   =================================== */
.form-row { display: grid; gap: var(--space-4); }
@media (min-width: 640px) { .form-row--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ===================================
   Footer/Header basics
   =================================== */
.site-header, .site-footer { background: var(--color-surface); border-top: 1px solid var(--gray-200); border-bottom: 1px solid var(--gray-200); }

/* ===================================
   Transitions
   =================================== */
.transition-base { transition: all var(--duration-normal) var(--ease-standard); }

/* End of base.css */
