/* ==============================================
   Rock Movement - Unified Theme Stylesheet
   Version: 2.0.0
   Last Updated: January 2025
   ============================================== */

/* ==============================================
   1. CSS VARIABLES & THEME SYSTEM
   ============================================== */

:root {
  /* Color Palette */
  --sage-green: #87a96b;
  --earth-brown: #8b4513;
  --sky-blue: #87ceeb;
  --sunset-orange: #ff6347;
  --lavender: #e6e6fa;
  --gold-accent: #daa520;
  --charcoal-dark: #2d5016;
  --canvas-white: #fefefe;
  --text-dark: #1a1a1a;
  --text-light: #666;

  /* Layout */
  --max-width: 1400px;
  --safe-top: env(safe-area-inset-top);
  --safe-right: env(safe-area-inset-right);
  --safe-bottom: env(safe-area-inset-bottom);
  --safe-left: env(safe-area-inset-left);

  /* Typography */
  --font-primary: 'Quicksand', sans-serif;
  --font-display: 'Playfair Display', serif;
  --font-size-base: 16px;
  --line-height-base: 1.6;

  /* Transitions */
  --transition-base: all 0.3s ease;
  --transition-fast: all 0.2s ease;

  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.2);
}

/* ==============================================
   2. DARK MODE THEME
   ============================================== */

[data-theme='dark'] {
  --canvas-white: #1a1a1a;
  --text-dark: #e0e0e0;
  --text-light: #b0b0b0;
  --charcoal-dark: #0d0d0d;

  /* Dark mode specific variables */
  --bg-primary: #1a1a1a;
  --bg-secondary: #242424;
  --bg-tertiary: #2e2e2e;
  --border-light: rgba(255, 255, 255, 0.1);
  --border-medium: rgba(255, 255, 255, 0.2);
}

/* Dark mode backgrounds */
[data-theme='dark'] body {
  background: var(--bg-primary);
  background-image:
    radial-gradient(circle at 15% 25%, rgba(135, 169, 107, 0.03) 0%, transparent 60%),
    radial-gradient(circle at 85% 15%, rgba(114, 137, 218, 0.02) 0%, transparent 55%);
}

[data-theme='dark'] .navbar {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
  border-bottom: 1px solid var(--border-light);
}

[data-theme='dark'] .footer {
  background: linear-gradient(to bottom, var(--bg-secondary), var(--bg-primary));
  border-top: 1px solid var(--border-light);
}

[data-theme='dark'] .card,
[data-theme='dark'] .modal-content,
[data-theme='dark'] .form-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
}

[data-theme='dark'] input,
[data-theme='dark'] textarea,
[data-theme='dark'] select {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-medium);
  color: var(--text-dark);
}

[data-theme='dark'] .btn-primary {
  background: linear-gradient(135deg, #4a7c3c, #8fb577);
  border: 1px solid rgba(143, 181, 119, 0.2);
}

[data-theme='dark'] .btn-secondary {
  background: transparent;
  border: 2px solid var(--sage-green);
  color: var(--sage-green);
}

/* ==============================================
   3. iOS OPTIMIZATIONS
   ============================================== */

/* Prevent iOS zoom on input focus */
@supports (-webkit-touch-callout: none) {
  input[type='text'],
  input[type='email'],
  input[type='password'],
  input[type='number'],
  input[type='tel'],
  input[type='url'],
  textarea,
  select {
    font-size: 16px !important;
  }
}

/* iOS safe areas */
@supports (padding: max(0px)) {
  .navbar {
    padding-top: max(1rem, var(--safe-top));
  }

  .footer {
    padding-bottom: max(1rem, var(--safe-bottom));
  }

  .container {
    padding-left: max(20px, var(--safe-left));
    padding-right: max(20px, var(--safe-right));
  }
}

/* iOS touch optimization */
@media (pointer: coarse) {
  button,
  a,
  input,
  select,
  textarea,
  .clickable {
    min-height: 44px;
    min-width: 44px;
  }

  .nav-menu a {
    padding: 1rem;
  }
}

/* Smooth scrolling on iOS */
* {
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

/* Prevent iOS bounce scrolling */
html,
body {
  overscroll-behavior: none;
  position: relative;
  width: 100%;
}

/* ==============================================
   4. RESPONSIVE UTILITIES
   ============================================== */

/* Mobile-first responsive breakpoints */
@media (max-width: 576px) {
  .hide-mobile {
    display: none !important;
  }
}

@media (min-width: 577px) and (max-width: 768px) {
  .hide-tablet {
    display: none !important;
  }
}

@media (min-width: 769px) {
  .hide-desktop {
    display: none !important;
  }
}

/* Container responsive sizing */
@media (max-width: 768px) {
  .container {
    padding: 0 15px;
  }

  .footer-content {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .nav-menu {
    position: fixed;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--canvas-white);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .nav-menu.active {
    transform: translateX(0);
  }
}

/* ==============================================
   5. ACCESSIBILITY FEATURES
   ============================================== */

/* Focus styles */
:focus-visible {
  outline: 2px solid var(--gold-accent);
  outline-offset: 2px;
}

/* Skip to main content */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--charcoal-dark);
  color: white;
  padding: 8px;
  text-decoration: none;
  z-index: 100;
}

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

/* Reduced motion */
@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;
  }
}

/* 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;
}

/* ==============================================
   6. PERFORMANCE OPTIMIZATIONS
   ============================================== */

/* Prevent layout shift */
img,
video {
  max-width: 100%;
  height: auto;
  aspect-ratio: attr(width) / attr(height);
}

/* Hardware acceleration for animations */
.animate {
  will-change: transform;
  transform: translateZ(0);
}

/* Optimize font loading */
.fonts-loaded {
  font-family: var(--font-primary);
}

/* Lazy loading images */
img[loading='lazy'] {
  background: var(--bg-secondary);
}

/* ==============================================
   7. PRINT STYLES
   ============================================== */

@media print {
  *,
  *::before,
  *::after {
    background: transparent !important;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  a,
  a:visited {
    text-decoration: underline;
  }

  a[href]::after {
    content: ' (' attr(href) ')';
  }

  abbr[title]::after {
    content: ' (' attr(title) ')';
  }

  a[href^='#']::after,
  a[href^='javascript:']::after {
    content: '';
  }

  pre {
    white-space: pre-wrap !important;
  }

  pre,
  blockquote {
    border: 1px solid #999;
    page-break-inside: avoid;
  }

  thead {
    display: table-header-group;
  }

  tr,
  img {
    page-break-inside: avoid;
  }

  p,
  h2,
  h3 {
    orphans: 3;
    widows: 3;
  }

  h2,
  h3 {
    page-break-after: avoid;
  }

  .navbar,
  .footer,
  .no-print {
    display: none !important;
  }
}
