/* ========================================================================== */
/*  Variables                                                                 */
/* ========================================================================== */

:root {
  /* Color palette – cool, tech-inspired */
  --color-background: #050814; /* deep, subtle blue/black */
  --color-surface: #0c1020;
  --color-surface-elevated: #111629;
  --color-surface-soft: #141a33;

  --color-text: #f5f7fb;
  --color-text-muted: #a3b0c7;
  --color-border-subtle: #242b3f;

  --color-primary: #2f8cff; /* vibrant smart-home blue */
  --color-primary-soft: rgba(47, 140, 255, 0.15);
  --color-primary-strong: #1a63c4;

  --color-success: #2ecc71;
  --color-warning: #f1c40f;
  --color-danger: #e74c3c;

  /* Neutral grays (cool) */
  --gray-50: #f8fafc;
  --gray-100: #eef2ff;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5f5;
  --gray-400: #94a3b8;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2933;
  --gray-900: #0b1120;

  /* Typography */
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", 
    "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", 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 */

  --line-height-tight: 1.2;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.7;

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

  /* Radius */
  --radius-xs: 2px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 20px;
  --radius-full: 999px;

  /* Shadows – soft, tech-inspired glows */
  --shadow-sm: 0 4px 10px rgba(5, 12, 30, 0.45);
  --shadow-md: 0 12px 30px rgba(5, 12, 30, 0.6);
  --shadow-lg: 0 24px 50px rgba(5, 12, 30, 0.75);

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

/* ========================================================================== */
/*  Reset / Normalize                                                         */
/* ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

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

ul,
ol {
  list-style: none;
  padding: 0;
  margin: 0;
}

body {
  min-height: 100vh;
}

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

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

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

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

/* Remove animations for users who prefer reduced motion */
@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;
  }
}

/* ========================================================================== */
/*  Base Styles                                                               */
/* ========================================================================== */

body {
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  background: radial-gradient(circle at top, #0d1730 0, #050814 45%, #02030b 100%);
  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: var(--gray-50);
  letter-spacing: 0.01em;
}

h1 {
  font-size: clamp(2rem, 2.6vw, var(--font-size-4xl));
  margin-bottom: var(--space-12);
}

h2 {
  font-size: clamp(1.5rem, 2vw, var(--font-size-3xl));
  margin-bottom: var(--space-8);
}

h3 {
  font-size: clamp(1.25rem, 1.5vw, var(--font-size-2xl));
  margin-bottom: var(--space-6);
}

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

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

strong {
  font-weight: 600;
}

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

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

/* Links – subtle, professional, tech accent */
a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-base),
    opacity var(--transition-base),
    text-shadow var(--transition-base);
}

a:hover {
  color: var(--color-primary-strong);
  text-shadow: 0 0 12px rgba(47, 140, 255, 0.35);
}

a:active {
  opacity: 0.85;
}

/* ========================================================================== */
/*  Accessibility                                                             */
/* ========================================================================== */

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

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

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

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

@media (max-width: 640px) {
  .container {
    padding-left: var(--space-8);
    padding-right: var(--space-8);
  }
}

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

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

.gap-xs { gap: var(--space-4); }
.gap-sm { gap: var(--space-6); }
.gap-md { gap: var(--space-8); }
.gap-lg { gap: var(--space-12); }

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

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-8);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-10);
}

@media (max-width: 900px) {
  .grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Spacing utilities (subset, extend as needed) */
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mt-sm { margin-top: var(--space-6); }
.mb-sm { margin-bottom: var(--space-6); }
.mt-md { margin-top: var(--space-10); }
.mb-md { margin-bottom: var(--space-10); }
.mt-lg { margin-top: var(--space-16); }
.mb-lg { margin-bottom: var(--space-16); }

.pt-md { padding-top: var(--space-10); }
.pb-md { padding-bottom: var(--space-10); }

.text-center { text-align: center; }
.text-right { text-align: right; }

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

/* Buttons – primary and outline for CTAs and filters */
.button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  padding: 0.65rem 1.35rem;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-strong));
  color: #ffffff;
  font-size: var(--font-size-sm);
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 0 18px rgba(47, 140, 255, 0.45);
  transition:
    background var(--transition-base),
    box-shadow var(--transition-base),
    transform var(--transition-fast),
    border-color var(--transition-base),
    color var(--transition-base),
    opacity var(--transition-fast);
}

