/* =============================================================================
   CSS Custom Properties (Design Tokens)
   ============================================================================= */
:root {
  /* Colors */
  --color-primary: #3b82f6;
  --color-primary-hover: #2563eb;
  --color-secondary: #64748b;
  --color-text: #1f2937;
  --color-text-light: #6b7280;
  --color-bg: #ffffff;
  --color-bg-alt: #f9fafb;
  --color-border: #e5e7eb;
  --color-success: #10b981;
  --color-error: #ef4444;

  /* Spacing */
  --spacing-unit: 8px;
  --spacing-xs: calc(var(--spacing-unit) * 1);   /* 8px */
  --spacing-sm: calc(var(--spacing-unit) * 2);   /* 16px */
  --spacing-md: calc(var(--spacing-unit) * 3);   /* 24px */
  --spacing-lg: calc(var(--spacing-unit) * 4);   /* 32px */
  --spacing-xl: calc(var(--spacing-unit) * 6);   /* 48px */
  --spacing-2xl: calc(var(--spacing-unit) * 8);  /* 64px */

  /* Typography */
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Courier New', monospace;

  --font-size-xs: 0.75rem;    /* 12px */
  --font-size-sm: 0.875rem;   /* 14px */
  --font-size-base: 1rem;     /* 16px */
  --font-size-lg: 1.125rem;   /* 18px */
  --font-size-xl: 1.25rem;    /* 20px */
  --font-size-2xl: 1.5rem;    /* 24px */
  --font-size-3xl: 1.875rem;  /* 30px */
  --font-size-4xl: 2.25rem;   /* 36px */
  --font-size-5xl: 3rem;      /* 48px */

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);

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

  /* Layout */
  --max-width-sm: 640px;
  --max-width-md: 768px;
  --max-width-lg: 1024px;
  --max-width-xl: 1280px;
  --max-width-2xl: 1440px;
}

/* =============================================================================
   Squircle Fallback (Prevents FOUC - Flash of Unstyled Content)
   Pre-applies border-radius while JavaScript loads the squircle mask
   ============================================================================= */
[data-squircle] {
  border-radius: var(--squircle-radius, 20px);
}

/* Playground preview element */
#playground-preview {
  border-radius: var(--squircle-radius, 20px);
}

/* Hero showcase element */
#hero-showcase {
  border-radius: var(--squircle-radius, 24px);
}

/* Gallery elements - apply fallback border-radius immediately */
/* Note: form- elements excluded because they use squircle borders (pseudo-elements) */
[id^="gallery-"],
[id^="button-"],
[id^="card-"],
[id^="modal-"],
[id^="nav-"],
[id^="image-"] {
  border-radius: var(--squircle-radius, 20px);
}

/* Smooth transition when clip-path is applied */
#playground-preview,
#hero-showcase,
[data-squircle],
[id^="gallery-"],
[id^="button-"],
[id^="card-"],
[id^="modal-"],
[id^="nav-"],
[id^="image-"] {
  transition: clip-path 0.15s ease-out;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg-alt);
  min-height: 100vh;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--color-text);
}

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

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

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

a:hover {
  color: var(--color-primary-hover);
}

a:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

code, pre {
  font-family: var(--font-mono);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

/* =============================================================================
   Reduced Motion Support (WCAG Compliance)
   ============================================================================= */
@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;
  }
}

/* =============================================================================
   Layout & Container
   ============================================================================= */
.container {
  width: 100%;
  max-width: var(--max-width-2xl);
  margin: 0 auto;
  padding: 0 var(--spacing-sm);
}

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

/* =============================================================================
   Button Components
   ============================================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-sm) var(--spacing-lg);
  border-radius: var(--radius-md);
  font-size: var(--font-size-base);
  font-weight: 500;
  text-align: center;
  transition: all var(--transition-fast);
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: var(--color-primary);
  color: white;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
  background: var(--color-primary-hover);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(59, 130, 246, 0.1);
  color: var(--color-primary);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.btn-secondary:hover {
  background: rgba(59, 130, 246, 0.15);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

.btn-sm {
  padding: var(--spacing-xs) var(--spacing-md);
  font-size: var(--font-size-sm);
}

.btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

kbd {
  display: inline-block;
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  box-shadow: var(--shadow-sm);
}

/* =============================================================================
   Hero Section
   ============================================================================= */
