/*
 * blog-post.css
 * Loaded only on /blogs/* pages — zero impact on main SPA.
 * Shares CSS variables from the main site's :root via style.css.
 */

/* ── Base ───────────────────────────────────────────────────────────────────── */
:root {
  --ice:    #dff0f7;
  --frost:  #b8dff0;
  --sky:    #6ab8d9;
  --deep:   #1a4a6b;
  --ink:    #0d2535;
  --snow:   #f7fbfd;
  --mist:   #e8f4f9;
  --accent: #ff6b35;
  --gold:   #f0c040;
  --white:  #ffffff;
  --gray:   #8ba8b8;
  --shadow: rgba(26,74,107,0.12);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--snow);
  color: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Nav (identical to main site) ──────────────────────────────────────────── */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: rgba(247,251,253,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--frost);
  padding: 0 2rem;
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.logo {
  font-family: 'Fraunces', serif;
  font-weight: 700; font-size: 1.3rem;
  color: var(--deep);
  display: flex; align-items: center; gap: 0.5rem;
  text-decoration: none;
}
.logo span { color: var(--sky); }
.nav-links { display: flex; gap: 0.25rem; }
.nav-links a {
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  font-size: 0.875rem; font-weight: 500;
  color: var(--deep); text-decoration: none;
  transition: background 0.2s;
}
.nav-links a:hover  { background: var(--ice); }
.nav-links a.active { background: var(--ice); color: var(--sky); }

/* ── Footer (identical to main site) ───────────────────────────────────────── */
footer { background: var(--ink); padding: 2.5rem 2rem; margin-top: 4rem; }
.footer-inner {
  max-width: 960px; margin: 0 auto;
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1.5rem;
}
.footer-logo { font-family: 'Fraunces', serif; font-size: 1.1rem; color: white; font-weight: 700; }
.footer-logo span { color: var(--sky); }
.footer-links { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.footer-links a {
  font-size: 0.85rem; color: var(--gray);
  text-decoration: none; transition: color 0.2s;
}
.footer-links a:hover { color: var(--sky); }
.footer-copy { font-size: 0.8rem; color: var(--gray); }

/* ── Page shell ─────────────────────────────────────────────────────────────── */
.post-main {
  max-width: 760px;
  margin: 0 auto;
  padding: 88px 1.5rem 4rem;
}

/* Fix 1: breadcrumb — stop items spreading to full width */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.25rem;
  font-size: 0.85rem;
  color: var(--blue);
  margin-bottom: 2rem;
  width: auto;
}
.breadcrumb a { color: var(--sky); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb span { color: var(--blue); }

/* Fix 2: TOC — override the global nav { position:fixed } rule */
nav.toc {
  position: static !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  backdrop-filter: none !important;
  border-bottom: none !important;
  height: auto !important;
  display: block;
  width: 100%;
  box-sizing: border-box;
  background: var(--mist);
  border: 1px solid var(--frost) !important;
  border-radius: 14px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 2.5rem;
  z-index: auto !important;
}

/* ── Article header ─────────────────────────────────────────────────────────── */
.post-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 1rem; }
.post-tag {
  display: inline-block; background: var(--ice); border-radius: 6px;
  padding: 0.2rem 0.65rem; font-size: 0.78rem; color: var(--sky);
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
}

.post-title {
  font-family: 'Fraunces', serif;
  font-size: clamp(1.9rem, 4.5vw, 2.75rem);
  font-weight: 700; line-height: 1.18;
  color: var(--deep); margin-bottom: 1rem;
}

.post-meta {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  font-size: 0.84rem; color: var(--gray);
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--ice);
  margin-bottom: 2rem;
}
.post-meta time { font-weight: 500; }
.post-meta .read-time::before { content: '·'; margin-right: 1rem; }

/* ── Article body ────────────────────────────────────────────────────────────── */
.post-body { font-size: 1.05rem; line-height: 1.8; color: var(--ink); }

.post-body h2 {
  font-family: 'Fraunces', serif;
  font-size: 1.6rem; font-weight: 700; color: var(--deep);
  margin: 2.5rem 0 0.85rem; line-height: 1.25;
  scroll-margin-top: 80px;
}
.post-body h3 {
  font-size: 1.15rem; font-weight: 700; color: var(--deep);
  margin: 1.75rem 0 0.5rem;
  scroll-margin-top: 80px;
}
.post-body p { margin-bottom: 1.25rem; }