.button:hover,
.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 30px rgba(47, 140, 255, 0.65);
}

.button:active,
.btn:active {
  transform: translateY(0);
  box-shadow: 0 0 18px rgba(47, 140, 255, 0.45);
  opacity: 0.9;
}

.button:disabled,
.btn:disabled,
.button[aria-disabled="true"],
.btn[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.55;
  box-shadow: none;
}

.button--secondary,
.btn--secondary {
  background: rgba(15, 23, 42, 0.8);
  border-color: var(--color-border-subtle);
  color: var(--gray-100);
  box-shadow: var(--shadow-sm);
}

.button--secondary:hover,
.btn--secondary:hover {
  border-color: var(--color-primary);
  box-shadow: 0 0 24px rgba(47, 140, 255, 0.35);
}

.button--ghost,
.btn--ghost {
  background: transparent;
  border-color: rgba(148, 163, 184, 0.35);
  color: var(--gray-100);
  box-shadow: none;
}

.button--ghost:hover,
.btn--ghost:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
}

/* Inputs – used across filters, checkout, account */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="tel"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-subtle);
  background-color: rgba(5, 10, 24, 0.9);
  color: var(--color-text);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-normal);
  transition:
    border-color var(--transition-base),
    box-shadow var(--transition-base),
    background-color var(--transition-base),
    transform var(--transition-fast);
}

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

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 1px var(--color-primary-soft), 0 0 20px rgba(47, 140, 255, 0.35);
  background-color: rgba(8, 14, 32, 0.98);
}

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

label {
  display: inline-block;
  margin-bottom: var(--space-4);
  font-size: var(--font-size-sm);
  color: var(--gray-100);
}

/* Card – for product tiles, info blocks, order summaries */
.card {
  position: relative;
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.95), rgba(2, 6, 23, 0.98));
  border-radius: var(--radius-lg);
  border: 1px solid rgba(148, 163, 184, 0.22);
  padding: var(--space-10);
  box-shadow: var(--shadow-sm);
  transition:
    transform var(--transition-base),
    box-shadow var(--transition-base),
    border-color var(--transition-base),
    background var(--transition-base);
  backdrop-filter: blur(12px);
}

.card::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: radial-gradient(circle at top left, rgba(47, 140, 255, 0.18), transparent 55%);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
  z-index: -1;
}

.card:hover {
  transform: translateY(-3px);
  border-color: rgba(59, 130, 246, 0.75);
  box-shadow: var(--shadow-md);
}

.card:hover::before {
  opacity: 1;
}

.card__header {
  margin-bottom: var(--space-6);
}

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

.card__meta {
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
}

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

.card__footer {
  margin-top: var(--space-8);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
}

/* Tag / pill – for compatibility labels, status badges */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.6rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(148, 163, 184, 0.4);
  font-size: var(--font-size-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.tag--primary {
  border-color: rgba(47, 140, 255, 0.8);
  background: rgba(15, 23, 42, 0.9);
  color: var(--gray-100);
}

.tag--success {
  border-color: rgba(46, 204, 113, 0.8);
  color: #bbf7d0;
}

.tag--danger {
  border-color: rgba(231, 76, 60, 0.8);
  color: #fecaca;
}

/* Notification banner – e.g., free shipping, sale */
.alert {
  border-radius: var(--radius-md);
  padding: var(--space-8);
  font-size: var(--font-size-sm);
  display: flex;
  align-items: flex-start;
  gap: var(--space-6);
  border: 1px solid var(--color-border-subtle);
  background: rgba(15, 23, 42, 0.95);
}

.alert--success {
  border-color: rgba(46, 204, 113, 0.75);
}

.alert--warning {
  border-color: rgba(241, 196, 15, 0.75);
}

.alert--danger {
  border-color: rgba(231, 76, 60, 0.75);
}

.alert__title {
  font-weight: 600;
  margin-bottom: var(--space-2);
  color: var(--gray-50);
}

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

/* Utility: subtle divider for sections */
.section-edge {
  border-top: 1px solid rgba(15, 23, 42, 0.95);
  box-shadow: 0 -1px 0 rgba(148, 163, 184, 0.12);
}