#hero {
  background: var(--color-text);
  color: white;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--spacing-2xl) var(--spacing-sm);
}

.hero-content {
  max-width: var(--max-width-lg);
}

#hero h1 {
  color: white;
  font-size: var(--font-size-5xl);
  margin-bottom: var(--spacing-md);
}

.hero-subtitle {
  font-size: var(--font-size-xl);
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: var(--spacing-xl);
}

.hero-demo {
  width: 200px;
  height: 200px;
  margin: var(--spacing-xl) auto;
  background: white;
  box-shadow: 0 8px 32px rgba(255, 255, 255, 0.2), 0 0 0 1px rgba(255, 255, 255, 0.1);
  animation: heroSquircleAnimation 4s ease-in-out infinite alternate;
}

@keyframes heroSquircleAnimation {
  0% {
    transform: scale(1);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.05);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 0.8;
  }
}

.hero-features {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-md);
  margin: var(--spacing-xl) 0;
  text-align: left;
}

.hero-features .feature {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.hero-features strong {
  font-size: var(--font-size-lg);
  color: white;
}

.hero-features span {
  font-size: var(--font-size-sm);
  color: rgba(255, 255, 255, 0.8);
}

.hero-cta {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  margin: var(--spacing-xl) 0;
}

.hero-quickstart {
  position: relative;
  margin-top: var(--spacing-lg);
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.hero-quickstart pre {
  background: rgba(0, 0, 0, 0.3);
  padding: var(--spacing-md);
  padding-right: 80px; /* Space for copy button */
  border-radius: var(--radius-md);
  text-align: left;
  overflow-x: auto;
}

.hero-quickstart button {
  position: absolute;
  top: var(--spacing-sm);
  right: var(--spacing-sm);
  background: var(--color-primary);
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
}

/* =============================================================================
   Playground Section
   ============================================================================= */
#playground {
  background: var(--color-bg);
}

.playground-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-xl);
  margin-top: var(--spacing-lg);
}

.playground-controls {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.control-group label {
  font-weight: 500;
  color: var(--color-text);
}

.control-group input[type="range"] {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--color-bg-alt);
  outline: none;
  -webkit-appearance: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--color-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.control-group input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--color-primary);
  cursor: pointer;
  border: none;
}

.control-group input[type="range"]:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

/* Dark mode range slider styles - Safari compatible */
.dark .control-group input[type="range"],
[data-theme="dark"] .control-group input[type="range"] {
  background-color: #374151;
}

.dark .control-group input[type="range"]::-webkit-slider-thumb,
[data-theme="dark"] .control-group input[type="range"]::-webkit-slider-thumb {
  background-color: #3b82f6;
  border: 2px solid #1f2937;
}

.dark .control-group input[type="range"]::-moz-range-thumb,
[data-theme="dark"] .control-group input[type="range"]::-moz-range-thumb {
  background-color: #3b82f6;
  border: 2px solid #1f2937;
}

.dark .control-group input[type="range"]::-webkit-slider-runnable-track,
[data-theme="dark"] .control-group input[type="range"]::-webkit-slider-runnable-track {
  background-color: #374151;
}

.dark .control-group input[type="range"]::-moz-range-track,
[data-theme="dark"] .control-group input[type="range"]::-moz-range-track {
  background-color: #374151;
}

.playground-preview {
  width: 100%;
  height: 200px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: var(--font-size-lg);
  color: white;
  /* v1.0: Using strong colors and shadows for visibility (border support coming in future versions) */
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.4);
}

.playground-metrics {
  padding: var(--spacing-lg);
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.playground-metrics h3 {
  font-size: var(--font-size-lg);
  margin-bottom: var(--spacing-md);
  color: var(--color-text);
}

#metrics-display p {
  margin-bottom: var(--spacing-sm);
  font-size: var(--font-size-base);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

#metrics-display p strong {
  min-width: 120px;
  color: var(--color-text-light);
  font-weight: 500;
}

