/*
 * container.css — the Section builder's one stylesheet (docs/design/section-builder.md).
 *
 * Loaded by a page that holds a Section builder block (the block's `styles`),
 * and by no other page. Every rule is gated on a flag the renderer writes
 * (`@rainbow/core/container`, `data-cb="pt pt-m d …"`) and reads the value from
 * the element's own CSS variable (`--cb-pt:64px`), so a property nobody set is
 * never declared and nothing typed in the CMS becomes a rule. Desktop first;
 * tablet at 1023.98px and below, mobile at 767.98px and below — the editor's
 * device widths, Tailwind's `lg` and `md` edges. A device's own value wins over
 * the wider one's because its rule comes later at the same specificity.
 *
 * tests/container.test.mjs fails when the renderer can write a flag this
 * sheet has no rule for.
 */

/* ── Defaults: a box is a flex column, a widget fills its row ─────────────── */

.cb { display: block; }
.cb-n { box-sizing: border-box; min-width: 0; }
.cb-box, .cb-inner { display: flex; flex-direction: column; }
.cb-inner { width: 100%; max-width: var(--cb-cw); margin-left: auto; margin-right: auto; }
.cb-heading { margin: 0; font-weight: 700; line-height: 1.2; }
.cb .cb-h1 { font-size: 48px; }
.cb .cb-h2 { font-size: 36px; }
.cb .cb-h3 { font-size: 28px; }
.cb .cb-h4 { font-size: 22px; }
.cb .cb-h5 { font-size: 18px; }
.cb .cb-h6 { font-size: 16px; }
.cb-text { line-height: 1.625; }
.cb-text > * { margin: 0; }
.cb-text > * + * { margin-top: 0.75em; }
.cb-text ul { list-style: disc; padding-left: 1.25em; }
.cb-text ol { list-style: decimal; padding-left: 1.25em; }
.cb-text h2 { font-size: 1.5em; font-weight: 700; line-height: 1.25; }
.cb-text h3 { font-size: 1.25em; font-weight: 700; line-height: 1.3; }
.cb-text h4 { font-size: 1.1em; font-weight: 700; }
.cb-text blockquote { border-left: 3px solid #c4b5fd; padding-left: 1em; font-style: italic; }
.cb-text a, .cb-heading a, .cb-list a, .cb-caption a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.cb-button { display: block; }
.cb-btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5em; text-decoration: none; cursor: pointer; text-align: center; }
.cb .cb-btn--white { padding: 12px 28px; border-radius: 10px; background: #fff; color: #5e2d91; font-weight: 500; transition: background-color .15s; }
.cb .cb-btn--white:hover { background: #ede9fe; }
.cb .cb-btn--outline-white { padding: 12px 28px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .75); color: #fff; font-weight: 500; transition: background-color .15s; }
.cb .cb-btn--outline-white:hover { background: rgba(255, 255, 255, .12); }
.cb .cb-btn--link { padding: 0; color: #5e2d91; font-weight: 600; }
.cb .cb-btn--link:hover { text-decoration: underline; text-underline-offset: 3px; }
.cb .cb-btn--sm { padding: 8px 18px; font-size: 14px; }
.cb .cb-btn--lg { padding: 16px 36px; font-size: 18px; }
.cb .cb-btn--link.cb-btn--sm, .cb .cb-btn--link.cb-btn--lg { padding: 0; }
.cb-svg { display: block; flex: none; width: 1em; height: 1em; }
.cb-btn-icon { width: var(--cb-isz, 1.1em); height: var(--cb-isz, 1.1em); }
.cb-icon { line-height: 0; }
.cb-icon .cb-svg { width: var(--cb-isz, 32px); height: var(--cb-isz, 32px); display: inline-block; }
.cb-image { margin: 0; }
.cb-image .cb-media, .cb-image-link { display: block; width: 100%; }
.cb-image img.cb-media { height: auto; max-width: 100%; }
.cb-caption { margin: 0.5em 0 0; font-size: 14px; color: #6b7280; }
.cb-list { margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.cb-list li { display: flex; align-items: baseline; gap: 0.6em; }
.cb-list--bullet { list-style: disc; padding-left: 1.25em; }
.cb-list--bullet li, .cb-list--number li { display: list-item; }
.cb-list--number { list-style: decimal; padding-left: 1.4em; }
.cb-list--none { list-style: none; }
.cb-list--check { list-style: none; }
.cb-list-icon { color: #5e2d91; width: 1.1em; height: 1.1em; transform: translateY(0.15em); }
.cb-spacer { height: 48px; }
.cb-divider { border: 0; border-top: 1px solid #e5e7eb; margin: 0; width: 100%; height: 0; }
.cb-video { position: relative; }
.cb-video .cb-media { display: block; width: 100%; border: 0; background: #000; }
.cb-placeholder { display: flex; align-items: center; justify-content: center; min-height: 120px; padding: 16px; background: #f3f4f6; color: #6b7280; font-size: 14px; text-align: center; border-radius: inherit; }

/* A box with a link: a cover link over it, its own controls above the cover. */
.cb-linked { position: relative; }
.cb-cover { position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.cb-linked :is(a, button, iframe, video, input, select, textarea, summary, label):not(.cb-cover) { position: relative; z-index: 2; }

/* ── The carousel: a scroll-snap row without JavaScript, moved by /js/cms-builder.js with it ── */

.cb-carousel { position: relative; }
.cb-track { display: flex; gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; scrollbar-width: none; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
.cb-track::-webkit-scrollbar { display: none; }
.cb-track:focus-visible { outline: 2px solid #5e2d91; outline-offset: 2px; }
.cb-slide { flex: 0 0 100%; min-width: 0; scroll-snap-align: start; }
.cb-slide > .cb-media { display: block; width: 100%; height: auto; }
.cb-carousel .cb-caption { text-align: center; }
.cb-arrow { position: absolute; top: 50%; z-index: 3; display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin-top: -22px; border: 0; border-radius: 9999px; background: rgba(255, 255, 255, .92); color: #1e1b4b; box-shadow: 0 4px 12px rgb(0 0 0 / 0.15); cursor: pointer; }
.cb-arrow .cb-svg { width: 20px; height: 20px; }
.cb-arrow:hover { background: #fff; }
.cb-arrow:focus-visible, .cb-dot:focus-visible, .cb-pause:focus-visible { outline: 2px solid #5e2d91; outline-offset: 2px; }
.cb-arrow[disabled] { opacity: .4; cursor: default; }
.cb-prev { left: 12px; }
.cb-next { right: 12px; }
.cb-flip { transform: rotate(180deg); }
/*
 * A dot is drawn 10px but pressed on 24px (WCAG 2.2 target size, 2.5.8): the
 * padding is the target, the background only fills the content box. Drawn as
 * a bare 10px button with an 8px gap, axe found every dot but one too small.
 */
.cb-dots { display: flex; justify-content: center; gap: 0; padding-top: 5px; }
.cb-dot { box-sizing: content-box; width: 10px; height: 10px; padding: 7px; border: 0; border-radius: 9999px; background: #d1d5db; background-clip: content-box; cursor: pointer; transition: width .2s, background-color .2s; }
.cb-dot[aria-current="true"] { width: 24px; background: #5e2d91; }
.cb-pause { position: absolute; right: 12px; bottom: 44px; z-index: 3; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 9999px; background: rgba(255, 255, 255, .92); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.cb-pause-icon { display: block; width: 10px; height: 12px; border-left: 3px solid #1e1b4b; border-right: 3px solid #1e1b4b; }
.cb-pause[data-cb-paused] .cb-pause-icon { width: 0; height: 0; border-style: solid; border-width: 6px 0 6px 10px; border-color: transparent transparent transparent #1e1b4b; }
@media (prefers-reduced-motion: reduce) {
  .cb-track { scroll-behavior: auto; }
  .cb-dot { transition: none; }
}

/* ── Desktop (and every device until one overrides it) ────────────────────── */

.cb-n[data-cb~="pt"] { padding-top: var(--cb-pt); }
.cb-n[data-cb~="pr"] { padding-right: var(--cb-pr); }
.cb-n[data-cb~="pb"] { padding-bottom: var(--cb-pb); }
.cb-n[data-cb~="pl"] { padding-left: var(--cb-pl); }
.cb-n[data-cb~="mt"] { margin-top: var(--cb-mt); }
.cb-n[data-cb~="mr"] { margin-right: var(--cb-mr); }
.cb-n[data-cb~="mb"] { margin-bottom: var(--cb-mb); }
.cb-n[data-cb~="ml"] { margin-left: var(--cb-ml); }
.cb-n[data-cb~="d"] { display: var(--cb-d); }
.cb-n[data-cb~="dir"] { flex-direction: var(--cb-dir); }
.cb-n[data-cb~="wr"] { flex-wrap: var(--cb-wr); }
.cb-n[data-cb~="jc"] { justify-content: var(--cb-jc); }
.cb-n[data-cb~="ai"] { align-items: var(--cb-ai); }
.cb-n[data-cb~="gap"] { gap: var(--cb-gap); }
.cb-n[data-cb~="cols"] { grid-template-columns: repeat(var(--cb-cols), minmax(0, 1fr)); }
.cb-n[data-cb~="sz"] { flex: var(--cb-fx); width: var(--cb-w); }
.cb-n[data-cb~="mw"] { max-width: var(--cb-mw); }
.cb-n[data-cb~="mh"] { min-height: var(--cb-mh); }
.cb-n[data-cb~="h"] { height: var(--cb-h); }
.cb-n[data-cb~="as"] { align-self: var(--cb-as); }
.cb-n[data-cb~="ta"] { text-align: var(--cb-ta); }
.cb-n[data-cb~="fs"] { font-size: var(--cb-fs); }
.cb-n[data-cb~="sb"] > .cb-slide { flex-basis: var(--cb-sb); }

.cb-n[data-cb~="cw"] { max-width: var(--cb-cw); }
.cb-n[data-cb~="fw"] { font-weight: var(--cb-fw); }
.cb-n[data-cb~="lh"] { line-height: var(--cb-lh); }
.cb-n[data-cb~="c"] { color: var(--cb-c); }
.cb-divider[data-cb~="c"] { border-top-color: var(--cb-c); }
.cb-n[data-cb~="bgc"] { background-color: var(--cb-bgc); }
.cb-n[data-cb~="bgg"] { background-image: var(--cb-bgg); }
.cb-n[data-cb~="bgi"] { background-image: var(--cb-bgi); background-size: var(--cb-bgs); background-position: var(--cb-bgp); background-repeat: no-repeat; }
.cb-n[data-cb~="bgr"] { background-repeat: repeat; }
.cb-n[data-cb~="ov"] { position: relative; isolation: isolate; }
.cb-n[data-cb~="ov"]::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--cb-ov); opacity: var(--cb-ovo); border-radius: inherit; pointer-events: none; }
.cb-n[data-cb~="bd"] { border: var(--cb-bw) var(--cb-bs) var(--cb-bc); }
.cb-n[data-cb~="rd"] { border-radius: var(--cb-rd); }
.cb-image[data-cb~="rd"] .cb-media, .cb-video[data-cb~="rd"] .cb-media { border-radius: var(--cb-rd); }
.cb-n[data-cb~="sh"] { box-shadow: var(--cb-sh); }
.cb-image[data-cb~="sh"] { box-shadow: none; }
.cb-image[data-cb~="sh"] .cb-media { box-shadow: var(--cb-sh); }
.cb-n[data-cb~="of"] { overflow: var(--cb-of); }
.cb-n[data-cb~="isz"] { --cb-isz-set: 1; }
.cb-divider[data-cb~="th"] { border-top-width: var(--cb-th); }
.cb-divider[data-cb~="ls"] { border-top-style: var(--cb-ls); }
.cb-n[data-cb~="ar"] .cb-media { aspect-ratio: var(--cb-ar); object-fit: var(--cb-fit); height: auto; }
.cb-video[data-cb~="ar"] .cb-media { height: auto; }

/* ── Tablet: 1023.98px and below ──────────────────────────────────────────── */

@media (max-width: 1023.98px) {
  .cb .cb-h1 { font-size: 40px; }
  .cb .cb-h2 { font-size: 30px; }
  .cb .cb-h3 { font-size: 24px; }
  .cb-n[data-cb~="pt-t"] { padding-top: var(--cb-pt-t); }
  .cb-n[data-cb~="pr-t"] { padding-right: var(--cb-pr-t); }
  .cb-n[data-cb~="pb-t"] { padding-bottom: var(--cb-pb-t); }
  .cb-n[data-cb~="pl-t"] { padding-left: var(--cb-pl-t); }
  .cb-n[data-cb~="mt-t"] { margin-top: var(--cb-mt-t); }
  .cb-n[data-cb~="mr-t"] { margin-right: var(--cb-mr-t); }
  .cb-n[data-cb~="mb-t"] { margin-bottom: var(--cb-mb-t); }
  .cb-n[data-cb~="ml-t"] { margin-left: var(--cb-ml-t); }
  .cb-n[data-cb~="d-t"] { display: var(--cb-d-t); }
  .cb-n[data-cb~="dir-t"] { flex-direction: var(--cb-dir-t); }
  .cb-n[data-cb~="wr-t"] { flex-wrap: var(--cb-wr-t); }
  .cb-n[data-cb~="jc-t"] { justify-content: var(--cb-jc-t); }
  .cb-n[data-cb~="ai-t"] { align-items: var(--cb-ai-t); }
  .cb-n[data-cb~="gap-t"] { gap: var(--cb-gap-t); }
  .cb-n[data-cb~="cols-t"] { grid-template-columns: repeat(var(--cb-cols-t), minmax(0, 1fr)); }
  .cb-n[data-cb~="sz-t"] { flex: var(--cb-fx-t); width: var(--cb-w-t); }
  .cb-n[data-cb~="mw-t"] { max-width: var(--cb-mw-t); }
  .cb-n[data-cb~="mh-t"] { min-height: var(--cb-mh-t); }
  .cb-n[data-cb~="h-t"] { height: var(--cb-h-t); }
  .cb-n[data-cb~="as-t"] { align-self: var(--cb-as-t); }
  .cb-n[data-cb~="ta-t"] { text-align: var(--cb-ta-t); }
  .cb-n[data-cb~="fs-t"] { font-size: var(--cb-fs-t); }
  .cb-n[data-cb~="sb-t"] > .cb-slide { flex-basis: var(--cb-sb-t); }
}

/* ── Mobile: 767.98px and below ───────────────────────────────────────────── */

@media (max-width: 767.98px) {
  .cb .cb-h1 { font-size: 34px; }
  .cb .cb-h2 { font-size: 28px; }
  .cb .cb-h3 { font-size: 22px; }
  .cb .cb-h4 { font-size: 20px; }
  .cb-n[data-cb~="pt-m"] { padding-top: var(--cb-pt-m); }
  .cb-n[data-cb~="pr-m"] { padding-right: var(--cb-pr-m); }
  .cb-n[data-cb~="pb-m"] { padding-bottom: var(--cb-pb-m); }
  .cb-n[data-cb~="pl-m"] { padding-left: var(--cb-pl-m); }
  .cb-n[data-cb~="mt-m"] { margin-top: var(--cb-mt-m); }
  .cb-n[data-cb~="mr-m"] { margin-right: var(--cb-mr-m); }
  .cb-n[data-cb~="mb-m"] { margin-bottom: var(--cb-mb-m); }
  .cb-n[data-cb~="ml-m"] { margin-left: var(--cb-ml-m); }
  .cb-n[data-cb~="d-m"] { display: var(--cb-d-m); }
  .cb-n[data-cb~="dir-m"] { flex-direction: var(--cb-dir-m); }
  .cb-n[data-cb~="wr-m"] { flex-wrap: var(--cb-wr-m); }
  .cb-n[data-cb~="jc-m"] { justify-content: var(--cb-jc-m); }
  .cb-n[data-cb~="ai-m"] { align-items: var(--cb-ai-m); }
  .cb-n[data-cb~="gap-m"] { gap: var(--cb-gap-m); }
  .cb-n[data-cb~="cols-m"] { grid-template-columns: repeat(var(--cb-cols-m), minmax(0, 1fr)); }
  .cb-n[data-cb~="sz-m"] { flex: var(--cb-fx-m); width: var(--cb-w-m); }
  .cb-n[data-cb~="mw-m"] { max-width: var(--cb-mw-m); }
  .cb-n[data-cb~="mh-m"] { min-height: var(--cb-mh-m); }
  .cb-n[data-cb~="h-m"] { height: var(--cb-h-m); }
  .cb-n[data-cb~="as-m"] { align-self: var(--cb-as-m); }
  .cb-n[data-cb~="ta-m"] { text-align: var(--cb-ta-m); }
  .cb-n[data-cb~="fs-m"] { font-size: var(--cb-fs-m); }
  .cb-n[data-cb~="sb-m"] > .cb-slide { flex-basis: var(--cb-sb-m); }
  .cb-arrow { width: 36px; height: 36px; margin-top: -18px; }
}

/* ── Hidden per device (shown faded on the editor's canvas, never removed there) ── */

@media (min-width: 1024px) {
  html:not(.cms-edit) .cb-hide-d { display: none !important; }
  .cms-edit .cb-hide-d { opacity: .35; outline: 1px dashed #a78bfa; }
}
@media (min-width: 768px) and (max-width: 1023.98px) {
  html:not(.cms-edit) .cb-hide-t { display: none !important; }
  .cms-edit .cb-hide-t { opacity: .35; outline: 1px dashed #a78bfa; }
}
@media (max-width: 767.98px) {
  html:not(.cms-edit) .cb-hide-m { display: none !important; }
  .cms-edit .cb-hide-m { opacity: .35; outline: 1px dashed #a78bfa; }
}

/* ── The editor's canvas only (html.cms-edit is set by /js/cms-editor.js) ──── */

.cms-edit .cb [data-cms-node]:hover:not(:has([data-cms-node]:hover)) { outline: 1px dashed rgba(124, 58, 237, .75); outline-offset: -1px; }
.cms-edit .cb [data-cms-placeholder]:empty::before { content: attr(data-cms-placeholder); opacity: .45; }
.cms-edit .cb [data-cms-placeholder]:empty { min-height: 1em; }
.cms-edit .cb-empty { display: flex; align-items: center; justify-content: center; min-height: 72px; padding: 12px; border: 1px dashed #a78bfa; border-radius: 8px; color: #7c3aed; font-size: 13px; background: rgba(237, 233, 254, .45); text-align: center; }
.cms-edit .cb-cover { pointer-events: none; }
.cms-edit .cb-video::after { content: ""; position: absolute; inset: 0; z-index: 4; }
