/* blog.css — ProsteKarnety /blog
   Chrome (header, footer, nav, hamburger) is styled by /styles.css and reused
   as-is. This file styles ONLY blog-specific content: the reading column, the
   post header, article prose, the in-nav language toggle, and (from C4) the
   .blog-card listing. All values reuse the design tokens from styles.css. */

/* ----- floating language switch (reuses homepage .lang-switch / .lang-btn) ----- */
.lang-switch a.lang-btn { text-decoration: none; }
.lang-btn--disabled { opacity: 0.4; cursor: default; }
.lang-btn--disabled:hover { color: var(--muted); background: none; }

/* ----- page shell: clear the fixed pill header (mirrors .subpage-hero) ----- */
.blog-main {
    background: var(--bg-ice);
    padding: calc(var(--header-h) + 56px) 0 88px;
}

.blog-reading {
    width: min(760px, calc(100% - 40px));
    margin: 0 auto;
}

/* ----- back link ----- */
.blog-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 22px;
    font-family: var(--font-label);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition);
}
.blog-back::before { content: "\2190"; font-size: 1.05em; line-height: 1; }
.blog-back:hover { color: var(--accent-bright); }

/* ----- the post as a clean white reading card on the ice background ----- */
.blog-post {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-panel);
    box-shadow: var(--shadow-card);
    padding: clamp(28px, 5vw, 56px);
}

/* ----- post header ----- */
.blog-post-head { margin-bottom: 32px; }

.blog-post-meta {
    margin: 0 0 14px;
    font-family: var(--font-label);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.blog-post-title {
    margin: 0 0 18px;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.9rem, 4.2vw, 2.8rem);
    line-height: 1.12;
    letter-spacing: -0.02em;
    color: var(--ink);
}

.blog-post-lead {
    margin: 0;
    font-size: clamp(1.08rem, 2.2vw, 1.28rem);
    line-height: 1.55;
    color: var(--ink-soft);
}

.blog-post-tags {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 22px 0 0;
    padding: 0;
}
.blog-post-tags li {
    font-family: var(--font-label);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--accent);
    background: var(--bg-ice);
    border-radius: var(--r-chip);
    padding: 5px 13px;
}

/* ----- cover ----- */
.blog-cover {
    display: block;
    width: 100%;
    height: auto;
    border-radius: var(--r-card);
    margin: 0 0 36px;
}

/* ----- article prose ----- */
.blog-prose {
    font-size: 1.06rem;
    line-height: 1.72;
    color: var(--ink-soft);
}
.blog-prose > :first-child { margin-top: 0; }
.blog-prose > :last-child { margin-bottom: 0; }

.blog-prose h2,
.blog-prose h3,
.blog-prose h4 {
    font-family: var(--font-display);
    color: var(--ink);
    line-height: 1.25;
    letter-spacing: -0.01em;
    scroll-margin-top: 104px;
}
.blog-prose h2 { font-size: 1.55rem; margin: 2.2em 0 0.6em; }
.blog-prose h3 { font-size: 1.25rem; margin: 1.9em 0 0.5em; }
.blog-prose h4 { font-size: 1.06rem; margin: 1.7em 0 0.5em; }

.blog-prose p { margin: 0 0 1.25em; }

.blog-prose a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
    transition: color var(--transition);
}
.blog-prose a:hover { color: var(--accent-bright); }

.blog-prose ul,
.blog-prose ol { margin: 0 0 1.25em; padding-left: 1.4em; }
.blog-prose li { margin: 0.35em 0; }
.blog-prose li::marker { color: var(--accent); }

.blog-prose strong { color: var(--ink); font-weight: 600; }

.blog-prose blockquote {
    margin: 1.8em 0;
    padding: 20px 24px;
    background: var(--bg-ice);
    border: 1px solid rgba(32, 42, 115, 0.08);
    border-radius: 16px;
    color: var(--ink-soft);
}
.blog-prose blockquote p:last-child { margin-bottom: 0; }

/* inline code + fenced blocks */
.blog-prose code {
    font-family: var(--font-mono);
    font-size: 0.88em;
    background: var(--bg-cream);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.12em 0.4em;
}
.blog-prose pre {
    margin: 1.6em 0;
    padding: 18px 20px;
    background: var(--bg-dark);
    border-radius: var(--r-card);
    overflow-x: auto;
    line-height: 1.6;
}
.blog-prose pre code {
    font-size: 0.85rem;
    color: #E6ECFF;
    background: none;
    border: 0;
    padding: 0;
}

