/* Chapter Two Modern Styling */

/* Import specific fonts as requested */
@import url('https://fonts.googleapis.com/css2?family=Kode+Mono:wght@400;500;600;700&family=Roboto:wght@300;400;500;600;700&display=swap');

/* CSS Variables for theming */
:root {
  /* Light mode colors */
  --ch2-primary: #3B76A1;
  --ch2-accent: #A1A03B;
  --ch2-warning: #FF8517;
  --ch2-danger: #A13D3B;
  --ch2-dark: #35424C;
  --ch2-muted: #33332C;
  
  /* Modern color palette */
  --ch2-bg-primary: #ffffff;
  --ch2-bg-secondary: #f8fafc;
  --ch2-bg-tertiary: #f1f5f9;
  --ch2-text-primary: #0f172a;
  --ch2-text-secondary: #475569;
  --ch2-text-muted: #64748b;
  --ch2-border: #e2e8f0;
  --ch2-border-light: #f1f5f9;
  
  /* Site background gradient */
  --ch2-site-bg: linear-gradient(135deg, #ffffff 0%, #f8fafc 50%, #f1f5f9 100%);
  
  /* Gradients */
  --ch2-gradient-primary: linear-gradient(135deg, #3B76A1 0%, #5b9bd5 100%);
  --ch2-gradient-accent: linear-gradient(135deg, #A1A03B 0%, #c4c350 100%);
  --ch2-gradient-hero: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
  --ch2-gradient-subtle: linear-gradient(135deg, rgba(59, 118, 161, 0.03) 0%, rgba(161, 160, 59, 0.03) 100%);
  
  /* Shadows with color tints */
  --ch2-shadow-sm: 0 1px 2px 0 rgba(59, 118, 161, 0.05);
  --ch2-shadow-md: 0 4px 6px -1px rgba(59, 118, 161, 0.1), 0 2px 4px -2px rgba(59, 118, 161, 0.1);
  --ch2-shadow-lg: 0 10px 15px -3px rgba(59, 118, 161, 0.1), 0 4px 6px -4px rgba(59, 118, 161, 0.1);
  --ch2-shadow-xl: 0 20px 25px -5px rgba(59, 118, 161, 0.1), 0 8px 10px -6px rgba(59, 118, 161, 0.1);
  --ch2-shadow-glow: 0 0 20px rgba(59, 118, 161, 0.15);
  
  /* Animations */
  --ch2-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --ch2-transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --ch2-transition-slow: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark mode colors */
[data-default-appearance="dark"], 
.dark {
  --ch2-bg-primary: #0f172a;
  --ch2-bg-secondary: #1e293b;
  --ch2-bg-tertiary: #334155;
  --ch2-text-primary: #f8fafc;
  --ch2-text-secondary: #cbd5e1;
  --ch2-text-muted: #94a3b8;
  --ch2-border: #334155;
  --ch2-border-light: #475569;
  
  /* Dark mode site background */
  --ch2-site-bg: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
  
  --ch2-gradient-hero: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
  --ch2-gradient-subtle: linear-gradient(135deg, rgba(91, 155, 213, 0.03) 0%, rgba(196, 195, 80, 0.03) 100%);
  
  /* Darker shadows for dark mode with color tints */
  --ch2-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --ch2-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.4);
  --ch2-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
  --ch2-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
  --ch2-shadow-glow: 0 0 20px rgba(91, 155, 213, 0.2);
}

/* Base typography improvements */
html {
  background: var(--ch2-site-bg);
  background-attachment: fixed;
  min-height: 100vh;
}

body {
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-feature-settings: 'kern', 'liga', 'clig', 'calt';
  background: transparent;
  color: var(--ch2-text-primary);
  transition: var(--ch2-transition);
  position: relative;
}

/* Subtle background pattern overlay */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--ch2-gradient-subtle);
  z-index: -2;
  pointer-events: none;
}

/* Animated background particles */
body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    radial-gradient(circle at 20% 20%, rgba(59, 118, 161, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(161, 160, 59, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 40% 80%, rgba(255, 133, 23, 0.02) 0%, transparent 50%);
  animation: float 20s ease-in-out infinite;
  z-index: -1;
  pointer-events: none;
}

/* Headings with modern spacing and weights */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Kode Mono', 'Monaco', 'Consolas', monospace;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  position: relative;
}

/* Modern heading animations */
h1, h2, h3 {
  background: var(--ch2-gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradient-shift 8s ease-in-out infinite;
}

@keyframes gradient-shift {
  0%, 100% { 
    background: var(--ch2-gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
  }
  50% { 
    background: var(--ch2-gradient-accent);
    -webkit-background-clip: text;
    background-clip: text;
  }
}

h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 700;
  margin-bottom: 1.5rem;
  position: relative;
}

h1::after {
  content: '';
  position: absolute;
  bottom: -0.5rem;
  left: 0;
  width: 60px;
  height: 4px;
  background: var(--ch2-gradient-accent);
  border-radius: 2px;
  animation: expand 2s ease-out;
}

@keyframes expand {
  from { width: 0; }
  to { width: 60px; }
}

h2 {
  font-size: clamp(1.875rem, 4vw, 2.5rem);
  margin-bottom: 1.25rem;
}

h3 {
  font-size: clamp(1.5rem, 3vw, 1.875rem);
  margin-bottom: 1rem;
}

/* Code and technical elements */
code, pre, .highlight {
  font-family: 'Courier New', 'Courier', monospace;
  font-feature-settings: 'liga', 'calt';
  font-weight: 500;
}

/* Inline code styling */
code {
  background: var(--ch2-bg-secondary);
  color: var(--ch2-primary);
  padding: 0.2em 0.4em;
  border-radius: 0.375rem;
  font-size: 0.875em;
  border: 1px solid var(--ch2-border);
  position: relative;
}

code::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--ch2-gradient-primary);
  opacity: 0.5;
}

