/*
 * Website Manager — Visual Builder page sections (Helpers/Sections.php). Brand presets only: every colour is a theme
 * token from /theme.css (Admin → Settings → Branding) or a neutral token from variables.css, with the
 * variables.css brand colours as the fallback. No section can set a colour, size or style of its own.
 *
 * Devices for "hide on": mobile < 640 px, tablet 640–1023 px, desktop ≥ 1024 px.
 */
.sx-page { display: flex; flex-direction: column; }
.sx {
  --sx-primary: var(--theme-primary, var(--brand-primary));
  --sx-on-primary: var(--theme-on-primary, var(--text-inverse));
  --sx-accent: var(--theme-secondary, var(--brand-accent));
  --sx-accent-text: var(--theme-secondary-text, var(--theme-secondary, var(--brand-accent)));
  position: relative; min-width: 0;
}
.sx-container { width: 100%; max-width: var(--container-content); margin: 0 auto; padding: 0 1rem; min-width: 0; }
.sx-w-narrow .sx-container { max-width: 46rem; }
.sx-w-wide .sx-container { max-width: 90rem; }
.sx-w-full .sx-container { max-width: none; }

/* Spacing presets. */
.sx-sp-none { padding: 0; }
.sx-sp-sm { padding: 1.5rem 0; }
.sx-sp-md { padding: 3rem 0; }
.sx-sp-lg { padding: 4.5rem 0; }
.sx-sp-xl { padding: 6rem 0; }

/* Tone presets: theme colours only. */
.sx-tone-default { background: var(--bg-surface); color: var(--text-primary); }
.sx-tone-muted { background: var(--tk-section-alt, var(--bg-page)); color: var(--text-primary); }
.sx-tone-brand { background: color-mix(in srgb, var(--sx-accent) 9%, var(--bg-surface)); color: var(--text-primary); }
.sx-tone-dark { background: var(--sx-primary); color: var(--sx-on-primary); }
.sx-tone-dark :is(.sx-title, .sx-hero-title, .sx-card-title, h2, h3) { color: inherit; }
.sx-tone-dark :is(.sx-intro, .sx-card-text, .sx-hero-lead, p) { color: color-mix(in srgb, var(--sx-on-primary) 85%, transparent); }
.sx-tone-dark a:not(.btn) { color: inherit; }
/* Cards on the dark tone: translucent on the brand colour, text in the tone's text colour (wins over the card presets). */
.sx-tone-dark .sx-grid .sx-card, .sx-tone-dark .sx-pricing .sx-price, .sx-tone-dark .sx-faq .sx-faq-item { background: color-mix(in srgb, var(--sx-on-primary) 8%, transparent); border-color: color-mix(in srgb, var(--sx-on-primary) 20%, transparent); color: var(--sx-on-primary); box-shadow: none; }
.sx-tone-dark .sx-card-icon { background: color-mix(in srgb, var(--sx-on-primary) 15%, transparent); color: var(--sx-on-primary); }
.sx-tone-dark .sx-faq-answer, .sx-tone-dark .sx-price-amount span { color: color-mix(in srgb, var(--sx-on-primary) 85%, transparent); }
.sx-tone-dark .sx-card-link, .sx-tone-dark .sx-price-features .icon { color: inherit; }

.sx-align-center { text-align: center; }
.sx-align-center :is(.sx-head, .sx-actions, .sx-hero-text) { align-items: center; justify-content: center; margin-left: auto; margin-right: auto; }

/* Hide on a device. */
@media (max-width: 639.98px) { .sx-hide-mobile { display: none; } }
@media (min-width: 640px) and (max-width: 1023.98px) { .sx-hide-tablet { display: none; } }
@media (min-width: 1024px) { .sx-hide-desktop { display: none; } }

/* Reveal presets (site-sections.js adds .is-visible; reduced motion shows everything at once). */
@media (prefers-reduced-motion: no-preference) {
  .sx-anim-fade:not(.is-visible) { opacity: 0; }
  .sx-anim-slide:not(.is-visible) { opacity: 0; transform: translateY(1.5rem); }
  .sx-anim-fade, .sx-anim-slide { transition: opacity 0.6s ease, transform 0.6s ease; }
}