.blog-prose img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: var(--r-card);
    margin: 1.8em 0;
}

.blog-prose hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 2.4em 0;
}

/* tables (GFM) */
.blog-prose table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.6em 0;
    font-size: 0.96rem;
}
.blog-prose th,
.blog-prose td {
    text-align: left;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
}
.blog-prose thead th {
    font-family: var(--font-label);
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
    border-bottom: 2px solid var(--border);
}
.blog-prose tbody tr:last-child td { border-bottom: 0; }

/* ----- listing (/blog/, /blog/en/) ----- */
.blog-list {
    width: min(1160px, calc(100% - 48px));
    margin: 0 auto;
}

.blog-list-head { margin-bottom: 30px; }
.blog-list-title {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 2.8rem);
    letter-spacing: -0.02em;
    color: var(--ink);
}
.blog-list-subtitle {
    margin: 12px 0 0;
    font-size: clamp(1.02rem, 2vw, 1.18rem);
    line-height: 1.5;
    color: var(--muted);
    max-width: 620px;
}

.blog-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
}

@media (max-width: 1000px) {
    .blog-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

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

/* NEW class — never reuses the JS reveal classes (.cat-card/.pass-card/etc.) */
.blog-card {
    container-type: inline-size;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-card);
    box-shadow: var(--shadow-card-rest);
    overflow: hidden;
    transition: transform var(--ease-spring) 0.25s, box-shadow var(--transition);
}
.blog-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-card-lift);
}

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

.blog-card-cover {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

/* fallback cover for posts without their own image — keeps the grid uniform */
.blog-card-cover--fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(120% 130% at 82% -15%, var(--accent-bright) 0%, var(--bg-dark) 72%);
}
.blog-card-fallback-mark {
    width: clamp(44px, 16cqi, 60px);
    height: clamp(44px, 16cqi, 60px);
    border-radius: 14px;
    opacity: 0.92;
}

.blog-card-body { padding: clamp(16px, 6cqi, 26px); }

.blog-card-meta {
    margin: 0 0 10px;
    font-family: var(--font-label);
    font-size: clamp(0.7rem, 3cqi, 0.78rem);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.blog-card-title {
    margin: 0 0 10px;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.05rem, 5cqi, 1.45rem);
    line-height: 1.2;
    letter-spacing: -0.01em;
    color: var(--ink);
    transition: color var(--transition);
}
.blog-card-link:hover .blog-card-title { color: var(--accent); }

.blog-card-lead {
    margin: 0;
    font-size: clamp(0.88rem, 4cqi, 1rem);
    line-height: 1.55;
    color: var(--ink-soft);
}

.blog-card .blog-post-tags { margin-top: 14px; }
.blog-card .blog-post-tags li { font-size: clamp(0.68rem, 3cqi, 0.78rem); padding: 4px 11px; }

/* ----- listing/tag layout: topic sidebar (left) + cards (right) ----- */
.blog-layout {
    display: grid;
    grid-template-columns: 236px minmax(0, 1fr);
    gap: 32px;
    align-items: start;
}

/* "Karta" — sidebar as a card surface */
.blog-filter {
    position: sticky;
    top: max(calc(var(--header-h) + 22px), calc(50vh - var(--blog-filter-half, 240px)));
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-card);
    box-shadow: var(--shadow-card-rest);
    padding: 18px 14px;
}
.blog-filter-title {
    margin: 0 0 12px;
    padding-left: 12px;
    font-family: var(--font-label);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}
.blog-filter-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.blog-filter-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 11px;
    text-decoration: none;
    font-family: var(--font-label);
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--ink-soft);
    transition: background var(--transition), color var(--transition);
}
.blog-filter-link:hover { background: var(--bg-ice); color: var(--ink); }
.blog-filter-link[aria-current="page"] { background: var(--bg-ice); color: var(--accent); }
.blog-filter-count { font-size: 0.76rem; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }

/* mobile-only affordances — hidden everywhere until the media query below shows them */
.blog-filter-toggle { display: none; }
.blog-filter-docked { display: none; }

