/* ============================================================
   Wrench Buddy — style.css
   Dark mechanic-shop aesthetic · WCAG 2.2 AA compliant
   ============================================================ */

/* === Custom Properties === */
:root {
  --bg:              #0f0f0f;
  --surface:         #1a1a1a;
  --surface-raised:  #242424;
  --accent:          #E8824B;
  --accent-hover:    #f0956a;
  --text-primary:    #f0f0f0;
  --text-muted:      #a0a0a0;
  --text-on-surface: #e0e0e0;
  --border:          #3a3a3a;
  --danger:          #e05252;
  --success:         #52c07a;
  --warning:         #e0b252;

  --focus-color:  #f0956a;
  --focus-width:  3px;
  --focus-offset: 2px;

  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  --font-heading: 'Barlow Condensed', system-ui, sans-serif;
  --font-body:    'Inter', system-ui, sans-serif;

  --max-width:  1140px;
  --nav-height: 64px;
  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg:  16px;
}

/* === WCAG 2.4.11 / 2.4.12 — scroll padding so sticky nav never obscures focused elements === */
html {
  scroll-padding-top: calc(var(--nav-height) + 1rem);
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* === Skip Link (WCAG 2.4.1) === */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  z-index: 9999;
  padding: var(--space-3) var(--space-6);
  background: var(--accent);
  color: #000;
  font-weight: 700;
  font-size: 0.9rem;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  text-decoration: none;
}
.skip-link:focus { top: 0; }

/* === Focus Styles (WCAG 2.4.13 — 3px, 3:1 contrast, non-zero offset) === */
:focus { outline: none; }
:focus-visible {
  outline: var(--focus-width) solid var(--focus-color);
  outline-offset: var(--focus-offset);
  border-radius: var(--radius-sm);
}

/* === Typography === */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.02em;
}
h1 { font-size: clamp(2.4rem, 6vw, 4.5rem); }
h2 { font-size: clamp(1.75rem, 4vw, 2.75rem); }
h3 { font-size: clamp(1.2rem, 2.5vw, 1.6rem); }
h4 { font-size: 1.1rem; }
p  { max-width: 68ch; }

a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }

img, svg { display: block; max-width: 100%; }
ul, ol  { padding-left: var(--space-6); }

/* === Layout === */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--space-6);
}
.section    { padding-block: var(--space-20); }
.section--sm { padding-block: var(--space-12); }

/* === Buttons — min 44×44px touch target (WCAG 2.5.8) === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  min-width: 44px;
  padding: var(--space-3) var(--space-6);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

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

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

/* === Header / Nav === */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  background: rgba(15, 15, 15, 0.95);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-height);
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  color: var(--text-primary);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.nav-logo img { width: 32px; height: 32px; border-radius: var(--radius-sm); }
.nav-logo:hover { color: var(--accent); }

.nav-menu {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  list-style: none;
  padding: 0;
  margin: 0;
}

/* Nav links — min 44px touch target via min-height + padding */
.nav-link {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding-inline: var(--space-4);
  color: var(--text-on-surface);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
}
.nav-link:hover { color: var(--accent); background: var(--surface); }
.nav-link[aria-current="page"] { color: var(--accent); }

/* Hamburger toggle — hidden on desktop */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  min-width: 44px;
  min-height: 44px;
  padding: var(--space-2);
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-primary);
}
.nav-toggle-bar { display: block; width: 22px; height: 2px; background: currentColor; border-radius: 2px; }

/* === Mobile Nav === */
@media (max-width: 768px) {
  .nav-toggle { display: flex; }

  .nav-menu {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    bottom: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--surface);
    padding: var(--space-6);
    overflow-y: auto;
    transform: translateX(100%);
    visibility: hidden;
  }

  .nav-menu.is-open {
    transform: translateX(0);
    visibility: visible;
  }

  .nav-link {
    padding: var(--space-4);
    border-bottom: 1px solid var(--border);
    font-size: 1.1rem;
  }

  .nav-menu .btn { margin-top: var(--space-4); width: 100%; }
}

/* Transitions — only when motion is OK */
@media (prefers-reduced-motion: no-preference) {
  .btn                { transition: background 200ms ease, color 200ms ease, border-color 200ms ease; }
  a                   { transition: color 200ms ease; }
  .nav-logo           { transition: color 200ms ease; }
  .nav-link           { transition: color 200ms ease, background 200ms ease; }

  @media (max-width: 768px) {
    .nav-menu         { transition: transform 0.25s ease, visibility 0.25s ease; }
  }
}

/* === Hero === */
.hero {
  position: relative;
  padding-block: var(--space-24);
  overflow: hidden;
}

/* Subtle grid texture */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(232, 130, 75, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(232, 130, 75, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
}

/* Fade-to-bg at bottom */
.hero::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 120px;
  background: linear-gradient(transparent, var(--bg));
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-12);
  align-items: center;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-4);
  background: rgba(232, 130, 75, 0.12);
  border: 1px solid rgba(232, 130, 75, 0.3);
  border-radius: 99px;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: var(--space-6);
}