/* Shared parts. */
.sx-head { display: flex; flex-direction: column; gap: 0.5rem; max-width: 46rem; margin-bottom: 2rem; }
.sx-title { margin: 0; font-family: var(--font-heading); font-size: var(--text-h2); line-height: 1.2; color: var(--tk-h2, var(--text-primary)); overflow-wrap: anywhere; }
.sx-intro { margin: 0; color: var(--text-secondary); font-size: var(--text-body-lg, 1.0625rem); line-height: 1.6; }
.sx-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.25rem; }
.sx-actions:empty { display: none; }
.sx-rich { display: flex; flex-direction: column; gap: 1rem; line-height: 1.7; }
.sx-rich p, .sx-list { margin: 0; }
.sx-list { padding-left: 1.25rem; display: grid; gap: 0.375rem; }
.sx-image { display: block; width: 100%; height: auto; border-radius: var(--radius-md); }
.sx-empty { margin: 0; padding: 1.5rem; border: 1px dashed var(--border-strong); border-radius: var(--radius); color: var(--text-muted); text-align: center; }
.sx-caption { margin: 0.75rem 0 0; color: var(--text-muted); font-size: var(--text-small); }
.sx-eyebrow { margin: 0; font-size: var(--text-small); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--sx-accent-text); }
.sx-tone-dark .sx-eyebrow { color: inherit; }

/* Hero. */
.sx-hero { display: grid; gap: 2rem; align-items: center; }
.sx-hero-text { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.sx-hero-title { margin: 0; font-family: var(--font-heading); font-size: var(--text-h1); line-height: 1.15; overflow-wrap: anywhere; }
.sx-hero-lead { margin: 0; font-size: var(--text-body-lg, 1.0625rem); line-height: 1.6; color: var(--text-secondary); max-width: 40rem; }
.sx-hero-visual img, .sx-hero-video { display: block; width: 100%; height: auto; border-radius: var(--radius-xl); object-fit: cover; }
.sx-hero-centered { text-align: center; justify-items: center; }
.sx-hero-centered .sx-hero-text { align-items: center; }
.sx-hero-background { position: relative; isolation: isolate; min-height: 22rem; padding: 3rem 1.5rem; border-radius: var(--radius-xl); overflow: hidden; color: var(--sx-on-primary); }
.sx-hero-background .sx-hero-visual { position: absolute; inset: 0; z-index: -1; }
.sx-hero-background .sx-hero-visual :is(img, video) { width: 100%; height: 100%; border-radius: 0; }
.sx-hero-background::after { content: ""; position: absolute; inset: 0; z-index: -1; background: color-mix(in srgb, var(--sx-primary) 72%, transparent); }
.sx-hero-background :is(.sx-hero-lead, .sx-eyebrow) { color: inherit; }
@media (min-width: 900px) { .sx-hero-split { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); } }

/* Image and text. */
.sx-split { display: grid; gap: 2rem; align-items: center; }
.sx-split-text { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
@media (min-width: 900px) {
  .sx-split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .sx-split-right .sx-split-media { order: 2; }
}

/* Columns / cards. */
.sx-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.25rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .sx-cols-2, .sx-cols-3, .sx-cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .sx-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .sx-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.sx-card { display: flex; flex-direction: column; gap: 0.625rem; min-width: 0; text-align: inherit; }
.sx-cards-cards .sx-card, .sx-cards-icons .sx-card { padding: 1.5rem; background: var(--tk-card-bg, var(--bg-surface)); border: 1px solid var(--tk-card-border, var(--border-default)); border-radius: var(--radius-xl); box-shadow: var(--shadow-sm); }
.sx-card-image { width: 100%; height: auto; border-radius: var(--radius-md); }
.sx-card-icon { display: inline-flex; align-items: center; justify-content: center; width: 2.75rem; height: 2.75rem; border-radius: var(--radius); background: color-mix(in srgb, var(--sx-accent) 12%, transparent); color: var(--sx-accent-text); }
.sx-align-center .sx-card-icon { margin: 0 auto; }
.sx-card-title { margin: 0; font-family: var(--font-heading); font-size: var(--text-h5, 1.125rem); color: var(--tk-card-title, inherit); }
.sx-card-title a { color: inherit; text-decoration: none; }
.sx-card-title a:hover { text-decoration: underline; }
.sx-card-text { margin: 0; color: var(--text-secondary); line-height: 1.6; }
.sx-card-link { font-weight: 600; color: var(--sx-accent-text); }

/* Stats. */
.sx-stats { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.5rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 900px) { .sx-stats { grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); } }
.sx-stat { display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; }
.sx-stat-value { font-family: var(--font-heading); font-size: clamp(2rem, 1.6rem + 1.6vw, 3rem); font-weight: 600; color: var(--sx-accent-text); font-variant-numeric: tabular-nums; }
.sx-tone-dark .sx-stat-value { color: inherit; }
.sx-stat-label { color: var(--text-secondary); }

