/*
 * Rich text written in the admin, styled the same in two places:
 *   - on the website:        .content-prose          (HTML from App\Support\ContentHtml::render)
 *   - in the admin's editor: .dch-content-editor .tiptap   (App\Filament\Support\ContentEditor)
 * so what the editor sees while writing is what the visitor sees.
 *
 * Headings: the editor offers H2 "Nadpis" and H3 "Podnadpis" (H4 for legacy texts). On the
 * website they move below the page's own headings and carry the visual level as a class:
 * H2 -> .prose-l1, H3 -> .prose-l2, H4 -> .prose-l3.
 *
 * On the website load after style.css (the theme styles p, li and headings globally); in the
 * admin it is linked from the panel's <head> together with the website fonts.
 */

/* ---------- Root ---------- */
:is(.content-prose, .dch-content-editor .tiptap) {
    --prose-text: #3f3d4f;
    --prose-heading: #2B2540;
    --prose-accent: #2563EB;
    --prose-muted: #6b6a7b;
    --prose-line: #e6e8ef;
    --prose-soft: #f4f7ff;
    color: var(--prose-text);
    font-family: 'Poppins', sans-serif;
    font-size: 16.5px;
    line-height: 1.7;
    overflow-wrap: break-word;
}
:is(.content-prose, .dch-content-editor .tiptap) > :first-child { margin-top: 0 !important; }
:is(.content-prose, .dch-content-editor .tiptap) > :last-child { margin-bottom: 0 !important; }

/* ---------- Paragraphs ---------- */
:is(.content-prose, .dch-content-editor .tiptap) :is(p, li, td, th, blockquote) {
    font-family: inherit;
}
:is(.content-prose, .dch-content-editor .tiptap) p {
    margin: 0 0 1em;
    padding: 0;
    color: inherit;
    font-size: inherit;
    line-height: inherit;
    font-weight: 400;
}
/* A paragraph introducing a list ("V každém apartmánu najdete:", "Ložnice:") stays close to it */
:is(.content-prose, .dch-content-editor .tiptap) p:has(+ :is(ul, ol)) { margin-bottom: 0.45em; }

/* The opening paragraph (or the one right after the text's first heading) reads as a lead */
.content-prose > p:first-child,
.content-prose > .prose-l1:first-child + p,
.dch-content-editor .tiptap > p:first-child,
.dch-content-editor .tiptap > :is(h1, h2):first-child + p {
    font-size: 1.08em;
    color: #2f2d3d;
}

/* ---------- Headings ---------- */
:is(.content-prose :is(.prose-l1, .prose-l2, .prose-l3), .dch-content-editor .tiptap :is(h1, h2, h3, h4, h5, h6)) {
    color: var(--prose-heading);
    font-family: 'Roboto', sans-serif;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.01em;
    padding: 0;
}
/* Nadpis */
:is(.content-prose .prose-l1, .dch-content-editor .tiptap :is(h1, h2)) { font-size: 1.35rem; margin: 1.7em 0 0.55em; }
/* Podnadpis */
:is(.content-prose .prose-l2, .dch-content-editor .tiptap h3)          { font-size: 1.15rem; margin: 1.6em 0 0.5em; }
/* Menší nadpis (starší texty) */
:is(.content-prose .prose-l3, .dch-content-editor .tiptap :is(h4, h5, h6)) { font-size: 1.02rem; margin: 1.4em 0 0.45em; }

/* ---------- Inline ---------- */
:is(.content-prose, .dch-content-editor .tiptap) strong { font-weight: 600; color: var(--prose-heading); }
:is(.content-prose, .dch-content-editor .tiptap) em { font-style: italic; }
:is(.content-prose, .dch-content-editor .tiptap) a {
    color: var(--prose-accent);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}
:is(.content-prose, .dch-content-editor .tiptap) a:hover { text-decoration-thickness: 2px; }

/* ---------- Lists (the website theme turns every li into a flex row with 15px padding) ---------- */
:is(.content-prose, .dch-content-editor .tiptap) :is(ul, ol) {
    margin: 0 0 1.15em;
    padding: 0 0 0 1.45em;
}
:is(.content-prose, .dch-content-editor .tiptap) :is(ul, ol) > li {
    display: list-item;
    margin: 0 0 0.45em;
    padding: 0 0 0 0.2em;
    color: inherit;
    font-size: inherit;
    line-height: 1.6;
}
:is(.content-prose, .dch-content-editor .tiptap) ul > li { list-style: disc; }
:is(.content-prose, .dch-content-editor .tiptap) ol > li { list-style: decimal; }
:is(.content-prose, .dch-content-editor .tiptap) li::marker { color: var(--prose-accent); font-weight: 600; }
:is(.content-prose, .dch-content-editor .tiptap) li > p { margin: 0; }
:is(.content-prose, .dch-content-editor .tiptap) li > :is(ul, ol) { margin: 0.45em 0 0.2em; }
:is(.content-prose, .dch-content-editor .tiptap) li > ul > li { list-style: circle; }

/* ---------- Quotes, rules, media ---------- */
:is(.content-prose, .dch-content-editor .tiptap) blockquote {
    margin: 1.5em 0;
    padding: 0.9em 1.2em;
    border-left: 4px solid var(--prose-accent);
    border-radius: 0 10px 10px 0;
    background: var(--prose-soft);
    color: var(--prose-heading);
    font-style: normal;
    quotes: none;
}
:is(.content-prose, .dch-content-editor .tiptap) blockquote p:last-child { margin-bottom: 0; }
:is(.content-prose, .dch-content-editor .tiptap) hr {
    border: 0;
    border-top: 1px solid var(--prose-line);
    margin: 2em 0;
    opacity: 1;
}
:is(.content-prose, .dch-content-editor .tiptap) img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0.5em 0 1.2em;
    border-radius: 12px;
}

/* ---------- Tables ---------- */
.content-prose .prose-table { overflow-x: auto; margin: 0 0 1.25em; }
:is(.content-prose, .dch-content-editor .tiptap) table { width: 100%; border-collapse: collapse; font-size: 0.95em; }
:is(.content-prose, .dch-content-editor .tiptap) :is(th, td) {
    padding: 0.55em 0.8em;
    border: 0;
    border-bottom: 1px solid var(--prose-line);
    text-align: left;
    vertical-align: top;
}
:is(.content-prose, .dch-content-editor .tiptap) thead th { background: #f6f7fb; color: var(--prose-heading); font-weight: 600; }

/* ---------- Website: compact variant (beach cards etc.) and phones ---------- */
.content-prose.content-prose--sm { font-size: 15px; line-height: 1.6; }
.content-prose.content-prose--sm .prose-l1 { font-size: 1.1rem; }
.content-prose.content-prose--sm :is(.prose-l2, .prose-l3) { font-size: 1rem; }

@media (max-width: 575.98px) {
    .content-prose { font-size: 16px; line-height: 1.65; }
    .content-prose .prose-l1 { font-size: 1.22rem; }
    .content-prose .prose-l2 { font-size: 1.08rem; }
}

/* ---------- Admin editor: a white "page" as wide as the text column on the website ---------- */
.dch-content-editor .fi-fo-rich-editor-content {
    background: #fff;
    padding: 1.5rem 1.75rem;
}
.dch-content-editor .tiptap {
    max-width: 680px;
    min-height: 12rem;
}
