/* ===================================================
   Kei Fire Trucks — Main Stylesheet
   =================================================== */

/* --- Custom Properties --- */
:root {
  --color-primary:       #c0392b;
  --color-primary-dark:  #96281b;
  --color-primary-light: #e74c3c;
  --color-bg:            #ffffff;
  --color-surface:       #f6f6f6;
  --color-surface-alt:   #efefef;
  --color-border:        #d8d8d8;
  --color-text:          #1e1e1e;
  --color-text-muted:    #636363;
  --color-link:          #c0392b;
  --color-link-hover:    #96281b;
  --color-nav-bg:        #1a1a1a;
  --color-nav-text:      #f0f0f0;
  --color-nav-hover:     #c0392b;
  --color-footer-bg:     #111111;
  --color-footer-text:   #aaaaaa;

  --font-sans:   -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono:   "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;

  --radius:      4px;
  --radius-lg:   8px;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.10);
  --shadow-md:   0 3px 8px rgba(0,0,0,.12);

  --container:   1100px;
  --nav-height:  60px;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--color-text);
  background: var(--color-bg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--color-link); }
a:hover { color: var(--color-link-hover); }
ul, ol { list-style: none; }

/* --- Typography --- */
h1, h2, h3, h4 {
  line-height: 1.25;
  font-weight: 700;
  color: var(--color-text);
}
h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); margin-bottom: 0.5rem; }
h2 { font-size: 1.35rem; margin-bottom: 0.4rem; }
h3 { font-size: 1.1rem; margin-bottom: 0.3rem; }
p  { margin-bottom: 1rem; }
p:last-child { margin-bottom: 0; }
strong { font-weight: 600; }

/* --- Layout --- */
.container {
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 1.25rem;
}

.site-main {
  flex: 1;
  padding-block: 2rem;
}

.page-wrap {
  padding-block: 1.5rem 3rem;
}

/* --- Site Header & Nav --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-nav-bg);
  border-bottom: 3px solid var(--color-primary);
  height: var(--nav-height);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  gap: 1rem;
}

/* Brand */
.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  color: var(--color-nav-text);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}
.brand:hover { color: var(--color-primary-light); }
.brand-icon { width: 26px; height: 26px; color: var(--color-primary-light); flex-shrink: 0; }

/* Hamburger toggle (mobile) */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem;
  color: var(--color-nav-text);
  flex-shrink: 0;
}
.hamburger-bar {
  display: block;
  width: 22px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}
.nav-toggle[aria-expanded="true"] .hamburger-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .hamburger-bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .hamburger-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Nav list */
.site-nav { display: flex; align-items: center; }
.nav-list {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}
.nav-item { position: relative; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.45rem 0.75rem;
  color: var(--color-nav-text);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  border-radius: var(--radius);
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.nav-link:hover, .nav-link.active { background: rgba(255,255,255,.08); color: var(--color-primary-light); }
.nav-link.active { color: var(--color-primary-light); }

/* Dropdown caret */
.dropdown-caret {
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  transition: transform 0.15s;
}
.has-dropdown:hover .dropdown-caret,
.has-dropdown:focus-within .dropdown-caret { transform: rotate(180deg); }

/* Dropdown menu */
.nav-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: #242424;
  border: 1px solid #333;
  border-radius: var(--radius);
  min-width: 180px;
  box-shadow: var(--shadow-md);
  padding: 0.3rem 0;
}
.has-dropdown:hover .nav-dropdown,
.has-dropdown:focus-within .nav-dropdown { display: block; }
.nav-dropdown-link {
  display: block;
  padding: 0.5rem 1rem;
  color: var(--color-nav-text);
  text-decoration: none;
  font-size: 0.9rem;
  transition: background 0.12s;
}
.nav-dropdown-link:hover, .nav-dropdown-link.active {
  background: var(--color-primary);
  color: #fff;
}

/* --- Breadcrumb --- */
.breadcrumb { margin-bottom: 1.25rem; }
.breadcrumb-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  align-items: center;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}
.breadcrumb-item + .breadcrumb-item::before {
  content: "/";
  margin-right: 0.2rem;
  color: var(--color-border);
}
.breadcrumb-link { color: var(--color-text-muted); text-decoration: none; }
.breadcrumb-link:hover { color: var(--color-link); }

/* --- Page Title & Subtitle --- */
.page-title { margin-bottom: 0.25rem; }
.vehicle-subtitle {
  font-size: 0.95rem;
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
  font-weight: 400;
}

