/* ==========================================================================
   BLOG VELATUM (/blog/, /blog/<slug>.html)
   Korzysta ze zmiennych i komponentów z ../style.css (kolory, fonty,
   .cta-button, .breadcrumbs, .dates-empty, .back-link, .text-link).
   ========================================================================== */

.blog-page {
    padding-top: 10rem;
    padding-bottom: 6rem;
}

.blog-list.container,
.post-page.container {
    max-width: 1180px;
}

/* ---------- Nagłówek listy ---------- */
.blog-hero {
    text-align: center;
    max-width: 720px;
    margin: 0 auto 3.5rem;
}

.blog-hero-title {
    color: var(--accent-main);
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 300;
    letter-spacing: 0.3em;
    line-height: 1.2;
    margin-bottom: 1.2rem;
}

.blog-hero-lead {
    font-size: 1.05rem;
    font-weight: 300;
    line-height: 1.8;
    color: var(--text-muted);
}

/* ---------- Filtry kategorii ---------- */
.blog-filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.7rem;
    margin: 0 auto 3rem;
}

.blog-filter {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 44px;
    padding: 0.55rem 1.2rem;
    border: 1px solid rgba(241, 235, 221, 0.18);
    background: transparent;
    color: var(--text-color);
    font-family: var(--font-sans);
    font-size: 0.7rem;
    font-weight: 400;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    cursor: pointer;
    transition: border-color 0.3s ease, color 0.3s ease, background-color 0.3s ease;
}

.blog-filter:hover {
    border-color: var(--accent-main);
    color: var(--gold-light);
}

.blog-filter.is-active {
    border-color: var(--accent-main);
    background: rgba(201, 169, 97, 0.1);
    color: var(--gold-light);
}

.blog-filter-count {
    font-size: 0.65rem;
    letter-spacing: 0.05em;
    color: var(--accent-subtle);
}

/* ---------- Karty ---------- */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2rem;
}

.blog-grid[hidden] {
    display: none !important;
}

.blog-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    border: 1px solid var(--hairline);
    box-shadow: var(--card-shadow);
    transition: border-color 0.4s var(--ease-premium), transform 0.4s var(--ease-premium);
}

.blog-card:hover,
.blog-card:focus-within {
    border-color: rgba(201, 169, 97, 0.5);
    transform: translateY(-3px);
}

.blog-card-media {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    background: #111;
}

.blog-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s var(--ease-premium);
}

.blog-card:hover .blog-card-image:not(.blog-cover-placeholder) {
    transform: scale(1.03);
}

/* Zastępnik okładki: sygnet na czarno-złotym tle. */
.blog-cover-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse at 50% 40%, rgba(201, 169, 97, 0.16) 0%, rgba(201, 169, 97, 0) 62%),
        linear-gradient(160deg, #17150f 0%, #0b0b0a 60%, #14120d 100%);
}

.blog-cover-placeholder img {
    width: 64px;
    height: auto;
    opacity: 0.55;
    filter: drop-shadow(0 0 14px rgba(201, 169, 97, 0.35));
}

.blog-card-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    padding: 1.6rem 1.6rem 1.8rem;
}

.blog-card-badge {
    align-self: flex-start;
    margin-bottom: 1rem;
    padding: 0.3rem 0.8rem;
    border: 1px solid var(--accent-main);
    color: var(--gold-light);
    font-size: 0.6rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
}

.blog-card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.2rem 0.5rem;
    margin-bottom: 0.9rem;
    font-size: 0.66rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.blog-card-category {
    color: var(--accent-main);
}

.blog-card-sep {
    color: var(--accent-subtle);
}

.blog-card-title {
    font-family: var(--font-serif);
    font-size: 1.45rem;
    font-weight: 400;
    letter-spacing: 0.02em;
    line-height: 1.3;
    color: var(--ivory);
    margin-bottom: 0.8rem;
}

.blog-card-link {
    color: inherit;
    text-decoration: none;
}

/* Cała karta klikalna. */
.blog-card-link::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
}

.blog-card-link:focus-visible {
    outline: none;
}

.blog-card:focus-within {
    outline: 1px solid var(--accent-main);
    outline-offset: 4px;
}

.blog-card-excerpt {
    flex: 1;
    font-size: 0.9rem;
    font-weight: 300;
    line-height: 1.7;
    color: var(--text-muted);
    margin-bottom: 1.4rem;
}

.blog-card-more {
    align-self: flex-start;
    font-size: 0.66rem;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--accent-main);
    padding-bottom: 0.2rem;
    border-bottom: 1px solid rgba(201, 169, 97, 0.4);
}

