/* ===========================================================================
   Danex — blog post blocks (page-builder output).
   Loaded on the public site AND inside the admin panel so the editor's block
   previews match what visitors see. Kept self-contained for that reason:
   every colour/size is defined here rather than inherited from site.css.
   =========================================================================== */

.post-blocks {
    --pb-red:      #c81e2d;
    --pb-red-dark: #9d0f1b;
    --pb-red-soft: #fdecec;
    --pb-ink:      #242424;
    --pb-charcoal: #1c1c1c;
    --pb-muted:    #5f5952;
    --pb-line:     #e8e1d6;
    --pb-soft:     #faf6f0;
    --pb-green:    #1f7a3a;
    --pb-green-soft: #e9f6ec;
    --pb-radius:   14px;
    --pb-shadow:   0 6px 24px rgba(28, 20, 18, 0.08);
    --pb-font:     "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;

    font-family: var(--pb-font);
    color: var(--pb-ink);
    font-size: 1.06rem;
    line-height: 1.8;
}

.pb { margin: 0 0 1.6rem; }
.pb:last-child { margin-bottom: 0; }

/* Text-ish content (rich editor output) --------------------------------- */
.post-blocks h2, .post-blocks h3, .post-blocks h4 { color: var(--pb-charcoal); line-height: 1.2; font-weight: 700; margin: 0 0 .5em; }
.post-blocks h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); }
.post-blocks h3 { font-size: 1.25rem; }
.post-blocks p { margin: 0 0 1.1rem; }
.post-blocks p:last-child { margin-bottom: 0; }
.post-blocks ul, .post-blocks ol { margin: 0 0 1.1rem; padding-left: 1.4rem; }
.post-blocks ul { list-style: disc; }
.post-blocks ol { list-style: decimal; }
.post-blocks li { margin-bottom: .4rem; }
.post-blocks a { color: var(--pb-red); text-decoration: underline; }
.post-blocks strong { font-weight: 700; }
.post-blocks .color { color: var(--color); }   /* coloured text from the editor */

