/* Strona wpisu i lista bloga (MON-260). Motyw ciemny: klasa .dark na <html> (layouts/landing.html).
   Ładowany PRZED blocks.css, który nadpisuje typografię .blog-content dla bloków wpisu. */

/* ---- Typografia treści wpisu ---- */
.blog-content {
    color: #374151; /* text-gray-700 */
    line-height: 1.75;
    font-size: 1rem;
}
.dark .blog-content { color: #d1d5db; } /* text-gray-300 */

.blog-content > * + * { margin-top: 1.25rem; }

.blog-content h1, .blog-content h2, .blog-content h3,
.blog-content h4, .blog-content h5, .blog-content h6 {
    font-weight: 700;
    color: #111827; /* text-gray-900 */
    line-height: 1.3;
}
.dark .blog-content h1, .dark .blog-content h2, .dark .blog-content h3,
.dark .blog-content h4, .dark .blog-content h5, .dark .blog-content h6 {
    color: #ffffff;
}
.blog-content h1 { font-size: 1.875rem; margin-top: 2.5rem; }
.blog-content h2 { font-size: 1.5rem; margin-top: 2.5rem; }
.blog-content h3 { font-size: 1.25rem; margin-top: 2rem; }
.blog-content h4 { font-size: 1.125rem; margin-top: 1.5rem; }
.blog-content > h1:first-child, .blog-content > h2:first-child,
.blog-content > h3:first-child { margin-top: 0; }

.blog-content a { color: #4f46e5; text-decoration: none; } /* indigo-600 */
.dark .blog-content a { color: #818cf8; } /* indigo-400 */
.blog-content a:hover { color: #4338ca; text-decoration: underline; }
.dark .blog-content a:hover { color: #a5b4fc; }

.blog-content strong { color: #111827; font-weight: 600; }
.dark .blog-content strong { color: #ffffff; }

.blog-content ul, .blog-content ol { padding-left: 1.5rem; }
.blog-content ul { list-style: disc; }
.blog-content ol { list-style: decimal; }
.blog-content li + li { margin-top: 0.375rem; }
.blog-content li > ul, .blog-content li > ol { margin-top: 0.375rem; }

.blog-content code {
    color: #4338ca; /* indigo-700 */
    background: #f3f4f6; /* gray-100 */
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-size: 0.875em;
}
.dark .blog-content code { color: #c7d2fe; background: #1f2937; } /* indigo-200 / gray-800 */

.blog-content pre {
    background: #f9fafb; /* gray-50 */
    border: 1px solid #e5e7eb; /* gray-200 */
    border-radius: 0.5rem;
    padding: 1rem;
    overflow-x: auto;
}
.dark .blog-content pre { background: #111827; border-color: #1f2937; } /* gray-900 / gray-800 */
.blog-content pre code { background: none; padding: 0; color: inherit; }

.blog-content blockquote {
    border-left: 3px solid #d1d5db; /* gray-300 */
    padding-left: 1rem;
    color: #4b5563; /* gray-600 */
    font-style: italic;
}
.dark .blog-content blockquote { border-color: #374151; color: #9ca3af; } /* gray-700 / gray-400 */

.blog-content img {
    border-radius: 0.75rem;
    border: 1px solid #e5e7eb;
    max-width: 100%;
}
.dark .blog-content img { border-color: #1f2937; }

.blog-content hr { border-color: #e5e7eb; }
.dark .blog-content hr { border-color: #1f2937; }

.blog-content table { border-collapse: collapse; width: 100%; font-size: 0.9375rem; }
.blog-content th, .blog-content td {
    border: 1px solid #e5e7eb;
    padding: 0.5rem 0.75rem;
    text-align: left;
}
.dark .blog-content th, .dark .blog-content td { border-color: #1f2937; }
.blog-content th { background: #f3f4f6; font-weight: 600; color: #1f2937; }
.dark .blog-content th { background: #1f2937; color: #e5e7eb; }

/* Wąski ekran: długie słowa i URL-e zawijają się, tabele i kod przewijają we własnym kontenerze */
.blog-content { overflow-wrap: anywhere; min-width: 0; }
.blog-content img, .blog-content video, .blog-content iframe { max-width: 100%; height: auto; }
/* Komórki nie dziedziczą zawijania "anywhere", inaczej tabela nigdy nie przekroczy kontenera i nie ma czego przewijać */
.blog-content table { display: block; max-width: 100%; overflow-x: auto; overflow-wrap: normal; word-break: normal; }
.blog-content pre { max-width: 100%; overflow-wrap: normal; }

/* ---- Układ strony wpisu ---- */
.blog-shell { max-width: 48rem; margin: 0 auto; padding: 0 1.5rem; min-width: 0; }
.blog-layout { display: block; min-width: 0; }
.blog-article { min-width: 0; max-width: 70ch; }

@media (min-width: 1024px) {
    .blog-shell-toc { max-width: 66rem; }
    .blog-layout-side {
        display: grid;
        grid-template-columns: minmax(0, 70ch) 16rem;
        column-gap: 3rem;
        align-items: start;
    }
    .blog-layout-side .blog-article { grid-column: 1; grid-row: 1; }
    .blog-layout-side .blog-toc-wrap {
        grid-column: 2;
        grid-row: 1;
        position: sticky;
        top: 5.5rem; /* fixed navbar ok. 4rem + odstęp */
        max-height: calc(100vh - 7rem);
        overflow-y: auto;
    }
}

/* ---- Nagłówek wpisu ---- */
.blog-title { overflow-wrap: anywhere; }
.blog-description {
    margin-top: 1rem;
    font-size: 1.125rem;
    line-height: 1.6;
    color: #4b5563;
    overflow-wrap: anywhere;
}
.dark .blog-description { color: #9ca3af; }

.blog-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; min-width: 0; }
.blog-header-tags { margin-bottom: 0.75rem; }
.blog-tag {
    display: inline-block;
    padding: 0.125rem 0.625rem;
    border-radius: 9999px;
    border: 1px solid #c7d2fe;
    background: #eef2ff;
    color: #4338ca;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.5;
    text-decoration: none;
    overflow-wrap: anywhere;
}
.blog-tag:hover { background: #e0e7ff; border-color: #a5b4fc; }
.blog-tag:focus-visible { outline: 2px solid #6366f1; outline-offset: 2px; }
.dark .blog-tag { border-color: rgba(129, 140, 248, 0.35); background: rgba(99, 102, 241, 0.12); color: #c7d2fe; }
.dark .blog-tag:hover { background: rgba(99, 102, 241, 0.25); border-color: #818cf8; }

.blog-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.75rem;
    margin-top: 1rem;
    font-size: 0.875rem;
    color: #6b7280; /* gray-500 */
    min-width: 0;
}
.dark .blog-meta { color: #9ca3af; }
.blog-meta > * { min-width: 0; }
.blog-meta > * + *::before { content: "\00b7"; margin-right: 0.75rem; }
.blog-author { font-weight: 600; color: #111827; }
.dark .blog-author { color: #f3f4f6; }

.blog-cover {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    margin-top: 1.5rem;
    border-radius: 0.75rem;
    border: 1px solid #e5e7eb;
    background: #f3f4f6;
}
.dark .blog-cover { border-color: #1f2937; background: #111827; }

/* ---- Spis treści ---- */
.blog-toc-wrap {
    margin-bottom: 2rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    background: #f9fafb;
    font-size: 0.875rem;
    min-width: 0;
}
.dark .blog-toc-wrap { border-color: #1f2937; background: #111827; }
.blog-toc-wrap > summary {
    cursor: pointer;
    padding: 0.75rem 1rem;
    font-weight: 700;
    color: #111827;
    list-style: none;
}
.blog-toc-wrap > summary::-webkit-details-marker { display: none; }
.blog-toc-wrap > summary::after { content: "\25be"; float: right; color: #9ca3af; }
.blog-toc-wrap[open] > summary::after { content: "\25b4"; }
.dark .blog-toc-wrap > summary { color: #ffffff; }
.blog-toc-wrap > summary:focus-visible { outline: 2px solid #6366f1; outline-offset: -2px; }

.blog-toc { padding: 0 1rem 0.875rem; }
.blog-toc ul { list-style: none; margin: 0; padding: 0; }
.blog-toc li + li { margin-top: 0.125rem; }
.blog-toc a {
    display: block;
    padding: 0.25rem 0.5rem;
    border-left: 2px solid transparent;
    color: #4b5563;
    text-decoration: none;
    overflow-wrap: anywhere;
}
.blog-toc a:hover { color: #4338ca; }
.blog-toc a.is-active, .blog-toc a[aria-current="true"] {
    border-left-color: #4f46e5;
    color: #4338ca;
    font-weight: 600;
}
.blog-toc .blog-toc-sub { padding-left: 1.25rem; }
.dark .blog-toc a { color: #9ca3af; }
.dark .blog-toc a:hover { color: #c7d2fe; }
.dark .blog-toc a.is-active, .dark .blog-toc a[aria-current="true"] { border-left-color: #818cf8; color: #c7d2fe; }

@media (min-width: 1024px) {
    .blog-toc-wrap { margin-bottom: 0; }
    .blog-toc-wrap.is-wide > summary { display: none; }
    .blog-toc-wrap.is-wide .blog-toc { padding-top: 0.75rem; }
    .blog-toc-wrap::details-content { content-visibility: visible; display: block; }
}

/* ---- Stopka wpisu ---- */
.blog-footer { margin-top: 3rem; display: grid; gap: 2rem; min-width: 0; }
.blog-md-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.875rem;
    color: #4f46e5;
    text-decoration: none;
}
.blog-md-link:hover { text-decoration: underline; }
.dark .blog-md-link { color: #818cf8; }

.blog-translations {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem 0.75rem;
    font-size: 0.875rem;
    color: #6b7280;
    min-width: 0;
}
.dark .blog-translations { color: #9ca3af; }
.blog-translations a { color: #4f46e5; text-decoration: none; overflow-wrap: anywhere; }
.blog-translations a:hover { text-decoration: underline; }
.dark .blog-translations a { color: #818cf8; }

.blog-related h2 { font-size: 1.125rem; font-weight: 700; color: #111827; margin-bottom: 0.75rem; }
.dark .blog-related h2 { color: #ffffff; }
.blog-related ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.blog-related li {
    padding: 0.875rem 1rem;
    border: 1px solid #f3f4f6;
    border-radius: 0.5rem;
    background: #f9fafb;
    min-width: 0;
}
.blog-related li:hover { border-color: rgba(99, 102, 241, 0.5); }
.dark .blog-related li { border-color: #1f2937; background: #111827; }
.blog-related a { font-weight: 600; color: #111827; text-decoration: none; overflow-wrap: anywhere; }
.blog-related a:hover { color: #4f46e5; }
.dark .blog-related a { color: #f3f4f6; }
.dark .blog-related a:hover { color: #a5b4fc; }
.blog-related p { margin-top: 0.25rem; font-size: 0.875rem; color: #4b5563; overflow-wrap: anywhere; }
.dark .blog-related p { color: #9ca3af; }
.blog-related-meta { margin-top: 0.375rem; font-size: 0.75rem; color: #6b7280; }
.dark .blog-related-meta { color: #9ca3af; }

/* ---- Lista wpisów ---- */
.blog-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1.5rem;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    color: #4b5563;
    min-width: 0;
}
.dark .blog-filters { color: #9ca3af; }
.blog-filter-group { display: inline-flex; flex-wrap: wrap; gap: 0.25rem; }
.blog-filter-group a {
    padding: 0.25rem 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 9999px;
    color: #374151;
    text-decoration: none;
}
.blog-filter-group a:hover { border-color: #a5b4fc; }
.blog-filter-group a[aria-current="true"] { background: #4f46e5; border-color: #4f46e5; color: #ffffff; }
.dark .blog-filter-group a { border-color: #374151; color: #d1d5db; }
.dark .blog-filter-group a:hover { border-color: #818cf8; }
.dark .blog-filter-group a[aria-current="true"] { background: #6366f1; border-color: #6366f1; color: #ffffff; }
.blog-filter-active { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.blog-filter-active a { color: #4f46e5; }
.dark .blog-filter-active a { color: #818cf8; }

.blog-card {
    display: block;
    min-width: 0;
    overflow: hidden;
    border: 1px solid #f3f4f6;
    border-radius: 0.5rem;
    background: #f9fafb;
    transition: border-color 0.2s;
}
.blog-card:hover { border-color: rgba(99, 102, 241, 0.5); }
.dark .blog-card { border-color: #1f2937; background: #111827; }
.blog-card-cover {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    background: #f3f4f6;
}
.dark .blog-card-cover { background: #1f2937; }
.blog-card-body { padding: 1rem 1.25rem; min-width: 0; }
.blog-card-title { font-size: 1.125rem; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.blog-card-title a { color: #111827; text-decoration: none; }
.blog-card-title a:hover { color: #4f46e5; }
.dark .blog-card-title a { color: #ffffff; }
.dark .blog-card-title a:hover { color: #a5b4fc; }
.blog-card-summary { margin-top: 0.5rem; font-size: 0.875rem; color: #4b5563; overflow-wrap: anywhere; }
.dark .blog-card-summary { color: #9ca3af; }
.blog-card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.75rem;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: #6b7280;
}
.dark .blog-card-meta { color: #9ca3af; }
.blog-card .blog-tags { margin-top: 0.75rem; }

@media (prefers-reduced-motion: no-preference) {
    html { scroll-behavior: smooth; }
}
