/* In-page drawer: chromeless embed variant of the edit form (loaded in an iframe) */
html:has(body.cms-embed) { height: 100%; overflow: hidden; }
body.cms-embed {
  --cms-form-grid-gap: var(--cms-embed-form-grid-gap);
  --cms-form-grid-padding: var(--cms-embed-form-grid-padding);
  --cms-form-section-title-padding: var(--cms-embed-form-section-title-padding);
  --cms-field-padding: var(--cms-embed-field-padding);
  --cms-field-textarea-min-height: var(--cms-embed-textarea-min-height);
  height: 100vh; height: 100dvh; margin: 0; display: flex; flex-direction: column; overflow: hidden;
  background: var(--color-canvas); box-shadow: inset 1px 0 0 var(--color-border);
}
.cms-embed-main { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.cms-embed .cms-embed-header { flex: none; padding: var(--cms-embed-header-padding); }
.cms-embed-header__top {
  display: block;
}
.cms-embed-header__title { min-width: 0; }
.cms-embed .cms-embed-header h1 {
  overflow-wrap: anywhere; margin: .15rem 0 0; font-size: var(--cms-font-size-xl);
}
.cms-embed .cms-embed-header .eyebrow { margin: 0; }
.cms-embed-header__actions {
  display: flex; align-items: center; gap: var(--cms-embed-header-actions-gap); padding-top: .1rem;
}
.cms-embed-header__actions .icon-button {
  width: var(--cms-icon-button-size-mobile); height: var(--cms-icon-button-size-mobile); border-color: transparent; background: transparent;
}
.cms-embed-header__actions .icon-button:hover,
.cms-embed-header__actions .icon-button[aria-expanded="true"] {
  border-color: transparent; background: var(--cms-bg-hover-strong); color: var(--color-text);
}
.cms-embed-header__actions .icon-button:focus-visible {
  outline: 0; border-color: var(--cms-border-accent); background: var(--color-accent-soft); color: var(--color-accent);
  box-shadow: var(--cms-focus-ring);
}
.cms-embed-header__meta {
  min-height: var(--cms-embed-meta-min-height); display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  margin-top: var(--cms-embed-meta-margin-top);
}
.cms-embed-publication-menu {
  position: relative; min-width: 0;
}
.cms-embed-publication {
  appearance: none; border: 1px solid transparent; border-radius: 999px; background: transparent; cursor: pointer;
  /* Even padding keeps the rounded hover cap clear of the dot and its glow ring;
     the matching negative margin keeps the dot optically flush with the title. */
  min-height: 2.05rem; padding: .18rem .48rem; margin-left: -.48rem;
  display: inline-flex; align-items: center; gap: .42rem; color: var(--color-muted); font: inherit; font-size: var(--cms-font-size-sm);
  transition: border-color var(--motion-fast), background var(--motion-fast), color var(--motion-fast), box-shadow var(--motion-fast);
}
.cms-embed-publication::after {
  content: ""; width: 0; height: 0; margin-left: .05rem;
  border-left: .24rem solid transparent; border-right: .24rem solid transparent; border-top: .3rem solid currentColor;
  opacity: .72;
}
.cms-embed-publication:hover,
.cms-embed-publication[aria-expanded="true"] {
  background: var(--cms-bg-hover-strong); color: var(--color-text);
}
.cms-embed-publication:focus-visible {
  outline: 0; border-color: var(--cms-border-accent); background: var(--color-accent-soft); color: var(--color-accent);
  box-shadow: var(--cms-focus-ring);
}
.cms-embed-publication__dot {
  flex: 0 0 auto; width: .48rem; height: .48rem; border-radius: 999px; background: var(--color-faint);
}
.cms-embed-publication--published .cms-embed-publication__dot {
  background: var(--color-success); box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-success) 18%, transparent);
}
.cms-embed-publication--draft {
  color: var(--color-accent);
}
.cms-embed-publication--draft .cms-embed-publication__dot {
  background: var(--color-accent); box-shadow: 0 0 0 3px var(--color-accent-soft);
}
.cms-embed-publication-menu .action-menu__panel {
  top: calc(100% + .35rem); right: auto; left: 0; bottom: auto; width: 10rem;
  transform-origin: top left;
}
.cms-embed .alert { margin: 12px 26px 0; }
.cms-embed-form { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.cms-embed-form .form-stack {
  flex: 1; min-height: 0; align-content: start; align-items: start; overflow-y: auto; padding: var(--cms-embed-form-scroll-padding);
}
.cms-reorder-list {
  flex: 1; min-height: 0; overflow-y: auto; padding: var(--cms-embed-form-scroll-padding);
}
.cms-embed-form .form-stack,
.cms-reorder-list,
.cms-embed textarea,
.cms-embed .combo__menu,
.cms-embed .CodeMirror-scroll {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--color-muted) 38%, transparent) transparent;
}
.cms-embed-form .form-stack::-webkit-scrollbar,
.cms-reorder-list::-webkit-scrollbar,
.cms-embed textarea::-webkit-scrollbar,
.cms-embed .combo__menu::-webkit-scrollbar,
.cms-embed .CodeMirror-scroll::-webkit-scrollbar {
  width: 8px; height: 8px;
}
.cms-embed-form .form-stack::-webkit-scrollbar-thumb,
.cms-reorder-list::-webkit-scrollbar-thumb,
.cms-embed textarea::-webkit-scrollbar-thumb,
.cms-embed .combo__menu::-webkit-scrollbar-thumb,
.cms-embed .CodeMirror-scroll::-webkit-scrollbar-thumb {
  border: 2px solid transparent; border-radius: 999px; background: color-mix(in srgb, var(--color-muted) 38%, transparent);
  background-clip: padding-box;
}
.cms-embed textarea {
  min-height: var(--cms-embed-textarea-min-height);
}
.cms-embed .EasyMDEContainer .CodeMirror {
  min-height: var(--cms-embed-markdown-min-height);
}
.cms-embed-actions {
  position: fixed; right: 0; bottom: 0; left: 0; z-index: 35;
  --cms-button-height: var(--cms-embed-action-button-height);
  --cms-button-padding: var(--cms-embed-action-button-padding);
  --cms-button-gap: var(--cms-embed-action-button-gap);
  flex-wrap: wrap; gap: var(--cms-embed-action-gap); padding: var(--cms-embed-action-padding);
  box-shadow: var(--cms-shadow-footer);
}
.cms-embed-actions .button {
  min-height: var(--cms-button-height); padding: var(--cms-button-padding); gap: var(--cms-button-gap); font-size: var(--cms-font-size-sm);
}
.cms-embed-actions .button .icon { width: var(--cms-embed-action-icon-size); height: var(--cms-embed-action-icon-size); }
.cms-embed-actions .save-state { min-height: 2rem; }
/* Save + state sit left; Cancel and the overflow menu are pushed to the right. */
.cms-embed-actions .cms-embed-cancel { margin-left: auto; }
.cms-embed-actions .cms-embed-more { flex: 0 0 auto; }
.cms-embed-actions .action-menu__panel {
  top: auto; bottom: calc(100% + .45rem); right: 0;
  --cms-popover-closed-transform: translateY(var(--cms-motion-shift-xs)) scale(.985);
  transform-origin: bottom right;
}
.cms-embed .button:focus-visible,
.cms-embed .icon-button:focus-visible,
.cms-embed .action-menu__panel a:focus-visible,
.cms-embed .action-menu__panel button:focus-visible,
.cms-embed .lang-tab:focus-visible,
.cms-embed .editor-toolbar button:focus-visible,
.cms-embed .help-popover summary:focus-visible,
.cms-embed .object-list__delete:focus-visible,
.cms-embed .combo__item:focus-visible {
  outline: 0; border-color: var(--cms-border-accent); background: var(--color-accent-soft); color: var(--color-accent);
  box-shadow: var(--cms-focus-ring);
}
.cms-embed .lang-tab:hover,
.cms-embed .object-list__delete:hover,
.cms-embed .combo__item:hover {
  background: var(--cms-bg-hover-strong); color: var(--color-text);
}
.cms-embed .file-control:focus-within,
.cms-embed .image-preview:focus-within,
.cms-embed .object-list:focus-within {
  border-color: var(--cms-border-accent); box-shadow: var(--cms-focus-ring);
}