#browser-tier {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: white !important;
}

.playground-code h3 {
  margin-bottom: var(--spacing-md);
}

.code-tabs {
  display: flex;
  gap: var(--spacing-xs);
  margin-bottom: var(--spacing-sm);
  border-bottom: 1px solid var(--color-border);
  overflow-x: auto;
}

.tab-btn {
  padding: var(--spacing-sm) var(--spacing-md);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-light);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.tab-btn.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.tab-btn:hover {
  color: var(--color-text);
}

.code-block {
  position: relative;
}

.code-block pre {
  /* Let Tailwind classes handle styling - don't override bg-gray-900 */
  white-space: pre;
  font-family: var(--font-mono);
}

.code-block button {
  position: absolute;
  top: var(--spacing-sm);
  right: var(--spacing-sm);
  padding: var(--spacing-xs) var(--spacing-sm);
  font-size: var(--font-size-xs);
  background: var(--color-primary);
  color: white;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.code-block button:hover {
  background: var(--color-primary-hover);
}

.playground-shortcuts {
  margin-top: var(--spacing-lg);
  padding: var(--spacing-md);
  background: var(--color-bg-alt);
  border-radius: var(--radius-md);
  text-align: center;
  font-size: var(--font-size-sm);
  color: var(--color-text-light);
}

/* =============================================================================
   Gallery Section
   ============================================================================= */
#gallery {
  background: var(--color-bg-alt);
}

.gallery-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-2xl);
  margin-top: var(--spacing-lg);
}

.gallery-category {
  background: white;
  padding: var(--spacing-xl);
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.gallery-category h3 {
  margin-bottom: var(--spacing-lg);
  font-size: var(--font-size-2xl);
  color: var(--color-text);
}

.button-group, .card-group, .modal-group, .nav-group, .image-group, .form-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-md);
  margin-top: var(--spacing-md);
}

.demo-button {
  display: inline-block;
  padding: var(--spacing-sm) var(--spacing-lg);
  border-radius: var(--radius-md);
  font-weight: 500;
  transition: all var(--transition-fast);
}

