/* ============================================================
   BLOG — style
   Scope: /blog/* (blog index + article pages)
   ============================================================ */

/* ── Reset & base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

:root {
  --blog-blue:    #1565C0;
  --blog-green:   #2E7D32;
  --blog-red:     #C62828;
  --blog-purple:  #6A1B9A;
  --blog-orange:  #E65100;
  --blog-gray:    #455A64;
  --blog-bg:      #F8FAFC;
  --blog-surface: #FFFFFF;
  --blog-border:  #E2E8F0;
  --blog-text:    #1A202C;
  --blog-muted:   #64748B;
  --blog-max-w:   1100px;
  --blog-art-w:   760px;
  --blog-radius:  12px;
  --blog-shadow:  0 2px 12px rgba(0,0,0,.08);
  --blog-shadow-hover: 0 8px 32px rgba(21,101,192,.15);
}

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--blog-bg);
  color: var(--blog-text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blog-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* ── Utility ───────────────────────────────────────────────── */
.container { max-width: var(--blog-max-w); margin: 0 auto; padding: 0 20px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ── Site header ───────────────────────────────────────────── */
.blog-site-header {
  background: #fff;
  border-bottom: 1px solid var(--blog-border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 6px rgba(0,0,0,.06);
}

.blog-site-header nav {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 60px;
}

.blog-site-header .brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--blog-blue);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.blog-site-header .brand::before {
  content: '💰';
  font-size: 1.2rem;
}

.blog-site-header .spacer { flex: 1; }

.btn-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: var(--blog-blue);
  color: #fff;
  border-radius: 8px;
  font-size: .875rem;
  font-weight: 600;
  text-decoration: none;
  transition: background .2s, transform .1s;
  white-space: nowrap;
}

.btn-cta:hover { background: #0D47A1; text-decoration: none; transform: translateY(-1px); }

/* ── Breadcrumbs ───────────────────────────────────────────── */
.blog-breadcrumbs {
  padding: 12px 0;
  font-size: .82rem;
  color: var(--blog-muted);
}

.blog-breadcrumbs a { color: var(--blog-muted); }
.blog-breadcrumbs a:hover { color: var(--blog-blue); text-decoration: none; }
.blog-breadcrumbs span { margin: 0 6px; }

/* ── Blog hero (index page) ───────────────────────────────── */
.blog-hero {
  background: linear-gradient(135deg, var(--blog-blue) 0%, #0D47A1 100%);
  color: #fff;
  padding: 64px 0 48px;
  margin-bottom: 48px;
}

.blog-hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
  margin: 0 0 12px;
  line-height: 1.2;
}

.blog-hero p {
  font-size: 1.1rem;
  opacity: .88;
  max-width: 520px;
  margin: 0 0 24px;
}

/* ── Category filters ──────────────────────────────────────── */
.blog-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 36px;
}

.filter-btn {
  padding: 7px 16px;
  border-radius: 100px;
  border: 2px solid var(--blog-border);
  background: #fff;
  color: var(--blog-gray);
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .18s;
}

.filter-btn:hover,
.filter-btn.active {
  border-color: var(--blog-blue);
  background: var(--blog-blue);
  color: #fff;
}

/* ── Article grid ──────────────────────────────────────────── */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 28px;
  margin-bottom: 56px;
}

/* Featured article — full width */
.blog-grid .article-card.featured {
  grid-column: 1 / -1;
}

