/* Instacalc Wiki - World-Class Design System
 * A distinct visual identity for the calculator showcase gallery
 * Inspired by: Apple App Store + Dribbble + McMaster-Carr efficiency
 */

/* ============================================
   CSS VARIABLES - Design Tokens
   ============================================ */

:root {
  /* Primary Palette - Teal (precision, calculation, trust) */
  --wiki-primary: #14b8a6;
  --wiki-primary-dark: #0d9488;
  --wiki-primary-light: #5eead4;
  --wiki-primary-subtle: #ccfbf1;

  /* Accent - Purple (creativity, power, innovation) */
  --wiki-accent: #a855f7;
  --wiki-accent-dark: #9333ea;
  --wiki-accent-light: #c084fc;
  --wiki-accent-subtle: #f3e8ff;

  /* Neutrals - Clean light theme */
  --wiki-bg: #f8fafc;
  --wiki-surface: #ffffff;
  --wiki-surface-secondary: #f1f5f9;
  --wiki-border: #e2e8f0;
  --wiki-border-strong: #cbd5e1;
  --wiki-divider: #f1f5f9;

  /* Text */
  --wiki-text: #0f172a;
  --wiki-text-secondary: #334155;
  --wiki-text-muted: #64748b;
  --wiki-text-light: #94a3b8;

  /* Semantic colors */
  --wiki-success: #22c55e;
  --wiki-success-bg: #dcfce7;
  --wiki-warning: #f59e0b;
  --wiki-warning-bg: #fef3c7;
  --wiki-danger: #ef4444;
  --wiki-danger-bg: #fee2e2;
  --wiki-info: #3b82f6;
  --wiki-info-bg: #dbeafe;

  /* Elevation - Shadows */
  --wiki-shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.03);
  --wiki-shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --wiki-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --wiki-shadow-md: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --wiki-shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --wiki-shadow-xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);

  /* Spacing scale */
  --space-1: 0.25rem;   /* 4px */
  --space-2: 0.5rem;    /* 8px */
  --space-3: 0.75rem;   /* 12px */
  --space-4: 1rem;      /* 16px */
  --space-5: 1.5rem;    /* 24px */
  --space-6: 2rem;      /* 32px */
  --space-8: 3rem;      /* 48px */
  --space-10: 4rem;     /* 64px */
  --space-12: 6rem;     /* 96px */
  --space-16: 8rem;     /* 128px */

  /* Border radius */
  --radius-xs: 0.25rem;    /* 4px */
  --radius-sm: 0.375rem;   /* 6px */
  --radius: 0.5rem;        /* 8px */
  --radius-md: 0.625rem;   /* 10px */
  --radius-lg: 0.75rem;    /* 12px */
  --radius-xl: 1rem;       /* 16px */
  --radius-2xl: 1.5rem;    /* 24px */
  --radius-3xl: 2rem;      /* 32px */
  --radius-full: 9999px;   /* Pill shape */

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-display: 'DM Sans', var(--font-sans);
  --font-mono: 'SF Mono', 'Monaco', 'Consolas', 'Courier New', monospace;

  /* Timing functions */
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
  --ease-out: cubic-bezier(0.0, 0, 0.2, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);

  /* Transitions */
  --transition-fast: 150ms var(--ease-smooth);
  --transition: 250ms var(--ease-smooth);
  --transition-slow: 400ms var(--ease-smooth);
}

/* ============================================
   THEME VARIABLE MAPPING
   ============================================ */

