/* ========================================================================
   Eco Shop PL - Base Styles
   A modern, minimalist, eco-friendly design foundation
   ------------------------------------------------------------------------
   Sections:
   1) CSS Variables
   2) Reset & Normalize
   3) Base Typography & Elements
   4) Layout Utilities
   5) Accessibility Utilities
   6) Components (Buttons, Inputs, Cards)
   ======================================================================== */

/* ========================================================================
   1) CSS VARIABLES
   ======================================================================== */
:root {
  /* Color Palette - Earth tones & fresh greens */
  --color-background: #f4f5f1;      /* soft warm off-white */
  --color-surface: #ffffff;         /* pure white for surfaces/cards */
  --color-text: #1f2723;            /* deep, natural charcoal green */
  --color-text-muted: #6a746e;      /* soft muted gray-green */

  --color-primary: #3c7f5a;         /* eco green */
  --color-primary-soft: #e0f2e7;    /* pale green tint */
  --color-primary-strong: #25533a;  /* darker variant for hover/focus */

  --color-success: #3c7f5a;         /* aligned with primary for simplicity */
  --color-warning: #c98a2e;         /* warm amber */
  --color-danger: #b3423b;          /* earthy brick red */

  /* Neutral Grays */
  --gray-50: #f7f7f5;
  --gray-100: #e4e5e1;
  --gray-200: #d1d4ce;
  --gray-300: #b6bbb2;
  --gray-400: #9ca398;
  --gray-500: #818a7e;
  --gray-600: #666f64;
  --gray-700: #4d554b;
  --gray-800: #343a34;
  --gray-900: #1f2420;

  /* Typography */
  --font-family-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Helvetica, Arial, sans-serif;
  --font-family-serif: "Georgia", "Times New Roman", serif;
  --font-family-accent: "Poppins", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, Helvetica, 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 */
  --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 (0–96px) */
  --space-0: 0;
  --space-1: 0.125rem;  /* 2px */
  --space-2: 0.25rem;   /* 4px */
  --space-3: 0.375rem;  /* 6px */
  --space-4: 0.5rem;    /* 8px */
  --space-5: 0.625rem;  /* 10px */
  --space-6: 0.75rem;   /* 12px */
  --space-8: 1rem;      /* 16px */
  --space-10: 1.25rem;  /* 20px */
  --space-12: 1.5rem;   /* 24px */
  --space-16: 2rem;     /* 32px */
  --space-20: 2.5rem;   /* 40px */
  --space-24: 3rem;     /* 48px */
  --space-32: 4rem;     /* 64px */
  --space-40: 5rem;     /* 80px */
  --space-48: 6rem;     /* 96px */

  /* Radius */
  --radius-none: 0;
  --radius-xs: 2px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 20px;
  --radius-full: 999px;

  /* Shadows - soft, natural */
  --shadow-xs: 0 1px 2px rgba(15, 23, 15, 0.06);
  --shadow-sm: 0 2px 4px rgba(15, 23, 15, 0.08);
  --shadow-md: 0 8px 18px rgba(15, 23, 15, 0.12);
  --shadow-lg: 0 14px 30px rgba(15, 23, 15, 0.16);

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

  /* Layout */
  --container-max-width: 1120px;
  --container-padding-x: 1.25rem;
}

/* ========================================================================
   2) RESET & NORMALIZE
   Inspired by modern normalize + minimal opinionated resets
   ======================================================================== */

/* Box sizing border-box for all elements */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

/* Set core body defaults */
html {
  scroll-behavior: smooth;
  text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* Remove list styles on ul, ol elements with a class attribute */
ul[class],
ol[class] {
  list-style: none;
  padding-left: 0;
}

/* Reset images and media to be responsive */
img,
svg,
video,
canvas,
audio,
iframe,
embed,
object {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

/* Inherit fonts for form controls */
input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

button,
[role="button"] {
  cursor: pointer;
}

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

/* Remove default button, input styles where reasonable */
button {
  border: none;
  background: none;
  padding: 0;
}

textarea {
  resize: vertical;
}

/* Basic table reset */
table {
  border-collapse: collapse;
  border-spacing: 0;
  width: 100%;
}

/* Anchor default reset */
a {
  color: inherit;
  text-decoration: none;
}

/* ========================================================================
   3) BASE TYPOGRAPHY & ELEMENTS
   ======================================================================== */

body {
  font-family: var(--font-family-sans);
  font-size: var(--font-size-base);
  line-height: var(--line-height-relaxed);
  background-color: var(--color-background);
  color: var(--color-text);
}

/* Headings - modern, scalable, slightly tighter line-height */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-family-accent);
  font-weight: 600;
  line-height: var(--line-height-snug);
  color: var(--color-text);
}

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