/* Block code styling */
pre {
  background: var(--ch2-bg-secondary) !important;
  border: 1px solid var(--ch2-border) !important;
  border-radius: 0.75rem !important;
  position: relative;
  overflow: hidden;
  box-shadow: var(--ch2-shadow-md);
}

pre::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--ch2-gradient-primary);
  z-index: 1;
}

/* Quotes and callouts */
blockquote, .callout {
  font-family: 'Courier New', 'Courier', monospace;
  background: var(--ch2-bg-secondary);
  border-left: 4px solid var(--ch2-accent);
  padding: 1.5rem;
  margin: 2rem 0;
  border-radius: 0.5rem;
  position: relative;
  font-style: italic;
  box-shadow: var(--ch2-shadow-md);
}

blockquote::before {
  content: '"';
  position: absolute;
  top: -0.5rem;
  left: 1rem;
  font-size: 3rem;
  color: var(--ch2-accent);
  font-family: 'Kode Mono', monospace;
  font-weight: 700;
  line-height: 1;
}

/* Modern header styling */
header {
  backdrop-filter: blur(20px);
  background: rgba(255, 255, 255, 0.85);
  border-bottom: 1px solid var(--ch2-border-light);
  position: sticky;
  top: 0;
  z-index: 50;
  transition: var(--ch2-transition);
  box-shadow: var(--ch2-shadow-sm);
}

[data-default-appearance="dark"] header,
.dark header {
  background: rgba(15, 23, 42, 0.85);
  border-bottom-color: var(--ch2-border);
}

/* Header scroll effect */
header.scrolled {
  backdrop-filter: blur(30px);
  box-shadow: var(--ch2-shadow-md);
  transform: translateY(-1px);
}

/* Logo styling */
.ch2-logo {
  height: 2.5rem;
  width: auto;
  transition: var(--ch2-transition);
  filter: drop-shadow(0 2px 4px rgba(59, 118, 161, 0.1));
}

.ch2-logo:hover {
  transform: scale(1.05) rotate(1deg);
  filter: drop-shadow(0 4px 8px rgba(59, 118, 161, 0.2));
}

/* Navigation improvements */
nav ul li a {
  position: relative;
  padding: 0.75rem 1.25rem;
  border-radius: 0.75rem;
  transition: var(--ch2-transition);
  font-weight: 500;
  overflow: hidden;
}

nav ul li a:hover {
  background: var(--ch2-bg-secondary);
  color: var(--ch2-primary);
  transform: translateY(-2px);
  box-shadow: var(--ch2-shadow-md);
}

nav ul li a::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: var(--ch2-gradient-primary);
  opacity: 0.1;
  transition: var(--ch2-transition);
  z-index: -1;
}

nav ul li a:hover::before {
  left: 0;
}

nav ul li a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 3px;
  background: var(--ch2-gradient-accent);
  transition: var(--ch2-transition);
  transform: translateX(-50%);
  border-radius: 2px;
}

nav ul li a:hover::after {
  width: 80%;
}

/* Hero section with modern gradient */
.hero-section {
  background: var(--ch2-gradient-hero);
  padding: 4rem 0 6rem;
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Ccircle cx='30' cy='30' r='1'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  animation: float 20s ease-in-out infinite;
}

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

/* Modern card styling */
.ch2-card {
  background: var(--ch2-bg-primary);
  border: 1px solid var(--ch2-border);
  border-radius: 1rem;
  padding: 2rem;
  box-shadow: var(--ch2-shadow-md);
  transition: var(--ch2-transition);
  position: relative;
  overflow: hidden;
}

