/* The Complete Ethereum Story - Professional Design System */

/* =============================================================================
   CSS Custom Properties (Official Ethereum Brand Colors)
   ============================================================================= */
:root {
  /* Official Ethereum Brand Colors */
  --ethereum-black: #12100B;           /* Primary Ethereum black */
  --ethereum-dark-gray: #3D3E3F;      /* Wordmark gray */
  --ethereum-gold: #C3996B;           /* Powered by Ethereum gold */
  
  /* Ethereum Logo Opacity Variations (based on #12100B) */
  --ethereum-center: rgba(18, 16, 11, 0.60);   /* 60% opacity center */
  --ethereum-right: rgba(18, 16, 11, 0.80);    /* 80% opacity right triangles */
  --ethereum-left: rgba(18, 16, 11, 0.45);     /* 45% opacity left triangles */
  
  /* Extended Ethereum Palette */
  --ethereum-primary: #12100B;        /* Main brand color */
  --ethereum-secondary: #3D3E3F;      /* Secondary gray */
  --ethereum-accent: #C3996B;         /* Gold accent */
  --ethereum-highlight: #6C63FF;      /* Modern purple for CTAs */
  
  /* Semantic Colors */
  --success: #00D395;                  /* Blockchain green */
  --warning: #F7931A;                  /* Bitcoin orange for warnings */
  --danger: #E53E3E;                   /* Error red */
  --info: #3182CE;                     /* Info blue */

  /* Neutral Grays (Professional Scale) */
  --white: #FFFFFF;
  --gray-50: #FAFAFA;
  --gray-100: #F5F5F5;
  --gray-200: #E5E5E5;
  --gray-300: #D4D4D4;
  --gray-400: #A3A3A3;
  --gray-500: #737373;
  --gray-600: #525252;
  --gray-700: #404040;
  --gray-800: #262626;
  --gray-900: #171717;

  /* Dark Theme Colors (Ethereum Inspired) */
  --dark-bg: #0A0A0A;                  /* Near black background */
  --dark-surface: #1A1A1A;             /* Card/surface color */
  --dark-border: #2D2D2D;              /* Border color */
  --dark-text: #F5F5F5;               /* Primary text */
  --dark-text-muted: #A3A3A3;         /* Secondary text */

  /* Typography Scale (Professional Ethereum-inspired) */
  --font-display: 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Inter', 'SF Pro Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;

  /* Font Sizes (Fluid Typography) */
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.375vw, 1rem);
  --text-base: clamp(1rem, 0.9rem + 0.5vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.625vw, 1.25rem);
  --text-xl: clamp(1.25rem, 1.1rem + 0.75vw, 1.5rem);
  --text-2xl: clamp(1.5rem, 1.3rem + 1vw, 2rem);
  --text-3xl: clamp(1.875rem, 1.6rem + 1.375vw, 2.5rem);
  --text-4xl: clamp(2.25rem, 1.9rem + 1.75vw, 3rem);
  --text-5xl: clamp(3rem, 2.5rem + 2.5vw, 4rem);

  /* Spacing Scale (Geometric Progression) */
  --space-1: 0.25rem;    /* 4px */
  --space-2: 0.5rem;     /* 8px */
  --space-3: 0.75rem;    /* 12px */
  --space-4: 1rem;       /* 16px */
  --space-5: 1.25rem;    /* 20px */
  --space-6: 1.5rem;     /* 24px */
  --space-8: 2rem;       /* 32px */
  --space-10: 2.5rem;    /* 40px */
  --space-12: 3rem;      /* 48px */
  --space-16: 4rem;      /* 64px */
  --space-20: 5rem;      /* 80px */
  --space-24: 6rem;      /* 96px */
  --space-32: 8rem;      /* 128px */

  /* Layout & Sizing */
  --container-max: 1200px;
  --container-padding: var(--space-6);
  --header-height: 80px;
  --border-radius: 8px;
  --border-radius-lg: 12px;
  --border-width: 1px;

  /* Shadows (Ethereum-inspired with depth) */
  --shadow-sm: 0 1px 2px 0 rgba(18, 16, 11, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(18, 16, 11, 0.1), 0 2px 4px -2px rgba(18, 16, 11, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(18, 16, 11, 0.1), 0 4px 6px -4px rgba(18, 16, 11, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(18, 16, 11, 0.15), 0 8px 10px -6px rgba(18, 16, 11, 0.1);
  --shadow-inner: inset 0 2px 4px 0 rgba(18, 16, 11, 0.1);
  --shadow-glow: 0 0 20px rgba(108, 99, 255, 0.3);  /* Purple glow for special elements */

  /* Animations */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Z-Index Scale */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
}

/* Light Theme (Default) - Clean & Professional */
:root,
[data-theme="light"] {
  --bg-primary: var(--white);
  --bg-secondary: var(--gray-50);
  --bg-tertiary: var(--gray-100);
  --text-primary: var(--ethereum-black);
  --text-secondary: var(--ethereum-dark-gray);
  --text-muted: var(--gray-500);
  --border-color: var(--gray-200);
  --border-color-hover: var(--ethereum-accent);
}

/* Dark Theme Override - Ethereum Dark Mode */
[data-theme="dark"] {
  --bg-primary: var(--dark-bg);
  --bg-secondary: var(--dark-surface);
  --bg-tertiary: var(--gray-800);
  --text-primary: var(--dark-text);
  --text-secondary: var(--dark-text-muted);
  --text-muted: var(--gray-400);
  --border-color: var(--dark-border);
  --border-color-hover: var(--ethereum-gold);
}

/* =============================================================================
   Reset & Base Styles
   ============================================================================= */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  transition: background-color var(--transition-normal), color var(--transition-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* =============================================================================
   Typography System
   ============================================================================= */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  margin-bottom: var(--space-4);
}

h1 { font-size: var(--text-5xl); }
h2 { font-size: var(--text-4xl); }
h3 { font-size: var(--text-3xl); }
h4 { font-size: var(--text-2xl); }
h5 { font-size: var(--text-xl); }
h6 { font-size: var(--text-lg); }

p {
  margin-bottom: var(--space-4);
  line-height: 1.7;
  color: var(--text-secondary);
}

a {
  color: var(--ethereum-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color var(--transition-fast);
}

a:hover, a:focus {
  color: var(--ethereum-secondary);
  text-decoration-thickness: 2px;
}

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

em, i {
  font-style: italic;
}

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background-color: var(--bg-secondary);
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--space-1);
  padding: var(--space-1) var(--space-2);
}

pre {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  background-color: var(--bg-secondary);
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--border-radius);
  padding: var(--space-4);
  overflow-x: auto;
  margin-bottom: var(--space-4);
}

