/* =============================================================================
   AdCP Design System
   Version 1.0.0

   A restrictive design system for consistent UI across the AdCP platform.
   All components should use these variables - no hardcoded values.

   This is the SINGLE source of truth for all styling.
   ============================================================================= */

/* =============================================================================
   1. COLOR PALETTE

   Primary: Blue (#1a36b4) - Brand color, primary actions
   All grays, status colors, and backgrounds derive from this system.
   ============================================================================= */

:root {
  /* -----------------------------------------------------------------------------
     1.1 Brand Colors
     ----------------------------------------------------------------------------- */
  --color-primary-900: #0f1f6b;     /* Darkest - use sparingly */
  --color-primary-800: #142782;
  --color-primary-700: #1a36b4;     /* PRIMARY - main brand blue */
  --color-primary-600: #2d4fd6;     /* Lighter primary - hover states */
  --color-primary-500: #4169e1;     /* Mid blue */
  --color-primary-400: #6b8cef;
  --color-primary-300: #a4c2f4;     /* Accent blue - highlights */
  --color-primary-200: #c5d9f7;     /* Light blue - backgrounds */
  --color-primary-100: #dbe8fc;     /* Lightest blue - subtle bg */
  --color-primary-50:  #eef4fc;     /* Near white blue - cards */

  /* Semantic aliases for primary */
  --color-brand: var(--color-primary-700);
  --color-brand-hover: var(--color-primary-600);
  --color-brand-light: var(--color-primary-300);
  --color-brand-bg: var(--color-primary-50);

  /* -----------------------------------------------------------------------------
     1.2 Neutral Colors (Gray Scale)
     ----------------------------------------------------------------------------- */
  --color-gray-950: #0a0a0a;        /* Near black */
  --color-gray-900: #1d1d1d;        /* Primary text */
  --color-gray-800: #2d3748;        /* Headings */
  --color-gray-700: #374151;        /* Secondary text dark */
  --color-gray-600: #4b5563;        /* Body text */
  --color-gray-500: #6b7280;        /* Secondary text */
  --color-gray-400: #9ca3af;        /* Placeholder, disabled */
  --color-gray-300: #d1d5db;        /* Borders */
  --color-gray-200: #e5e7eb;        /* Light borders */
  --color-gray-100: #f3f4f6;        /* Light backgrounds */
  --color-gray-50:  #f9fafb;        /* Subtle backgrounds */

  /* Semantic aliases for neutrals */
  --color-text: var(--color-gray-900);
  --color-text-secondary: var(--color-gray-500);
  --color-text-muted: var(--color-gray-400);
  --color-text-heading: var(--color-gray-800);
  --color-border: var(--color-gray-200);
  --color-border-strong: var(--color-gray-300);
  --color-bg-page: var(--color-gray-100);
  --color-bg-subtle: var(--color-gray-50);
  --color-bg-card: #ffffff;

  /* -----------------------------------------------------------------------------
     1.3 Status Colors (Semantic)
     ----------------------------------------------------------------------------- */
  /* Success - Green */
  --color-success-700: #047857;
  --color-success-600: #059669;
  --color-success-500: #10b981;     /* Primary success */
  --color-success-100: #d1fae5;
  --color-success-50:  #ecfdf5;

  /* Warning - Amber/Orange */
  --color-warning-700: #b45309;
  --color-warning-600: #d97706;
  --color-warning-500: #f59e0b;     /* Primary warning */
  --color-warning-100: #fef3c7;
  --color-warning-50:  #fffbeb;

  /* Error/Danger - Red */
  --color-error-700: #b91c1c;
  --color-error-600: #dc2626;
  --color-error-500: #ef4444;       /* Primary error */
  --color-error-100: #fee2e2;
  --color-error-50:  #fef2f2;

  /* Info - Blue (uses primary palette) */
  --color-info-700: var(--color-primary-700);
  --color-info-600: var(--color-primary-600);
  --color-info-500: #3b82f6;
  --color-info-200: var(--color-primary-200);
  --color-info-100: var(--color-primary-100);
  --color-info-50:  var(--color-primary-50);

  /* -----------------------------------------------------------------------------
     1.4 Surface Colors
     ----------------------------------------------------------------------------- */
  --color-surface: #ffffff;
  --color-surface-raised: #ffffff;
  --color-surface-overlay: rgba(0, 0, 0, 0.5);
  --color-surface-invert: var(--color-gray-900);

  /* Off-white for alternating sections */
  --color-off-white: #f6f5ec;

  /* -----------------------------------------------------------------------------
     1.5 Legacy Compatibility (map old vars to new)
     ----------------------------------------------------------------------------- */
  --aao-primary: var(--color-primary-700);
  --aao-primary-light: var(--color-primary-600);
  --aao-accent: var(--color-primary-300);
  --aao-off-white: var(--color-off-white);
  --aao-black: var(--color-gray-900);
  --aao-white: #ffffff;
  --aao-gray: var(--color-gray-500);
  --aao-gray-light: var(--color-gray-400);
  --aao-gray-dark: var(--color-gray-700);
  --aao-border: var(--color-border);

  /* -----------------------------------------------------------------------------
     1.6 Gradients
     ----------------------------------------------------------------------------- */
  --gradient-primary: linear-gradient(135deg, var(--color-primary-700) 0%, var(--color-primary-500) 100%);
  --gradient-primary-dark: linear-gradient(135deg, var(--color-primary-800) 0%, var(--color-primary-600) 100%);
  --gradient-success: linear-gradient(135deg, var(--color-success-500) 0%, var(--color-success-600) 100%);
  --gradient-light: linear-gradient(135deg, var(--color-primary-50) 0%, var(--color-primary-100) 100%);
}

