/* Legacy custom themes use all their design values. Themes based on Classic
   only override the settings that differ from the editor defaults. */
body.theme-custom:where(:not([data-custom-overrides]), [data-custom-overrides~="primary"]) { --primary: var(--custom-primary); }
body.theme-custom:where(:not([data-custom-overrides]), [data-custom-overrides~="primary_hover"]) { --primary-hover: var(--custom-primary-hover); }
body.theme-custom:where(:not([data-custom-overrides]), [data-custom-overrides~="secondary"]) { --secondary: var(--custom-secondary); }
body.theme-custom:where(:not([data-custom-overrides]), [data-custom-overrides~="surface"]) { --surface: var(--custom-surface); }
body.theme-custom:where(:not([data-custom-overrides]), [data-custom-overrides~="surface_alt"]) { --surface-2: var(--custom-surface-alt); --surface-3: var(--custom-surface-alt); }
body.theme-custom:where(:not([data-custom-overrides]), [data-custom-overrides~="text"]) { --text: var(--custom-text); }
body.theme-custom:where(:not([data-custom-overrides]), [data-custom-overrides~="muted"]) { --muted: var(--custom-muted); }
body.theme-custom:where(:not([data-custom-overrides]), [data-custom-overrides~="border"]) { --border: var(--custom-border); }
body.theme-custom:where(:not([data-custom-overrides]), [data-custom-overrides~="link"]) { --link: var(--custom-link); }
body.theme-custom:where(:not([data-custom-overrides]), [data-custom-overrides~="link_hover"]) { --link-hover: var(--custom-link-hover); }
body.theme-custom:where(:not([data-custom-overrides]), [data-custom-overrides~="menu_hover"]) { --primary-soft: var(--custom-menu-hover); }
body.theme-custom:where(:not([data-custom-overrides]), [data-custom-overrides~="container_radius"]) { --theme-radius: var(--custom-container-radius); }
body.theme-custom:where(:not([data-custom-overrides]), [data-custom-overrides~="body_size"]) { font-size: var(--custom-body-size); }
body.theme-custom:where(:not([data-custom-overrides]), [data-custom-overrides~="line_height"]) { line-height: var(--custom-line-height); }
body.theme-custom:where(:not([data-custom-overrides]), [data-custom-overrides~="background_size"]) { background-size: var(--custom-background-size); }
body.theme-custom:where(:not([data-custom-overrides]), [data-custom-overrides~="background_position"]) { background-position: var(--custom-background-position); }
body.theme-custom:where(:not([data-custom-overrides]), [data-custom-overrides~="background_attachment"]) { background-attachment: var(--custom-background-attachment); }