/* --- Page Content (generic markdown area) --- */
.page-content h2 { margin-top: 2rem; margin-bottom: 0.5rem; }
.page-content h3 { margin-top: 1.5rem; margin-bottom: 0.4rem; }
.page-content ul, .page-content ol {
  list-style: disc;
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}
.page-content ol { list-style: decimal; }
.page-content li { margin-bottom: 0.25rem; }
.page-content hr { border: none; border-top: 1px solid var(--color-border); margin-block: 2rem; }
.page-content blockquote {
  border-left: 4px solid var(--color-primary);
  padding: 0.75rem 1rem;
  background: var(--color-surface);
  margin-bottom: 1rem;
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* --- Hero (home page) --- */
.hero {
  background: linear-gradient(135deg, var(--color-nav-bg) 0%, #2c1010 100%);
  color: #fff;
  padding: 4rem 0 3.5rem;
  text-align: center;
  margin-bottom: 3rem;
}
.hero-title {
  font-size: clamp(2rem, 6vw, 3.2rem);
  color: #fff;
  margin-bottom: 1rem;
}
.hero-sub {
  font-size: 1.1rem;
  color: rgba(255,255,255,.75);
  max-width: 560px;
  margin: 0 auto 2rem;
}
.hero-actions { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius);
  text-decoration: none;
  cursor: pointer;
  border: 2px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn-primary {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}
.btn-primary:hover {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  color: #fff;
}
.btn-secondary {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}
.btn-secondary:hover {
  background: var(--color-primary);
  color: #fff;
}
.btn-ghost {
  background: rgba(255,255,255,.12);
  color: #fff;
  border-color: rgba(255,255,255,.25);
}
.btn-ghost:hover {
  background: rgba(255,255,255,.22);
  color: #fff;
}

/* --- Card Grid (for listing pages) --- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}
.card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.18s, transform 0.18s;
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.card-img {
  aspect-ratio: 16 / 9;
  background: var(--color-surface);
  overflow: hidden;
}
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.card-body { padding: 1.1rem 1.25rem 1.25rem; flex: 1; }
.card-title { font-size: 1.05rem; font-weight: 700; margin-bottom: 0.35rem; }
.card-desc { font-size: 0.875rem; color: var(--color-text-muted); }
.card-footer {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--color-surface);
  font-size: 0.82rem;
  color: var(--color-text-muted);
}

/* --- Vehicle Gallery Previews (on vehicle profile page) --- */
.vehicle-gallery-previews {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.gallery-preview-card {
  position: relative;
  display: block;
  text-decoration: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.18s, transform 0.18s;
}
.gallery-preview-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.gallery-preview-img {
  aspect-ratio: 4 / 3;
  overflow: hidden;
}
.gallery-preview-img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.25s; }
.gallery-preview-card:hover .gallery-preview-img img { transform: scale(1.04); }
.gallery-preview-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 0.9rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-text);
  background: var(--color-bg);
}

/* Image placeholder (when no photo yet) */
.img-placeholder {
  width: 100%;
  height: 100%;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-surface-alt);
  color: var(--color-text-muted);
  font-size: 0.85rem;
  text-align: center;
  padding: 1rem;
}

/* --- Specs Table --- */
.specs-section { margin-bottom: 2rem; }
.section-heading {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--color-primary);
  color: var(--color-text);
}
.specs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.specs-table th,
.specs-table td {
  padding: 0.65rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}
.specs-table th {
  width: 38%;
  font-weight: 600;
  color: var(--color-text-muted);
  background: var(--color-surface);
  white-space: nowrap;
}
.specs-table tr:last-child th,
.specs-table tr:last-child td { border-bottom: none; }

/* --- Related Parts List --- */
.related-parts { margin-bottom: 2rem; }
.related-parts-list { border: 1px solid var(--color-border); border-radius: var(--radius-lg); overflow: hidden; }
.related-parts-item + .related-parts-item { border-top: 1px solid var(--color-border); }
.related-parts-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  text-decoration: none;
  color: var(--color-text);
  font-size: 0.92rem;
  background: var(--color-bg);
  transition: background 0.12s;
}
.related-parts-link:hover { background: var(--color-surface); color: var(--color-primary); }

