:root {
  --global-max-width: min(1100px, 95vw);
  --global-card-radius: clamp(16px, 3vw, 28px);
  --global-gap: clamp(1rem, 2.5vw, 2.75rem);
  --global-soft-shadow: 0 24px 80px rgba(6, 46, 82, 0.12);
  
  /* Enhanced mobile variables */
  --mobile-padding: clamp(12px, 4vw, 24px);
  --mobile-gap: clamp(12px, 3vw, 20px);
  --mobile-text-scale: clamp(0.9, 2vw, 1);
}

body {
  width: 100%;
  min-height: 100vh;
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: #f8fafc;
  color: #0f172a;
  overflow-x: hidden;
  font-size: calc(1rem * var(--mobile-text-scale));
  line-height: 1.6;
}

main,
.section-shell,
[data-global-container="true"] {
  width: var(--global-max-width);
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 4rem) var(--mobile-padding);
}

section {
  border-radius: var(--global-card-radius);
}

img,
video,
iframe {
  max-width: 100%;
  height: auto;
  border-radius: inherit;
}

figure {
  margin: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  /* Better mobile touch targets */
  min-height: 44px;
  min-width: 44px;
}

.table-scroll {
  overflow-x: auto;
}

.table-scroll table {
  min-width: 600px;
}

.flex,
.row,
.columns,
.stack,
.grid,
[class*="grid"],
[class*="Grid"],
[class*="columns"],
[class*="Columns"] {
  gap: var(--mobile-gap);
}

/* Enhanced responsive breakpoints */
@media (max-width: 1024px) {
  header nav,
  header .nav-wrapper,
  header .nav-links {
    width: 100%;
  }
  
  .container {
    padding-left: var(--mobile-padding);
    padding-right: var(--mobile-padding);
  }
}

@media (max-width: 900px) {
  main,
  .section-shell,
  [data-global-container="true"] {
    padding-left: var(--mobile-padding);
    padding-right: var(--mobile-padding);
  }
  
  /* Better navigation stacking */
  .nav-inner {
    flex-wrap: wrap;
    justify-content: space-between;
  }
  
  .nav-links {
    order: 3;
    width: 100%;
    margin-top: 12px;
  }
}