h2 {
  font-size: var(--font-size-3xl);
  letter-spacing: -0.025em;
  margin-bottom: var(--space-12);
}

h3 {
  font-size: var(--font-size-2xl);
  letter-spacing: -0.02em;
  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-base);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
}

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

p:last-child {
  margin-bottom: 0;
}

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

strong {
  font-weight: 600;
}

/* Links - subtle underline on hover to keep layout clean */
a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-base);
}

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

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

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

/* ========================================================================
   4) LAYOUT UTILITIES
   ======================================================================== */

/* Centered content container */
.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);
}

/* Flex utilities */
.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-around {
  justify-content: space-around;
}

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

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

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

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

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

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

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

/* Simple spacing helpers (margin / padding) - minimal set */
.mt-0 { margin-top: 0; }
.mt-8 { margin-top: var(--space-8); }
.mt-16 { margin-top: var(--space-16); }
.mt-24 { margin-top: var(--space-24); }

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

.pt-16 { padding-top: var(--space-16); }
.pb-16 { padding-bottom: var(--space-16); }
.pt-24 { padding-top: var(--space-24); }
.pb-24 { padding-bottom: var(--space-24); }

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

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

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

/* ========================================================================
   5) ACCESSIBILITY UTILITIES
   ======================================================================== */

/* 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:active,
.sr-only-focusable:focus {
  position: static;
  width: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

/* Focus styles - use :focus-visible for modern, non-intrusive outlines */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

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

/* ========================================================================
   6) COMPONENTS
   Basic building blocks for Eco Shop PL
   ======================================================================== */

/* -------------------- Buttons -------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  padding: 0.7rem 1.5rem;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  font-size: var(--font-size-sm);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background-color: var(--color-primary);
  color: #ffffff;
  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);
}

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

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

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

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

/* Button variants */
.btn--outline {
  background-color: transparent;
  color: var(--color-primary-strong);
  border-color: var(--color-primary);
  box-shadow: none;
}

.btn--outline:hover {
  background-color: var(--color-primary-soft);
  box-shadow: var(--shadow-sm);
}

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

.btn--ghost:hover {
  background-color: rgba(60, 127, 90, 0.06);
}

/* Size variants */
.btn--sm {
  padding: 0.5rem 1.1rem;
  font-size: var(--font-size-xs);
}

.btn--lg {
  padding: 0.85rem 1.9rem;
  font-size: var(--font-size-md);
}

/* -------------------- Form Inputs -------------------- */

.input,
.select,
.textarea {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-200);
  background-color: var(--color-surface);
  color: var(--color-text);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-normal);
  transition:
    border-color var(--transition-base),
    box-shadow var(--transition-base),
    background-color var(--transition-base);
}

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

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 1px var(--color-primary-soft);
}

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

/* Label & helper text */
.label {
  display: block;
  margin-bottom: var(--space-4);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--gray-800);
}

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

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

/* -------------------- Card Component -------------------- */

.card {
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-16);
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(15, 23, 15, 0.03);
}

.card--soft {
  background-color: var(--gray-50);
  box-shadow: none;
}

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

.card-title {
  font-family: var(--font-family-accent);
  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);
}

/* Product image wrapper - maintains clean aspect ratio */
.card-media {
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: var(--space-8);
}

.card-media img {
  display: block;
  width: 100%;
  height: auto;
}

/* -------------------- Badges / Pills (for eco labels, etc.) -------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.15rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background-color: var(--gray-100);
  color: var(--gray-700);
}

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

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

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

/* -------------------- Simple Tag List for filters/categories -------------------- */

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--gray-200);
  font-size: var(--font-size-xs);
  color: var(--gray-700);
  background-color: #ffffff;
  transition:
    background-color var(--transition-base),
    border-color var(--transition-base),
    color var(--transition-base);
}

.tag--active,
.tag:hover {
  border-color: var(--color-primary);
  background-color: var(--color-primary-soft);
  color: var(--color-primary-strong);
}

/* ========================================================================
   RESPONSIVE TWEAKS
   ======================================================================== */

@media (min-width: 768px) {
  h1 {
    font-size: 2.5rem;
  }

  h2 {
    font-size: 2rem;
  }

  h3 {
    font-size: 1.75rem;
  }

  .container {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

@media (min-width: 1024px) {
  h1 {
    font-size: 2.75rem;
  }

  h2 {
    font-size: 2.25rem;
  }
}