blockquote {
  border-left: 4px solid var(--ethereum-primary);
  padding-left: var(--space-4);
  margin: var(--space-6) 0;
  font-style: italic;
  color: var(--text-secondary);
}

/* =============================================================================
   Layout Components
   ============================================================================= */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--container-padding);
}

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

.section--hero {
  padding: var(--space-32) 0;
  background: linear-gradient(135deg, var(--ethereum-black) 0%, var(--ethereum-dark-gray) 50%, var(--ethereum-black) 100%);
  color: var(--white);
  text-align: center;
  position: relative;
  overflow: hidden;
  min-height: 80vh;
  display: flex;
  align-items: center;
}

.section--hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 20% 30%, rgba(195, 153, 107, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(108, 99, 255, 0.1) 0%, transparent 50%),
    conic-gradient(from 45deg at 50% 50%, 
      transparent 0deg, 
      rgba(195, 153, 107, 0.05) 90deg, 
      transparent 180deg, 
      rgba(108, 99, 255, 0.05) 270deg, 
      transparent 360deg
    );
  pointer-events: none;
}

.section--hero::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 200px;
  height: 200px;
  background: 
    linear-gradient(45deg, transparent 30%, rgba(195, 153, 107, 0.1) 50%, transparent 70%),
    linear-gradient(-45deg, transparent 30%, rgba(108, 99, 255, 0.1) 50%, transparent 70%);
  border-radius: 50%;
  filter: blur(40px);
  pointer-events: none;
  z-index: 0;
}

