/* ============================================================
   BigLobster — Blog Design System
   ============================================================
   Comprehensive CSS for blog index (listing) and individual
   articles. Works alongside style.css, style-dark.css, and
   style-mobile.css.
   ============================================================ */

/* ── BLOG INDEX ── */

/* Blog hero (listing page) */
.blog-hero {
  margin-bottom: 6.4rem;
  padding-bottom: 4rem;
  border-bottom: 1px solid var(--border);
}

.blog-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 5vw, 4.8rem);
  line-height: 1.1;
  color: var(--text-primary);
  letter-spacing: -.025em;
  margin-bottom: 1.6rem;
  max-width: 80rem;
}

.blog-hero p {
  font-size: clamp(1.6rem, 2vw, 2rem);
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 72rem;
}

/* Blog grid */
.blog-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3.2rem;
  margin-bottom: 8rem;
}

@media (min-width: 768px) {
  .blog-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 4rem;
  }
}

@media (min-width: 1024px) {
  .blog-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 4rem;
  }
}

/* Blog card */
.blog-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s var(--ease);
  height: 100%;
  display: flex;
  flex-direction: column;
}

.blog-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .08);
  border-color: var(--accent);
}

[data-theme="dark"] .blog-card:hover {
  box-shadow: 0 12px 32px rgba(0, 0, 0, .2);
}

.blog-card-content {
  padding: 2.4rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.blog-card h2 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 1.8vw, 1.8rem);
  line-height: 1.3;
  color: var(--text-primary);
  letter-spacing: -.01em;
  margin-bottom: 1.2rem;
  margin-top: 0;
}

.blog-card h2 a {
  color: inherit;
  text-decoration: none;
  transition: color .2s;
}

.blog-card h2 a:hover {
  color: var(--accent);
}

.blog-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  margin-bottom: 1.2rem;
}

.blog-card-badge {
  display: inline-block;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-light);
  padding: .3rem .8rem;
  border-radius: 4px;
  line-height: 1.3;
}

.blog-card .blog-date {
  font-size: 1.3rem;
  color: var(--text-muted);
  margin-bottom: 1.2rem;
  order: -1;
}

.blog-card .blog-excerpt {
  font-size: 1.45rem;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 2rem;
  flex: 1;
}

.blog-card-footer {
  margin-top: auto;
  padding-top: 1.6rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: .8rem;
  align-items: stretch;
}

.blog-card-footer .blog-reading-time {
  font-size: 1.2rem;
  font-weight: 500;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-light);
  padding: .4rem 1rem;
  border-radius: 4px;
  display: inline-block;
  align-self: flex-start;
}

.blog-card-footer .blog-read-link,
.blog-card-footer .btn-primary {
  display: block;
  text-align: center;
  font-size: 1.4rem;
  font-weight: 600;
  padding: .8rem 1.6rem;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  transition: background .2s, transform .2s;
}

.blog-card-footer .blog-read-link:hover,
.blog-card-footer .btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

/* Article tags (also used in listing page) */
.article-tag {
  display: inline-block;
  font-size: 1.2rem;
  font-weight: 500;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-light);
  padding: .4rem 1rem;
  border-radius: 4px;
  transition: background .2s, color .2s;
}

.article-tag:hover {
  background: var(--accent);
  color: #fff;
}

/* ── ARTICLE DETAIL ── */

/* Article Hero (individual article) */
.article-hero {
  margin-bottom: 4.8rem;
  padding-bottom: 3.2rem;
  border-bottom: 1px solid var(--border);
}

.article-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 1.15;
  color: var(--text-primary);
  letter-spacing: -.02em;
  margin-bottom: 1.6rem;
}

.article-hero .article-meta {
  font-size: 1.4rem;
  color: var(--text-muted);
  margin-bottom: 0;
  display: flex;
  gap: 1.6rem;
}

.article-hero .article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .8rem;
  margin-top: 1.6rem;
}

.article-cover {
  margin: 1.5rem 0 2rem;
}
.article-cover img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  display: block;
}

/* Article Body */
.article-body {
  max-width: 70ch;
  margin-inline: auto;
  line-height: 1.8;
  font-size: 1.7rem;
}

.article-body p {
  margin-bottom: 2rem;
  color: var(--text-secondary);
}

.article-body p:last-child {
  margin-bottom: 0;
}

.article-body h2 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 2.5vw, 2.2rem);
  color: var(--text-primary);
  letter-spacing: -.01em;
  margin-top: 4.8rem;
  margin-bottom: 1.6rem;
  line-height: 1.25;
}

.article-body h3 {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 2vw, 1.8rem);
  color: var(--text-primary);
  margin-top: 3.2rem;
  margin-bottom: 1.2rem;
  line-height: 1.3;
}

.article-body h2:first-child {
  margin-top: 0;
}

.article-body ul,
.article-body ol {
  margin-bottom: 2rem;
  padding-left: 2.4rem;
}