/* Wyróżniony artykuł: okładka obok tekstu. */
.blog-featured {
    margin-bottom: 2rem;
}

.blog-card--featured {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
}

.blog-card--featured .blog-card-media {
    aspect-ratio: auto;
    min-height: 100%;
}

.blog-card--featured .blog-card-body {
    justify-content: center;
    padding: 2.6rem 2.4rem;
}

.blog-card--featured .blog-card-title {
    font-size: clamp(1.6rem, 2.4vw, 2.2rem);
}

.blog-card--featured .blog-card-excerpt {
    flex: 0 0 auto;
    font-size: 0.98rem;
}

/* ---------- Stany: ładowanie, pusto, błąd, więcej ---------- */
.blog-skeleton {
    border: 1px solid var(--hairline);
    padding-bottom: 1.6rem;
}

.blog-skeleton-media,
.blog-skeleton-line,
.blog-skeleton-title {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.03) 0%, rgba(201, 169, 97, 0.09) 50%, rgba(255, 255, 255, 0.03) 100%);
    background-size: 200% 100%;
    animation: blog-shimmer 1.6s linear infinite;
}

.blog-skeleton-media {
    aspect-ratio: 16 / 9;
    margin-bottom: 1.4rem;
}

.blog-skeleton-line {
    height: 0.8rem;
    margin: 0 1.6rem 0.8rem;
}

.blog-skeleton-title {
    height: 2.6rem;
    margin: 0 0 1.2rem;
    max-width: 80%;
}

.blog-skeleton-line--short {
    max-width: 35%;
}

.blog-skeleton-line--mid {
    max-width: 65%;
}

@keyframes blog-shimmer {
    from { background-position: 200% 0; }
    to { background-position: -200% 0; }
}

.blog-state {
    margin-top: 1rem;
    margin-bottom: 1rem;
}

.blog-state button.cta-button {
    margin-top: 0;
}

.blog-noscript {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem 0;
}

.blog-more {
    text-align: center;
    margin-top: 3rem;
}

.blog-more .cta-button:disabled {
    opacity: 0.5;
    cursor: progress;
}

/* ---------- CTA (lista i artykuł) ---------- */
.post-cta {
    position: relative;
    margin-top: 4rem;
    padding: 2.8rem 2.4rem;
    text-align: center;
    border: 1px solid var(--hairline);
    background:
        radial-gradient(ellipse at 50% 0%, rgba(201, 169, 97, 0.09) 0%, rgba(201, 169, 97, 0) 70%),
        var(--card-bg);
}

.blog-cta {
    margin-top: 6rem;
}

.post-cta-kicker {
    font-size: 0.66rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--accent-main);
    margin-bottom: 0.8rem;
}

.post-cta-title,
.post-content .post-cta-title {
    font-family: var(--font-serif);
    font-size: clamp(1.4rem, 2.4vw, 1.9rem);
    font-weight: 300;
    letter-spacing: 0.16em;
    color: var(--ivory);
    margin: 0 0 1rem;
}

.post-cta p:not(.post-cta-kicker) {
    max-width: 560px;
    margin: 0 auto;
    font-size: 0.95rem;
    font-weight: 300;
    line-height: 1.75;
    color: var(--text-muted);
}

.post-cta-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
}

.post-cta-actions .cta-button {
    margin-top: 0;
}

/* ==========================================================================
   ARTYKUŁ
   ========================================================================== */
.post-header {
    max-width: 820px;
    margin: 0 auto 2.5rem;
    text-align: center;
}

.post-category {
    display: inline-block;
    margin-bottom: 1.2rem;
    font-size: 0.68rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--accent-main);
    text-decoration: none;
    border-bottom: 1px solid rgba(201, 169, 97, 0.35);
    padding-bottom: 0.2rem;
}

.post-category:hover {
    border-bottom-color: var(--accent-main);
}

.post-title {
    font-size: clamp(2rem, 4.2vw, 3.1rem);
    font-weight: 300;
    letter-spacing: 0.04em;
    line-height: 1.2;
    color: var(--ivory);
    margin-bottom: 1.4rem;
    overflow-wrap: anywhere;
}

.post-lead {
    max-width: 680px;
    margin: 0 auto 1.6rem;
    font-size: 1.1rem;
    font-weight: 300;
    line-height: 1.8;
    color: rgba(241, 235, 221, 0.86);
}

.post-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.3rem 0.7rem;
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.post-meta-sep {
    color: var(--accent-main);
}

.post-cover {
    max-width: 1100px;
    margin: 0 auto 3.5rem;
    border: 1px solid var(--hairline);
    box-shadow: var(--card-shadow);
}

