/* ==========================================================================
   DTCReader — Design System
   A clean, professional stylesheet for an automotive diagnostic tool.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Google Fonts — Inter
   -------------------------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* --------------------------------------------------------------------------
   CSS Custom Properties (Design Tokens)
   -------------------------------------------------------------------------- */
:root {
  /* Color palette */
  --primary:        #0F172A; /* dark navy — main headings */
  --primary-light:  #1E293B; /* slightly lighter navy */
  --accent:         #2563EB; /* blue — links, buttons, highlights */
  --accent-hover:   #1D4ED8;
  --accent-light:   #EFF6FF; /* light blue bg for badges */
  --danger:         #DC2626; /* red — high severity */
  --warning:        #D97706; /* amber — medium severity */
  --success:        #16A34A; /* green — low severity */
  --bg:             #F8FAFC; /* page background */
  --surface:        #FFFFFF; /* card / surface background */
  --border:         #E2E8F0;
  --border-strong:  #CBD5E1;
  --text:           #1E293B; /* body text */
  --text-muted:     #64748B;
  --text-light:     #94A3B8;

  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --text-base: 1rem;
  --leading:   1.6;

  /* Spacing scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-8: 3rem;
  --space-10: 4rem;

  /* Border radius */
  --radius-sm:  0.25rem;
  --radius:     0.5rem;
  --radius-lg:  0.75rem;
  --radius-xl:  1rem;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm:  0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow:     0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md:  0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg:  0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

  /* Transitions */
  --transition: 150ms ease;

  /* Aliases for inner-page compatibility */
  --color-text:         var(--text);
  --color-text-muted:   var(--text-muted);
  --color-text-secondary: var(--text-muted);
  --color-border:       var(--border);
  --color-surface:      var(--surface);
  --color-surface-alt:  var(--bg);
  --color-surface-hover: #f1f5f9;
  --color-accent:       var(--accent);
  --color-accent-hover: var(--accent-hover);
  --color-primary:      var(--accent);
  --font-mono:          'SF Mono', 'Fira Code', 'Fira Mono', monospace;
}

/* --------------------------------------------------------------------------
   Reset & Base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading);
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}

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

ul,
ol {
  list-style: none;
}

/* --------------------------------------------------------------------------
   Typography
   -------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  font-weight: 600;
  line-height: 1.25;
  color: var(--primary);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

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

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

strong { font-weight: 600; }
em     { font-style: italic; }

code,
kbd {
  font-family: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', monospace;
  font-size: 0.875em;
  background: var(--accent-light);
  color: var(--accent);
  padding: 0.1em 0.35em;
  border-radius: var(--radius-sm);
}

/* --------------------------------------------------------------------------
   Layout — Container
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: var(--space-5);
}

.container--narrow {
  max-width: 760px;
}

.container--wide {
  max-width: 1400px;
}

/* --------------------------------------------------------------------------
   Header & Navigation
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: var(--space-6);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  flex-shrink: 0;
}

.nav-logo:hover {
  color: var(--accent);
}

.nav-logo svg {
  color: var(--accent);
  flex-shrink: 0;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  flex-shrink: 0;
}
.site-logo:hover { color: var(--accent); }

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-5);
}

.nav-links a {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  padding: var(--space-2) 0;
  border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Mobile nav toggle (hidden on desktop) */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-2);
  color: var(--text);
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.625rem 1.25rem;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1;
  border-radius: var(--radius);
  border: 1.5px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background-color var(--transition),
    color var(--transition),
    border-color var(--transition),
    box-shadow var(--transition),
    transform 80ms ease;
  user-select: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
  box-shadow: var(--shadow-md);
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent);
}

.btn-outline:hover {
  background: var(--accent-light);
  color: var(--accent-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}

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

.btn-sm {
  padding: 0.4rem 0.875rem;
  font-size: 0.8125rem;
}

.btn-lg {
  padding: 0.875rem 1.75rem;
  font-size: 1.0625rem;
}

.btn-full {
  width: 100%;
}

/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), border-color var(--transition);
}

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

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

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

.card-header {
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: var(--space-1);
}

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

/* --------------------------------------------------------------------------
   Badges & Pills
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  padding: 0.2em 0.65em;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  border-radius: var(--radius-full);
  white-space: nowrap;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* Severity badges */
.badge-severity-high {
  background: #FEE2E2;
  color: var(--danger);
}

.badge-severity-medium {
  background: #FEF3C7;
  color: var(--warning);
}

.badge-severity-low {
  background: #DCFCE7;
  color: var(--success);
}

.badge-info {
  background: var(--accent-light);
  color: var(--accent);
}

.badge-neutral {
  background: var(--border);
  color: var(--text-muted);
}

/* Manufacturer / make pill buttons */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  cursor: pointer;
  text-decoration: none;
  transition:
    background var(--transition),
    border-color var(--transition),
    color var(--transition),
    box-shadow var(--transition);
}

.pill:hover {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

/* --------------------------------------------------------------------------
   Search Components
   -------------------------------------------------------------------------- */
.search-box {
  display: flex;
  align-items: stretch;
  width: 100%;
  max-width: 620px;
  background: var(--surface);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(37 99 235 / 0.15), var(--shadow);
}

.search-input {
  flex: 1;
  padding: 0.875rem 1.125rem;
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  color: var(--text);
  background: transparent;
  border: none;
  outline: none;
  min-width: 0;
}

.search-input::placeholder {
  color: var(--text-light);
}

.search-btn {
  padding: 0.875rem 1.5rem;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition);
  flex-shrink: 0;
}