/* =============================================================================
   2. TYPOGRAPHY

   Font scale uses a modular scale (1.25 ratio) for harmony.
   Line heights are optimized for readability.
   ============================================================================= */

:root {
  /* -----------------------------------------------------------------------------
     2.1 Font Families
     ----------------------------------------------------------------------------- */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;

  /* -----------------------------------------------------------------------------
     2.2 Font Sizes (modular scale 1.25)
     ----------------------------------------------------------------------------- */
  --text-xs:   0.75rem;    /* 12px */
  --text-sm:   0.875rem;   /* 14px */
  --text-base: 1rem;       /* 16px - base */
  --text-lg:   1.125rem;   /* 18px */
  --text-xl:   1.25rem;    /* 20px */
  --text-2xl:  1.5rem;     /* 24px */
  --text-3xl:  1.875rem;   /* 30px */
  --text-4xl:  2.25rem;    /* 36px */
  --text-5xl:  2.75rem;    /* 44px */

  /* -----------------------------------------------------------------------------
     2.3 Font Weights
     ----------------------------------------------------------------------------- */
  --font-normal:   400;
  --font-medium:   500;
  --font-semibold: 600;
  --font-bold:     700;

  /* -----------------------------------------------------------------------------
     2.4 Line Heights
     ----------------------------------------------------------------------------- */
  --leading-none:   1;
  --leading-tight:  1.25;
  --leading-snug:   1.375;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;
  --leading-loose:  1.8;

  /* -----------------------------------------------------------------------------
     2.5 Letter Spacing
     ----------------------------------------------------------------------------- */
  --tracking-tight:  -0.025em;
  --tracking-normal: 0;
  --tracking-wide:   0.025em;
  --tracking-wider:  0.05em;
  --tracking-widest: 0.1em;
}

/* =============================================================================
   3. SPACING SCALE

   Consistent spacing using an 8px base unit.
   Use these variables for ALL padding, margin, and gap values.
   ============================================================================= */

:root {
  --space-0:   0;
  --space-px:  1px;
  --space-0.5: 0.125rem;   /* 2px */
  --space-1:   0.25rem;    /* 4px */
  --space-1.5: 0.375rem;   /* 6px */
  --space-2:   0.5rem;     /* 8px - base unit */
  --space-2.5: 0.625rem;   /* 10px */
  --space-3:   0.75rem;    /* 12px */
  --space-3.5: 0.875rem;   /* 14px */
  --space-4:   1rem;       /* 16px */
  --space-5:   1.25rem;    /* 20px */
  --space-6:   1.5rem;     /* 24px */
  --space-7:   1.75rem;    /* 28px */
  --space-8:   2rem;       /* 32px */
  --space-9:   2.25rem;    /* 36px */
  --space-10:  2.5rem;     /* 40px */
  --space-12:  3rem;       /* 48px */
  --space-14:  3.5rem;     /* 56px */
  --space-16:  4rem;       /* 64px */
  --space-20:  5rem;       /* 80px */
  --space-24:  6rem;       /* 96px */
}

/* =============================================================================
   4. LAYOUT

   Container widths, breakpoints, and z-index scale.
   ============================================================================= */