.post-cover-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

.post-layout {
    display: grid;
    grid-template-columns: 240px minmax(0, 720px);
    justify-content: center;
    gap: 4rem;
}

.post-layout--single {
    grid-template-columns: minmax(0, 720px);
}

/* ---------- Spis treści ---------- */
.post-toc {
    position: relative;
}

.post-toc nav {
    position: sticky;
    top: calc(var(--nav-height) + 1.5rem);
    padding: 1.4rem 1.4rem 1.2rem;
    border: 1px solid var(--line);
    background-color: rgba(255, 255, 255, 0.02);
}

.post-toc-title {
    font-family: var(--font-sans);
    font-size: 0.66rem;
    font-weight: 400;
    letter-spacing: 0.24em;
    color: var(--accent-subtle);
    margin: 0 0 1rem;
    text-transform: uppercase;
}

.post-toc ol {
    list-style: none;
    counter-reset: toc;
}

.post-toc li {
    counter-increment: toc;
    margin-bottom: 0.2rem;
}

.post-toc a {
    display: flex;
    gap: 0.6rem;
    padding: 0.35rem 0;
    font-size: 0.82rem;
    font-weight: 300;
    line-height: 1.45;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.3s ease;
}

.post-toc a::before {
    content: counter(toc, decimal-leading-zero);
    flex-shrink: 0;
    font-size: 0.66rem;
    line-height: 1.9;
    color: var(--accent-subtle);
}

.post-toc a:hover,
.post-toc a.is-active {
    color: var(--gold-light);
}

/* ---------- Typografia treści ---------- */
.post-content {
    font-size: 1.02rem;
    font-weight: 300;
    line-height: 1.85;
    color: rgba(232, 232, 232, 0.9);
    overflow-wrap: break-word;
}

.post-content > * + * {
    margin-top: 1.3rem;
}

.post-content h2 {
    margin-top: 3.2rem;
    margin-bottom: -0.2rem;
    font-size: clamp(1.5rem, 2.6vw, 1.95rem);
    font-weight: 400;
    letter-spacing: 0.05em;
    line-height: 1.3;
    color: var(--accent-main);
    scroll-margin-top: calc(var(--nav-height) + 1rem);
}

.post-content h3 {
    margin-top: 2.2rem;
    margin-bottom: -0.4rem;
    font-family: var(--font-serif);
    font-size: 1.35rem;
    font-weight: 400;
    letter-spacing: 0.03em;
    line-height: 1.35;
    color: var(--gold-light);
    scroll-margin-top: calc(var(--nav-height) + 1rem);
}

.post-content h4 {
    margin-top: 1.8rem;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ivory);
}

.post-content > :first-child {
    margin-top: 0;
}

.post-content strong,
.post-content b {
    font-weight: 500;
    color: var(--ivory);
}

.post-content em {
    color: rgba(241, 235, 221, 0.95);
}

.post-content a {
    color: var(--gold-light);
    text-decoration: none;
    border-bottom: 1px solid rgba(201, 169, 97, 0.45);
    transition: color 0.3s ease, border-color 0.3s ease;
}

.post-content a:hover {
    color: var(--accent-main);
    border-bottom-color: var(--accent-main);
}

.post-content ul,
.post-content ol {
    padding-left: 1.6rem;
}

.post-content ul {
    list-style: none;
    padding-left: 1.4rem;
}

.post-content li + li {
    margin-top: 0.6rem;
}

.post-content ul > li {
    position: relative;
}

.post-content ul > li::before {
    content: "";
    position: absolute;
    left: -1.35rem;
    top: 0.78em;
    width: 6px;
    height: 6px;
    background: var(--accent-main);
    transform: rotate(45deg);
}

.post-content ol > li::marker {
    color: var(--accent-main);
    font-weight: 400;
}

.post-content li > ul,
.post-content li > ol {
    margin-top: 0.6rem;
}

.post-content blockquote {
    margin-left: 0;
    margin-right: 0;
    padding: 0.4rem 0 0.4rem 1.6rem;
    border-left: 1px solid var(--accent-main);
    font-family: var(--font-serif);
    font-size: 1.35rem;
    font-style: italic;
    line-height: 1.6;
    color: var(--ivory);
}

.post-content blockquote > * + * {
    margin-top: 0.8rem;
}

.post-content code {
    padding: 0.1rem 0.4rem;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.04);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.88em;
    color: var(--gold-light);
}

.post-content pre {
    padding: 1.2rem 1.4rem;
    overflow-x: auto;
    border: 1px solid var(--line);
    background: #111110;
    font-size: 0.88rem;
    line-height: 1.6;
}

