/*
 * Campground Launch shared RTE styles.
 *
 * Loaded in TWO contexts:
 *   1. Plugin admin pages that have an RTE (queued by enqueue helper after
 *      vendor/quill/quill.snow.min.css). Overrides Quill's defaults so the
 *      editor visually matches the rest of the plugin admin (cgl-page).
 *   2. Frontend pages that render RTE-authored HTML (any page using the
 *      seo_text shortcodes). The `.cgl-rte-output` wrapper class is added
 *      by render helpers and the rules below mirror the editor's display
 *      exactly — list bullets, H2/H3 sizing, link color — so the preview
 *      in the admin matches what the visitor sees.
 *
 * Naming: every selector is scoped under either `.cgl-rte-host` (editor)
 * or `.cgl-rte-output` (frontend) to avoid leaking into Kadence's typography.
 */

/* ─── Editor shell ──────────────────────────────────────────────────────── */

.cgl-rte-host {
    background: #fff;
    border-radius: 6px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 13px;
    line-height: 1.6;
}

/* Quill applies its own border to .ql-container; reset both elements so the
 * toolbar and editor body read as a single card with a unified focus ring. */
.ql-toolbar.ql-snow {
    border: 1px solid #d1d5db !important;
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
    border-bottom: 0 !important;
    background: #f9fafb;
    padding: 6px 8px !important;
}
.ql-container.ql-snow {
    border: 1px solid #d1d5db !important;
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
    font-family: inherit !important;
    font-size: inherit !important;
}

.ql-container.ql-snow:focus-within {
    border-color: #16a34a !important;
    box-shadow: 0 0 0 2px #dcfce7;
}
.ql-toolbar.ql-snow:has(+ .ql-container.ql-snow:focus-within) {
    border-color: #16a34a !important;
}

/* Toolbar buttons */
.ql-toolbar.ql-snow button {
    width: 28px;
    height: 28px;
    border-radius: 4px;
}
.ql-toolbar.ql-snow button:hover,
.ql-toolbar.ql-snow button:focus,
.ql-toolbar.ql-snow .ql-active {
    background: #ecfdf5;
    color: #16a34a;
}
.ql-toolbar.ql-snow .ql-stroke {
    stroke: #374151;
}
.ql-toolbar.ql-snow .ql-fill {
    fill: #374151;
}
.ql-toolbar.ql-snow button:hover .ql-stroke,
.ql-toolbar.ql-snow button.ql-active .ql-stroke,
.ql-toolbar.ql-snow button:focus .ql-stroke {
    stroke: #16a34a;
}
.ql-toolbar.ql-snow button:hover .ql-fill,
.ql-toolbar.ql-snow button.ql-active .ql-fill,
.ql-toolbar.ql-snow button:focus .ql-fill {
    fill: #16a34a;
}

/* ─── Editor typography (admin preview only) ────────────────────────────── */
/*
 * These overrides give the editor surface a predictable, legible preview
 * regardless of the WP admin theme. They are deliberately scoped to
 * `.cgl-rte-host .ql-editor` only — NOT applied to .cgl-rte-output on
 * the frontend, because the rendered page should inherit Kadence's
 * typography so the RTE content matches the rest of the site (font
 * family, body size, link color, heading scale).
 */
.cgl-rte-host .ql-editor {
    padding: 12px 14px;
    color: #111827;
    font-size: 14px;
    line-height: 1.6;
}
.cgl-rte-host .ql-editor p {
    margin: 0 0 0.75em;
}
.cgl-rte-host .ql-editor p:last-child {
    margin-bottom: 0;
}
.cgl-rte-host .ql-editor h2 {
    font-size: 1.5em;
    font-weight: 700;
    line-height: 1.25;
    margin: 1.1em 0 0.4em;
    color: #111827;
}
.cgl-rte-host .ql-editor h3 {
    font-size: 1.2em;
    font-weight: 700;
    line-height: 1.3;
    margin: 1em 0 0.35em;
    color: #111827;
}
.cgl-rte-host .ql-editor h2:first-child,
.cgl-rte-host .ql-editor h3:first-child {
    margin-top: 0;
}
.cgl-rte-host .ql-editor ul {
    list-style: disc outside;
}
.cgl-rte-host .ql-editor ol {
    list-style: decimal outside;
}
.cgl-rte-host .ql-editor a {
    color: #16a34a;
    text-decoration: underline;
}

/*
 * Editor-only placeholder for an inserted gallery embed. On the FRONTEND the
 * marker div is expanded server-side into a real `.cgl-category-gallery`
 * (styled further below) — the raw marker is chrome-free and never renders —
 * so these rules are deliberately scoped to `.cgl-rte-host .ql-editor` only.
 * (An earlier version tried to style the raw marker's thumbnail spans into a
 * frontend grid; that produced the stacked-thumbnail look and is gone now.)
 */
.cgl-rte-host .ql-editor .cgl-rte-gallery-wrap {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    justify-content: center;
    min-height: 96px;
    margin: 1em 0;
    padding: 12px;
    border: 1px dashed #94a3b8;
    border-radius: 8px;
    background: #f8fafc;
    color: #334155;
    cursor: pointer;
}
.cgl-rte-host .ql-editor .cgl-rte-gallery-label {
    font-size: 13px;
    font-weight: 600;
}
.cgl-rte-host .ql-editor .cgl-rte-gallery-thumbs {
    display: grid;
    grid-template-columns: repeat(6, 40px);
    gap: 6px;
    max-width: 100%;
}
.cgl-rte-host .ql-editor .cgl-rte-gallery-thumbs img {
    width: 40px !important;
    height: 40px !important;
    object-fit: cover;
    border-radius: 4px !important;
    display: block;
}

/*
 * Embedded-form placeholder (editor only). The persisted marker is an empty
 * `<div class="cgl-rte-form-wrap" data-form-id="N">`; the server expands it to
 * the real Kadence form on the frontend, so these styles never reach a visitor.
 */
.cgl-rte-host .ql-editor .cgl-rte-form-wrap {
    display: flex;
    flex-direction: row;
    gap: 10px;
    align-items: center;
    justify-content: center;
    min-height: 56px;
    margin: 1em 0;
    padding: 12px 14px;
    border: 1px dashed #94a3b8;
    border-radius: 8px;
    background: #f8fafc;
    color: #334155;
    cursor: pointer;
}
.cgl-rte-host .ql-editor .cgl-rte-form-wrap:hover {
    border-color: #16a34a;
    background: #f0fdf4;
}
.cgl-rte-host .ql-editor .cgl-rte-form-label {
    font-size: 13px;
    font-weight: 600;
}
/* Small "form card" glyph drawn in CSS so the placeholder needs no image. */
.cgl-rte-host .ql-editor .cgl-rte-form-icon {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    border: 1.5px solid #64748b;
    border-radius: 3px;
    position: relative;
}
.cgl-rte-host .ql-editor .cgl-rte-form-icon::before,
.cgl-rte-host .ql-editor .cgl-rte-form-icon::after {
    content: "";
    position: absolute;
    left: 3px;
    right: 3px;
    height: 1.5px;
    background: #64748b;
}
.cgl-rte-host .ql-editor .cgl-rte-form-icon::before { top: 5px; }
.cgl-rte-host .ql-editor .cgl-rte-form-icon::after  { top: 9px; }

/* Editor placeholder for an HTML Widget embed. Same atomic-chip treatment as
 * the form placeholder; the server expands the marker to a sandboxed iframe on
 * the frontend, so these styles never reach a visitor. */
.cgl-rte-host .ql-editor .cgl-rte-widget-wrap {
    display: flex;
    flex-direction: row;
    gap: 10px;
    align-items: center;
    justify-content: center;
    min-height: 56px;
    margin: 1em 0;
    padding: 12px 14px;
    border: 1px dashed #94a3b8;
    border-radius: 8px;
    background: #f8fafc;
    color: #334155;
    cursor: pointer;
}
.cgl-rte-host .ql-editor .cgl-rte-widget-wrap:hover {
    border-color: #16a34a;
    background: #f0fdf4;
}
.cgl-rte-host .ql-editor .cgl-rte-widget-label {
    font-size: 13px;
    font-weight: 600;
}
/* Small "code card" glyph — a bordered card with </> marks. */
.cgl-rte-host .ql-editor .cgl-rte-widget-icon {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    border: 1.5px solid #64748b;
    border-radius: 3px;
    position: relative;
}
.cgl-rte-host .ql-editor .cgl-rte-widget-icon::before,
.cgl-rte-host .ql-editor .cgl-rte-widget-icon::after {
    content: "";
    position: absolute;
    top: 5px;
    width: 4px;
    height: 4px;
    border: 1.5px solid #64748b;
    border-width: 0 0 1.5px 1.5px;
}
.cgl-rte-host .ql-editor .cgl-rte-widget-icon::before { left: 4px;  transform: rotate(45deg); }
.cgl-rte-host .ql-editor .cgl-rte-widget-icon::after  { right: 4px; transform: rotate(-135deg); }

/* Editor placeholder for an Event Calendar embed. Same atomic-chip treatment as
 * the form/widget placeholders; the server expands the marker to the rendered
 * Event Cards block on the frontend, so these styles never reach a visitor. */
.cgl-rte-host .ql-editor .cgl-rte-events-wrap {
    display: flex;
    flex-direction: row;
    gap: 10px;
    align-items: center;
    justify-content: center;
    min-height: 56px;
    margin: 1em 0;
    padding: 12px 14px;
    border: 1px dashed #94a3b8;
    border-radius: 8px;
    background: #f8fafc;
    color: #334155;
    cursor: pointer;
}
.cgl-rte-host .ql-editor .cgl-rte-events-wrap:hover {
    border-color: #16a34a;
    background: #f0fdf4;
}
.cgl-rte-host .ql-editor .cgl-rte-events-label {
    font-size: 13px;
    font-weight: 600;
}
/* Small "calendar" glyph — a bordered card with a header rule and two tabs. */
.cgl-rte-host .ql-editor .cgl-rte-events-icon {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    border: 1.5px solid #64748b;
    border-radius: 3px;
    position: relative;
}
.cgl-rte-host .ql-editor .cgl-rte-events-icon::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 4px;
    height: 1.5px;
    background: #64748b;
}
.cgl-rte-host .ql-editor .cgl-rte-events-icon::after {
    content: "";
    position: absolute;
    left: 3px;
    top: 7px;
    width: 3px;
    height: 3px;
    background: #64748b;
    box-shadow: 5px 0 0 #64748b, 10px 0 0 #64748b;
}