:root {
  /* -----------------------------------------------------------------------------
     4.1 Container Widths
     ----------------------------------------------------------------------------- */
  --container-xs:  320px;
  --container-sm:  640px;
  --container-md:  768px;
  --container-lg:  1024px;
  --container-xl:  1200px;
  --container-2xl: 1400px;

  /* Semantic containers */
  --container-prose: 700px;    /* Optimal reading width */
  --container-content: 1100px; /* Main content area */
  --container-wide: 1400px;    /* Wide layouts (admin) */

  /* -----------------------------------------------------------------------------
     4.2 Z-Index Scale
     ----------------------------------------------------------------------------- */
  --z-hide:     -1;
  --z-base:     0;
  --z-raised:   1;
  --z-dropdown: 10;
  --z-sticky:   20;
  --z-fixed:    30;
  --z-overlay:  40;
  --z-modal:    50;
  --z-toast:    60;
  --z-tooltip:  70;
}

/* =============================================================================
   5. BORDERS & RADIUS
   ============================================================================= */

:root {
  /* -----------------------------------------------------------------------------
     5.1 Border Radius
     ----------------------------------------------------------------------------- */
  --radius-none: 0;
  --radius-sm:   4px;
  --radius-md:   6px;
  --radius-lg:   8px;
  --radius-xl:   12px;
  --radius-2xl:  16px;
  --radius-full: 9999px;

  /* -----------------------------------------------------------------------------
     5.2 Border Widths
     ----------------------------------------------------------------------------- */
  --border-0: 0;
  --border-1: 1px;
  --border-2: 2px;
  --border-3: 3px;
  --border-4: 4px;
}

/* =============================================================================
   6. SHADOWS

   Consistent elevation system using layered shadows.
   ============================================================================= */

:root {
  --shadow-xs:  0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-sm:  0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md:  0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.06);
  --shadow-lg:  0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
  --shadow-xl:  0 20px 25px rgba(0, 0, 0, 0.1), 0 10px 10px rgba(0, 0, 0, 0.04);
  --shadow-2xl: 0 25px 50px rgba(0, 0, 0, 0.25);

  /* Colored shadows for brand elements */
  --shadow-primary-sm: 0 1px 3px rgba(26, 54, 180, 0.1);
  --shadow-primary-md: 0 4px 12px rgba(26, 54, 180, 0.15);
  --shadow-primary-lg: 0 10px 20px rgba(26, 54, 180, 0.2);

  /* Inner shadows */
  --shadow-inner: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}

/* =============================================================================
   7. TRANSITIONS

   Standard timing for animations and transitions.
   ============================================================================= */

:root {
  /* Durations */
  --duration-fast:   100ms;
  --duration-normal: 200ms;
  --duration-slow:   300ms;
  --duration-slower: 500ms;

  /* Easing */
  --ease-linear: linear;
  --ease-in:     cubic-bezier(0.4, 0, 1, 1);
  --ease-out:    cubic-bezier(0, 0, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);

  /* Common transitions */
  --transition-colors: color var(--duration-normal) var(--ease-in-out),
                       background-color var(--duration-normal) var(--ease-in-out),
                       border-color var(--duration-normal) var(--ease-in-out);
  --transition-transform: transform var(--duration-normal) var(--ease-out);
  --transition-all: all var(--duration-normal) var(--ease-in-out);
}

/* =============================================================================
   8. COMPONENT TOKENS

   Component-specific design tokens for consistency.
   ============================================================================= */

:root {
  /* -----------------------------------------------------------------------------
     8.1 Buttons
     ----------------------------------------------------------------------------- */
  --btn-padding-x: var(--space-5);
  --btn-padding-y: var(--space-2.5);
  --btn-padding-x-sm: var(--space-3);
  --btn-padding-y-sm: var(--space-2);
  --btn-padding-x-lg: var(--space-8);
  --btn-padding-y-lg: var(--space-4);
  --btn-radius: var(--radius-lg);
  --btn-font-weight: var(--font-semibold);
  --btn-font-size: var(--text-sm);
  --btn-font-size-sm: var(--text-xs);
  --btn-font-size-lg: var(--text-base);

  /* -----------------------------------------------------------------------------
     8.2 Cards
     ----------------------------------------------------------------------------- */
  --card-padding: var(--space-6);
  --card-padding-sm: var(--space-4);
  --card-padding-lg: var(--space-8);
  --card-radius: var(--radius-xl);
  --card-shadow: var(--shadow-sm);
  --card-shadow-hover: var(--shadow-md);
  --card-border: var(--border-1) solid var(--color-border);

  /* -----------------------------------------------------------------------------
     8.3 Form Inputs
     ----------------------------------------------------------------------------- */
  --input-padding-x: var(--space-4);
  --input-padding-y: var(--space-3);
  --input-radius: var(--radius-lg);
  --input-border: var(--border-1) solid var(--color-border);
  --input-border-focus: var(--border-2) solid var(--color-brand);
  --input-font-size: var(--text-sm);

  /* -----------------------------------------------------------------------------
     8.4 Badges
     ----------------------------------------------------------------------------- */
  --badge-padding-x: var(--space-3);
  --badge-padding-y: var(--space-1);
  --badge-radius: var(--radius-full);
  --badge-font-size: var(--text-xs);
  --badge-font-weight: var(--font-semibold);

  /* -----------------------------------------------------------------------------
     8.5 Modals
     ----------------------------------------------------------------------------- */
  --modal-padding: var(--space-8);
  --modal-radius: var(--radius-xl);
  --modal-shadow: var(--shadow-xl);
  --modal-max-width: 600px;
  --modal-backdrop: rgba(0, 0, 0, 0.5);

  /* -----------------------------------------------------------------------------
     8.6 Navigation
     ----------------------------------------------------------------------------- */
  --nav-height: 60px;
  --nav-padding-x: var(--space-5);
}