body.theme-custom:not([data-custom-overrides]) > .container { width: calc(100% - var(--custom-outer-gutter) * 2); box-shadow: 0 8px 28px rgb(0 0 0 / 12%); }
@media (min-width: 651px) {
  body.theme-custom:where(:not([data-custom-overrides]), [data-custom-overrides~="outer_gutter"]) > .container { width: calc(100% - var(--custom-outer-gutter) * 2); }
  body.theme-custom:where(:not([data-custom-overrides]), [data-custom-overrides~="outer_margin"]) > .container { margin: var(--custom-outer-margin) auto; }
  body.theme-custom:where(:not([data-custom-overrides]), [data-custom-overrides~="content_padding_x"]) > .container { padding-inline: var(--custom-content-padding-x); }
  body.theme-custom:where(:not([data-custom-overrides]), [data-custom-overrides~="content_padding_y"]) > .container { padding-block: var(--custom-content-padding-y); }
  body.theme-custom:where(:not([data-custom-overrides]), [data-custom-overrides~="container_radius"]) > .container { border-radius: var(--custom-container-radius); }
}
body.theme-custom:where(:not([data-custom-overrides]), [data-custom-overrides~="content_width"]) > .container { max-width: var(--custom-content-width); }
body.theme-custom[data-custom-shadow="none"] > .container { box-shadow: none; }
body.theme-custom[data-custom-shadow="strong"] > .container { box-shadow: 0 16px 48px rgb(0 0 0 / 24%); }
body.theme-custom:where(:not([data-custom-overrides]), [data-custom-overrides~="header_padding"]) { --header-padding: var(--custom-header-padding); }
body.theme-custom:where(:not([data-custom-overrides]), [data-custom-overrides~="header_padding"]) .container > header { padding-block: var(--custom-header-padding); }
body.theme-custom:where(:not([data-custom-overrides]), [data-custom-overrides~="header_height"]) .container > header { min-height: var(--custom-header-height); }
body.theme-custom:where(:not([data-custom-overrides]), [data-custom-overrides~="footer_padding"]) .site-footer { padding-block: var(--custom-footer-padding); }
body.theme-custom:where(:not([data-custom-overrides]), [data-custom-overrides~="footer_background"]) .site-footer { background-color: var(--custom-footer-background); }
body.theme-custom:where(:not([data-custom-overrides]), [data-custom-overrides~="footer_size"]) .site-footer { font-size: var(--custom-footer-size); }
body.theme-custom:where(:not([data-custom-overrides]), [data-custom-overrides~="link"]) a:not(.btn) { color: var(--custom-link); }
body.theme-custom:where(:not([data-custom-overrides]), [data-custom-overrides~="link_hover"]) a:not(.btn):hover { color: var(--custom-link-hover); }
body.theme-custom:where(:not([data-custom-overrides]), [data-custom-overrides~="page_title_size"]) main h1.page-title { font-size: var(--custom-page-title-size); }
body.theme-custom:where(:not([data-custom-overrides]), [data-custom-overrides~="title_align"]) main h1.page-title { text-align: var(--custom-title-align); }
body.theme-custom:where(:not([data-custom-overrides]), [data-custom-overrides~="h1_size"]) .cms-page h1 { font-size: var(--custom-h1-size); }
body.theme-custom:where(:not([data-custom-overrides]), [data-custom-overrides~="h2_size"]) .cms-page h2 { font-size: var(--custom-h2-size); }
body.theme-custom:where(:not([data-custom-overrides]), [data-custom-overrides~="h3_size"]) .cms-page h3 { font-size: var(--custom-h3-size); }
body.theme-custom:where(:not([data-custom-overrides]), [data-custom-overrides~="h4_size"]) .cms-page h4 { font-size: var(--custom-h4-size); }
body.theme-custom:where(:not([data-custom-overrides]), [data-custom-overrides~="h5_size"]) .cms-page h5 { font-size: var(--custom-h5-size); }
body.theme-custom:where(:not([data-custom-overrides]), [data-custom-overrides~="h6_size"]) .cms-page h6 { font-size: var(--custom-h6-size); }
body.theme-custom:where(:not([data-custom-overrides]), [data-custom-overrides~="body_size"]) .cms-page :is(p, li) { font-size: var(--custom-body-size); }
body.theme-custom:where(:not([data-custom-overrides]), [data-custom-overrides~="line_height"]) .cms-page :is(p, li) { line-height: var(--custom-line-height); }
body.theme-custom:where(:not([data-custom-overrides]), [data-custom-overrides~="section_gap"]) .cms-page .cms-section { margin-block: var(--custom-section-gap); }
body.theme-custom:where(:not([data-custom-overrides]), [data-custom-overrides~="card_radius"]) :is(.cms-page .card, .admin-card) { border-radius: var(--custom-card-radius); }
body.theme-custom:where(:not([data-custom-overrides]), [data-custom-overrides~="control_radius"]) :is(.btn, .starter-button),
body.theme-custom:where(:not([data-custom-overrides]), [data-custom-overrides~="control_radius"]) :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
  border-radius: var(--custom-control-radius);
}
body.theme-custom:where(:not([data-custom-overrides]), [data-custom-overrides~="button_size"]) :is(.btn, .starter-button) { font-size: var(--custom-button-size); }
body.theme-custom:where(:not([data-custom-overrides]), [data-custom-overrides~="form_size"]) :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) { font-size: var(--custom-form-size); }
body.theme-custom:where(:not([data-custom-overrides]), [data-custom-overrides~="menu_size"]) :is(.horiznav, .nav-drawer) li > :is(a, span) { font-size: var(--custom-menu-size); }
body.theme-custom:where(:not([data-custom-overrides]), [data-custom-overrides~="menu_case"]) :is(.horiznav, .nav-drawer) li > :is(a, span) { text-transform: var(--custom-menu-case); }
body.theme-custom[data-custom-overrides~="menu_padding_x"] { --top-menu-padding-x: var(--custom-menu-padding-x); }
body.theme-custom[data-custom-overrides~="menu_padding_y"] { --top-menu-padding-y: var(--custom-menu-padding-y); }
body.theme-custom:where(:not([data-custom-overrides]), [data-custom-overrides~="menu_padding_y"]) :is(.horiznav, .nav-drawer) li > :is(a, span) { padding-block: var(--custom-menu-padding-y); }
/* Submenus and the drawer keep a minimum inner space, while top-level links can use zero. */
body.theme-custom:where(:not([data-custom-overrides]), [data-custom-overrides~="menu_padding_x"]) :is(.horiznav, .nav-drawer) li > :is(a, span) { padding-inline: max(var(--custom-menu-padding-x), 12px); }
body.theme-custom:where(:not([data-custom-overrides]), [data-custom-overrides~="menu_padding_x"]) .container > header .horiznav > li > :is(a, span) { padding-inline: var(--custom-menu-padding-x); }
body.theme-custom:where(:not([data-custom-overrides]), [data-custom-overrides~="menu_padding_x"]) .nav-drawer li.has-sub > :is(a, span) { padding-right: 52px; }
body.theme-custom.menu-position-left:not(.is-admin):where(:not([data-custom-overrides]), [data-custom-overrides~="sidebar_width"]) > .container { grid-template-columns: var(--custom-sidebar-width) minmax(0, 1fr); }
body.theme-custom.menu-position-left:not(.is-admin):where(:not([data-custom-overrides]), [data-custom-overrides~="layout_gap"]) > .container { column-gap: var(--custom-layout-gap); }
@media (max-width: 650px) {
  body.theme-custom:not([data-custom-overrides]) > .container { width: 100%; margin: 0; border-radius: 0; }
  body.theme-custom:where(:not([data-custom-overrides]), [data-custom-overrides~="mobile_padding"]) > .container { padding: var(--custom-mobile-padding); }
}