/* Map theme variables to wiki variables for backwards compatibility */
:root {
  --wiki-bg: var(--theme-background, #f8fafc);
  --wiki-surface: var(--theme-surface, #ffffff);
  --wiki-surface-secondary: var(--theme-surface-secondary, #f1f5f9);
  --wiki-border: var(--theme-border, #e2e8f0);
  --wiki-border-strong: var(--theme-border-strong, #cbd5e1);
  --wiki-text: var(--theme-text, #0f172a);
  --wiki-text-secondary: var(--theme-text-secondary, #334155);
  --wiki-text-muted: var(--theme-text-muted, #64748b);
  --wiki-text-light: var(--theme-text-light, #94a3b8);
  --wiki-primary: var(--theme-primary, #14b8a6);
  --wiki-primary-dark: var(--theme-primary-dark, #0d9488);
  --wiki-accent: var(--theme-accent, #a855f7);
  --font-sans: var(--theme-font-family, 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif);
}

/* ============================================
   BASE STYLES
   ============================================ */

body.wiki-page {
  font-family: var(--font-sans);
  background-color: var(--wiki-bg);
  color: var(--wiki-text);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  margin: 0;
  padding: 0;
}

.wiki-container {
  max-width: 1536px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.wiki-container-narrow {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

/* ============================================
   HEADER & NAVIGATION
   ============================================ */

/* Original Simple Header */
.wiki-header {
  background: var(--wiki-surface);
  border-bottom: 1px solid var(--wiki-border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, 0.9);
}

/* ============================================
   BEAUTIFUL FUN HEADER (New!)
   ============================================ */

.wiki-header-fun {
  background: var(--theme-gradient-header, linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%));
  position: relative;
  overflow: hidden;
  padding-bottom: 0;
  min-height: 400px;
}

/* Floating Background Shapes */
.wiki-header-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  opacity: 0.2;
}

.wiki-shape {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  animation: wiki-float 20s infinite ease-in-out;
}

.wiki-shape-1 {
  width: 300px;
  height: 300px;
  top: -100px;
  right: 10%;
  animation-delay: 0s;
}

.wiki-shape-2 {
  width: 200px;
  height: 200px;
  bottom: 20%;
  left: 5%;
  animation-delay: -5s;
}

.wiki-shape-3 {
  width: 150px;
  height: 150px;
  top: 40%;
  left: 15%;
  animation-delay: -10s;
}

.wiki-shape-4 {
  width: 250px;
  height: 250px;
  top: 10%;
  right: 30%;
  animation-delay: -15s;
}

@keyframes wiki-float {
  0%, 100% {
    transform: translate(0, 0) scale(1);
  }
  33% {
    transform: translate(30px, -30px) scale(1.1);
  }
  66% {
    transform: translate(-20px, 20px) scale(0.9);
  }
}

/* Top Navigation */
.wiki-top-nav {
  position: relative;
  z-index: 10;
  padding: var(--space-4) 0;
}

.wiki-nav-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.wiki-return-link {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-full);
  color: white;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.wiki-return-link:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateX(-4px);
}

.wiki-return-link img {
  width: 24px;
  height: 24px;
  filter: brightness(0) invert(1);
}

.wiki-nav-links {
  display: flex;
  gap: var(--space-4);
}

.wiki-nav-link {
  color: white;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-lg);
  transition: all var(--transition-fast);
}

.wiki-nav-link:hover {
  background: rgba(255, 255, 255, 0.15);
}

.wiki-nav-button {
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.wiki-nav-button:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.4);
}

/* Hero Content */
.wiki-hero-content {
  position: relative;
  z-index: 5;
  padding: var(--space-6) 0 var(--space-8);
  text-align: center;
}

/* Icon Grid Background */
.wiki-icon-grid {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-8);
  padding: var(--space-8);
  opacity: 0.1;
  font-size: 3rem;
  pointer-events: none;
}

.wiki-icon-grid span {
  animation: wiki-icon-float 3s infinite ease-in-out;
}

.wiki-icon-grid span:nth-child(odd) {
  animation-delay: -1s;
}

@keyframes wiki-icon-float {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-20px) rotate(5deg);
  }
}

/* Hero Title */
.wiki-hero-title {
  position: relative;
  margin-bottom: var(--space-6);
}

.wiki-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-full);
  color: white;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: var(--space-4);
  animation: wiki-badge-pulse 2s infinite ease-in-out;
}

@keyframes wiki-badge-pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.wiki-badge-icon {
  animation: wiki-sparkle 1.5s infinite ease-in-out;
}

@keyframes wiki-sparkle {
  0%, 100% {
    transform: rotate(0deg) scale(1);
  }
  50% {
    transform: rotate(180deg) scale(1.2);
  }
}

.wiki-hero-title h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 8vw, 3.5rem);
  font-weight: 700;
  line-height: 1.1;
  margin: 0 0 var(--space-4);
  letter-spacing: -0.03em;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.wiki-gradient-text {
  background: linear-gradient(135deg, #ffffff 0%, #e0e7ff 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
  animation: wiki-gradient-shift 3s infinite ease-in-out;
}

.wiki-gradient-text-alt {
  background: linear-gradient(135deg, #fde68a 0%, #fbbf24 50%, #f59e0b 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
  animation: wiki-gradient-shift 3s infinite ease-in-out reverse;
}

@keyframes wiki-gradient-shift {
  0%, 100% {
    filter: hue-rotate(0deg);
  }
  50% {
    filter: hue-rotate(20deg);
  }
}

.wiki-hero-subtitle {
  font-size: 1rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.9);
  max-width: 600px;
  margin: 0 auto;
}

/* Enhanced Search Box */
.wiki-hero-search {
  max-width: 700px;
  margin: var(--space-5) auto var(--space-5);
}

.wiki-search-box {
  position: relative;
  display: flex;
  align-items: center;
  background: white;
  border-radius: var(--radius-2xl);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  padding: var(--space-2);
  transition: all var(--transition);
}

.wiki-search-box:focus-within {
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4);
  transform: translateY(-2px);
}

.wiki-search-icon-big {
  font-size: 1.5rem;
  margin: 0 var(--space-3) 0 var(--space-4);
  flex-shrink: 0;
}

.wiki-search-input-big {
  flex: 1;
  font-size: 1rem;
  padding: var(--space-3) var(--space-3);
  border: none;
  background: transparent;
  color: var(--wiki-text);
  outline: none;
}

.wiki-search-input-big::placeholder {
  color: var(--wiki-text-light);
}

.wiki-search-kbd {
  background: var(--wiki-surface-secondary);
  color: var(--wiki-text-muted);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  font-size: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 600;
  margin-right: var(--space-3);
  border: 1px solid var(--wiki-border);
}

/* Quick Suggestions */
.wiki-quick-suggestions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  margin-top: var(--space-4);
  flex-wrap: wrap;
  color: white;
}

.wiki-suggestion-pill {
  padding: var(--space-2) var(--space-4);
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-full);
  color: white;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.wiki-suggestion-pill:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
}

/* Stats Bar */
.wiki-stats-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-5);
  padding: var(--space-4);
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-2xl);
  max-width: 600px;
  margin: 0 auto;
}

