body { padding-top: 4rem; line-height: 1.6; }

/* === Nagłówek artykułu (tytuł + meta) === */
.article-header {
    background: radial-gradient(120% 140% at 0% 0%, #ffffff 0, #f8f9ff 40%, #f3f4ff 100%);
    border: 1px solid #e3e6ef;
    border-radius: 0.9rem;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.75rem;
    box-shadow: 0 0.4rem 1.2rem rgba(15, 23, 42, 0.06);
}

.article-header h1 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0 0 0.35rem 0;
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.article-header h1::before {
    content: "";
    width: 4px;
    height: 1.9rem;
    border-radius: 999px;
    background: linear-gradient(180deg, #0d6efd, #6610f2);
}

.article-header p {
    margin: 0;
    font-size: 0.9rem;
    color: #6c757d;
}

.article-header p::before {
    content: "ARTYKUŁ";
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.68rem;
    font-weight: 600;
    color: #a0a4b8;
    margin-right: 0.75rem;
    padding-right: 0.75rem;
    border-right: 1px solid #e1e4f0;
}

.sidebar {
    border-left: 1px solid #e9ecef;
    padding-left: 1rem;
}

/* === Spis treści === */
#toc {
    background-color: #fdfdff;
    border: 1px solid #e3e6ef;
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    margin-bottom: 1.75rem;
    box-shadow: 0 0.25rem 0.75rem rgba(15, 23, 42, 0.04);
}

/*#toc a.active{*/
/*    color:#0d6efd;*/
/*    background-color: rgba(13,110,253,0.06);*/
/*    padding-left: .5rem*/
/*}*/

/*@media (min-width: 992px){*/
/*    #toc { position: sticky; top: 5.25rem; }*/
/*}*/

#toc h5 {
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #6c757d;
    margin: 0 0 0.75rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#toc h5::before {
    content: "☰";
    font-size: 1.05rem;
    line-height: 1;
    color: #0d6efd;
}

#toc ol {
    margin: 0;
    padding-left: 0.25rem;
    list-style: none;
}

#toc li {
    margin-bottom: 0.25rem;
}

#toc a {
    display: inline-flex;
    align-items: baseline;
    gap: 0.35rem;
    font-size: 0.95rem;
    text-decoration: none;
    color: #343a40;
    padding: 0.15rem 0.25rem;
    border-radius: 0.25rem;
    transition:
            color 0.15s ease,
            background-color 0.15s ease,
            padding-left 0.15s ease;
}

#toc a::before {
    content: "•";
    font-size: 0.65rem;
    line-height: 1;
    color: #0d6efd;
    transform: translateY(-0.05rem);
}

#toc a:hover {
    color: #0d6efd;
    background-color: rgba(13, 110, 253, 0.04);
    padding-left: 0.5rem;
}

#toc a:focus-visible {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

.callout {
    background-color: #f0f4ff;
    border-left: 4px solid #0d6efd;
    padding: 1rem;
    margin: 1.5rem 0;
    border-radius: 0.25rem;
}

.markmap { position: relative; margin-bottom: 2rem; }
.markmap > .article-content svg{ width: 100%; height: auto; }
.article-content svg[height]{ height: auto; }


.temp-card {
    background-color: #f8f9ff;
    border-radius: 0.5rem;
    padding: 1rem 1.25rem;
}

.temp-label {
    font-weight: 600;
}

.chart-figure {
    margin: 0;
}

.chart-caption {
    font-size: 0.875rem;
    color: #6c757d;
    margin-top: 0.25rem;
}

/* === Oś czasu (timeline) === */
.timeline {
    position: relative;
    margin: 1.25rem 0 2rem;
    padding-left: 1.25rem;
}

.timeline::before {
    content: "";
    position: absolute;
    left: 0.35rem;
    top: 0.25rem;
    bottom: 0.25rem;
    width: 2px;
    background: linear-gradient(180deg, rgba(13,110,253,0.65), rgba(102,16,242,0.65));
    border-radius: 999px;
    opacity: 0.9;
}

.timeline-item {
    position: relative;
    padding-left: 1.75rem;
    margin-bottom: 1.15rem;
}

.timeline-item:last-child { margin-bottom: 0; }

.timeline-dot {
    position: absolute;
    left: -0.05rem;
    top: 0.35rem;
    width: 0.85rem;
    height: 0.85rem;
    border-radius: 999px;
    border: 2px solid #0d6efd;
    background: #ffffff;
    box-shadow: 0 0.35rem 0.8rem rgba(15,23,42,0.12);
}

.timeline-card {
    border: 1px solid #e3e6ef;
    border-radius: 0.75rem;
    background: #ffffff;
    padding: 0.9rem 1rem;
    box-shadow: 0 0.25rem 0.75rem rgba(15, 23, 42, 0.05);
}