.demo-card {
  padding: var(--spacing-lg);
  background: #f8fafc;
  flex: 1;
  min-width: 200px;
  /* Using stronger shadow for visibility */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.demo-card strong {
  display: block;
  font-size: var(--font-size-lg);
  margin-bottom: var(--spacing-sm);
  color: var(--color-text);
}

.demo-card small {
  font-size: var(--font-size-sm);
  color: var(--color-text-light);
}

/* Button Styles */
.demo-button.btn-primary {
  background: var(--color-primary);
  color: white;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
  border: none;
  cursor: pointer;
}

.demo-button.btn-primary:hover {
  background: #2563eb;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
  transform: translateY(-1px);
}

.demo-button.btn-secondary {
  background: rgba(59, 130, 246, 0.1);
  color: var(--color-primary);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  border: none;
  cursor: pointer;
}

.demo-button.btn-secondary:hover {
  background: rgba(59, 130, 246, 0.2);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

.demo-button.btn-ghost {
  background: var(--color-bg-alt);
  color: var(--color-text);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  border: none;
  cursor: pointer;
}

.demo-button.btn-ghost:hover {
  background: #e5e7eb;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

.demo-button.btn-disabled {
  background: #f1f5f9;
  color: #94a3b8;
  box-shadow: none;
  border: none;
  cursor: not-allowed;
  opacity: 0.6;
}

/* Modal Styles */
.demo-modal {
  padding: var(--spacing-xl);
  background: white;
  flex: 1;
  min-width: 280px;
  max-width: 400px;
  /* Using stronger shadow for visibility */
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.demo-modal strong {
  display: block;
  margin-bottom: var(--spacing-sm);
  font-size: 1.25rem;
}

.demo-modal p {
  margin-bottom: var(--spacing-sm);
}

.modal-alert {
  border-left: 4px solid #f59e0b;
}

.modal-success {
  border-left: 4px solid #10b981;
}

/* Navigation Styles */
.nav-tabs,
.nav-pills {
  display: flex;
  gap: var(--spacing-xs);
  margin-bottom: var(--spacing-md);
  flex-wrap: wrap;
}

.demo-tab,
.demo-pill {
  padding: var(--spacing-sm) var(--spacing-md);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  border-bottom: 2px solid transparent;
}

.demo-tab:hover {
  background: var(--color-bg-alt);
}

.demo-tab.active {
  border-bottom-color: var(--color-primary);
  color: var(--color-primary);
}

.demo-pill {
  border-radius: 999px;
  background: var(--color-bg-alt);
}

.demo-pill.active {
  background: var(--color-primary);
  color: white;
}

.demo-breadcrumbs {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  font-size: 0.875rem;
  flex-wrap: wrap;
}

.breadcrumb-item {
  padding: var(--spacing-xs) var(--spacing-sm);
  background: var(--color-bg-alt);
  border-radius: var(--radius-sm);
}

.breadcrumb-item.active {
  background: var(--color-primary);
  color: white;
}

.breadcrumb-separator {
  color: var(--color-text-muted);
}

/* Image Styles */
.demo-image-wrapper {
  margin-bottom: var(--spacing-md);
}

.demo-image-wrapper.full-width {
  grid-column: 1 / -1;
}

.demo-avatar {
  width: 80px;
  height: 80px;
  object-fit: cover;
  display: block;
}

.demo-thumbnail {
  width: 200px;
  height: 150px;
  object-fit: cover;
  display: block;
}

.demo-hero {
  width: 100%;
  max-width: 600px;
  height: auto;
  display: block;
}

/* Form Styles */
.form-example {
  margin-bottom: var(--spacing-lg);
}

.form-example label {
  display: block;
  margin-bottom: var(--spacing-xs);
  font-weight: 500;
  color: var(--color-text);
}

.demo-input,
.demo-textarea {
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-md);
  border: none;
  background: var(--color-bg-alt);
  font-family: inherit;
  font-size: 1rem;
  transition: all var(--transition-fast);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.demo-input:focus,
.demo-textarea:focus {
  outline: none;
  background: white;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15), 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

.demo-textarea {
  resize: vertical;
}

/* Example Labels */
.example-label {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: var(--spacing-xs);
  font-family: 'Courier New', monospace;
}

/* =============================================================================
   Comparison Section
   ============================================================================= */
#comparison {
  background: var(--color-bg);
}

.comparison-controls {
  margin: var(--spacing-lg) 0;
  text-align: center;
}

.comparison-split {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-xl);
  margin: var(--spacing-xl) 0;
}

.comparison-element {
  width: 100%;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  /* v1.0: Strong contrasting colors for visibility (border support coming in future versions) */
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.4);
  font-weight: 700;
  font-size: var(--font-size-lg);
  color: #78350f;
}

/* Overlay mode for comparison */
.comparison-split.overlay-mode {
  position: relative;
  display: block;
  height: 250px;
}

.comparison-split.overlay-mode .comparison-item {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 200px;
}

.comparison-split.overlay-mode .comparison-item:first-child {
  opacity: 0.7;
  z-index: 1;
}

.comparison-split.overlay-mode .comparison-item:last-child {
  opacity: 0.7;
  z-index: 2;
  transform: translateX(20px) translateY(20px);
}

.comparison-split.overlay-mode .comparison-label {
  position: relative;
  z-index: 10;
  background: white;
  padding: var(--spacing-xs);
  display: inline-block;
  border-radius: var(--radius-sm);
  margin-top: 210px;
}

.comparison-label {
  text-align: center;
  font-size: var(--font-size-sm);
  color: var(--color-text-light);
  margin-top: var(--spacing-sm);
}

.comparison-explanation {
  padding: var(--spacing-lg);
  background: var(--color-bg-alt);
  border-radius: var(--radius-md);
  margin-top: var(--spacing-xl);
}

/* =============================================================================
   Compatibility Section
   ============================================================================= */
#compatibility {
  background: var(--color-bg-alt);
}

.tier-detection {
  text-align: center;
  margin: var(--spacing-lg) 0;
}