.search-btn:hover {
  background: var(--accent-hover);
}

/* --------------------------------------------------------------------------
   Form Elements
   -------------------------------------------------------------------------- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.form-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(37 99 235 / 0.12);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-light);
}

.form-helper {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.form-error {
  font-size: 0.8125rem;
  color: var(--danger);
}

/* --------------------------------------------------------------------------
   Sections
   -------------------------------------------------------------------------- */
.section {
  padding-block: var(--space-10);
}

.section--sm {
  padding-block: var(--space-8);
}

.section--alt {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.section-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--space-3);
}

.section-title {
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: var(--space-3);
}

.section-subtitle {
  font-size: 1.0625rem;
  color: var(--text-muted);
  max-width: 540px;
}

/* --------------------------------------------------------------------------
   Grid helpers
   -------------------------------------------------------------------------- */
.grid {
  display: grid;
  gap: var(--space-5);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.site-footer {
  background: var(--primary);
  color: var(--text-light);
  padding-block: var(--space-8);
  margin-top: auto;
}

.site-footer a {
  color: var(--text-light);
  transition: color var(--transition);
}

.site-footer a:hover {
  color: #fff;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-6);
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 1.125rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  margin-bottom: var(--space-3);
}

.footer-brand svg {
  color: var(--accent);
}

.footer-tagline {
  font-size: 0.875rem;
  color: var(--text-light);
  max-width: 280px;
  line-height: 1.5;
}

.footer-links-group h4 {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-light);
  margin-bottom: var(--space-3);
}

.footer-links-group ul {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.footer-links-group a {
  font-size: 0.875rem;
}

.footer-bottom {
  margin-top: var(--space-8);
  padding-top: var(--space-5);
  border-top: 1px solid rgb(255 255 255 / 0.08);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  font-size: 0.8125rem;
  color: var(--text-light);
}

.footer-disclaimer {
  font-size: 0.75rem;
  color: rgb(148 163 184 / 0.7);
  line-height: 1.5;
  max-width: 640px;
  margin-top: var(--space-3);
}

/* --------------------------------------------------------------------------
   Divider
   -------------------------------------------------------------------------- */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin-block: var(--space-5);
}

/* --------------------------------------------------------------------------
   Utility Classes
   -------------------------------------------------------------------------- */

/* Text color */
.text-muted   { color: var(--text-muted); }
.text-light   { color: var(--text-light); }
.text-accent  { color: var(--accent); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-success { color: var(--success); }
.text-white   { color: #fff; }

/* Text size */
.text-xs  { font-size: 0.75rem; }
.text-sm  { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg  { font-size: 1.125rem; }
.text-xl  { font-size: 1.25rem; }

/* Text alignment */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-left   { text-align: left; }

/* Font weight */
.font-normal  { font-weight: 400; }
.font-medium  { font-weight: 500; }
.font-semibold{ font-weight: 600; }
.font-bold    { font-weight: 700; }

/* Margin top */
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }

/* Margin bottom */
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

/* Padding */
.p-0 { padding: 0; }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }

/* Display */
.flex         { display: flex; }
.inline-flex  { display: inline-flex; }
.block        { display: block; }
.hidden       { display: none; }

/* Flex helpers */
.items-center    { align-items: center; }
.items-start     { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.flex-wrap       { flex-wrap: wrap; }
.gap-2           { gap: var(--space-2); }
.gap-3           { gap: var(--space-3); }
.gap-4           { gap: var(--space-4); }
.gap-5           { gap: var(--space-5); }
.gap-6           { gap: var(--space-6); }

/* Width */
.w-full { width: 100%; }

/* Border radius */
.rounded    { border-radius: var(--radius); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-full); }

/* Overflow */
.overflow-hidden { overflow: hidden; }

/* Visually hidden (for accessibility) */
.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;
}

/* --------------------------------------------------------------------------
   Responsive — Mobile First
   -------------------------------------------------------------------------- */

/* Tablet: 768px and up */
@media (min-width: 768px) {
  h1 { font-size: 3rem; }
  h2 { font-size: 2rem; }

  .grid-2-md { grid-template-columns: repeat(2, 1fr); }
  .grid-3-md { grid-template-columns: repeat(3, 1fr); }
}

/* Desktop: 1024px and up */
@media (min-width: 1024px) {
  h1 { font-size: 3.5rem; }

  .grid-3-lg { grid-template-columns: repeat(3, 1fr); }
  .grid-4-lg { grid-template-columns: repeat(4, 1fr); }
}

/* Mobile-only overrides */
@media (max-width: 767px) {
  .site-nav {
    position: relative;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: flex-start;
    padding: var(--space-4) var(--space-5);
    gap: var(--space-3);
    box-shadow: var(--shadow-md);
  }

  .nav-links.is-open {
    display: flex;
  }

  .nav-links a {
    border-bottom: none;
    padding: var(--space-2) 0;
    width: 100%;
  }

  .nav-toggle {
    display: block;
  }

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

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