.section--hero * {
  position: relative;
  z-index: 1;
}

/* =============================================================================
   Header Component
   ============================================================================= */
.header {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background-color: rgba(255, 255, 255, 0.95);
  border-bottom: var(--border-width) solid var(--border-color);
  height: var(--header-height);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  transition: all var(--transition-fast);
}

[data-theme="dark"] .header {
  background-color: rgba(10, 10, 10, 0.95);
}

.header__content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  gap: var(--space-4);
}

.header__brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-weight: 700;
  font-size: var(--text-lg);
  color: var(--text-primary);
  text-decoration: none;
}

.header__logo {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--ethereum-highlight) 0%, var(--ethereum-accent) 100%);
  border-radius: var(--border-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-weight: 700;
  font-size: 18px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.header__logo:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-md);
}

.header__nav {
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: var(--space-6);
  margin: 0;
  padding: 0;
}

.nav-menu__item {
  margin: 0;
}

.nav-menu__link {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--border-radius);
  transition: color var(--transition-fast), background-color var(--transition-fast);
}

.nav-menu__link:hover,
.nav-menu__link:focus,
.nav-menu__link--active {
  color: var(--ethereum-highlight);
  background-color: rgba(108, 99, 255, 0.1);
}

.header__controls {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.theme-toggle {
  background: none;
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--border-radius);
  padding: var(--space-2);
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover,
.theme-toggle:focus {
  background-color: var(--bg-secondary);
  color: var(--ethereum-highlight);
  border-color: var(--ethereum-highlight);
  box-shadow: var(--shadow-sm);
}

.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-2);
  color: var(--text-primary);
}

/* Mobile Navigation */
@media (max-width: 768px) {
  .header__nav {
    display: none;
  }

  .mobile-menu-toggle {
    display: block;
  }

  .header__nav--mobile-open {
    display: flex;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    border-bottom: var(--border-width) solid var(--border-color);
    padding: var(--space-4) 0;
    flex-direction: column;
    gap: 0;
    box-shadow: var(--shadow-lg);
  }

  [data-theme="dark"] .header__nav--mobile-open {
    background-color: rgba(10, 10, 10, 0.98);
  }

  .nav-menu {
    flex-direction: column;
    gap: 0;
    padding: 0 var(--container-padding);
  }

  .nav-menu__link {
    display: block;
    padding: var(--space-4);
    border-bottom: var(--border-width) solid var(--border-color);
    transition: all var(--transition-fast);
  }

  .nav-menu__link:hover {
    background-color: rgba(108, 99, 255, 0.1);
    padding-left: var(--space-6);
  }

  .header__controls {
    padding: 0 var(--container-padding);
    justify-content: flex-end;
    margin-top: var(--space-4);
  }
}

/* =============================================================================
   Hero Section
   ============================================================================= */