/* Buttons and fields (Components section of the editor). Only when a value differs from the default. */
body.theme-custom[data-custom-components]:where(:not([data-custom-overrides]), [data-custom-overrides~="button_padding_y"]) :is(.btn:not(.btn-small), button[type="submit"]) {
  padding-block: var(--custom-button-padding-y);
}
body.theme-custom[data-custom-components]:where(:not([data-custom-overrides]), [data-custom-overrides~="button_padding_x"]) :is(.btn:not(.btn-small), button[type="submit"]) {
  padding-inline: var(--custom-button-padding-x);
}
body.theme-custom[data-custom-components]:where(:not([data-custom-overrides]), [data-custom-overrides~="button_border_width"]) :is(.btn, button[type="submit"]) {
  border-width: var(--custom-button-border-width);
}
body.theme-custom[data-custom-components]:where(:not([data-custom-overrides]), [data-custom-overrides~="button_weight"]) :is(.btn, button[type="submit"]) {
  font-weight: var(--custom-button-weight);
}
body.theme-custom[data-custom-components]:where(:not([data-custom-overrides]), [data-custom-overrides~="button_case"]) :is(.btn, button[type="submit"]) {
  text-transform: var(--custom-button-case);
}
body.theme-custom[data-custom-colors~="primary"] .btn-primary {
  background: var(--custom-button-primary-bg, var(--surface));
  color: var(--custom-button-primary-text, var(--text));
  border-color: var(--custom-button-primary-bg, var(--border));
}
body.theme-custom[data-custom-colors~="primary"] .btn-primary:hover {
  background: var(--custom-button-primary-bg-hover, var(--link));
  color: var(--custom-button-primary-text, var(--surface));
  border-color: var(--custom-button-primary-bg-hover, var(--link));
}
body.theme-custom[data-custom-colors~="primary"] .btn-primary.btn-solid:not(:disabled):not(.is-disabled) {
  background: var(--custom-button-primary-bg, var(--link));
  color: var(--custom-button-primary-text, var(--surface));
  border-color: var(--custom-button-primary-bg, var(--link));
}
body.theme-custom[data-custom-colors~="primary"] .btn-primary.btn-solid:not(:disabled):not(.is-disabled):hover {
  background: var(--custom-button-primary-bg-hover, var(--link-hover));
  color: var(--custom-button-primary-text, var(--surface));
  border-color: var(--custom-button-primary-bg-hover, var(--link-hover));
}
body.theme-custom[data-custom-components]:where(:not([data-custom-overrides]), [data-custom-overrides~="field_border_width"])
  :is(input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]):not([type="file"]), select, textarea) {
  border-width: var(--custom-field-border-width);
}
body.theme-custom[data-custom-components]:where(:not([data-custom-overrides]), [data-custom-overrides~="field_padding_y"])
  :is(input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]):not([type="file"]), select, textarea) {
  padding-block: var(--custom-field-padding-y);
}
body.theme-custom[data-custom-colors~="field"] :is(input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]):not([type="file"]), select, textarea) {
  background: var(--custom-field-bg);
}
body.theme-custom[data-custom-components]:where(:not([data-custom-overrides]), [data-custom-overrides~="field_padding_x"]) :is(input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]):not([type="file"]), textarea) {
  padding-inline: var(--custom-field-padding-x);
}
body.theme-custom[data-custom-colors~="focus"] :is(input, select, textarea):focus {
  border-color: var(--custom-focus-color);
  box-shadow: 0 0 0 4px var(--custom-focus-soft);
}
body.theme-custom[data-custom-colors~="focus"] div.input-block :is(input, select, textarea):focus {
  box-shadow: inset 0 0 0 1px var(--custom-focus-color);
}

