/* ===== GLOBAL OPTIMIZED CSS ===== */
/* Deferred loading - non-critical styles */

/* Sections */
.section {
  padding: 3rem 0;
}

.section-alt {
  background: var(--darker);
}

.section h2 {
  font-size: clamp(1.4rem, 4vw, 2rem);
  margin-bottom: 1rem;
  text-align: center;
}

.section-intro {
  text-align: center;
  color: var(--text-secondary);
  max-width: 700px;
  margin: 0 auto 1.5rem;
  font-size: clamp(0.95rem, 2.5vw, 1.1rem);
}

/* Buttons */
.btn-lg {
  padding: 1rem 2rem;
  font-size: 1rem;
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--accent);
  color: var(--accent);
}

.btn-outline:hover {
  background: var(--accent);
  color: #fff;
}

.btn-sub {
  display: block;
  font-size: 0.7rem;
  font-weight: 400;
  opacity: 0.8;
  margin-top: 2px;
}

/* Cards */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1.25rem;
  border: 1px solid rgba(255,255,255,0.1);
  transition: transform 0.2s, border-color 0.2s;
}

.card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
}

/* Grids - Mobile first */
.grid-2, .grid-3, .grid-4 {
  display: grid;
  gap: 1rem;
}

.grid-2 { grid-template-columns: 1fr; }
.grid-3 { grid-template-columns: 1fr; }
.grid-4 { grid-template-columns: 1fr; }

/* Badges */
.badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-gold {
  background: rgba(255,215,0,0.15);
  color: var(--gold);
  border: 1px solid var(--gold);
}

.badge-success {
  background: rgba(76,175,80,0.15);
  color: var(--success);
}

/* Text utilities */
.text-center { text-align: center; }
.text-accent { color: var(--accent); }
.text-gold { color: var(--gold); }
.text-muted { color: var(--text-secondary); }

/* Spacing */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

/* Animations - respect reduced motion */
@keyframes pulse {
  0%, 100% { box-shadow: 0 4px 15px rgba(13,71,161,0.4); }
  50% { box-shadow: 0 4px 25px rgba(255,107,53,0.5); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.pulse-btn {
  animation: pulse 2.5s ease-in-out infinite;
}

/* Smooth animations */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.4s, transform 0.4s;
}

.animate-on-scroll.in-view {
  opacity: 1;
  transform: translateY(0);
}

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

/* Selection */
::selection {
  background: var(--accent);
  color: #fff;
}

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

/* ===== TABLET ===== */
@media (min-width: 640px) {
  .section {
    padding: 3.5rem 0;
  }
  
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

/* ===== DESKTOP ===== */
@media (min-width: 1024px) {
  .section {
    padding: 4rem 0;
  }
  
  .container {
    padding: 0 20px;
  }
  
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
  
  .grid-2, .grid-3, .grid-4 {
    gap: 1.5rem;
  }
}

/* ===== TOUCH OPTIMIZATION ===== */
@media (hover: none) and (pointer: coarse) {
  .btn {
    min-height: 48px;
    min-width: 48px;
  }
  
  .card:hover {
    transform: none;
  }
  
  .nav-link, .toc-item, .mobile-link {
    min-height: 44px;
    display: flex;
    align-items: center;
  }
}

/* ===== SAFE AREAS (notch phones) ===== */
@supports (padding: env(safe-area-inset-bottom)) {
  .footer {
    padding-bottom: calc(2rem + env(safe-area-inset-bottom));
  }
  
  .header {
    padding-top: env(safe-area-inset-top);
  }
}

/* ===== DARK MODE ENHANCEMENTS ===== */
@media (prefers-color-scheme: dark) {
  img {
    filter: brightness(0.95);
  }
}

/* ===== PRINT ===== */
@media print {
  .header, .footer, .btn, .nav-mobile, .live-bar {
    display: none !important;
  }
  
  body {
    background: #fff;
    color: #000;
  }
  
  a {
    text-decoration: underline;
  }
}