/* =============================================================================
   9. BASE ELEMENT STYLES

   Global styles applied to HTML elements to ensure consistent defaults.
   These use the design tokens defined above.
   ============================================================================= */

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background-color: var(--color-bg-page);
}

/* =============================================================================
   10. BASE COMPONENT CLASSES

   Reusable component classes that use the design tokens.
   ============================================================================= */

/* -----------------------------------------------------------------------------
   10.1 Buttons
   ----------------------------------------------------------------------------- */
.ds-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--btn-padding-y) var(--btn-padding-x);
  border: none;
  border-radius: var(--btn-radius);
  font-family: var(--font-sans);
  font-size: var(--btn-font-size);
  font-weight: var(--btn-font-weight);
  line-height: var(--leading-tight);
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition-all);
}

.ds-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Primary Button - Solid brand color */
.ds-btn-primary {
  background: var(--color-brand);
  color: white;
}

.ds-btn-primary:hover:not(:disabled) {
  background: var(--color-brand-hover);
  transform: translateY(-1px);
}

/* Secondary Button - Outline style */
.ds-btn-secondary {
  background: transparent;
  color: var(--color-brand);
  border: var(--border-2) solid var(--color-brand);
}

.ds-btn-secondary:hover:not(:disabled) {
  background: var(--color-brand);
  color: white;
}

/* Ghost Button - Minimal, for less emphasis */
.ds-btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
  border: var(--border-1) solid var(--color-border);
}

.ds-btn-ghost:hover:not(:disabled) {
  background: var(--color-bg-subtle);
  border-color: var(--color-border-strong);
}

/* Danger Button */
.ds-btn-danger {
  background: var(--color-error-500);
  color: white;
}

.ds-btn-danger:hover:not(:disabled) {
  background: var(--color-error-600);
}

/* Button Sizes */
.ds-btn-sm {
  padding: var(--btn-padding-y-sm) var(--btn-padding-x-sm);
  font-size: var(--btn-font-size-sm);
}

.ds-btn-lg {
  padding: var(--btn-padding-y-lg) var(--btn-padding-x-lg);
  font-size: var(--btn-font-size-lg);
}

/* Button on dark backgrounds (e.g., hero) */
.ds-btn-on-dark {
  background: white;
  color: var(--color-brand);
}

.ds-btn-on-dark:hover:not(:disabled) {
  background: var(--color-off-white);
  transform: translateY(-1px);
}

.ds-btn-outline-on-dark {
  background: transparent;
  color: white;
  border: var(--border-2) solid rgba(255, 255, 255, 0.5);
}

.ds-btn-outline-on-dark:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  border-color: white;
}

/* -----------------------------------------------------------------------------
   9.2 Cards
   ----------------------------------------------------------------------------- */
.ds-card {
  background: var(--color-bg-card);
  border: var(--card-border);
  border-radius: var(--card-radius);
  padding: var(--card-padding);
  transition: var(--transition-all);
}

.ds-card-interactive {
  cursor: pointer;
}

.ds-card-interactive:hover {
  border-color: var(--color-brand);
  box-shadow: var(--shadow-primary-md);
  transform: translateY(-2px);
}

.ds-card-sm {
  padding: var(--card-padding-sm);
}

.ds-card-lg {
  padding: var(--card-padding-lg);
}

/* Card with shadow (no border) */
.ds-card-elevated {
  border: none;
  box-shadow: var(--card-shadow);
}

.ds-card-elevated:hover {
  box-shadow: var(--card-shadow-hover);
}

/* -----------------------------------------------------------------------------
   9.3 Badges
   ----------------------------------------------------------------------------- */
