@layer reset, tokens, base, primitives, components, layouts, utilities;

@layer tokens {
  :root {
    color-scheme: light;

    --ds-brand-50: #f2f6f5;
    --ds-brand-100: #e6efee;
    --ds-brand-200: #cddfde;
    --ds-brand-300: #afc9c7;
    --ds-brand-400: #7f9fa3;
    --ds-brand-500: #668a8e;
    --ds-brand-600: #4f777a;
    --ds-brand-700: #315d60;
    --ds-brand-800: #24494b;
    --ds-brand-900: #183638;

    --ds-action-50: #fff1f2;
    --ds-action-100: #ffe1e3;
    --ds-action-400: #d95661;
    --ds-action-500: #c9363e;
    --ds-action-600: #ad2832;
    --ds-action-700: #8f1f29;

    --ds-price-50: #fff8e8;
    --ds-price-100: #fdecc4;
    --ds-price-300: #e8bb55;
    --ds-price-500: #996000;
    --ds-price-600: #865400;

    --ds-success-50: #edf8f3;
    --ds-success-600: #287a56;
    --ds-warning-50: #fff8e8;
    --ds-warning-700: #805100;
    --ds-danger-50: #fff1f2;
    --ds-danger-700: #8f1f29;
    --ds-info-50: #eef6fb;
    --ds-info-700: #285a70;

    --ds-canvas: #faf9f6;
    --ds-surface: #ffffff;
    --ds-surface-subtle: #f5f6f3;
    --ds-ink: #202525;
    --ds-muted: #505b5b;
    --ds-placeholder: #65706e;
    --ds-border: #ccd2d0;
    --ds-border-soft: #e5e9e7;
    --ds-focus: #315d60;

    --ds-font: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --ds-weight-regular: 400;
    --ds-weight-medium: 500;
    --ds-weight-semibold: 600;
    --ds-weight-bold: 700;

    --ds-text-xs: 0.75rem;
    --ds-text-sm: 0.875rem;
    --ds-text-md: 1rem;
    --ds-text-product: 1.0625rem;
    --ds-text-price: 1.25rem;
    --ds-text-section: clamp(1.375rem, 1.2rem + 0.35vw, 1.625rem);
    --ds-text-title: clamp(1.75rem, 1.55rem + 0.55vw, 2rem);

    --ds-leading-tight: 1.25;
    --ds-leading-body: 1.5;
    --ds-leading-relaxed: 1.6;

    --ds-space-1: 0.25rem;
    --ds-space-2: 0.5rem;
    --ds-space-3: 0.75rem;
    --ds-space-4: 1rem;
    --ds-space-5: 1.25rem;
    --ds-space-6: 1.5rem;
    --ds-space-8: 2rem;
    --ds-space-10: 2.5rem;
    --ds-space-12: 3rem;
    --ds-space-16: 4rem;
    --ds-space-20: 5rem;

    --ds-radius-sm: 0.5rem;
    --ds-radius-md: 0.75rem;
    --ds-radius-lg: 1rem;
    --ds-radius-xl: 1.25rem;
    --ds-radius-2xl: 1.5rem;
    --ds-radius-round: 999px;

    --ds-shadow-sm: 0 2px 8px rgb(20 30 29 / 0.06);
    --ds-shadow-md: 0 8px 24px rgb(20 30 29 / 0.10);
    --ds-shadow-lg: 0 18px 48px rgb(20 30 29 / 0.16);
    --ds-shadow-overlay: 0 28px 80px rgb(20 30 29 / 0.24);

    --ds-gutter: 1rem;
    --ds-content: 100rem;
    --ds-control: 3rem;
    --ds-field: 3.25rem;
    --ds-cta: 3.5rem;
    --ds-icon-sm: 1rem;
    --ds-icon-md: 1.25rem;
    --ds-icon-lg: 1.5rem;
    --ds-icon-xl: 1.75rem;

    --ds-motion-fast: 140ms;
    --ds-motion-normal: 220ms;
    --ds-ease: cubic-bezier(0.2, 0.75, 0.25, 1);
  }

  @media (min-width: 37.5rem) {
    :root { --ds-gutter: 1.5rem; }
  }

  @media (min-width: 52.5rem) {
    :root { --ds-gutter: 2rem; }
  }

  @media (min-width: 75rem) {
    :root { --ds-gutter: 2.5rem; }
  }

  @media (min-width: 100rem) {
    :root { --ds-gutter: 3rem; }
  }
}

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  html { min-width: 20rem; scroll-behavior: smooth; text-size-adjust: 100%; }
  body { min-height: 100vh; margin: 0; }
  h1, h2, h3, h4, p, figure, blockquote, dl, dd { margin: 0; }
  ul, ol { margin: 0; padding: 0; }
  img, picture, svg, video { display: block; max-width: 100%; }
  img { height: auto; }
  button, input, select, textarea { margin: 0; font: inherit; }
  button, [role="button"] { touch-action: manipulation; }
  button, a { -webkit-tap-highlight-color: transparent; }
  fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
  legend { padding: 0; }
  table { border-collapse: collapse; border-spacing: 0; }
  [hidden] { display: none !important; }
}

@layer base {
  body {
    background: var(--ds-canvas);
    color: var(--ds-ink);
    font-family: var(--ds-font);
    font-size: var(--ds-text-md);
    font-weight: var(--ds-weight-regular);
    line-height: var(--ds-leading-body);
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
  }

  a { color: inherit; text-decoration: none; }
  button { color: inherit; }
  input, select, textarea { color: var(--ds-ink); }
  input::placeholder, textarea::placeholder { color: var(--ds-placeholder); opacity: 1; }

  :where(a, button, input, select, textarea, [tabindex]):focus-visible {
    outline: 3px solid var(--ds-focus);
    outline-offset: 3px;
  }

  ::selection { background: var(--ds-brand-200); color: var(--ds-brand-900); }
}

@layer primitives {
  .icon {
    width: var(--ds-icon-md);
    height: var(--ds-icon-md);
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
  }

  .ds-container {
    width: min(100%, var(--ds-content));
    margin-inline: auto;
    padding-inline: var(--ds-gutter);
  }

  .ds-surface {
    border: 1px solid var(--ds-border-soft);
    border-radius: var(--ds-radius-lg);
    background: var(--ds-surface);
    box-shadow: var(--ds-shadow-sm);
  }

  .ds-control {
    min-width: var(--ds-control);
    min-height: var(--ds-control);
  }
}

@layer utilities {
  .visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
  }

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