/* CarHunch Engineering — article layout and typography */

.article-hero {
  background: linear-gradient(180deg, var(--ch-bg-dark) 0%, var(--ch-bg-dark-2) 100%);
  padding: 3rem 1.5rem 4rem;
  color: #fff;
}

.article-hero h1 {
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 0.5rem;
}

.article-hero__subhead {
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 0.75rem;
}

.article-hero__meta {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.6);
}

/* Faded car background behind article body — viewport-sized (same as main site .ch-page-bg) */
.article-bg-wrap {
  position: relative;
  background: var(--ch-bg);
}

/* Fixed to viewport so the car stays one screen tall; content scrolls over it */
.article-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.article-bg__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  opacity: 0.2;
  filter: grayscale(1);
}

.article-bg__overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(248, 250, 252, 0.5) 50%,
    rgba(248, 250, 252, 1) 90%,
    var(--ch-bg) 100%
  );
}

.article-bg-content {
  position: relative;
  z-index: 2;
}

/* Keep header and hero above the fixed background */
.article-hero {
  position: relative;
  z-index: 5;
}

.article-body {
  font-family: 'Inter', sans-serif;
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--ch-text);
  max-width: var(--article-max-w);
  margin: 0 auto;
  padding: 3rem 1.5rem 5rem;
}

.article-body h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 3rem 0 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--ch-border);
  color: var(--ch-text);
}

.article-body h2:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

.article-body h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 2rem 0 0.75rem;
  color: var(--ch-text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tech-logo {
  height: 1.4rem;
  width: auto;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

.article-body p {
  margin-bottom: 1.25rem;
}

.pull-quote {
  border-left: 4px solid var(--ch-primary);
  background: var(--ch-bg);
  border-radius: 0 var(--ch-radius) var(--ch-radius) 0;
  padding: 1.25rem 1.5rem;
  margin: 2rem 0;
  font-size: 1.1rem;
  font-style: italic;
  color: var(--ch-text);
}

.callout {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-left: 4px solid var(--ch-primary);
  border-radius: var(--ch-radius);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  font-size: 0.95rem;
  color: #1e3a8a;
}

.callout-audience {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-left: 4px solid #0284c7;
  border-radius: var(--ch-radius);
  padding: 1.25rem 1.5rem;
  margin: 2.5rem 0;
}

.callout-audience__label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #0284c7;
  margin-bottom: 0.6rem;
}

.callout-audience p {
  margin: 0;
  font-size: 0.975rem;
  line-height: 1.7;
  color: #0c4a6e;
}

.tldr-box {
  background: var(--ch-bg);
  border: 1px solid var(--ch-border);
  border-left: 4px solid var(--ch-primary);
  border-radius: var(--ch-radius);
  padding: 1rem 1.5rem;
  margin: 2rem auto;
  font-size: 1rem;
  line-height: 1.65;
  color: var(--ch-text);
  max-width: var(--ch-max-w);
}

/* Code blocks — wrapper and language label */
pre[class*="language-"] {
  background: #1e293b;
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.88rem;
  line-height: 1.6;
  margin: 1.5rem 0;
  border: 1px solid rgba(255, 255, 255, 0.06);
  position: relative;
  padding-top: 2.25rem;
}

pre[class*="language-"]::before {
  content: attr(data-lang);
  position: absolute;
  top: 0.5rem;
  right: 1rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.45);
}

code[class*="language-"] {
  font-family: 'JetBrains Mono', monospace;
}

/* Prism token colors — One Dark–style */
.token.comment { color: #5c6370; font-style: italic; }
.token.keyword { color: #c678dd; }
.token.string { color: #98c379; }
.token.number { color: #d19a66; }
.token.function { color: #61afef; }
.token.punctuation { color: #abb2bf; }
.token.operator { color: #56b6c2; }
.token.class-name { color: #e5c07b; }
.token.boolean { color: #d19a66; }
.token.variable { color: #e06c75; }
.token.attr-name { color: #d19a66; }
.token.plain { color: #abb2bf; }

/* Inline code */
.article-body code:not([class*="language-"]) {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9em;
  background: var(--ch-bg);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  color: var(--ch-text);
}

/* Figures (graphs, diagrams) */
.article-body figure {
  margin: 2rem 0;
}

.article-body figure svg {
  width: 100%;
  height: auto;
}

.article-body figcaption {
  font-size: 0.9rem;
  color: var(--ch-muted);
  margin-top: 1rem;
  line-height: 1.5;
  font-style: italic;
}

/* Two Real Vehicles — thumbnail + text */
.article-body .vehicle-with-thumb {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  align-items: flex-start;
  margin: 2rem 0;
}

.article-body .vehicle-thumb__link {
  flex-shrink: 0;
  text-decoration: none;
  border-radius: var(--ch-radius);
  overflow: hidden;
  box-shadow: var(--ch-shadow);
}

.article-body .vehicle-thumb__link:hover {
  box-shadow: var(--ch-shadow-hover);
}

.article-body .vehicle-thumb__img {
  display: block;
  width: 240px;
  height: auto;
  object-fit: contain;
  background: var(--ch-bg);
}

.article-body .vehicle-thumb__body {
  flex: 1;
  min-width: 0;
}

.article-body .vehicle-thumb__body p:first-child {
  margin-top: 0;
}

@media (max-width: 540px) {
  .article-body .vehicle-with-thumb {
    flex-direction: column;
  }

  .article-body .vehicle-thumb__img {
    width: 100%;
    max-width: 280px;
  }
}

/* Article layout with optional ToC sidebar */
.article-wrap {
  max-width: var(--ch-max-w);
  margin: 0 auto;
  padding: 0 1.5rem;
}

@media (min-width: 1100px) {
  .article-layout {
    display: grid;
    grid-template-columns: 1fr 240px;
    gap: 3rem;
    align-items: start;
  }

  .article-body {
    max-width: none;
    padding-left: 0;
    padding-right: 0;
  }

  .ch-toc {
    position: sticky;
    top: 2rem;
    font-size: 0.875rem;
  }

  .ch-toc__title {
    font-weight: 600;
    color: var(--ch-text);
    margin-bottom: 0.75rem;
  }

  .ch-toc ul {
    list-style: none;
  }

  .ch-toc a {
    color: var(--ch-muted);
    display: block;
    padding: 0.25rem 0;
  }

  .ch-toc a:hover {
    color: var(--ch-primary);
  }
}

@media (max-width: 1099px) {
  .ch-toc {
    display: none;
  }
}