/* Background colour + font size marks (also styled inside the admin editor) */
.post-blocks .bg, .tiptap .bg { background: var(--bg); padding: .05em .2em; border-radius: 3px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.post-blocks .size[data-size="xs"], .tiptap .size[data-size="xs"] { font-size: .75em; }
.post-blocks .size[data-size="sm"], .tiptap .size[data-size="sm"] { font-size: .875em; }
.post-blocks .size[data-size="lg"], .tiptap .size[data-size="lg"] { font-size: 1.25em; }
.post-blocks .size[data-size="xl"], .tiptap .size[data-size="xl"] { font-size: 1.5em; line-height: 1.3; }
.post-blocks .size[data-size="xxl"], .tiptap .size[data-size="xxl"] { font-size: 2em; line-height: 1.2; }
.post-blocks em { font-style: italic; }
.post-blocks img { max-width: 100%; height: auto; display: block; }
.post-blocks .pb-text img, .post-blocks .pb-columns img, .post-blocks .pb-callout img { border-radius: var(--pb-radius); margin: 1.2rem 0; box-shadow: var(--pb-shadow); }
.post-blocks .pb-text blockquote, .post-blocks .pb-columns blockquote { margin: 1.4rem 0; padding: .6rem 1.2rem; border-left: 4px solid var(--pb-red); background: var(--pb-red-soft); border-radius: 0 var(--pb-radius) var(--pb-radius) 0; color: var(--pb-red-dark); }
.post-blocks code { background: var(--pb-soft); padding: .1em .35em; border-radius: 4px; font-size: .92em; }
.post-blocks pre { background: var(--pb-charcoal); color: #f5f5f5; padding: 1rem 1.2rem; border-radius: var(--pb-radius); overflow: auto; }
.post-blocks pre code { background: none; padding: 0; color: inherit; }
.post-blocks figcaption { font-size: .88rem; color: var(--pb-muted); text-align: center; margin-top: .6rem; }

/* Heading ----------------------------------------------------------------- */
.pb-heading.pb { margin-top: .6rem; }
h2.pb-heading { margin-bottom: .4rem; }

/* Image ------------------------------------------------------------------- */
.pb-image { margin-left: 0; margin-right: 0; }
.pb-image img { width: 100%; border-radius: var(--pb-radius); box-shadow: var(--pb-shadow); }
.pb-image--small { max-width: 480px; margin-left: auto; margin-right: auto; }
.pb-image--wide { margin-left: calc(-1 * clamp(0px, 8vw, 120px)); margin-right: calc(-1 * clamp(0px, 8vw, 120px)); }
@media (max-width: 1100px) { .pb-image--wide { margin-left: 0; margin-right: 0; } }

/* Gallery ----------------------------------------------------------------- */
.pb-gallery { margin-left: 0; margin-right: 0; }
.pb-gallery__grid { display: grid; gap: .8rem; grid-template-columns: repeat(3, 1fr); }
.pb-gallery--cols-2 .pb-gallery__grid { grid-template-columns: repeat(2, 1fr); }
.pb-gallery--cols-4 .pb-gallery__grid { grid-template-columns: repeat(4, 1fr); }
.pb-gallery__grid a { display: block; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 10px; background: var(--pb-red-soft); }
.pb-gallery__grid img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s ease; }
.pb-gallery__grid a:hover img { transform: scale(1.04); }
@media (max-width: 620px) { .pb-gallery__grid, .pb-gallery--cols-4 .pb-gallery__grid { grid-template-columns: repeat(2, 1fr); } }

/* Image + text ------------------------------------------------------------ */
.pb-image-text { display: grid; grid-template-columns: 2fr 3fr; gap: 1.8rem; align-items: center; }
.pb-image-text--right .pb-image-text__media { order: 2; }
.pb-image-text__media img { width: 100%; border-radius: var(--pb-radius); box-shadow: var(--pb-shadow); }
@media (max-width: 680px) { .pb-image-text { grid-template-columns: 1fr; } .pb-image-text--right .pb-image-text__media { order: 0; } }

/* Quote ------------------------------------------------------------------- */
.pb-quote { margin-left: 0; margin-right: 0; padding: 1.4rem 1.6rem 1.4rem 1.8rem; border-left: 5px solid var(--pb-red); background: var(--pb-red-soft); border-radius: 0 var(--pb-radius) var(--pb-radius) 0; }
.pb-quote p { font-size: 1.25rem; line-height: 1.5; font-weight: 600; color: var(--pb-red-dark); margin: 0; }
.pb-quote cite { display: block; margin-top: .7rem; font-style: normal; font-size: .92rem; color: var(--pb-muted); }

/* Two columns ------------------------------------------------------------- */
.pb-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
@media (max-width: 680px) { .pb-columns { grid-template-columns: 1fr; gap: 1.2rem; } }

/* Video ------------------------------------------------------------------- */
.pb-video { margin-left: 0; margin-right: 0; }
.pb-video__frame { position: relative; aspect-ratio: 16 / 9; border-radius: var(--pb-radius); overflow: hidden; background: #000; box-shadow: var(--pb-shadow); }
.pb-video__frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* PDF document ------------------------------------------------------------ */
.pb-pdf { margin-left: 0; margin-right: 0; border: 1px solid var(--pb-line); border-radius: var(--pb-radius); overflow: hidden; background: #fff; box-shadow: var(--pb-shadow); }
.pb-pdf__bar { display: flex; align-items: center; gap: .8rem; padding: .6rem .9rem; background: var(--pb-charcoal); color: #fff; font-size: .9rem; }
.pb-pdf__title { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pb-pdf__status { color: #d9d3ca; white-space: nowrap; }
.pb-pdf__tools { display: flex; gap: .3rem; }
.pb-pdf__btn { width: 30px; height: 30px; border-radius: 8px; border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.08); color: #fff; font-size: 1rem; line-height: 1; cursor: pointer; padding: 0; }
.pb-pdf__btn:hover { background: var(--pb-red); border-color: var(--pb-red); }
.pb-pdf__pages { height: min(80vh, 900px); overflow: auto; background: #e9e5df; padding: 16px; display: flex; flex-direction: column; gap: 16px; -webkit-user-select: none; user-select: none; }
.pb-pdf--single .pb-pdf__pages { height: auto; max-height: none; }
.pb-pdf__page { background: #fff; box-shadow: 0 2px 10px rgba(28, 20, 18, .15); flex-shrink: 0; max-width: none; margin: 0 auto; }
.pb-pdf__page canvas { display: block; max-width: none; }
.pb-pdf:fullscreen { border-radius: 0; display: flex; flex-direction: column; }
.pb-pdf:fullscreen .pb-pdf__pages { flex: 1; height: auto; max-height: none; }
.pb-pdf.is-error .pb-pdf__pages { display: none; }
.pb-pdf.is-error .pb-pdf__status { color: #ffb3b9; }
.pb-pdf__fallback { margin: 0; padding: 1rem; color: var(--pb-muted); }
.pb-pdf--card { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.2rem; background: var(--pb-soft); }
.pb-pdf__card-icon { flex-shrink: 0; width: 46px; height: 56px; border-radius: 6px; background: var(--pb-red); color: #fff; font-size: .72rem; font-weight: 700; letter-spacing: .06em; display: grid; place-items: center; }
.pb-pdf__card-meta { font-size: .88rem; color: var(--pb-muted); }
@media (max-width: 620px) { .pb-pdf__status { display: none; } }

/* Callout ----------------------------------------------------------------- */
.pb-callout { padding: 1.2rem 1.4rem; border-radius: var(--pb-radius); border: 1px solid var(--pb-line); background: var(--pb-soft); }
.pb-callout__title { display: block; font-weight: 700; color: var(--pb-charcoal); margin-bottom: .4rem; }
.pb-callout--highlight { background: var(--pb-red-soft); border-color: #f3b9bf; }
.pb-callout--highlight .pb-callout__title { color: var(--pb-red-dark); }
.pb-callout--success { background: var(--pb-green-soft); border-color: #bfe3c8; }
.pb-callout--success .pb-callout__title { color: var(--pb-green); }

/* Buttons ----------------------------------------------------------------- */
.pb-button { display: flex; }
.pb-button--center { justify-content: center; }
.post-blocks .btn { display: inline-block; font-weight: 600; padding: .8rem 1.5rem; border-radius: 999px; border: 2px solid transparent; cursor: pointer; text-decoration: none; font-size: 1rem; line-height: 1.4; transition: transform .12s ease, background .12s ease; }
.post-blocks .btn:hover { transform: translateY(-1px); text-decoration: none; }
.post-blocks .btn--donate { background: var(--pb-red); color: #fff; }
.post-blocks .btn--donate:hover { background: var(--pb-red-dark); color: #fff; }
.post-blocks .btn--primary { background: var(--pb-charcoal); color: #fff; }
.post-blocks .btn--primary:hover { background: #000; color: #fff; }
.post-blocks .btn--outline { background: transparent; color: var(--pb-red); border-color: var(--pb-red); }
.post-blocks .btn--outline:hover { background: var(--pb-red); color: #fff; }
.post-blocks .btn--light { background: #fff; color: var(--pb-red); }
.post-blocks .btn--light:hover { background: var(--pb-red-soft); color: var(--pb-red-dark); }

/* Call to action band ----------------------------------------------------- */
.post-blocks .pb-cta { background: linear-gradient(120deg, var(--pb-red) 0%, var(--pb-red-dark) 100%); color: #fff; border-radius: var(--pb-radius); padding: clamp(1.6rem, 4vw, 2.6rem); text-align: center; }
.post-blocks .pb-cta h2 { color: #fff; margin-bottom: .4rem; }
.post-blocks .pb-cta p { max-width: 55ch; margin: 0 auto 1.2rem; color: #ffe1e3; }

/* Divider / spacer -------------------------------------------------------- */
.pb-divider { border: none; border-top: 1px solid var(--pb-line); margin: 2rem 0; height: 0; }
.pb-spacer { height: 2.5rem; margin: 0; }

/* Admin preview tweaks ---------------------------------------------------- */
.post-blocks--preview { padding: 1rem 1.2rem; background: #fff; border-radius: 10px; }
.post-blocks--preview .pb-image--wide { margin-left: 0; margin-right: 0; }
.post-blocks--preview .pb-spacer { background: repeating-linear-gradient(135deg, #f3efe8 0 8px, #fff 8px 16px); border-radius: 8px; }
.post-blocks--preview .pb-divider { margin: 1rem 0; }
.post-blocks--preview .pb-video__frame { pointer-events: none; }
.dark .post-blocks--preview { background: #fff; color: var(--pb-ink); }