.article-body li {
  margin-bottom: .8rem;
  color: var(--text-secondary);
}

.article-body li::marker {
  color: var(--accent);
}

.article-body ul li {
  list-style-type: disc;
}

.article-body ol li {
  list-style-type: decimal;
}

.article-body strong {
  color: var(--text-primary);
  font-weight: 600;
}

.article-body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color .2s;
}

.article-body a:hover {
  color: var(--accent-hover);
}

.article-body img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 2.4rem auto;
  border-radius: 8px;
}

.article-body blockquote {
  margin: 2.4rem 0;
  padding: 1.6rem 2rem;
  border-left: 3px solid var(--accent);
  background: var(--bg-subtle);
  border-radius: 0 4px 4px 0;
  font-style: italic;
  color: var(--text-secondary);
  line-height: 1.7;
}

.article-body blockquote p {
  margin-bottom: 0;
}

.article-body code {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: .9em;
  background: var(--bg-subtle);
  padding: .2rem .5rem;
  border-radius: 3px;
  color: var(--accent);
}

.article-body pre {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2rem;
  overflow-x: auto;
  margin-bottom: 2rem;
}

.article-body pre code {
  background: none;
  padding: 0;
  font-size: .85em;
  color: var(--text-secondary);
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 2rem;
  font-size: 1.5rem;
}

.article-body th,
.article-body td {
  padding: 1rem 1.2rem;
  border: 1px solid var(--border);
  text-align: left;
}

.article-body th {
  background: var(--bg-subtle);
  font-weight: 600;
  color: var(--text-primary);
}

.article-body td {
  color: var(--text-secondary);
}

/* Pull Quote */
.pull-quote {
  margin: 4rem 0;
  padding: 2.4rem 3.2rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 0 8px 8px 0;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 2vw, 1.9rem);
  line-height: 1.5;
  color: var(--text-primary);
  font-style: italic;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.pull-quote::before {
  content: '"';
  position: absolute;
  top: .4rem;
  left: 1rem;
  font-size: 3.6rem;
  line-height: 1;
  color: var(--accent);
  opacity: .25;
  font-family: var(--font-display);
}

.pull-quote p {
  margin: 0;
}

.pull-quote cite {
  display: block;
  margin-top: 1.2rem;
  font-size: 1.4rem;
  font-style: normal;
  color: var(--text-muted);
  font-family: var(--font-body);
}

/* Stats Block */
.stats-block {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.6rem;
  margin: 4rem 0;
  padding: 3.2rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

@media (min-width: 640px) {
  .stats-block {
    grid-template-columns: repeat(3, 1fr);
    gap: 2.4rem;
  }
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: .4rem;
}

.stat-number {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 4vw, 3.6rem);
  color: var(--accent);
  line-height: 1.1;
  font-weight: 400;
}

.stat-label {
  font-size: 1.4rem;
  color: var(--text-secondary);
  line-height: 1.4;
  max-width: 20ch;
}

/* Section Divider */
.section-divider {
  width: 4rem;
  height: 2px;
  background: var(--accent-teal);
  opacity: .4;
  margin: 4.8rem auto;
  border-radius: 2px;
}

/* Breadcrumb */
.breadcrumb {
  font-size: 1.3rem;
  color: var(--text-muted);
  margin-bottom: 3.2rem;
  padding-bottom: 1.6rem;
  border-bottom: 1px solid var(--border);
}

.breadcrumb a {
  color: var(--accent);
  text-decoration: none;
  transition: color .2s;
}

.breadcrumb a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.breadcrumb span {
  color: var(--text-secondary);
}

/* Article Footer */
.article-footer {
  margin-top: 4.8rem;
  padding-top: 3.2rem;
  border-top: 1px solid var(--border);
  text-align: center;
}

.article-footer p {
  font-size: 1.6rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

/* ── RESPONSIVE ── */
@media (max-width: 640px) {
  .blog-hero {
    margin-bottom: 4.8rem;
    padding-bottom: 2.4rem;
  }
  
  .blog-card-content {
    padding: 1.6rem;
  }
  
  .blog-card-footer {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }
  
  .article-hero {
    margin-bottom: 3.2rem;
    padding-bottom: 2.4rem;
  }

  .article-body {
    font-size: 1.6rem;
  }

  .article-body h2 {
    margin-top: 3.2rem;
  }

  .article-body h3 {
    margin-top: 2.4rem;
  }

  .pull-quote {
    padding: 1.6rem 2rem;
    margin: 3.2rem 0;
  }

  .stats-block {
    padding: 2rem;
    margin: 3.2rem 0;
  }

  .section-divider {
    margin: 3.2rem auto;
  }

  .article-body table {
    font-size: 1.3rem;
  }

  .article-body th,
  .article-body td {
    padding: .6rem .8rem;
  }
}

/* ── DARK MODE ADJUSTMENTS ── */
[data-theme="dark"] .blog-card {
  background: var(--bg-subtle);
}

[data-theme="dark"] .pull-quote {
  background: var(--bg-subtle);
  border-left-color: var(--accent);
}

[data-theme="dark"] .stats-block {
  background: var(--bg-subtle);
}

[data-theme="dark"] .article-tag {
  color: var(--accent);
}

/* ── Blog card cover images ─────────────────────── */
.blog-card {
  overflow: hidden;
}
.blog-card-image {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--bg-subtle);
}
.blog-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s var(--ease);
}
.blog-card:hover .blog-card-image img {
  transform: scale(1.05);
}