/* ── Article card ──────────────────────────────────────────── */
/* Karta jest <article> (nie <a>) — klikalność przez stretched link pattern */
.article-card {
  background: var(--blog-surface);
  border-radius: var(--blog-radius);
  border: 1px solid var(--blog-border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow .2s, transform .2s;
  position: relative; /* wymagane dla stretched link */
}

.article-card:hover {
  box-shadow: var(--blog-shadow-hover);
  transform: translateY(-3px);
}

.article-card.featured {
  flex-direction: row;
}

/* Stretched link — główny link (tytuł) pokrywa całą kartę */
.card-main-link {
  color: var(--blog-text);
  text-decoration: none;
}

.card-main-link::after {
  content: '';
  position: absolute;
  inset: 0; /* top:0 right:0 bottom:0 left:0 */
  z-index: 0;
}

.card-main-link:hover { text-decoration: none; color: var(--blog-blue); }

/* Tagi muszą być nad stretched linkiem */
.article-card .tag-pill,
.article-card .read-more {
  position: relative;
  z-index: 1;
}

.article-card-img {
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, var(--blog-blue) 0%, #42A5F5 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  flex-shrink: 0;
}

.article-card.featured .article-card-img {
  width: 380px;
  aspect-ratio: auto;
  min-height: 240px;
}

.article-card-body {
  padding: 20px 24px 24px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.article-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.category-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: .75rem;
  font-weight: 600;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.reading-time {
  font-size: .8rem;
  color: var(--blog-muted);
}

.article-card h2,
.article-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 10px;
  color: var(--blog-text);
  line-height: 1.4;
}

.article-card.featured h2 {
  font-size: 1.5rem;
}

.article-card p {
  font-size: .9rem;
  color: var(--blog-muted);
  margin: 0 0 16px;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
}

.article-date {
  font-size: .8rem;
  color: var(--blog-muted);
}

.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.tag-pill {
  padding: 2px 9px;
  background: var(--blog-bg);
  border: 1px solid var(--blog-border);
  border-radius: 100px;
  font-size: .75rem;
  color: var(--blog-muted);
  text-decoration: none;
  transition: background .15s, color .15s;
}

.tag-pill:hover {
  background: var(--blog-blue);
  color: #fff;
  border-color: var(--blog-blue);
  text-decoration: none;
}

.read-more {
  font-size: .85rem;
  font-weight: 600;
  color: var(--blog-blue);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.read-more::after { content: ' →'; }
.read-more:hover { text-decoration: underline; }

/* ── Empty / loading state ─────────────────────────────────── */
.blog-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--blog-muted);
  grid-column: 1 / -1;
}

/* ── Article page ──────────────────────────────────────────── */
.article-page {
  max-width: var(--blog-art-w);
  margin: 0 auto;
  padding: 0 20px 80px;
}

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

.article-header h1 {
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  font-weight: 800;
  line-height: 1.25;
  margin: 16px 0 12px;
  color: var(--blog-text);
}

.article-header-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  color: var(--blog-muted);
  font-size: .875rem;
  border-bottom: 1px solid var(--blog-border);
  padding-bottom: 20px;
  margin-bottom: 8px;
}

.article-header-meta .category-badge { font-size: .78rem; }

.meta-dot { color: var(--blog-border); }

/* ── Article content typography ────────────────────────────── */
.article-content {
  font-size: 1.05rem;
  line-height: 1.85;
  color: #2D3748;
}

.article-content .article-lead {
  font-size: 1.2rem;
  color: #4A5568;
  line-height: 1.65;
  margin-bottom: 2rem;
  font-weight: 400;
}

.article-content h2 {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--blog-text);
  margin: 2.5rem 0 .8rem;
  padding-bottom: .4rem;
  border-bottom: 2px solid var(--blog-border);
  line-height: 1.3;
}

.article-content h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--blog-text);
  margin: 1.8rem 0 .6rem;
}

.article-content p { margin: 0 0 1.2rem; }

.article-content ul,
.article-content ol {
  margin: 0 0 1.2rem;
  padding-left: 1.6rem;
}

.article-content li { margin-bottom: .5rem; }

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

.article-content pre {
  background: #F1F5F9;
  border: 1px solid var(--blog-border);
  border-radius: 8px;
  padding: 16px 20px;
  overflow-x: auto;
  font-size: .9rem;
  margin: 1.2rem 0;
}

.article-content code {
  background: #F1F5F9;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: .9em;
}

.article-content pre code {
  background: none;
  padding: 0;
}

/* ── Tip box ───────────────────────────────────────────────── */
.article-tip {
  background: #EBF4FF;
  border-left: 4px solid var(--blog-blue);
  border-radius: 0 8px 8px 0;
  padding: 16px 20px;
  margin: 1.8rem 0;
  font-size: .95rem;
  color: #1E3A5F;
}

