/* =========================================
   1. VARIABLES & THEME CONFIGURATION
   ========================================= */
:root {
  /* Color Palette: Sage, Sand, Lavender, Cream, Terracotta */
  --color-primary: #8DA399;       /* Sage Green */
  --color-primary-hover: #768C82;
  --color-secondary: #C88D7F;     /* Muted Terracotta */
  --color-sand: #E6E2DD;          /* Warm Sand */
  --color-lavender: #EBEBF2;      /* Light Lavender */
  --color-background: #FAFAF8;    /* Creamy White */
  --color-surface: #FFFFFF;       /* Pure White */
  
  --color-text-main: #464644;     /* Dark Warm Grey */
  --color-text-muted: #787875;
  --color-border: #DCDCDA;

  /* System Colors */
  --color-success: #6B8E6B;
  --color-warning: #D9A441;
  --color-danger: #C06060;

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-serif: "Georgia", "Times New Roman", serif; /* Elegant serif for headings */
  
  --size-base: 1rem;
  --size-sm: 0.875rem;
  --size-lg: 1.25rem;
  --size-xl: 1.5rem;
  --size-2xl: 2rem;
  --size-3xl: 2.5rem;
  --size-4xl: 3rem;

  --line-height-tight: 1.2;
  --line-height-base: 1.6;
  --line-height-loose: 1.8;

  /* Spacing Scale */
  --space-1: 0.25rem;  /* 4px */
  --space-2: 0.5rem;   /* 8px */
  --space-3: 0.75rem;  /* 12px */
  --space-4: 1rem;     /* 16px */
  --space-6: 1.5rem;   /* 24px */
  --space-8: 2rem;     /* 32px */
  --space-12: 3rem;    /* 48px */
  --space-16: 4rem;    /* 64px */
  --space-24: 6rem;    /* 96px */

  /* UI Elements */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(70, 70, 68, 0.05), 0 2px 4px -1px rgba(70, 70, 68, 0.03);
  --shadow-lg: 0 10px 15px -3px rgba(70, 70, 68, 0.05), 0 4px 6px -2px rgba(70, 70, 68, 0.02);

  --transition-base: 0.3s ease-in-out;
}

/* =========================================
   2. RESET & NORMALIZE
   ========================================= */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

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

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

/* =========================================
   3. BASE STYLES
   ========================================= */
body {
  font-family: var(--font-sans);
  background-color: var(--color-background);
  color: var(--color-text-main);
  line-height: var(--line-height-base);
  font-size: var(--size-base);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  font-weight: 400;
  color: var(--color-text-main);
  line-height: var(--line-height-tight);
  margin-bottom: var(--space-4);
  letter-spacing: -0.01em;
}

h1 { font-size: var(--size-4xl); }
h2 { font-size: var(--size-3xl); }
h3 { font-size: var(--size-2xl); }
h4 { font-size: var(--size-xl); }

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

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-base);
  cursor: pointer;
}

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

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

.flex {
  display: flex;
}

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

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

.justify-between {
  justify-content: space-between;
}

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

.grid {
  display: grid;
  gap: var(--space-6);
}

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

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

.mt-4 { margin-top: var(--space-4); }
.mt-8 { margin-top: var(--space-8); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-8 { margin-bottom: var(--space-8); }

/* =========================================
   5. COMPONENTS
   ========================================= */
/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 2rem;
  border-radius: var(--radius-full);
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: all var(--transition-base);
  border: 1px solid transparent;
  font-size: var(--size-base);
}

.btn-primary {
  background-color: var(--color-primary);
  color: white;
}

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

.btn-secondary {
  background-color: transparent;
  border-color: var(--color-secondary);
  color: var(--color-secondary);
}

.btn-secondary:hover {
  background-color: var(--color-secondary);
  color: white;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Inputs */
.input {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: var(--size-base);
  line-height: 1.5;
  color: var(--color-text-main);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(141, 163, 153, 0.2);
}

/* Cards */
.card {
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-base);
  border: 1px solid rgba(0,0,0,0.02);
}

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

/* Section Backgrounds for Theme */
.bg-sand {
  background-color: var(--color-sand);
}

.bg-lavender {
  background-color: var(--color-lavender);
}

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

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