/*
 * Članak: kazalo + izgled teksta iz editora (inc/post-content.php, partials/toc.php).
 * Zasebna datoteka (ne ide kroz assets/dist), učitava se samo na članku.
 * Boje i font kao u temi: crvena #d51f26, tekst #4a4444, siva #f8f8f8, Inter.
 */

/* ---------- Stupac teksta se ne širi (široka slika / tablica / embed) ---------- */
.c-article__main {
    min-width: 0;
}

.c-article__editor {
    overflow-wrap: break-word;
}

/* ---------- Naslovi iz editora: svaka razina jasno različita ---------- */
.c-article__editor.u-rich-text > h2,
.c-article__editor.u-rich-text > h3,
.c-article__editor.u-rich-text > h4,
.c-article__editor.u-rich-text > h5,
.c-article__editor.u-rich-text > h6 {
    color: #4a4444;
    padding-top: 0;
    padding-bottom: 0;
}

.c-article__editor.u-rich-text > h2 {
    font-size: 28px;
    line-height: 34px;
    font-weight: 900;
    margin: 20px 0 16px;
}

.c-article__editor.u-rich-text > h3 {
    font-size: 21px;
    line-height: 28px;
    font-weight: 700;
    margin: 12px 0 12px;
}

.c-article__editor.u-rich-text > h4 {
    font-size: 18px;
    line-height: 26px;
    font-weight: 700;
    color: #d51f26;
    margin: 6px 0 8px;
}

.c-article__editor.u-rich-text > h5 {
    font-size: 14px;
    line-height: 20px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 4px 0 8px;
}

.c-article__editor.u-rich-text > h6 {
    font-size: 12px;
    line-height: 18px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(74, 68, 68, 0.7);
    margin: 4px 0 8px;
}

.c-article__editor.u-rich-text > h2:first-child,
.c-article__editor.u-rich-text > h3:first-child,
.c-article__editor.u-rich-text > h4:first-child,
.c-article__editor.u-rich-text > h5:first-child,
.c-article__editor.u-rich-text > h6:first-child {
    margin-top: 0;
}

/* Naslov uvijek počinje ispod slike poravnate lijevo/desno, ne uz nju */
.c-article__editor.u-rich-text > h2,
.c-article__editor.u-rich-text > h3,
.c-article__editor.u-rich-text > h4,
.c-article__editor.u-rich-text > h5,
.c-article__editor.u-rich-text > h6,
.c-article__editor.u-rich-text > table,
.c-article__editor.u-rich-text > blockquote {
    clear: both;
}

/* Sidro naslova ne smije završiti ispod fiksnog izbornika */
.c-article__editor [id^="naslov-"] {
    scroll-margin-top: 110px;
}

/* ---------- Slike, opisi, embedovi ---------- */
.c-article__editor img {
    max-width: 100%;
    height: auto;
}

.c-article__editor .wp-caption {
    width: auto !important;
    max-width: 100%;
    margin: 0 0 30px;
}

.c-article__editor .wp-caption img {
    display: block;
}

.c-article__editor .wp-caption.aligncenter {
    text-align: center;
}

.c-article__editor .wp-caption.aligncenter img {
    margin: 0 auto;
}

.c-article__editor .wp-caption-text,
.c-article__editor figcaption {
    font-size: 13px;
    line-height: 19px;
    color: rgba(74, 68, 68, 0.75);
    padding-top: 8px;
}

.c-article__editor .aligncenter {
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.c-article__editor .alignleft {
    float: left;
    max-width: 50%;
    margin: 6px 28px 16px 0;
}

.c-article__editor .alignright {
    float: right;
    max-width: 50%;
    margin: 6px 0 16px 28px;
}

/* Slika s opisom umetnuta na početak odlomka: WordPress ostavi prazan odlomak ispred nje (višak razmaka) */
.c-article__editor.u-rich-text > p:empty:has(+ .wp-caption) {
    display: none;
}

.c-article__editor .wp-caption.alignleft,
.c-article__editor .wp-caption.alignright {
    margin-bottom: 20px;
}

.c-article__editor::after {
    content: "";
    display: table;
    clear: both;
}

.c-article__editor iframe {
    max-width: 100%;
}

/* ---------- Tablice ---------- */
.c-article__editor table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 30px;
    font-size: 15px;
    line-height: 22px;
}