/* ── CTA box ───────────────────────────────────────────────── */
.article-cta {
  background: linear-gradient(135deg, var(--blog-blue) 0%, #0D47A1 100%);
  border-radius: var(--blog-radius);
  padding: 24px 28px;
  margin: 2.5rem 0 0;
  color: #fff;
  font-size: 1rem;
}

.article-cta p { margin: 0; color: rgba(255,255,255,.95); }
.article-cta a { color: #FFD54F; font-weight: 600; }
.article-cta a:hover { color: #FFECB3; }

/* ── Article tags (footer of article) ─────────────────────── */
.article-tags-section {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--blog-border);
}

.article-tags-section h3 {
  font-size: .85rem;
  font-weight: 600;
  color: var(--blog-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin: 0 0 10px;
}

/* ── Related articles ──────────────────────────────────────── */
.related-articles {
  background: var(--blog-surface);
  border: 1px solid var(--blog-border);
  border-radius: var(--blog-radius);
  padding: 28px;
  margin-top: 2.5rem;
}

.related-articles h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 18px;
  color: var(--blog-text);
  border: none;
  padding: 0;
}

.related-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.related-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  text-decoration: none;
  color: var(--blog-text);
  padding: 10px;
  border-radius: 8px;
  transition: background .15s;
}

.related-item:hover { background: var(--blog-bg); text-decoration: none; }

.related-item-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.related-item-title {
  font-weight: 600;
  font-size: .9rem;
  line-height: 1.4;
  margin: 0 0 3px;
}

.related-item-meta {
  font-size: .78rem;
  color: var(--blog-muted);
}

/* ── Footer ────────────────────────────────────────────────── */
.blog-footer {
  background: #1A202C;
  color: rgba(255,255,255,.7);
  padding: 36px 0;
  font-size: .875rem;
  margin-top: 48px;
}

.blog-footer .container {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
  align-items: center;
}

.blog-footer a { color: rgba(255,255,255,.7); }
.blog-footer a:hover { color: #fff; text-decoration: none; }
.blog-footer .footer-links { display: flex; gap: 16px; flex-wrap: wrap; }

/* ── "Latest on blog" widget (used on homepage) ─────────────── */
.blog-preview-section {
  background: #fff;
  padding: 64px 0;
  border-top: 1px solid var(--blog-border);
}

.blog-preview-section .section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 32px;
  gap: 12px;
  flex-wrap: wrap;
}

.blog-preview-section h2 {
  font-size: 1.7rem;
  font-weight: 800;
  margin: 0;
  color: var(--blog-text);
}

.blog-preview-section .see-all {
  font-size: .9rem;
  font-weight: 600;
  color: var(--blog-blue);
  text-decoration: none;
  white-space: nowrap;
}

.blog-preview-section .see-all:hover { text-decoration: underline; }

.blog-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

/* ── Progress bar ──────────────────────────────────────────── */
.reading-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: var(--blog-blue);
  width: 0%;
  z-index: 200;
  transition: width .1s linear;
}

/* ── Table of contents ─────────────────────────────────────── */
.article-toc {
  background: var(--blog-bg);
  border: 1px solid var(--blog-border);
  border-radius: 8px;
  padding: 16px 20px;
  margin: 2rem 0;
  font-size: .9rem;
}

.article-toc h4 {
  font-size: .82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--blog-muted);
  margin: 0 0 10px;
}

.article-toc ol {
  margin: 0;
  padding-left: 1.4rem;
}

.article-toc li { margin-bottom: 5px; }
.article-toc a { color: var(--blog-blue); font-size: .88rem; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
  .article-card.featured { flex-direction: column; }
  .article-card.featured .article-card-img { width: 100%; min-height: 160px; }

  .blog-grid { grid-template-columns: 1fr; }
  .blog-grid .article-card.featured { grid-column: auto; }

  .blog-hero { padding: 40px 0 32px; }

  .article-content { font-size: 1rem; }
  .article-content h2 { font-size: 1.25rem; }
  .article-header h1 { font-size: 1.5rem; }

  .blog-footer .container { flex-direction: column; align-items: flex-start; gap: 12px; }
}

@media (max-width: 480px) {
  .blog-filters { gap: 6px; }
  .filter-btn { font-size: .78rem; padding: 5px 12px; }
  .article-card-body { padding: 16px 18px 18px; }
  .related-articles { padding: 20px; }
}