.wiki-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
}

.wiki-stat-number {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: white;
}

.wiki-stat-label {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.7);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.wiki-stat-divider {
  width: 1px;
  height: 32px;
  background: rgba(255, 255, 255, 0.2);
}

/* Wave Separator */
.wiki-wave {
  position: relative;
  bottom: -1px;
  width: 100%;
  height: 80px;
  overflow: hidden;
  line-height: 0;
}

.wiki-wave svg {
  position: relative;
  display: block;
  width: calc(100% + 1.3px);
  height: 80px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .wiki-hero-content {
    padding: var(--space-6) 0 var(--space-8);
  }

  .wiki-hero-title h1 {
    font-size: 2rem;
  }

  .wiki-stats-bar {
    flex-direction: column;
    gap: var(--space-4);
  }

  .wiki-stat-divider {
    width: 40px;
    height: 1px;
  }

  .wiki-nav-links {
    display: none;
  }

  .wiki-icon-grid {
    grid-template-columns: repeat(3, 1fr);
    font-size: 2rem;
  }
}

.wiki-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) 0;
  gap: var(--space-6);
}

.wiki-nav .return-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  color: var(--wiki-text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  transition: color var(--transition-fast);
}

.wiki-nav .return-link:hover {
  color: var(--wiki-primary);
}

.wiki-nav .return-link img {
  width: 28px;
  height: 28px;
  opacity: 0.6;
  transition: opacity var(--transition-fast);
}

.wiki-nav .return-link:hover img {
  opacity: 1;
}

.wiki-title {
  flex: 1;
  text-align: center;
}

.wiki-title h1 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--wiki-text);
  margin: 0;
  letter-spacing: -0.02em;
}

.wiki-title p {
  font-size: 0.875rem;
  color: var(--wiki-text-muted);
  margin: var(--space-1) 0 0 0;
}

