/**
 * LeanCMS v2 — Core Plugin Styles
 *
 * CSS variables for LCMS blocks. This file is loaded separately
 * from the Tailwind build so it won't be overwritten during rebuilds.
 *
 * @package lcms
 */

:root {
    /* ── Brand / Text / Background Colors ────────────────────
       Plugin-level fallbacks. The theme's config.css is the source
       of truth and overrides these via the lcms-config dependency.
       To change colours, update _brand-config.json + config.css.
       ──────────────────────────────────────────────────────── */
    --color-brand-primary: #6529AD;
    --color-brand-primary-hover: #732EC2;
    --color-brand-primary-rgb: 101, 41, 173;
    --color-brand-accent: #ddae27;
    --color-brand-accent-hover: #f7e07c;

    --color-text-primary: #101010;
    --color-text-secondary: #666666;
    --color-text-muted: #6b7280;
    --color-text-light: rgba(255, 255, 255, 0.95);
    /* Text on a brand-coloured surface (CTA brand variant, announcement bar,
       brand step-circles). Defaults white; a bright-brand site (e.g. neon)
       sets it dark so text stays legible on the brand colour. Distinct from
       --color-text-light (text on *dark* surfaces). */
    --color-text-on-brand: #ffffff;
    /* Body anchor colour. Defaults to brand PRIMARY (not accent): an accent is
       often a bright/low-contrast hue that fails WCAG on white. Sites that want
       accent links opt in via brand-config links.color (owning the contrast). */
    --color-text-link: var(--color-brand-primary);
    --color-text-link-hover: var(--color-brand-primary-hover);

    --color-bg-primary: #ffffff;
    --color-bg-secondary: #f5f5f5;
    --color-bg-brand-light: #f0f4ff;
    --color-bg-brand-light-alt: #e8eeff;
    --color-bg-dark: #153f80;
    --color-bg-dark-secondary: #112e60;
    --color-card-bg: #f9fafb;

    /* Semantic surface tokens — block panels/cards/section tints. Default
       light; a dark/brand theme overrides via colors.surface[_muted] so
       block templates stay un-opinionated (no hardcoded bg-white/bg-gray). */
    --color-surface: #ffffff;
    --color-surface-muted: #f3f4f6;

    /* Divider colour — consumed by .lcms-table row separators and
       any other "hairline between siblings" concern. Designed as a
       quiet-but-foreground-visible line (not as subtle as a
       background tint). Modern grey, Tailwind gray-200 equivalent.
       Sites override via theme.css or via a future
       `colors.borders.divider` brand-config field if one's added. */
    --color-border: #e5e7eb;

    /* ── Typography ───────────────────────────────────────── */
    --font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-heading: var(--font-family);
    --font-body: var(--font-family);
    /* Weight tokens consumed by the theme chrome (header CTA, nav, footer)
       via var(--font-weight-bold) with no fallback. Defined here so they
       resolve whenever the plugin is active, independent of whether the
       theme's config.css is present/current. */
    --font-weight-normal: 400;
    --font-weight-bold: 700;

    /* ── Buttons ──────────────────────────────────────────────
       Semantic button variables for content blocks. Defaults
       cascade from brand colours; override in _brand-config.json
       under `buttons.*` (see brand-config-fallback). Values may
       be solid colours OR linear-gradient(...) strings.
       ──────────────────────────────────────────────────────── */
    --btn-primary-bg: var(--color-brand-primary);
    --btn-primary-bg-hover: var(--color-brand-primary-hover);
    --btn-primary-color: #ffffff;
    --btn-primary-color-hover: #ffffff;
    --btn-primary-border: transparent;

    --btn-secondary-bg: var(--color-brand-accent);
    --btn-secondary-bg-hover: var(--color-brand-accent-hover);
    --btn-secondary-color: #ffffff;
    --btn-secondary-color-hover: #ffffff;
    --btn-secondary-border: transparent;

    /* Chrome button alias — header CTA, gforms submit. Defaults
       track --btn-secondary-bg so existing sites keep their accent-
       coloured chrome CTAs unchanged. */
    --button-bg: var(--btn-secondary-bg);
    --button-bg-hover: var(--btn-secondary-bg-hover);
    --button-color: var(--btn-secondary-color);
    --button-color-hover: var(--btn-secondary-color-hover);

    /* ── Layout ───────────────────────────────────────────── */
    --content-max-width: 1200px;
    --content-max-width-wide: 1460px;

    /* Canonical content-measure scale — the page/section "Measure"
       control (Page_Flow content_width) resolves a chosen rung to one
       of these and emits --lcms-content-width, which `.lcms-measure`
       consumes. Brand-config tunable via layout.measure.*. */
    --lcms-measure-narrow: 48rem;  /* ~768px — reading measure */
    --lcms-measure-medium: 80rem;  /* ~1280px — matches block "container" (screen-xl) */
    --lcms-measure-wide:   96rem;  /* ~1536px — matches block "wide" (screen-2xl) */
    --lcms-measure-full:   none;   /* fills the container */

    /* ── Borders & Radius ─────────────────────────────────── */
    --border-radius-sm: 4px;
    --border-radius: 8px;
    --border-radius-lg: 16px;
    --border-radius-xl: 32px;
    /* Authoritative button radius for LCMS buttons. Defaults to 25px — matches
       the previous effective default (which came from daisyui.rounded_btn's 25px
       default via the old --rounded-btn coupling). Overridden by brand-config
       buttons.radius. DaisyUI's own --rounded-btn now applies only to dui- components. */
    --button-radius: 25px;

    /* Buttons on a brand-coloured surface (.lcms-bg-brand). Primary/secondary
       flip to a contrasting fill; outline uses the on-brand text token. The
       fill defaults to the brand ACCENT (a second, guaranteed-distinct brand
       colour) rather than the dark bg: many brands set background.dark to the
       same value as brand.primary, so a dark-derived fill would collide with
       the brand surface and render the button invisible. Brands override via
       buttons.on_brand_bg / buttons.on_brand_bg_hover / buttons.shadow_on_brand
       so the treatment suits a bright OR dark brand. */
    --button-on-brand-bg: var(--color-brand-accent);
    --button-on-brand-bg-hover: var(--color-brand-accent-hover);

    /* ── Block Presentation Style ─────────────────────────── */
    --block-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --block-border: none;

    /* ── Shadows ──────────────────────────────────────────── */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.1);

    /* ── Card component tokens ─────────────────────────────
       The card surface, given the same token vocabulary as buttons
       (--button-*) and inputs (--lcms-input-*). Each token reads its
       brand/source var with the CURRENT literal as the fallback, so
       computed output is unchanged — this is a naming consolidation,
       not a restyle. Sites override by setting the source var (e.g.
       shadows.cards) or the --lcms-card-* token directly.
       `.lcms-card` (and the .lcms-card-shadow / .lcms-card-interactive
       utilities) consume these; the card-grid block's standard cards
       inherit them via those classes. The card-grid *image-tile* variant
       is a deliberately distinct surface (bg-image tiles, --border-radius-lg
       + --block-shadow) and is intentionally NOT folded in here. */
    --lcms-card-bg: var(--color-bg-secondary);
    --lcms-card-radius: var(--border-radius);
    --lcms-card-padding: var(--card-padding, 2rem);            /* md+ */
    --lcms-card-padding-mobile: 1.5rem;                        /* base */
    --lcms-card-padding-compact: var(--card-padding-compact, 1rem);
    --lcms-card-shadow: var(--shadow-cards, var(--shadow-sm));         /* .lcms-card base */
    --lcms-card-shadow-strong: var(--shadow-cards, var(--block-shadow)); /* .lcms-card-shadow opt-in */
    --lcms-card-shadow-hover: var(--shadow-cards-hover, var(--shadow-cards));
    --lcms-card-border: var(--block-border);

    /* ── Transitions ──────────────────────────────────────── */
    --transition-fast: 150ms ease;
    --transition-standard: 300ms ease;

    /* ── Scrim ────────────────────────────────────────────────
       Generic image overlay used by image-backed blocks (nav-tile,
       hero, etc). Brand-config drives the defaults via the `scrim`
       block; per-block overrides are also possible. The component
       classes live below in this file.
       ──────────────────────────────────────────────────────── */
    --scrim-opacity-near: 0.7;
    --scrim-opacity-far: 0.05;
    --scrim-blend-mode: normal;

    /* ── Block Spacing ─────────────────────────────────────
       The non-`neutral` presets are the site's canonical scale —
       brand-config can override any of them via `spacing.block.*`
       to dial the rhythm site-wide (e.g. tighter `default` for
       cohesive newsletter layouts).
       `neutral` is locked to the plugin's untuned baseline (4rem)
       and IS NOT brand-config tunable — authors pick `neutral`
       when a specific block wants the plugin's stock breathing
       room regardless of how the site has tuned its canonical
       rhythm. Same architectural pattern as `background: none`. */
    --block-spacing-none: 0;
    --block-spacing-minimal: 1rem;
    --block-spacing-compact: 2rem;
    --block-spacing-default: 4rem;
    --block-spacing-neutral: 4rem; /* locked */
    --block-spacing-spacious: 6rem;
    --block-spacing-extra-spacious: 8rem;
}

