/* ============================================
   AVALON: THE FORGOTTEN WORLD
   Aetherpunk Design System - Main Stylesheet
   ============================================ */

/* ============================================
   CSS CUSTOM PROPERTIES (Design Tokens)
   ============================================ */
:root {
  /* Primary - Deep Arcane Colors */
  --color-void-black: #0a0a0f;
  --color-midnight: #12121a;
  --color-shadow: #1a1a2e;
  --color-deep-purple: #16132d;
  --color-charcoal: #252536;

  /* Accent - Magical Glow */
  --color-aether-cyan: #00f5d4;
  --color-aether-blue: #00bbf9;
  --color-mystic-purple: #9b5de5;
  --color-arcane-gold: #f5a623;
  --color-ember-orange: #ff6b35;
  --color-blood-red: #dc2f2f;

  /* Mechanical - Brass/Copper */
  --color-brass: #b5a642;
  --color-copper: #b87333;
  --color-bronze: #cd7f32;
  --color-aged-gold: #cfb53b;
  --color-iron: #48484a;

  /* Text Colors */
  --color-text-primary: #e8e6e3;
  --color-text-secondary: #a8a5a0;
  --color-text-muted: #6b6966;
  --color-text-accent: var(--color-aether-cyan);

  /* Semantic Colors */
  --color-danger: #ff6b6b;
  --color-success: #51cf66;
  --color-warning: #fcc419;
  --color-info: var(--color-aether-blue);

  /* Gradients */
  --gradient-aether: linear-gradient(135deg, var(--color-aether-cyan), var(--color-mystic-purple));
  --gradient-brass: linear-gradient(135deg, var(--color-brass), var(--color-copper));
  --gradient-dark: linear-gradient(180deg, var(--color-void-black), var(--color-shadow));
  --gradient-hero: linear-gradient(180deg, transparent 0%, rgba(10, 10, 15, 0.7) 50%, var(--color-void-black) 100%);
  --gradient-card: linear-gradient(145deg, var(--color-midnight), var(--color-shadow));

  /* Typography */
  --font-display: 'Cinzel Decorative', 'Times New Roman', serif;
  --font-heading: 'Cinzel', 'Georgia', serif;
  --font-body: 'Crimson Text', 'Georgia', serif;
  --font-ui: 'Rajdhani', 'Arial', sans-serif;

  /* Font Sizes - Fluid Typography */
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.9rem + 0.5vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.6vw, 1.25rem);
  --text-xl: clamp(1.25rem, 1.1rem + 0.75vw, 1.5rem);
  --text-2xl: clamp(1.5rem, 1.2rem + 1.5vw, 2rem);
  --text-3xl: clamp(2rem, 1.5rem + 2.5vw, 3rem);
  --text-4xl: clamp(2.5rem, 2rem + 3vw, 4rem);
  --text-5xl: clamp(3rem, 2.5rem + 4vw, 5rem);

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  --space-4xl: 6rem;

  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 20px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
  --shadow-glow-cyan: 0 0 20px rgba(0, 245, 212, 0.3);
  --shadow-glow-purple: 0 0 20px rgba(155, 93, 229, 0.3);
  --shadow-glow-gold: 0 0 20px rgba(245, 166, 35, 0.3);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 300ms ease;
  --transition-slow: 500ms ease;

  /* Z-Index Scale */
  --z-base: 1;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-fixed: 300;
  --z-modal-backdrop: 400;
  --z-modal: 500;
  --z-tooltip: 600;

  /* Container Widths */
  --container-sm: 640px;
  --container-md: 768px;
  --container-lg: 1024px;
  --container-xl: 1280px;
  --container-2xl: 1536px;
}