.wiki-actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.wiki-actions .nav-link {
  text-decoration: none;
  color: var(--wiki-text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  transition: color var(--transition-fast);
}

.wiki-actions .nav-link:hover {
  color: var(--wiki-primary);
}

/* ============================================
   HERO SECTION
   ============================================ */

.wiki-hero {
  text-align: center;
  padding: var(--space-12) 0 var(--space-8);
  background: linear-gradient(180deg, var(--wiki-surface) 0%, var(--wiki-bg) 100%);
}

.wiki-hero h2 {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 700;
  color: var(--wiki-text);
  margin: 0 0 var(--space-4);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.wiki-hero p {
  font-size: 1.25rem;
  color: var(--wiki-text-muted);
  margin: 0 0 var(--space-6);
}

/* ============================================
   SEARCH BAR
   ============================================ */

.wiki-search-wrapper {
  max-width: 600px;
  margin: 0 auto;
  position: relative;
}

.wiki-search {
  width: 100%;
  padding: var(--space-4) var(--space-5) var(--space-4) var(--space-12);
  font-size: 1rem;
  border: 2px solid var(--wiki-border);
  border-radius: var(--radius-full);
  background: var(--wiki-surface);
  color: var(--wiki-text);
  transition: all var(--transition);
  outline: none;
}

.wiki-search:focus {
  border-color: var(--wiki-primary);
  box-shadow: 0 0 0 4px var(--wiki-primary-subtle);
}

.wiki-search-icon {
  position: absolute;
  left: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  color: var(--wiki-text-light);
  font-size: 1.25rem;
  pointer-events: none;
}

.wiki-search-trigger {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--wiki-surface-secondary);
  border: 1px solid var(--wiki-border);
  border-radius: var(--radius-lg);
  color: var(--wiki-text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.wiki-search-trigger:hover {
  background: var(--wiki-surface);
  border-color: var(--wiki-primary);
  color: var(--wiki-primary);
}

/* ============================================
   FILTER BAR
   ============================================ */

.wiki-filter-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-6) 0;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.wiki-filter-bar::-webkit-scrollbar {
  display: none;
}

.wiki-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--wiki-surface);
  border: 1px solid var(--wiki-border);
  border-radius: var(--radius-full);
  color: var(--wiki-text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.wiki-filter-pill:hover {
  background: var(--wiki-surface-secondary);
  border-color: var(--wiki-primary-light);
  color: var(--wiki-text);
}

.wiki-filter-pill.active {
  background: var(--wiki-primary);
  border-color: var(--wiki-primary);
  color: white;
}

.wiki-filter-pill.active:hover {
  background: var(--wiki-primary-dark);
  border-color: var(--wiki-primary-dark);
}

/* ============================================
   CALCULATOR CARDS
   ============================================ */

/* Card Container */
.calc-card {
  background: var(--wiki-surface);
  border: 1px solid var(--wiki-border);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  transition: all var(--transition);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.calc-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--wiki-primary), var(--wiki-accent));
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.calc-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--wiki-shadow-lg);
  border-color: var(--wiki-primary-light);
}

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

/* Card Header */
.calc-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.calc-card-icon {
  font-size: 2rem;
  line-height: 1;
  flex-shrink: 0;
}

.calc-card-title {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--wiki-text);
  margin: 0;
  line-height: 1.3;
  flex: 1;
}