.post-body ul, .post-body ol {
  padding-left: 1.5rem; margin-bottom: 1.25rem;
}
.post-body li { margin-bottom: 0.45rem; line-height: 1.7; }

.post-body a {
  color: var(--sky); text-decoration: underline;
  text-underline-offset: 3px; font-weight: 500;
}
.post-body a:hover { color: var(--deep); }

.post-body strong { font-weight: 700; color: var(--deep); }

.post-body blockquote {
  border-left: 4px solid var(--sky);
  background: var(--mist);
  padding: 1rem 1.25rem;
  margin: 1.75rem 0;
  border-radius: 0 10px 10px 0;
  font-style: italic; color: var(--deep);
}

/* Callout box */
.callout {
  background: var(--mist); border: 1px solid var(--frost);
  border-radius: 14px; padding: 1.1rem 1.3rem;
  margin: 1.75rem 0; display: flex; gap: 0.75rem; align-items: flex-start;
}
.callout-icon { font-size: 1.3rem; flex-shrink: 0; margin-top: 1px; }
.callout-body { font-size: 0.95rem; line-height: 1.65; color: var(--deep); }
.callout-body strong { display: block; margin-bottom: 0.25rem; font-size: 1rem; }

/* Data table */
.data-table {
  width: 100%; border-collapse: collapse;
  margin: 1.75rem 0; font-size: 0.9rem;
  border-radius: 12px; overflow: hidden;
  box-shadow: 0 1px 8px var(--shadow);
}
.data-table th {
  background: var(--deep); color: white;
  padding: 0.75rem 1rem; text-align: left;
  font-weight: 600; font-size: 0.83rem;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.data-table td {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--ice);
  color: var(--ink);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:nth-child(even) td { background: var(--mist); }

.post-body hr {
  border: none; border-top: 1px solid var(--ice);
  margin: 2.5rem 0;
}

/* ── Inline CTA (mid-article) ───────────────────────────────────────────────── */
.inline-cta {
  background: linear-gradient(135deg, var(--deep) 0%, #2a7aaa 100%);
  border-radius: 16px; padding: 1.5rem 1.75rem;
  margin: 2.5rem 0; display: flex; align-items: center;
  gap: 1.25rem; flex-wrap: wrap;
}
.inline-cta-text { flex: 1; min-width: 180px; }
.inline-cta-text strong { color: white; font-size: 1rem; display: block; margin-bottom: 0.25rem; }
.inline-cta-text span   { color: var(--frost); font-size: 0.88rem; }
.inline-cta-btn {
  display: inline-block;
  background: var(--gold); color: var(--deep);
  font-weight: 700; font-size: 0.92rem;
  padding: 0.7rem 1.4rem; border-radius: 10px;
  text-decoration: none; white-space: nowrap;
  transition: opacity 0.15s, transform 0.1s; flex-shrink: 0;
}
.inline-cta-btn:hover { opacity: 0.9; transform: translateY(-1px); color: var(--deep); }

/* ── Bottom CTA ─────────────────────────────────────────────────────────────── */
.post-cta {
  background: linear-gradient(135deg, var(--deep) 0%, #0d2535 100%);
  border-radius: 20px; padding: 2rem 2.25rem;
  margin: 3rem 0 2rem; text-align: center;
}
.post-cta h3 {
  font-family: 'Fraunces', serif;
  font-size: 1.5rem; color: white; margin-bottom: 0.5rem;
}
.post-cta p { color: var(--frost); font-size: 0.95rem; margin-bottom: 1.25rem; }
.cta-btn-large {
  display: inline-block;
  background: var(--gold); color: var(--deep);
  font-weight: 700; font-size: 1.05rem;
  padding: 0.85rem 2rem; border-radius: 12px;
  text-decoration: none;
  transition: opacity 0.15s, transform 0.1s;
}
.cta-btn-large:hover { opacity: 0.9; transform: translateY(-2px); color: var(--deep); }

/* ── Related posts ──────────────────────────────────────────────────────────── */
.related-section { margin-top: 3rem; }
.related-section h2 {
  font-family: 'Fraunces', serif;
  font-size: 1.25rem; color: var(--deep);
  margin-bottom: 1.25rem;
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}
.related-card {
  background: white; border: 1px solid var(--ice);
  border-radius: 12px; padding: 1.1rem;
  text-decoration: none; display: block;
  transition: box-shadow 0.2s, transform 0.15s;
}
.related-card:hover { box-shadow: 0 4px 16px var(--shadow); transform: translateY(-2px); }
.related-card-title {
  font-size: 0.92rem; font-weight: 600;
  color: var(--deep); line-height: 1.35; margin-bottom: 0.4rem;
}
.related-card time { font-size: 0.78rem; color: var(--gray); }

/* ── Blog index page ────────────────────────────────────────────────────────── */
.blog-index-main {
  max-width: 960px; margin: 0 auto;
  padding: 88px 1.5rem 4rem;
}
.blog-index-header { margin-bottom: 3rem; }
.blog-index-header h1 {
  font-family: 'Fraunces', serif;
  font-size: clamp(2rem, 5vw, 3.2rem);
  color: var(--deep); margin-bottom: 0.5rem;
}
.blog-index-header p { color: var(--gray); font-size: 1rem; line-height: 1.6; }

.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.75rem;
}
.blog-card {
  background: white; border: 1px solid var(--ice);
  border-radius: 16px; overflow: hidden;
  transition: box-shadow 0.2s, transform 0.15s;
  display: flex; flex-direction: column;
}
.blog-card:hover { box-shadow: 0 8px 28px var(--shadow); transform: translateY(-3px); }
.blog-card-body { padding: 1.4rem; flex: 1; display: flex; flex-direction: column; gap: 0.6rem; }
.blog-card-tags { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.blog-card-title {
  font-size: 1.1rem; font-weight: 700;
  color: var(--deep); line-height: 1.35; margin: 0;
}
.blog-card-desc {
  font-size: 0.9rem; color: var(--gray);
  line-height: 1.55; flex: 1;
}
.blog-card-footer {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 0.85rem; border-top: 1px solid var(--ice);
  margin-top: auto;
}
.blog-card-footer time { font-size: 0.8rem; color: var(--gray); }
.blog-card-link {
  display: inline-block;
  font-size: 0.85rem; font-weight: 600; color: var(--sky);
  text-decoration: none;
}
.blog-card-link:hover { color: var(--deep); }
a.blog-card-wrap { text-decoration: none; }

/* Focus states */
:focus-visible { outline: 3px solid var(--sky); outline-offset: 3px; border-radius: 4px; }
:focus:not(:focus-visible) { outline: none; }

/* ── Blog card images ───────────────────────────────────────────────────────── */
.blog-card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  object-position: center;
  display: block;
  border-radius: 16px 16px 0 0;
}
.blog-card-image-wrap {
  background: linear-gradient(135deg, var(--deep) 0%, #2a7aaa 100%);
  border-radius: 16px 16px 0 0;
  overflow: hidden;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.blog-card-image-wrap .fallback-icon {
  font-size: 3rem;
  opacity: 0.4;
}

/* ── Blog post hero image ───────────────────────────────────────────────────── */
.post-hero-image {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  object-position: center;
  border-radius: 16px;
  margin-bottom: 2rem;
  display: block;
}
.post-image-caption {
  text-align: center;
  font-size: 0.82rem;
  color: var(--gray);
  margin-top: -1.5rem;
  margin-bottom: 2rem;
  font-style: italic;
}

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  nav { padding: 0 1rem; }
  .post-main { padding: 80px 1.1rem 3rem; }
  .blog-index-main { padding: 80px 1.1rem 3rem; }
  .blog-grid { grid-template-columns: 1fr; }
  .related-grid { grid-template-columns: 1fr; }
  .inline-cta { flex-direction: column; }
  .post-cta { padding: 1.5rem 1.25rem; }
  .data-table { font-size: 0.82rem; }
  .data-table th, .data-table td { padding: 0.6rem 0.75rem; }

  /*
   * Mobile blog nav: keep only logo + Predict (/) + Blog (/blogs/).
   * About, FAQ, Contact are all reachable via the footer.
   * Pure CSS — zero JS, zero new files.
   */
  .nav-links a:not([href="/"]):not([href="/blogs/"]) {
    display: none;
  }
}