/* ==========================================================================
   Variables
   ========================================================================== */
:root {
  /* Color Palette - Tech-inspired cool blues & metallic grays */
  --color-background: #050b12;          /* Deep, subtle tech background */
  --color-surface: #0d1724;             /* Elevated surfaces (cards, headers) */
  --color-surface-alt: #111827;         /* Alternate surface / sections */
  --color-text: #e5e7eb;                /* Primary text (light gray) */
  --color-text-muted: #9ca3af;          /* Muted/secondary text */
  --color-border-subtle: #1f2933;       /* Subtle border for inputs/cards */
  --color-border-strong: #4b5563;       /* Stronger border for emphasis */

  --color-primary: #38bdf8;             /* Cool blue accent (links, CTAs) */
  --color-primary-soft: rgba(56, 189, 248, 0.12);
  --color-primary-strong: #0ea5e9;

  --color-success: #22c55e;             /* Success (green) */
  --color-warning: #fbbf24;             /* Warning (amber) */
  --color-danger: #f97373;              /* Danger (red) */

  /* Neutral grayscale (cool, metallic) */
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2933;
  --gray-900: #111827;

  /* 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-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-display: clamp(2.5rem, 4vw, 3.5rem);

  --line-height-tight: 1.2;
  --line-height-snug: 1.35;
  --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-8: 2rem;     /* 32px */
  --space-10: 2.5rem;  /* 40px */
  --space-12: 3rem;    /* 48px */
  --space-16: 4rem;    /* 64px */
  --space-20: 5rem;    /* 80px */
  --space-24: 6rem;    /* 96px */

  /* Radii - slightly futuristic but subtle */
  --radius-sm: 0.25rem;   /* 4px */
  --radius-md: 0.5rem;    /* 8px */
  --radius-lg: 0.75rem;   /* 12px */
  --radius-xl: 1rem;      /* 16px */
  --radius-pill: 9999px;

  /* Shadows - soft, elevated tech feel */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.55);
  --shadow-lg: 0 18px 45px rgba(15, 23, 42, 0.7);

  /* Transitions */
  --transition-fast: 120ms ease-out;
  --transition-normal: 180ms ease-out;
  --transition-slow: 240ms ease-out;
}

/* Respect prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  :root {
    --transition-fast: 0s;
    --transition-normal: 0s;
    --transition-slow: 0s;
  }
}

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

* {
  margin: 0;
}

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

body {
  min-height: 100vh;
}

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

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

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

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

/* Remove default focus outlines; re-add with :focus-visible below */
:focus {
  outline: none;
}

/* ==========================================================================
   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: 60vh;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 600;
  line-height: var(--line-height-tight);
  color: #f9fafb;
}

h1 {
  font-size: var(--font-size-display);
  letter-spacing: -0.04em;
  margin-bottom: var(--space-4);
}

h2 {
  font-size: var(--font-size-3xl);
  letter-spacing: -0.03em;
  margin-bottom: var(--space-3);
}

h3 {
  font-size: var(--font-size-2xl);
  margin-bottom: var(--space-3);
}

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

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

h6 {
  font-size: var(--font-size-base);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}

p {
  margin-bottom: var(--space-3);
  color: var(--color-text);
}

p:last-child {
  margin-bottom: 0;
}

strong,
b {
  font-weight: 600;
}

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

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

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

a:active {
  opacity: 0.85;
}

code,
pre {
  font-family: var(--font-mono);
}

hr {
  border: none;
  border-top: 1px solid var(--color-border-subtle);
  margin: var(--space-6) 0;
}

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

@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;
  }
}

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

/* ==========================================================================
   Layout Utilities
   ========================================================================== */
.container {
  width: 100%;
  margin-inline: auto;
  padding-inline: var(--space-4);
  max-width: 1120px; /* tuned for product grids & comparison tables */
}

@media (min-width: 1280px) {
  .container {
    max-width: 1200px;
  }
}

