/* ========================================
   Variables
   ======================================== */
:root {
  /* Color Palette - tuned for Fix Wheel Suomi */
  --color-background: #0b1015; /* deep, technical backdrop */
  --color-surface: #141a21;    /* elevated surfaces / cards */
  --color-surface-alt: #1e262f;

  --color-text: #f4f6f8;
  --color-text-muted: #9ba4b1;

  --color-primary: #2f7ed8;   /* crisp blue for key actions */
  --color-primary-soft: rgba(47, 126, 216, 0.12);
  --color-primary-strong: #1b5da5;

  --color-success: #32b67a;
  --color-warning: #f5a623;
  --color-danger: #e15454;

  --color-border-subtle: #2a313b;
  --color-border-strong: #3b4554;

  --color-neutral-50: #f7f8fa;
  --color-neutral-100: #e4e7ec;
  --color-neutral-200: #ccd1db;
  --color-neutral-300: #a8b0c0;
  --color-neutral-400: #8690a3;
  --color-neutral-500: #656f83;
  --color-neutral-600: #4d5668;
  --color-neutral-700: #393f4c;
  --color-neutral-800: #222733;
  --color-neutral-900: #12151b;

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

  --font-size-xs: 0.75rem;   /* 12px */
  --font-size-sm: 0.875rem;  /* 14px */
  --font-size-md: 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 (px) */
  --space-0: 0px;
  --space-1: 2px;
  --space-2: 4px;
  --space-3: 6px;
  --space-4: 8px;
  --space-5: 10px;
  --space-6: 12px;
  --space-8: 16px;
  --space-10: 20px;
  --space-12: 24px;
  --space-16: 32px;
  --space-20: 40px;
  --space-24: 48px;
  --space-32: 64px;
  --space-40: 80px;
  --space-48: 96px;

  /* Radius */
  --radius-xs: 2px;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
  --radius-xl: 16px;
  --radius-pill: 999px;

  /* Shadows (subtle, technical feel) */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 4px 10px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.55);

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

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

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

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

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

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

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

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

/* Remove default button and link styles where appropriate */
button,
[role="button"] {
  cursor: pointer;
}

/* ========================================
   Base Styles
   ======================================== */
body {
  font-family: var(--font-sans);
  font-size: var(--font-size-md);
  line-height: var(--line-height-normal);
  background-color: var(--color-background);
  color: var(--color-text);
}

main {
  min-height: calc(100vh - 160px); /* leave room for header/footer */
}

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

h1 {
  font-size: var(--font-size-4xl);
  letter-spacing: 0.01em;
  margin-bottom: var(--space-16);
}

h2 {
  font-size: var(--font-size-3xl);
  margin-bottom: var(--space-12);
}

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

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

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

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

p {
  margin-bottom: var(--space-8);
  line-height: var(--line-height-relaxed);
  /* comfortable line length */
}

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

strong {
  font-weight: 600;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  text-underline-offset: 0.16em;
  transition: color var(--transition-fast);
}

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

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

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

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

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

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

/* Screen reader only */
.sr-only {
  border: 0;
  clip: rect(0 0 0 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
  white-space: nowrap;
}

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

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

.flex {
  display: flex;
}

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

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

.flex-row {
  flex-direction: row;
}

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

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

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

.grid {
  display: grid;
}

.grid-cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

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

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

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

.mt-0 { margin-top: 0; }
.mt-8 { margin-top: var(--space-8); }
.mt-16 { margin-top: var(--space-16); }
.mt-24 { margin-top: var(--space-24); }
.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: var(--space-8); }
.mb-16 { margin-bottom: var(--space-16); }
.mb-24 { margin-bottom: var(--space-24); }

.py-16 {
  padding-top: var(--space-16);
  padding-bottom: var(--space-16);
}

.py-24 {
  padding-top: var(--space-24);
  padding-bottom: var(--space-24);
}

/* ========================================
   Form & Button Components
   ======================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  padding: 0.7rem 1.5rem;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font-weight: 500;
  font-size: var(--font-size-sm);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  background-color: var(--color-primary);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
  transition:
    background-color var(--transition-normal),
    color var(--transition-normal),
    box-shadow var(--transition-normal),
    transform var(--transition-fast),
    border-color var(--transition-normal);
}

.btn:hover {
  background-color: var(--color-primary-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-xs);
}

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

.btn--outline {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
  box-shadow: none;
}

.btn--outline:hover {
  background-color: var(--color-primary-soft);
}

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

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

.btn:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 3px;
}

label {
  display: inline-block;
  margin-bottom: var(--space-4);
  font-size: var(--font-size-sm);
  font-weight: 500;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="search"],
input[type="password"],
select,
textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border-subtle);
  background-color: #0e141a;
  color: var(--color-text);
  line-height: 1.4;
  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 {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 1px var(--color-primary);
}

input:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

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

/* ========================================
   Card Component
   ======================================== */
.card {
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border-subtle);
  box-shadow: var(--shadow-sm);
  padding: var(--space-16);
}

.card--elevated {
  box-shadow: var(--shadow-md);
  border-color: var(--color-border-strong);
}

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

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

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

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

/* ========================================
   Helper States
   ======================================== */
.text-muted {
  color: var(--color-text-muted);
}

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

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

.border-subtle {
  border: 1px solid var(--color-border-subtle);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-pill);
  font-size: var(--font-size-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.badge--success {
  background-color: rgba(50, 182, 122, 0.15);
  color: var(--color-success);
}

.badge--warning {
  background-color: rgba(245, 166, 35, 0.14);
  color: var(--color-warning);
}

.badge--danger {
  background-color: rgba(225, 84, 84, 0.16);
  color: var(--color-danger);
}

/* ========================================
   Responsive Tweaks
   ======================================== */
@media (max-width: 768px) {
  h1 {
    font-size: 1.9rem;
  }

  h2 {
    font-size: 1.6rem;
  }

  .container {
    padding-left: var(--space-12);
    padding-right: var(--space-12);
  }

  .grid-cols-2,
  .grid-cols-3 {
    grid-template-columns: 1fr;
  }
}
