/* GPL Canvas — Suprevo integration layer ===================================================
 * How this theme renders the ENGINE's sections. Everything Suprevo-specific lives here:
 *   - the transparent .sv-section wrapper's relationship to GPL's block-* markup,
 *   - the client-pickable background presets  (functions.php → suprevo_bg_presets),
 *   - the per-item card tones                 (functions.php → suprevo_tone_palette).
 * Page-level design tweaks live in gpl-extra.css; the ported GPL design lives in main.css.
 * Loaded on the front end AND in the editor preview (via suprevo_editor_preview_styles),
 * so what a client picks in the editor is what they get live.
 * ========================================================================================= */

/* --- Per-item card tones ("Ons aanbod" coloured tiles) -------------------------------------
 * The engine stamps sv-tone--{slug} on each .card (Suprevo_Renderer::tone); the client picks a
 * tone per card from GPL's palette (curated — never a free colour picker). A toned tile drops
 * the white card shadow so the colour reads as the surface; text stays dark for contrast. */
.card.sv-tone { box-shadow: none; --tw-ring-color: transparent; }
.card.sv-tone--mint  { background-color: #dcefe4; }  /* Mint  — soft green */
.card.sv-tone--lucht { background-color: #dbeaf2; }  /* Lucht — soft blue  */
.card.sv-tone--zand  { background-color: #f4ead7; }  /* Zand  — warm sand  */
.card.sv-tone--roze  { background-color: #f6e2e4; }  /* Roze  — soft rose  */
.card.sv-tone .card__body,
.card.sv-tone .card__title { color: #2c3940; }

/* --- Section background presets (client picks; agency authors) -----------------------------
 * The engine stamps sv-bg-{slug} on the section wrapper. Each section applies the scheme the
 * way its structure wants: full-bleed sections (Features) colour the whole wrapper, while the
 * CTA recolours its designed slate PANEL (.block-cta__inner) — so the card changes, not the
 * page around it. 'default' (Standaard) keeps GPL's normal look. Text contrast is designed
 * into every preset, so a client picking one can never produce an unreadable section. */

/* Full-bleed sections (Features & other transparent blocks): colour the wrapper. CTA is
   excluded here (handled below); 'default' is left as GPL's normal look. */
.sv-section:not(.sv-bg-default):not(.sv-section--cta) .block-cards.bg-cream { background-color: transparent; }
.sv-bg-cream:not(.sv-section--cta) { background-color: #eeece2; color: #232d33; }
.sv-bg-white:not(.sv-section--cta) { background-color: #ffffff; color: #232d33; }
.sv-bg-slate:not(.sv-section--cta) { background-color: #3c4d57; color: #ffffff; }
.sv-bg-dark:not(.sv-section--cta)  { background-color: #232d33; color: #eef2ff; }
.sv-bg-gold:not(.sv-section--cta)  { background-color: #ecbe41; color: #3a2f10; }
.sv-section:not(.sv-bg-default):not(.sv-section--cta) .block-cards__header h2 { color: inherit; }
.sv-section:not(.sv-bg-default):not(.sv-section--cta) .block-cards__header p  { color: inherit; opacity: .85; }

/* Same treatment for EVERY other bespoke block: each hardcodes a background for its default
   look (accordion/faq → white, news/rich_text/gallery → cream, stats → slate). On any NON-default
   scheme, drop that background so the section scheme shows, and let the section-level text inherit
   the scheme's readable foreground. Raised surfaces (cards, stat boxes) keep their own bg by design. */
.sv-section:not(.sv-bg-default):not(.sv-section--cta) :is(
	.block-accordion, .block-news, .block-text, .block-text-image, .block-gallery, .block-contact-form, .block-stats
) { background-color: transparent; }

/* Hero & stats manage their OWN fixed-background panels (a slate/image band, a dark stats
   strip), so they must NOT follow the scheme's foreground here — otherwise a light scheme
   (white/cream/gold) turns their title dark-on-dark. They're excluded and handled below. */
.sv-section:not(.sv-bg-default):not(.sv-section--cta):not(.sv-section--hero):not(.sv-section--stats) :is(
	h1, h2, h3, h4, .prose-gpl,
	.block-accordion .accordion-trigger, .block-accordion .accordion-panel, .block-accordion .accordion-icon,
	.block-news__eyebrow, .block-news__all, .block-news__title, .block-news__intro,
	.block-gallery__eyebrow, .block-gallery__caption,
	.block-contact-form__intro
):not(:where(.card, .news-card, .tile, .sv-card) *) { color: inherit; }
/* ↑ raised cards excluded: this rule is (0,7,0) and used to beat the card-ink rule below (0,4,1),
   turning an UNLINKED card title white-on-white on the slate/dark schemes. */

/* Stats is a self-contained band (white metric cards + a coloured strip). Its section heading
   inherits the block's light `.text-slate-100`, which fails on a LIGHT scheme — force it dark
   there. The metric cards carry their own bg + colours, so they're unaffected. */
.sv-section--stats:is(.sv-bg-cream, .sv-bg-white, .sv-bg-gold) .block-stats { color: var(--gpl-slate-900); }
.sv-section--stats:is(.sv-bg-cream, .sv-bg-white, .sv-bg-gold) .block-stats :is(h1, h2, h3, h4) { color: var(--gpl-slate-900); }

/* Dark schemes: the muted greys used for intros/labels lose contrast on slate/dark — lift them.
   Section intros/leads use the `.text-slate-*` UTILITY classes (not a BEM class), so target those. */
.sv-section:is(.sv-bg-slate, .sv-bg-dark, .sv-bg-custom--dark):not(.sv-section--cta) :is(
	.text-slate-500, .text-slate-600, .text-slate-700, .text-slate-800,
	.block-accordion .accordion-panel, .block-gallery__caption, .prose-gpl
) { color: rgba(255, 255, 255, .82); }

/* ENGINE-rendered content (columns + other un-templated sections: `.sv-section__title`,
   `.sv-section__intro`, `.sv-prose` and everything in it) paints the engine's muted grey, which the
   list above never reached — on gold/coral it sat at ~3–3.9:1. On ANY coloured scheme let it take
   the scheme's own readable foreground; raised panels (cards/tiles) inside keep their own ink.
   Links inside inherit too: prose links are underlined, so they stay identifiable. */
.sv-section:not(.sv-bg-default):not(.sv-section--cta):not(.sv-section--hero):not(.sv-section--stats)
	:is(.sv-section__title, .sv-section__intro, .sv-prose, .sv-prose *):not(:where(.sv-card, .card, .tile, .news-card) *) { color: inherit; }

/* Client-picked CUSTOM tile colours: the engine tags them `sv-tone--light|dark` by luminance
   (Suprevo_Renderer::tone). Text on them follows that, not the theme's muted card grey (3.3:1 on a
   mid-tone custom tile). Repeated class = (0,6,0), beats the (0,5,0) scheme card-text rules above. */
.sv-section .sv-tone--custom.sv-tone--light.sv-tone--light.sv-tone--light :is(h1, h2, h3, h4, p, li, a, strong, .tile__text, .card__title,
	.text-slate-500, .text-slate-600, .text-slate-700, .text-slate-800) { color: var(--gpl-color-ink); }
.sv-section .sv-tone--custom.sv-tone--dark.sv-tone--dark.sv-tone--dark :is(h1, h2, h3, h4, p, li, a, strong, .tile__text, .card__title,
	.text-slate-500, .text-slate-600, .text-slate-700, .text-slate-800) { color: #fff; }

/* Prose emphasis + quotes hardcode a dark ink / muted grey (blocks.css), so on a dark scheme
   they'd disappear even though the surrounding prose was lifted above. Lift them too — a bold
   run that turns invisible ("...Tekst naast een afbeelding...") is the tell. */
.sv-section:is(.sv-bg-slate, .sv-bg-dark, .sv-bg-custom--dark):not(.sv-section--cta) .prose-gpl :where(strong) { color: #fff; }
.sv-section:is(.sv-bg-slate, .sv-bg-dark, .sv-bg-custom--dark):not(.sv-section--cta) .prose-gpl :where(blockquote) { color: rgba(255, 255, 255, .82); }

/* Raised surfaces (news/feature cards) are their OWN light panel — keep their text dark on any
   section scheme, so the flips above can't turn a card title/excerpt white-on-white. */
.sv-section:not(.sv-bg-default):not(.sv-section--cta) :is(.card, .news-card, .tile) :is(h1, h2, h3, h4) { color: var(--gpl-color-ink); }
.sv-section:not(.sv-bg-default):not(.sv-section--cta) :is(.card, .news-card) .news-card__title a { color: var(--gpl-color-ink); }
.sv-section:not(.sv-bg-default):not(.sv-section--cta) :is(.card, .news-card, .tile) :is(.news-card__excerpt, .tile__text, p, .text-slate-500, .text-slate-600) { color: var(--gpl-slate-600); }
.sv-section:not(.sv-bg-default):not(.sv-section--cta) :is(.card, .news-card) :is(.text-slate-700, .text-slate-800) { color: var(--gpl-color-primary); }
/* Tone tiles (mint/lucht/zand/roze) keep their own dark title colour from blocks.css. */
.sv-section:not(.sv-bg-default):not(.sv-section--cta) .tile.sv-tone :is(h1, h2, h3, h4) { color: #2c3940; }

/* CTA: recolour GPL's slate panel to the scheme (default & slate keep GPL slate). */
.sv-section--cta.sv-bg-cream .block-cta__inner { background-color: #eeece2; }
.sv-section--cta.sv-bg-white .block-cta__inner { background-color: #ffffff; box-shadow: inset 0 0 0 1px #e2ddd0; }
.sv-section--cta.sv-bg-dark  .block-cta__inner { background-color: #232d33; }
.sv-section--cta.sv-bg-gold  .block-cta__inner { background-color: #ecbe41; }
.sv-section--cta:is(.sv-bg-cream, .sv-bg-white, .sv-bg-gold) .block-cta__title { color: #232d33; }
.sv-section--cta:is(.sv-bg-cream, .sv-bg-white, .sv-bg-gold) .block-cta__text  { color: #3a3a3a; }
.sv-section--cta.sv-bg-gold .btn--accent { background-color: #232d33; color: #ffffff; }

/* --- Columns section wrapper --------------------------------------------------------------
 * The column GRID comes from the engine's structural sheet (`suprevo-sections-layout`) and the
 * block SKIN from the kept `suprevo-sections` content baseline. GPL only dequeues the WRAPPER,
 * so the fallback columns section (GPL has no columns.php override) needs its width + vertical
 * rhythm re-supplied here — SCOPED to .sv-section--columns so GPL's own full-bleed sections are
 * untouched. */
.sv-section--columns { padding-block: clamp(3rem, 6vw, 5rem); }
.sv-section--columns > .sv-container { width: 100%; max-width: var(--sv-container); margin-inline: auto; padding-inline: clamp(1.25rem, 4vw, 2.5rem); }

/* --------------------------------------------------------------------------
 * Baseline container for ENGINE-templated sections the theme doesn't override.
 * The theme dequeues `suprevo-sections-wrapper` (which carried .sv-container +
 * .sv-pad-*), and its own section templates supply their own container. Sections
 * still rendered by the engine's DEFAULT template (columns, banner, logo_wall,
 * collection, archive_loop, …) or by the generic field fallback would otherwise be
 * full-bleed with clipped text. Keyed on the engine's OWN markers rather than a
 * list of type slugs, so a new engine section type (archives were exactly that)
 * is covered the day it ships instead of rendering at the wrong width.
 * The engine's sections-layout.css sets the same rule at the `container` TOKEN
 * width (1180px); GPL's blocks are 80rem, so this re-states it to match them.
 * ------------------------------------------------------------------------ */
.sv-section--engine-tpl > .sv-container,
.sv-section--fallback   > .sv-container,
.sv-section--archive-head > .sv-container {
	width: 100%;
	max-width: 80rem;
	margin-inline: auto;
	padding-inline: clamp(1.25rem, 4vw, 2rem);
}
.sv-section--engine-tpl,
.sv-section--fallback,
.sv-section--archive-head { padding-block: clamp(3rem, 6vw, 5rem); }
/* The engine's derived archive header (only shown when the archive has no authored layout)
   sits directly on top of the loop — drop its bottom padding so the two read as one block
   instead of a 10rem seam. */
.sv-section--archive-head { padding-bottom: 0; }
.sv-section--engine-tpl.sv-pad-sm, .sv-section--fallback.sv-pad-sm { padding-block: clamp(2rem, 4vw, 3rem); }
.sv-section--engine-tpl.sv-pad-lg, .sv-section--fallback.sv-pad-lg { padding-block: clamp(4rem, 9vw, 7.5rem); }

/* --------------------------------------------------------------------------
 * Engine-default sections on DARK schemes (slate/dark). These render with
 * the engine's own `.sv-*` markup (no theme template), whose text classes carry
 * their own dark/muted colours from the kept `suprevo-sections` baseline. The
 * scheme sets the wrapper to `color:#fff`, but those explicit colours win — so
 * intros, column bodies, captions and card meta go dark-on-dark. Lift them.
 * ------------------------------------------------------------------------ */
.sv-section:is(.sv-bg-slate, .sv-bg-dark, .sv-bg-custom--dark):is(.sv-section--engine-tpl, .sv-section--fallback, .sv-section--archive-head) :is(
	.sv-section__title, .sv-block__title, .sv-collection__title, .sv-banner__title
) { color: #fff; }
.sv-section:is(.sv-bg-slate, .sv-bg-dark, .sv-bg-custom--dark):is(.sv-section--engine-tpl, .sv-section--fallback, .sv-section--archive-head) :is(
	.sv-section__intro, .sv-prose, .sv-card__body, .sv-collection__excerpt, .sv-collection__meta, .sv-banner__intro
) { color: rgba(255, 255, 255, .85); }

/* --- Banner action button ------------------------------------------------------------------
 * The engine banner emits `.sv-btn.sv-btn--invert` (a light pill meant for dark backgrounds),
 * which vanishes on the light schemes. Give it a scheme-aware, readable fill. */
.sv-section--banner .sv-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
	min-height: 44px; padding: .75rem 1.5rem; border-radius: 9999px; font-weight: 600; line-height: 1;
	transition: background-color .2s, color .2s;
}
.sv-section--banner:is(.sv-bg-default, .sv-bg-cream, .sv-bg-white, .sv-bg-gold) .sv-btn { background-color: var(--gpl-color-primary); color: #fff; }
.sv-section--banner:is(.sv-bg-default, .sv-bg-cream, .sv-bg-white, .sv-bg-gold) .sv-btn:hover { background-color: var(--gpl-slate-800); }
.sv-section--banner:is(.sv-bg-slate, .sv-bg-dark, .sv-bg-custom--dark) .sv-btn { background-color: #fff; color: var(--gpl-slate-900); }
.sv-section--banner:is(.sv-bg-slate, .sv-bg-dark, .sv-bg-custom--dark) .sv-btn:hover { background-color: var(--gpl-slate-100); }

/* --- Collection / archive results ----------------------------------------------------------
 * The CARDS are the theme's own `.news-card` (the engine's shared card partial is overridden in
 * suprevo/sections/collection/card.php), so only the ARRANGEMENT belongs here — same grid as
 * `.block-news__grid`, so the Nieuws archive reads as the home page's news band continued. */
.sv-collection--cards { display: grid; gap: 1.75rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .sv-collection--cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .sv-collection--cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* List variant: a stacked feed — the card turns side-on once there's room for it. */
.sv-collection--list { display: grid; gap: 1.5rem; }
@media (min-width: 700px) {
	.sv-collection--list .news-card { display: grid; grid-template-columns: minmax(0, 18rem) minmax(0, 1fr); align-items: stretch; }
	.sv-collection--list .news-card__media { height: 100%; aspect-ratio: auto; min-height: 12rem; }
	.sv-collection--list .news-card__date { left: auto; right: 1.25rem; }
}

/* Pagination — the engine renders paginate_links() markup on archives. Pills in the brand
   palette, matching the button family (44px min target for touch/a11y). */
.sv-pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .5rem; margin-top: clamp(2rem, 4vw, 3rem); }
.sv-pagination .page-numbers {
	display: inline-flex; align-items: center; justify-content: center;
	min-width: 2.75rem; height: 2.75rem; padding: 0 .85rem;
	border-radius: 9999px; background-color: #fff; color: var(--gpl-color-primary);
	font-weight: 600; line-height: 1; text-decoration: none;
	box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--gpl-color-primary) 22%, transparent);
	transition: background-color .2s, color .2s, box-shadow .2s;
}
.sv-pagination a.page-numbers:hover { background-color: var(--gpl-color-primary); color: #fff; }
.sv-pagination .page-numbers.current { background-color: var(--gpl-color-primary); color: #fff; box-shadow: none; }
.sv-pagination .page-numbers.dots { background: none; box-shadow: none; color: var(--gpl-slate-600); }

/* --------------------------------------------------------------------------
 * Spacing scale for THEME-templated sections. The theme dequeues the engine
 * wrapper (which carried `.sv-pad-*`) and its section templates apply a fixed
 * `.section` / `.block-*` rhythm — so sm/md/lg all rendered identically. Map the
 * token onto the inner wrapper so the three sizes actually differ. `md` = the
 * template default (untouched); only sm/lg override.
 * ------------------------------------------------------------------------ */
.sv-section.sv-pad-sm :is(.section, .block-news, .block-gallery) { padding-block: clamp(2rem, 4vw, 3rem); }
.sv-section.sv-pad-lg :is(.section, .block-news, .block-gallery) { padding-block: clamp(5rem, 9vw, 7.5rem); }
.sv-section--hero.sv-pad-sm :is(.block-hero--solid, .block-hero--overlay) .block-hero__inner { padding-top: 3rem; padding-bottom: 1.75rem; }
.sv-section--hero.sv-pad-lg :is(.block-hero--solid, .block-hero--overlay) .block-hero__inner { padding-top: 7rem; padding-bottom: 3.5rem; }

/* --- FREE COLOURS (engine per-site opt-in: `wp suprevo free-colors on`) ----------------------
 * A custom section background is painted by the engine (`.sv-section.sv-bg-custom` from
 * --sv-section-bg) and tagged light/dark; the dark variant joins the slate/dark text lifts above
 * (the `:is()` lists). Here: the CTA panel, and the section's button colour (`.sv-has-accent`,
 * --sv-accent / --sv-accent-fg — the text colour is computed by the engine, never picked). */
/* CTA: the section background (preset or custom) colours the PANEL — unless the client gave the
 * panel its own "Block colour" (.sv-has-panel, --sv-panel-bg/-fg from the engine): then the
 * background colours the area AROUND the panel and the panel takes the block colour. */
.sv-section--cta.sv-bg-custom:not(.sv-has-panel) { background-color: transparent; }
.sv-section--cta.sv-bg-custom:not(.sv-has-panel) .block-cta__inner { background-color: var(--sv-section-bg); }
.sv-section--cta.sv-bg-custom--light:not(.sv-has-panel) :is(.block-cta__title, .block-cta__text) { color: var(--gpl-color-ink); }
.sv-section--cta.sv-bg-custom--dark:not(.sv-has-panel) :is(.block-cta__title, .block-cta__text) { color: #fff; }
.sv-section.sv-section--cta.sv-has-panel .block-cta__inner { background-color: var(--sv-panel-bg); box-shadow: none; }
.sv-section.sv-section--cta.sv-has-panel :is(.block-cta__title, .block-cta__text) { color: var(--sv-panel-fg); }
.sv-section.sv-section--cta.sv-has-panel .block-cta__text { opacity: .9; }
.sv-section--cta.sv-has-panel.sv-bg-cream { background-color: #eeece2; }
.sv-section--cta.sv-has-panel.sv-bg-white { background-color: #ffffff; }
.sv-section--cta.sv-has-panel.sv-bg-slate { background-color: #3c4d57; }
.sv-section--cta.sv-has-panel.sv-bg-dark { background-color: #232d33; }
.sv-section--cta.sv-has-panel.sv-bg-gold { background-color: #ecbe41; }
.sv-section.sv-has-accent .btn:is(.btn--primary, .btn--accent),
.sv-section.sv-has-accent .btn:is(.btn--primary, .btn--accent):hover {
	background-color: var(--sv-accent); border-color: var(--sv-accent); color: var(--sv-accent-fg);
}
.sv-section.sv-has-accent .btn:is(.btn--primary, .btn--accent):hover { filter: brightness(.93); }

/* --- Card / tile body text (engine Suprevo_Renderer::text) ---------------------------------
 * Plain textarea bodies arrive as <p>s, and lines the client types as "- item" as a <ul>. */
.sv-text > :where(p, ul) { margin: 0; }
.sv-text > * + * { margin-top: .5rem; }
.sv-text ul { padding-left: 1.15em; list-style: disc; }
.sv-text li + li { margin-top: .15rem; }
.sv-text li::marker { color: currentColor; }
