/* ========================================
   BASE STYLES - Foundation Layer
   ========================================
   Core styles that apply site-wide.
   Import after tokens.css, before component CSS.
   
   CONTENTS:
   1. Reset & Box Model
   2. Scrollbar Stability
   3. Body & Typography Foundation
   4. Container & Layout
   5. Button Base Styles
   6. Link Styles
   7. Form Elements
   8. Utility Classes
   9. Accessibility
   10. Animations
   
   NOTE: This file consolidates essentials from
   styles.css, modern-theme.css, and fixes.css
*/

/* ==========================================
   1. RESET & BOX MODEL
   ========================================== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

/* ==========================================
   2. SCROLLBAR STABILITY
   ========================================== */
html {
  overflow-y: auto;
  scrollbar-gutter: stable both-edges;
  min-height: 100%;
  max-height: none;
}

body {
  overflow-x: hidden;
  scrollbar-gutter: stable;
}

/* Disable transitions during page load to prevent flicker */
.no-transitions * {
  transition: none !important;
  animation: none !important;
}

/* ==========================================
   3. BODY & TYPOGRAPHY FOUNDATION
   ========================================== */
body {
  font-family: var(--font-body);
  font-weight: var(--font-medium, 500);
  line-height: 1.6;
  color: var(--text-secondary);
  letter-spacing: 0.3px;
  background-color: var(--color-secondary);
  text-align: center;
}

/* Headings - Classical Cinzel */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-title);
  font-weight: var(--font-semibold, 600);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-primary);
  text-shadow: 
    2px 2px 4px rgba(0, 0, 0, 0.8),
    0px 0px 8px rgba(0, 0, 0, 0.6);
  margin-bottom: 1rem;
  line-height: 1.2;
}

h1 { font-size: clamp(2.5rem, 5vw, 3.5rem); letter-spacing: 2px; }
h2 { font-size: clamp(2rem, 4vw, 2.8rem); letter-spacing: 1.8px; }
h3 { font-size: clamp(1.75rem, 3.5vw, 2.2rem); letter-spacing: 1.5px; }
h4 { font-size: 1.8rem; letter-spacing: 1.2px; }
h5 { font-size: 1.5rem; letter-spacing: 1px; }
h6 { font-size: 1.3rem; letter-spacing: 0.8px; }

/* Paragraphs - Modern Montserrat */
p {
  font-family: var(--font-body);
  font-weight: var(--font-medium, 500);
  font-size: 1.1rem;
  line-height: 1.7;
  letter-spacing: 0.3px;
  margin-bottom: 1.2rem;
  color: var(--text-muted, #a0a0a0);
}

/* Small text */
small, .small-text {
  font-family: var(--font-body);
  font-weight: var(--font-normal, 400);
  font-size: 0.9rem;
  letter-spacing: 0.2px;
}

/* ==========================================
   4. CONTAINER & LAYOUT
   ========================================== */
.container {
  width: 100%;
  max-width: var(--container-max, 1200px);
  margin: 0 auto;
  padding: 0 1.5rem;
  position: relative;
  z-index: var(--z-base, 1);
  overflow: visible;
}

/* Page container for injected header */
#page-container {
  width: 100%;
  position: relative;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Main content wrapper */
.main-content {
  flex: 1 0 auto;
  width: 100%;
  position: relative;
  z-index: 2;
  margin-top: 0;
}

/* Section defaults */
section:not(.simple-hero) {
  padding: 3.5rem 0;
  position: relative;
  z-index: 1;
  overflow: visible;
  clear: both;
}

/* First content section spacing */
main > section:first-of-type {
  padding-top: 1.25rem;
}

/* ==========================================
   5. BUTTON BASE STYLES
   ========================================== */
.btn, button, input[type="submit"], input[type="button"] {
  font-family: var(--font-body);
  font-weight: var(--font-bold, 700);
  letter-spacing: 1px;
  text-transform: uppercase;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md, 8px);
  text-decoration: none;
  cursor: pointer;
  border: none;
  display: inline-block;
  transition: all var(--transition-slow, 0.3s ease);
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
  color: var(--text-primary);
  box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 77, 0, 0.5);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--text-secondary);
  color: var(--text-secondary);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--color-primary);
  color: var(--color-primary);
  transform: translateY(-2px);
}

/* CTA button variants */
.btn-cta, .btn-signup, .btn-submit {
  background-color: var(--color-primary);
  color: white;
  border: none;
}