/* Header and menus (Header and menus section of the editor). Tokens of data-custom-header. */
/* core.css hides the overflow of the body while the page scrolls in the root: clipping, unlike hiding, keeps the header from sticking to a body that never scrolls. */
body.theme-custom[data-custom-header~="sticky"] { overflow: clip; }
body.theme-custom[data-custom-header~="sticky"] .container > header {
  position: sticky; top: 0; z-index: 30;
  background: var(--custom-header-bg, var(--surface));
}
body.theme-custom[data-custom-header~="bg"] .container > header { background: var(--custom-header-bg); }
body.theme-custom[data-custom-header~="menu-pill"] .horiznav > li > :is(a, span)::before,
body.theme-custom[data-custom-header~="menu-none"] .horiznav > li > :is(a, span)::before { display: none; }
body.theme-custom[data-custom-header~="menu-pill"] .horiznav > li > :is(a, span) { border-radius: 999px; transition: background-color .15s ease, color .12s ease; }
body.theme-custom[data-custom-header~="menu-pill"] .horiznav > li > :is(a, span):is(:hover, :focus-visible, .active) { background-color: var(--custom-menu-hover); }
body.theme-custom[data-custom-header~="submenu"] .horiznav li > ul { border-radius: var(--custom-submenu-radius); box-shadow: var(--custom-submenu-shadow); }
