/* ==========================================================================
   EcoLeaf Notes - Design System
   Inspired by Organic Minimalism, Warm Paper Journal & ui-ux-pro-max guidelines
   ========================================================================== */

:root {
  /* --- Brand Color Palette: Forest, Sage & Earth --- */
  --color-forest-950: #0a1910;
  --color-forest-900: #102a1b;
  --color-forest-800: #183e28;
  --color-forest-700: #225437;
  --color-forest-600: #2d6a4f;
  --color-sage-500: #40916c;
  --color-sage-400: #52b788;
  --color-mint-300: #74c69d;
  --color-mint-200: #95d5b2;
  --color-mint-100: #d8f3dc;
  --color-mint-50: #edf8f1;

  /* --- Warm Paper & Earth Accents --- */
  --color-earth-amber: #c48b48;
  --color-earth-ochre: #dd9e54;
  --color-earth-wood: #8c5836;
  --color-paper-base: #fbf9f4;
  --color-paper-surface: #ffffff;
  --color-paper-subtle: #f4efe6;
  --color-paper-border: #e6ded1;
  --color-paper-border-hover: #d3c7b5;

  /* --- Text & Semantic Neutral (Light Mode) --- */
  --color-text-primary: #19241c;
  --color-text-secondary: #48594d;
  --color-text-muted: #738578;
  --color-text-on-dark: #ffffff;
  
  --color-bg-canvas: #f6f3eb;
  --color-bg-surface: #ffffff;
  --color-bg-card: #ffffff;
  --color-bg-tag: rgba(64, 145, 108, 0.12);
  --color-border: #e4dcd0;
  --color-border-hover: #cfc2b1;
  --color-accent: #2d6a4f;
  --color-accent-hover: #1b4332;
  --color-accent-light: #edf8f1;
  --color-badge-bg: #e3f2e9;
  --color-badge-text: #1b4d36;

  /* --- Feedback Colors --- */
  --color-success: #2e7d32;
  --color-danger: #c0392b;
  --color-danger-bg: #fde8e7;
  --color-warning: #d97706;

  /* --- Typography Scale --- */
  --font-serif: 'Lora', 'Songti SC', 'SimSun', serif;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-handwriting: 'Caveat', cursive, sans-serif;

  --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.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.68;

  /* --- Shadows & Organic Glows --- */
  --shadow-sm: 0 1px 2px rgba(27, 36, 28, 0.05);
  --shadow-md: 0 4px 14px rgba(27, 36, 28, 0.06), 0 1px 3px rgba(27, 36, 28, 0.04);
  --shadow-lg: 0 10px 28px rgba(27, 36, 28, 0.08), 0 2px 6px rgba(27, 36, 28, 0.04);
  --shadow-floating: 0 20px 38px -10px rgba(16, 42, 27, 0.15), 0 1px 3px rgba(16, 42, 27, 0.05);
  --shadow-card-hover: 0 14px 28px rgba(45, 106, 79, 0.12), 0 2px 8px rgba(45, 106, 79, 0.06);

  /* --- Border Radius --- */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* --- Transitions --- */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 220ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 320ms cubic-bezier(0.16, 1, 0.3, 1);

  /* --- Spacing --- */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;

  /* --- Touch Targets --- */
  --min-touch-size: 44px;
}

/* ==========================================================================
   Dark Mode (OLED Deep Forest Night)
   ========================================================================== */
[data-theme="dark"] {
  --color-text-primary: #e6ede8;
  --color-text-secondary: #a9beae;
  --color-text-muted: #728c78;
  --color-text-on-dark: #ffffff;

  --color-bg-canvas: #0b140e;
  --color-bg-surface: #121f17;
  --color-bg-card: #14241b;
  --color-bg-tag: rgba(116, 198, 157, 0.15);
  --color-border: #1f3326;
  --color-border-hover: #2d4c38;
  --color-accent: #52b788;
  --color-accent-hover: #74c69d;
  --color-accent-light: rgba(82, 183, 136, 0.14);
  --color-badge-bg: #1c3627;
  --color-badge-text: #95d5b2;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
  --shadow-floating: 0 20px 40px rgba(0, 0, 0, 0.6);
  --shadow-card-hover: 0 14px 28px rgba(82, 183, 136, 0.15), 0 2px 10px rgba(0, 0, 0, 0.5);
}

/* ==========================================================================
   Base CSS Reset & Typography
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--color-bg-canvas);
  color: var(--color-text-primary);
  line-height: var(--leading-relaxed);
  min-height: 100vh;
  transition: background-color var(--transition-normal), color var(--transition-normal);
  background-image: 
    radial-gradient(ellipse at 15% 10%, rgba(82, 183, 136, 0.08) 0%, transparent 40%),
    radial-gradient(ellipse at 85% 80%, rgba(196, 139, 72, 0.06) 0%, transparent 45%);
  background-attachment: fixed;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  color: var(--color-text-primary);
  line-height: var(--leading-tight);
  font-weight: 600;
}

p {
  color: var(--color-text-secondary);
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

button {
  font-family: inherit;
  font-size: inherit;
  border: none;
  background: none;
  cursor: pointer;
  outline: none;
  color: inherit;
}

input, textarea, select {
  font-family: inherit;
  font-size: var(--text-base);
  color: var(--color-text-primary);
  outline: none;
}

ul, ol {
  list-style: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Accessibility Focus Ring */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* SVG Icon Base */
.icon-svg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  stroke-width: 2;
  stroke: currentColor;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