.btn-cta:hover, .btn-signup:hover, .btn-submit:hover {
  background-color: var(--color-primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 77, 0, 0.3);
}

.btn-cta.secondary, .btn-login {
  background-color: transparent;
  color: var(--text-secondary);
  border: 2px solid var(--color-primary);
}

.btn-cta.secondary:hover, .btn-login:hover {
  background-color: rgba(255, 77, 0, 0.1);
  transform: translateY(-2px);
}

/* ==========================================
   6. LINK STYLES
   ========================================== */
a {
  color: var(--color-primary-hover);
  text-decoration: none;
  transition: color var(--transition-slow, 0.3s ease);
}

a:hover {
  color: var(--color-primary);
}

/* ==========================================
   7. FORM ELEMENTS
   ========================================== */
input, textarea, select {
  font-family: var(--font-body);
  font-weight: var(--font-medium, 500);
  letter-spacing: 0.3px;
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm, 4px);
  background-color: var(--surface-dark);
  color: var(--text-secondary);
  font-size: 1rem;
  transition: border-color var(--transition-slow, 0.3s ease);
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--color-primary);
}

textarea {
  resize: vertical;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: var(--font-medium, 500);
  color: var(--text-secondary);
}

.form-group {
  margin-bottom: 1.5rem;
}

/* ==========================================
   8. UTILITY CLASSES
   ========================================== */
/* Text alignment */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

/* Display utilities */
.hidden { display: none !important; }
.visible { visibility: visible !important; }

/* Flex utilities */
.flex { display: flex; }
.flex-center { 
  display: flex; 
  align-items: center; 
  justify-content: center; 
}
.flex-column { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }

/* ==========================================
   9. ACCESSIBILITY
   ========================================== */
/* Skip to content link */
.skip-to-content {
  position: absolute;
  top: -100px;
  left: 0;
  background: var(--color-primary);
  color: white;
  padding: 10px 15px;
  z-index: 9999;
  transition: top var(--transition-slow, 0.3s ease);
  font-family: var(--font-body);
  text-decoration: none;
  font-weight: var(--font-semibold, 600);
  border-radius: 0 0 var(--radius-sm, 4px) 0;
}

.skip-to-content:focus {
  top: 0;
  outline: 3px solid var(--color-accent);
}

/* Focus visible for keyboard navigation */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==========================================
   10. ANIMATIONS
   ========================================== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInBottom {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Animation utility classes */
.fade-in {
  opacity: 0;
  animation: fadeIn 0.8s ease-in forwards;
}

.slide-in-right {
  opacity: 0;
  transform: translateX(30px);
  animation: slideInRight 0.8s ease-out forwards;
}

.slide-in-left {
  opacity: 0;
  transform: translateX(-30px);
  animation: slideInLeft 0.8s ease-out forwards;
}

.slide-in-bottom {
  opacity: 0;
  transform: translateY(30px);
  animation: slideInBottom 0.8s ease-out forwards;
}

/* Animation delays */
.delay-1 { animation-delay: 0.2s; }
.delay-2 { animation-delay: 0.4s; }
.delay-3 { animation-delay: 0.6s; }
.delay-4 { animation-delay: 0.8s; }

/* ==========================================
   UTILITY CLASSES
   ========================================== */
/* Margin utilities */
.mt-56 { margin-top: 56px; }
.mt-48 { margin-top: 48px; }
.mt-32 { margin-top: 32px; }
.mt-24 { margin-top: 24px; }
.mt-16 { margin-top: 16px; }
.mb-56 { margin-bottom: 56px; }
.mb-48 { margin-bottom: 48px; }
.mb-32 { margin-bottom: 32px; }
.mb-24 { margin-bottom: 24px; }
.mb-16 { margin-bottom: 16px; }

/* Text alignment */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

/* Font size utilities */
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-1-5rem { font-size: 1.5rem; }

/* Gap utilities for grid/flex */
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.gap-32 { gap: 32px; }

/* ==========================================
   11. RESPONSIVE FOUNDATION
   ========================================== */
@media (max-width: 768px) {
  .container {
    padding: 0 1rem;
  }
  
  section:not(.simple-hero) {
    padding: 2.5rem 0;
  }
  
  .btn {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 0.75rem;
  }
  
  section:not(.simple-hero) {
    padding: 2rem 0;
  }
  
  h1 { font-size: 2rem; }
  h2 { font-size: 1.75rem; }
  h3 { font-size: 1.5rem; }
  
  .btn {
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
  }
}