/* ============================================
   CSS RESET & BASE STYLES
   ============================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.7;
  color: var(--color-text-primary);
  background-color: var(--color-void-black);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 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;
    scroll-behavior: auto !important;
  }
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-text-primary);
  margin-bottom: var(--space-md);
}

h1 {
  font-size: var(--text-4xl);
  letter-spacing: 0.05em;
}

h2 {
  font-size: var(--text-3xl);
  letter-spacing: 0.03em;
}

h3 {
  font-size: var(--text-2xl);
}

h4 {
  font-size: var(--text-xl);
}

h5 {
  font-size: var(--text-lg);
}

h6 {
  font-size: var(--text-base);
}

/* Display Text (for hero titles) */
.display-title {
  font-family: var(--font-display);
  font-size: var(--text-5xl);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

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

a {
  color: var(--color-aether-cyan);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-mystic-purple);
}

strong, b {
  font-weight: 700;
  color: var(--color-text-primary);
}

em, i {
  font-style: italic;
}

/* UI Text */
.text-ui {
  font-family: var(--font-ui);
  letter-spacing: 0.05em;
}

/* Glowing Rune Text Effect */
.rune-text {
  font-family: var(--font-display);
  color: var(--color-aether-cyan);
  text-shadow:
    0 0 10px var(--color-aether-cyan),
    0 0 20px var(--color-aether-blue),
    0 0 30px var(--color-mystic-purple),
    0 0 40px var(--color-mystic-purple);
}

.rune-text--gold {
  color: var(--color-arcane-gold);
  text-shadow:
    0 0 10px var(--color-arcane-gold),
    0 0 20px var(--color-ember-orange),
    0 0 30px var(--color-copper);
}

/* ============================================
   LAYOUT UTILITIES
   ============================================ */
.container {
  width: 100%;
  max-width: var(--container-xl);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-lg);
  padding-right: var(--space-lg);
}

.container--narrow {
  max-width: var(--container-md);
}

.container--wide {
  max-width: var(--container-2xl);
}

/* 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-end {
  justify-content: flex-end;
}

.gap-sm {
  gap: var(--space-sm);
}

.gap-md {
  gap: var(--space-md);
}

.gap-lg {
  gap: var(--space-lg);
}

.gap-xl {
  gap: var(--space-xl);
}

/* Grid Utilities */
.grid {
  display: grid;
}

.grid-cols-1 {
  grid-template-columns: repeat(1, 1fr);
}

.grid-cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

/* Responsive Grid */
@media (max-width: 768px) {
  .md\:grid-cols-1 {
    grid-template-columns: repeat(1, 1fr);
  }
}

@media (max-width: 576px) {
  .sm\:grid-cols-1 {
    grid-template-columns: repeat(1, 1fr);
  }
}

/* ============================================
   SECTION STYLING
   ============================================ */
.section {
  padding: var(--space-4xl) 0;
}

.section--dark {
  background-color: var(--color-midnight);
}

.section--gradient {
  background: var(--gradient-dark);
}

.section__header {
  text-align: center;
  margin-bottom: var(--space-3xl);
}

.section__title {
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  margin-bottom: var(--space-md);
  position: relative;
  display: inline-block;
}

.section__title::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 2px;
  background: var(--gradient-aether);
}

.section__subtitle {
  font-size: var(--text-lg);
  color: var(--color-text-secondary);
  max-width: 600px;
  margin: var(--space-lg) auto 0;
}

/* ============================================
   DECORATIVE ELEMENTS
   ============================================ */

/* Ornate Divider */
.divider {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: var(--space-2xl) 0;
  gap: var(--space-md);
}

.divider__line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--color-brass), transparent);
  max-width: 200px;
}

.divider__icon {
  color: var(--color-brass);
  font-size: var(--text-xl);
}

/* Gear Decoration */
.gear-decoration {
  position: relative;
}

.gear-decoration::before,
.gear-decoration::after {
  content: '\2699';
  position: absolute;
  color: var(--color-brass);
  opacity: 0.3;
  font-size: 2rem;
}

.gear-decoration::before {
  top: -10px;
  left: -20px;
}