/* FAQ / accordion. */
.sx-faq { display: grid; gap: 0.75rem; max-width: 52rem; }
.sx-align-center .sx-faq { margin: 0 auto; text-align: left; }
.sx-faq-item { border: 1px solid var(--border-default); border-radius: var(--radius); background: var(--bg-surface); }
.sx-faq-item summary { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.25rem; font-weight: 600; cursor: pointer; list-style: none; min-height: 44px; }
.sx-faq-item summary::-webkit-details-marker { display: none; }
.sx-faq-item[open] summary .icon { transform: rotate(180deg); }
.sx-faq-answer { padding: 0 1.25rem 1.25rem; color: var(--text-secondary); }

/* Tabs. */
.sx-tabs { display: grid; gap: 1rem; }
.sx-tablist { display: flex; flex-wrap: wrap; gap: 0.5rem; border-bottom: 1px solid var(--border-default); }
.sx-tablist [role="tab"] { min-height: 44px; padding: 0.5rem 1rem; border: 0; border-bottom: 3px solid transparent; background: none; font: inherit; font-weight: 600; color: var(--text-secondary); cursor: pointer; }
.sx-tablist [role="tab"][aria-selected="true"] { color: var(--sx-accent-text); border-bottom-color: var(--sx-accent); }
.sx-tab-panel { display: grid; gap: 1rem; }

/* Call to action. */
.sx-cta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1.5rem; }
.sx-cta-text { display: flex; flex-direction: column; gap: 0.5rem; min-width: min(100%, 18rem); flex: 1; }
.sx-cta-text p { margin: 0; }
.sx-cta-card { padding: 2rem; border-radius: var(--radius-xl); background: var(--sx-primary); color: var(--sx-on-primary); }
.sx-cta-card .sx-title, .sx-cta-card p { color: inherit; }
.sx-align-center .sx-cta { flex-direction: column; text-align: center; }
.sx-cta .sx-actions { margin-top: 0; }

/* Pricing / packages. */
.sx-pricing { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); }
.sx-price { display: flex; flex-direction: column; gap: 0.75rem; padding: 1.75rem; border: 1px solid var(--border-default); border-radius: var(--radius-xl); background: var(--bg-surface); text-align: left; }
.sx-price.is-featured { border: 2px solid var(--sx-accent); box-shadow: var(--shadow-lg); }
.sx-price-amount { margin: 0; font-family: var(--font-heading); font-size: 1.75rem; font-weight: 600; }
.sx-price-amount span { font-size: var(--text-small); font-weight: 400; color: var(--text-muted); }
.sx-price-features { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; flex: 1; }
.sx-price-features li { display: flex; gap: 0.5rem; align-items: flex-start; }
.sx-price-features .icon { color: var(--sx-accent-text); flex-shrink: 0; margin-top: 0.2rem; }

/* Products, categories. */
.sx-basket { margin-top: 0.5rem; display: grid; gap: 0.25rem; }
.sx-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.sx-align-center .sx-chips { justify-content: center; }

/* Before / after. */
.sx-before-after { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .sx-before-after { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.sx-before-after figure { margin: 0; display: grid; gap: 0.5rem; }
.sx-before-after figcaption { font-weight: 600; }

/* Logos. */
.sx-logos { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 1.5rem 2.5rem; }
.sx-logo { display: block; max-height: 3.5rem; width: auto; max-width: 10rem; object-fit: contain; filter: grayscale(1); opacity: 0.8; }
.sx-logos a:hover .sx-logo, .sx-logos a:focus-visible .sx-logo { filter: none; opacity: 1; }
.sx-logos-scroll { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 0.5rem; }
.sx-logos-scroll li { scroll-snap-align: start; flex: 0 0 auto; }

/* Video. */
.sx-video { margin: 0; display: grid; gap: 0.5rem; }
.sx-video video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; background: var(--sx-primary); border-radius: var(--radius-md); }
.sx-video figcaption { color: var(--text-muted); font-size: var(--text-small); }

/* Carousel: scroll-snap, swipe or Tab; no autoplay. */
.sx-carousel { list-style: none; margin: 0; padding: 0 0 0.75rem; display: grid; grid-auto-flow: column; grid-auto-columns: min(85%, 32rem); gap: 1rem; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; }
.sx-slide { scroll-snap-align: start; min-width: 0; border-radius: var(--radius-md); }
.sx-slide:focus-visible { outline: 3px solid var(--sx-accent); outline-offset: 2px; }
.sx-slide figure { margin: 0; display: grid; gap: 0.5rem; }
.sx-slide img { aspect-ratio: 4 / 3; object-fit: cover; }
.sx-slide figcaption { color: var(--text-muted); font-size: var(--text-small); }

/* Contact. */
.sx-contact { display: grid; gap: 2rem; align-items: start; }
@media (min-width: 900px) { .sx-contact { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); } }
.sx-contact-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; text-align: left; }
.sx-contact-list li { display: flex; gap: 0.75rem; align-items: flex-start; overflow-wrap: anywhere; }
.sx-contact-list .icon { color: var(--sx-accent-text); flex-shrink: 0; margin-top: 0.15rem; }

