/* Modern CSS Design System - 2024-2025 Standards */
/* Following cutting-edge web design patterns with Storm System integration */

/* ========================
   CSS Custom Properties 
   ======================== */
:root {
  /* Professional animation timing */
  --transition-fast: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Layered shadow system */
  --shadow-ambient: 0 0 1px rgba(0, 0, 0, 0.04);
  --shadow-key-light: 0 4px 6px -1px rgba(0, 0, 0, 0.08);
  --shadow-key-heavy: 0 10px 15px -3px rgba(0, 0, 0, 0.10);
  --shadow-fill: 0 20px 25px -5px rgba(0, 0, 0, 0.08);
  
  /* Glassmorphism values */
  --glass-blur: 10px;
  --glass-saturation: 180%;
  --glass-opacity: 0.75;
}

/* ========================
   Fluid Typography System
   ======================== */
h1, h2, h3, h4, h5, h6 {
  line-height: 1.2;
  font-weight: 800;
  transition: all var(--transition-fast);
  position: relative;
  letter-spacing: -0.02em;
}

/* Catchy and impactful modern headers */
h1 {
  font-size: clamp(2rem, 5vw + 1rem, 4rem);
  background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 1.5rem;
  position: relative;
  display: inline-block;
}

h1::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 0;
  width: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
  border-radius: 2px;
  transition: width var(--transition-normal);
}

h1:hover::after {
  width: 100%;
}

h2 {
  font-size: clamp(1.75rem, 4vw + 0.5rem, 3rem);
  color: var(--primary-color);
  margin-bottom: 1.25rem;
  position: relative;
  padding-left: 0;
  transition: padding-left var(--transition-fast);
}

h2::before {
  content: '';
  position: absolute;
  left: -20px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 0;
  background: linear-gradient(180deg, var(--accent-color), var(--secondary-color));
  transition: height var(--transition-normal);
  border-radius: 2px;
}

h2:hover {
  padding-left: 16px;
}

h2:hover::before {
  height: 100%;
}

h3 {
  font-size: clamp(1.5rem, 3vw + 0.25rem, 2.25rem);
  color: var(--secondary-color);
  margin-bottom: 1rem;
  position: relative;
  display: inline-block;
}

h3::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent-color);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition-fast);
  border-radius: 1px;
}

h3:hover::after {
  transform: scaleX(1);
}