@media (max-width: 768px) {
  /* Enhanced mobile navigation */
  header nav,
  header .nav-wrapper {
    flex-direction: column;
    align-items: stretch !important;
    gap: var(--mobile-gap);
  }

  header nav ul,
  header .nav-links,
  nav ul.nav-links,
  nav ul {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  header nav a,
  header .nav-links a,
  nav ul a {
    display: block;
    width: 100%;
    padding: 12px 16px;
    text-align: center;
    border-radius: 8px;
  }

  /* Better grid behavior */
  .flex,
  .row,
  .columns,
  .stack,
  [class*="Row"],
  [class*="Flex"],
  [class*="Stack"],
  [class*="column"],
  [class*="Column"] {
    display: flex;
    flex-direction: column !important;
    gap: var(--mobile-gap);
  }

  .grid,
  [class*="grid"],
  [data-columns],
  [data-grid],
  [class*="Grid"] {
    display: grid;
    grid-template-columns: 1fr !important;
    gap: var(--mobile-gap);
  }

  /* Special grid exceptions for better mobile layout */
  .value-props {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Enhanced table behavior */
  .table-scroll table,
  table {
    display: block;
    width: 100%;
    overflow-x: auto;
    border-radius: 8px;
  }

  /* Better section padding */
  .hero,
  section,
  .card,
  .panel,
  .surface,
  .feature {
    padding: clamp(16px, 4vw, 24px) !important;
    border-radius: clamp(8px, 2vw, 16px);
  }

  /* Improved typography scaling */
  h1 {
    font-size: clamp(24px, 7vw, 36px) !important;
    line-height: 1.2 !important;
    margin-bottom: clamp(16px, 4vw, 24px) !important;
    text-align: center;
  }

  h2 {
    font-size: clamp(20px, 6vw, 28px) !important;
    line-height: 1.25 !important;
    margin-bottom: clamp(12px, 3vw, 20px) !important;
    text-align: center;
  }

  h3,
  h4 {
    font-size: clamp(18px, 5vw, 22px) !important;
    line-height: 1.3 !important;
    margin-bottom: clamp(8px, 2vw, 16px) !important;
  }

  p,
  li {
    font-size: clamp(14px, 4vw, 16px);
    line-height: 1.5;
    margin-bottom: clamp(8px, 2vw, 12px);
  }

  /* Better button styling */
  button,
  .button,
  .btn,
  .cta,
  .secondary,
  .ghost {
    padding: 12px 20px;
    font-size: 16px;
    border-radius: 10px;
    font-weight: 700;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
  }

  /* Enhanced form elements */
  input,
  textarea,
  select {
    padding: 12px 16px;
    font-size: 16px;
    border-radius: 10px;
    border: 2px solid rgba(15, 23, 42, 0.2);
    min-height: 48px;
    width: 100%;
  }

  textarea {
    min-height: 120px;
    resize: vertical;
  }

  /* Better spacing */
  .full-bleed,
  .edge-to-edge {
    margin-left: calc(-1 * var(--mobile-padding));
    margin-right: calc(-1 * var(--mobile-padding));
    border-radius: 0;
  }
  
  /* Improved mobile menu */
  .mobile-menu {
    border-radius: 12px;
    margin-top: 8px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(8px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  }
  
  .mobile-menu a,
  .mobile-menu button {
    margin: 0 8px;
    border-radius: 8px;
  }
}

/* Enhanced small screen optimizations */
@media (max-width: 480px) {
  body {
    font-size: 15px;
  }

  header {
    padding: 8px 0;
  }

  main,
  .section-shell,
  [data-global-container="true"] {
    padding: clamp(16px, 4vw, 24px);
  }
  
  .container {
    padding-left: 16px;
    padding-right: 16px;
  }
  
  /* Stack value props on very small screens */
  .value-props {
    grid-template-columns: 1fr !important;
    gap: 16px;
  }
  
  /* Smaller cards and panels */
  .card,
  .panel {
    padding: 16px !important;
    border-radius: 12px;
  }
  
  /* Better hero layout */
  .hero {
    padding: 24px 16px !important;
    text-align: center;
  }
  
  .hero-grid {
    grid-template-columns: 1fr !important;
    gap: 20px;
  }
}

/* Ultra-small screens */
@media (max-width: 375px) {
  :root {
    --mobile-padding: 12px;
    --mobile-gap: 12px;
  }
  
  h1 {
    font-size: clamp(20px, 8vw, 28px) !important;
  }
  
  h2 {
    font-size: clamp(18px, 7vw, 24px) !important;
  }
  
  .hero,
  .section {
    padding: 20px 12px !important;
  }
  
  button,
  .cta,
  .secondary {
    padding: 10px 16px;
    font-size: 15px;
    min-height: 44px;
  }
}

/* Tablet-specific improvements */
@media (min-width: 481px) and (max-width: 768px) {
  .hero-grid,
  .contact-grid,
  .grid {
    grid-template-columns: 1fr !important;
    gap: 24px;
  }
  
  .features,
  .plans,
  .cards {
    grid-template-columns: 1fr !important;
    gap: 20px;
  }
  
  .value-props {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Enhanced accessibility */
@media (max-width: 768px) {
  /* Better focus indicators */
  :focus-visible {
    outline: 3px solid #3b82f6;
    outline-offset: 2px;
    border-radius: 6px;
  }
  
  /* Improved touch targets */
  a, button {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  
  /* Better contrast for small screens */
  .nav-links a {
    background: rgba(15, 23, 42, 0.05);
    margin-bottom: 4px;
  }
  
  .nav-links a:hover,
  .nav-links a:focus {
    background: rgba(15, 23, 42, 0.1);
  }
}

/* Dark mode enhancements for mobile */
@media (prefers-color-scheme: dark) and (max-width: 768px) {
  body {
    background-color: #0f172a;
    color: #f8fafc;
  }
  
  .mobile-menu {
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(248, 250, 252, 0.1);
  }
  
  .card,
  .panel {
    background: rgba(30, 41, 59, 0.5);
    border-color: rgba(248, 250, 252, 0.1);
  }
}

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