/* =========================================================
   layout/blog.css
   ---------------------------------------------------------
   Style dla bloga:
   - .blog-page        — strona z listą postów
   - .blog-hero        — nagłówek strony bloga
   - .blog-post        — pojedynczy post
   - .post-list        — siatka kart postów
   - .post-card        — karta posta (bez zdjęcia lub ze zdjęciem)
   - .post-card-image  — zdjęcie karty (aspect-ratio 16:9)
   - .post-card-body   — treść karty (data, tytuł, opis)
   - .post-meta        — meta posta (link wstecz + data)
   - .post-hero-image  — zdjęcie główne posta
   - .post-content     — treść posta (h2, h3, p, ul, ol)
   - .post-image       — zdjęcie wewnątrz treści posta
   - .code-block       — blok kodu z przyciskiem kopiowania
   - .code-block-copy  — przycisk "Kopiuj" w bloku kodu (JS)
   - .narrow           — kontener o max-width 740px
   ========================================================= */

.blog-page,
.blog-post,
.legal-page {
  padding: 52px 0 80px;
}

/* -------------------------
   Hero bloga
   ------------------------- */

.blog-hero {
  max-width: 720px;
  margin-bottom: 48px;
}

.blog-hero h1 {
  margin: 8px 0 20px;
}

/* -------------------------
   Lista postów — siatka kart
   Mobile: 1 kolumna
   Tablet: 2 kolumny
   Desktop wide: 3 kolumny
   ------------------------- */

.post-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

/* Karta posta — flex column żeby tekst był zawsze na dole */
.post-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  background: var(--color-surface-strong);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  position: relative;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

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

/* Zdjęcie karty — 16:9, object-fit cover */
.post-card-image {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
}

/* Treść karty — flex:1 żeby wypychała się na dół */
.post-card-body {
  flex: 1;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
}

/* Data publikacji */
.post-card-date {
  margin: 0;
  font-size: 12px;
  color: var(--color-accent);
  font-weight: 700;
}

/* Tytuł karty */
.post-card-title {
  margin: 0;
  font-size: clamp(16px, 3vw, 20px);
  line-height: 1.2;
}

/* Link tytułu — cały kafelek klikalny przez ::after */
.post-card-title a {
  color: var(--color-text);
  text-decoration: none;
  transition: color 0.15s ease;
}

.post-card-title a:hover {
  color: var(--color-accent);
}

/* Rozciągnięcie linku na cały kafelek */
.post-card-title a::after {
  content: "";
  position: absolute;
  inset: 0;
}

/* Opis karty */
.post-card-desc {
  margin: 0;
  font-size: 14px;
  color: var(--color-muted);
  line-height: 1.65;
}

/* -------------------------
   Pojedynczy post
   ------------------------- */

/* Wąski kontener dla treści posta */
.narrow {
  max-width: 740px;
  margin: 0 auto;
}

/* Meta posta — link wstecz i data */
.post-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

/* Link "← Blog" */
.post-back {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.post-back:hover {
  color: var(--color-text);
}

/* Data publikacji w nagłówku posta */
.post-date {
  font-size: 12px;
  color: var(--color-accent);
  font-weight: 700;
}

/* Zdjęcie główne posta — hero */
.post-hero-image {
  width: 100%;
  margin: 32px 0;
  border-radius: var(--radius-card);
  display: block;
  object-fit: cover;
}

/* -------------------------
   Treść posta
   ------------------------- */

.post-content {
  color: var(--color-muted);
  font-size: 16px;
  line-height: 1.8;
  margin-top: 32px;
}

.post-content h2 {
  margin: 40px 0 16px;
  color: var(--color-text);
  font-size: clamp(18px, 3vw, 26px);
}

.post-content h3 {
  margin: 28px 0 12px;
  color: var(--color-text);
  font-size: clamp(15px, 2.5vw, 20px);
}

.post-content p {
  margin: 0 0 18px;
}

.post-content p:last-child {
  margin-bottom: 0;
}

.post-content ul,
.post-content ol {
  padding-left: 1.4em;
  margin: 0 0 18px;
}

.post-content li {
  margin: 8px 0;
}

.post-content strong {
  color: var(--color-text);
  font-weight: 700;
}

.post-content a {
  color: var(--color-text);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Zdjęcia wewnątrz treści posta
   Użycie w HTML: <img class="post-image" ...> */
.post-image {
  width: 100%;
  height: auto;
  border-radius: var(--radius-card);
  display: block;
  margin: 28px 0;
  object-fit: cover;
}

/* -------------------------
   Bloki kodu
   Użycie w HTML: <pre class="code-block"><code>...</code></pre>
   Przycisk "Kopiuj" dodawany automatycznie przez JS (initCodeCopy)
   ------------------------- */

.code-block {
  position: relative;
  margin: 24px 0;
  padding: 20px 24px;
  border-radius: 14px;
  background: #0f1117;
  overflow-x: auto;
}

.code-block code {
  font-family: "Courier New", Courier, monospace;
  font-size: 14px;
  line-height: 1.7;
  color: #e8e8e8;
  white-space: pre;
}

/* Przycisk kopiowania — pojawia się po najechaniu na blok */
.code-block-copy {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 6px 12px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.6);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.18s ease, background 0.18s ease;
}

.code-block:hover .code-block-copy {
  opacity: 1;
}

.code-block-copy:hover,
.code-block-copy.is-copied {
  background: rgba(255,255,255,0.18);
  color: #ffffff;
}

/* -------------------------
   Desktop >= 820px
   ------------------------- */

@media (min-width: 820px) {
  .post-list {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1100px) {
  .post-list {
    grid-template-columns: repeat(3, 1fr);
  }
}
