/* ==========================================================================
   FILE: /bonsai/assets/css/global.css
   PROJECT: Bonsai Collection Tracker
   PURPOSE: Universal responsive styling, layout, typography (mobile-first)
   VERSION: v6.0 - Fully Responsive
   UPDATED: 2025-11-19
   
   BREAKPOINTS (T-shirt sizes):
   - XS: Mobile phones (≤576px)
   - S: Tablets (577px-768px)
   - M: Laptops (769px-1024px)
   - L: Desktop (1025px-1440px)
   - XL: Widescreen (≥1441px)
   
   TABLE OF CONTENTS:
   1. CSS VARIABLES
   2. RESET & BASE
   3. TYPOGRAPHY (Responsive)
   4. GLOBAL LAYOUT CONTAINERS
   5. HEADER (Responsive Navigation)
   6. FOOTER
   7. LINKS & BUTTONS
   8. UTILITIES
   9. RESPONSIVE BREAKPOINTS
   ========================================================================== */

/* ==========================================================================
   1. CSS VARIABLES
   ========================================================================== */

:root {
  /* Color Palette */
  --color-primary: #5a8245;
  --color-primary-dark: #436934;
  --color-primary-darker: #3a5c2d;
  --color-bg-light: #f7f8f4;
  --color-bg-white: #ffffff;
  --color-text-dark: #2d362d;
  --color-text-base: #1d1f21;
  --color-text-muted: #777;
  --color-border: #e9e9e9;
  --color-border-light: #ebebeb;
  
  /* Spacing Scale (Mobile-First) */
  --space-xs: 0.25rem;    /* 4px */
  --space-sm: 0.5rem;     /* 8px */
  --space-md: 1rem;       /* 16px */
  --space-lg: 1.5rem;     /* 24px */
  --space-xl: 2rem;       /* 32px */
  --space-2xl: 3rem;      /* 48px */
  --space-3xl: 4rem;      /* 64px */
  
  /* Font Sizes (Mobile-First - rem based) */
  --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 */
  
  /* Container Widths */
  --container-sm: 640px;
  --container-md: 768px;
  --container-lg: 1024px;
  --container-xl: 1280px;
  --container-2xl: 1400px;
  
  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.25s ease;
  --transition-slow: 0.3s ease;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-base: 0 1px 4px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.12);
  
  /* Border Radius */
  --radius-sm: 4px;
  --radius-base: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
}

/* ==========================================================================
   2. RESET & BASE (Mobile-First)
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  /* Always reserve scrollbar space to prevent layout shift */
  overflow-y: scroll;
  /* Base font size - scales with device */
  font-size: 16px;
  line-height: 1.6;
  /* Smooth scrolling */
  scroll-behavior: smooth;
  /* Prevent font size adjustments on orientation change */
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 
               Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background-color: var(--color-bg-light);
  color: var(--color-text-base);
  font-size: var(--text-base);
  line-height: 1.6;
  /* Better font rendering */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Prevent horizontal overflow */
  overflow-x: hidden;
}

/* ==========================================================================
   3. TYPOGRAPHY (Responsive Scaling)
   ========================================================================== */

/* Mobile-First Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  color: var(--color-text-dark);
  line-height: 1.3;
  margin-bottom: 0.75rem;
  word-wrap: break-word;
}

h1 { font-size: var(--text-3xl); }  /* 30px */
h2 { font-size: var(--text-2xl); }  /* 24px */
h3 { font-size: var(--text-xl); }   /* 20px */
h4 { font-size: var(--text-lg); }   /* 18px */
h5 { font-size: var(--text-base); } /* 16px */
h6 { font-size: var(--text-sm); }   /* 14px */

p {
  line-height: 1.7;
  margin-bottom: var(--space-md);
}

/* Scale typography slightly on tablets */
@media (min-width: 577px) {
  h1 { font-size: calc(var(--text-3xl) * 1.1); }
  h2 { font-size: calc(var(--text-2xl) * 1.1); }
}

/* Scale typography on desktop */
@media (min-width: 1025px) {
  html {
    font-size: 17px;
  }
}

/* ==========================================================================
   4. GLOBAL LAYOUT CONTAINERS
   ========================================================================== */

.container {
  width: 100%;
  max-width: var(--container-xl);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-md);
  padding-right: var(--space-md);
}

/* Increase container padding on larger screens */
@media (min-width: 577px) {
  .container {
    padding-left: var(--space-lg);
    padding-right: var(--space-lg);
  }
}

@media (min-width: 769px) {
  .container {
    padding-left: var(--space-xl);
    padding-right: var(--space-xl);
  }
}

/* Container size variants */
.container-sm { max-width: var(--container-sm); }
.container-md { max-width: var(--container-md); }
.container-lg { max-width: var(--container-lg); }
.container-xl { max-width: var(--container-xl); }
.container-2xl { max-width: var(--container-2xl); }

/* ==========================================================================
   5. HEADER (Responsive Navigation)
   ========================================================================== */

header {
  background-color: var(--color-bg-white);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) 0;
  min-height: 60px;
}

/* Brand Section */
.site-brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.brand-link {
  display: flex;
  align-items: center;
  text-decoration: none;
  transition: opacity var(--transition-base);
}

.brand-link:hover {
  opacity: 0.85;
}

.logo {
  height: 48px;
  width: auto;
  max-width: 48px;
}

.brand-title {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: var(--text-lg);
  color: var(--color-text-dark);
  /* Hide on very small screens if needed */
  display: none;
}

/* Navigation */
.main-nav ul {
  list-style: none;
  display: flex;
  gap: var(--space-md);
  margin: 0;
  padding: 0;
}