/* ─── Vertical spacer ───────────────────────────────────────────────────── */
/* Frontend: pure empty vertical space. The pixel height rides on an inline
 * `height` style set by the blot/sanitizer; nothing visible renders. */
.cgl-rte-output .cgl-rte-spacer {
    display: block;
    width: 100%;
    /* height comes from the inline style="height:Npx" on the element */
    clear: both;
}
.cgl-rte-output .cgl-rte-spacer-label { display: none; }

/* Editor: show the gap as a dashed, labelled placeholder sized to the real
 * height so the author sees the actual separation. The label is absolutely
 * centered so it never adds to the box height, and is stripped server-side so
 * it never reaches the frontend. box-sizing:border-box keeps the dashed border
 * from inflating the chosen height. */
.cgl-rte-host .ql-editor .cgl-rte-spacer {
    position: relative;
    box-sizing: border-box;
    width: 100%;
    margin: 0.5em 0;
    border: 1px dashed #94a3b8;
    border-radius: 6px;
    background: repeating-linear-gradient(
        45deg, #f8fafc, #f8fafc 6px, #eef2f7 6px, #eef2f7 12px);
    cursor: pointer;
}
.cgl-rte-host .ql-editor .cgl-rte-spacer:hover {
    border-color: #16a34a;
}
.cgl-rte-host .ql-editor .cgl-rte-spacer-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #64748b;
    pointer-events: none;
    white-space: nowrap;
}

/* ─── Structural rules (editor + frontend) ──────────────────────────────── */
/*
 * Only the bits that the theme can't be trusted to handle correctly:
 *   - list bullet/number markers visible (some themes strip them in
 *     non-prose containers; Quill's HTML always needs them)
 *   - consistent list indentation so nested lists read
 *   - image border-radius (handled below in the Images section)
 *   - video iframe responsive sizing (handled below)
 * Everything typographical (font-size, color, headings) is left to the
 * theme on the frontend so .cgl-rte-output content blends in naturally.
 */
.cgl-rte-host .ql-editor ul,
.cgl-rte-host .ql-editor ol,
.cgl-rte-output ul,
.cgl-rte-output ol {
    padding-left: 1.6em;
    margin: 0 0 0.75em;
}
.cgl-rte-output ul { list-style: disc outside; }
.cgl-rte-output ol { list-style: decimal outside; }
.cgl-rte-host .ql-editor li,
.cgl-rte-output li {
    padding-left: 0;
    margin: 0 0 0.2em;
}
/* Quill renders its own ::before counter/bullet via a .ql-ui span in
 * some themes; hide so the native marker we restored above is what
 * the user sees (and matches the frontend native list rendering). */
.cgl-rte-host .ql-editor ol > li::before,
.cgl-rte-host .ql-editor ul > li::before {
    content: '' !important;
    display: none !important;
}
.cgl-rte-host .ql-editor li > .ql-ui {
    display: none !important;
}

/* Video embeds (Quill stores as <iframe class="ql-video">). Always one
 * per row, full width of the content column, with vertical breathing
 * room. !important defeats theme defaults (Kadence flex wrappers,
 * embed responsive plugins, etc.) that otherwise force inline-block
 * sizing and pack two iframes onto one line at native dimensions.
 *
 * Targets BOTH the wrapper-scoped selectors AND globally on the
 * unique RTE-produced classes/attributes (iframe.ql-video,
 * iframe[data-cgl-rte-video]). The unconditional global targeting
 * is intentional — it covers two real cases:
 *   1. Pages whose Breeze HTML cache still holds pre-wrapper renders.
 *   2. Renderers added later that forget to call cgl_render_rte_output.
 * Risk is essentially zero because both selectors are markers we
 * write ourselves; no third-party iframe matches them.
 */
.cgl-rte-host .ql-editor iframe.ql-video,
.cgl-rte-host .ql-editor iframe[src],
.cgl-rte-output iframe.ql-video,
.cgl-rte-output iframe[data-cgl-rte-video],
.cgl-rte-output iframe[src],
iframe.ql-video,
iframe[data-cgl-rte-video] {
    display: block !important;
    float: none !important;
    clear: both !important;
    width: 100% !important;
    max-width: 100% !important;
    aspect-ratio: 16 / 9;
    height: auto !important;
    margin: 1.5em 0 !important;
    border: 0;
    border-radius: 8px;
    background: #000;
}
/* Belt and braces: if Quill or a pasted document jams two iframes into
 * the same paragraph, the paragraph itself should still stack them. */
.cgl-rte-host .ql-editor p:has(iframe),
.cgl-rte-output p:has(iframe),
p:has(> iframe.ql-video),
p:has(> iframe[data-cgl-rte-video]) {
    display: block;
    line-height: 0;
}
.cgl-rte-host .ql-editor p:has(iframe) iframe + iframe,
.cgl-rte-output p:has(iframe) iframe + iframe,
p:has(> iframe.ql-video) iframe + iframe,
p:has(> iframe[data-cgl-rte-video]) iframe + iframe {
    margin-top: 1.5em !important;
}

/*
 * Gallery grid — the SINGLE source of gallery styling for the whole plugin.
 * cgl-rte.css is enqueued on every frontend page, so these rules cover the
 * "Site Images" page shortcode, the Ways to Stay category-gallery block, AND
 * inline RTE galleries, all rendered by cgl_gallery_html(). Intentionally NOT
 * scoped under `.cgl-rte-output` — the page/block galleries aren't wrapped in
 * it. `!important` beats the theme's `figure { margin }` on `.cgl-gi`.
 */
.cgl-category-gallery {
    display: grid !important;
    gap: 8px !important;
}
.cgl-category-gallery.cgl-gallery-style-masonry {
    grid-template-columns: repeat(4, 1fr) !important;
    grid-auto-rows: 1px !important;
}
.cgl-category-gallery.cgl-gallery-style-standard-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    grid-auto-rows: auto !important;
}
/* Mobile: exactly 2 columns. Must name the style-modifier classes so this
 * matches the specificity of the desktop `.cgl-category-gallery.cgl-gallery-style-*`
 * rules above — both are `!important`, so a lower-specificity base-class rule
 * would lose the tie and leave the desktop column count in place on phones. */
@media (max-width: 768px) {
    .cgl-category-gallery.cgl-gallery-style-masonry,
    .cgl-category-gallery.cgl-gallery-style-standard-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}
.cgl-category-gallery .cgl-gi {
    overflow: hidden;
    cursor: pointer;
    border-radius: 8px;
    line-height: 0;
    position: relative;
    align-self: start !important;
    margin: 0 !important;
}
.cgl-category-gallery .cgl-gi img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform .35s ease;
}
.cgl-category-gallery.cgl-gallery-style-standard-grid .cgl-gi {
    aspect-ratio: 1 / 1;
    align-self: stretch !important;
    height: 100% !important;
    min-height: 0 !important;
}
.cgl-category-gallery.cgl-gallery-style-standard-grid .cgl-gi img {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    object-fit: cover !important;
}
.cgl-category-gallery .cgl-gi::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    transition: background .35s ease;
    pointer-events: none;
}
.cgl-category-gallery .cgl-gi:hover img {
    transform: scale(1.05);
}
.cgl-category-gallery .cgl-gi:hover::after {
    background: rgba(0, 0, 0, .22);
}

/*
 * Fullscreen lightbox shared by EVERY gallery rendered through
 * cgl_gallery_html() (page shortcode, category-gallery block, inline RTE). The
 * gallery's inline script moves the dialog to <body>, so these selectors are
 * intentionally NOT scoped under `.cgl-rte-output`. The styling lives here
 * (always-enqueued cgl-rte.css) rather than a per-gallery inline <style> so
 * Breeze/Autoptimize can't NBSP-corrupt it and repeated galleries don't each
 * ship the same rules.
 */
.cgl-rte-lb {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.93);
    align-items: center;
    justify-content: center;
    padding: 48px 56px;
}
.cgl-rte-lb.is-open {
    display: flex;
}
.cgl-rte-lb-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    user-select: none;
    border-radius: 2px;
}
.cgl-rte-lb-close {
    position: fixed;
    top: 14px;
    right: 18px;
    background: none;
    border: none;
    color: #fff;
    font-size: 36px;
    line-height: 1;
    cursor: pointer;
    padding: 4px;
    opacity: .8;
}
.cgl-rte-lb-close:hover {
    opacity: 1;
}
.cgl-rte-lb-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, .12);
    border: none;
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    padding: 14px 16px;
    border-radius: 4px;
    opacity: .8;
    transition: opacity .2s, background .2s;
}
.cgl-rte-lb-prev {
    left: 10px;
}
.cgl-rte-lb-next {
    right: 10px;
}
.cgl-rte-lb-nav:hover {
    opacity: 1;
    background: rgba(255, 255, 255, .22);
}

/*
 * Video gallery items (issue #134). A video tile shows a poster thumbnail (or a
 * first-frame <video>) with a centered play badge; clicking opens the shared
 * lightbox, which swaps its <img> for a controllable <video>.
 */
.cgl-category-gallery .cgl-gi video.cgl-gi-vid {
    width: 100%;
    height: auto;
    display: block;
}
.cgl-category-gallery.cgl-gallery-style-standard-grid .cgl-gi video.cgl-gi-vid {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}
.cgl-gi-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: rgba(0, 0, 0, .55);
    pointer-events: none;
    transition: background .2s ease;
    z-index: 1;
}
.cgl-gi-play::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 54%;
    transform: translate(-50%, -50%);
    border-style: solid;
    border-width: 11px 0 11px 18px;
    border-color: transparent transparent transparent #fff;
}
.cgl-category-gallery .cgl-gi-video:hover .cgl-gi-play {
    background: rgba(0, 0, 0, .72);
}
.cgl-rte-lb-video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 2px;
    background: #000;
}

/*
 * Featured Video — rendered in place of a page's Featured Image when a video is
 * set (issue #134). Autoplays muted + looping with controls; poster is the
 * Featured Image. max-height + object-fit keep a tall/portrait clip in bounds
 * (letterboxed on the black backdrop) instead of collapsing or dominating.
 */
.cgl-featured-video {
    display: block;
    width: 100%;
    height: auto;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    background: #000;
}

/* ─── Images (editor + frontend) ───────────────────────────────────────── */
/*
 * Default image: full-width responsive block. Quill emits <img> without
 * a wrapper, so layout has to come from CSS.
 *
 * The unconditional `img.cgl-rte-image` selector applies on the frontend
 * regardless of whether the .cgl-rte-output wrapper is present (Breeze
 * may serve cached HTML predating that wrapper). Every image inserted
 * through our blot gets the marker class in cgl-rte.js.
 */