.tier-badge {
  display: inline-block;
  padding: var(--spacing-xs) var(--spacing-md);
  background: var(--color-primary);
  color: white;
  border-radius: var(--radius-md);
  font-weight: 500;
}

.browser-matrix {
  margin: var(--spacing-xl) 0;
}

.browser-matrix table {
  width: 100%;
  border-collapse: collapse;
  margin-top: var(--spacing-md);
  background: white;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.browser-matrix th,
.browser-matrix td {
  padding: var(--spacing-md);
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

.browser-matrix th {
  background: var(--color-bg-alt);
  font-weight: 600;
  color: var(--color-text);
}

.tier-hierarchy {
  margin-top: var(--spacing-xl);
  padding: var(--spacing-lg);
  background: white;
  border-radius: var(--radius-md);
}

.tier-hierarchy ol {
  margin-top: var(--spacing-md);
  margin-left: var(--spacing-lg);
}

.tier-hierarchy li {
  margin-bottom: var(--spacing-sm);
  padding-left: var(--spacing-sm);
}

/* =============================================================================
   Code Examples Section
   ============================================================================= */
#code {
  background: var(--color-bg);
}

.install-section {
  margin: var(--spacing-lg) 0 var(--spacing-xl);
}

.install-section pre {
  background: var(--color-bg-alt);
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  font-size: var(--font-size-base);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.code-examples-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-lg);
}

.code-example {
  position: relative;
  background: white;
  padding: var(--spacing-lg);
  border-radius: var(--radius-md);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.code-example h4 {
  margin-bottom: var(--spacing-md);
}

.code-example pre {
  background: var(--color-bg-alt);
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  overflow-x: auto;
  font-size: var(--font-size-sm);
  line-height: 1.6;
  margin-bottom: var(--spacing-sm);
}

/* =============================================================================
   Footer
   ============================================================================= */
#footer {
  background: var(--color-text);
  color: white;
  padding: var(--spacing-xl) 0;
  text-align: center;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-md);
  flex-wrap: wrap;
}

.footer-links a {
  color: white;
  font-weight: 500;
}

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

.footer-copy {
  font-size: var(--font-size-sm);
  color: rgba(255, 255, 255, 0.7);
}

/* =============================================================================
   Responsive Breakpoints (Mobile-First)
   ============================================================================= */