.main-nav a {
  color: var(--color-primary);
  font-weight: 600;
  font-size: var(--text-sm);
  text-decoration: none;
  transition: color var(--transition-base);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  /* Touch-friendly */
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.main-nav a:hover,
.main-nav a:focus {
  color: var(--color-text-base);
}

.main-nav a.active {
  color: var(--color-text-base);
  pointer-events: none;
  cursor: default;
}

/* Tablet: Show brand title */
@media (min-width: 577px) {
  .brand-title {
    display: block;
    font-size: var(--text-xl);
  }
  
  .logo {
    height: 64px;
    max-width: 64px;
  }
  
  .header-bar {
    padding: var(--space-lg) 0;
  }
  
  .main-nav a {
    font-size: var(--text-base);
    gap: var(--space-md);
  }
}

/* Desktop: Larger header */
@media (min-width: 1025px) {
  .brand-title {
    font-size: var(--text-2xl);
  }
  
  .logo {
    height: 80px;
    max-width: 80px;
  }
  
  .main-nav ul {
    gap: var(--space-lg);
  }
}

/* ==========================================================================
   6. FOOTER
   ========================================================================== */

footer {
  background-color: var(--color-bg-white);
  color: var(--color-text-muted);
  text-align: center;
  padding: var(--space-lg) 0;
  font-size: var(--text-sm);
  margin-top: var(--space-2xl);
  border-top: 1px solid var(--color-border);
}

@media (min-width: 769px) {
  footer {
    padding: var(--space-xl) 0;
  }
}

/* ==========================================================================
   7. LINKS & BUTTONS
   ========================================================================== */

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-base);
}

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

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

/* Buttons */
button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  outline: none;
  background-color: var(--color-primary);
  color: var(--color-bg-white);
  font-weight: 600;
  font-size: var(--text-base);
  border-radius: var(--radius-base);
  padding: 0.75rem 1.5rem;
  cursor: pointer;
  transition: background-color var(--transition-base), 
              transform var(--transition-fast);
  text-decoration: none;
  /* Touch-friendly */
  min-height: 44px;
  touch-action: manipulation;
  user-select: none;
}

button:active,
.btn:active {
  transform: scale(0.98);
}

/* Only apply hover on non-touch devices */
@media (hover: hover) {
  button:hover,
  .btn:hover {
    background-color: var(--color-primary-dark);
  }
}

button:focus-visible,
.btn:focus-visible {
  outline: 3px solid var(--color-bg-white);
  outline-offset: 2px;
}

/* Button variants */
.btn-secondary {
  background-color: var(--color-text-muted);
}

@media (hover: hover) {
  .btn-secondary:hover {
    background-color: #5a5a5a;
  }
}

/* ==========================================================================
   8. UTILITIES
   ========================================================================== */

/* Text Alignment */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* Display */
.hidden { display: none !important; }
.block { display: block; }
.inline-block { display: inline-block; }
.flex { display: flex; }
.grid { display: grid; }

/* Spacing Utilities */
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--space-sm); }
.mt-2 { margin-top: var(--space-md); }
.mt-3 { margin-top: var(--space-lg); }
.mt-4 { margin-top: var(--space-xl); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--space-sm); }
.mb-2 { margin-bottom: var(--space-md); }
.mb-3 { margin-bottom: var(--space-lg); }
.mb-4 { margin-bottom: var(--space-xl); }

.p-0 { padding: 0; }
.p-1 { padding: var(--space-sm); }
.p-2 { padding: var(--space-md); }
.p-3 { padding: var(--space-lg); }
.p-4 { padding: var(--space-xl); }

/* Width Utilities */
.w-full { width: 100%; }
.w-auto { width: auto; }

/* Max Width Utilities */
.max-w-sm { max-width: var(--container-sm); }
.max-w-md { max-width: var(--container-md); }
.max-w-lg { max-width: var(--container-lg); }
.max-w-xl { max-width: var(--container-xl); }

/* ==========================================================================
   9. RESPONSIVE UTILITIES
   ========================================================================== */

/* Hide/Show at Breakpoints */
.hide-xs { display: none; }
.show-xs { display: block; }

@media (min-width: 577px) {
  .hide-xs { display: block; }
  .show-xs { display: none; }
  .hide-sm { display: none; }
  .show-sm { display: block; }
}

@media (min-width: 769px) {
  .hide-sm { display: block; }
  .show-sm { display: none; }
  .hide-md { display: none; }
  .show-md { display: block; }
}

@media (min-width: 1025px) {
  .hide-md { display: block; }
  .show-md { display: none; }
  .hide-lg { display: none; }
  .show-lg { display: block; }
}

@media (min-width: 1441px) {
  .hide-lg { display: block; }
  .show-lg { display: none; }
  .hide-xl { display: none; }
  .show-xl { display: block; }
}

/* ==========================================================================
   ACCESSIBILITY
   ========================================================================== */

/* Skip to main content link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--color-primary);
  color: white;
  padding: var(--space-sm) var(--space-md);
  text-decoration: none;
  z-index: 1000;
}

.skip-link:focus {
  top: 0;
}

/* Reduce motion for users who prefer it */
@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;
  }
}

/* Focus visible improvements */
*:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

/* ==========================================================================
   PRINT STYLES
   ========================================================================== */

@media print {
  body {
    background-color: white;
  }
  
  header,
  footer,
  .main-nav,
  button,
  .btn {
    display: none;
  }
  
  a {
    text-decoration: underline;
  }
  
  .container {
    max-width: 100%;
  }
}

/* ==========================================================================
   END OF FILE: global.css | v6.0.0 | 2025-11-19 22:00 UTC
   ========================================================================== */