.ds-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--badge-padding-y) var(--badge-padding-x);
  border-radius: var(--badge-radius);
  font-size: var(--badge-font-size);
  font-weight: var(--badge-font-weight);
  line-height: var(--leading-tight);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

.ds-badge-primary {
  background: var(--color-primary-100);
  color: var(--color-brand);
}

.ds-badge-success {
  background: var(--color-success-100);
  color: var(--color-success-700);
}

.ds-badge-warning {
  background: var(--color-warning-100);
  color: var(--color-warning-700);
}

.ds-badge-error {
  background: var(--color-error-100);
  color: var(--color-error-700);
}

.ds-badge-neutral {
  background: var(--color-gray-100);
  color: var(--color-gray-600);
}

/* Square badges (for status indicators) */
.ds-badge-square {
  border-radius: var(--radius-sm);
}

/* -----------------------------------------------------------------------------
   9.4 Form Inputs
   ----------------------------------------------------------------------------- */
.ds-input {
  width: 100%;
  padding: var(--input-padding-y) var(--input-padding-x);
  border: var(--input-border);
  border-radius: var(--input-radius);
  font-family: var(--font-sans);
  font-size: var(--input-font-size);
  color: var(--color-text);
  background: var(--color-bg-card);
  transition: var(--transition-colors);
}

.ds-input:focus {
  outline: none;
  border: var(--input-border-focus);
  box-shadow: 0 0 0 3px var(--color-primary-100);
}

.ds-input::placeholder {
  color: var(--color-text-muted);
}

.ds-input:disabled {
  background: var(--color-bg-subtle);
  cursor: not-allowed;
}

/* Input with error state */
.ds-input-error {
  border-color: var(--color-error-500);
}

.ds-input-error:focus {
  border-color: var(--color-error-500);
  box-shadow: 0 0 0 3px var(--color-error-100);
}

/* Select inputs */
.ds-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M3 4l3 3 3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  padding-right: var(--space-10);
}

/* -----------------------------------------------------------------------------
   9.5 Status Indicators
   ----------------------------------------------------------------------------- */
.ds-status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
}

.ds-status-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
}

.ds-status-dot-success { background: var(--color-success-500); }
.ds-status-dot-warning { background: var(--color-warning-500); }
.ds-status-dot-error   { background: var(--color-error-500); }
.ds-status-dot-info    { background: var(--color-info-500); }
.ds-status-dot-neutral { background: var(--color-gray-400); }

/* -----------------------------------------------------------------------------
   9.6 Alerts / Info Boxes
   ----------------------------------------------------------------------------- */
.ds-alert {
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  border-left: var(--border-4) solid;
}

.ds-alert-info {
  background: var(--color-info-50);
  border-left-color: var(--color-info-500);
  color: var(--color-info-700);
}

.ds-alert-success {
  background: var(--color-success-50);
  border-left-color: var(--color-success-500);
  color: var(--color-success-700);
}

.ds-alert-warning {
  background: var(--color-warning-50);
  border-left-color: var(--color-warning-500);
  color: var(--color-warning-700);
}

.ds-alert-error {
  background: var(--color-error-50);
  border-left-color: var(--color-error-500);
  color: var(--color-error-700);
}

/* -----------------------------------------------------------------------------
   9.7 Gradients
   ----------------------------------------------------------------------------- */
.ds-gradient-primary {
  background: linear-gradient(135deg, var(--color-primary-700) 0%, var(--color-primary-600) 100%);
}

.ds-gradient-success {
  background: linear-gradient(135deg, var(--color-success-500) 0%, var(--color-success-600) 100%);
}

.ds-gradient-light {
  background: linear-gradient(135deg, var(--color-primary-50) 0%, var(--color-primary-100) 100%);
}

/* -----------------------------------------------------------------------------
   9.8 Text Utilities
   ----------------------------------------------------------------------------- */
.ds-text-primary   { color: var(--color-text); }
.ds-text-secondary { color: var(--color-text-secondary); }
.ds-text-muted     { color: var(--color-text-muted); }
.ds-text-brand     { color: var(--color-brand); }
.ds-text-success   { color: var(--color-success-600); }
.ds-text-warning   { color: var(--color-warning-600); }
.ds-text-error     { color: var(--color-error-600); }

.ds-text-on-dark   { color: white; }
.ds-text-on-dark-secondary { color: rgba(255, 255, 255, 0.8); }

/* -----------------------------------------------------------------------------
   9.9 Link Styles
   ----------------------------------------------------------------------------- */
.ds-link {
  color: var(--color-brand);
  text-decoration: none;
  font-weight: var(--font-medium);
  transition: var(--transition-colors);
}

