/* Base CSS - Design Tokens, Reset, and Core Styles */

/* Design Tokens (CSS Custom Properties) */
:root {
  /* Spacing */
  --space-1: .2rem;
  --space-2: .4rem;
  --space-3: .8rem;
  --space-4: 1.2rem;
  --space-5: 1.6rem;
  --space-6: 2.4rem;
  
  /* Colors - Light Mode (Default) */
  --bg: #f0ede9;
  --text: #111111;
  --fg: #111;
  --muted: #666;
  --text-muted: #ccc;
  --brand: #4CAF50;
  --brand-hover: #45a049;
  --border: #e6e6e6;
  --border-focus: #4CAF50;
  --bg-muted: #f8f9fa;
  --bg-hover: #e9ecef;
  --error: #dc3545;
  --success: #28a745;
  --success-bg: #e8f5e8;
  --success-dark: #1b5e20;
  --success-light: #81c784;
  --warning: #ffc107;
  
  /* Typography */
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --font-size-xs: 0.7rem;
  --font-size-sm: 0.8rem;
  --font-size-base: 0.9rem;
  --font-size-lg: 1rem;
  --font-size-xl: 1.1rem;
  --font-size-2xl: 1.3rem;
  --font-size-3xl: 1.6rem;
  --line-height-tight: 1.2;
  --line-height-normal: 1.4;
  --line-height-relaxed: 1.6;
  --line-height-content: 1.4;
  --line-height-headings: 1.2;
  
  /* Layout */
  --max-w: 1200px;
  --column-gap: 20px;
  --left-column-width: 200px;
  --right-column-width: 200px;
  --center-min-width: 600px;
  --radius: 0.75rem;
  --radius-sm: 0.375rem;
  --radius-lg: 1rem;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  
  /* Focus */
  --focus: 2px solid var(--brand);
  --focus-offset: 2px;
  
  /* Z-index */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
  
  /* Transitions */
  --transition-fast: 150ms ease-in-out;
  --transition-normal: 250ms ease-in-out;
  --transition-slow: 350ms ease-in-out;
  
  /* Breakpoints */
  --breakpoint-tablet: 1024px;
  --breakpoint-mobile: 768px;
  
  /* 100vh handling for mobile browsers */
  --vh: 1vh;
  
  /* Color scheme support */
  color-scheme: light dark;
}

/* Dark Mode Theme */
[data-theme="dark"] {
  --bg: #0E0F12;
  --text: #FFFFFF;
  --fg: #FFFFFF;
  --muted: #CCCCCC;
  --text-muted: #999999;
  --brand: #4CAF50;
  --brand-hover: #45a049;
  --border: #333333;
  --border-focus: #4CAF50;
  --bg-muted: #1A1B1E;
  --bg-hover: #2A2B2E;
  --error: #dc3545;
  --success: #28a745;
  --success-bg: #1a3d1a;
  --success-dark: #1b5e20;
  --success-light: #81c784;
  --warning: #ffc107;
}

/* Body styles */
body {
  background: var(--bg);
  color: var(--text);
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Header styles */
.site-header {
  background: #4CAF50;
  border-bottom: 1px solid #45a049;
  padding: 10px 0;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo-link {
  font-size: 24px;
  font-weight: bold;
  color: white;
  text-decoration: none;
  transition: color var(--transition-fast);
}

.logo-link:hover {
  color: #e8f5e8;
}

/* Footer styles */
.site-footer {
  background: #4CAF50;
  border-top: 1px solid #45a049;
  padding: 10px 0;
  text-align: center;
}

.footer-links {
  color: white;
  font-size: 14px;
}

.footer-links a {
  color: white;
  text-decoration: none;
  transition: color var(--transition-fast);
}

.footer-links a:hover {
  color: #e8f5e8;
}

.footer-copyright {
  color: white;
  font-size: 14px;
}



/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  :root {
    --transition-fast: 0ms;
    --transition-normal: 0ms;
    --transition-slow: 0ms;
  }
  
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Reset and Base Styles */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px; /* Prevents zoom on iOS */
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  color: var(--fg);
  background-color: var(--bg);
  min-height: 100vh;
  min-height: calc(var(--vh, 1vh) * 100);
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--space-3) 0;
  font-weight: 600;
  line-height: var(--line-height-tight);
  color: var(--fg);
}

h1 { font-size: var(--font-size-3xl); }
h2 { font-size: var(--font-size-2xl); }
h3 { font-size: var(--font-size-xl); }
h4 { font-size: var(--font-size-lg); }
h5 { font-size: var(--font-size-base); }
h6 { font-size: var(--font-size-sm); }

p {
  margin: 0 0 var(--space-3) 0;
  line-height: var(--line-height-relaxed);
}

/* Links */
a {
  color: var(--brand);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--brand-hover);
}