/* ── Container ───────────────────────────────────────────── */
.lcms-container {
    max-width: var(--content-max-width);
    margin-left: auto;
    margin-right: auto;
    width: 100%;
}

/* Override Tailwind's max-w-screen-xl to use our variable */
section .max-w-screen-xl {
    max-width: var(--content-max-width);
}

/* ── Block Spacing Classes ───────────────────────────────────
   CASCADE CONTRACT (why `!important` — reviewed I12, 2026-06-28):
   these are the user-facing block-spacing OVERRIDE control. A block's
   root element carries BOTH a Tailwind `py-*` (e.g. the hero height map
   emits `py-12 md:py-16 lg:py-20`) AND its `lcms-spacing-*` class on the
   same element. Tailwind utilities and these are equal specificity
   (single class, 0,1,0), and the compiled Tailwind `dist/main.css` loads
   AFTER this file — so without `!important` the block's stock `py-*`
   would silently beat the author's spacing choice. `!important` is what
   makes the override control actually override; it is deliberate, not debt.
   The only block that re-overrides this (small-height hero, `hero.css`)
   must therefore also use `!important` — that single coupling is the
   extent of the "arms race". The clean alternative (CSS @layer ranking
   Tailwind below LCMS utilities) is a build-pipeline change, deferred.
   See docs/planning/sprints/css-hygiene-tokens.md (I12). */
.lcms-spacing-none {
    padding-top: var(--block-spacing-none) !important;
    padding-bottom: var(--block-spacing-none) !important;
}

.lcms-spacing-minimal {
    padding-top: var(--block-spacing-minimal) !important;
    padding-bottom: var(--block-spacing-minimal) !important;
}

.lcms-spacing-compact {
    padding-top: var(--block-spacing-compact) !important;
    padding-bottom: var(--block-spacing-compact) !important;
}

.lcms-spacing-default {
    padding-top: var(--block-spacing-default) !important;
    padding-bottom: var(--block-spacing-default) !important;
}

.lcms-spacing-neutral {
    padding-top: var(--block-spacing-neutral) !important;
    padding-bottom: var(--block-spacing-neutral) !important;
}

.lcms-spacing-spacious {
    padding-top: var(--block-spacing-spacious) !important;
    padding-bottom: var(--block-spacing-spacious) !important;
}

.lcms-spacing-extra-spacious {
    padding-top: var(--block-spacing-extra-spacious) !important;
    padding-bottom: var(--block-spacing-extra-spacious) !important;
}

/* ── Per-side spacing overrides ───────────────────────────
   Fine-tune junctions between adjacent blocks. Set via the
   spacing_top / spacing_bottom schema fields; classes win
   over the symmetric .lcms-spacing-* rules above because
   they're declared later AND target a single property. */
.lcms-spacing-top-none           { padding-top: var(--block-spacing-none) !important; }
.lcms-spacing-top-minimal        { padding-top: var(--block-spacing-minimal) !important; }
.lcms-spacing-top-compact        { padding-top: var(--block-spacing-compact) !important; }
.lcms-spacing-top-default        { padding-top: var(--block-spacing-default) !important; }
.lcms-spacing-top-neutral        { padding-top: var(--block-spacing-neutral) !important; }
.lcms-spacing-top-spacious       { padding-top: var(--block-spacing-spacious) !important; }
.lcms-spacing-top-extra-spacious { padding-top: var(--block-spacing-extra-spacious) !important; }

.lcms-spacing-bottom-none           { padding-bottom: var(--block-spacing-none) !important; }
.lcms-spacing-bottom-minimal        { padding-bottom: var(--block-spacing-minimal) !important; }
.lcms-spacing-bottom-compact        { padding-bottom: var(--block-spacing-compact) !important; }
.lcms-spacing-bottom-default        { padding-bottom: var(--block-spacing-default) !important; }
.lcms-spacing-bottom-neutral        { padding-bottom: var(--block-spacing-neutral) !important; }
.lcms-spacing-bottom-spacious       { padding-bottom: var(--block-spacing-spacious) !important; }
.lcms-spacing-bottom-extra-spacious { padding-bottom: var(--block-spacing-extra-spacious) !important; }

/* ── Block Dividers ──────────────────────────────────────── */
.lcms-block-wrap {
    position: relative;
}

.lcms-divider {
    position: absolute;
    left: 0;
    width: 100%;
    line-height: 0;
    pointer-events: none;
    z-index: 2;
}

.lcms-divider--top {
    top: -1px;
}

.lcms-divider--bottom {
    bottom: -1px;
}

.lcms-divider svg {
    display: block;
    width: 100%;
    height: 60px;
    /* Layered dividers scale back copies taller than the viewBox so their
       crests peek above the front; allow that overflow (non-layered shapes
       stay within bounds, so this is inert for them). */
    overflow: visible;
}

@media (min-width: 768px) {
    .lcms-divider svg {
        height: 80px;
    }
}

/* ── Icon Component (SVG Mask) ───────────────────────────── */
.lcms-icon {
    display: inline-block;
    background-color: currentColor;
    -webkit-mask-image: var(--lcms-icon-url);
    mask-image: var(--lcms-icon-url);
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    flex-shrink: 0;
}

/* ── Icon Row — linked items ─────────────────────────────── */
/* Linked items render as <a class="block-icon-row__item"> and would
   otherwise pick up the global accent link colour, so the icon (filled via
   currentColor) and any inherited text look mismatched next to non-linked
   <div> items. Inherit the card colour at rest so the row stays uniform,
   then move the "this is a link" affordance to hover (accent icon + title)
   — the template already sets a pointer cursor. Scoped to <a> so non-linked
   items never get the hover treatment. */
a.block-icon-row__item {
    color: inherit;
}
a.block-icon-row__item:hover {
    color: var(--color-brand-accent, currentColor);
}
a.block-icon-row__item:hover .block-icon-row__title {
    color: var(--color-brand-accent, inherit);
}

/* ── Icon Component (Emoji) ──────────────────────────────── */
.lcms-icon-emoji {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    flex-shrink: 0;
}
.lcms-icon-emoji.w-4  { font-size: 1rem; }
.lcms-icon-emoji.w-6  { font-size: 1.5rem; }
.lcms-icon-emoji.w-10 { font-size: 2.5rem; }
.lcms-icon-emoji.w-14 { font-size: 3.5rem; }
.lcms-icon-emoji.w-20 { font-size: 5rem; }

/* ── Icon Component (PNG / Image) ───────────────────────── */
.lcms-icon-img {
    display: inline-block;
    object-fit: contain;
    flex-shrink: 0;
}