.timeline-year {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: #0d6efd;
    margin-bottom: 0.15rem;
}

.timeline-title {
    margin: 0.15rem 0 0.4rem;
    font-weight: 650;
    color: #111827;
}

.timeline-card ul {
    margin: 0;
    padding-left: 1.1rem;
}

.timeline-card li { margin-bottom: 0.2rem; }
.timeline-card li:last-child { margin-bottom: 0; }

/* === Nagłówki artykułu – tytuły sekcji (h2) === */
.article-content h2 {
    position: relative;
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.35rem;
    border-bottom: 2px solid #e9ecef;
    letter-spacing: 0.02em;
    scroll-margin-top: 5rem;
}
/* zamiast tylko h2 */
.article-content :is(h2, h3, h4, [id]) {
    scroll-margin-top: 5.5rem;
}

.article-content h2::before {
    content: "";
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 72px;
    height: 3px;
    border-radius: 999px;
    background: linear-gradient(90deg, #0d6efd, #6610f2);
}

/* === Podtytuły (h3) === */
.article-content h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    padding-left: 0.75rem;
    border-left: 3px solid #0d6efd;
    display: flex;
    align-items: center;
}

.article-content h3::after {
    content: "";
    flex: 1;
    height: 1px;
    margin-left: 0.75rem;
    background: linear-gradient(
            90deg,
            rgba(13, 110, 253, 0.35),
            transparent
    );
}

/* === Tabele === */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

table thead {
    background-color: #f8f9ff;
}

table th,
table td {
    border: 1px solid #e3e6ef;
    padding: 0.5rem 0.6rem;
    vertical-align: top;
}

table th {
    font-weight: 600;
}

/* === Przypisy / źródła === */
.fn-ref {
    font-size: 0.75em;
    vertical-align: super;
}

.fn-ref a {
    text-decoration: none;
    color: #0d6efd;
    border-bottom: 1px dotted rgba(13,110,253,0.6);
    cursor: pointer;
}

.fn-ref a:hover {
    text-decoration: none;
}

.footnotes {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e1e4f0;
    font-size: 0.875rem;
    color: #495057;
}

.footnotes h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 0.75rem;
    padding-left: 0;
    border-left: none;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #6c757d;
}

.footnotes h3::after {
    display: none;
}

.footnotes ol {
    margin: 0;
    padding-left: 1.25rem;
}

.footnotes li {
    margin-bottom: 0.4rem;
}

.footnotes li::marker {
    font-weight: 600;
    color: #0d6efd;
}

.footnotes a.source-link {
    text-decoration: none;
    color: #0d6efd;
}

.footnotes a.source-link:hover {
    text-decoration: underline;
}

.fn-back {
    margin-left: 0.35rem;
    text-decoration: none;
    font-size: 0.8em;
    color: #6c757d;
}

.fn-back:hover {
    color: #0d6efd;
}

/* Popover przypisów */
.footnote-popover {
    max-width: 320px;
    font-size: 0.78rem;
}

/* === Interaktywny kreator promptu === */
.prompt-builder {
    border-radius: 0.75rem;
    border: 1px solid #e3e6ef;
    background-color: #ffffff;
}

.prompt-builder .nav-pills .nav-link {
    font-size: 0.9rem;
}

.prompt-builder .nav-pills .nav-link:not(.active) {
    background-color: #f5f6ff;
}

