/* ============================================
   ORDERSAFE LANDING PAGE - DESIGN SYSTEM
   Shopify Polaris-inspired, Mobile-first
   ============================================ */

/* ============================================
   1. CSS VARIABLES (DESIGN TOKENS)
   ============================================ */
:root {
  /* Colors - Shopify Polaris Palette */
  --primary: #008060;
  --primary-hover: #006e52;
  --primary-light: #e6f2ef;

  /* Neutrals */
  --bg-page: #f6f6f7;
  --bg-surface: #ffffff;
  --bg-surface-hovered: #f9fafb;

  --text-primary: #202223;
  --text-secondary: #6d7175;
  --text-disabled: #b5b5bd;
  --text-on-primary: #ffffff;

  --border: #d1d5db;
  --border-hovered: #a8abb2;

  /* Semantic Colors */
  --success: #008060;
  --warning: #ffc453;
  --critical: #d82c0d;
  --info: #0074d9;

  /* Shadows (Polaris-style) */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-float: 0 4px 8px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.15);

  /* Spacing (8px grid) */
  --space-xs: 0.5rem;   /* 8px */
  --space-sm: 1rem;     /* 16px */
  --space-md: 1.5rem;   /* 24px */
  --space-lg: 2rem;     /* 32px */
  --space-xl: 3rem;     /* 48px */
  --space-2xl: 4rem;    /* 64px */
  --space-3xl: 6rem;    /* 96px */

  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --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 */

  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  --line-height-tight: 1.25;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.75;

  /* Layout */
  --container-max-width: 1200px;
  --section-padding: var(--space-2xl);
  --mobile-padding: var(--space-lg);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 350ms ease;

  /* Z-index layers */
  --z-base: 0;
  --z-elevated: 10;
  --z-sticky: 100;
  --z-modal: 1000;
}

/* ============================================
   2. CSS RESET & NORMALIZE
   ============================================ */
*, *::before, *::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

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

/* ============================================
   3. BASE STYLES (TYPOGRAPHY)
   ============================================ */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  margin-bottom: var(--space-sm);
}

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(--space-md);
}

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

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

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

ul, ol {
  list-style: none;
}

/* ============================================
   4. LAYOUT SYSTEM
   ============================================ */
.container {
  width: 100%;
  max-width: var(--container-max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--mobile-padding);
  padding-right: var(--mobile-padding);
}

section {
  padding-top: var(--section-padding);
  padding-bottom: var(--section-padding);
}

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

.grid-2 { grid-template-columns: 1fr; }
.grid-3 { grid-template-columns: 1fr; }

/* Flex Utilities */
.flex {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

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

.flex-center {
  justify-content: center;
  align-items: center;
}

.flex-between {
  justify-content: space-between;
}

/* ============================================
   5. COMPONENTS
   ============================================ */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-lg);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  line-height: 1;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--primary);
  color: var(--text-on-primary);
  border-color: var(--primary);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  border-color: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-float);
  text-decoration: none;
}

.btn-secondary {
  background-color: transparent;
  color: var(--primary);
  border-color: var(--primary);
}

.btn-secondary:hover {
  background-color: var(--primary-light);
  text-decoration: none;
}

.btn-lg {
  padding: var(--space-md) var(--space-xl);
  font-size: var(--font-size-lg);
}

/* Cards */
.card {
  background-color: var(--bg-surface);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--transition-base);
}

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

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  border-radius: var(--radius-full);
  background-color: var(--primary-light);
  color: var(--primary-hover);  /* WCAG AA compliant: 5.2:1 contrast */
}

.badge-success {
  background-color: #e6f2ef;
  color: var(--success);
}

.badge-warning {
  background-color: #fff8e1;
  color: #f57c00;
}

/* ============================================
   6. UTILITIES
   ============================================ */

/* Text Utilities */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-secondary); }

.font-bold { font-weight: var(--font-weight-bold); }
.font-semibold { font-weight: var(--font-weight-semibold); }
.font-medium { font-weight: var(--font-weight-medium); }

/* Spacing Utilities */
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }

.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

/* Visibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

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

/* ============================================
   7. RESPONSIVE BREAKPOINTS
   ============================================ */

/* Mobile First - Base styles above for 0-768px */

/* Tablet (769px - 1024px) */
@media (min-width: 769px) {
  :root {
    --section-padding: var(--space-3xl);
    --mobile-padding: var(--space-2xl);
  }

  h1 { font-size: var(--font-size-5xl); }
  h2 { font-size: var(--font-size-4xl); }

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

/* Desktop (1025px+) */
@media (min-width: 1025px) {
  :root {
    --section-padding: 5rem;
  }

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

/* Large Desktop (1440px+) */
@media (min-width: 1440px) {
  :root {
    --section-padding: 6rem;
  }
}

/* ============================================
   8. SECTION-SPECIFIC STYLES (PHASE 3)
   ============================================ */

/* Hero Section */
#hero {
  position: relative;
  overflow: hidden;
}

@media (min-width: 769px) {
  #hero .grid-2 {
    grid-template-columns: 1.2fr 1fr;
  }
}

/* Pricing Section - Responsive Grid */
@media (min-width: 769px) {
  #pricing .card:first-child {
    grid-column: 1;
  }

  #pricing .card:last-child {
    grid-column: 2;
  }

  #pricing > .container > div:first-of-type {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Back to Top Button (Phase 4) */
.back-to-top {
  position: fixed;
  bottom: var(--space-lg);
  right: var(--space-lg);
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background-color: var(--primary);
  color: var(--text-on-primary);
  border: none;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-xl);
  box-shadow: var(--shadow-float);
  z-index: var(--z-sticky);
  transition: all var(--transition-fast);
}

.back-to-top:hover {
  background-color: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* Animations */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.8;
  }
}

.btn-primary:hover {
  animation: pulse 2s ease-in-out infinite;
}

/* Smooth transitions for all interactive elements */
button, a, .card {
  transition: all var(--transition-base);
}

.card:hover {
  transform: translateY(-4px);
}

/* Mobile optimizations */
@media (max-width: 768px) {
  h1 {
    font-size: var(--font-size-3xl);
  }

  h2 {
    font-size: var(--font-size-2xl);
  }

  section {
    padding-top: var(--space-xl);
    padding-bottom: var(--space-xl);
  }

  /* Stack pricing cards on mobile */
  #pricing .card {
    margin-bottom: var(--space-md);
  }

  /* Adjust footer for mobile */
  footer .container > div {
    flex-direction: column;
    text-align: center;
  }
}
