/* ============================================================
   Semi-Truck Wreck Attorney Blog
   Re-Optimized Layout, Performance & Accessibility Styles
   ============================================================ */

/* ---------------- Design Tokens (Variables) ---------------- */
:root {
  --font-base: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --c-bg: #f5f7fa;
  --c-surface: #ffffff;
  --c-surface-accent: #eef5ff;
  --c-border: #e1e7ed;
  --c-text: #1f2b37;
  --c-text-soft: #5a6a79;
  --c-accent: #1559c7;
  --c-accent-hover: #0d47a1;
  --c-danger: #d93025;
  --radius: 10px;
  --shadow: 0 2px 6px rgba(0,0,0,.07);
  --shadow-hover: 0 5px 18px -2px rgba(27,42,57,.20);
  --layout-max: 1200px;
  --transition: .2s ease-in-out;
}

/* --- Dark Mode Colors --- */
@media (prefers-color-scheme: dark) {
  :root {
    --c-bg: #101921;
    --c-surface: #1d2a34;
    --c-surface-accent: #22394a;
    --c-border: #2e4350;
    --c-text: #e8f0f5;
    --c-text-soft: #9cb1bf;
    --shadow: 0 2px 6px rgba(0,0,0,.55);
    --shadow-hover: 0 6px 18px -3px rgba(0,0,0,.7);
  }
  body { color-scheme: dark; }
}

/* ---------------- Base & Typography ---------------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-base);
  background: var(--c-bg);
  color: var(--c-text);
  line-height: 1.65;
  font-size: 17px;
}
@media (max-width: 768px) {
  body { font-size: 16px; }
}

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

h1, h2, h3, h4 {
  font-weight: 700;
  line-height: 1.3;
  margin: 1.5em 0 .8em;
  text-wrap: balance;
}
h1 { font-size: clamp(2rem, 5vw, 2.5rem); }
h2 { font-size: clamp(1.5rem, 4vw, 1.9rem); }
h3 { font-size: clamp(1.2rem, 3vw, 1.4rem); }
p  { margin: 0 0 1.2em; max-width: 75ch; }

/* ---------------- Layout & Structure ---------------- */
.site-header, .site-footer {
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  text-align: center;
  padding: 1.5rem 1rem;
}
.site-footer {
  border-top: 1px solid var(--c-border);
  margin-top: 3rem;
  font-size: 0.9em;
  color: var(--c-text-soft);
}
.tagline {
  margin: .25rem 0 0;
  color: var(--c-text-soft);
}

.post-wrapper {
  max-width: var(--layout-max);
  margin: 2rem auto;
  padding: 0 1rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 2.5rem;
}
.post-content {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: clamp(1.5rem, 5vw, 2.5rem);
  box-shadow: var(--shadow);
}
@media (max-width: 1024px) {
  .post-wrapper { grid-template-columns: 1fr; }
}

/* ---------------- Content & Article Styles ---------------- */
.article-body img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 2em auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.article-body ul, .article-body ol {
  padding-left: 1.5em;
}
.article-body li {
  margin-bottom: 0.5em;
}
.post-meta {
  font-size: 0.8em;
  text-transform: uppercase;
  color: var(--c-text-soft);
  margin-bottom: 1.5rem;
  font-weight: 600;
}

/* ---------------- Ads & Monetization ---------------- */
.ad-container, .post-ad {
  margin: 2rem auto;
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--c-bg);
  min-height: 90px;
  text-align: center;
}

/* Affiliate Call-to-Action Box */
.affiliate-cta-box {
    background-color: var(--c-surface-accent);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 1.5rem 2rem;
    margin: 2.5rem 0;
    text-align: center;
    box-shadow: var(--shadow);
}
.affiliate-cta-box h3 {
    margin-top: 0;
    color: var(--c-text);
    font-size: 1.4em;
}
.cta-button {
    display: inline-block;
    background-color: var(--c-danger);
    color: #fff !important;
    padding: 14px 28px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    margin-top: 1rem;
    transition: background-color var(--transition), transform var(--transition);
}
.cta-button:hover {
    background-color: #a51818;
    transform: translateY(-2px);
    text-decoration: none;
}

/* Affiliate Sidebar Banner */
.affiliate-sidebar-banner {
    background: var(--c-surface-accent);
    padding: 1.5rem;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    text-align: center;
    margin-bottom: 1.5rem;
}
.affiliate-sidebar-banner h4 {
    margin-top: 0;
    font-size: 1.2em;
}

/* ---------------- Responsive Video Container ---------------- */
.video-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    max-width: 100%;
    margin: 2em 0;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}