/* Tablet (768px+) */
@media (min-width: 768px) {
  /* Hero */
  #hero h1 {
    font-size: calc(var(--font-size-5xl) * 1.2);
  }

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

  .hero-cta {
    flex-direction: row;
    justify-content: center;
  }

  /* Playground */
  .playground-layout {
    grid-template-columns: 1fr 1fr;
  }

  /* Gallery */
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Comparison */
  .comparison-split {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Code Examples */
  .code-examples-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Desktop (1280px+) */
@media (min-width: 1280px) {
  /* Container */
  .container {
    padding: 0 var(--spacing-lg);
  }

  /* Hero */
  .hero-features {
    grid-template-columns: repeat(5, 1fr);
    text-align: center;
  }

  /* Gallery */
  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  /* Playground keeps 2 columns even on desktop */

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

/* Focus Indicators (Accessibility) */
*:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* ============================================================================
   Copy Button State Classes (for feedback)
   ============================================================================ */
.btn-copy-success {
  background-color: #10b981 !important;
  color: white !important;
}

.btn-copy-error {
  background-color: #ef4444 !important;
  color: white !important;
}

.btn-copy-fallback {
  background-color: #f59e0b !important;
  color: white !important;
}

/* ============================================================================
   Skip to Content Link (Accessibility)
   ============================================================================ */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: #000;
  color: #fff;
  padding: 8px 16px;
  text-decoration: none;
  z-index: 100;
  border-radius: 0 0 4px 0;
}

.skip-link:focus {
  top: 0;
}

/* ============================================================================
   Print Styles
   ============================================================================ */
@media print {
  /* Hide non-essential elements */
  header,
  footer,
  nav,
  aside,
  .no-print,
  button,
  .hero-demo,
  .playground-preview {
    display: none !important;
  }

  /* Reset colors for print */
  * {
    background: white !important;
    color: black !important;
  }

  /* Add page breaks */
  h1, h2, h3 {
    page-break-after: avoid;
  }

  /* Show URLs for links */
  a[href]:after {
    content: " (" attr(href) ")";
  }

  /* Optimize layout */
  body {
    margin: 0;
    padding: 20px;
  }

  section {
    page-break-inside: avoid;
  }
}

/* ============================================================================
   Dark Mode Support (Class-based to match Tailwind's darkMode: 'class')
   Safari-compatible with data-theme fallback
   ============================================================================ */
.dark,
[data-theme="dark"] {
  --color-background: #111827;
  --color-text: #f3f4f6;
  --color-text-muted: #9ca3af;
  color-scheme: dark;
}

.dark body,
[data-theme="dark"] body {
  background-color: var(--color-background);
  color: var(--color-text);
}

/* Safari fallback: Use data-theme attribute if class doesn't work */
[data-theme="dark"] {
  color-scheme: dark;
}

[data-theme="light"] {
  color-scheme: light;
}

/* Adjust specific components for dark mode - Safari compatible */
.dark .bg-white,
[data-theme="dark"] .bg-white {
  background-color: #1f2937 !important;
}

.dark .bg-gray-50,
[data-theme="dark"] .bg-gray-50 {
  background-color: #111827 !important;
}

.dark .bg-gray-100,
[data-theme="dark"] .bg-gray-100 {
  background-color: #1f2937 !important;
}

.dark .text-gray-900,
[data-theme="dark"] .text-gray-900 {
  color: #f3f4f6 !important;
}

.dark .text-gray-700,
[data-theme="dark"] .text-gray-700 {
  color: #d1d5db !important;
}

.dark .text-gray-600,
[data-theme="dark"] .text-gray-600 {
  color: #9ca3af !important;
}

.dark .border-gray-200,
[data-theme="dark"] .border-gray-200 {
  border-color: #374151 !important;
}

.dark .border-gray-300,
[data-theme="dark"] .border-gray-300 {
  border-color: #4b5563 !important;
}

/* Code blocks - keep dark */
.dark .bg-gray-900,
[data-theme="dark"] .bg-gray-900,
.dark pre,
[data-theme="dark"] pre {
  background-color: #000 !important;
}

/* Inputs and forms - exclude form elements inside squircle wrappers */
.dark input:not([id^="form-"]),
[data-theme="dark"] input:not([id^="form-"]),
.dark textarea:not([id^="form-"]),
[data-theme="dark"] textarea:not([id^="form-"]),
.dark select,
[data-theme="dark"] select {
  background-color: #1f2937 !important;
  border-color: #4b5563 !important;
  color: #f3f4f6 !important;
}

/* Range sliders - ensure visibility in dark mode */
.dark input[type="range"],
[data-theme="dark"] input[type="range"] {
  background-color: #374151 !important;
}

.dark input[type="range"]::-webkit-slider-thumb,
[data-theme="dark"] input[type="range"]::-webkit-slider-thumb {
  background-color: #3b82f6 !important;
  border: 2px solid #1f2937;
}

.dark input[type="range"]::-moz-range-thumb,
[data-theme="dark"] input[type="range"]::-moz-range-thumb {
  background-color: #3b82f6 !important;
  border: 2px solid #1f2937;
}

.dark input[type="range"]::-webkit-slider-runnable-track,
[data-theme="dark"] input[type="range"]::-webkit-slider-runnable-track {
  background-color: #374151 !important;
}

.dark input[type="range"]::-moz-range-track,
[data-theme="dark"] input[type="range"]::-moz-range-track {
  background-color: #374151 !important;
}

/* Cards and boxes */
.dark .shadow-sm,
[data-theme="dark"] .shadow-sm,
.dark .shadow,
[data-theme="dark"] .shadow,
.dark .shadow-lg,
[data-theme="dark"] .shadow-lg {
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.5) !important;
}

/* ============================================================================
   Smooth Scroll (Respect prefers-reduced-motion)
   ============================================================================ */
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