.cgl-rte-host .ql-editor img,
.cgl-rte-output img,
img.cgl-rte-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px !important;
    display: inline-block;  /* allows text wrap when aligned */
    vertical-align: middle;
}

/* Aspect-ratio crop — when the contextual toolbar sets data-aspect-ratio,
 * apply the CSS aspect-ratio property and cover-crop the image to fill
 * the resulting box. Width comes from the existing layout (intrinsic,
 * float max-width, or the explicit width attribute). The browser then
 * computes height as `width / ratio`.
 *
 * Unconditional, !important targeting on data-aspect-ratio:
 *   - Wrapper-scoped selectors aren't reliable on the frontend (Breeze
 *     can serve cached HTML predating the wrapper change, and some
 *     renderers might emit images outside .cgl-rte-output).
 *   - !important defeats Kadence's `.entry-content img` rules which
 *     otherwise force max-width and reset object-fit.
 * The attribute selector is unique to OUR images — no third-party img
 * tag uses it — so the global scope is safe.
 */
img[data-aspect-ratio] {
    object-fit: cover !important;
    object-position: center !important;
    height: auto !important;
    /* `width: auto` honors the img's `width` HTML attribute (set by the
     * size picker — Thumb / Med / Large / Full). max-width caps it to
     * the container so it never overflows. Crucially this means the
     * displayed size never exceeds the source image's pixel size, so
     * picking a smaller variant actually shrinks the rendered box
     * instead of upscaling and going grainy. */
    width: auto !important;
    max-width: 100% !important;
}
img[data-aspect-ratio="1/1"]   { aspect-ratio: 1 / 1  !important; }
img[data-aspect-ratio="4/3"]   { aspect-ratio: 4 / 3  !important; }
img[data-aspect-ratio="16/9"]  { aspect-ratio: 16 / 9 !important; }
img[data-aspect-ratio="3/4"]   { aspect-ratio: 3 / 4  !important; }

/* Aligned (floated) images: still cap at 50% of the column so text
 * wrap reads well, but use `width: auto` so a small picked size
 * actually shows small instead of being stretched to the 50% cap.
 * Result: medium picked + float-right renders at min(600px, 50% column),
 * never upscaled past medium's source pixels. */
img[data-aspect-ratio].ql-align-left,
img[data-aspect-ratio].ql-align-right {
    width: auto !important;
    max-width: 50% !important;
}
img[data-aspect-ratio].ql-align-center {
    display: block !important;
    margin-left: auto !important;
    margin-right: auto !important;
    float: none !important;
}

/* Centered: take a block by itself, no text wrap. Targeted at the img
 * directly AND with the unconditional `img.cgl-rte-image.ql-align-center`
 * selector so the rule applies even when:
 *   - Breeze serves cached HTML that pre-dates the .cgl-rte-output wrapper
 *   - Kadence's `.entry-content img` rules try to force inline-block /
 *     reset margins (the !importants here defeat that without escalating
 *     to the body selector).
 * Without these the editor preview showed centered but the frontend
 * inherited Kadence's defaults and rendered left-aligned. */
.cgl-rte-host .ql-editor img.ql-align-center,
.cgl-rte-output img.ql-align-center,
img.cgl-rte-image.ql-align-center,
img.ql-align-center {
    /* Unconditional `img.ql-align-center` is the catch-all: the
     * ql-align-center class is unique to Quill output (no third-party
     * img tag uses it), so the global rule is safe. Without it, legacy
     * images that pre-date both the .cgl-rte-output wrapper AND the
     * cgl-rte-image marker class fall through to Kadence's defaults and
     * never center on the frontend. */
    display: block !important;
    margin-left: auto !important;
    margin-right: auto !important;
    margin-top: 1em !important;
    margin-bottom: 1em !important;
    float: none !important;
    clear: both !important;
}
/* When an image is wrapped in an <a> (image-link), centering the <img>
 * with margin:auto fails because the <a> is shrink-wrapped around it.
 * Hoist the centering to the anchor's parent paragraph via text-align. */
.cgl-rte-output p:has(> a > img.ql-align-center),
.cgl-rte-output p:has(> img.ql-align-center),
p:has(> a > img.ql-align-center),
p:has(> img.ql-align-center) {
    text-align: center !important;
}

/* ── Text-block alignment (paragraphs, headings, lists, blockquotes) ──────
 * Quill stores block alignment as a CLASS on the element
 * (`<p class="ql-align-center">`), not an inline style. In the editor Quill's
 * own stylesheet applies text-align, so alignment looked correct there — but
 * on the frontend nothing re-applied it and Kadence's typography defaults took
 * over, so left/center/right/justify never rendered. Mirror the image-align
 * approach: scope under the editor/output wrappers AND keep an unconditional
 * catch-all. The ql-align-* classes are unique to Quill output (no third-party
 * collision), so the global rule is safe and also covers Breeze-cached HTML
 * emitted before the .cgl-rte-output wrapper existed. `!important` defeats
 * Kadence's `.entry-content` typography without escalating to a body selector.
 * (ql-align-left is Quill's default/no-class state; matched here for the rare
 * case it is written out explicitly. text-align on an <img> that carries the
 * same class is inert, so these do not disturb image alignment.) */
.cgl-rte-host .ql-editor .ql-align-left,
.cgl-rte-output .ql-align-left,
.ql-align-left { text-align: left !important; }

.cgl-rte-host .ql-editor .ql-align-center,
.cgl-rte-output .ql-align-center,
.ql-align-center { text-align: center !important; }

.cgl-rte-host .ql-editor .ql-align-right,
.cgl-rte-output .ql-align-right,
.ql-align-right { text-align: right !important; }

.cgl-rte-host .ql-editor .ql-align-justify,
.cgl-rte-output .ql-align-justify,
.ql-align-justify { text-align: justify !important; }

/* Floated (text-wrap) — Quill stores the chosen side via ql-align-{left,right}.
 * We default to the more common right-float (sized so wrapping reads well)
 * and mirror for left-aligned images. */
.cgl-rte-host .ql-editor img.ql-align-right,
.cgl-rte-output img.ql-align-right {
    float: right;
    margin: 0.25em 0 0.75em 1.5em;
    max-width: 50%;
}
.cgl-rte-host .ql-editor img.ql-align-left,
.cgl-rte-output img.ql-align-left {
    float: left;
    margin: 0.25em 1.5em 0.75em 0;
    max-width: 50%;
}

/* Clear floats at the end of an RTE block so the next sibling
 * (heading, paragraph, etc.) starts on a fresh line instead of
 * intruding into the floated image's gutter. */
.cgl-rte-host .ql-editor::after,
.cgl-rte-output::after {
    content: '';
    display: block;
    clear: both;
}

/* On narrow viewports float-wrap reads poorly — stack images full-width. */
@media (max-width: 600px) {
    .cgl-rte-host .ql-editor img.ql-align-left,
    .cgl-rte-host .ql-editor img.ql-align-right,
    .cgl-rte-output img.ql-align-left,
    .cgl-rte-output img.ql-align-right {
        float: none;
        display: block;
        max-width: 100%;
        margin: 1em 0;
    }
}

/* Image-with-link: keep the anchor inline-block so float still works
 * when the image is wrapped in <a> via the link toolbar button. */
.cgl-rte-host .ql-editor a:has(> img),
.cgl-rte-output a:has(> img) {
    display: inline-block;
}
.cgl-rte-host .ql-editor a:has(> img.ql-align-center),
.cgl-rte-output a:has(> img.ql-align-center) {
    display: block;
    text-align: center;
}
.cgl-rte-host .ql-editor a:has(> img.ql-align-left),
.cgl-rte-output a:has(> img.ql-align-left) {
    float: left;
    margin: 0.25em 1.5em 0.75em 0;
}
.cgl-rte-host .ql-editor a:has(> img.ql-align-right),
.cgl-rte-output a:has(> img.ql-align-right) {
    float: right;
    margin: 0.25em 0 0.75em 1.5em;
}

/* ─── Image contextual toolbar (editor only) ───────────────────────────── */
/*
 * Floating bar that appears above (or below, when there's no room above)
 * the image you click. Lets the user pick a media-library size, edit the
 * alt text and delete the image. Position is set by JS each show / scroll / resize.
 */
.cgl-rte-img-toolbar {
    position: absolute;
    display: none;
    align-items: center;
    gap: 4px;
    padding: 4px 6px;
    background: #111827;
    color: #fff;
    border-radius: 6px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    font-size: 12px;
    line-height: 1;
    /* High z-index because the toolbar lives on document.body and has
     * to overlay everything in the admin (sticky save bars, etc). */
    z-index: 99999;
    white-space: nowrap;
}
/* Inside the columns dialog the toolbar must clear the modal overlay
 * (.cgl-rte-modal-overlay is z-index 100050). Still below wp.media, which
 * is hidden while an image is selected anyway. */