.hero-title { margin-bottom: var(--space-6); }
.hero-title span { color: var(--accent); }

.hero-subtitle {
  font-size: 1.15rem;
  color: var(--text-muted);
  margin-bottom: var(--space-10);
  max-width: 52ch;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: var(--space-4); align-items: center; }

.hero-badge {
  flex-shrink: 0;
  width: 180px;
  height: 180px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.hero-badge img { width: 120px; height: 120px; object-fit: contain; }

@media (max-width: 768px) {
  .hero { padding-block: var(--space-16) var(--space-20); }
  .hero-inner { grid-template-columns: 1fr; }
  .hero-badge { display: none; }
}

/* === Section Labels === */
.section-label {
  display: block;
  color: var(--accent);
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: var(--space-4);
}
.section-title   { margin-bottom: var(--space-4); }
.section-subtitle { color: var(--text-muted); font-size: 1.1rem; margin-bottom: var(--space-12); }
.section-header  { margin-bottom: var(--space-12); }

/* === Feature Cards === */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-6);
}

.feature-card {
  padding: var(--space-8);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
}
.feature-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
}
.feature-icon {
  width: 48px;
  height: 48px;
  background: rgba(232, 130, 75, 0.12);
  border: 1px solid rgba(232, 130, 75, 0.2);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-5);
  font-size: 1.4rem;
}
.feature-card h3 { font-size: 1.2rem; margin-bottom: var(--space-3); }
.feature-card p  { color: var(--text-muted); font-size: 0.9rem; max-width: none; }

@media (prefers-reduced-motion: no-preference) {
  .feature-card { transition: border-color 200ms ease, transform 200ms ease; }
  .feature-card:hover { border-color: rgba(232, 130, 75, 0.4); transform: translateY(-2px); }
}

/* === How It Works Steps === */
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-8);
  list-style: none;
  padding: 0;
}
.step { text-align: center; }
.step-num {
  width: 64px; height: 64px;
  background: var(--accent);
  color: #000;
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-5);
}
.step h3 { font-size: 1.1rem; margin-bottom: var(--space-2); }
.step p  { color: var(--text-muted); font-size: 0.9rem; max-width: none; }

/* === Guides CTA Strip === */
.guides-cta {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.guides-cta-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  flex-wrap: wrap;
  padding-block: var(--space-10);
}

/* === Guide Cards (hub page) === */
.guide-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-6);
}
.guide-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  overflow: hidden;
}
.guide-card-body { padding: var(--space-8); flex: 1; }
.guide-card-icon { font-size: 2rem; margin-bottom: var(--space-4); }
.guide-card h3   { margin-bottom: var(--space-3); font-size: 1.3rem; color: var(--text-primary); }
.guide-card p    { color: var(--text-muted); font-size: 0.9rem; max-width: none; }
.guide-card-footer {
  padding: var(--space-4) var(--space-8);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
}
@media (prefers-reduced-motion: no-preference) {
  .guide-card { transition: border-color 200ms ease, transform 200ms ease; }
  .guide-card:hover { border-color: rgba(232, 130, 75, 0.4); transform: translateY(-2px); }
}

/* === Page Header (inner pages) === */
.page-header {
  padding-block: var(--space-12);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
.page-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(232, 130, 75, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(232, 130, 75, 0.03) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
}
.page-header > .container { position: relative; z-index: 1; }

/* Breadcrumb (WCAG 2.4.8) */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  list-style: none;
  padding: 0;
  margin-bottom: var(--space-4);
  font-size: 0.85rem;
  color: var(--text-muted);
}
.breadcrumb a { color: var(--text-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb li + li::before { content: '/'; margin-right: var(--space-2); color: var(--border); }

/* === Article Layout (guide pages) === */
.article {
  max-width: 720px;
  margin-inline: auto;
  padding-block: var(--space-12);
}
.article h2 {
  font-size: 1.75rem;
  margin-top: var(--space-12);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}
.article h3 {
  font-size: 1.25rem;
  margin-top: var(--space-8);
  margin-bottom: var(--space-3);
  color: var(--accent);
}
.article p  { margin-bottom: var(--space-5); color: var(--text-on-surface); line-height: 1.75; }
.article ul, .article ol { margin-bottom: var(--space-5); }
.article li { margin-bottom: var(--space-2); color: var(--text-on-surface); line-height: 1.6; }
.article strong { color: var(--text-primary); }
.article a  { color: var(--accent); }

/* Callout boxes */
.callout {
  padding: var(--space-5) var(--space-6);
  border-left: 3px solid var(--accent);
  background: rgba(232, 130, 75, 0.06);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin-block: var(--space-6);
}
.callout-warning { border-left-color: var(--warning); background: rgba(224, 178, 82, 0.06); }
.callout-danger  { border-left-color: var(--danger);  background: rgba(224, 82,  82, 0.06); }
.callout p { margin: 0; font-size: 0.95rem; }

/* Code */
code {
  font-family: 'Courier New', monospace;
  font-size: 0.85em;
  background: var(--surface-raised);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  color: var(--accent);
}

/* DTC table */
.dtc-table-wrap { overflow-x: auto; margin-block: var(--space-6); }
.dtc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.dtc-table th {
  background: var(--surface-raised);
  color: var(--accent);
  font-family: var(--font-heading);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 0.75rem;
  text-align: left;
  padding: var(--space-3) var(--space-4);
  border-bottom: 2px solid var(--border);
}
.dtc-table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  color: var(--text-on-surface);
  vertical-align: top;
}
.dtc-table tbody tr:hover td { background: var(--surface); }

/* Code category badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  font-family: var(--font-heading);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.badge-p { background: rgba(82, 130, 224, 0.2); color: #82aae0; }
.badge-c { background: rgba(82, 192, 122, 0.2); color: #52c07a; }
.badge-b { background: rgba(224, 178, 82, 0.2);  color: #e0b252; }
.badge-u { background: rgba(224, 82, 82, 0.2);   color: #e05252; }

/* Related guides (bottom of article) */
.related-guides { margin-top: var(--space-16); padding-top: var(--space-8); border-top: 1px solid var(--border); }
.related-guides h2 { font-size: 1.25rem; margin-bottom: var(--space-6); }
.related-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.related-list a {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-on-surface);
  font-size: 0.95rem;
}
.related-list a:hover { border-color: rgba(232, 130, 75, 0.4); color: var(--text-primary); }
.related-list a::after { content: '→'; margin-left: auto; color: var(--accent); }