/* mobile: card chrome kept; tags collapse into a card that docks into a fixed bottom pill once scrolled past (mirrors www/guide) */
@media (max-width: 760px) {
    .blog-layout { grid-template-columns: minmax(0, 1fr); gap: 18px; }

    .blog-filter { position: static; align-self: stretch; padding: 0; display: flex; flex-direction: column;
        overflow: hidden; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-card);
        box-shadow: var(--shadow-card); transition: opacity .25s ease; }
    .blog-filter.is-replaced { opacity: 0; pointer-events: none; }
    .blog-list { padding-bottom: 84px; }   /* clears the fixed docked pill; scoped to listing pages only, unlike guide's `body` rule, since blog.css also loads on post pages that never have a docked pill */

    .blog-filter-title { display: none; }  /* desktop heading hidden; toggle's own label takes over */

    /* left/right (not centered like guide's docked pill) so it never extends under the
       bottom-right .lang-switch pill (fixed at bottom:16px; right:16px on mobile — styles.css:4186).
       132px reserved = lang-switch's own ~98px width + 16px gutter + ~18px breathing room;
       verify visually against the real rendered lang-switch width and adjust if needed. */
    .blog-filter-docked { display: flex; position: fixed; top: auto; bottom: 16px; left: 16px; right: 132px;
        z-index: 40; margin: 0; flex-direction: column-reverse;
        border-radius: var(--r-chip); background: var(--bg-dark); border-color: rgba(255, 255, 255, .14); box-shadow: var(--shadow-nav);
        opacity: 0; transform: translateY(calc(100% + 24px)); pointer-events: none;
        transition: opacity .3s ease, transform .34s cubic-bezier(.22, 1, .36, 1); }
    .blog-filter-docked.is-visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
    .blog-filter-docked.is-open { border-radius: var(--r-card); }

    .blog-filter-toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%;
        padding: 13px 16px; background: none; border: 0; border-radius: inherit; cursor: pointer; font: inherit;
        font-weight: 600; font-size: 0.95rem; color: var(--ink); }
    .blog-filter-toggle-lbl { display: flex; align-items: center; gap: 10px; min-width: 0; }
    .blog-filter-toggle-lbl svg { width: 20px; height: 20px; color: var(--accent); flex-shrink: 0; }
    .blog-filter-caret { width: 18px; height: 18px; color: var(--muted); flex-shrink: 0; transition: transform var(--transition); }
    .blog-filter.is-open .blog-filter-caret { transform: rotate(180deg); }
    .blog-filter-docked .blog-filter-caret { transform: rotate(180deg); }
    .blog-filter-docked.is-open .blog-filter-caret { transform: rotate(0deg); }

    .blog-filter-list { display: none; flex-direction: column; gap: 2px; padding: 6px 12px 14px; border-top: 1px solid var(--border); }
    .blog-filter.is-open .blog-filter-list { display: flex; }
    .blog-filter-docked .blog-filter-list { display: none; padding: 14px 12px 6px; border-bottom: 1px solid rgba(255, 255, 255, .14);
        max-height: 70svh; overflow-y: auto; border-top: 0; }
    .blog-filter-docked.is-open .blog-filter-list { display: flex; }

    .blog-filter-link { flex: 0 0 auto; white-space: normal; border: 0; border-radius: 11px; padding: 8px 12px; }  /* drop the pill/chip styling, back to the desktop row look */

    /* dark-surface colors on the docked pill */
    .blog-filter-docked .blog-filter-toggle { color: #fff; }
    .blog-filter-docked .blog-filter-toggle-lbl svg { color: var(--lime); }
    .blog-filter-docked .blog-filter-caret { color: var(--muted-on-dark); }
    .blog-filter-docked .blog-filter-link { color: var(--muted-on-dark); }
    .blog-filter-docked .blog-filter-link:hover { background: rgba(255, 255, 255, .07); color: #fff; }
    .blog-filter-docked .blog-filter-link[aria-current="page"] { background: rgba(255, 255, 255, .10); color: #fff; }
    .blog-filter-docked .blog-filter-count { color: var(--muted-on-dark); }
}

@media (prefers-reduced-motion: reduce) {
    .blog-filter, .blog-filter-docked { transition: none; }
}

/* ----- tag chips are now links: strip UA link styling; the pill reacts on hover ----- */
.blog-post-tags a { color: inherit; text-decoration: none; }
.blog-post-tags li:hover { background: var(--accent); color: #fff; }