a:focus-visible {
  outline: var(--focus);
  outline-offset: var(--focus-offset);
}

/* Images */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Form Elements */
input,
select,
textarea,
button {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

/* Focus Management */
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: var(--focus);
  outline-offset: var(--focus-offset);
}



/* 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;
}

/* Container */
.container {
  max-width: var(--max-w);
  margin-inline: auto;
  padding-inline: var(--space-3);
}

/* Grid System */
.grid {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

/* Grid Column Utilities */
.col-1 { grid-column: span 1; }
.col-2 { grid-column: span 2; }
.col-3 { grid-column: span 3; }
.col-4 { grid-column: span 4; }
.col-5 { grid-column: span 5; }
.col-6 { grid-column: span 6; }
.col-7 { grid-column: span 7; }
.col-8 { grid-column: span 8; }
.col-9 { grid-column: span 9; }
.col-10 { grid-column: span 10; }
.col-11 { grid-column: span 11; }
.col-12 { grid-column: span 12; }

/* Responsive Grid Columns */
@media (min-width: 480px) {
  .col-sm-6 { grid-column: span 6; }
  .col-sm-12 { grid-column: span 12; }
}

@media (min-width: 768px) {
  .col-md-4 { grid-column: span 4; }
  .col-md-6 { grid-column: span 6; }
  .col-md-8 { grid-column: span 8; }
  .col-md-12 { grid-column: span 12; }
}

@media (min-width: 1024px) {
  .col-lg-3 { grid-column: span 3; }
  .col-lg-4 { grid-column: span 4; }
  .col-lg-6 { grid-column: span 6; }
  .col-lg-8 { grid-column: span 8; }
  .col-lg-9 { grid-column: span 9; }
  .col-lg-12 { grid-column: span 12; }
}

@media (min-width: 1280px) {
  .col-xl-2 { grid-column: span 2; }
  .col-xl-3 { grid-column: span 3; }
  .col-xl-4 { grid-column: span 4; }
  .col-xl-6 { grid-column: span 6; }
  .col-xl-8 { grid-column: span 8; }
  .col-xl-10 { grid-column: span 10; }
  .col-xl-12 { grid-column: span 12; }
}

/* Flexbox Utilities */
.flex {
  display: flex;
}

.flex-col {
  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-start {
  justify-content: flex-start;
}

.justify-end {
  justify-content: flex-end;
}

/* Spacing Utilities */
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-5 { gap: var(--space-5); }

.p-1 { padding: var(--space-1); }
.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-5 { padding: var(--space-5); }

.m-1 { margin: var(--space-1); }
.m-2 { margin: var(--space-2); }
.m-3 { margin: var(--space-3); }
.m-4 { margin: var(--space-4); }
.m-5 { margin: var(--space-5); }

/* Text Utilities */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-xs { font-size: var(--font-size-xs); }
.text-sm { font-size: var(--font-size-sm); }
.text-base { font-size: var(--font-size-base); }
.text-lg { font-size: var(--font-size-lg); }
.text-xl { font-size: var(--font-size-xl); }
.text-2xl { font-size: var(--font-size-2xl); }

.text-muted { color: var(--muted); }
.text-brand { color: var(--brand); }
.text-error { color: var(--error); }
.text-success { color: var(--success); }

/* Border Utilities */
.border {
  border: 1px solid var(--border);
}

.border-radius {
  border-radius: var(--radius);
}

.border-radius-sm {
  border-radius: var(--radius-sm);
}

.border-radius-lg {
  border-radius: var(--radius-lg);
}

/* Shadow Utilities */
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow { box-shadow: var(--shadow); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

/* Background Utilities */
.bg-brand { background-color: var(--brand); }
.bg-muted { background-color: var(--muted); }
.bg-error { background-color: var(--error); }
.bg-success { background-color: var(--success); }

/* Safe Area Support for iOS */
@supports (padding: max(0px)) {
  .safe-area-top {
    padding-top: max(var(--space-3), env(safe-area-inset-top));
  }
  
  .safe-area-bottom {
    padding-bottom: max(var(--space-3), env(safe-area-inset-bottom));
  }
  
  .safe-area-left {
    padding-left: max(var(--space-3), env(safe-area-inset-left));
  }
  
  .safe-area-right {
    padding-right: max(var(--space-3), env(safe-area-inset-right));
  }
}

/* Touch Action Optimization */
button,
input,
select,
textarea {
  touch-action: manipulation;
}

/* Container Query Support */
@supports (container-type: inline-size) {
  .container-query {
    container-type: inline-size;
  }
}

/* Print Styles */
@media print {
  .ad-placeholder,
  .left-ad-column,
  .right-sidebar-column {
    display: none !important;
  }
  
  body {
    background: white !important;
    color: black !important;
  }
  
  a {
    color: black !important;
    text-decoration: underline !important;
  }
}