/*
Theme Name: XchangeCar
Theme URI: https://xchangecar.com/blog
Author: XchangeCar Team
Author URI: https://xchangecar.com
Description: Official custom WordPress SEO blog theme for XchangeCar, designed with technical blueprint aesthetic, OKLCH color tokens, Barlow typography, and vehicle swap CTAs.
Version: 1.0.0
License: Proprietary / XchangeCar
Text Domain: xchangecar
*/

:root {
  --color-bg: #f2f2f3;
  --color-surface: #e9e9ea;
  --color-text: #1d1f20;
  --color-accent: #5980a6;
  --color-accent-2: #728fab;
  --color-divider: color-mix(in srgb, #1d1f20 16%, transparent);

  /* Semantic aliases */
  --color-cta: oklch(62% 0.16 45);
  --color-cta-hover: oklch(56% 0.16 45);
  --color-cta-active: oklch(50% 0.16 45);
  --brand-primary: var(--color-cta);
  --brand-primary-hover: var(--color-cta-hover);
  --text-primary: #1d1f20;
  --text-muted: #7a7a7d;
  --bg-subtle: #f2f2f3;
  --border-color: #d4d4d7;
  --card-bg: #ffffff;

  /* Typography */
  --font-heading: 'Barlow Condensed', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Barlow', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Layout — mirrors .app-shell in public/css/style.css */
  --container-max: 1240px;
  --container-narrow: 840px;
  --container-gutter: 24px;
  /* Horizontal padding that keeps full-bleed bars aligned with the 1240px shell */
  --shell-inset: max(24px, calc((100% - 1240px) / 2 + 24px));
  --shadow-sm: 0 1px 2px color-mix(in srgb, #2b2b2d 14%, transparent);
  --radius-md: 4px;
  --font-heading-weight: 600;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

/* Typography elements */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.15;
  color: var(--color-text);
  letter-spacing: -0.01em;
}

a {
  color: var(--brand-primary);
  text-decoration: none;
  transition: color 0.15s ease;
}

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

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Blueprint Corner Elements */
.blueprint {
  position: relative;
}

.blueprint .corner {
  position: absolute;
  width: 5px;
  height: 5px;
  border-color: var(--color-accent);
  border-style: solid;
  pointer-events: none;
}

.blueprint .corner.tl {
  top: -1px;
  left: -1px;
  border-width: 2px 0 0 2px;
}

.blueprint .corner.tr {
  top: -1px;
  right: -1px;
  border-width: 2px 2px 0 0;
}

.blueprint .corner.bl {
  bottom: -1px;
  left: -1px;
  border-width: 0 0 2px 2px;
}

.blueprint .corner.br {
  bottom: -1px;
  right: -1px;
  border-width: 0 2px 2px 0;
}

/* Country Badge */
.brand-country-badge {
  background: var(--color-accent);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
  letter-spacing: 0.05em;
  display: inline-block;
  vertical-align: middle;
}

/* Layout Containers */
.blog-container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--container-gutter);
}

.blog-container-narrow {
  max-width: var(--container-narrow);
  margin: 0 auto;
  padding: 0 20px;
}

/* Main App Navigation */
.app-nav {
  display: flex;
  align-items: center;
  gap: 13.6px;
  padding-top: 10.2px;
  padding-bottom: 10.2px;
  padding-left: var(--shell-inset);
  padding-right: var(--shell-inset);
  border-bottom: 1px solid var(--color-divider);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 20;
}

.nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

/* The brand carries .nav-link for parity with the main site markup, but must not
   inherit the nav link's vertical padding — that would make the bar taller. */
.nav-brand.nav-link {
  padding: 0;
  opacity: 1;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-left: auto;
}

.nav-link {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  text-decoration: none;
  opacity: 0.75;
  transition: opacity 0.15s ease, color 0.15s ease;
  position: relative;
  padding: 6px 0;
}

.nav-link:hover, .nav-link.active {
  opacity: 1;
  color: var(--color-text);
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--brand-primary);
}

.nav-auth {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 14px;
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--color-text);
  cursor: pointer;
  padding: 6px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6.8px 12.24px;
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: var(--font-heading-weight);
  line-height: 1.2;
  color: var(--color-text);
  text-decoration: none;
  cursor: pointer;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  transition: all 0.15s ease;
}

.btn svg { display: block; }

