/**
 * Promotion popup — plugin styles.
 *
 * Two palettes, on purpose:
 *
 *  - What visitors see (the dialog) uses the theme's custom properties, so the
 *    popup looks like part of the site.
 *  - What the owner sees while editing (the inline panel) uses the engine's
 *    --cms-ui-* chrome colours, so it reads as tooling rather than content.
 *
 * A theme can override anything here, or replace the markup entirely with
 * theme/blocks/promo.php.
 */

/* ------------------------------------------------------- what visitors see */

dialog.promo {
  max-width: min(512px, calc(100vw - 32px));
  padding: var(--xmedium, 30px) 20px 40px;
  border: 0;
  border-radius: 5px;
  background: var(--white, #fff);
  color: #545454;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .12);
  text-align: center;
}

dialog.promo::backdrop { background: rgba(0, 0, 0, .4); }

.promo__title {
  font-family: var(--body, inherit);
  font-size: 1.875em;
  font-weight: 600;
  line-height: 2rem;
  color: #595959;
  margin-bottom: var(--medium, 15px);
  text-wrap: balance;
}

.promo__text { font-size: 1.125em; }
.promo__text > * + * { margin-top: var(--medium, 15px); }

dialog.promo .promo__close {
  margin-top: var(--xmedium, 30px);
  padding: 10px 18px;
  border: 0;
  border-radius: 10px;
  background: var(--secondary, #ebc384);
  color: var(--on-secondary, #5b1e11);
  font: inherit;
  cursor: pointer;
  transition: background .3s ease-in-out;
}

dialog.promo .promo__close:hover { background: var(--primary, #e19418); }

/* ------------------------------------------------------- what the owner sees */

/*
 * In edit mode the dialog would be in the way, so the same text appears as an
 * inline panel — which also keeps it reachable while the promotion is off.
 *
 * One row of chrome at the top, then the promotion below exactly as a visitor
 * would see it. The two are visually separate so it is obvious which part is
 * the site and which part is the editor.
 */
.promo-edit {
  max-width: 620px;
  margin: var(--large, 45px) auto 0;
  background: var(--white, #fff);
  border: 2px solid var(--cms-ui-accent, #5b9dff);
  border-radius: 4px;
  overflow: hidden;
  text-align: center;
}

.promo-edit__bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  background: var(--cms-ui-accent-soft, rgba(91, 157, 255, .12));
  border-bottom: 1px solid var(--cms-ui-accent-soft, rgba(91, 157, 255, .12));
  text-align: left;
}

.promo-edit__state {
  font-family: var(--cms-ui-sans, sans-serif);
  font-size: 12.5px;
  line-height: 1.3;
  color: var(--cms-ui-accent, #5b9dff);
}

.promo-edit__body { padding: var(--xmedium, 30px); }
.promo-edit__button { margin: var(--xmedium, 30px) 0 0; }

.promo-edit .promo__title,
.promo-edit .promo__text { color: var(--on-background, #2b2724); }

.promo-edit__button span {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 10px;
  background: var(--secondary, #ebc384);
  color: var(--on-secondary, #5b1e11);
}

/* Switched off: the controls stay fully legible, only the preview dims. */
.promo-edit.cms-flag-off {
  border-style: dashed;
  border-color: var(--cms-ui-muted, #98a3bb);
}

.promo-edit.cms-flag-off .promo-edit__bar {
  background: rgba(0, 0, 0, .04);
  border-bottom-color: rgba(0, 0, 0, .08);
}

.promo-edit.cms-flag-off .promo-edit__state { color: var(--cms-ui-muted, #98a3bb); }
.promo-edit.cms-flag-off .promo-edit__body { opacity: .45; }

@media print {
  dialog.promo { display: none; }
}