@media (max-width: 560px) {
  body.cms-embed {
    --cms-form-grid-gap: var(--cms-embed-form-grid-gap-mobile);
    --cms-form-grid-padding: var(--cms-embed-form-grid-padding-mobile);
    --cms-form-section-title-padding: var(--cms-embed-form-section-title-padding-mobile);
    --cms-field-padding: var(--cms-embed-field-padding-mobile);
    --cms-field-textarea-min-height: var(--cms-embed-textarea-min-height-mobile);
    --cms-embed-header-padding: var(--cms-embed-header-padding-mobile);
    --cms-embed-header-actions-gap: var(--cms-embed-header-actions-gap-mobile);
    --cms-embed-meta-min-height: var(--cms-embed-meta-min-height-mobile);
    --cms-embed-meta-margin-top: var(--cms-embed-meta-margin-top-mobile);
    --cms-embed-form-scroll-padding: var(--cms-embed-form-scroll-padding-mobile);
    --cms-embed-textarea-min-height: var(--cms-embed-textarea-min-height-mobile);
    --cms-embed-markdown-min-height: var(--cms-embed-markdown-min-height-mobile);
    --cms-embed-action-gap: var(--cms-embed-action-gap-mobile);
    --cms-embed-action-padding: var(--cms-embed-action-padding-mobile);
    --cms-embed-action-button-height: var(--cms-touch-target);
    --cms-embed-action-button-padding: var(--cms-embed-action-button-padding-mobile);
    --cms-embed-icon-button-size-mobile: var(--cms-touch-target);
  }
  .cms-embed .cms-embed-header { padding: var(--cms-embed-header-padding); }
  .cms-embed-header__top { gap: .55rem; }
  .cms-embed-header__actions { gap: var(--cms-embed-header-actions-gap); }
  .cms-embed-header__actions .icon-button { width: var(--cms-embed-icon-button-size-mobile); height: var(--cms-embed-icon-button-size-mobile); }
  .cms-embed-publication { min-height: var(--cms-touch-target); }
  .cms-embed-header__meta { min-height: var(--cms-embed-meta-min-height); margin-top: var(--cms-embed-meta-margin-top); }
  .cms-embed .alert { margin-right: 16px; margin-left: 16px; }
  .cms-embed-form .form-stack { padding: var(--cms-embed-form-scroll-padding); }
  .cms-reorder-list { padding: var(--cms-embed-form-scroll-padding); }
  .cms-embed textarea { min-height: var(--cms-embed-textarea-min-height); }
  .cms-embed .EasyMDEContainer .CodeMirror { min-height: var(--cms-embed-markdown-min-height); }
  .cms-embed-actions { gap: var(--cms-embed-action-gap); padding: var(--cms-embed-action-padding); }
  .cms-embed-actions .button { min-height: var(--cms-embed-action-button-height); padding: var(--cms-embed-action-button-padding); }
  .cms-embed-actions .button--primary { flex: 0 0 auto; }
  .cms-embed-actions .save-state { flex: 0 1 auto; padding-inline: .35rem; }
}