.c-article__editor th,
.c-article__editor td {
    border: 1px solid #e6e3e3;
    padding: 8px 10px;
    text-align: left;
    vertical-align: top;
}

.c-article__editor th,
.c-article__editor thead td {
    background: #f8f8f8;
    font-weight: 700;
}

/* ---------- Popisi ---------- */
/* Crvena točka / crveni broj, svi redci stavke poravnati s tekstom, manji razmak između stavki */
.c-article__editor.u-rich-text ul,
.c-article__editor.u-rich-text ol {
    list-style-position: outside;
    margin: 0;
    padding: 0 0 30px 1.5em;
}

.c-article__editor.u-rich-text ul {
    list-style-type: disc;
}

.c-article__editor.u-rich-text ol {
    list-style-type: decimal;
}

.c-article__editor.u-rich-text ul li,
.c-article__editor.u-rich-text ol li {
    padding: 0 0 10px 0.35em;
}

.c-article__editor.u-rich-text li:last-child {
    padding-bottom: 0;
}

.c-article__editor.u-rich-text li::marker {
    color: #d51f26;
}

.c-article__editor.u-rich-text ol > li::marker {
    font-weight: 700;
}

/* Ugniježđeni popis: šuplja točka, uvučen */
.c-article__editor.u-rich-text li > ul,
.c-article__editor.u-rich-text li > ol {
    padding: 10px 0 0 1.25em;
}

.c-article__editor.u-rich-text li > ul {
    list-style-type: circle;
}

/* ---------- Citat ---------- */
/* Crvena linija lijevo, svijetla pozadina, veći tekst; autor (cite) ispod. Ugrađene objave (Instagram, X…) se ne diraju. */
.c-article__editor.u-rich-text > blockquote:not([class*="instagram"]):not([class*="twitter"]):not([class*="tiktok"]):not(.wp-embedded-content) {
    margin: 6px 0 36px;
    padding: 22px 28px 22px 26px;
    background: #f8f8f8;
    border-left: 4px solid #d51f26;
    font-size: 20px;
    line-height: 31px;
    color: #4a4444;
}

.c-article__editor.u-rich-text > blockquote:not([class*="instagram"]):not([class*="twitter"]):not([class*="tiktok"]):not(.wp-embedded-content)::before {
    content: none;
    display: none;
}

.c-article__editor.u-rich-text > blockquote p {
    font-size: inherit;
    line-height: inherit;
    padding: 0 0 14px;
    margin: 0;
}

.c-article__editor.u-rich-text > blockquote p:last-child,
.c-article__editor.u-rich-text > blockquote p:last-of-type {
    padding-bottom: 0;
}

/* Klasični editor stavlja <br> ispred autora citata – razmak već daje cite */
.c-article__editor.u-rich-text > blockquote br:has(+ cite) {
    display: none;
}

.c-article__editor.u-rich-text > blockquote cite,
.c-article__editor.u-rich-text > blockquote footer {
    display: block;
    margin-top: 14px;
    font-size: 14px;
    line-height: 20px;
    font-style: normal;
    font-weight: 700;
    color: rgba(74, 68, 68, 0.75);
}

/* ---------- Kazalo ---------- */
.c-toc {
    background: #f8f8f8;
    border-top: 3px solid #d51f26;
    padding: 22px 24px 14px;
    margin-bottom: 40px;
    color: #4a4444;
}

.c-toc__title {
    font-size: 13px;
    line-height: 18px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0 0 6px;
}

.c-toc__list {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: zbtoc;
}

.c-toc__item {
    display: flex;
    align-items: flex-start;
    padding: 11px 0;
    font-size: 15px;
    line-height: 21px;
    font-weight: 700;
}

/* Linija samo između glavnih stavki */
.c-toc__item + .c-toc__item:not(.c-toc__item--sub) {
    border-top: 1px solid rgba(74, 68, 68, 0.14);
}