.prompt-builder-preview {
    background: radial-gradient(130% 160% at 0% 0%, #020617 0, #020617 45%, #020617 100%);
    color: #e5e7eb;
    border-radius: 0.75rem;
    padding: 0.9rem 1rem;
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.86rem;
    max-height: 260px;
    overflow: auto;
    border: 1px solid #111827;
    box-shadow: 0 0.6rem 1.6rem rgba(15, 23, 42, 0.55);
    position: relative;
}

.prompt-builder-preview::before {
    content: "Schemat promptu";
    position: absolute;
    top: 0.4rem;
    right: 0.8rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: #9ca3af;
}

.prompt-builder-preview code {
    color: inherit;
    background: none;
}

/* === Laboratorium RAG === */
.rag-lab {
    border-radius: 0.75rem;
    border: 1px solid #e3e6ef;
    background-color: #ffffff;
}

.rag-lab-output {
    border-top: 1px dashed #dee2e6;
    padding-top: 0.75rem;
    margin-top: 0.5rem;
}

.rag-lab .btn-group .btn.active {
    background-color: #0d6efd;
    color: #ffffff;
}

/* === Interaktywne definicje (glossary) === */
.def-ref {
    position: relative;
    color: #0d6efd;
    text-decoration: none;
    border-bottom: 1px dotted rgba(13, 110, 253, 0.7);
    cursor: pointer;
    font-weight: 500;
    transition:
            color 0.15s ease,
            border-bottom-color 0.15s ease,
            background-color 0.15s ease;
}

.def-ref:hover {
    color: #0b5ed7;
    border-bottom-style: solid;
    background-color: rgba(13, 110, 253, 0.03);
}

.definition-popover.bs-popover-top,
.definition-popover.bs-popover-bottom,
.definition-popover.bs-popover-start,
.definition-popover.bs-popover-end {
    max-width: 320px;
    border-radius: 0.75rem;
    border: 1px solid #e3e6ef;
    box-shadow: 0 0.75rem 1.8rem rgba(15, 23, 42, 0.16);
}

.definition-popover .popover-body {
    padding: 0.6rem 0.7rem;
    font-size: 0.78rem;
    color: #111827;
}

.definition-popover .popover-body strong {
    display: block;
    margin-bottom: 0.15rem;
    font-size: 0.8rem;
}

.equation-card{
    background: radial-gradient(120% 140% at 0% 0%, #ffffff 0, #f8f9ff 45%, #f3f4ff 100%);
    border: 1px solid #e3e6ef;
    border-radius: 0.85rem;
    padding: 1rem 1.25rem;
    box-shadow: 0 0.35rem 1.05rem rgba(15, 23, 42, 0.06);
    margin: 0 0 1.25rem 0;
}

.equation-label{
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: #6c757d;
    margin-bottom: 0.35rem;
}

.equation-label::before{
    content: "∑";
    color: #0d6efd;
    font-size: 1.05rem;
    line-height: 1;
}

.equation{
    overflow-x: auto;
    padding: 0.25rem 0.1rem;
}

.equation .katex-display{ margin: 0.35rem 0 0; }

.var-card{
    border-top: 1px dashed #dee2e6;
    padding-top: 0.75rem;
    margin-top: 0.75rem;
}

.var-title{
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #6c757d;
    margin-bottom: 0.55rem;
}

.var-defs{ margin: 0; display: grid; gap: 0.45rem; }

.var-row{
    display: grid;
    grid-template-columns: minmax(7.25rem, max-content) 1fr;
    gap: 0.9rem;
    align-items: start;
}

.var-defs dt{
    margin: 0;
    font-weight: 800;
    color: #111827;
    white-space: nowrap;
}

.var-defs dd{ margin: 0; color: #495057; }

.article-content .katex{ font-size: 1.03em;}

/* === Karty: checklisty i antywzorce (spójne z equation-card / temp-card) === */
.checklist-card {
    background: radial-gradient(
            120% 140% at 0% 0%,
            #ffffff 0,
            #f8f9ff 45%,
            #f3f4ff 100%
    );
    border: 1px solid #e3e6ef;
    border-radius: 0.75rem;
    padding: 0.9rem 1rem;
    box-shadow: 0 0.35rem 1rem rgba(15, 23, 42, 0.06);
}

.checklist-card p:first-child {
    font-size: 0.9rem;
    font-weight: 600;
}

.checklist-card ul {
    margin: 0;
    padding-left: 1.1rem;
    font-size: 0.88rem;
    color: #495057;
}

.checklist-card li {
    margin-bottom: 0.25rem;
}

.checklist-card li:last-child {
    margin-bottom: 0;
}

.anti-pattern-card {
    background: radial-gradient(
            120% 140% at 0% 0%,
            #ffffff 0,
            #fff7f7 45%,
            #ffecec 100%
    );
    border: 1px solid #f1c4c4;
    border-radius: 0.75rem;
    padding: 0.85rem 1rem;
    box-shadow: 0 0.35rem 1rem rgba(148, 27, 12, 0.06);
}

.anti-pattern-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: #c53030;
    margin-bottom: 0.3rem;
}

.anti-pattern-label::before {
    content: "!";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.1rem;
    height: 1.1rem;
    border-radius: 999px;
    border: 1px solid rgba(220, 53, 69, 0.4);
    font-size: 0.75rem;
    color: #dc3545;
    padding-left: 2px;
}

.anti-pattern-card p {
    font-size: 0.9rem;
}

.anti-pattern-card .small {
    font-size: 0.82rem;
}

/* === Tabele wzorców / antywzorców === */
.pattern-table {
    font-size: 0.9rem;
}

.pattern-table caption {
    caption-side: top;
    text-align: left;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #6c757d;
    padding-bottom: 0.3rem;
}

/* === Bloki szablonów promptów (dopasowane do reszty) === */
.template-pre {
    background-color: #fdfdff;
    border: 1px solid #e3e6ef;
    border-radius: 0.75rem;
    padding: 0.75rem 0.9rem;
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.86rem;
    line-height: 1.5;
    white-space: pre-wrap;
}

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

.pattern-table caption {
    caption-side: top;
    text-align: left;
    font-size: 0.82rem;
    font-weight: 600;
    color: #6c757d;
    padding-bottom: 0.25rem;
}

/* ===== Pasek progresu czytania ===== */
:root{
    /* U Ciebie body ma padding-top: 4rem, więc to zwykle idealny offset pod navbar */
    --pc-nav-offset: 70px;

    --pc-progress-h: 3px;
    --pc-progress-radius: 999px;

    /* Akcenty (fallback, jeśli nie masz tokenów) */
    --pc-accent: #0d6efd;
    --pc-accent2: #6610f2;
}

.read-progress{
    position: fixed;
    left: 0;
    right: 0;

    /* pod navbar + uwzględnij safe-area na iOS */
    top: calc(var(--pc-nav-offset) + env(safe-area-inset-top, 0px));

    height: var(--pc-progress-h);
    z-index: 1029;              /* zwykle tuż pod .navbar (1030) */
    pointer-events: none;

    /* subtelny „tor” (działa w jasnym i ciemnym) */
    background:
            linear-gradient(
                    to right,
                    transparent 0%,
                    rgba(0,0,0,0.06) 8%,
                    rgba(0,0,0,0.06) 92%,
                    transparent 100%
            );
    overflow: hidden;
}

[data-bs-theme="dark"] .read-progress{
    background:
            linear-gradient(
                    to right,
                    transparent 0%,
                    rgba(255,255,255,0.10) 8%,
                    rgba(255,255,255,0.10) 92%,
                    transparent 100%
            );
}

.read-progress > span{
    display: block;
    height: 100%;
    width: 0%;
    border-radius: var(--pc-progress-radius);

    background: linear-gradient(90deg, var(--pc-accent), var(--pc-accent2));
    box-shadow: 0 0.6rem 1.2rem rgba(13,110,253,0.22);

    transform: translateZ(0);    /* mniej „szarpania” na niektórych GPU */
    transition: width 90ms linear;
}

@media (prefers-reduced-motion: reduce){
    .read-progress > span{ transition: none; }
}

.article-content{
    max-width: var(--pc-max-line);
    margin-inline: auto;
    font-size: 1.02rem;
    line-height: 1.75;
    text-wrap: pretty;
    hyphens: auto;
}

.article-content :is(h1,h2,h3){ text-wrap: balance; }

.reading-time{
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    /*font-weight: 600;*/
    color: var(--pc-muted);
}
.reading-time::before{ content:"⏱"; opacity: .85; }

.back-to-top{
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 1030;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity .2s ease, transform .2s ease;
}
.back-to-top.show{ opacity: 1; transform: translateY(0); }

/* === Justowanie treści (elegancko, nie na siłę) === */
@media (min-width: 768px) {
    .article-content p:not(.callout) {
        text-align: justify;
        text-align-last: left;     /* ostatnia linia normalnie */
        text-justify: inter-word;  /* hint (tam gdzie wspierane) */
    }
}

/* Krótkie „kafle” zostaw do lewej — justowanie tu wygląda gorzej */
.article-content .callout { text-align: left; }

/*@media print {*/
/*    nav.navbar, .sidebar, .read-progress, .col-lg-9, .col-lg-3, .markmap, .rag-lab, canvas,*/
/*    .btn, .copy-template-btn {*/
/*        display: none !important;*/
/*    }*/

/*    body {*/
/*        padding-top: 0 !important;*/
/*    }*/

/*    .article-header {*/
/*        box-shadow: none !important;*/
/*        border: none !important;*/
/*        padding: 0 !important;*/
/*    }*/

/*    .col-lg-9 {*/
/*        width: 100% !important;*/
/*    }*/

/*    .col-lg-3 {*/
/*        width: 0 !important;*/
/*    }*/

/*    a {*/
/*        color: inherit !important;*/
/*        text-decoration: underline !important;*/
/*    }*/
/*}*/



.brand-mark{ width: 34px; height: 34px; display: block; flex-shrink: 0; }
@media (min-width: 992px){ .brand-mark{ width: 36px; height: 36px; } }

.brand-lockup{
  height: 32px;
  width: auto;
  display: block;
}
.brand-chip{
  display: inline-flex;
  align-items: center;
  padding: .18rem .55rem;
  border-radius: 999px;
  border: 1px solid var(--luage-border);
  background: rgba(255,255,255,.72);
  color: rgba(27,36,51,.72);
  font-weight: 900;
  font-size: .78rem;
  letter-spacing: .02em;
}
@media (min-width: 992px){
  .brand-lockup{ height: 36px; }
  .brand-chip{ font-size: .8rem; }
}