h4 {
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
  color: var(--accent-color);
  margin-bottom: 0.75rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

h5 {
  font-size: clamp(1.125rem, 2vw, 1.5rem);
  color: var(--text-color);
  margin-bottom: 0.5rem;
  font-weight: 600;
}

h6 {
  font-size: clamp(1rem, 1.5vw, 1.25rem);
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Body text with proper scaling */
p {
  font-size: clamp(1rem, 1vw + 0.5rem, 1.125rem);
  line-height: 1.7;
  color: var(--text-color);
}

/* ========================
   Layered Shadow System
   ======================== */
.sb-card,
.sb-shadow-sm,
.sb-shadow-md,
.sb-shadow-lg,
.sb-shadow-xl {
  box-shadow: 
    var(--shadow-ambient),
    var(--shadow-key-light),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: box-shadow var(--transition-normal);
}

.sb-shadow-lg {
  box-shadow: 
    var(--shadow-ambient),
    var(--shadow-key-heavy),
    var(--shadow-fill),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.sb-shadow-xl {
  box-shadow: 
    0 0 2px rgba(0, 0, 0, 0.05),
    0 12px 24px -4px rgba(0, 0, 0, 0.12),
    0 24px 48px -8px rgba(0, 0, 0, 0.10),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* Hover states with elevated shadows */
.sb-card:hover,
.sb-shadow-md:hover,
.sb-shadow-lg:hover {
  box-shadow: 
    0 0 2px rgba(0, 0, 0, 0.06),
    0 16px 32px -6px rgba(0, 0, 0, 0.15),
    0 32px 64px -12px rgba(0, 0, 0, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

/* ========================
   Glassmorphism Effects
   ======================== */
.glass,
.sb-navbar,
.sb-sticky {
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturation));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturation));
  background: rgba(var(--surface-color-rgb, 21, 29, 40), var(--glass-opacity));
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Glass panels for cards */
.glass-panel {
  backdrop-filter: blur(20px) saturate(200%);
  -webkit-backdrop-filter: blur(20px) saturate(200%);
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.05),
    rgba(255, 255, 255, 0.02)
  );
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  box-shadow: 
    var(--shadow-ambient),
    var(--shadow-key-light),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* ========================
   Modern Button Styles
   ======================== */
.sb-btn {
  font-size: clamp(0.875rem, 1vw, 1rem);
  padding: clamp(0.5rem, 1vw, 0.75rem) clamp(1rem, 2vw, 1.5rem);
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
  font-weight: 600;
  letter-spacing: 0.02em;
  box-shadow: 
    var(--shadow-ambient),
    var(--shadow-key-light);
}

.sb-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 600ms;
}

.sb-btn:hover::before {
  left: 100%;
}

.sb-btn:hover {
  transform: translateY(-1px);
  box-shadow: 
    var(--shadow-ambient),
    var(--shadow-key-heavy),
    var(--shadow-fill);
}

.sb-btn:active {
  transform: translateY(0);
  transition: transform 100ms;
}

/* ========================
   Professional Animations
   ======================== */
[data-storm],
[data-storm-hover],
[data-storm-click] {
  animation-duration: 250ms !important;
  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Reduce all transition times to professional standards */
* {
  transition-duration: var(--transition-fast) !important;
}

*:hover {
  transition-duration: var(--transition-normal) !important;
}

/* ========================
   Container Queries
   ======================== */
@container (min-width: 768px) {
  .sb-card {
    padding: 2rem;
  }
  
  h1 {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
  }
}

@container (max-width: 480px) {
  .sb-card {
    padding: 1rem;
  }
  
  h1, h2, h3 {
    word-wrap: break-word;
    hyphens: auto;
  }
}

/* ========================
   Micro-interactions
   ======================== */
a {
  position: relative;
  text-decoration: none;
  transition: color var(--transition-fast);
}

a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 2px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform var(--transition-fast);
}

a:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* ========================
   Scroll-triggered Animations
   ======================== */
@media (prefers-reduced-motion: no-preference) {
  [data-storm] {
    opacity: 0;
    animation-fill-mode: forwards;
  }
  
  [data-storm].in-view {
    opacity: 1;
  }
}

/* ========================
   Modern Form Inputs
   ======================== */
.sb-input,
.sb-textarea,
.sb-select {
  font-size: clamp(0.875rem, 1vw, 1rem);
  padding: clamp(0.5rem, 1vw, 0.75rem);
  background: rgba(var(--surface-color-rgb, 21, 29, 40), 0.5);
  backdrop-filter: blur(5px);
  border: 2px solid rgba(var(--primary-color-rgb, 79, 143, 186), 0.2);
  transition: all var(--transition-fast);
}

.sb-input:focus,
.sb-textarea:focus,
.sb-select:focus {
  border-color: var(--primary-color);
  background: rgba(var(--surface-color-rgb, 21, 29, 40), 0.8);
  box-shadow: 
    0 0 0 3px rgba(var(--primary-color-rgb, 79, 143, 186), 0.1),
    var(--shadow-key-light);
  outline: none;
}

/* ========================
   Content Styling Enhancement
   ======================== */
.spellbook-md h1,
.spellbook-md h2,
.spellbook-md h3,
.spellbook-md h4,
.spellbook-md h5,
.spellbook-md h6 {
  margin-top: 2em;
  scroll-margin-top: 5rem;
  position: relative;
}

/* Add accent lines to content headers */
.spellbook-md h1::before,
.spellbook-md h2::before {
  content: '';
  position: absolute;
  top: -0.5em;
  left: 0;
  width: 60px;
  height: 4px;
  background: linear-gradient(90deg, var(--accent-color), transparent);
  border-radius: 2px;
}

/* Code blocks with modern styling */
pre {
  background: linear-gradient(
    135deg,
    rgba(var(--primary-color-rgb, 79, 143, 186), 0.1),
    rgba(var(--primary-color-rgb, 79, 143, 186), 0.05)
  );
  border-left: 4px solid var(--primary-color);
  box-shadow: 
    var(--shadow-ambient),
    var(--shadow-key-light);
  position: relative;
  padding-left: 2rem;
}

code {
  font-size: clamp(0.8rem, 1vw, 0.9rem);
  font-family: 'JetBrains Mono', 'Courier New', monospace;
}

/* ========================
   Responsive Grid Improvements
   ======================== */
.sb-grid {
  gap: clamp(1rem, 2vw, 2rem);
}

/* Container padding removed - handled by utility classes in HTML */

/* ========================
   Performance Optimizations
   ======================== */
@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;
  }
}

/* ========================
   Dark Mode Enhancements
   ======================== */
@media (prefers-color-scheme: dark) {
  :root {
    --shadow-ambient: 0 0 1px rgba(0, 0, 0, 0.2);
    --shadow-key-light: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-key-heavy: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    --shadow-fill: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
  }
}