.ds-link:hover {
  text-decoration: underline;
}

.ds-link-subtle {
  color: var(--color-text-secondary);
}

.ds-link-subtle:hover {
  color: var(--color-brand);
}

/* =============================================================================
   10. LAYOUT UTILITIES
   ============================================================================= */

/* Container classes */
.ds-container {
  width: 100%;
  max-width: var(--container-content);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-5);
  padding-right: var(--space-5);
}

.ds-container-wide {
  max-width: var(--container-wide);
}

.ds-container-prose {
  max-width: var(--container-prose);
}

/* Spacing utilities */
.ds-mt-0  { margin-top: var(--space-0); }
.ds-mt-2  { margin-top: var(--space-2); }
.ds-mt-4  { margin-top: var(--space-4); }
.ds-mt-6  { margin-top: var(--space-6); }
.ds-mt-8  { margin-top: var(--space-8); }
.ds-mt-12 { margin-top: var(--space-12); }

.ds-mb-0  { margin-bottom: var(--space-0); }
.ds-mb-2  { margin-bottom: var(--space-2); }
.ds-mb-4  { margin-bottom: var(--space-4); }
.ds-mb-6  { margin-bottom: var(--space-6); }
.ds-mb-8  { margin-bottom: var(--space-8); }
.ds-mb-12 { margin-bottom: var(--space-12); }

.ds-p-0  { padding: var(--space-0); }
.ds-p-2  { padding: var(--space-2); }
.ds-p-4  { padding: var(--space-4); }
.ds-p-6  { padding: var(--space-6); }
.ds-p-8  { padding: var(--space-8); }

.ds-gap-2 { gap: var(--space-2); }
.ds-gap-4 { gap: var(--space-4); }
.ds-gap-6 { gap: var(--space-6); }
.ds-gap-8 { gap: var(--space-8); }

/* Flex utilities */
.ds-flex { display: flex; }
.ds-flex-col { flex-direction: column; }
.ds-items-center { align-items: center; }
.ds-justify-center { justify-content: center; }
.ds-justify-between { justify-content: space-between; }
.ds-flex-wrap { flex-wrap: wrap; }
.ds-flex-1 { flex: 1; }

/* Grid utilities */
.ds-grid { display: grid; }
.ds-grid-2 { grid-template-columns: repeat(2, 1fr); }
.ds-grid-3 { grid-template-columns: repeat(3, 1fr); }
.ds-grid-4 { grid-template-columns: repeat(4, 1fr); }

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

/* =============================================================================
   11. FOCUS STATES (Accessibility)
   ============================================================================= */

/* Visible focus ring for keyboard navigation */
.ds-btn:focus-visible,
.ds-input:focus-visible,
.ds-card-interactive:focus-visible,
.ds-link:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
}

/* Skip focus styles for mouse users */
.ds-btn:focus:not(:focus-visible),
.ds-input:focus:not(:focus-visible),
.ds-card-interactive:focus:not(:focus-visible) {
  outline: none;
}

/* =============================================================================
   12. PAGE COMPONENTS

   Reusable components for marketing/content pages.
   These provide consistent styling for heroes, sections, footers, etc.
   ============================================================================= */

/* -----------------------------------------------------------------------------
   12.1 Hero Section
   ----------------------------------------------------------------------------- */