.c-toc__item:not(.c-toc__item--sub)::before {
    content: counter(zbtoc, decimal-leading-zero);
    counter-increment: zbtoc;
    flex: none;
    width: 30px;
    color: #d51f26;
    font-weight: 900;
}

.c-toc__item:has(+ .c-toc__item--sub) {
    padding-bottom: 6px;
}

/* Podstavka (H3): bez broja, uvučena, okomita crta grupira podnaslove */
.c-toc__item--sub {
    margin-left: 30px;
    padding: 4px 0 4px 12px;
    border-left: 2px solid rgba(74, 68, 68, 0.14);
    font-size: 14px;
    line-height: 20px;
    font-weight: 400;
}

.c-toc__item--sub:has(+ .c-toc__item:not(.c-toc__item--sub)),
.c-toc__item--sub:last-child {
    margin-bottom: 8px;
}

.c-toc__link {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s;
}

.c-toc__link:hover,
.c-toc__link:focus-visible,
.c-toc__item.is-active > .c-toc__link {
    color: #d51f26;
}

.c-toc__item--sub.is-active {
    border-left-color: #d51f26;
}

/* Desktop: kazalo na vrhu bočne trake; mobitel: sklopivo iznad teksta */
.c-toc--mobile {
    display: none;
}

@media (max-width: 800px) {
    .c-toc--desktop {
        display: none;
    }

    .c-toc--mobile {
        display: block;
        padding: 0;
        margin: 0 0 28px;
    }

    .c-toc--mobile .c-toc__title {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        margin: 0;
        padding: 16px 18px;
        cursor: pointer;
        list-style: none;
        -webkit-tap-highlight-color: transparent;
    }

    .c-toc--mobile .c-toc__title::-webkit-details-marker {
        display: none;
    }

    .c-toc--mobile .c-toc__title::after {
        content: "";
        flex: none;
        width: 9px;
        height: 9px;
        margin-left: auto;
        border-right: 2px solid #d51f26;
        border-bottom: 2px solid #d51f26;
        transform: translateY(-3px) rotate(45deg);
        transition: transform 0.2s;
    }

    .c-toc--mobile[open] .c-toc__title::after {
        transform: translateY(2px) rotate(-135deg);
    }

    .c-toc__count {
        font-weight: 700;
        color: rgba(74, 68, 68, 0.6);
        letter-spacing: 0;
    }

    .c-toc--mobile .c-toc__list {
        padding: 0 18px 10px;
    }

    /* Veća površina za dodir */
    .c-toc__item {
        padding: 12px 0;
        font-size: 15px;
    }

    .c-toc__item--sub {
        padding: 7px 0 7px 12px;
    }

    /* Tekst iza slike s opisom WordPress ostavi izvan odlomka: ista veličina kao odlomak */
    .c-article__editor.u-rich-text {
        font-size: 14px;
        line-height: 24px;
    }

    .c-article__editor.u-rich-text > h2 {
        font-size: 22px;
        line-height: 28px;
        margin: 14px 0 12px;
    }

    .c-article__editor.u-rich-text > h3 {
        font-size: 19px;
        line-height: 25px;
        margin: 8px 0 10px;
    }

    .c-article__editor.u-rich-text > h4 {
        font-size: 17px;
        line-height: 24px;
    }

    .c-article__editor [id^="naslov-"] {
        scroll-margin-top: 80px;
    }

    .c-article__editor .alignleft,
    .c-article__editor .alignright {
        float: none;
        max-width: 100%;
        margin: 0 0 20px;
    }

    .c-article__editor.u-rich-text ul li,
    .c-article__editor.u-rich-text ol li {
        padding-bottom: 8px;
    }

    .c-article__editor.u-rich-text > blockquote:not([class*="instagram"]):not([class*="twitter"]):not([class*="tiktok"]):not(.wp-embedded-content) {
        padding: 18px 18px 18px 20px;
        font-size: 17px;
        line-height: 27px;
        margin-bottom: 30px;
    }

    /* Tablica se pomiče vodoravno umjesto da razvuče stranicu */
    .c-article__editor table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        font-size: 14px;
    }
}