/* Reviews in a section. */
.sx-reviews { list-style: none; margin: 0; padding: 0; }

/* Newsletter inside a page: the shared form, without the band's own outer spacing. */
.sx-newsletter .newsletter { padding: 0; background: none; }

/* Builder canvas (staff only): hidden sections stay visible, faded, so they can be selected and shown again. */
.sx-is-hidden, [data-bld-hidden] { opacity: 0.4; }
.sx-is-hidden::before { content: "Hidden section"; position: absolute; top: 0.5rem; right: 0.5rem; z-index: 2; padding: 0.125rem 0.5rem; border-radius: 999px; background: var(--text-primary); color: var(--bg-surface); font-size: var(--text-caption); }

/*
 * The Visual Builder canvas (html.bld-canvas-doc exists only in the staff canvas frame). The drawn page sits directly
 * in <main> (the canvas area is display: contents), and every editing aid below is an outline or a floating label:
 * none of them changes the layout, so the canvas measures exactly like the public page.
 */
.bld-canvas-root { display: contents; }
.bld-canvas-loading { min-height: 40vh; }
.bld-canvas-doc [data-bld-index], .bld-canvas-doc [data-bld-f], .bld-canvas-doc [data-bld-dyn], .bld-canvas-doc [data-bld-global],
.bld-canvas-doc .site-header, .bld-canvas-doc .site-footer, .bld-canvas-doc .page-shell > .newsletter { cursor: pointer; }
.bld-canvas-doc .bld-hover { outline: 2px dashed color-mix(in srgb, var(--brand-accent) 70%, transparent); outline-offset: -2px; }
.bld-canvas-doc .bld-selected { outline: 3px solid var(--brand-accent); outline-offset: -3px; }
.bld-canvas-doc .bld-el-selected { outline: 2px solid var(--brand-accent); outline-offset: 2px; }
.bld-canvas-doc [data-bld-editing] { outline: 2px solid var(--brand-accent); outline-offset: 2px; cursor: text; caret-color: currentColor; }
.bld-canvas-doc .bld-drop-line { height: 0; border-top: 4px solid var(--brand-accent); margin: -2px 0; position: relative; z-index: 5; }
.bld-canvas-doc .bld-drop-line::after { content: attr(data-label); position: absolute; left: 50%; top: -0.9rem; transform: translateX(-50%); padding: 0.125rem 0.625rem; border-radius: 999px; background: var(--brand-accent); color: var(--text-inverse); font-size: var(--text-caption); white-space: nowrap; }
.bld-tag { position: absolute; z-index: 1000; pointer-events: none; padding: 0.125rem 0.5rem; border-radius: 0.375rem; background: var(--brand-accent); color: var(--text-inverse); font: 600 0.75rem/1.4 var(--font-sans); white-space: nowrap; }
.bld-tag[hidden] { display: none; }
/* The Theme panel measures what the canvas shows on a sample placed out of sight, then removes it at once. */
.bld-probe { position: absolute; top: 0; left: -10000px; width: 40rem; visibility: hidden; pointer-events: none; }
/* Embedded players and videos do not take the click: it selects them instead. */
.bld-canvas-doc .site-main iframe, .bld-canvas-doc .site-main video { pointer-events: none; }

/* The builder canvas page: no chat bubble or back-to-top over the page being edited. */
.bld-canvas-doc #live-chat, .bld-canvas-doc .back-to-top { display: none !important; }
/* A visible newsletter section replaces the site-wide band (as on the public page). */
.bld-canvas-doc.bld-has-newsletter .page-shell > .newsletter { display: none; }