.calc-card-featured {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  background: var(--wiki-accent-subtle);
  color: var(--wiki-accent-dark);
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

/* Card Description */
.calc-card-description {
  font-size: 0.875rem;
  color: var(--wiki-text-muted);
  margin: 0 0 var(--space-4);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Card Tags */
.calc-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.calc-card-tag {
  display: inline-flex;
  padding: var(--space-1) var(--space-3);
  background: var(--wiki-surface-secondary);
  color: var(--wiki-text-secondary);
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.calc-card-tag:hover {
  background: var(--wiki-primary-subtle);
  color: var(--wiki-primary-dark);
}

/* Card Stats */
.calc-card-stats {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-top: auto;
  padding-top: var(--space-4);
  border-top: 1px solid var(--wiki-divider);
  font-size: 0.875rem;
  color: var(--wiki-text-muted);
}

.calc-card-stat {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.calc-card-stat-icon {
  opacity: 0.7;
}

/* Card Preview */
.calc-card-preview {
  margin: var(--space-4) 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--wiki-border);
  background: var(--wiki-surface-secondary);
  aspect-ratio: 16 / 9;
}

.calc-card-preview iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

/* Card Actions */
.calc-card-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.calc-card-btn {
  flex: 1;
  padding: var(--space-2) var(--space-4);
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-lg);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}

.calc-card-btn-primary {
  background: var(--wiki-primary);
  color: white;
}

.calc-card-btn-primary:hover {
  background: var(--wiki-primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--wiki-shadow-sm);
}

.calc-card-btn-secondary {
  background: var(--wiki-surface-secondary);
  color: var(--wiki-text-secondary);
  border: 1px solid var(--wiki-border);
}

.calc-card-btn-secondary:hover {
  background: var(--wiki-surface);
  color: var(--wiki-text);
  border-color: var(--wiki-border-strong);
}

/* ============================================
   LAYOUT MODES
   ============================================ */

/* Grid Layout (Default) */
.wiki-layout-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
  padding: var(--space-6) 0;
}

@media (min-width: 640px) {
  .wiki-layout-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .wiki-layout-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1536px) {
  .wiki-layout-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* List Layout (Compact) */
.wiki-layout-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-6) 0;
}

.wiki-layout-list .calc-card {
  flex-direction: row;
  align-items: center;
  padding: var(--space-4);
  gap: var(--space-4);
}

.wiki-layout-list .calc-card:hover {
  transform: translateX(4px);
}

.wiki-layout-list .calc-card-header {
  margin-bottom: 0;
  flex: 0 0 auto;
}

.wiki-layout-list .calc-card-description {
  margin: 0;
  flex: 1;
}

.wiki-layout-list .calc-card-stats {
  border: none;
  padding: 0;
  margin: 0;
  flex: 0 0 auto;
}

/* Masonry Layout */
.wiki-layout-masonry {
  columns: 1;
  column-gap: var(--space-6);
  padding: var(--space-6) 0;
}

@media (min-width: 640px) {
  .wiki-layout-masonry {
    columns: 2;
  }
}

@media (min-width: 1024px) {
  .wiki-layout-masonry {
    columns: 3;
  }
}

.wiki-layout-masonry .calc-card {
  break-inside: avoid;
  margin-bottom: var(--space-6);
}

/* Table Layout */
.wiki-layout-table {
  padding: var(--space-6) 0;
}

.wiki-table {
  width: 100%;
  background: var(--wiki-surface);
  border: 1px solid var(--wiki-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.wiki-table table {
  width: 100%;
  border-collapse: collapse;
}

.wiki-table th {
  padding: var(--space-4) var(--space-5);
  text-align: left;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--wiki-text-secondary);
  background: var(--wiki-surface-secondary);
  border-bottom: 1px solid var(--wiki-border);
}

.wiki-table td {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--wiki-divider);
  font-size: 0.875rem;
}

.wiki-table tr:last-child td {
  border-bottom: none;
}

.wiki-table tr:hover {
  background: var(--wiki-surface-secondary);
  cursor: pointer;
}

/* ============================================
   LAYOUT SWITCHER
   ============================================ */

.wiki-layout-switcher {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: 50;
  background: var(--wiki-surface);
  border: 1px solid var(--wiki-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--wiki-shadow-lg);
  overflow: hidden;
}

.wiki-layout-switcher-trigger {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--wiki-surface);
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--wiki-text);
  transition: all var(--transition-fast);
}

.wiki-layout-switcher-trigger:hover {
  background: var(--wiki-surface-secondary);
}

.wiki-layout-switcher-dropdown {
  position: absolute;
  bottom: 100%;
  right: 0;
  margin-bottom: var(--space-2);
  background: var(--wiki-surface);
  border: 1px solid var(--wiki-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--wiki-shadow-xl);
  min-width: 200px;
  padding: var(--space-2);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: all var(--transition);
}

.wiki-layout-switcher-dropdown.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

.wiki-layout-option {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 0.875rem;
  color: var(--wiki-text-muted);
}

.wiki-layout-option:hover {
  background: var(--wiki-surface-secondary);
  color: var(--wiki-text);
}