.hero__title {
  font-size: var(--text-5xl);
  font-weight: 700;
  margin-bottom: var(--space-6);
  background: linear-gradient(135deg, 
    var(--white) 0%, 
    var(--ethereum-accent) 50%, 
    var(--white) 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.hero__subtitle {
  font-size: var(--text-xl);
  margin-bottom: var(--space-10);
  opacity: 0.95;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 400;
}

.hero__actions {
  display: flex;
  gap: var(--space-4);
  justify-content: center;
  flex-wrap: wrap;
}

/* =============================================================================
   Button Components
   ============================================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border: var(--border-width) solid transparent;
  border-radius: var(--border-radius);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: var(--text-base);
  line-height: 1;
}

.btn--primary {
  background: linear-gradient(135deg, var(--ethereum-highlight) 0%, #5A52E8 100%);
  color: var(--white);
  border-color: var(--ethereum-highlight);
  font-weight: 600;
  box-shadow: var(--shadow-md);
}

.btn--primary:hover,
.btn--primary:focus {
  background: linear-gradient(135deg, #5A52E8 0%, var(--ethereum-highlight) 100%);
  border-color: #5A52E8;
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
  color: var(--white);
}

.btn--secondary {
  background-color: transparent;
  color: var(--ethereum-accent);
  border-color: var(--ethereum-accent);
  font-weight: 500;
}

.btn--secondary:hover,
.btn--secondary:focus {
  background-color: var(--ethereum-accent);
  border-color: var(--ethereum-accent);
  color: var(--ethereum-black);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn--outline {
  background-color: transparent;
  color: var(--text-primary);
  border-color: var(--border-color);
  font-weight: 500;
}

.btn--outline:hover,
.btn--outline:focus {
  background-color: var(--ethereum-highlight);
  color: var(--white);
  border-color: var(--ethereum-highlight);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn--lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-lg);
}

/* =============================================================================
   Card Components
   ============================================================================= */
.card {
  background-color: var(--bg-secondary);
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: var(--space-8);
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--ethereum-highlight), var(--ethereum-accent));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition-normal);
}

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

.card:hover::before {
  transform: scaleX(1);
}

.card__icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--ethereum-highlight) 0%, var(--ethereum-accent) 100%);
  border-radius: var(--border-radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-size: var(--text-2xl);
  margin-bottom: var(--space-5);
  box-shadow: var(--shadow-md);
}

.card__title {
  font-size: var(--text-xl);
  font-weight: 600;
  margin-bottom: var(--space-3);
  color: var(--text-primary);
}

.card__description {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 0;
}

/* =============================================================================
   Grid System
   ============================================================================= */
.grid {
  display: grid;
  gap: var(--space-6);
}

.grid--2 {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid--3 {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.grid--4 {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

@media (max-width: 768px) {
  .grid--2,
  .grid--3,
  .grid--4 {
    grid-template-columns: 1fr;
  }
}

/* =============================================================================
   Chapter Layout
   ============================================================================= */
.chapter-layout {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: var(--space-8);
  align-items: start;
}

@media (max-width: 1024px) {
  .chapter-layout {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }
}

.chapter-sidebar {
  position: sticky;
  top: calc(var(--header-height) + var(--space-6));
  background-color: var(--bg-secondary);
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: var(--space-6);
  max-height: calc(100vh - var(--header-height) - var(--space-12));
  overflow-y: auto;
}

@media (max-width: 1024px) {
  .chapter-sidebar {
    position: static;
    max-height: none;
    order: -1;
  }
}

.chapter-content {
  background-color: var(--bg-secondary);
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: var(--space-8);
}

/* =============================================================================
   Table of Contents
   ============================================================================= */
.toc__title {
  font-size: var(--text-lg);
  font-weight: 600;
  margin-bottom: var(--space-4);
  color: var(--text-primary);
}

.toc__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc__item {
  margin-bottom: var(--space-2);
}

.toc__link {
  display: block;
  padding: var(--space-2) var(--space-3);
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--border-radius);
  font-size: var(--text-sm);
  line-height: 1.4;
  transition: all var(--transition-fast);
  border-left: 3px solid transparent;
}

.toc__link:hover,
.toc__link:focus {
  color: var(--ethereum-highlight);
  background-color: rgba(108, 99, 255, 0.1);
  border-left-color: var(--ethereum-highlight);
}

.toc__link--active {
  color: var(--ethereum-highlight);
  background-color: rgba(108, 99, 255, 0.15);
  border-left-color: var(--ethereum-highlight);
  font-weight: 600;
}

/* Progress Bar */
.progress-bar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  width: 0%;
  height: 4px;
  background: linear-gradient(90deg, var(--ethereum-highlight) 0%, var(--ethereum-accent) 100%);
  z-index: var(--z-fixed);
  transition: width 0.1s ease;
  box-shadow: 0 0 8px rgba(108, 99, 255, 0.3);
}

/* =============================================================================
   Chapter Sections
   ============================================================================= */
.chapter-section {
  margin-bottom: var(--space-12);
  scroll-margin-top: calc(var(--header-height) + var(--space-6));
}

.chapter-section__title {
  font-size: var(--text-3xl);
  font-weight: 700;
  margin-bottom: var(--space-6);
  color: var(--text-primary);
  position: relative;
  padding-bottom: var(--space-3);
}

.chapter-section__title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 80px;
  height: 4px;
  background: linear-gradient(90deg, var(--ethereum-highlight) 0%, var(--ethereum-accent) 100%);
  border-radius: 2px;
}