/* 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-column {
  display: flex;
  flex-direction: column;
}

.gap-xs { gap: var(--space-2); }
.gap-sm { gap: var(--space-3); }
.gap-md { gap: var(--space-4); }
.gap-lg { 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);
}

/* Alignment & text utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--color-text-muted); }

/******************** Spacing Utilities (Y-axis) ********************/
.section-padding {
  padding-block: var(--space-10);
}

.section-padding-lg {
  padding-block: var(--space-16);
}

/******************** Surface Utilities ********************/
.surface {
  background-color: var(--color-surface);
}

.surface-alt {
  background-color: var(--color-surface-alt);
}

/* ==========================================================================
   Form Elements & Inputs
   ========================================================================== */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="tel"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-subtle);
  background-color: rgba(15, 23, 42, 0.9);
  color: var(--color-text);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-normal);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast);
}

input::placeholder,
textarea::placeholder {
  color: var(--color-text-muted);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 1px var(--color-primary-soft), 0 0 0 1px rgba(15, 23, 42, 0.9);
}

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

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

/* ==========================================================================
   Buttons
   ========================================================================== */
.button,
button[type="button"],
button[type="submit"],
button[type="reset"],
input[type="button"],
input[type="submit"],
input[type="reset"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-strong));
  color: #0b1120;
  font-size: var(--font-size-sm);
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background var(--transition-normal), transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
  box-shadow: 0 8px 20px rgba(56, 189, 248, 0.35);
  text-decoration: none;
  white-space: nowrap;
}

.button:hover,
button[type="button"]:hover,
button[type="submit"]:hover,
button[type="reset"]:hover,
input[type="button"]:hover,
input[type="submit"]:hover,
input[type="reset"]:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(56, 189, 248, 0.5);
}

.button:active,
button[type="button"]:active,
button[type="submit"]:active,
button[type="reset"]:active,
input[type="button"]:active,
input[type="submit"]:active,
input[type="reset"]:active {
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.8);
}

.button:focus-visible,
button[type="button"]:focus-visible,
button[type="submit"]:focus-visible,
button[type="reset"]:focus-visible,
input[type="button"]:focus-visible,
input[type="submit"]:focus-visible,
input[type="reset"]:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
}

.button--secondary {
  background: rgba(15, 23, 42, 0.9);
  color: var(--color-text);
  border-color: var(--color-border-strong);
  box-shadow: var(--shadow-xs);
}

.button--secondary:hover {
  background: #111827;
}

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

.button--ghost:hover {
  border-color: var(--color-primary);
}

.button[disabled],
button[disabled],
input[disabled][type="button"],
input[disabled][type="submit"],
input[disabled][type="reset"] {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

/* Small button variant for filters, chips, etc. */
.button--sm {
  padding: 0.35rem 0.9rem;
  font-size: var(--font-size-xs);
}

/* ==========================================================================
   Card Component
   ========================================================================== */
.card {
  position: relative;
  background: radial-gradient(circle at top left, rgba(56, 189, 248, 0.12), transparent 55%), var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(148, 163, 184, 0.08);
  padding: var(--space-5);
  box-shadow: var(--shadow-md);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-fast), background var(--transition-normal);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(56, 189, 248, 0.35);
}

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

.card-title {
  font-size: var(--font-size-lg);
  margin-bottom: var(--space-1);
}

.card-subtitle {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.card-body {
  font-size: var(--font-size-sm);
}

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

/* ==========================================================================
   Misc & Helper Classes
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-pill);
  font-size: var(--font-size-xs);
  padding: 0.15rem 0.6rem;
  border: 1px solid rgba(148, 163, 184, 0.45);
  color: var(--color-text-muted);
  background: rgba(15, 23, 42, 0.85);
}

.badge--primary {
  border-color: rgba(56, 189, 248, 0.7);
  color: var(--color-primary);
}

.status-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  margin-right: 0.25rem;
  background-color: var(--color-success);
}

/* Light divider for list-like content (e.g., specs, comparisons) */
.divider-y > * + * {
  border-top: 1px solid rgba(31, 41, 55, 0.9);
  padding-top: var(--space-3);
  margin-top: var(--space-3);
}
