/* =========================================================
   Variables
   ========================================================= */
:root {
  /* Color Palette - Automotive / Premium */
  --color-background: #050507; /* near-black graphite */
  --color-surface: #101217;
  --color-surface-alt: #181b21;
  --color-text: #f5f5f7;
  --color-text-muted: #a0a3aa;
  --color-border-subtle: #272b33;
  --color-border-strong: #3b414d;

  --color-primary: #e5091a; /* racing red */
  --color-primary-soft: rgba(229, 9, 26, 0.12);
  --color-primary-strong: #ff2534;

  --color-success: #18a76f;
  --color-success-soft: rgba(24, 167, 111, 0.12);

  --color-warning: #ffaa2b;
  --color-warning-soft: rgba(255, 170, 43, 0.12);

  --color-danger: #ff3b4f;
  --color-danger-soft: rgba(255, 59, 79, 0.12);

  --color-info: #1673ff; /* deep performance blue */
  --color-info-soft: rgba(22, 115, 255, 0.12);

  /* Neutral Grays (metallic / tech) */
  --gray-50: #f8fafc;
  --gray-100: #edf2f7;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #020617;

  /* Typography */
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  --font-size-xs: 0.75rem;   /* 12px */
  --font-size-sm: 0.875rem;  /* 14px */
  --font-size-base: 1rem;    /* 16px */
  --font-size-md: 1.0625rem; /* 17px */
  --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 */

  --line-height-tight: 1.15;
  --line-height-snug: 1.3;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.7;

  /* Spacing Scale (0–96px) */
  --space-0: 0;
  --space-1: 0.25rem;  /* 4px */
  --space-2: 0.5rem;   /* 8px */
  --space-3: 0.75rem;  /* 12px */
  --space-4: 1rem;     /* 16px */
  --space-5: 1.25rem;  /* 20px */
  --space-6: 1.5rem;   /* 24px */
  --space-7: 1.75rem;  /* 28px */
  --space-8: 2rem;     /* 32px */
  --space-10: 2.5rem;  /* 40px */
  --space-12: 3rem;    /* 48px */
  --space-16: 4rem;    /* 64px */
  --space-20: 5rem;    /* 80px */
  --space-24: 6rem;    /* 96px */

  /* Radius (slightly angular, automotive) */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 18px;
  --radius-pill: 999px;

  /* Shadows (subtle, directional, modern) */
  --shadow-soft: 0 8px 20px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 14px 40px rgba(0, 0, 0, 0.55);
  --shadow-hard: 0 0 0 1px rgba(255, 255, 255, 0.02), 0 24px 60px rgba(0, 0, 0, 0.75);

  /* Transitions */
  --transition-fast: 120ms ease-out;
  --transition-base: 180ms ease-out;
  --transition-slow: 260ms ease;
}

/* =========================================================
   Reset / Normalize
   ========================================================= */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
}

h1,
h2,
h3,
h4,
h5,
h6,
p,
figure,
blockquote,
dl,
dd {
  margin: 0;
}

ul[role="list"],
ol[role="list"] {
  list-style: none;
  margin: 0;
  padding: 0;
}

img,
svg,
video,
canvas,
audio,
iframe,
embed,
object {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

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

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

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

table {
  border-collapse: collapse;
  border-spacing: 0;
}

:where([hidden]) {
  display: none !important;
}

/* =========================================================
   Base Styles
   ========================================================= */
body {
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  background-color: var(--color-background);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

main {
  min-height: 100vh;
}

p {
  margin-top: 0;
  margin-bottom: var(--space-4);
  color: var(--color-text-muted);
}

strong,
b {
  font-weight: 600;
}

small {
  font-size: var(--font-size-xs);
}

/* Headings - structured, bold, scalable */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 650;
  line-height: var(--line-height-tight);
  letter-spacing: 0.02em;
  color: var(--color-text);
}

h1 {
  font-size: clamp(2.25rem, 2.1vw + 1.8rem, 3rem);
  margin-bottom: var(--space-4);
}

h2 {
  font-size: clamp(1.875rem, 1.6vw + 1.4rem, 2.25rem);
  margin-top: var(--space-6);
  margin-bottom: var(--space-3);
}

h3 {
  font-size: clamp(1.5rem, 1vw + 1.2rem, 1.875rem);
  margin-top: var(--space-5);
  margin-bottom: var(--space-3);
}

h4 {
  font-size: var(--font-size-xl);
  margin-top: var(--space-4);
  margin-bottom: var(--space-2);
}

h5 {
  font-size: var(--font-size-lg);
  margin-top: var(--space-3);
  margin-bottom: var(--space-2);
}

h6 {
  font-size: var(--font-size-sm);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-text-muted);
  margin-top: var(--space-3);
  margin-bottom: var(--space-2);
}

/* Links */
a {
  position: relative;
  transition: color var(--transition-base);
}

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

a:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
}

/* =========================================================
   Utilities
   ========================================================= */

/* Layout */
.container {
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-4);
  padding-right: var(--space-4);
  max-width: 1200px;
}

