/**
 * CARTELL Design Tokens & Base Styles
 * Derived from DESIGN.md and design-reference.png
 */

:root {
  /* Brand Accent Colors */
  --color-primary: #e91e63;
  --color-primary-dark: #c2185b;
  --color-primary-hover: #d81557;
  --color-primary-soft: #fff0f5;
  --color-primary-border: #f8bbd0;

  /* Secondary & Pastel Accents */
  --color-accent-purple: #7c4dff;
  --color-accent-purple-soft: #f3e5f5;
  --color-accent-blue: #2196f3;
  --color-accent-blue-soft: #e3f2fd;
  --color-accent-green: #20a464;
  --color-accent-green-soft: #e8f5e9;
  --color-accent-orange: #ff9800;
  --color-accent-orange-soft: #fff3e0;

  /* Category Specific Backgrounds */
  --color-cat-art: #fce4ec;
  --color-cat-tailoring: #e3f2fd;
  --color-cat-embroidery: #e8f5e9;
  --color-cat-tools: #f3e5f5;

  /* Neutral Palette */
  --color-text: #171717;
  --color-text-secondary: #4a4a4a;
  --color-text-muted: #6b6b6b;
  --color-text-light: #707070; /* WCAG 2.2 AA: 5.0:1 contrast on white */

  --color-background: #ffffff;
  --color-surface: #ffffff;
  --color-surface-soft: #fafafa;
  --color-surface-hover: #f5f5f5;

  --color-border: #eeeeee;
  --color-border-light: #f5f5f5;
  --color-border-hover: #e0e0e0;

  /* Feedback Colors */
  --color-success: #20a464;
  --color-warning: #f59e0b;
  --color-error: #e53935;
  --color-badge-red: #e91e63;

  /* Radii */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-pill: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.06);
  --shadow-card-hover: 0 6px 20px rgba(0, 0, 0, 0.09);
  --shadow-header: 0 2px 10px rgba(0, 0, 0, 0.04);
  --shadow-bottom-nav: 0 -2px 12px rgba(0, 0, 0, 0.06);
  --shadow-drawer: -4px 0 24px rgba(0, 0, 0, 0.15);

  /* Spacing Scale (8pt rhythm with 4pt half-steps) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* Layout Containers */
  --container-max: 1280px;
  --container-padding: 16px;
  --header-height-mobile: 60px;
  --bottom-nav-height: 64px;

  /* Dark Theme / Footer Tokens (DASHBOARD THEAM.png) */
  --color-footer-bg: #1a202c;
  --color-footer-text: #94a3b8;
  --color-footer-heading: #ffffff;
  --color-footer-border: #2d3748;
  --color-footer-link-hover: #e91e63;

  /* Promotional Card Tokens */
  --color-promo-code-bg: #fff0f5;
  --color-promo-code-border: #f48fb1;
  --color-promo-code-text: #e91e63;

  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --font-script: 'Brush Script MT', 'Dancing Script', cursive;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-smooth: 350ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* Modern CSS Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background-color: var(--color-background);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  width: 100%;
  /* Safe padding on mobile so fixed bottom navigation does not cover content */
  padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 769px) {
  body {
    padding-bottom: 0;
  }
}

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

input, button, textarea, select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
}

a {
  color: inherit;
  text-decoration: none;
}

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

/* Screen Reader Only Utility */
.screen-reader-text,
.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;
}

/* Skip to Content for Keyboard Users */
.skip-link {
  position: absolute;
  top: -999px;
  left: 16px;
  background: var(--color-primary);
  color: #ffffff;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  z-index: 9999;
  font-weight: 600;
  text-decoration: none;
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: 16px;
}

/* Layout Utilities */
.site-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
}

.main-content {
  flex: 1 0 auto;
  width: 100%;
}

.cartell-container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--container-padding);
  padding-right: var(--container-padding);
}

/* Reduced Motion Support */
@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;
  }
}