.chapter-section__content {
  font-size: var(--text-base);
  line-height: 1.7;
  color: var(--text-secondary);
}

.chapter-section__content > *:last-child {
  margin-bottom: 0;
}

/* =============================================================================
   Glossary Components
   ============================================================================= */
.glossary-search {
  margin-bottom: var(--space-8);
}

.search-input {
  width: 100%;
  padding: var(--space-4);
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--border-radius-lg);
  font-size: var(--text-base);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  transition: border-color var(--transition-fast);
}

.search-input:focus {
  outline: none;
  border-color: var(--ethereum-highlight);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.1);
}

.search-input::placeholder {
  color: var(--text-secondary);
}

.glossary-grid {
  display: grid;
  gap: var(--space-6);
}

.glossary-term {
  background-color: var(--bg-secondary);
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: var(--space-6);
  transition: all var(--transition-normal);
}

.glossary-term:hover {
  border-color: var(--ethereum-highlight);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.glossary-term__title {
  font-size: var(--text-xl);
  font-weight: 600;
  margin-bottom: var(--space-3);
  color: var(--ethereum-highlight);
}

.glossary-term__definition {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 0;
}

/* =============================================================================
   Footer Component
   ============================================================================= */
.footer {
  background-color: var(--bg-secondary);
  border-top: var(--border-width) solid var(--border-color);
  padding: var(--space-12) 0 var(--space-6);
  margin-top: var(--space-16);
}

.footer__content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-8);
  margin-bottom: var(--space-8);
}

.footer__section {
  display: flex;
  flex-direction: column;
}

.footer__title {
  font-size: var(--text-lg);
  font-weight: 600;
  margin-bottom: var(--space-4);
  color: var(--text-primary);
}

.footer__links {
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer__links li {
  margin-bottom: var(--space-2);
}

.footer__links a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.footer__links a:hover,
.footer__links a:focus {
  color: var(--ethereum-highlight);
}

.footer__bottom {
  border-top: var(--border-width) solid var(--border-color);
  padding-top: var(--space-6);
  text-align: center;
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

/* =============================================================================
   Utility Classes
   ============================================================================= */
.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;
}

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.hidden { display: none; }
.visible { display: block; }

.mt-0 { margin-top: 0; }
.mt-4 { margin-top: var(--space-4); }
.mt-8 { margin-top: var(--space-8); }
.mb-0 { margin-bottom: 0; }
.mb-4 { margin-bottom: var(--space-4); }
.mb-8 { margin-bottom: var(--space-8); }

/* =============================================================================
   Responsive Design
   ============================================================================= */
@media (max-width: 480px) {
  :root {
    --container-padding: var(--space-4);
  }

  .hero__actions {
    flex-direction: column;
    align-items: center;
  }

  .btn {
    width: 100%;
    max-width: 280px;
  }

  .card {
    padding: var(--space-4);
  }

  .chapter-content {
    padding: var(--space-6);
  }
}

/* =============================================================================
   Accessibility & Animation Preferences
   ============================================================================= */
@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;
  }
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg-primary: var(--dark-bg);
    --bg-secondary: var(--dark-surface);
    --text-primary: var(--dark-text);
    --text-secondary: var(--dark-muted);
    --border-color: var(--dark-border);
  }
}

/* Focus Management */
:focus {
  outline: 2px solid var(--ethereum-highlight);
  outline-offset: 2px;
}