.btn-primary {
  background: var(--brand-primary);
  color: #ffffff;
  border-color: var(--brand-primary);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

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

.btn-secondary {
  color: var(--color-text);
  border-color: var(--color-divider);
}

.btn-secondary:hover {
  background: color-mix(in srgb, var(--color-text) 7%, transparent);
  color: var(--color-text);
}

.btn-secondary:active {
  background: color-mix(in srgb, var(--color-text) 14%, transparent);
}

.btn-block {
  width: 100%;
  margin-top: 6.8px;
}

/* Ghost / icon variants — mirrors .btn-ghost and .btn-icon in public/css/style.css */
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--color-accent);
  padding-inline: 3.4px;
}

.btn-ghost:hover {
  background: color-mix(in srgb, var(--color-accent) 10%, transparent);
  color: var(--color-accent);
}

.btn-ghost:active {
  background: color-mix(in srgb, var(--color-accent) 18%, transparent);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
}

/* Declared after .btn so the burger stays hidden on desktop (matches main site) */
.nav-burger {
  display: none;
}

/* Blog Hero Banner */
.blog-hero {
  padding: 48px 0 36px;
  border-bottom: 1px solid var(--color-divider);
  background: linear-gradient(180deg, var(--color-surface) 0%, var(--color-bg) 100%);
  margin-bottom: 40px;
}

.blog-hero-kicker {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-accent);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.blog-hero-title {
  font-size: 48px;
  letter-spacing: -0.02em;
  margin-bottom: 14px;
}

.blog-hero-desc {
  font-size: 18px;
  color: var(--text-muted);
  max-width: 680px;
  line-height: 1.5;
}

/* Category Filter Tabs */
.category-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 12px;
  margin-bottom: 32px;
  scrollbar-width: thin;
}

.category-tab {
  padding: 7px 15px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 4px;
  background: var(--color-surface);
  color: var(--color-text);
  text-decoration: none;
  white-space: nowrap;
  border: 1px solid var(--border-color);
  transition: all 0.15s ease;
}

.category-tab:hover, .category-tab.active {
  background: var(--color-text);
  color: #ffffff;
  border-color: var(--color-text);
}

/* Blog Article Cards Grid */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  margin-bottom: 60px;
}

.blog-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  overflow: hidden;
}

.blog-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.06);
}

.blog-card-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--color-surface);
  overflow: hidden;
}

.blog-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.25s ease;
}

.blog-card:hover .blog-card-media img {
  transform: scale(1.03);
}

.blog-card-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #e4e7eb 0%, #cfd7df 100%);
  color: var(--color-accent);
}

.blog-card-body {
  padding: 22px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.blog-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.blog-card-category {
  color: var(--brand-primary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.blog-card-title {
  font-size: 22px;
  margin-bottom: 10px;
  line-height: 1.25;
}

.blog-card-title a {
  color: var(--color-text);
  text-decoration: none;
}

.blog-card-title a:hover {
  color: var(--brand-primary);
}

.blog-card-excerpt {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 18px;
  flex-grow: 1;
}

.blog-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 14px;
  border-top: 1px solid var(--color-divider);
  font-size: 13px;
  font-weight: 600;
}

.blog-card-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--brand-primary);
}

/* Pagination */
.blog-pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 40px 0 60px;
}

.blog-pagination .page-numbers {
  padding: 8px 14px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  color: var(--color-text);
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
}

.blog-pagination .page-numbers.current {
  background: var(--color-text);
  color: #ffffff;
  border-color: var(--color-text);
}

/* Single Article Layout */
.single-article {
  padding-bottom: 60px;
}

.article-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  margin: 24px 0 16px;
}

.article-breadcrumbs a {
  color: var(--text-muted);
}

.article-header {
  margin-bottom: 32px;
}

.article-category-badge {
  display: inline-block;
  background: color-mix(in srgb, var(--brand-primary) 12%, transparent);
  color: var(--brand-primary);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 16px;
}

.article-title {
  font-size: 46px;
  line-height: 1.1;
  margin-bottom: 18px;
}

.article-meta-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 13px;
  color: var(--text-muted);
  padding: 14px 0;
  border-top: 1px solid var(--color-divider);
  border-bottom: 1px solid var(--color-divider);
}

.article-featured-image {
  margin: 32px 0;
  border: 1px solid var(--border-color);
  overflow: hidden;
  background: var(--color-surface);
}

.article-featured-image img {
  width: 100%;
  height: auto;
}

.article-content {
  font-size: 17px;
  line-height: 1.75;
  color: #242729;
}

.article-content p {
  margin-bottom: 22px;
}