/* ── Related articles ─────────────────────────── */
.related-articles {
  margin-top: 4rem;
  padding-top: 3rem;
  border-top: 1px solid var(--border);
}
.related-articles h2 {
  font-family: var(--font-display);
  font-size: var(--type-h2);
  margin-bottom: 2rem;
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 2rem;
}
.related-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  text-decoration: none;
  color: var(--text-primary);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}
.related-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.related-card-image {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
}
.related-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s var(--ease);
}
.related-card:hover .related-card-image img {
  transform: scale(1.05);
}
.related-card-title {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1.5rem;
  line-height: 1.4;
}

/* ── Table of Contents (ToC) ─────────────────────── */
.toc {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 2rem 2.4rem;
  margin-bottom: 3.2rem;
}
.toc__title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1.2rem;
  display: flex;
  align-items: center;
  gap: .8rem;
}
.toc__title::before {
  content: '☰';
  font-size: 1.4rem;
  color: var(--accent);
}
.toc ol {
  list-style: none;
  counter-reset: toc-counter;
  padding: 0;
  margin: 0;
}
.toc ol li {
  list-style: none;
  counter-increment: toc-counter;
  margin-bottom: .6rem;
}
.toc li::before {
  content: counter(toc-counter) '.';
  color: var(--accent);
  font-weight: 600;
  margin-right: .6rem;
  font-size: 1.3rem;
}
.toc a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 1.45rem;
  line-height: 1.5;
  transition: color .2s;
  border-bottom: 1px solid transparent;
}
.toc a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.toc .toc-h3 {
  padding-left: 1.6rem;
  counter-increment: none;
}
.toc .toc-h3::before {
  content: '·';
  font-weight: 400;
}

/* ── Article Navigation (Prev / Next) ────────────── */
.article-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.6rem;
  margin-top: 4.8rem;
  padding-top: 3.2rem;
  border-top: 1px solid var(--border);
}
.article-nav__link {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  padding: 1.6rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: border-color .2s, transform .2s;
}
.article-nav__link:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.article-nav__link--prev {
  align-items: flex-start;
}
.article-nav__link--next {
  align-items: flex-end;
  text-align: right;
}
.article-nav__label {
  font-size: 1.2rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: .4rem;
}
.article-nav__title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--text-primary);
  line-height: 1.4;
}

/* ── Article CTA ─────────────────────────────────── */
.article-cta {
  margin-top: 4.8rem;
  padding: 3.2rem;
  background: var(--accent-light);
  border: 2px solid var(--accent);
  border-radius: 12px;
  text-align: center;
}
.article-cta h2 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  color: var(--text-primary);
  margin-bottom: 1.2rem;
}
.article-cta p {
  font-size: 1.5rem;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 50ch;
  margin-inline: auto;
  margin-bottom: 2rem;
}
.article-cta .btn-primary {
  font-size: 1.5rem;
  padding: 1.2rem 2.4rem;
}

/* ── Dark mode for new components ─────────────────── */
[data-theme="dark"] .toc {
  background: var(--bg-subtle);
}
[data-theme="dark"] .article-nav__link {
  background: var(--bg-subtle);
}
[data-theme="dark"] .article-cta {
  background: var(--accent-light);
  border-color: var(--accent);
}

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 640px) {
  .toc {
    padding: 1.6rem;
  }
  .article-nav {
    grid-template-columns: 1fr;
  }
  .article-nav__link--next {
    text-align: left;
    align-items: flex-start;
  }
  .article-cta {
    padding: 2.4rem 1.6rem;
  }
}

/* ── Article Infographics ─────────────────────────── */
.article-infographic {
  margin: 3.2rem 0;
  text-align: center;
}

.article-infographic img {
  width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}

.article-infographic figcaption {
  font-size: 1.3rem;
  color: var(--text-muted);
  margin-top: 1rem;
  font-style: italic;
}

/* ── Article Summary Box ──────────────────────────── */
.article-summary {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  padding: 2rem 2.4rem;
  margin: 2.4rem 0 3.2rem;
  font-size: 1.5rem;
  line-height: 1.7;
  color: var(--text-secondary);
}

.article-summary strong {
  color: var(--text-primary);
}

[data-theme="dark"] .article-summary {
  background: var(--bg-subtle);
}

@media (max-width: 640px) {
  .article-infographic {
    margin: 2.4rem 0;
  }
  .article-summary {
    padding: 1.6rem 2rem;
    font-size: 1.4rem;
  }
}