.ch2-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--ch2-gradient-primary);
  opacity: 0;
  transition: var(--ch2-transition);
}

.ch2-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--ch2-shadow-xl);
}

.ch2-card:hover::before {
  opacity: 1;
}

/* Section spacing and containers */
.ch2-section {
  padding: 4rem 0;
  position: relative;
}

.ch2-section:nth-child(even) {
  background-color: var(--ch2-bg-secondary);
}

.ch2-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Team member cards */
.team-member {
  background: var(--ch2-bg-primary);
  border-radius: 1rem;
  padding: 2rem;
  text-align: center;
  box-shadow: var(--ch2-shadow-md);
  transition: var(--ch2-transition);
  border: 1px solid var(--ch2-border);
  position: relative;
  overflow: hidden;
}

.team-member::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--ch2-gradient-accent);
  transform: scaleX(0);
  transition: var(--ch2-transition);
}

.team-member:hover {
  transform: translateY(-8px);
  box-shadow: var(--ch2-shadow-xl);
}

.team-member:hover::before {
  transform: scaleX(1);
}

.team-photo {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  margin: 0 auto 1.5rem;
  border: 4px solid var(--ch2-border);
  transition: var(--ch2-transition);
  background: var(--ch2-bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--ch2-text-muted);
}

.team-member:hover .team-photo {
  border-color: var(--ch2-primary);
  transform: scale(1.1);
}

/* Button improvements */
.ch2-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: var(--ch2-gradient-primary);
  color: white;
  border-radius: 0.75rem;
  font-weight: 600;
  text-decoration: none;
  transition: var(--ch2-transition);
  border: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.ch2-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: var(--ch2-transition);
}

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

.ch2-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--ch2-shadow-lg);
}

/* Feature grid */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin: 3rem 0;
}

.feature-item {
  background: var(--ch2-bg-primary);
  padding: 2rem;
  border-radius: 1rem;
  border: 1px solid var(--ch2-border);
  transition: var(--ch2-transition);
  position: relative;
}

.feature-item::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: var(--ch2-gradient-primary);
  border-radius: 1rem;
  opacity: 0;
  transition: var(--ch2-transition);
  z-index: -1;
}

.feature-item:hover::before {
  opacity: 1;
}

.feature-item:hover {
  transform: translateY(-4px);
  border-color: transparent;
}

/* Tech stack styling */
.tech-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 2rem 0;
}

.tech-item {
  background: var(--ch2-bg-secondary);
  padding: 0.5rem 1rem;
  border-radius: 2rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.875rem;
  color: var(--ch2-text-secondary);
  border: 1px solid var(--ch2-border);
  transition: var(--ch2-transition);
}

.tech-item:hover {
  background: var(--ch2-primary);
  color: white;
  transform: translateY(-2px);
}

/* Contact form improvements */
.contact-section {
  background: var(--ch2-bg-primary) !important;
  border: 1px solid var(--ch2-border) !important;
  position: relative;
  overflow: hidden;
}

.contact-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--ch2-gradient-primary);
}

/* Form input improvements */
input, textarea {
  background: var(--ch2-bg-secondary) !important;
  border: 1px solid var(--ch2-border) !important;
  color: var(--ch2-text-primary) !important;
  transition: var(--ch2-transition) !important;
}

input:focus, textarea:focus {
  background: var(--ch2-bg-primary) !important;
  border-color: var(--ch2-primary) !important;
  box-shadow: 0 0 0 3px rgba(59, 118, 161, 0.1) !important;
}

/* Testimonial styling */
.testimonial {
  background: var(--ch2-bg-primary);
  padding: 2rem;
  border-radius: 1rem;
  border-left: 4px solid var(--ch2-accent);
  margin: 2rem 0;
  box-shadow: var(--ch2-shadow-md);
  position: relative;
}

.testimonial::before {
  content: '"';
  position: absolute;
  top: -0.5rem;
  left: 1rem;
  font-size: 3rem;
  color: var(--ch2-accent);
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
}

/* Responsive improvements */
@media (max-width: 768px) {
  .ch2-container {
    padding: 0 1rem;
  }
  
  .feature-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .team-photo {
    width: 100px;
    height: 100px;
  }
  
  h1 {
    font-size: 2.5rem;
  }
}

/* Scroll animations */
@media (prefers-reduced-motion: no-preference) {
  .scroll-fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
  }
  
  .scroll-fade-in.visible {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Loading states */
.loading {
  background: linear-gradient(90deg, var(--ch2-bg-secondary) 25%, var(--ch2-bg-tertiary) 50%, var(--ch2-bg-secondary) 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Modern scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--ch2-bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--ch2-border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--ch2-primary);
}