button:focus,
a:focus,
input:focus,
textarea:focus,
select:focus {
  outline: 2px solid var(--ethereum-highlight);
  outline-offset: 2px;
}

/* High Contrast Support */
@media (prefers-contrast: high) {
  :root {
    --border-width: 2px;
  }
  
  .btn {
    border-width: 2px;
  }
}

/* =============================================================================
   Print Styles
   ============================================================================= */
@media print {
  .header,
  .footer,
  .chapter-sidebar,
  .theme-toggle,
  .mobile-menu-toggle,
  .progress-bar {
    display: none;
  }
  
  .chapter-content,
  .chapter-layout {
    background: white;
    border: none;
    box-shadow: none;
  }
  
  .chapter-layout {
    grid-template-columns: 1fr;
  }
  
  a {
    color: black;
    text-decoration: underline;
  }
  
  .chapter-section {
    page-break-inside: avoid;
  }
}

/* =============================================================================
   Loading States & Animations
   ============================================================================= */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.fade-in {
  animation: fadeIn 0.6s ease-out;
}

.slide-in {
  animation: slideIn 0.3s ease-out;
}

.loading-spinner {
  animation: spin 1s linear infinite;
}

/* No-js fallbacks */
.no-js .header__nav {
  display: flex;
}

.no-js .mobile-menu-toggle {
  display: none;
}

/* =============================================================================
   Professional Ethereum-Inspired Enhancements
   ============================================================================= */

/* Ethereum Diamond Logo Animation */
@keyframes ethereumPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.ethereum-logo {
  animation: ethereumPulse 3s ease-in-out infinite;
}

/* Professional Code Blocks */
pre {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--ethereum-highlight);
  position: relative;
}

pre::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--ethereum-highlight), transparent);
}

/* Enhanced Links */
a {
  color: var(--ethereum-highlight);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: all var(--transition-fast);
}

a:hover, a:focus {
  color: var(--ethereum-accent);
  border-bottom-color: var(--ethereum-accent);
}

/* Professional Blockquotes */
blockquote {
  border-left: 4px solid var(--ethereum-accent);
  background: rgba(195, 153, 107, 0.05);
  position: relative;
  font-style: normal;
}

blockquote::before {
  content: '"';
  font-size: 3rem;
  color: var(--ethereum-accent);
  position: absolute;
  top: -10px;
  left: 16px;
  line-height: 1;
  font-family: Georgia, serif;
}

/* Enhanced Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-6) 0;
  background: var(--bg-secondary);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

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

th {
  background: var(--ethereum-highlight);
  color: var(--white);
  font-weight: 600;
}

tr:hover {
  background: rgba(108, 99, 255, 0.05);
}

/* Ethereum-inspired Separators */
.section-divider {
  height: 1px;
  background: linear-gradient(90deg, 
    transparent 0%, 
    var(--ethereum-highlight) 50%, 
    transparent 100%
  );
  margin: var(--space-16) 0;
}

/* Enhanced Selection */
::selection {
  background: rgba(108, 99, 255, 0.2);
  color: var(--text-primary);
}