/* === Changelog Timeline === */
.changelog-wrap {
  max-width: 800px;
  margin-inline: auto;
  padding-block: var(--space-12);
}
.changelog-timeline {
  position: relative;
  padding-left: var(--space-10);
}
.changelog-timeline::before {
  content: '';
  position: absolute;
  left: 5px;
  top: var(--space-3);
  bottom: 0;
  width: 2px;
  background: var(--border);
}
.changelog-entry {
  position: relative;
  margin-bottom: var(--space-12);
}
.changelog-entry::before {
  content: '';
  position: absolute;
  left: calc(-1 * var(--space-10) + 0px);
  top: 0.65rem;
  width: 12px;
  height: 12px;
  background: var(--accent);
  border-radius: 50%;
  border: 2px solid var(--bg);
}
.changelog-ver-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.changelog-ver-row h2 {
  font-size: 1.5rem;
  border: none;
  margin: 0;
  padding: 0;
}
.changelog-date { color: var(--text-muted); font-size: 0.85rem; }

.changelog-section-title {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: var(--space-6);
  margin-bottom: var(--space-3);
}
.changelog-list { list-style: none; padding: 0; }
.changelog-list li {
  padding: var(--space-2) 0 var(--space-2) var(--space-6);
  border-bottom: 1px solid rgba(58, 58, 58, 0.5);
  color: var(--text-on-surface);
  font-size: 0.95rem;
  position: relative;
}
.changelog-list li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 700;
}
.changelog-list.fixes li::before { content: '✗'; color: var(--danger); }
.changelog-list.fixes li::before { content: '⬦'; color: var(--success); }

/* === Screenshots row === */
.screenshots-row {
  display: flex;
  gap: var(--space-4);
  overflow-x: auto;
  padding-bottom: var(--space-3);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.screenshot-placeholder {
  flex-shrink: 0;
  background: var(--surface-raised);
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  aspect-ratio: 9 / 16;
  width: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  color: var(--text-muted);
  font-size: 0.8rem;
  text-align: center;
  padding: var(--space-4);
}
.screenshot-placeholder p { max-width: none; margin: 0; }

/* Screenshot image (swap placeholder with real image) */
.screenshot-img {
  flex-shrink: 0;
  width: 200px;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

/* === Footer === */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-block: var(--space-12) var(--space-8);
}
.footer-inner {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: var(--space-12);
  margin-bottom: var(--space-10);
}
.footer-brand .nav-logo { margin-bottom: var(--space-4); }
.footer-brand p { color: var(--text-muted); font-size: 0.9rem; max-width: 32ch; }
.footer-col h4 {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--space-4);
}
.footer-links { list-style: none; padding: 0; }
.footer-links li { margin-bottom: var(--space-3); }
.footer-links a { color: var(--text-muted); text-decoration: none; font-size: 0.9rem; }
.footer-links a:hover { color: var(--text-primary); }
.footer-bottom {
  padding-top: var(--space-6);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-4);
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* === Responsive === */
@media (max-width: 768px) {
  .footer-inner { grid-template-columns: 1fr; gap: var(--space-8); }
  .guides-cta-inner { flex-direction: column; align-items: flex-start; }
  .steps { grid-template-columns: 1fr; }
}

/* === Utility === */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}
.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  margin-block: var(--space-8);
}
.text-muted  { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.mt-0  { margin-top: 0; }
.mb-0  { margin-bottom: 0; }