.article-content h2 {
  font-size: 32px;
  margin: 40px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-divider);
}

.article-content h3 {
  font-size: 24px;
  margin: 28px 0 12px;
}

.article-content ul, .article-content ol {
  margin: 0 0 22px 24px;
}

.article-content li {
  margin-bottom: 8px;
}

.article-content blockquote {
  border-left: 3px solid var(--brand-primary);
  padding: 16px 20px;
  margin: 24px 0;
  background: var(--color-surface);
  font-style: italic;
  font-size: 18px;
}

.article-content h3 + p,
.article-content h2 + p {
  margin-top: 0;
}

/* Inline data tables (e.g. state tax comparisons) */
.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 28px;
  font-size: 15px;
}

.article-content caption {
  text-align: left;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.article-content th, .article-content td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-divider);
  vertical-align: top;
}

.article-content th {
  font-family: var(--font-heading);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border-color);
}

.article-content table tbody tr:last-child td {
  border-bottom: none;
}

/* Tip / warning callouts inside long-form articles */
.article-callout {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 16px 18px;
  margin: 8px 0 28px;
  background: var(--color-surface);
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--color-accent);
}

.article-callout.warn {
  border-left-color: var(--brand-primary);
}

.article-callout-icon {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  color: var(--color-accent);
}

.article-callout.warn .article-callout-icon {
  color: var(--brand-primary);
}

.article-callout p {
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
}

.article-callout strong {
  display: block;
  font-family: var(--font-heading);
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 4px;
  color: var(--color-text);
}

@media (max-width: 640px) {
  .article-content table { font-size: 13.5px; }
  .article-content th, .article-content td { padding: 8px 10px; }
}

/* CTA Blocks Embedded in Articles */
.article-cta-box {
  background: var(--color-surface);
  border: 1px solid var(--border-color);
  padding: 28px;
  margin: 36px 0;
}

.article-cta-header {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-accent);
  margin-bottom: 8px;
}

.article-cta-title {
  font-size: 26px;
  margin-bottom: 8px;
}

.article-cta-desc {
  font-size: 15px;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.5;
}

.article-cta-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* Social Sharing */
.article-share-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 20px 0;
  margin-top: 40px;
  border-top: 1px solid var(--color-divider);
  border-bottom: 1px solid var(--color-divider);
}

.article-share-buttons {
  display: flex;
  gap: 10px;
}

/* App Footer */
.app-footer {
  border-top: 1px solid var(--color-divider);
  padding-top: 32px;
  padding-bottom: 32px;
  padding-left: var(--shell-inset);
  padding-right: var(--shell-inset);
  background: var(--color-surface);
  margin-top: auto;
  font-size: 13px;
}

/* The footer bar already carries the shell inset, so the inner container must not pad again */
.app-footer .blog-container {
  max-width: none;
  margin: 0;
  padding: 0;
}

.footer-nav {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.footer-nav a {
  color: var(--color-text);
  opacity: 0.85;
}

.footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  opacity: 0.6;
  font-size: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid color-mix(in srgb, var(--color-divider) 50%, transparent);
}

/* Mobile Slide-out Drawer */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
  z-index: 998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.drawer-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 280px;
  background: var(--color-bg);
  box-shadow: -4px 0 20px rgba(0,0,0,0.15);
  z-index: 999;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transform: translateX(105%);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.drawer-link {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
  padding: 10px 0;
  border-bottom: 1px solid var(--color-divider);
  text-decoration: none;
}

/* Responsive Breakpoints matching AGENTS.md */
@media (max-width: 992px) {
  .blog-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .blog-hero-title {
    font-size: 40px;
  }
}

@media (max-width: 860px) {
  .nav-links, .nav-link, .nav-auth {
    display: none;
  }
  .mobile-menu-btn,
  .nav-burger {
    display: inline-flex;
    margin-left: auto;
  }
}

@media (max-width: 768px) {
  .blog-grid {
    grid-template-columns: 1fr;
  }
  .blog-hero {
    padding: 32px 0 24px;
  }
  .blog-hero-title {
    font-size: 32px;
  }
  .article-title {
    font-size: 32px;
  }
  .article-content {
    font-size: 16px;
  }
}

@media (max-width: 520px) {
  .blog-container {
    padding: 0 16px;
  }
}

@media (max-width: 480px) {
  .blog-hero-title {
    font-size: 28px;
  }
  .article-title {
    font-size: 26px;
  }
  .article-cta-box {
    padding: 20px 16px;
  }
}