.post-content pre code {
    padding: 0;
    border: 0;
    background: none;
    color: var(--text-color);
}

.post-content img {
    max-width: 100%;
    height: auto;
    margin: 0 auto;
    border: 1px solid var(--hairline);
}

.post-content figure {
    margin-left: 0;
    margin-right: 0;
}

.post-content figcaption {
    margin-top: 0.7rem;
    font-size: 0.8rem;
    text-align: center;
    color: var(--text-muted);
}

.post-content hr {
    height: 1px;
    margin: 3rem auto;
    border: 0;
    width: min(320px, 60%);
    background: linear-gradient(90deg, rgba(201, 169, 97, 0) 0%, rgba(201, 169, 97, 0.6) 50%, rgba(201, 169, 97, 0) 100%);
}

.post-content table {
    display: block;
    width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.post-content th,
.post-content td {
    padding: 0.7rem 0.9rem;
    border-bottom: 1px solid var(--line);
    text-align: left;
}

.post-content th {
    font-weight: 500;
    color: var(--gold-light);
}

/* ---------- Tagi, powiązane, powrót ---------- */
.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    list-style: none;
    margin-top: 3rem;
}

.post-tags li {
    padding: 0.35rem 0.8rem;
    border: 1px solid var(--line);
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.post-related {
    margin-top: 6rem;
}

.post-related-title {
    text-align: center;
    margin-bottom: 2.5rem;
    font-size: clamp(1.5rem, 2.6vw, 2.1rem);
}

.blog-grid--related {
    grid-template-columns: repeat(auto-fit, minmax(240px, 360px));
    justify-content: center;
}

.post-back {
    margin-top: 4rem;
    text-align: center;
}

.post-back .back-link {
    margin-bottom: 0;
}

/* ---------- 404 / błąd ---------- */
.post-missing {
    max-width: 640px;
    margin: 0 auto;
    text-align: center;
    padding: 2rem 0 3rem;
}

.post-missing-code {
    font-family: var(--font-serif);
    font-size: 5rem;
    font-weight: 300;
    line-height: 1;
    letter-spacing: 0.2em;
    color: var(--accent-main);
    opacity: 0.6;
    margin-bottom: 1rem;
}

.post-missing h1 {
    font-size: clamp(1.7rem, 3vw, 2.3rem);
    font-weight: 300;
    letter-spacing: 0.12em;
    color: var(--ivory);
    margin-bottom: 1rem;
}

.post-missing p:not(.post-missing-code) {
    font-weight: 300;
    color: var(--text-muted);
}

.post-error {
    color: #E0897D !important;
}

.post-skeleton {
    max-width: 820px;
    margin: 0 auto;
}

.post-skeleton .blog-skeleton-line {
    margin-left: 0;
    margin-right: 0;
}

.post-skeleton .blog-skeleton-media {
    margin: 2rem 0;
}

/* ---------- Responsywność ---------- */
@media (max-width: 1024px) {
    .blog-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1.5rem;
    }

    .post-layout {
        grid-template-columns: minmax(0, 720px);
        gap: 0;
    }

    .post-toc {
        margin-bottom: 2.5rem;
    }

    .post-toc nav {
        position: static;
    }
}

@media (max-width: 768px) {
    .blog-page {
        padding-top: 7.5rem;
        padding-bottom: 4rem;
    }

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

    .blog-card--featured .blog-card-media {
        aspect-ratio: 16 / 9;
        min-height: 0;
    }

    .blog-card--featured .blog-card-body {
        padding: 1.6rem 1.4rem 1.8rem;
    }

    .post-cta {
        padding: 2.2rem 1.3rem;
    }

    .post-cover {
        margin-left: -1.2rem;
        margin-right: -1.2rem;
        border-left: 0;
        border-right: 0;
    }

    .post-content {
        font-size: 0.98rem;
    }

    .post-content blockquote {
        font-size: 1.2rem;
        padding-left: 1.1rem;
    }
}

@media (max-width: 640px) {
    .blog-grid {
        grid-template-columns: 1fr;
    }

    .blog-hero-title {
        letter-spacing: 0.18em;
    }

    .blog-filters {
        justify-content: flex-start;
    }

    .post-cta-actions .cta-button {
        width: 100%;
        text-align: center;
    }

    .blog-card-body {
        padding: 1.4rem 1.3rem 1.6rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .blog-skeleton-media,
    .blog-skeleton-line,
    .blog-skeleton-title {
        animation: none;
    }

    .blog-card,
    .blog-card-image {
        transition: none;
    }

    .blog-card:hover,
    .blog-card:focus-within {
        transform: none;
    }
}