/* --- Gallery Page --- */
.gallery-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.85rem;
  margin-bottom: 2rem;
}
.gallery-figure { display: flex; flex-direction: column; gap: 0; }
.gallery-img-link {
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
}
.gallery-img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.22s; }
.gallery-img-link:hover .gallery-img { transform: scale(1.04); }
.gallery-caption {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  padding: 0.4rem 0.1rem 0;
  text-align: center;
}
.gallery-notes { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--color-border); }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--color-text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

/* --- Parts Notes Aside --- */
.parts-notes {
  background: var(--color-surface);
  border-left: 4px solid var(--color-primary);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1rem 1.25rem;
  margin-top: 1.5rem;
  font-size: 0.92rem;
}

/* --- Parts Description --- */
.parts-description { margin-bottom: 1.5rem; font-size: 0.97rem; }

/* --- Licenses Page --- */
.license-block {
  margin-bottom: 2.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.license-block-header {
  background: var(--color-surface);
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.license-block-title { font-size: 1.05rem; font-weight: 700; margin: 0; }
.license-text {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.7;
  padding: 1.25rem;
  overflow-x: auto;
  overflow-y: auto;
  max-height: 420px;
  background: #fafafa;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  color: var(--color-text);
}

/* --- Intro cards on home / listing --- */
.feature-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-block: 2.5rem;
}
.feature-item {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  border: 1px solid var(--color-border);
}
.feature-icon {
  width: 36px;
  height: 36px;
  color: var(--color-primary);
  margin-bottom: 0.75rem;
}
.feature-item h3 { font-size: 1rem; margin-bottom: 0.35rem; }
.feature-item p  { font-size: 0.875rem; color: var(--color-text-muted); margin: 0; }

/* --- Vehicle body content --- */
.vehicle-body { margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--color-border); }
.vehicle-body h2 { margin-top: 1.5rem; }
.vehicle-body p, .vehicle-body ul, .vehicle-body ol { font-size: 0.95rem; }
.vehicle-body ul { list-style: disc; padding-left: 1.5rem; margin-bottom: 1rem; }

/* --- Footer --- */
.site-footer {
  background: var(--color-footer-bg);
  color: var(--color-footer-text);
  padding: 1.25rem 0;
  font-size: 0.83rem;
  margin-top: auto;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.footer-link { color: var(--color-footer-text); transition: color 0.12s; }
.footer-link:hover { color: #fff; }

/* --- Contribute Link (header, top-right) ---
   Edit here to change appearance: color, size, border, spacing.        */
.contribute-link {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  color: var(--color-nav-text);       /* text + icon colour */
  background: rgba(255,255,255,.08);  /* subtle background pill */
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;               /* pill shape; set to var(--radius) for square */
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.contribute-link:hover {
  background: rgba(255,255,255,.18);
  border-color: rgba(255,255,255,.35);
  color: #fff;
}
.contribute-icon {
  flex-shrink: 0;
  /* icon size is set via width/height on the element; override here if needed */
}

/* --- Responsive --- */
@media (max-width: 700px) {
  :root { --nav-height: 56px; }

  .nav-toggle { display: flex; }
  .contribute-label { display: none; }  /* icon only on mobile */
  .contribute-link { padding: 0.35rem 0.5rem; }

  .site-nav {
    display: none;
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: #1a1a1a;
    overflow-y: auto;
    padding: 1rem;
    flex-direction: column;
    align-items: stretch;
  }
  .site-nav.is-open { display: flex; }

  .nav-list {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }
  .nav-link {
    padding: 0.9rem 0.75rem;
    border-radius: 0;
    border-bottom: 1px solid rgba(255,255,255,.06);
    font-size: 1rem;
    justify-content: space-between;
  }
  .nav-dropdown {
    display: block;
    position: static;
    background: rgba(255,255,255,.05);
    border: none;
    box-shadow: none;
    border-radius: 0;
    padding: 0;
  }
  .nav-dropdown-link {
    padding: 0.7rem 1.5rem;
    font-size: 0.95rem;
    border-bottom: 1px solid rgba(255,255,255,.04);
  }

  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .card-grid { grid-template-columns: 1fr; }
  .feature-strip { grid-template-columns: 1fr 1fr; }
  .specs-table th { width: 45%; font-size: 0.82rem; }
  .specs-table td { font-size: 0.85rem; }
  .footer-inner { flex-direction: column; text-align: center; }
  .gallery-page-header { flex-direction: column; }
}

@media (max-width: 420px) {
  .feature-strip { grid-template-columns: 1fr; }
  .vehicle-gallery-previews { grid-template-columns: 1fr; }
}

/* --- Utility --- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}