/* ── Icon Component (SVG Set) ───────────────────────────── */
.lcms-icon-svg-set {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.lcms-icon-svg-set svg {
    width: 100%;
    height: 100%;
}

/* ── Icon scale system (B51) ─────────────────────────────────
   Single LCMS rule: Glyph = Lucide. Scale = hierarchy. Color = surface.
   Icons are monochrome and inherit currentColor — color decisions live
   on the surface (button variant, panel state, pill background, kind-
   tinted container), never on the icon itself. Use the size tier that
   matches the icon's role in the visual hierarchy:
     xs — fine print, status pips, badges
     sm — default chrome: action buttons, chips, inline UI controls
     md — primary chrome: kind icons, section headers
     lg — feature display: block pickers, large CTAs
   See docs/reference/ICONOGRAPHY.md for the full principle. */
:root {
    --lcms-icon-size-xs: 0.875em;
    --lcms-icon-size-sm: 1em;
    --lcms-icon-size-md: 1.25em;
    --lcms-icon-size-lg: 1.75em;
}
.lcms-icon-xs { width: var(--lcms-icon-size-xs); height: var(--lcms-icon-size-xs); }
.lcms-icon-sm { width: var(--lcms-icon-size-sm); height: var(--lcms-icon-size-sm); }
.lcms-icon-md { width: var(--lcms-icon-size-md); height: var(--lcms-icon-size-md); }
.lcms-icon-lg { width: var(--lcms-icon-size-lg); height: var(--lcms-icon-size-lg); }

/* Front-end Lucide glyph — tracks host font-size so a single class works
   inside buttons, links and chevrons. Aliased to .lcms-icon-sm for the
   B51 scale system; kept for back-compat with pre-B51 markup. */
.lcms-glyph {
    width: var(--lcms-icon-size-sm);
    height: var(--lcms-icon-size-sm);
}

/* ── Border Radius Classes ───────────────────────────────── */
.lcms-rounded-sm {
    border-radius: var(--border-radius-sm) !important;
}

.lcms-rounded {
    border-radius: var(--border-radius) !important;
}

.lcms-rounded-lg {
    border-radius: var(--border-radius-lg) !important;
}

.lcms-rounded-xl {
    border-radius: var(--border-radius-xl) !important;
}

.lcms-rounded-none {
    border-radius: 0 !important;
}

/* ── Flex Alignment Utilities ────────────────────────────── */
.items-end {
    align-items: flex-end;
}

/* ── Card Component Classes ─────────────────────────────── */
.lcms-card {
    background: var(--lcms-card-bg);
    border-radius: var(--lcms-card-radius);
    padding: var(--lcms-card-padding-mobile);
    box-shadow: var(--lcms-card-shadow);
}

.lcms-card-shadow {
    box-shadow: var(--lcms-card-shadow-strong);
    border: var(--lcms-card-border);
    transition: box-shadow var(--transition-fast);
}

.lcms-card-interactive:hover {
    box-shadow: var(--lcms-card-shadow-hover);
}

/* ── Image Shadow Class ──────────────────────────────────── */
.lcms-image-shadow {
    box-shadow: var(--shadow-images, none);
}

/* ── Button Radius & Shadow ──────────────────────────────
   LCMS buttons are plugin-owned (.btn / .btn-* in main.css @layer
   components). Radius is driven by --button-radius (authoritative);
   the box-shadow comes from --shadow-btn. No --rounded-btn / !important:
   that token belongs to DaisyUI's dui- components, not LCMS buttons. */
.btn {
    border-radius: var(--button-radius);
    box-shadow: var(--shadow-btn, none);
    /* Casing token (G36) — brand-config typography.button_transform. */
    text-transform: var(--button-transform, none);
}

.btn:hover {
    color: var(--button-color-hover, #fff);
}

/* ── Buttons on a brand-coloured surface ─────────────────────
   Token-driven, all variants. Specificity (0,2,0) beats a site's
   own `.btn` border/colour without !important, so a per-site button
   border (e.g. neo/retro) still wins on normal surfaces but the
   brand-surface treatment wins here. Supersedes the old
   .block-cta--brand .btn-primary provision and generalises to ANY
   block with a brand background, not just the CTA. */
.lcms-bg-brand .btn-primary,
.lcms-bg-brand .btn-secondary {
    background: var(--button-on-brand-bg);
    border-color: var(--button-on-brand-bg);
    box-shadow: var(--shadow-btn-on-brand, var(--shadow-btn, none));
}
/* Optional on-brand button ink. Defaults to each variant's own text colour
   so existing sites are unchanged; set --button-on-brand-color when the on-brand
   fill flips dark on a LIGHT brand surface (e.g. a bright-cyan brand) and the
   variant's normal dark ink would otherwise be unreadable on it. */
.lcms-bg-brand .btn-primary   { color: var(--button-on-brand-color, var(--btn-primary-color)); }
.lcms-bg-brand .btn-secondary { color: var(--button-on-brand-color, var(--btn-secondary-color)); }
.lcms-bg-brand .btn-primary:hover,
.lcms-bg-brand .btn-secondary:hover {
    background: var(--button-on-brand-bg-hover, var(--color-bg-dark-secondary));
    border-color: var(--button-on-brand-bg-hover, var(--color-bg-dark-secondary));
    /* Must restate box-shadow: the general .btn:hover (0,2,0 — :hover counts as
       a class) TIES the on-brand rest rule and wins on source order, so without
       this the shadow would flip to --shadow-btn-hover (the general/brand colour)
       and vanish into the brand background. */
    box-shadow: var(--shadow-btn-on-brand-hover, var(--shadow-btn-on-brand, var(--shadow-btn-hover, var(--shadow-btn, none))));
}
/* Outline sits directly on the brand fill, so its ink/border use the
   on-brand text token (dark for a bright brand, light for a dark one). */
.lcms-bg-brand .btn-outline {
    background: transparent;
    color: var(--color-text-on-brand);
    border-color: var(--color-text-on-brand);
    box-shadow: var(--shadow-btn-on-brand, var(--shadow-btn, none));
}
.lcms-bg-brand .btn-outline:hover {
    background: var(--color-text-on-brand);
    color: var(--color-brand-primary);
    box-shadow: var(--shadow-btn-on-brand-hover, var(--shadow-btn-on-brand, var(--shadow-btn-hover, var(--shadow-btn, none))));
}

@media (min-width: 768px) {
    .lcms-card {
        padding: var(--lcms-card-padding);
    }
}

/* Card modifiers — below media query to ensure they win. */
.lcms-card.lcms-card--compact {
    padding: var(--lcms-card-padding-compact);
}

.lcms-card.lcms-card--flush {
    padding: 0;
}

/* ── Accordion / Collapse ────────────────────────────────────
   Hand-rolled replacement for DaisyUI's `dui-collapse` (G39). Same
   technique: a CSS grid whose second row animates 0fr→1fr for a smooth
   height transition, a full-size hidden <input> overlay as the click
   target, and a box-shadow caret. Used by the accordion component
   (`components/accordion.php`) — which embeds in Stack/Grid too — so it
   lives in this always-loaded file rather than an on-demand block sheet.
   The element also carries `.lcms-card`/`.lcms-card-shadow`/`.lcms-rounded`
   for bg/shadow/radius (unchanged); this only supplies the collapse
   mechanics. We keep just the checkbox/radio + arrow variants DaisyUI's
   markup used — the <details>/plus/programmatic-open variants are dropped.
   `:has()` is required for the parent row-expansion (DaisyUI v4 used it too,
   so browser support is unchanged). */
.lcms-collapse {
    position: relative;
    display: grid;
    overflow: hidden;
    grid-template-rows: max-content 0fr;
    transition: grid-template-rows 0.2s;
    width: 100%;
}
.lcms-collapse > input[type="checkbox"],
.lcms-collapse > input[type="radio"] {
    grid-column-start: 1;
    grid-row-start: 1;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    opacity: 0;
    height: 100%;
    width: 100%;
    min-height: 3.75rem;
    margin: 0;
    z-index: 1;
    cursor: pointer;
}
.lcms-collapse-title {
    position: relative;
    grid-column-start: 1;
    grid-row-start: 1;
    padding: 1rem;
    padding-inline-end: 3rem;
    min-height: 3.75rem;
}
.lcms-collapse-content {
    grid-column-start: 1;
    grid-row-start: 2;
    visibility: hidden;
    min-height: 0;
    padding-left: 1rem;
    padding-right: 1rem;
    transition: visibility 0.2s, padding 0.2s ease-out;
}
.lcms-collapse:has(> input:checked) {
    grid-template-rows: max-content 1fr;
}
.lcms-collapse > input:checked ~ .lcms-collapse-content {
    visibility: visible;
    min-height: fit-content;
    padding-bottom: 1rem;
}
/* Arrow caret — a box-shadow square rotated 45°, flipping to 225° when open. */
.lcms-collapse-arrow > .lcms-collapse-title::after {
    content: "";
    position: absolute;
    display: block;
    height: 0.5rem;
    width: 0.5rem;
    top: 1.9rem;
    inset-inline-end: 1.4rem;
    pointer-events: none;
    transform-origin: 75% 75%;
    box-shadow: 2px 2px;
    transform: translateY(-100%) rotate(45deg);
    transition: transform 0.2s cubic-bezier(0, 0, 0.2, 1);
}
.lcms-collapse-arrow:has(> input:checked) > .lcms-collapse-title::after {
    transform: translateY(-50%) rotate(225deg);
}

/* ── Responsive Pull Offsets ────────────────────────────────
   Use via inline style: style="--pull-top: -10rem;"
   Only applies on md+ breakpoints, resets on mobile.
   Uses attribute selector + !important to win specificity.
   ──────────────────────────────────────────────────────────── */
@media (min-width: 768px) {
    .block-content__col[style*="--pull-top"] {
        margin-top: var(--pull-top) !important;
    }
    .block-content__col[style*="--pull-right"] {
        margin-right: var(--pull-right) !important;
    }
    .block-content__col[style*="--pull-bottom"] {
        margin-bottom: var(--pull-bottom) !important;
    }
    .block-content__col[style*="--pull-left"] {
        margin-left: var(--pull-left) !important;
    }
}

/* ── Gravity Forms Styling ──────────────────────────────────
   Match form buttons and inputs to site branding.
   ──────────────────────────────────────────────────────────── */
.gform_wrapper .gform_button,
.gform_wrapper input[type="submit"] {
    background: var(--button-bg, var(--color-brand-accent)) !important;
    border-color: var(--color-brand-accent) !important;
    color: var(--button-color, #fff) !important;
    padding: var(--button-padding, 12px 24px);
    border-radius: var(--button-radius);
    box-shadow: var(--shadow-btn, none);
    font-weight: 600;
    transition: var(--transition-fast);
    cursor: pointer;
}

.gform_wrapper .gform_button:hover,
.gform_wrapper input[type="submit"]:hover {
    background: var(--button-bg-hover, var(--color-brand-accent-hover)) !important;
    border-color: var(--color-brand-accent-hover) !important;
    color: var(--button-color-hover, #fff) !important;
}

.gform_wrapper input::placeholder,
.gform_wrapper textarea::placeholder {
    color: var(--color-text-primary);
    opacity: 0.6;
}

/* ── Dialog Component ────────────────────────────────────────
   Native <dialog> element styling for modals, drawers, and sheets.
   Uses CSS-only approach with minimal JS for open/close.
   ──────────────────────────────────────────────────────────── */
.lcms-dialog {
    padding: 0;
    border: none;
    background: transparent;
    max-width: 100vw;
    max-height: 100vh;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.lcms-dialog::backdrop {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.lcms-dialog__backdrop {
    position: fixed;
    inset: 0;
    cursor: pointer;
}

.lcms-dialog__backdrop button {
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    cursor: pointer;
}

.lcms-dialog__box {
    background: var(--color-bg-primary, #fff);
    color: var(--color-text-primary, #101010);
    text-align: left;
    overflow-y: auto;
    position: relative;
    z-index: 1;
}

.lcms-dialog__close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--color-text-secondary, #666);
    cursor: pointer;
    padding: 0.25rem;
    transition: color var(--transition-fast);
    z-index: 10;
}

.lcms-dialog__close:hover {
    color: var(--color-text-primary, #101010);
}

.lcms-dialog__title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
    padding-right: 2rem;
}

.lcms-dialog__content {
    font-size: 1rem;
    line-height: 1.6;
}

.lcms-dialog__content p {
    margin-bottom: 1rem;
}

.lcms-dialog__content p:last-child {
    margin-bottom: 0;
}

/* Modal variant — centered overlay */
.lcms-dialog--modal[open] {
    display: grid;
    place-items: center;
    padding: 1rem;
}

.lcms-dialog--modal .lcms-dialog__box {
    max-width: 42rem;
    max-height: 80vh;
    width: 100%;
    border-radius: var(--border-radius-lg, 16px);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    animation: lcms-modal-pop 0.2s ease-out;
}

/* Drawer variant — slides from right */
.lcms-dialog--drawer[open] {
    display: flex;
    justify-content: flex-end;
}

.lcms-dialog--drawer .lcms-dialog__box {
    height: 100vh;
    width: 100%;
    max-width: 28rem;
    padding: 1.5rem;
    animation: lcms-drawer-slide-in 0.3s ease-out;
}

/* Sheet variant — slides from bottom */
.lcms-dialog--sheet[open] {
    display: flex;
    align-items: flex-end;
}

.lcms-dialog--sheet .lcms-dialog__box {
    width: 100%;
    max-height: 80vh;
    border-radius: var(--border-radius-lg, 16px) var(--border-radius-lg, 16px) 0 0;
    padding: 1.5rem;
    animation: lcms-sheet-slide-up 0.3s ease-out;
}

/* Animations */
@keyframes lcms-modal-pop {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes lcms-drawer-slide-in {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

@keyframes lcms-sheet-slide-up {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

/* ─────────────────────────────────────────────────────────────
   Scrim — generic image overlay component.

   Composable via two class modifiers:
     .lcms-scrim--color-{dark|branded|none}
     .lcms-scrim--direction-{content-side|diagonal}
   And a .lcms-scrim--right modifier that flips the gradient
   horizontally for right-aligned content blocks.

   `--scrim-rgb` is set per color modifier; the direction selectors
   consume it in their gradient. Opacities (--scrim-opacity-near,
   --scrim-opacity-far) come from brand-config or sensible defaults.
   ─────────────────────────────────────────────────────────────── */

.lcms-scrim {
    --scrim-rgb: 0, 0, 0;
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    mix-blend-mode: var(--scrim-blend-mode, normal);
}

.lcms-scrim--color-dark {
    --scrim-rgb: 0, 0, 0;
}

.lcms-scrim--color-branded {
    --scrim-rgb: var(--color-brand-primary-rgb);
}

.lcms-scrim--color-none {
    display: none;
}

/* Blend-mode modifiers — override the brand-config default per-block.
   `mix-blend-mode` requires an isolated stacking context on the parent
   to prevent bleed; image-backed block templates that use scrim should
   set `isolation: isolate` on their tile container. */
.lcms-scrim--blend-normal       { --scrim-blend-mode: normal; }
.lcms-scrim--blend-multiply     { --scrim-blend-mode: multiply; }
.lcms-scrim--blend-screen       { --scrim-blend-mode: screen; }
.lcms-scrim--blend-overlay      { --scrim-blend-mode: overlay; }
.lcms-scrim--blend-soft-light   { --scrim-blend-mode: soft-light; }

/* Content-side: horizontal sweep. Default direction is from left
   (content side); `--right` modifier mirrors it. */
.lcms-scrim--direction-content-side {
    background: linear-gradient(
        to right,
        rgba(var(--scrim-rgb), var(--scrim-opacity-near)) 0%,
        rgba(var(--scrim-rgb), var(--scrim-opacity-near)) 35%,
        rgba(var(--scrim-rgb), var(--scrim-opacity-far)) 100%
    );
}

.lcms-scrim--direction-content-side.lcms-scrim--right {
    background: linear-gradient(
        to left,
        rgba(var(--scrim-rgb), var(--scrim-opacity-near)) 0%,
        rgba(var(--scrim-rgb), var(--scrim-opacity-near)) 35%,
        rgba(var(--scrim-rgb), var(--scrim-opacity-far)) 100%
    );
}

/* Diagonal: anchored at the content side's top corner. 135deg from
   top-left (left-aligned), 225deg (mirrored) for right-aligned. */
.lcms-scrim--direction-diagonal {
    background: linear-gradient(
        135deg,
        rgba(var(--scrim-rgb), var(--scrim-opacity-near)) 18%,
        rgba(var(--scrim-rgb), var(--scrim-opacity-far)) 40%
    );
}

.lcms-scrim--direction-diagonal.lcms-scrim--right {
    background: linear-gradient(
        225deg,
        rgba(var(--scrim-rgb), var(--scrim-opacity-near)) 18%,
        rgba(var(--scrim-rgb), var(--scrim-opacity-far)) 40%
    );
}

/* ── Section background utilities ────────────────────────────
   Driven by `background` field in base-schema. Templates apply
   one of these via `lcms_background_classes($data)` to opt into
   a contrasting section panel. Each tone has an "alt" sibling
   for visual rhythm when stacking same-tone blocks (zebra-style
   layouts without leaving the palette). Descendant rules below
   handle heading + prose inversion so blocks don't have to
   repeat the logic per template. Custom utility classes via
   `section_class` still take precedence (rule ordering /
   specificity).

   The `none` value emits no class — the section stays transparent
   so the parent (body / wrapper) shows through.
   ──────────────────────────────────────────────────────────── */
:root {
    /* Alt tones — defaults are subtle (~5–8%) variances from the
       base tones. Brand-config can override any of these to dial
       in site-specific palettes. `light` is the brand-tinted soft
       tone; `neutral` is pure gray (no brand tint), useful when
       the design wants a clean canvas independent of brand. */
    --color-bg-light-alt: #ebebeb;
    --color-bg-neutral: #f9f9f9;
    --color-bg-neutral-alt: #f0f0f0;
    --color-bg-brand-alt: var(--color-brand-primary-hover);

    /* Zebra-stripe tones for `background: auto` sections. A is
       transparent so the page background shows through (the "off"
       stripe); B is the light tint (the "on" stripe). Brand-config
       (colors.background.zebra_a / zebra_b) can set either to any
       tone for a custom alternation. */
    --color-bg-zebra-a: transparent;
    --color-bg-zebra-b: var(--color-bg-secondary, #f5f5f5);

    /* Panel edge-shape cut depths (section edge_top/edge_bottom). How far
       the clip-path cut reaches into the panel. Keep ≤ the section's
       boundary padding so content near the cut corners isn't clipped. */
    --lcms-edge-depth-small:  2rem;
    --lcms-edge-depth-medium: 3rem;
    --lcms-edge-depth-large:  5rem;
}

/* ── Page flow container ─────────────────────────────────────
   Spacing Rhythm v2 (S0). A single flex column wrapping a page's block
   stream (render-layout.php). Vertical-only — NO horizontal padding, so
   full-bleed / breakout blocks still reach the viewport edges. Between-
   block rhythm is the container's `gap`, defaulting to 0 so an un-opted
   page lays out exactly as before; a page opts in by emitting an inline
   `--lcms-page-gap` (and optional page padding) via the resolver
   (lcms_resolve_flow_spacing). The defaults live here in the cascade so
   theme/template CSS (S3) can override them per template without touching
   PHP, and a page-level inline override still wins by specificity. */
.lcms-page-flow {
    --lcms-page-gap: 0px;
    --lcms-page-pad-top: 0px;
    --lcms-page-pad-bottom: 0px;
    /* Page-level defaults for SECTION (cluster) rhythm. Defined here — the
       guaranteed ancestor of every .lcms-cluster — so they inherit into all
       sections. A page can override them (inner gap / section padding) by
       emitting these vars inline on .lcms-page-flow (lcms_resolve_flow_spacing
       / _flow), and an individual section overrides locally (inline on its own
       .lcms-cluster, which wins because it's the closer ancestor). */
    --lcms-cluster-gap: var(--block-spacing-minimal);
    --lcms-cluster-boundary: var(--block-spacing-default);
    --lcms-cluster-pad-top: var(--lcms-cluster-boundary);
    --lcms-cluster-pad-bottom: var(--lcms-cluster-boundary);
    display: flex;
    flex-direction: column;
    gap: var(--lcms-page-gap);
    padding-block: var(--lcms-page-pad-top) var(--lcms-page-pad-bottom);
    /* Shared counter for .lcms-numbered-heading (content block's
       "Number this heading" toggle) — reset once per page here so every
       numbered heading counts up in one sequence across however many
       separate blocks use it, regardless of block type or position. */
    counter-reset: lcms-heading-num;
}

/* Auto-numbered content headings (content block's number_headings field).
   Prefer this over typing "Step 1: …" into the heading text — a typed
   number drifts the moment a step is reordered, inserted, or deleted,
   since nothing re-numbers the siblings around it; the counter always
   reflects the heading's actual position in the page-flow. */
.lcms-numbered-heading {
    counter-increment: lcms-heading-num;
}
.lcms-numbered-heading::before {
    content: counter(lcms-heading-num) ". ";
    color: var(--color-brand-primary);
}

/* Content measure — applied by a block whose width is set to "Auto
   (follow page/section)". Consumes the cascaded --lcms-content-width
   (page emits on .lcms-page-flow, a section overrides on its .lcms-cluster).
   When no page/section measure is set the var is undefined and the block
   falls back to the site content width. */
.lcms-measure {
    max-width: var(--lcms-content-width, var(--content-max-width, 75rem));
    margin-inline: auto;
}

/* Opt-out page-flow child (Spacing Rhythm v2, S0 full-bleed carve-out → S2
   end-to-end). A child that owns its spacing — or a full-bleed block that
   must sit flush — drops the page gap. Single-owner cancel, like the
   cluster: each such child cancels only the gap *above itself*, so two
   adjacent opt-out children never double-cancel the one shared gap. At the
   flow's outer edges it cancels the page padding instead (there is no gap
   before the first child / after the last). gap/padding-as-variables make
   these exact; zero-effect while --lcms-page-gap is 0. */
.lcms-page-flow > .lcms-flow-flush {
    margin-block-start: calc(-1 * var(--lcms-page-gap));
}
.lcms-page-flow > .lcms-flow-flush:first-child {
    margin-block-start: calc(-1 * var(--lcms-page-pad-top));
}
.lcms-page-flow > .lcms-flow-flush:last-child {
    margin-block-end: calc(-1 * var(--lcms-page-pad-bottom));
}

/* Page-section clusters (C22 Sub-item B). Render-time wrapper around a
   contiguous run of blocks sharing a cluster_id, carrying shared treatment
   (a .lcms-bg-* class and/or an inline background-image from the page's
   _clusters registry). position: relative anchors any background-image /
   overlay layering.

   Spacing Rhythm v2 (S1) revises the Phase-1 invariant that the wrapper
   "adds no spacing of its own": the cluster is now a flex column that owns
   the between-member rhythm via `gap` and the content inset via
   `padding-block`. Bare members render with zero intrinsic vertical
   spacing and lean on these; a member that owns its spacing (explicit
   value / own background panel) is wrapped in .lcms-cluster-flush, which
   cancels the gap/boundary on its edges so its spacing never doubles.
   Defaults (gap = minimal, boundary = default) live on .lcms-page-flow so a
   page can set them for every section at once; a section overrides them inline
   (per-cluster gap / padding). The fallbacks here keep a section sane even if
   it ever renders outside a page-flow. */
.lcms-cluster {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--lcms-cluster-gap, var(--block-spacing-minimal));
    padding-block: var(--lcms-cluster-pad-top, var(--block-spacing-default)) var(--lcms-cluster-pad-bottom, var(--block-spacing-default));
}

/* Opt-out cluster member. It owns its vertical spacing, so it drops the
   cluster's between-member gap: each such member cancels only the gap
   *above itself*, so two adjacent opt-out members never double-cancel the
   single shared gap. At the cluster's outer edges the member would instead
   double the boundary inset, so cancel that there. gap/boundary-as-
   variables are what make these cancels exact. */
.lcms-cluster > .lcms-cluster-flush {
    margin-block-start: calc(-1 * var(--lcms-cluster-gap, var(--block-spacing-minimal)));
}
.lcms-cluster > .lcms-cluster-flush:first-child {
    margin-block-start: calc(-1 * var(--lcms-cluster-pad-top, var(--block-spacing-default)));
}
.lcms-cluster > .lcms-cluster-flush:last-child {
    margin-block-end: calc(-1 * var(--lcms-cluster-pad-bottom, var(--block-spacing-default)));
}

/* Front-end section selection (Spacing Rhythm v2 editor UX, E2b). Marked
   only in edit mode under the interleaved flag. Hovering a section's own
   chrome outlines it (dashed) and shows its label; the :not(:has()) guard
   suppresses that while a member block is hovered, so a member-hover
   highlights only the member (and a member click selects the block — see
   drawer onBodyClick). The drawer marks the active section with
   data-lcms-cluster-selected (see syncOnPageSelection): that gets a
   persistent solid outline + label, and the hover is suppressed on it so the
   two states don't stack. All theme-aware via --color-brand-primary. */
.lcms-cluster--editable {
    position: relative;
    cursor: pointer;
}
.lcms-cluster--editable:hover:not(:has(.lcms-block-edit-wrap:hover)):not([data-lcms-cluster-selected="true"]) {
    outline: 2px dashed var(--color-brand-primary, #0066cc);
    outline-offset: -2px;
}
.lcms-cluster--editable[data-lcms-cluster-selected="true"] {
    outline: 2px solid var(--color-brand-primary, #0066cc);
    outline-offset: -2px;
}
.lcms-cluster--editable:hover:not(:has(.lcms-block-edit-wrap:hover)):not([data-lcms-cluster-selected="true"])::before,
.lcms-cluster--editable[data-lcms-cluster-selected="true"]::before {
    content: attr(data-lcms-cluster-label);
    position: absolute;
    top: 0;
    left: 0;
    z-index: 5;
    padding: 2px 8px;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.4;
    color: #fff;
    background: var(--color-brand-primary, #0066cc);
    pointer-events: none;
}

.lcms-bg-white {
    background: var(--color-bg-primary, #ffffff);
    color: var(--color-text-primary, #101010);
}

.lcms-bg-light {
    background: var(--color-bg-secondary, #f5f5f5);
    color: var(--color-text-primary, #101010);
}

.lcms-bg-light-alt {
    background: var(--color-bg-light-alt, #ebebeb);
    color: var(--color-text-primary, #101010);
}

.lcms-bg-neutral {
    background: var(--color-bg-neutral, #f9f9f9);
    color: var(--color-text-primary, #101010);
}

.lcms-bg-neutral-alt {
    background: var(--color-bg-neutral-alt, #f0f0f0);
    color: var(--color-text-primary, #101010);
}

/* Zebra stripes (section background: auto). Tone A is transparent by
   default (page background shows through) so it sets no text colour;
   tone B is the light tint with primary ink. A site that sets a dark
   zebra tone via brand-config would also need to handle inversion —
   v1 assumes light-on-light tones. */
.lcms-bg-zebra-a {
    background: var(--color-bg-zebra-a, transparent);
}

.lcms-bg-zebra-b {
    background: var(--color-bg-zebra-b, #f5f5f5);
    color: var(--color-text-primary, #101010);
}

/* Editor-only: the `auto` value never reaches a rendered section (the
   loop resolves it to zebra-a/-b), but the drawer's section swatch binds
   `lcms-bg-{value}`, so `.lcms-bg-auto` gives that swatch a striped fill
   that reads as "zebra" rather than a blank chip. */
.lcms-bg-auto {
    background: repeating-linear-gradient(
        45deg,
        var(--color-bg-zebra-b, #f5f5f5) 0 3px,
        var(--color-bg-zebra-a, #ffffff) 3px 6px
    );
}

.lcms-bg-dark {
    background: var(--color-bg-dark, #153f80);
    color: var(--color-text-light, rgba(255, 255, 255, 0.95));
}

.lcms-bg-dark-alt {
    background: var(--color-bg-dark-secondary, #112e60);
    color: var(--color-text-light, rgba(255, 255, 255, 0.95));
}

.lcms-bg-brand {
    background: var(--color-brand-primary, #6529AD);
    /* On-brand text token (not --color-text-light): a bright brand colour needs
       dark text, which only --color-text-on-brand expresses. Defaults to white
       so dark-brand sites are unaffected. */
    color: var(--color-text-on-brand, var(--color-text-light, rgba(255, 255, 255, 0.95)));
}

.lcms-bg-brand-alt {
    background: var(--color-bg-brand-alt, var(--color-brand-primary-hover, #732EC2));
    color: var(--color-text-on-brand, var(--color-text-light, rgba(255, 255, 255, 0.95)));
}

/* ── Relative card surface ───────────────────────────────────
   The stacked-surface problem: cards default to a light-grey
   lift (--color-bg-secondary). That reads well on a white
   section but vanishes when the section background is the same
   light-grey tone — e.g. .lcms-bg-light is also
   --color-bg-secondary, so a card on it disappears.

   The card surface steps relative to its section: on light-
   family sections the card moves up to white so it stays
   distinct from what it sits on. White sections already
   contrast the default card; dark and brand sections contrast
   it too (light card on a dark ground) — both left as-is.

   Specificity (0,2,0) wins over the base .lcms-card (0,1,0)
   without !important. Per-instance overrides via the block's
   section_class / section_style still win on top. ──────────── */
.lcms-bg-light .lcms-card,
.lcms-bg-light-alt .lcms-card,
.lcms-bg-neutral .lcms-card,
.lcms-bg-neutral-alt .lcms-card,
.lcms-bg-zebra-b .lcms-card {
    background: var(--color-bg-primary, #ffffff);
}

/* Heading inversion — pull from current colour so headings
   inherit the section colour rather than the global heading
   colour rule. :where() keeps specificity at zero so theme
   overrides win without !important. */
.lcms-bg-dark :where(h1, h2, h3, h4, h5, h6),
.lcms-bg-dark-alt :where(h1, h2, h3, h4, h5, h6),
.lcms-bg-brand :where(h1, h2, h3, h4, h5, h6),
.lcms-bg-brand-alt :where(h1, h2, h3, h4, h5, h6) {
    color: inherit;
}

/* Prose inversion — flip Tailwind prose colour variables when
   the surrounding section is dark/brand. Only applied when the
   markup actually opted into prose; bare paragraphs inherit via
   the section's `color` above. */
.lcms-bg-dark .prose,
.lcms-bg-dark-alt .prose,
.lcms-bg-brand .prose,
.lcms-bg-brand-alt .prose {
    --tw-prose-body: var(--color-text-light, rgba(255, 255, 255, 0.95));
    --tw-prose-headings: #ffffff;
    --tw-prose-lead: rgba(255, 255, 255, 0.9);
    --tw-prose-bold: #ffffff;
    --tw-prose-links: #ffffff;
    --tw-prose-quotes: #ffffff;
    --tw-prose-quote-borders: rgba(255, 255, 255, 0.4);
    --tw-prose-hr: rgba(255, 255, 255, 0.25);
    --tw-prose-captions: rgba(255, 255, 255, 0.75);
    --tw-prose-counters: rgba(255, 255, 255, 0.75);
    --tw-prose-bullets: rgba(255, 255, 255, 0.5);
    --tw-prose-code: #ffffff;
    --tw-prose-kbd: #ffffff;
    --tw-prose-th-borders: rgba(255, 255, 255, 0.3);
    --tw-prose-td-borders: rgba(255, 255, 255, 0.2);
}

/* Brand sections invert to the on-brand token (dark for bright brands),
   not the on-dark light token the dark sections use. */
.lcms-bg-brand .prose,
.lcms-bg-brand-alt .prose {
    --tw-prose-body: var(--color-text-on-brand, var(--color-text-light, rgba(255, 255, 255, 0.95)));
    --tw-prose-headings: var(--color-text-on-brand, #ffffff);
    --tw-prose-lead: var(--color-text-on-brand, rgba(255, 255, 255, 0.9));
    --tw-prose-bold: var(--color-text-on-brand, #ffffff);
    --tw-prose-links: var(--color-text-on-brand, #ffffff);
    --tw-prose-code: var(--color-text-on-brand, #ffffff);
    --tw-prose-kbd: var(--color-text-on-brand, #ffffff);
}

/* ── Module-internal spacing tokens ──────────────────────────
   Centralises the rhythm-critical spacing inside a block —
   section-header bottom, heading bottom, lead bottom, content
   bottom, actions top. Defaults match the values templates were
   already using so the baseline visual is unchanged. Brand-
   config can override any of these via `spacing.module.*`.

   Smaller intra-component spacing (e.g. mb-2 between a stat
   value and label, mb-1 inside a card date) stays as Tailwind
   utilities — those are component-level details, not rhythm.
   ──────────────────────────────────────────────────────────── */
:root {
    --lcms-gap-section-header-end: 3rem;   /* mb-12 — section header → first content element */
    --lcms-gap-heading-end:        1rem;   /* mb-4  — inline heading (heading1/heading2) → body */
    --lcms-gap-lead-end:           1.5rem; /* mb-6  — lead paragraph → body */
    --lcms-gap-content-end:        1rem;   /* mb-4  — between content units (image → text, etc) */
    --lcms-gap-actions-start:      1.5rem; /* mt-6  — content → button-group / archive link */
}

.lcms-mb-section-header { margin-bottom: var(--lcms-gap-section-header-end); }
.lcms-mb-heading        { margin-bottom: var(--lcms-gap-heading-end); }
.lcms-mb-lead           { margin-bottom: var(--lcms-gap-lead-end); }
.lcms-mb-content        { margin-bottom: var(--lcms-gap-content-end); }
.lcms-mt-actions        { margin-top:    var(--lcms-gap-actions-start); }

/* ── Typographic-rhythm scale ────────────────────────────────
   A finer scale than the coarse --block-spacing-* rungs (which
   govern between-block / between-section gaps). Page-level
   typographic-rhythm controls (Page_Flow RHYTHM_FIELDS) resolve
   their chosen rung against this scale and re-emit a module gap
   var (e.g. --lcms-gap-heading-end) on .lcms-page-flow, so a page
   can tune heading / section-header spacing in-flow. The rung
   *vocabulary* is shared with block spacing (none…extra-spacious);
   only the rem values differ — these are sub-block-scale, sized
   for spacing *within* a block, not *between* blocks. */
:root {
    --lcms-rhythm-none:           0;
    --lcms-rhythm-minimal:        0.5rem;
    --lcms-rhythm-compact:        0.75rem;
    --lcms-rhythm-default:        1.5rem;
    --lcms-rhythm-neutral:        1.5rem;
    --lcms-rhythm-spacious:       2.5rem;
    --lcms-rhythm-extra-spacious: 3.5rem;
}

/* ── Section anchor scroll target ────────────────────────────
   Every block wrapper that resolves an anchor (manual or auto-
   derived from heading) gets the id on .lcms-anim-on-scroll.
   --lcms-scroll-margin-top adds breathing room when the page
   scrolls to the anchor so a sticky header / brand chrome
   doesn't cover the section start. Tune per-site via brand-
   config (`layout.scroll_margin_top`) when sticky chrome is
   taller (or smaller) than the default.
   ──────────────────────────────────────────────────────────── */
.lcms-anim-on-scroll[id] {
    scroll-margin-top: var(--lcms-scroll-margin-top, 5rem);
}

/* ── Table of Contents ───────────────────────────────────────
   Flat semantic list with level-based indentation via padding.
   `style: flat` removes list markers entirely; bullet/numbered
   inherit the standard list-style. Items render at h2 level by
   default; h3 and h4 receive progressive left-padding so the
   outline reads as a hierarchy without nested <ul> markup.
   ──────────────────────────────────────────────────────────── */
.block-toc__list {
    margin: 0;
    padding-left: 1.25rem;
    list-style-position: outside;
}

.block-toc__list--flat {
    list-style: none;
    padding-left: 0;
}

.block-toc__item {
    margin: 0.25rem 0;
    line-height: 1.5;
}

.block-toc__item--h3 {
    padding-left: 1.25rem;
    font-size: 0.95em;
    opacity: 0.9;
}

.block-toc__item--h4 {
    padding-left: 2.5rem;
    font-size: 0.9em;
    opacity: 0.8;
}

.block-toc__link {
    color: inherit;
    text-decoration: none;
}

.block-toc__link:hover,
.block-toc__link:focus {
    color: var(--color-text-link-hover, var(--color-brand-primary));
    text-decoration: underline;
}

/* ── LCMS Tables ─────────────────────────────────────────────
   Canonical default styling for any LCMS-rendered table. Today
   stamped by Tiptap (`HTMLAttributes: { class: 'lcms-table
   not-prose' }`); future LCMS table renderers (CSV-paste block,
   manual HTML wrapped in the class, etc.) get the same baseline
   look for free.

   Aesthetic: the modern "data table" pattern shared by Stripe,
   GitHub, Linear, Notion, Material Design — horizontal row
   separators only (no vertical cell borders), subtle header tint
   via brand-config tokens, consistent padding. Reads cleanly,
   doesn't fragment the eye's left-to-right scan across a row.

   Customisation lives at TWO layers — pick whichever is right
   for the change you're making:

   1) Brand-config / system tokens (affects every consumer
      across the site — buttons, cards, drawers, tables…):

          colors.borders.divider     → --color-border
          colors.background.secondary → --color-bg-secondary

   2) Per-table override in theme.css (only affects this block):

          .lcms-table thead th { background: var(--color-brand-primary); color: #fff; }
          .lcms-table tbody tr:nth-child(even) td { background: var(--color-surface-muted); }
          .lcms-table tbody tr:hover td { background: var(--color-surface-muted); }
          .lcms-table tbody tr { border-bottom-color: var(--color-text-muted); }   (heavier hairline)

   Per-component CSS variables (`--lcms-table-...`) deliberately
   avoided — the global semantic tokens are the API. See discussion
   2026-05-26.

   `.not-prose` (added alongside `.lcms-table` by Tiptap) opts the
   table out of Tailwind Typography's prose defaults, which strip
   first-/last-cell padding and apply prose-style header treatment
   that fights our look.
   ──────────────────────────────────────────────────────────── */
/* The horizontal-scroll container used to live directly on the <table>
   (display:block; overflow-x:auto;) so no wrapper was needed — but a
   <table> with display overridden away from `table` never gets a real
   CSS-table layout box: the browser's "fixup" algorithm still generates
   an anonymous inner table to hold thead/tbody/tr/td correctly, and THAT
   anonymous box always sizes itself by content (shrink-to-fit),
   completely ignoring the outer width:100%. A short/narrow table (e.g. a
   2-column dates list) never stretched to fill its container — only wide
   tables that needed to scroll rendered correctly.

   Fix: the scroll container now lives on `.lcms-table-scroll`, a wrapper
   div inserted at render time around every `.lcms-table` /
   `.lcms-tiptap-table` (see lcms_wrap_content_tables() in
   includes/render-helpers.php — applies retroactively to existing
   content, Tiptap-authored or manual HTML, no re-authoring needed). The
   <table> itself keeps its native, unoverridden `display: table`, so the
   browser's real auto-table-layout algorithm runs and correctly stretches
   to 100% (distributing the extra width across columns) when content is
   narrower than the container, while the wrapper still scrolls when
   content is wider. table-layout is still left at its default `auto` —
   auto-sizing-by-content is the right pairing with a scroll container
   (a long Notes column gets more room instead of every column being
   forced equal-ish width). */
.lcms-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.lcms-table,
.lcms-tiptap-table {
    border-collapse: collapse;
    width: 100%;
    margin: 0;
}

.lcms-table th,
.lcms-table td,
.lcms-tiptap-table th,
.lcms-tiptap-table td {
    padding: 0.5rem 0.75rem;
    vertical-align: top;
    text-align: left;
    position: relative;
}

/* Horizontal row separators only — no vertical cell borders.
   Consumes `--color-border` (the system divider token) rather
   than a background token, so the line is reliably visible on
   bright / low-contrast monitors. Sites tune via brand-config
   `colors.borders.divider` or the override pattern above. */
.lcms-table tbody tr,
.lcms-tiptap-table tbody tr {
    border-bottom: 1px solid var(--color-border, #e5e7eb);
}

/* Last row in the body has no trailing separator — keeps the
   table edge clean, no floating line below the final row. */
.lcms-table tbody tr:last-child,
.lcms-tiptap-table tbody tr:last-child {
    border-bottom: 0;
}

.lcms-table thead th,
.lcms-table th,
.lcms-tiptap-table thead th,
.lcms-tiptap-table th {
    background: var(--color-bg-secondary, #f5f5f5);
    font-weight: 600;
}

/* Strip trailing margin on the last child of each cell.
   Single-paragraph cells lose awkward bottom space; multi-
   paragraph cells keep spacing between paragraphs. Universal
   "no trailing margin in a constrained container" pattern —
   covers <p>, lists, blockquotes, anything with bottom-margin
   defaults. */
.lcms-table th > :last-child,
.lcms-table td > :last-child,
.lcms-tiptap-table th > :last-child,
.lcms-tiptap-table td > :last-child {
    margin-bottom: 0;
}

/* ── Syntax-highlighted code blocks ──────────────────────────
   Canonical styling for CodeBlockLowlight's output (the drawer's
   Tiptap richtext editor's "Code block" toolbar button). Highlighting
   itself runs client-side at edit time — lowlight annotates each token
   with an `hljs-*` span and Tiptap serializes that straight into the
   stored HTML, so no highlight.js/lowlight runtime is needed here on
   the front end, just this colour theme, shared by editor + published
   output (same "canonical styles live in lcms-core.css, loaded
   everywhere the rendered content lands" pattern as `.lcms-table`
   above).

   `not-prose` (added alongside the `hljs` class by Tiptap) opts the
   block out of Tailwind Typography's own opinionated pre/code
   styling, same escape-hatch this codebase already uses for tables.

   Palette: a fixed dark theme regardless of site brand — code blocks
   read better on a dedicated dark background at any brand palette,
   the same reasoning most docs sites (GitHub, Stripe, MDN) apply; not
   wired to brand-config tokens the way headings/buttons/etc. are. */
pre code.hljs {
    display: block;
    overflow-x: auto;
    /* Explicit, not inherited — the ProseMirror editor baseline sets
       `pre { white-space: pre-wrap }` globally (wraps long lines
       instead of scrolling), which would otherwise cascade down to
       this code element too. Code should scroll horizontally, not
       reflow. */
    white-space: pre;
    padding: 1rem 1.25rem;
    border-radius: var(--border-radius, 0.5rem);
    background: #1e1e2e;
    color: #cdd6f4;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    tab-size: 2;
}

.hljs-comment,
.hljs-quote {
    color: #6c7086;
    font-style: italic;
}

.hljs-keyword,
.hljs-selector-tag,
.hljs-literal,
.hljs-doctag {
    color: #cba6f7;
}

.hljs-string,
.hljs-attr,
.hljs-regexp,
.hljs-addition {
    color: #a6e3a1;
}

.hljs-number,
.hljs-symbol,
.hljs-bullet {
    color: #fab387;
}

.hljs-title,
.hljs-name,
.hljs-section,
.hljs-selector-id {
    color: #89b4fa;
}

.hljs-type,
.hljs-class .hljs-title {
    color: #f9e2af;
}

.hljs-variable,
.hljs-template-variable,
.hljs-deletion {
    color: #f38ba8;
}

.hljs-tag,
.hljs-attribute,
.hljs-built_in,
.hljs-builtin-name {
    color: #94e2d5;
}

.hljs-emphasis {
    font-style: italic;
}

.hljs-strong {
    font-weight: 700;
}

/* ── Compositor mode (C15) ───────────────────────────────────
   `mode: compositor` renders the block stream INTO the_content via
   render-compositor.php, so #lcms-content sits inside the theme's content
   column (vs layout mode, which owns the viewport). Blocks fill the column;
   full-bleed blocks fill the column too (no viewport breakout here — that's
   layout mode's domain). The wrapper is a passive flow container — the theme
   owns width/chrome. */
.lcms-compositor {
    width: 100%;
}
/* In a constrained column, never let a block's content measure exceed it. */
.lcms-compositor .lcms-measure {
    max-width: 100%;
}

/* ── Section menu (C15 — lcms_section_menu) ───────────────────
   The plugin renders the section sub-nav; the theme owns the sidebar
   container that calls it. Base, unopinionated styling only — themes
   restyle freely. */
.lcms-section-menu__list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.lcms-section-menu__list li {
    margin: 0;
}
.lcms-section-menu__list a {
    display: block;
    padding: 0.4rem 0;
    text-decoration: none;
}
.lcms-section-menu__list .current_page_item > a,
.lcms-section-menu__list a[aria-current="page"] {
    font-weight: 600;
}
/* Child items — basic indent affordance for nested levels. Covers both the
   assigned-menu path (wp_nav_menu → .sub-menu) and the page-hierarchy fallback
   (wp_list_pages → .children). Per-level, so deeper nesting steps in further.
   Placeholder spacing; richer styling comes later. */
.lcms-section-menu__list .sub-menu,
.lcms-section-menu__list .children {
    list-style: none;
    margin: 0;
    padding-left: 1rem;
}

/* ── Blog Options chrome (C15 Slice 2 — theme single.php) ─────
   Article-single furniture rendered around the_content: follow links,
   categories/tags, prev-next, share. Unopinionated base only — the theme
   restyles freely (markup + styling are theme territory; this just keeps the
   chrome tidy out of the box). */
.lcms-blog-options {
    max-width: var(--lcms-content-width, var(--content-max-width, 75rem));
    margin: 3rem auto 0;
    padding-top: 2rem;
    border-top: 1px solid var(--color-border, rgba(0, 0, 0, 0.1));
    display: flex;
    flex-direction: column;
    gap: 2rem;
}
.lcms-blog-options__heading {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.75rem;
}
/* Link rows — follow + share */
.lcms-social-links,
.lcms-share-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
}
.lcms-social-links a,
.lcms-share-links a {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.85rem;
    border: 1px solid var(--color-border, rgba(0, 0, 0, 0.15));
    border-radius: var(--lcms-radius, 0.375rem);
    text-decoration: none;
    font-size: 0.9rem;
    line-height: 1.2;
    transition: border-color var(--transition-standard, 0.2s ease),
                background-color var(--transition-standard, 0.2s ease),
                color var(--transition-standard, 0.2s ease);
}
.lcms-social-links a:hover,
.lcms-share-links a:hover {
    border-color: var(--color-brand-primary, currentColor);
    background-color: var(--color-bg-secondary, rgba(0, 0, 0, 0.03));
    color: var(--color-brand-primary);
}
/* Inline share-network icon. Centre it as a flex box AND size it relative to
   the label (em) so it pairs with the text rather than sitting proud of it;
   line-height:0 + display:block strip the baseline/line gap that pushes a
   fixed-px SVG visually high next to the text. */
.lcms-share-links__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    line-height: 0;
}
.lcms-share-links__icon svg {
    display: block;
    width: 1.1em;
    height: 1.1em;
}
/* Category / tag lists — inline, comma-free chips */
.lcms-term-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.6rem;
    margin: 0 0 0.5rem;
}
.lcms-term-list a {
    font-size: 0.85rem;
    text-decoration: none;
    opacity: 0.85;
}
.lcms-term-list a:hover { opacity: 1; }
/* Prev / next — paired cards (prev anchored left, next right; stacks on mobile). */
.lcms-blog-options__nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.lcms-blog-options__nav a {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 1rem 1.25rem;
    border: 1px solid var(--color-border, var(--color-bg-secondary));
    border-radius: var(--border-radius, 8px);
    background: var(--color-surface, var(--color-bg-primary, #ffffff));
    color: var(--color-text-primary);
    text-decoration: none;
    transition: border-color var(--transition-standard, 0.2s ease),
                box-shadow var(--transition-standard, 0.2s ease),
                transform var(--transition-standard, 0.2s ease);
}
.lcms-blog-options__nav a:hover {
    border-color: var(--color-brand-primary);
    box-shadow: var(--shadow-cards, 0 4px 14px rgba(0, 0, 0, 0.08));
    transform: translateY(-1px);
}
.lcms-blog-options__nav .nav-previous { grid-column: 1; }
.lcms-blog-options__nav .nav-next { grid-column: 2; text-align: right; }
.lcms-blog-options__nav .meta-nav {
    display: block;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-secondary);
}
.lcms-blog-options__nav .nav-previous .meta-nav::before { content: "\2190\00a0"; } /* ← */
.lcms-blog-options__nav .nav-next .meta-nav::after { content: "\00a0\2192"; }     /* → */
.lcms-blog-options__nav .post-title { font-weight: 600; }
@media (max-width: 640px) {
    .lcms-blog-options__nav { grid-template-columns: 1fr; }
    .lcms-blog-options__nav .nav-previous,
    .lcms-blog-options__nav .nav-next { grid-column: 1; text-align: left; }
    .lcms-blog-options__nav .nav-next .meta-nav::after { content: none; }
    .lcms-blog-options__nav .nav-next .meta-nav::before { content: "\2192\00a0"; } /* → on mobile (left-aligned) */
}

/* ── Prose / typeset article body (C15 Slice 2 — S2-a) ───────
   The article template (single.php) adds `lcms-prose` to the content wrapper
   so a compositor-rendered article body sits at a reading measure and reads as
   tight typeset prose — independent of how wide the theme's content column is.
   Section compositor pages (page-with-sidebar) deliberately don't get this. */
.lcms-prose .lcms-compositor,
.lcms-prose > .prose {
    max-width: var(--lcms-prose-measure, 44rem);
    margin-inline: auto;
}

/* ── Prose heading rhythm ────────────────────────────────────
   Tailwind Typography only styles h1–h4 and zeroes the top margin of whatever
   directly follows a heading (`h2/h3/h4 + *`) — great for heading→text, but it
   (a) bunches consecutive headings and (b) leaves h5/h6 with no margins at all.
   These two rules fix both. `:is()` keeps specificity above the plugin's
   `:where()`-based rules (so source order doesn't matter); margins are em so
   they track each heading's font-size (base prose or prose-lg alike). */

/* (a) A heading directly after another heading — restore separation that the
   `… + *` rule zeroes (h2 keeps its native 2em since there's no `h1 + *`). */
.prose :is(h2, h3, h4, h5, h6) + :is(h2, h3, h4, h5, h6) {
    margin-top: 1.5em;
}

/* (b) h5 / h6 — unstyled by prose; give them the scale's rhythm (also
   out-specifies the `h4 + *` zeroing when an h5 follows an h4). */
.prose :is(h5, h6) {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}

/* (c) Restate prose's first/last-child margin reset for h5/h6 — rules (a)+(b)
   out-specify Tailwind's `:where()`-based reset (spec 0,1,0), so an h5/h6 at the
   very top/bottom of a prose block would otherwise leak its margin into the
   block/section padding. Higher specificity (0,2,1) wins. */
.prose > :is(h5, h6):first-child {
    margin-top: 0;
}

.prose > :is(h5, h6):last-child {
    margin-bottom: 0;
}

