/*
 * Kompatibilní vrstva pro klasický (neblokový) obsah.
 *
 * MIGRACE-PLAN.md: 1126 z 1129 příspěvků je klasické HTML, které se ve
 * FSE šabloně vykresluje přes wp:post-content jako prosté HTML uvnitř
 * .wp-block-post-content — bez vlastních block-editor stylů. Tahle vrstva
 * dorovnává základní prvky (nadpisy, tabulky, seznamy, citace) na tokeny
 * gov.cz theme.json, aby nezůstaly zcela nestylované.
 *
 * Nejde o kompletní řešení Rizika #4/#5 — 296 stránek s tabulkami a 330
 * s inline styly (nejvyšší specificita, tahle vrstva je nepřebije) je
 * podle plánu potřeba jednotlivě projít ve Fázi 3.
 */

.wp-block-post-content {
    color: var(--wp--preset--color--contrast);
    font-size: var(--wp--preset--font-size--body-m);
    line-height: 1.6;
}

.wp-block-post-content h1,
.wp-block-post-content h2,
.wp-block-post-content h3,
.wp-block-post-content h4,
.wp-block-post-content h5,
.wp-block-post-content h6 {
    font-weight: 700;
    line-height: 1.25;
    margin-top: var(--wp--preset--spacing--60, 2rem);
    margin-bottom: var(--wp--preset--spacing--30, 1rem);
}
.wp-block-post-content h1 { font-size: var(--wp--preset--font-size--headline-xl); }
.wp-block-post-content h2 { font-size: var(--wp--preset--font-size--headline-l); }
.wp-block-post-content h3 { font-size: var(--wp--preset--font-size--headline-m); }
.wp-block-post-content h4,
.wp-block-post-content h5,
.wp-block-post-content h6 { font-size: var(--wp--preset--font-size--body-l); }

.wp-block-post-content p {
    margin-top: 0;
    margin-bottom: var(--wp--preset--spacing--30, 1rem);
}

.wp-block-post-content a {
    color: var(--wp--preset--color--accent-1);
    text-decoration: underline;
}
.wp-block-post-content a:hover {
    text-decoration: none;
}

.wp-block-post-content ul,
.wp-block-post-content ol {
    margin: 0 0 var(--wp--preset--spacing--30, 1rem);
    padding-left: 1.5em;
}
.wp-block-post-content li {
    margin-bottom: 0.4em;
}

.wp-block-post-content blockquote {
    margin: var(--wp--preset--spacing--40, 1.25rem) 0;
    padding: 0.5rem 0 0.5rem 1.25rem;
    border-left: 4px solid var(--wp--preset--color--accent-1);
    color: var(--wp--preset--color--accent-6);
    font-style: italic;
}

.wp-block-post-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--absgov-radius);
}

.wp-block-post-content hr {
    border: none;
    border-top: 1px solid var(--wp--preset--color--accent-5);
    margin: var(--wp--preset--spacing--60, 2rem) 0;
}

/* Tabulky - 296 stránek podle MIGRACE-PLAN.md obsahuje <table> bez tříd */
.wp-block-post-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: var(--wp--preset--spacing--40, 1.25rem);
    font-size: var(--wp--preset--font-size--body-s);
    display: block;
    overflow-x: auto;
}
.wp-block-post-content th,
.wp-block-post-content td {
    border: 1px solid var(--wp--preset--color--accent-5);
    padding: 0.5rem 0.75rem;
    text-align: left;
    vertical-align: top;
}
.wp-block-post-content th {
    background: var(--wp--preset--color--accent-4);
    font-weight: 700;
}
.wp-block-post-content tr:nth-child(even) td {
    background: var(--wp--preset--color--accent-4);
}

.wp-block-post-content iframe {
    max-width: 100%;
}

/* Klasická [gallery] (shortcode ze starého editoru, viz gallery_shortcode())
 * — bez motivu s "html5" gallery podporou WP nevykresluje sloupcové inline
 * styly a bez vlastního CSS se .gallery-item skládaly pod sebe na celou
 * šířku. Rozloženo do mřížky podle gallery-columns-N třídy, kterou shortcode
 * vždy vypisuje. */
.wp-block-post-content .gallery {
    display: grid;
    gap: var(--wp--preset--spacing--30, 1rem);
    margin: 0 0 var(--wp--preset--spacing--40, 1.25rem);
}
.wp-block-post-content .gallery-columns-1 { grid-template-columns: repeat(1, 1fr); }
.wp-block-post-content .gallery-columns-2 { grid-template-columns: repeat(2, 1fr); }
.wp-block-post-content .gallery-columns-3 { grid-template-columns: repeat(3, 1fr); }
.wp-block-post-content .gallery-columns-4 { grid-template-columns: repeat(4, 1fr); }
.wp-block-post-content .gallery-columns-5 { grid-template-columns: repeat(5, 1fr); }
.wp-block-post-content .gallery-columns-6 { grid-template-columns: repeat(6, 1fr); }
.wp-block-post-content .gallery-columns-7 { grid-template-columns: repeat(7, 1fr); }
.wp-block-post-content .gallery-columns-8 { grid-template-columns: repeat(8, 1fr); }
.wp-block-post-content .gallery-columns-9 { grid-template-columns: repeat(9, 1fr); }
.wp-block-post-content .gallery-item {
    margin: 0;
}
.wp-block-post-content .gallery-item .gallery-icon {
    line-height: 0;
}
.wp-block-post-content .gallery-item img {
    width: 100%;
    height: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}
.wp-block-post-content .gallery-caption {
    margin-top: 0.35rem;
    font-size: var(--wp--preset--font-size--body-s);
    color: var(--wp--preset--color--accent-6);
}
@media (max-width: 600px) {
    .wp-block-post-content .gallery-columns-4,
    .wp-block-post-content .gallery-columns-5,
    .wp-block-post-content .gallery-columns-6,
    .wp-block-post-content .gallery-columns-7,
    .wp-block-post-content .gallery-columns-8,
    .wp-block-post-content .gallery-columns-9 {
        grid-template-columns: repeat(3, 1fr);
    }
}