@media (min-width: 1440px) {
  .container {
    max-width: 1320px;
  }
}

/* Flex helpers */
.flex {
  display: flex;
}

.inline-flex {
  display: inline-flex;
}

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

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

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

.flex-wrap {
  flex-wrap: wrap;
}

.items-center {
  align-items: center;
}

.items-start {
  align-items: flex-start;
}

.items-end {
  align-items: flex-end;
}

.justify-center {
  justify-content: center;
}

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

.gap-2 {
  gap: var(--space-2);
}

.gap-4 {
  gap: var(--space-4);
}

.gap-6 {
  gap: var(--space-6);
}

/* Grid helpers */
.grid {
  display: grid;
}

.grid-auto-fit {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-4);
}

/* Spacing utilities (core subset) */
.mt-0 { margin-top: 0; }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.pt-4 { padding-top: var(--space-4); }
.pb-4 { padding-bottom: var(--space-4); }
.px-4 {
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}

/* Screen reader only */
.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;
}

/* Aspect ratios for imagery */
.aspect-video {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
}

.aspect-video > * {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* =========================================================
   Components
   ========================================================= */

/* Buttons - primary CTAs for e-commerce / filters */
.button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.7rem 1.4rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: var(--font-size-sm);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-strong));
  color: #ffffff!important;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.02), 0 14px 35px rgba(0, 0, 0, 0.7);
  transition:
    background-color var(--transition-base),
    box-shadow var(--transition-base),
    transform var(--transition-fast),
    border-color var(--transition-base),
    color var(--transition-base);
}

.button:hover,
.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.85);
}

.button:active,
.btn:active {
  transform: translateY(0);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7);
}

.button--secondary,
.btn--secondary {
  background: linear-gradient(135deg, #1d2027, #252a34);
  border-color: var(--color-border-strong);
  color: var(--color-text)!important;
  box-shadow: var(--shadow-soft);
}

.button--ghost,
.btn--ghost {
  background: transparent;
  border-color: var(--color-border-subtle);
  color: var(--color-text)!important;
  box-shadow: none;
}

.button--danger,
.btn--danger {
  background: linear-gradient(135deg, var(--color-danger), #ff6576);
}

.button[disabled],
.btn[disabled],
.button.is-disabled,
.btn.is-disabled {
  cursor: not-allowed;
  opacity: 0.5;
  box-shadow: none;
}

.button:focus-visible,
.btn:focus-visible {
  outline: 2px solid var(--color-info);
  outline-offset: 3px;
}

/* Form Inputs - filters, search, checkout */
.input,
select,
textarea,
input[type="text"],
input[type="email"],
input[type="search"],
input[type="password"],
input[type="tel"],
input[type="number"],
input[type="url"] {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-subtle);
  background-color: #06070a;
  color: var(--color-text);
  font-size: var(--font-size-sm);
  line-height: 1.4;
  transition:
    border-color var(--transition-base),
    box-shadow var(--transition-base),
    background-color var(--transition-base);
}

.input::placeholder,
input::placeholder,
textarea::placeholder {
  color: var(--gray-500);
}

.input:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 1px rgba(229, 9, 26, 0.4), 0 0 0 4px rgba(229, 9, 26, 0.25);
}

input[disabled],
select[disabled],
textarea[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Cards - product tiles, info panels */
.card {
  position: relative;
  background: radial-gradient(circle at top left, rgba(255, 255, 255, 0.04), transparent 55%),
              var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  border: 1px solid rgba(255, 255, 255, 0.04);
  box-shadow: var(--shadow-soft);
  transition:
    transform var(--transition-base),
    box-shadow var(--transition-base),
    border-color var(--transition-base),
    background-color var(--transition-base);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: rgba(255, 255, 255, 0.08);
}

.card--flat {
  box-shadow: none;
}

.card-header {
  margin-bottom: var(--space-3);
}

.card-body {
  color: var(--color-text-muted);
}

.card-footer {
  margin-top: var(--space-4);
}

/* Badges - for stock, sale, tags */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-pill);
  font-size: var(--font-size-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid transparent;
}

.badge--primary {
  background-color: var(--color-primary-soft);
  color: var(--color-primary);
  border-color: rgba(229, 9, 26, 0.4);
}

.badge--success {
  background-color: var(--color-success-soft);
  color: var(--color-success);
  border-color: rgba(24, 167, 111, 0.4);
}

.badge--warning {
  background-color: var(--color-warning-soft);
  color: var(--color-warning);
  border-color: rgba(255, 170, 43, 0.4);
}

/* Price text helper */
.price {
  font-size: var(--font-size-xl);
  font-weight: 650;
  letter-spacing: 0.04em;
}

.price--muted {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  text-decoration: line-through;
}

/* =========================================================
   Accessibility & Motion
   ========================================================= */

:focus-visible {
  outline: 2px solid var(--color-info);
  outline-offset: 3px;
}

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

/* =========================================================
   End base.css
   ========================================================= */