/* Ethereum-inspired Gradients */
.ethereum-gradient {
  background: linear-gradient(135deg, 
    var(--ethereum-highlight) 0%, 
    var(--ethereum-accent) 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Enhanced Dark Mode Transitions */
* {
  transition: background-color var(--transition-normal), 
              border-color var(--transition-normal), 
              color var(--transition-normal);
}

/* =============================================================================
   Web3 & Token Gating Styles
   ============================================================================= */

/* Premium Navigation Link */
.nav-menu__link--premium {
  background: linear-gradient(135deg, var(--ethereum-highlight), var(--ethereum-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 600;
  position: relative;
}

.nav-menu__link--premium::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--ethereum-highlight), var(--ethereum-accent));
  transform: scaleX(0);
  transition: transform var(--transition-fast);
}

.nav-menu__link--premium:hover::after {
  transform: scaleX(1);
}

/* Wallet Status & Connection */
.wallet-status {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.wallet-info {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  background: var(--bg-secondary);
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--border-radius-lg);
  font-size: var(--text-sm);
}

.wallet-info__ens {
  font-weight: 600;
  color: var(--text-primary);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wallet-info__badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  background: rgba(108, 99, 255, 0.1);
  color: var(--ethereum-highlight);
  border-radius: var(--border-radius);
  font-size: var(--text-xs);
  font-weight: 500;
}

.wallet-info__disconnect {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: var(--text-xs);
  padding: var(--space-1);
  transition: color var(--transition-fast);
}

.wallet-info__disconnect:hover {
  color: var(--ethereum-highlight);
}

/* Premium Content States */
.premium-locked {
  position: relative;
}

.premium-locked .premium-unlocked-content {
  display: none;
}

.premium-unlocked .premium-lock-screen {
  display: none;
}

.premium-unlocked .premium-unlocked-content {
  display: block;
}

/* Premium Lock Screen */
.premium-lock-screen {
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Premium Badges & Status */
.premium-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  background: linear-gradient(135deg, var(--ethereum-highlight), var(--ethereum-accent));
  color: var(--white);
  border-radius: var(--border-radius-lg);
  font-weight: 600;
  box-shadow: var(--shadow-glow);
}

.premium-badge__icon {
  font-size: var(--text-lg);
}

.premium-badge__ens {
  font-size: var(--text-sm);
  opacity: 0.9;
}

.premium-prompt {
  text-align: center;
  padding: var(--space-6);
  background: var(--bg-secondary);
  border: 2px dashed var(--border-color);
  border-radius: var(--border-radius-lg);
}

.premium-prompt__text {
  display: block;
  margin-bottom: var(--space-4);
  color: var(--text-secondary);
}

/* Connect Wallet Button */
.btn-connect-wallet {
  position: relative;
  overflow: hidden;
}

.btn-connect-wallet::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 0.5s ease;
}

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

/* Web3 Toast Notifications */
.web3-toast {
  position: fixed;
  top: calc(var(--header-height) + var(--space-4));
  right: var(--space-4);
  z-index: var(--z-modal);
  max-width: 400px;
  animation: slideInToast 0.3s ease-out;
}

@keyframes slideInToast {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.web3-toast--error .web3-toast__content {
  background: var(--danger);
  color: var(--white);
  padding: var(--space-4);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-xl);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.web3-toast__icon {
  font-size: var(--text-lg);
}

.web3-toast__message {
  flex: 1;
  font-size: var(--text-sm);
}

.web3-toast__close {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: var(--text-lg);
  padding: var(--space-1);
  line-height: 1;
}

/* Premium Metrics Display */
.premium-metrics {
  margin: var(--space-6) 0;
}

.premium-metrics .grid > div {
  text-align: center;
  padding: var(--space-4);
  border-radius: var(--border-radius);
  transition: transform var(--transition-fast);
}

.premium-metrics .grid > div:hover {
  transform: translateY(-2px);
}

/* Premium Benefits Cards */
.premium-benefits .card {
  text-align: left;
  border: 1px solid var(--border-color);
  transition: all var(--transition-normal);
}

.premium-benefits .card:hover {
  border-color: var(--ethereum-highlight);
  box-shadow: var(--shadow-glow);
}

/* Mobile Optimizations for Web3 */
@media (max-width: 768px) {
  .wallet-status {
    order: -1;
    margin-bottom: var(--space-2);
  }
  
  .wallet-info {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
  }
  
  .wallet-info__ens {
    max-width: none;
    font-size: var(--text-xs);
  }
  
  .web3-toast {
    left: var(--space-2);
    right: var(--space-2);
    max-width: none;
  }
  
  .premium-lock-screen {
    min-height: 50vh;
    padding: var(--space-4);
  }
}

/* Loading States for Web3 */
.web3-loading {
  position: relative;
}

.web3-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-top: 2px solid var(--ethereum-highlight);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* ENS Name Highlighting */
.user-ens-name {
  background: linear-gradient(135deg, var(--ethereum-highlight), var(--ethereum-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 600;
}