.hero {
  background: linear-gradient(135deg, var(--color-brand) 0%, var(--color-primary-500) 100%);
  color: white;
  padding: var(--space-20) var(--space-8) var(--space-16);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image:
    radial-gradient(circle at 20% 80%, rgba(164,194,244,0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(164,194,244,0.15) 0%, transparent 50%),
    radial-gradient(circle at 40% 40%, rgba(255,255,255,0.08) 0%, transparent 30%);
  pointer-events: none;
}

.hero-container {
  max-width: 800px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.hero-logo {
  margin-bottom: var(--space-8);
}

.hero h1 {
  font-size: var(--text-5xl);
  font-weight: var(--font-bold);
  margin-bottom: var(--space-5);
  line-height: var(--leading-tight);
}

.hero-subtitle {
  font-size: var(--text-xl);
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  margin-bottom: var(--space-10);
  line-height: var(--leading-relaxed);
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

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

/* Smaller hero for article/content pages */
.hero--article {
  padding: var(--space-16) var(--space-8) var(--space-12);
}

.hero--article h1 {
  font-size: var(--text-4xl);
}

.hero-breadcrumb {
  font-size: var(--text-sm);
  opacity: 0.8;
  margin-bottom: var(--space-4);
}

.hero-breadcrumb a {
  color: white;
  text-decoration: none;
}

.hero-breadcrumb a:hover {
  text-decoration: underline;
}

/* -----------------------------------------------------------------------------
   12.2 Buttons

   Unified button system for the entire application.

   Usage:
   - .btn = base class (required)
   - .btn-primary = blue background, white text (main CTA)
   - .btn-secondary = gray background, dark text (secondary actions)
   - .btn-danger = red background, white text (destructive actions)
   - .btn-ghost = transparent with border (tertiary actions)
   - .btn-sm = smaller size for tight spaces
   - .btn-lg = larger size for hero CTAs
   - .btn-block = full width

   Context modifiers (for dark backgrounds like hero/CTA):
   - .btn-on-dark = white background (use instead of btn-primary on dark bg)
   - .btn-outline-on-dark = white outline (use instead of btn-secondary on dark bg)
   ----------------------------------------------------------------------------- */

/* Base button - all buttons need this */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
  font-weight: var(--font-medium);
  font-size: var(--text-sm);
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: var(--transition-all);
  white-space: nowrap;
}

/* Primary button - Blue background (main CTAs on light backgrounds) */
.btn-primary,
a.btn-primary,
a.btn-primary:visited {
  background: var(--color-brand);
  color: white;
}

.btn-primary:hover,
a.btn-primary:hover {
  background: var(--color-brand-hover);
  color: white;
}

/* Secondary button - Gray background (secondary actions) */
.btn-secondary {
  background: var(--color-gray-200);
  color: var(--color-text-heading);
}

.btn-secondary:hover {
  background: var(--color-gray-300);
}

/* Danger button - Red background (destructive actions) */
.btn-danger,
a.btn-danger,
a.btn-danger:visited {
  background: var(--color-error-500);
  color: white;
}

.btn-danger:hover,
a.btn-danger:hover {
  background: var(--color-error-600);
  color: white;
}

/* Ghost button - Transparent with border */
.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
  border: var(--border-1) solid var(--color-border);
}

.btn-ghost:hover {
  background: var(--color-bg-subtle);
  border-color: var(--color-border-strong);
}

/* Outline button - Blue outline on light backgrounds */
.btn-outline {
  background: transparent;
  color: var(--color-brand);
  border: var(--border-2) solid var(--color-brand);
}

.btn-outline:hover {
  background: var(--color-brand);
  color: white;
}

/* Success button - Green background */
.btn-success,
a.btn-success,
a.btn-success:visited {
  background: var(--color-success-500);
  color: white;
}

.btn-success:hover,
a.btn-success:hover {
  background: var(--color-success-600);
  color: white;
}

/* -----------------------------------------------------------------------------
   Button Sizes
   ----------------------------------------------------------------------------- */

/* Small - for tight spaces like table rows, cards */
.btn-sm {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
}

/* Large - for hero CTAs */
.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-base);
}

/* Full width */
.btn-block {
  width: 100%;
}

/* -----------------------------------------------------------------------------
   Dark Background Variants (for hero, CTA sections)
   ----------------------------------------------------------------------------- */

/* White button on dark backgrounds */
.btn-on-dark {
  background: white;
  color: var(--color-brand);
}

.btn-on-dark:hover {
  background: var(--color-off-white);
}

/* Outline button on dark backgrounds */
.btn-outline-on-dark {
  background: transparent;
  color: white;
  border: var(--border-2) solid rgba(255, 255, 255, 0.5);
}

.btn-outline-on-dark:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: white;
}

/* -----------------------------------------------------------------------------
   Button States
   ----------------------------------------------------------------------------- */

/* Disabled state */
.btn:disabled,
.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn:disabled:hover,
.btn[disabled]:hover {
  transform: none;
}

/* Focus state for accessibility */
.btn:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
}

/* -----------------------------------------------------------------------------
   12.3 CTA Section
   ----------------------------------------------------------------------------- */
.cta {
  padding: var(--space-20) var(--space-8);
  background: linear-gradient(135deg, var(--color-brand) 0%, var(--color-primary-500) 100%);
  text-align: center;
  color: white;
}

.cta-container {
  max-width: 600px;
  margin: 0 auto;
}

.cta h2 {
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  margin-bottom: var(--space-4);
}

.cta p {
  font-size: var(--text-lg);
  opacity: 0.95;
  margin-bottom: var(--space-8);
}

/* -----------------------------------------------------------------------------
   12.4 Footer
   ----------------------------------------------------------------------------- */
.footer {
  background: var(--color-gray-800);
  color: var(--color-gray-400);
  padding: var(--space-12) var(--space-8);
}

.footer-container {
  max-width: var(--container-content);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-6);
}