.cgl-rte-img-toolbar--in-modal {
    z-index: 100060;
}
.cgl-rte-img-toolbar .cgl-rte-img-label {
    color: #d1d5db;
    margin-right: 4px;
    padding: 0 2px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.cgl-rte-img-toolbar button {
    background: transparent;
    border: 0;
    color: #fff;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
    border-radius: 4px;
    cursor: pointer;
}
.cgl-rte-img-toolbar button:hover {
    background: rgba(255, 255, 255, 0.12);
}
.cgl-rte-img-toolbar button.is-active {
    background: #16a34a;
    color: #fff;
}
.cgl-rte-img-toolbar .cgl-rte-img-sep {
    width: 1px;
    height: 18px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 4px;
}
.cgl-rte-img-toolbar .cgl-rte-img-alt {
    width: 180px;
    padding: 4px 6px;
    font-size: 12px;
    line-height: 1.2;
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 4px;
    min-height: 0;
}
.cgl-rte-img-toolbar .cgl-rte-img-alt::placeholder {
    color: #9ca3af;
}
.cgl-rte-img-toolbar .cgl-rte-img-alt:focus {
    outline: none;
    border-color: #16a34a;
    box-shadow: none;
}
.cgl-rte-img-toolbar .cgl-rte-img-remove {
    color: #fca5a5;
    font-size: 18px;
    font-weight: 700;
    padding: 2px 8px;
}
.cgl-rte-img-toolbar .cgl-rte-img-remove:hover {
    background: #dc2626;
    color: #fff;
}

/* ─── Video remove button (editor only) ────────────────────────────────── */
/*
 * Floating affordance to delete an embedded video from the editor —
 * Quill 2's BlockEmbed for <iframe class="ql-video"> can't easily be
 * removed with Backspace, so we overlay an explicit × button on hover.
 * Positioned by JS (see installVideoDeleteOverlay in cgl-rte.js); CSS
 * here just defines the look + makes sure it sits above the iframe.
 */
.cgl-rte-video-remove {
    position: absolute;
    width: 28px;
    height: 28px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    font-size: 18px;
    line-height: 1;
    font-weight: 700;
    cursor: pointer;
    z-index: 5;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
    transition: background 0.15s ease, transform 0.15s ease;
}
.cgl-rte-video-remove:hover,
.cgl-rte-video-remove:focus {
    background: #dc2626;  /* red-600 — matches plugin destructive accent */
    transform: scale(1.08);
    outline: none;
}

/* ─── CTA buttons (editor + frontend) ──────────────────────────────────── */
/*
 * Block-level wrapper carries the row-level alignment via data-align so
 * left/center/right can be set without touching the inner <a>. The anchor
 * itself is the primary CTA — Kadence palette[0] on the frontend, plugin
 * green in the editor (and as a fallback before Kadence styles arrive).
 *
 * The unconditional `.cgl-rte-button-wrap` selectors mirror the same
 * pattern used by `.cgl-rte-image` above: Breeze can serve cached HTML
 * predating any wrapper change, so we don't rely on `.cgl-rte-output`
 * being present.
 */
.cgl-rte-host .ql-editor .cgl-rte-button-wrap,
.cgl-rte-output .cgl-rte-button-wrap,
.cgl-rte-button-wrap {
    display: block;
    margin: 1.25em 0;
    text-align: left;  /* default — overridden by data-align below */
    clear: both;
    line-height: 1.2;
}
.cgl-rte-button-wrap[data-align="left"]   { text-align: left; }
.cgl-rte-button-wrap[data-align="center"] { text-align: center; }
.cgl-rte-button-wrap[data-align="right"]  { text-align: right; }

/* Frontend spacing for an embedded Kadence form (the server wraps the expanded
 * form in `.cgl-rte-form`). Kadence owns the form's own styling. */
.cgl-rte-output .cgl-rte-form,
.cgl-rte-form {
    margin: 1.25em 0;
    clear: both;
}

/* Frontend render of an HTML Widget: an admin-authored, sandboxed iframe. Width
 * is always fluid; height is a fixed per-widget value set via CSS custom
 * properties on the wrapper (--cgl-widget-h desktop, --cgl-widget-h-mobile
 * below 600px). Mobile falls back to the desktop height when unset. */
.cgl-rte-output .cgl-rte-widget,
.cgl-rte-widget {
    margin: 1.25em 0;
    clear: both;
}
.cgl-rte-widget-frame {
    display: block;
    width: 100%;
    border: 0;
    height: var(--cgl-widget-h, 600px);
}
@media (max-width: 600px) {
    .cgl-rte-widget-frame {
        height: var(--cgl-widget-h-mobile, var(--cgl-widget-h, 600px));
    }
}

/*
 * Make the submit (and any step) button inside an RTE-embedded Kadence form
 * match the plugin's own CTA button (.cgl-rte-button above) instead of the
 * form's per-instance Kadence button colors.
 *
 * Scoped to `.cgl-rte-form` so it ONLY affects forms embedded through the RCE —
 * Kadence forms placed directly elsewhere on the site keep their own styling.
 * `!important` is required to beat Kadence's per-button generated CSS, which
 * matches at equal specificity but is emitted inline later in the document.
 * `.kb-button` is the base class Kadence puts on every form button (submit +
 * multi-step nav); `.kb-adv-form-submit-button` is the submit button itself.
 */
.cgl-rte-form .kb-button,
.cgl-rte-form .kb-adv-form-submit-button {
    background: var(--global-palette1, #16a34a) !important;
    background-image: none !important;
    color: #fff !important;
    border: 0 !important;
    border-radius: 6px !important;
    padding: 12px 26px !important;
    font-weight: 600 !important;
    font-size: 1em !important;
    line-height: 1.2 !important;
    box-shadow: none !important;
    text-shadow: none !important;
    transition: background 0.15s ease, transform 0.05s ease;
}
.cgl-rte-form .kb-button:hover,
.cgl-rte-form .kb-button:focus,
.cgl-rte-form .kb-adv-form-submit-button:hover,
.cgl-rte-form .kb-adv-form-submit-button:focus {
    background: var(--global-palette2, #15803d) !important;
    background-image: none !important;
    color: #fff !important;
}

.cgl-rte-host .ql-editor .cgl-rte-button,
.cgl-rte-output .cgl-rte-button,
.cgl-rte-button-wrap .cgl-rte-button {
    display: inline-block;
    background: var(--global-palette1, #16a34a);
    color: #fff !important;
    padding: 12px 26px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 1em;
    line-height: 1.2;
    text-decoration: none !important;
    border: 0;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.05s ease;
}
.cgl-rte-output .cgl-rte-button:hover,
.cgl-rte-button-wrap .cgl-rte-button:hover {
    background: var(--global-palette2, #15803d);
}

/* Editor-only: make the wrapper read as a click target. The `contenteditable
 * = false` attribute set by the blot already prevents text-edit inside, but
 * a subtle outline on hover signals "click to edit" to content managers. */
.cgl-rte-host .ql-editor .cgl-rte-button-wrap {
    position: relative;
    user-select: none;
    border-radius: 6px;
}
.cgl-rte-host .ql-editor .cgl-rte-button-wrap:hover {
    outline: 2px dashed #16a34a;
    outline-offset: 4px;
}
.cgl-rte-host .ql-editor .cgl-rte-button {
    cursor: pointer;
}

/* ─── Columns layout block (2–4 equal columns) ──────────────────────────────
 * Each column's content is stored inline as real HTML, so the block lays out
 * with CSS alone on every surface — the frontend `.cgl-rte-output` wrapper, the
 * editor preview, AND raw post-meta printed by a Kadence dynamic-content field
 * (which has no wrapper at all). The bare-class selectors below — like
 * `.cgl-rte-image` elsewhere — guarantee that last case. Columns are equal
 * width (flex:1 per column, so any count divides the row evenly): N-up on
 * desktop, a 2-up grid for 3/4 columns on tablets, and fully stacked on
 * phones. */
.cgl-rte-columns {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    align-items: flex-start;
    margin: 1.25em 0;
}
.cgl-rte-col {
    flex: 1 1 0;
    min-width: 0;  /* let long words wrap instead of forcing the column wider */
}
/* Trim the outer margins of a column's first/last block so column tops and
 * bottoms line up with neighbouring content. */
.cgl-rte-col > :first-child { margin-top: 0; }
.cgl-rte-col > :last-child  { margin-bottom: 0; }
/* Tablet: 3- and 4-column rows wrap to a 2-up grid before fully stacking.
 * flex-basis accounts for half of the 24px gap shared between the two items. */
@media (max-width: 900px) and (min-width: 601px) {
    .cgl-rte-columns[data-cols="3"] > .cgl-rte-col,
    .cgl-rte-columns[data-cols="4"] > .cgl-rte-col {
        flex-basis: calc(50% - 12px);
    }
}
/* Phone: every column stacks full width. */
@media (max-width: 600px) {
    .cgl-rte-columns {
        flex-direction: column;
        gap: 16px;
    }
    .cgl-rte-columns > .cgl-rte-col {
        flex-basis: auto;
        width: 100%;
    }
}

/* Editor-only: the block is atomic (contenteditable=false) and shows a live
 * side-by-side preview; a dashed frame, per-column separator, pointer cursor,
 * and a hover label signal "click to edit". */
.cgl-rte-host .ql-editor .cgl-rte-columns {
    position: relative;
    user-select: none;
    cursor: pointer;
    gap: 0;
    border: 1px dashed #d1d5db;
    border-radius: 8px;
}
.cgl-rte-host .ql-editor .cgl-rte-col {
    padding: 12px 16px;
}
.cgl-rte-host .ql-editor .cgl-rte-col + .cgl-rte-col {
    border-left: 1px dashed #d1d5db;
}
.cgl-rte-host .ql-editor .cgl-rte-columns:hover {
    outline: 2px dashed #16a34a;
    outline-offset: 4px;
}
.cgl-rte-host .ql-editor .cgl-rte-columns::after {
    content: "Click to edit columns";
    position: absolute;
    top: 6px;
    right: 8px;
    font-size: 10px;
    font-weight: 600;
    color: #6b7280;
    background: #fff;
    padding: 1px 6px;
    border-radius: 10px;
    opacity: 0;
    transition: opacity 0.12s ease;
    pointer-events: none;
}
.cgl-rte-host .ql-editor .cgl-rte-columns:hover::after {
    opacity: 1;
}

/* ─── Cards & callouts (RTE embeds) ──────────────────────────────────────────
 * A titled box with a bullet icon and rich body content. Both variants theme
 * themselves off a single `--cgl-rte-accent` custom property set inline on the
 * wrapper (the icon chip, list bullets, and body headings reference it). Like
 * the columns block they render with CSS alone — no server-side expansion. The
 * DOM is identical for both (icon, title, body as grid children); the wrapper
 * class picks the layout. Bare-class selectors so it renders in any context. */
.cgl-rte-cardlike {
    --cgl-rte-accent: #16a34a;  /* fallback when the inline var is absent */
    /* Lucide "circle-check", used as a mask so it takes the accent color. */
    --cgl-rte-bullet: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='m9 12 2 2 4-4'/%3E%3C/svg%3E");
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 14px;
    row-gap: 8px;
    margin: 1.25em 0;
    box-sizing: border-box;
}
.cgl-rte-cardlike-icon {
    grid-column: 1;
    grid-row: 1;
    align-self: start;
    width: 36px;
    height: 36px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    color: var(--cgl-rte-accent);
    background: color-mix(in srgb, var(--cgl-rte-accent) 15%, transparent);
}
.cgl-rte-cardlike-icon::before {
    content: "";
    width: 20px;
    height: 20px;
    background: currentColor;
    /* --cgl-rte-icon is set per data-icon below; falls back to circle-check. */
    -webkit-mask: var(--cgl-rte-icon, var(--cgl-rte-bullet)) center / contain no-repeat;
            mask: var(--cgl-rte-icon, var(--cgl-rte-bullet)) center / contain no-repeat;
}
.cgl-rte-cardlike-title {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    font-weight: 700;
    font-size: 1.15em;
    line-height: 1.25;
    color: #1f2937;
}
.cgl-rte-cardlike-body {
    color: #4b5563;
}
.cgl-rte-cardlike-body > :first-child { margin-top: 0; }
.cgl-rte-cardlike-body > :last-child  { margin-bottom: 0; }
/* Body headings pick up the accent (e.g. a big coloured time). */
.cgl-rte-cardlike-body h2,
.cgl-rte-cardlike-body h3 {
    color: var(--cgl-rte-accent);
}
/* Body lists use an accent circle-check bullet — "just use bullets". */
.cgl-rte-cardlike-body ul {
    list-style: none;
    padding-left: 0;
}
.cgl-rte-cardlike-body ul > li {
    position: relative;
    padding-left: 28px;
    margin: 0.4em 0;
}
.cgl-rte-cardlike-body ul > li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.15em;
    width: 18px;
    height: 18px;
    background: var(--cgl-rte-accent);
    -webkit-mask: var(--cgl-rte-bullet) center / contain no-repeat;
            mask: var(--cgl-rte-bullet) center / contain no-repeat;
}

/* Per-icon masks for the curated card/callout header-icon set. One rule
 * drives BOTH the rendered card icon (::before) and the dialog picker
 * glyph, keyed by data-icon. Icons are Lucide static SVGs (matches
 * lucide_url()); a name outside the set falls back to circle-check. */
.cgl-rte-cardlike-icon[data-icon="circle-check"],
.cgl-rte-iconpick-glyph[data-icon="circle-check"] { --cgl-rte-icon: url("https://cdn.jsdelivr.net/npm/lucide-static@0.477.0/icons/circle-check.svg"); }
.cgl-rte-cardlike-icon[data-icon="info"],
.cgl-rte-iconpick-glyph[data-icon="info"] { --cgl-rte-icon: url("https://cdn.jsdelivr.net/npm/lucide-static@0.477.0/icons/info.svg"); }
.cgl-rte-cardlike-icon[data-icon="triangle-alert"],
.cgl-rte-iconpick-glyph[data-icon="triangle-alert"] { --cgl-rte-icon: url("https://cdn.jsdelivr.net/npm/lucide-static@0.477.0/icons/triangle-alert.svg"); }
.cgl-rte-cardlike-icon[data-icon="shield-alert"],
.cgl-rte-iconpick-glyph[data-icon="shield-alert"] { --cgl-rte-icon: url("https://cdn.jsdelivr.net/npm/lucide-static@0.477.0/icons/shield-alert.svg"); }
.cgl-rte-cardlike-icon[data-icon="clock"],
.cgl-rte-iconpick-glyph[data-icon="clock"] { --cgl-rte-icon: url("https://cdn.jsdelivr.net/npm/lucide-static@0.477.0/icons/clock.svg"); }
.cgl-rte-cardlike-icon[data-icon="calendar"],
.cgl-rte-iconpick-glyph[data-icon="calendar"] { --cgl-rte-icon: url("https://cdn.jsdelivr.net/npm/lucide-static@0.477.0/icons/calendar.svg"); }
.cgl-rte-cardlike-icon[data-icon="map-pin"],
.cgl-rte-iconpick-glyph[data-icon="map-pin"] { --cgl-rte-icon: url("https://cdn.jsdelivr.net/npm/lucide-static@0.477.0/icons/map-pin.svg"); }
.cgl-rte-cardlike-icon[data-icon="tent"],
.cgl-rte-iconpick-glyph[data-icon="tent"] { --cgl-rte-icon: url("https://cdn.jsdelivr.net/npm/lucide-static@0.477.0/icons/tent.svg"); }
.cgl-rte-cardlike-icon[data-icon="caravan"],
.cgl-rte-iconpick-glyph[data-icon="caravan"] { --cgl-rte-icon: url("https://cdn.jsdelivr.net/npm/lucide-static@0.477.0/icons/caravan.svg"); }
.cgl-rte-cardlike-icon[data-icon="waves"],
.cgl-rte-iconpick-glyph[data-icon="waves"] { --cgl-rte-icon: url("https://cdn.jsdelivr.net/npm/lucide-static@0.477.0/icons/waves.svg"); }
.cgl-rte-cardlike-icon[data-icon="anchor"],
.cgl-rte-iconpick-glyph[data-icon="anchor"] { --cgl-rte-icon: url("https://cdn.jsdelivr.net/npm/lucide-static@0.477.0/icons/anchor.svg"); }
.cgl-rte-cardlike-icon[data-icon="fish"],
.cgl-rte-iconpick-glyph[data-icon="fish"] { --cgl-rte-icon: url("https://cdn.jsdelivr.net/npm/lucide-static@0.477.0/icons/fish.svg"); }
.cgl-rte-cardlike-icon[data-icon="dog"],
.cgl-rte-iconpick-glyph[data-icon="dog"] { --cgl-rte-icon: url("https://cdn.jsdelivr.net/npm/lucide-static@0.477.0/icons/dog.svg"); }
.cgl-rte-cardlike-icon[data-icon="utensils"],
.cgl-rte-iconpick-glyph[data-icon="utensils"] { --cgl-rte-icon: url("https://cdn.jsdelivr.net/npm/lucide-static@0.477.0/icons/utensils.svg"); }
.cgl-rte-cardlike-icon[data-icon="wifi"],
.cgl-rte-iconpick-glyph[data-icon="wifi"] { --cgl-rte-icon: url("https://cdn.jsdelivr.net/npm/lucide-static@0.477.0/icons/wifi.svg"); }
.cgl-rte-cardlike-icon[data-icon="trees"],
.cgl-rte-iconpick-glyph[data-icon="trees"] { --cgl-rte-icon: url("https://cdn.jsdelivr.net/npm/lucide-static@0.477.0/icons/trees.svg"); }
.cgl-rte-cardlike-icon[data-icon="flame"],
.cgl-rte-iconpick-glyph[data-icon="flame"] { --cgl-rte-icon: url("https://cdn.jsdelivr.net/npm/lucide-static@0.477.0/icons/flame.svg"); }
.cgl-rte-cardlike-icon[data-icon="sun"],
.cgl-rte-iconpick-glyph[data-icon="sun"] { --cgl-rte-icon: url("https://cdn.jsdelivr.net/npm/lucide-static@0.477.0/icons/sun.svg"); }
.cgl-rte-cardlike-icon[data-icon="car"],
.cgl-rte-iconpick-glyph[data-icon="car"] { --cgl-rte-icon: url("https://cdn.jsdelivr.net/npm/lucide-static@0.477.0/icons/car.svg"); }
.cgl-rte-cardlike-icon[data-icon="star"],
.cgl-rte-iconpick-glyph[data-icon="star"] { --cgl-rte-icon: url("https://cdn.jsdelivr.net/npm/lucide-static@0.477.0/icons/star.svg"); }

/* Card variant: white panel; icon + title on row 1, body full width below. */
.cgl-rte-card {
    background: #fff;
    border: 1px solid #ececec;
    border-radius: 14px;
    padding: 20px 22px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.04);
}
.cgl-rte-card > .cgl-rte-cardlike-body {
    grid-column: 1 / -1;
    grid-row: 2;
}

/* Callout variant: tinted alert box with a left accent border; icon spans both
 * rows so title + body stack to its right. */
.cgl-rte-callout {
    background: color-mix(in srgb, var(--cgl-rte-accent) 8%, #fff);
    border: 1px solid color-mix(in srgb, var(--cgl-rte-accent) 24%, transparent);
    border-left: 4px solid var(--cgl-rte-accent);
    border-radius: 10px;
    padding: 16px 18px;
    row-gap: 4px;
}
.cgl-rte-callout > .cgl-rte-cardlike-icon {
    grid-row: 1 / span 2;
    width: 30px;
    height: 30px;
}
.cgl-rte-callout > .cgl-rte-cardlike-title {
    grid-column: 2;
    font-size: 1.02em;
    color: color-mix(in srgb, var(--cgl-rte-accent) 55%, #1f2937);
}
.cgl-rte-callout > .cgl-rte-cardlike-body {
    grid-column: 2;
    grid-row: 2;
    font-size: 0.95em;
}
.cgl-rte-callout .cgl-rte-cardlike-body h2,
.cgl-rte-callout .cgl-rte-cardlike-body h3 {
    color: inherit;
}

@media (max-width: 600px) {
    .cgl-rte-card { padding: 16px 16px; }
}

/* Editor-only: atomic block with a static preview + click-to-edit affordance. */
.cgl-rte-host .ql-editor .cgl-rte-cardlike {
    position: relative;
    user-select: none;
    cursor: pointer;
}
.cgl-rte-host .ql-editor .cgl-rte-card:hover,
.cgl-rte-host .ql-editor .cgl-rte-callout:hover {
    outline: 2px dashed var(--cgl-rte-accent);
    outline-offset: 4px;
}
.cgl-rte-host .ql-editor .cgl-rte-cardlike::after {
    position: absolute;
    top: 6px;
    right: 8px;
    font-size: 10px;
    font-weight: 600;
    color: #6b7280;
    background: #fff;
    padding: 1px 6px;
    border-radius: 10px;
    opacity: 0;
    transition: opacity 0.12s ease;
    pointer-events: none;
}
.cgl-rte-host .ql-editor .cgl-rte-card::after    { content: "Click to edit card"; }
.cgl-rte-host .ql-editor .cgl-rte-callout::after { content: "Click to edit callout"; }
.cgl-rte-host .ql-editor .cgl-rte-cardlike:hover::after { opacity: 1; }

/* ─── FAQ accordion (RTE embed) ──────────────────────────────────────────────
 * Per-page Q&A stored inline as native <details>/<summary> — works as an
 * accordion with CSS alone (no JS, no server expansion). Styled to match the
 * FAQ page's accordion (bordered rows, accent chevron). Structured data is
 * appended server-side by cgl_expand_inline_faq_schema(). Bare-class selectors
 * so it renders in any context. */
.cgl-rte-faq {
    border-top: 1px solid #e5e7eb;
    margin: 1.25em 0;
}
.cgl-rte-faq-item {
    border-bottom: 1px solid #e5e7eb;
}
.cgl-rte-faq-q {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 1rem 0;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.4;
    color: inherit;
    list-style: none;             /* hide the default disclosure triangle */
}
.cgl-rte-faq-q::-webkit-details-marker { display: none; }
.cgl-rte-faq-q:hover { color: var(--global-palette1, #16a34a); }
.cgl-rte-faq-q::after {
    content: "";
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    background: var(--global-palette1, #16a34a);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") center / contain no-repeat;
    transition: transform 0.25s ease;
}
.cgl-rte-faq-item[open] > .cgl-rte-faq-q::after { transform: rotate(180deg); }
.cgl-rte-faq-a {
    padding: 0 0 1.25rem;
    color: #4b5563;
}
.cgl-rte-faq-a > :first-child { margin-top: 0; }
.cgl-rte-faq-a > :last-child  { margin-bottom: 0; }

/* Editor-only: atomic block + click-to-edit affordance (answers shown so the
 * author sees the full content; clicking anywhere opens the dialog). */
.cgl-rte-host .ql-editor .cgl-rte-faq {
    position: relative;
    user-select: none;
    cursor: pointer;
    border: 1px dashed #d1d5db;
    border-radius: 8px;
    padding: 4px 14px;
}
.cgl-rte-host .ql-editor .cgl-rte-faq-item > .cgl-rte-faq-a { display: block; }  /* preview answers even when collapsed */
.cgl-rte-host .ql-editor .cgl-rte-faq:hover { outline: 2px dashed var(--global-palette1, #16a34a); outline-offset: 4px; }
.cgl-rte-host .ql-editor .cgl-rte-faq::after {
    content: "Click to edit FAQ";
    position: absolute;
    top: 6px;
    right: 8px;
    font-size: 10px;
    font-weight: 600;
    color: #6b7280;
    background: #fff;
    padding: 1px 6px;
    border-radius: 10px;
    opacity: 0;
    transition: opacity 0.12s ease;
    pointer-events: none;
}
.cgl-rte-host .ql-editor .cgl-rte-faq:hover::after { opacity: 1; }

/* ─── Button insert/edit modal (editor only) ───────────────────────────── */
.cgl-rte-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100050;  /* above wp.media (100000) so picker overlays correctly */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.cgl-rte-modal {
    width: min(420px, 92vw);
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.cgl-rte-modal__header {
    padding: 14px 18px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    font-size: 14px;
    font-weight: 600;
    color: #111827;
}
.cgl-rte-modal__body {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.cgl-rte-modal__field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    border: 0;
    padding: 0;
    margin: 0;
    font-size: 13px;
}
.cgl-rte-modal__field > span,
.cgl-rte-modal__field > legend,
.cgl-rte-modal__field > label {
    font-weight: 600;
    color: #374151;
    padding: 0;
}
/* Curated accent swatches (card/callout dialog). */
.cgl-rte-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.cgl-rte-swatch {
    width: 24px;
    height: 24px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
}
.cgl-rte-swatch.is-active {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #111827;
}
/* Curated icon picker (card/callout dialog). */
.cgl-rte-iconpick {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 6px;
    max-height: 168px;
    overflow-y: auto;
    padding: 2px;
}
.cgl-rte-iconpick-opt {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
}
.cgl-rte-iconpick-opt:hover { border-color: #d1d5db; background: #f9fafb; }
.cgl-rte-iconpick-opt.is-active { border-color: #16a34a; background: #dcfce7; }
.cgl-rte-iconpick-glyph {
    width: 20px;
    height: 20px;
    color: #374151;
    background: currentColor;
    -webkit-mask: var(--cgl-rte-icon) center / contain no-repeat;
            mask: var(--cgl-rte-icon) center / contain no-repeat;
}
.cgl-rte-iconpick-opt.is-active .cgl-rte-iconpick-glyph { color: #166534; }

/* FAQ accordion dialog: a list of Q&A rows + an add button. */
.cgl-rte-faq-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-height: 52vh;
    overflow-y: auto;
    padding-right: 2px;
}
.cgl-rte-faq-row {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #fafafa;
}
.cgl-rte-faq-row__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.cgl-rte-faq-row__num {
    font-size: 12px;
    font-weight: 700;
    color: #6b7280;
    letter-spacing: 0.02em;
}
.cgl-rte-faq-row__del {
    border: 0;
    background: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 2px 4px;
}
.cgl-rte-faq-row__del:hover { color: #b91c1c; }
.cgl-rte-faq-add { align-self: flex-start; }
.cgl-rte-modal__field input[type="text"],
.cgl-rte-modal__field input[type="number"],
.cgl-rte-modal__field input[type="date"],
.cgl-rte-modal__field input[type="time"],
.cgl-rte-modal__field select {
    height: 34px;
    padding: 6px 10px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 13px;
    color: #111827;
    background: #fff;
    box-shadow: none;
}
.cgl-rte-modal__field textarea {
    padding: 6px 10px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font: inherit;
    font-size: 13px;
    color: #111827;
    background: #fff;
    box-shadow: none;
    resize: vertical;
}
.cgl-rte-modal__field input[type="text"]:focus,
.cgl-rte-modal__field input[type="number"]:focus,
.cgl-rte-modal__field input[type="date"]:focus,
.cgl-rte-modal__field input[type="time"]:focus,
.cgl-rte-modal__field textarea:focus,
.cgl-rte-modal__field select:focus {
    outline: none;
    border-color: #16a34a;
    box-shadow: 0 0 0 2px #dcfce7;
}
/* Quick-size preset buttons under the spacer height field. */
.cgl-rte-spacer-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}
.cgl-rte-modal__empty {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: #6b7280;
}
.cgl-rte-modal__err {
    border-color: #dc2626 !important;
    box-shadow: 0 0 0 2px #fee2e2 !important;
}
.cgl-rte-modal__align {
    display: flex;
    flex-direction: row;
    gap: 14px;
    align-items: center;
    flex-wrap: wrap;
}
.cgl-rte-modal__align legend {
    width: 100%;
    margin-bottom: 4px;
}
.cgl-rte-modal__align label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
}
/* Checkbox row (event-calendar toggles): checkbox left of its label, on one
 * line — distinct from the stacked label/control of __field. */
.cgl-rte-modal__check {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
}
.cgl-rte-modal__check input[type="checkbox"] {
    flex: 0 0 auto;
    margin: 0;
}
.cgl-rte-modal__actions {
    padding: 12px 18px;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 8px;
}
.cgl-rte-modal__spacer { flex: 1 1 auto; }
.cgl-rte-modal__btn {
    appearance: none;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #374151;
    padding: 7px 14px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
}
.cgl-rte-modal__btn:hover { background: #f3f4f6; }
.cgl-rte-modal__btn--primary {
    background: #16a34a;
    border-color: #16a34a;
    color: #fff;
}
.cgl-rte-modal__btn--primary:hover {
    background: #15803d;
    border-color: #15803d;
}
.cgl-rte-modal__btn--danger {
    color: #b91c1c;
    border-color: transparent;
    background: transparent;
}
.cgl-rte-modal__btn--danger:hover {
    background: #fee2e2;
}

/* ─── Columns edit dialog (editor only) ────────────────────────────────────
 * A wider modal variant hosting one nested editor per column (2–4), laid out
 * in an even grid keyed off data-count. The panes collapse to 2-up then 1-up on
 * narrow admin screens, and the body scrolls if tall editors exceed the
 * viewport. */
.cgl-rte-modal--wide {
    width: min(1080px, 96vw);
}
.cgl-rte-modal--wide .cgl-rte-modal__body {
    max-height: 74vh;
    overflow: auto;
}
/* Column-count selector — a small segmented control above the panes. */
.cgl-rte-cols-count {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}
.cgl-rte-count-btn {
    appearance: none;
    min-width: 34px;
    height: 30px;
    padding: 0 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    color: #374151;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
}
.cgl-rte-count-btn:hover { background: #f3f4f6; }
.cgl-rte-count-btn.is-active {
    background: #16a34a;
    border-color: #16a34a;
    color: #fff;
}
.cgl-rte-cols-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}
.cgl-rte-cols-grid[data-count="2"] { grid-template-columns: repeat(2, 1fr); }
.cgl-rte-cols-grid[data-count="3"] { grid-template-columns: repeat(3, 1fr); }
.cgl-rte-cols-grid[data-count="4"] { grid-template-columns: repeat(4, 1fr); }
/* Tablet: 3/4 panes drop to 2-up so each editor stays usably wide. */
@media (max-width: 820px) {
    .cgl-rte-cols-grid[data-count="3"],
    .cgl-rte-cols-grid[data-count="4"] {
        grid-template-columns: repeat(2, 1fr);
    }
}
/* Narrow: a single column of panes. */
@media (max-width: 560px) {
    .cgl-rte-cols-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Placeholder — match the plugin's muted text color */
.cgl-rte-host .ql-editor.ql-blank::before {
    color: #9ca3af;
    font-style: normal;
    left: 14px;
}

/* ─── Link / video URL tooltip ──────────────────────────────────────────── */
/*
 * Quill renders link/video URL prompts as a floating .ql-tooltip absolutely
 * positioned at left:0; top:0; inside the editor container. That clips
 * against the WP admin sidebar and floats awkwardly over the empty editor
 * body. Treat it instead as a full-width "prompt bar" docked at the top of
 * the editor body, flush against the toolbar — visually it reads as an
 * inline question, not a floating modal.
 */
.cgl-rte-host.ql-container {
    /* Positioning context for the absolute tooltip below. */
    position: relative;
}

/* Default state: respect Quill's .ql-hidden class. Quill removes that class
 * when the tooltip is actually invoked (link/video button click). */
.ql-snow .ql-tooltip.ql-hidden {
    display: none !important;
}
.ql-snow .ql-tooltip {
    left: 0 !important;
    right: 0 !important;
    top: 0 !important;
    transform: none !important;
    margin: 0 !important;
    width: auto;
    background: #f9fafb;
    border: 0;
    border-bottom: 1px solid #d1d5db;
    border-radius: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
    padding: 10px 14px;
    color: #374151;
    font-size: 13px;
    line-height: 1.4;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 10px;
}
.ql-snow .ql-tooltip::before {
    /* Quill's auto-inserted label ("Enter link:", "Enter video:",
     * "Visit URL:"). Keep it on its own line spacing-wise. */
    content: '';  /* prevent stray default rendering */
    margin: 0;
    flex-shrink: 0;
    color: #6b7280;
    font-weight: 500;
}
/* Re-introduce Quill's contextual prefix labels, but matching our typography. */
.ql-snow .ql-tooltip[data-mode="link"]::before  { content: 'Enter link:'; }
.ql-snow .ql-tooltip[data-mode="video"]::before { content: 'Enter video URL:'; }
.ql-snow .ql-tooltip[data-mode="formula"]::before { content: 'Enter formula:'; }
.ql-snow .ql-tooltip:not([data-mode])::before    { content: 'Visit URL:'; }

.ql-snow .ql-tooltip input[type=text] {
    flex: 1 1 auto;
    min-width: 0;
    padding: 6px 10px;
    height: 30px;
    line-height: 18px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 13px;
    color: #111827;
    background: #fff;
    box-shadow: none;
}
.ql-snow .ql-tooltip input[type=text]:focus {
    outline: none;
    border-color: #16a34a;
    box-shadow: 0 0 0 2px #dcfce7;
}

/* Action links ("Save", "Edit", "Remove") — chip-style buttons aligned at
 * the right of the bar. Reset every one of Quill's snow-theme defaults
 * because the framework ships baked-in margins/borders/floats on these. */
.ql-snow .ql-tooltip a.ql-action,
.ql-snow .ql-tooltip a.ql-remove,
.ql-snow .ql-tooltip a.ql-preview {
    flex-shrink: 0;
    margin: 0;
    padding: 6px 10px;
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    background: transparent;
    color: #16a34a;
}
.ql-snow .ql-tooltip a.ql-action {
    background: #16a34a;
    color: #fff;
}
.ql-snow .ql-tooltip a.ql-action:hover {
    background: #15803d;
}
.ql-snow .ql-tooltip a.ql-remove {
    color: #b91c1c;
}
.ql-snow .ql-tooltip a.ql-remove:hover {
    background: #fee2e2;
}
.ql-snow .ql-tooltip a.ql-preview {
    max-width: 340px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    border: 1px solid #d1d5db;
    background: #fff;
}
.ql-snow .ql-tooltip a.ql-preview:hover {
    background: #f3f4f6;
}
/* Quill writes the visible label via ::before/::after on .ql-action and
 * .ql-remove. Force the labels we want (Save / Remove). */
.ql-snow .ql-tooltip a.ql-action::after {
    content: 'Save' !important;
    padding-right: 0 !important;
    border-right: 0 !important;
    margin-left: 0 !important;
}
.ql-snow .ql-tooltip a.ql-remove::before {
    content: 'Remove' !important;
    margin-right: 0 !important;
}
.ql-snow .ql-tooltip.ql-editing a.ql-preview,
.ql-snow .ql-tooltip.ql-editing a.ql-remove {
    /* When the user is typing the URL, only "Save" makes sense. */
    display: none;
}
.ql-snow .ql-tooltip:not(.ql-editing) input[type=text] {
    /* When previewing an existing link, the input is hidden by default. */
    display: none;
}

/* ─── Review request callout ─────────────────────────────────────────────────
 * One site-wide callout (CL Tools → Reviews) rendered identically by the RTE
 * "Review request" block and [cglaunch_review_callout]. The accent defaults to
 * the site's primary colour and is overridden inline when the settings pick a
 * swatch. Layout: icon + title, then the content, then up to three buttons.
 * Bare-class selectors so it renders in any context (it is not always inside
 * `.cgl-rte-output`). */
.cgl-reviewask {
    --cgl-reviewask-accent: var(--global-palette1, #16a34a);
    --cgl-reviewask-icon: url("https://cdn.jsdelivr.net/npm/lucide-static@0.477.0/icons/star.svg");
    box-sizing: border-box;
    margin: 1.5em 0;
    color: #4b5563;
}
.cgl-reviewask--callout {
    background: color-mix(in srgb, var(--cgl-reviewask-accent) 8%, #fff);
    border: 1px solid color-mix(in srgb, var(--cgl-reviewask-accent) 24%, transparent);
    border-left: 4px solid var(--cgl-reviewask-accent);
    border-radius: 10px;
    padding: 18px 20px;
}
.cgl-reviewask--card {
    background: #fff;
    border: 1px solid #ececec;
    border-radius: 14px;
    padding: 20px 22px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.05);
}
.cgl-reviewask-head {
    display: flex;
    align-items: center;
    gap: 12px;
}
.cgl-reviewask-icon {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.cgl-reviewask-icon::before {
    content: "";
    width: 20px;
    height: 20px;
    background: currentColor;
    -webkit-mask: var(--cgl-reviewask-icon) center / contain no-repeat;
            mask: var(--cgl-reviewask-icon) center / contain no-repeat;
}
.cgl-reviewask--callout .cgl-reviewask-icon {
    background: var(--cgl-reviewask-accent);
    color: #fff;
}
.cgl-reviewask--card .cgl-reviewask-icon {
    background: color-mix(in srgb, var(--cgl-reviewask-accent) 15%, transparent);
    color: var(--cgl-reviewask-accent);
}
.cgl-reviewask-title {
    font-weight: 700;
    font-size: 1.2em;
    line-height: 1.25;
    color: #1f2937;
}
.cgl-reviewask--callout .cgl-reviewask-title {
    color: color-mix(in srgb, var(--cgl-reviewask-accent) 55%, #1f2937);
}
.cgl-reviewask-body {
    margin-top: 10px;
    font-size: 0.95em;
    line-height: 1.6;
    color: #4b5563;
}
.cgl-reviewask-body .cgl-rte-output > :first-child { margin-top: 0; }
.cgl-reviewask-body .cgl-rte-output > :last-child  { margin-bottom: 0; }
.cgl-reviewask-body a:not(.cgl-rte-button) {
    color: color-mix(in srgb, var(--cgl-reviewask-accent) 80%, #000);
    text-decoration: underline;
}
/* CTA buttons placed inside the content follow the callout's accent. */
.cgl-reviewask-body .cgl-rte-button {
    background: var(--cgl-reviewask-accent);
}
.cgl-reviewask-body .cgl-rte-button:hover {
    background: color-mix(in srgb, var(--cgl-reviewask-accent) 85%, #000);
}
.cgl-reviewask-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}
.cgl-reviewask-btn {
    display: inline-block;
    box-sizing: border-box;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 1em;
    line-height: 1.2;
    text-decoration: none !important;
    cursor: pointer;
    transition: background 0.15s ease, filter 0.15s ease;
}
.cgl-reviewask-btn--primary {
    background: var(--cgl-reviewask-accent);
    border: 1.5px solid var(--cgl-reviewask-accent);
    color: #fff !important;
}
.cgl-reviewask-btn--primary:hover { filter: brightness(0.92); }
.cgl-reviewask-btn--secondary {
    background: transparent;
    border: 1.5px solid color-mix(in srgb, var(--cgl-reviewask-accent) 55%, #fff);
    color: color-mix(in srgb, var(--cgl-reviewask-accent) 75%, #000) !important;
}
.cgl-reviewask-btn--secondary:hover {
    background: color-mix(in srgb, var(--cgl-reviewask-accent) 10%, #fff);
}
@media (max-width: 600px) {
    .cgl-reviewask--callout,
    .cgl-reviewask--card { padding: 16px; }
    .cgl-reviewask-actions { flex-direction: column; }
    .cgl-reviewask-btn { text-align: center; }
}

/* Header-icon masks for the callout icon set (render + settings picker). */
.cgl-reviewask-icon[data-icon="star"],           .cgl-iconopt-glyph[data-icon="star"]           { --cgl-reviewask-icon: url("https://cdn.jsdelivr.net/npm/lucide-static@0.477.0/icons/star.svg"); }
.cgl-reviewask-icon[data-icon="heart"],          .cgl-iconopt-glyph[data-icon="heart"]          { --cgl-reviewask-icon: url("https://cdn.jsdelivr.net/npm/lucide-static@0.477.0/icons/heart.svg"); }
.cgl-reviewask-icon[data-icon="thumbs-up"],      .cgl-iconopt-glyph[data-icon="thumbs-up"]      { --cgl-reviewask-icon: url("https://cdn.jsdelivr.net/npm/lucide-static@0.477.0/icons/thumbs-up.svg"); }
.cgl-reviewask-icon[data-icon="message-circle"], .cgl-iconopt-glyph[data-icon="message-circle"] { --cgl-reviewask-icon: url("https://cdn.jsdelivr.net/npm/lucide-static@0.477.0/icons/message-circle.svg"); }
.cgl-reviewask-icon[data-icon="smile"],          .cgl-iconopt-glyph[data-icon="smile"]          { --cgl-reviewask-icon: url("https://cdn.jsdelivr.net/npm/lucide-static@0.477.0/icons/smile.svg"); }

/* Editor placeholder for the review request block. Atomic chip like the other
 * marker embeds; the server expands the marker, so this never reaches a visitor. */
.cgl-rte-host .ql-editor .cgl-rte-reviewask-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    align-items: center;
    justify-content: center;
    min-height: 56px;
    margin: 1em 0;
    padding: 12px 14px;
    border: 1px dashed #94a3b8;
    border-left: 4px solid #16a34a;
    border-radius: 8px;
    background: #f8fafc;
    color: #334155;
    user-select: none;
}
.cgl-rte-host .ql-editor .cgl-rte-reviewask-icon {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    background: #16a34a;
    -webkit-mask: url("https://cdn.jsdelivr.net/npm/lucide-static@0.477.0/icons/star.svg") center / contain no-repeat;
            mask: url("https://cdn.jsdelivr.net/npm/lucide-static@0.477.0/icons/star.svg") center / contain no-repeat;
}
.cgl-rte-host .ql-editor .cgl-rte-reviewask-label { font-size: 13px; font-weight: 600; }
.cgl-rte-host .ql-editor .cgl-rte-reviewask-hint  { font-size: 12px; color: #64748b; }
/* An unexpanded marker (should not happen) must never show on the frontend. */
.cgl-rte-output .cgl-rte-reviewask-wrap:empty { display: none; }

/* ─── Countdown block (CL Blocks → Countdown) ──────────────────────────── */

.cgl-cd {
    --cgl-cd-accent: var(--global-palette1, #16a34a);
    --cgl-cd-icon: url("https://cdn.jsdelivr.net/npm/lucide-static@0.477.0/icons/calendar-clock.svg");
    box-sizing: border-box;
    margin: 1.5em 0;
    padding: 20px 24px;
    border: 1px solid #d9d3ca;
    border-radius: 8px;
    background: #fefdfc;
    color: #000;
}
.cgl-cd[hidden], .cgl-cd [hidden] { display: none !important; }
.cgl-cd__head { display: flex; align-items: center; gap: 12px; margin: 0 0 14px; }
.cgl-cd__icon {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--cgl-cd-accent) 15%, transparent);
    color: var(--cgl-cd-accent);
}
.cgl-cd__icon::before {
    content: "";
    width: 20px;
    height: 20px;
    background: currentColor;
    -webkit-mask: var(--cgl-cd-icon) center / contain no-repeat;
            mask: var(--cgl-cd-icon) center / contain no-repeat;
}
.cgl-cd__icon--ended {
    --cgl-cd-icon: url("https://cdn.jsdelivr.net/npm/lucide-static@0.477.0/icons/flag.svg");
    background: #ece8de;
    color: #57534e;
}
.cgl-cd__title { margin: 0; font-size: 1.25em; font-weight: 500; line-height: 1.3; }
.cgl-cd__units { display: flex; flex-wrap: wrap; gap: 8px; }
.cgl-cd__unit {
    flex: 1 1 0;
    min-width: 64px;
    padding: 10px 6px;
    border: 1px solid #e5e0d6;
    border-radius: 8px;
    background: #fff;
    text-align: center;
}
.cgl-cd__num {
    display: block;
    font-size: 30px;
    font-weight: 500;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}
.cgl-cd__lab { display: block; margin-top: 2px; font-size: 12px; }
.cgl-cd__when { margin: 14px 0 0; font-size: 14px; line-height: 1.5; }
/* The card is always light, so its text is always black, whatever the theme or the surrounding section colours. */
.cgl-cd .cgl-cd__title, .cgl-cd .cgl-cd__num, .cgl-cd .cgl-cd__lab, .cgl-cd .cgl-cd__when { color: #000 !important; }
.cgl-cd__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-top: 14px; }
.cgl-cd__btn {
    display: inline-block;
    box-sizing: border-box;
    padding: 9px 16px;
    border-radius: 6px;
    background: var(--cgl-cd-accent);
    border: 1.5px solid var(--cgl-cd-accent);
    color: #fff !important;
    font-weight: 600;
    font-size: 0.95em;
    line-height: 1.2;
    text-decoration: none !important;
    transition: filter 0.15s ease;
}
.cgl-cd__btn:hover { filter: brightness(0.92); }
.cgl-cd__cal { font-size: 0.9em; color: color-mix(in srgb, var(--cgl-cd-accent) 75%, #000) !important; text-decoration: underline; }

/* One line: the heading, the time left and the date side by side. */
.cgl-cd--compact { padding: 12px 16px; }
.cgl-cd--compact .cgl-cd__running {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 14px;
}
.cgl-cd--compact .cgl-cd__head { margin: 0; }
.cgl-cd--compact .cgl-cd__title { font-size: 1em; }
.cgl-cd--compact .cgl-cd__units { gap: 4px 10px; flex: 0 1 auto; }
.cgl-cd--compact .cgl-cd__unit {
    flex: 0 0 auto;
    min-width: 0;
    padding: 0;
    border: 0;
    background: none;
    text-align: left;
}
.cgl-cd--compact .cgl-cd__num { display: inline; font-size: 1em; font-weight: 600; }
.cgl-cd--compact .cgl-cd__lab { display: inline; margin: 0; font-size: 1em; }
.cgl-cd--compact .cgl-cd__when { flex: 0 1 auto; margin: 0; font-size: 13px; }
.cgl-cd--compact .cgl-cd__actions { margin-top: 0; }
.cgl-cd--compact .cgl-cd__ended .cgl-cd__head { margin: 0; }
.cgl-cd--compact .cgl-cd__ended .cgl-cd__title { font-size: 1em; }
.cgl-cd--compact .cgl-cd__ended .cgl-cd__when { margin-top: 4px; }

/* Stronger layouts for where the block is the point of the page. Same markup, the site accent, text still black
   (the colour rules above are not overridden here). */
.cgl-cd--framed {
    padding: 22px 24px;
    border: 2px solid var(--cgl-cd-accent);
    border-radius: 10px;
    background: color-mix(in srgb, var(--cgl-cd-accent) 7%, #fff);
    box-shadow: 0 6px 20px color-mix(in srgb, var(--cgl-cd-accent) 22%, transparent);
}
.cgl-cd--framed .cgl-cd__unit { border-color: color-mix(in srgb, var(--cgl-cd-accent) 35%, #fff); }
.cgl-cd--framed .cgl-cd__title { font-size: 1.4em; }
.cgl-cd--framed .cgl-cd__num { font-size: 40px; }

.cgl-cd--bar {
    position: relative;
    overflow: hidden;
    padding: 28px 24px 20px;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .09);
}
.cgl-cd--bar::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 6px; background: var(--cgl-cd-accent); }
.cgl-cd--bar .cgl-cd__unit { border: 0; background: color-mix(in srgb, var(--cgl-cd-accent) 14%, #fff); }
.cgl-cd--bar .cgl-cd__num { font-size: 44px; }

/* A centered band inside the content column (it does not break out of it). */
.cgl-cd--banner {
    padding: 26px 24px;
    border: 0;
    border-top: 3px solid var(--cgl-cd-accent);
    border-bottom: 3px solid var(--cgl-cd-accent);
    border-radius: 0;
    background: color-mix(in srgb, var(--cgl-cd-accent) 12%, #fff);
    text-align: center;
}
.cgl-cd--banner .cgl-cd__head,
.cgl-cd--banner .cgl-cd__units,
.cgl-cd--banner .cgl-cd__actions { justify-content: center; }
.cgl-cd--banner .cgl-cd__title { font-size: 1.4em; }
.cgl-cd--banner .cgl-cd__units { gap: 0; }
.cgl-cd--banner .cgl-cd__unit {
    flex: 0 0 auto;
    min-width: 0;
    padding: 4px 28px;
    border: 0;
    border-right: 1px solid color-mix(in srgb, var(--cgl-cd-accent) 40%, #fff);
    border-radius: 0;
    background: transparent;
}
.cgl-cd--banner .cgl-cd__unit:last-child { border-right: 0; }
.cgl-cd--banner .cgl-cd__num { font-size: 52px; }

@media (max-width: 480px) {
    .cgl-cd { padding: 16px; }
    .cgl-cd__num { font-size: 26px; }
    .cgl-cd--framed, .cgl-cd--bar, .cgl-cd--banner { padding: 18px 16px; }
    .cgl-cd--bar { padding-top: 24px; }
    .cgl-cd--framed .cgl-cd__num { font-size: 32px; }
    .cgl-cd--bar .cgl-cd__num { font-size: 34px; }
    .cgl-cd--banner .cgl-cd__num { font-size: 38px; }
    .cgl-cd--banner .cgl-cd__unit { padding: 4px 14px; }
}

/* ─── CL Blocks (the "CL Blocks" picker) ───────────────────────────────── */

/* Editor placeholder. Atomic chip like the other marker embeds; the server
 * expands the marker, so this never reaches a visitor. */
.cgl-rte-host .ql-editor .cgl-rte-clblock-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    align-items: center;
    justify-content: center;
    min-height: 56px;
    margin: 1em 0;
    padding: 12px 14px;
    border: 1px dashed #94a3b8;
    border-left: 4px solid #2563eb;
    border-radius: 8px;
    background: #f8fafc;
    color: #334155;
    cursor: pointer;
    user-select: none;
}
.cgl-rte-host .ql-editor .cgl-rte-clblock-wrap:hover { background: #f1f5f9; }
.cgl-rte-host .ql-editor .cgl-rte-clblock-icon {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    background: #2563eb;
    -webkit-mask: url("https://cdn.jsdelivr.net/npm/lucide-static@0.477.0/icons/layout-grid.svg") center / contain no-repeat;
            mask: url("https://cdn.jsdelivr.net/npm/lucide-static@0.477.0/icons/layout-grid.svg") center / contain no-repeat;
}
.cgl-rte-host .ql-editor .cgl-rte-clblock-label { font-size: 13px; font-weight: 600; }
.cgl-rte-host .ql-editor .cgl-rte-clblock-hint  { font-size: 12px; color: #64748b; }
/* An unexpanded marker (should not happen) must never show on the frontend. */
.cgl-rte-output .cgl-rte-clblock-wrap:empty { display: none; }

/* Picker dialog. */
.cgl-rte-modal--clblocks {
    width: min(520px, 94vw);
    max-height: 90vh;
}
.cgl-rte-modal--clblocks .cgl-rte-modal__body { overflow-y: auto; }
.cgl-rte-clblock-intro { margin: 0; font-size: 13px; color: #4b5563; line-height: 1.5; }
.cgl-rte-clblock-picks { display: flex; flex-direction: column; gap: 8px; }
.cgl-rte-clblock-pick {
    display: flex;
    flex-direction: column;
    gap: 3px;
    text-align: left;
    padding: 12px 14px;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    cursor: pointer;
    font: inherit;
}
.cgl-rte-clblock-pick:hover,
.cgl-rte-clblock-pick:focus { border-color: #2563eb; background: #f8fafc; outline: none; }
.cgl-rte-clblock-pick strong { font-size: 14px; color: #111827; }
.cgl-rte-clblock-pick span   { font-size: 12.5px; color: #6b7280; line-height: 1.45; }
.cgl-rte-clblock-list {
    max-height: 180px;
    overflow-y: auto;
    padding: 6px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fafafa;
}
.cgl-rte-clblock-help { font-size: 12px; color: #6b7280; line-height: 1.45; }
.cgl-rte-clblock-warn {
    margin: 0;
    padding: 8px 10px;
    border: 1px solid #f59e0b;
    border-left-width: 4px;
    border-radius: 4px;
    background: #fffbeb;
    color: #92400e;
    font-size: 12.5px;
    line-height: 1.45;
}
.cgl-rte-clblock-color { display: flex; align-items: center; gap: 8px; }
.cgl-rte-clblock-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cgl-rte-clblock-color input[type="color"] {
    flex: 0 0 auto;
    width: 38px;
    height: 34px;
    padding: 2px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
}
.cgl-rte-clblock-color input[type="text"] { flex: 1 1 auto; min-width: 0; }

/* ─── Sticky toolbar ───────────────────────────────────────────────────────
 * The toolbar stays on screen while the author scrolls a long document. It
 * sits just under the WordPress admin bar (32px; 46px on small screens, and
 * the bar scrolls away entirely at <=600px). Inside a dialog it sticks to the
 * dialog's own scroll area instead. cgl-rte.js (makeToolbarSticky) also adds
 * .cgl-rte-unclip to any ancestor that clips with overflow:hidden, because
 * sticky does nothing under such an ancestor. */
.ql-toolbar.ql-snow.cgl-rte-toolbar--sticky {
    position: sticky;
    top: var(--wp-admin--admin-bar--height, 32px);
    z-index: 20;
}
@media (max-width: 782px) {
    .ql-toolbar.ql-snow.cgl-rte-toolbar--sticky { top: var(--wp-admin--admin-bar--height, 46px); }
}
@media (max-width: 600px) {
    .ql-toolbar.ql-snow.cgl-rte-toolbar--sticky { top: 0; }
}
.ql-toolbar.ql-snow.cgl-rte-toolbar--sticky.cgl-rte-toolbar--in-modal { top: 0; }
.cgl-rte-unclip { overflow: clip !important; }
.cgl-rte-unclip--flow { display: flow-root; }