.gear-decoration::after {
  bottom: -10px;
  right: -20px;
}

/* Magical Border Glow */
.magical-border {
  position: relative;
  border: 1px solid var(--color-brass);
}

.magical-border::before {
  content: '';
  position: absolute;
  inset: -2px;
  background: var(--gradient-aether);
  border-radius: inherit;
  z-index: -1;
  opacity: 0;
  transition: opacity var(--transition-base);
}

.magical-border:hover::before {
  opacity: 0.5;
}

/* ============================================
   IMAGES & MEDIA
   ============================================ */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

.img-cover {
  object-fit: cover;
  width: 100%;
  height: 100%;
}

.img-contain {
  object-fit: contain;
}

/* Image with brass frame effect */
.img-framed {
  border: 3px solid var(--color-brass);
  box-shadow:
    inset 0 0 20px rgba(0, 0, 0, 0.5),
    var(--shadow-lg);
  position: relative;
}

.img-framed::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  pointer-events: none;
}

/* ============================================
   LISTS
   ============================================ */
ul, ol {
  padding-left: var(--space-xl);
  margin-bottom: var(--space-md);
}

li {
  margin-bottom: var(--space-sm);
}

/* Custom styled list */
.list-styled {
  list-style: none;
  padding-left: 0;
}

.list-styled li {
  position: relative;
  padding-left: var(--space-lg);
}

.list-styled li::before {
  content: '\2726';
  position: absolute;
  left: 0;
  color: var(--color-aether-cyan);
}

/* ============================================
   TABLES
   ============================================ */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--space-xl);
}

th, td {
  padding: var(--space-md);
  text-align: left;
  border-bottom: 1px solid var(--color-charcoal);
}

th {
  font-family: var(--font-ui);
  font-weight: 600;
  color: var(--color-aether-cyan);
  background-color: var(--color-midnight);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: var(--text-sm);
}

tr:hover {
  background-color: rgba(0, 245, 212, 0.05);
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

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

/* Text Colors */
.text-primary { color: var(--color-text-primary); }
.text-secondary { color: var(--color-text-secondary); }
.text-muted { color: var(--color-text-muted); }
.text-accent { color: var(--color-aether-cyan); }
.text-gold { color: var(--color-arcane-gold); }
.text-purple { color: var(--color-mystic-purple); }

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

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

.py-sm { padding-top: var(--space-sm); padding-bottom: var(--space-sm); }
.py-md { padding-top: var(--space-md); padding-bottom: var(--space-md); }
.py-lg { padding-top: var(--space-lg); padding-bottom: var(--space-lg); }
.py-xl { padding-top: var(--space-xl); padding-bottom: var(--space-xl); }

.px-sm { padding-left: var(--space-sm); padding-right: var(--space-sm); }
.px-md { padding-left: var(--space-md); padding-right: var(--space-md); }
.px-lg { padding-left: var(--space-lg); padding-right: var(--space-lg); }

/* Display Utilities */
.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }

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

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */
@media (max-width: 1200px) {
  .container {
    max-width: var(--container-lg);
  }
}

@media (max-width: 992px) {
  .container {
    max-width: var(--container-md);
  }

  .section {
    padding: var(--space-3xl) 0;
  }
}

@media (max-width: 768px) {
  .container {
    padding-left: var(--space-md);
    padding-right: var(--space-md);
  }

  .section {
    padding: var(--space-2xl) 0;
  }

  .grid-cols-2,
  .grid-cols-3,
  .grid-cols-4 {
    grid-template-columns: repeat(1, 1fr);
  }
}

@media (max-width: 576px) {
  h1 {
    font-size: var(--text-3xl);
  }

  h2 {
    font-size: var(--text-2xl);
  }

  .display-title {
    font-size: var(--text-3xl);
    letter-spacing: 0.05em;
  }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
  body {
    background: white;
    color: black;
  }

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