.footer-links {
  display: flex;
  gap: var(--space-8);
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--color-gray-300);
  text-decoration: none;
  font-size: var(--text-sm);
  transition: color var(--duration-normal);
}

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

.footer-copyright {
  font-size: var(--text-sm);
}

.footer--centered {
  text-align: center;
}

.footer--centered .footer-links {
  justify-content: center;
  margin-bottom: var(--space-6);
}

/* -----------------------------------------------------------------------------
   12.5 Cards (Page-level)
   ----------------------------------------------------------------------------- */
.card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  transition: var(--transition-all);
}

.card:hover {
  border-color: var(--color-brand);
  box-shadow: var(--shadow-primary-md);
}

.card-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--color-brand) 0%, var(--color-primary-500) 100%);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-5);
  font-size: var(--text-2xl);
}

.card h3 {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  margin-bottom: var(--space-3);
  color: var(--color-text-heading);
}

.card p {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-5);
}

.card a {
  color: var(--color-brand);
  font-weight: var(--font-semibold);
  text-decoration: none;
  font-size: var(--text-sm);
}

.card a:hover {
  text-decoration: underline;
}

/* Override card link styles for button links */
.card a.btn {
  font-weight: var(--font-medium);
  font-size: var(--text-sm);
}

.card a.btn-primary,
.card a.btn-primary:visited,
.card a.btn-primary:hover {
  color: white;
}

.card a.btn-danger,
.card a.btn-danger:visited,
.card a.btn-danger:hover {
  color: white;
}

.card a.btn-success,
.card a.btn-success:visited,
.card a.btn-success:hover {
  color: white;
}

.card a.btn-ghost,
.card a.btn-ghost:visited {
  color: var(--color-text-secondary);
}

.card a.btn:hover {
  text-decoration: none;
}

/* -----------------------------------------------------------------------------
   12.6 Article Cards
   ----------------------------------------------------------------------------- */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-8);
}

.article-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: var(--transition-all);
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
}

.article-card:hover {
  border-color: var(--color-brand);
  box-shadow: var(--shadow-primary-md);
  transform: translateY(-2px);
}

.article-card-content {
  padding: var(--space-6);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.article-category {
  display: inline-block;
  background: var(--color-primary-100);
  color: var(--color-brand);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  margin-bottom: var(--space-4);
  width: fit-content;
}

.article-badge-new {
  display: inline-block;
  background: var(--color-success-500);
  color: white;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: var(--font-bold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  margin-left: var(--space-2);
}

.article-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.article-date {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.article-card h2 {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  color: var(--color-text-heading);
  margin-bottom: var(--space-3);
  line-height: var(--leading-snug);
}

.article-card p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: var(--leading-relaxed);
  flex: 1;
}

.article-card-footer {
  padding: var(--space-4) var(--space-6);
  background: var(--color-bg-subtle);
  border-top: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.read-more {
  color: var(--color-brand);
  font-weight: var(--font-semibold);
  font-size: var(--text-sm);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.read-more svg {
  transition: transform var(--duration-normal);
}

.article-card:hover .read-more svg {
  transform: translateX(4px);
}

/* -----------------------------------------------------------------------------
   12.7 Filter Bar
   ----------------------------------------------------------------------------- */
.filter-bar {
  display: flex;
  gap: var(--space-4);
  margin-bottom: var(--space-8);
  flex-wrap: wrap;
  align-items: center;
}

.filter-bar select {
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  background: var(--color-bg-card);
  color: var(--color-text-heading);
  cursor: pointer;
}

.filter-bar select:focus {
  outline: none;
  border-color: var(--color-brand);
}

/* -----------------------------------------------------------------------------
   12.8 Container
   ----------------------------------------------------------------------------- */
.container {
  max-width: var(--container-content);
  margin: 0 auto;
  padding: 0 var(--space-5);
}

/* -----------------------------------------------------------------------------
   12.9 Responsive Adjustments
   ----------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .hero {
    padding: var(--space-12) var(--space-6) var(--space-10);
  }

  .hero--article {
    padding: var(--space-12) var(--space-6) var(--space-8);
  }

  .hero--article h1 {
    font-size: var(--text-2xl);
  }

  .hero h1 {
    font-size: var(--text-2xl);
  }

  .hero-subtitle {
    font-size: var(--text-base);
  }

  .cta {
    padding: var(--space-12) var(--space-6);
  }

  .footer-container {
    flex-direction: column;
    text-align: center;
  }

  .articles-grid {
    grid-template-columns: 1fr;
  }

  .container {
    padding: var(--space-8) var(--space-6);
  }
}