.wiki-layout-option.active {
  background: var(--wiki-primary-subtle);
  color: var(--wiki-primary-dark);
  font-weight: 600;
}

.wiki-layout-option-icon {
  font-size: 1rem;
}

/* ============================================
   FOOTER
   ============================================ */

.wiki-footer {
  margin-top: var(--space-16);
  padding: var(--space-8) 0;
  border-top: 1px solid var(--wiki-border);
  background: var(--wiki-surface);
}

.wiki-footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-6);
  flex-wrap: wrap;
}

.wiki-footer-links a {
  text-decoration: none;
  color: var(--wiki-text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  transition: color var(--transition-fast);
}

.wiki-footer-links a:hover {
  color: var(--wiki-primary);
}

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

.wiki-hidden {
  display: none !important;
}

.wiki-fade-in {
  animation: wikiEnter var(--transition-slow) var(--ease-smooth);
}

@keyframes wikiEnter {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.wiki-skeleton {
  background: linear-gradient(
    90deg,
    var(--wiki-surface-secondary) 0%,
    var(--wiki-bg) 50%,
    var(--wiki-surface-secondary) 100%
  );
  background-size: 200% 100%;
  animation: wikiShimmer 1.5s infinite;
  border-radius: var(--radius);
}

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

/* ============================================
   RESPONSIVE UTILITIES
   ============================================ */

@media (max-width: 639px) {
  .wiki-hide-mobile {
    display: none !important;
  }
}

@media (min-width: 640px) and (max-width: 1023px) {
  .wiki-hide-tablet {
    display: none !important;
  }
}

@media (min-width: 1024px) {
  .wiki-hide-desktop {
    display: none !important;
  }
}

/* ============================================
   DARK MODE (Optional - Future Enhancement)
   ============================================ */

@media (prefers-color-scheme: dark) {
  :root {
    /* Dark mode overrides could go here if needed */
    /* For now, wiki stays light theme */
  }
}

/* ============================================
   MINIMAL HEADER LAYOUT
   ============================================ */

.wiki-header-minimal {
  background: var(--theme-background, #ffffff);
  border-bottom: 1px solid var(--theme-border, #e5e7eb);
  padding: var(--theme-space-4, 1rem) 0;
}

.wiki-top-nav-minimal {
  padding: var(--theme-space-4, 1rem) 0;
}

.wiki-logo-link {
  display: flex;
  align-items: center;
  gap: var(--theme-space-2, 0.5rem);
  text-decoration: none;
  color: var(--theme-text, #111827);
  font-weight: 600;
  font-size: 1.125rem;
}

.wiki-logo-link img {
  width: 32px;
  height: 32px;
}

.wiki-hero-minimal {
  text-align: center;
  padding: var(--theme-space-8, 3rem) 0 var(--theme-space-6, 2rem);
  max-width: 800px;
  margin: 0 auto;
}

.wiki-hero-minimal h1 {
  font-size: var(--theme-text-4xl, 2.25rem);
  font-weight: 700;
  margin: 0 0 var(--theme-space-4, 1rem);
  color: var(--theme-text, #111827);
}

.wiki-hero-minimal p {
  font-size: var(--theme-text-lg, 1.125rem);
  color: var(--theme-text-secondary, #4b5563);
  margin: 0 0 var(--theme-space-6, 2rem);
}

.wiki-search-inline {
  max-width: 600px;
  margin: 0 auto;
}

.wiki-search-input-outline {
  width: 100%;
  padding: var(--theme-space-3, 0.75rem) var(--theme-space-4, 1rem);
  border: 2px solid var(--theme-border, #e5e7eb);
  border-radius: var(--theme-radius-base, 0.375rem);
  font-size: var(--theme-text-base, 1rem);
  transition: all 200ms ease;
  outline: none;
}

.wiki-search-input-outline:focus {
  border-color: var(--theme-primary, #2563eb);
  box-shadow: 0 0 0 3px var(--theme-primary-light, rgba(37, 99, 235, 0.1));
}

.wiki-button-solid {
  background: var(--theme-primary, #2563eb);
  color: white;
  border: none;
  padding: var(--theme-space-2, 0.5rem) var(--theme-space-4, 1rem);
  border-radius: var(--theme-radius-base, 0.375rem);
  font-size: var(--theme-text-sm, 0.875rem);
  font-weight: 500;
  cursor: pointer;
  transition: all 200ms ease;
}

.wiki-button-solid:hover {
  background: var(--theme-primary-dark, #1e40af);
}

/* ============================================
   THEME SWITCHER
   ============================================ */

.wiki-theme-switcher {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1000;
}

.wiki-theme-button {
  width: 56px;
  height: 56px;
  border-radius: var(--theme-radius-full, 9999px);
  background: var(--theme-primary, #14b8a6);
  color: white;
  border: none;
  box-shadow: var(--theme-shadow-lg, 0 20px 25px -5px rgb(0 0 0 / 0.1));
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  transition: all 200ms ease;
}

.wiki-theme-button:hover {
  transform: scale(1.1);
  box-shadow: var(--theme-shadow-xl, 0 25px 50px -12px rgb(0 0 0 / 0.25));
}

.wiki-theme-panel {
  position: absolute;
  bottom: 70px;
  right: 0;
  width: 400px;
  max-height: 600px;
  background: var(--theme-surface, white);
  border: 1px solid var(--theme-border, #e2e8f0);
  border-radius: var(--theme-radius-xl, 1rem);
  box-shadow: var(--theme-shadow-xl, 0 25px 50px -12px rgb(0 0 0 / 0.25));
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.wiki-theme-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--theme-border, #e2e8f0);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.wiki-theme-header h3 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--theme-text, #0f172a);
}

.wiki-theme-close {
  background: none;
  border: none;
  color: var(--theme-text-muted, #64748b);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--theme-radius-base, 0.5rem);
  transition: all 150ms ease;
}

.wiki-theme-close:hover {
  background: var(--theme-surface-secondary, #f1f5f9);
  color: var(--theme-text, #0f172a);
}

.wiki-theme-list {
  overflow-y: auto;
  padding: 1rem;
  flex: 1;
}

.wiki-theme-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border: 2px solid var(--theme-border, #e2e8f0);
  border-radius: var(--theme-radius-lg, 0.75rem);
  background: var(--theme-surface, white);
  cursor: pointer;
  transition: all 200ms ease;
  margin-bottom: 0.75rem;
  text-align: left;
}

.wiki-theme-option:hover {
  border-color: var(--theme-primary, #14b8a6);
  box-shadow: var(--theme-shadow-md, 0 10px 15px -3px rgb(0 0 0 / 0.1));
}

.wiki-theme-option.active {
  border-color: var(--theme-primary, #14b8a6);
  background: linear-gradient(135deg, var(--theme-primary, #14b8a6), var(--theme-accent, #a855f7));
  background-blend-mode: soft-light;
  opacity: 0.9;
}

.wiki-theme-preview {
  width: 80px;
  height: 60px;
  border-radius: var(--theme-radius-base, 0.5rem);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--theme-surface-secondary, #f1f5f9);
}

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

.wiki-theme-preview-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--theme-text-muted, #64748b);
  font-size: 1.5rem;
}

.wiki-theme-info {
  flex: 1;
}

.wiki-theme-name {
  font-weight: 600;
  color: var(--theme-text, #0f172a);
  margin-bottom: 0.25rem;
}

.wiki-theme-description {
  font-size: 0.875rem;
  color: var(--theme-text-secondary, #334155);
  line-height: 1.4;
}

.wiki-theme-active {
  color: var(--theme-primary, #14b8a6);
  font-size: 1.25rem;
}

.wiki-theme-option.active .wiki-theme-name,
.wiki-theme-option.active .wiki-theme-description {
  color: var(--theme-text, #0f172a);
}

@media (max-width: 640px) {
  .wiki-theme-panel {
    width: calc(100vw - 2rem);
    right: 1rem;
  }

  .wiki-theme-switcher {
    bottom: 1rem;
    right: 1rem;
  }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
  .wiki-header,
  .wiki-header-fun,
  .wiki-header-minimal,
  .wiki-filter-bar,
  .wiki-layout-switcher,
  .wiki-footer,
  .wiki-theme-switcher {
    display: none;
  }

  .calc-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ddd;
  }
}
