/* ===== MAKE FORMS > DESIGN: icon rail + slide-out panel (same idea as the Sign desk dock) =====
   Closed = a thin rail of icons and the Live Preview takes the whole width.
   Click an icon = its tools slide in next to the preview. Click it again (or press Esc) = gone. */

/* ---- layout: [rail] [panel, 0 when closed] [preview] ---- */
#mfEditorBodyDesign.mfr-on {
  --mfr-pw: 0px;
  grid-template-columns: 76px var(--mfr-pw) minmax(0, 1fr);
  gap: 0;
  align-items: start;
  transition: grid-template-columns .28s cubic-bezier(.2, .8, .2, 1);
}
#mfEditorBodyDesign.mfr-on.mfr-open { --mfr-pw: 392px; }

/* ---- the rail ---- */
.mfr-rail {
  position: sticky; top: 0; align-self: start; z-index: 7;
  display: flex; flex-direction: column; gap: 6px;
  padding: 8px; margin-right: 14px;
  border: 1px solid var(--border); border-radius: 22px; background: var(--bg2);
}
.mfr-btn {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px;
  width: 100%; padding: 9px 2px 7px;
  background: transparent; border: 1px solid transparent; border-radius: 14px;
  color: var(--text2); font-family: 'Inter', sans-serif; font-size: 10.5px; font-weight: 600; line-height: 1.1;
  cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
.mfr-btn svg { color: var(--cyan); display: block; }
.mfr-btn:hover, .mfr-btn.on { background: rgba(0, 194, 255, .12); border-color: rgba(0, 194, 255, .45); color: var(--text); }
.mfr-btn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.mfr-badge {
  position: absolute; top: 4px; right: 8px; min-width: 16px; height: 16px; padding: 0 4px; box-sizing: border-box;
  border-radius: 999px; background: var(--cyan); color: #04182B; font-size: 9.5px; font-weight: 800; line-height: 16px; text-align: center;
}
.mfr-badge:empty { display: none; }

/* ---- the slide-out panel (the old long left column, now one topic at a time) ---- */
.mfr-slot { min-width: 0; overflow: hidden; position: sticky; top: 0; align-self: start; }
.mfr-slot .mf-fields-panel {
  width: 378px; max-width: 100%; box-sizing: border-box; margin-right: 14px;
  padding: 0; gap: 0;
  max-height: calc(100vh - 190px); overflow-y: auto; overflow-x: hidden;
  opacity: 0; transform: translateX(-12px);
  transition: opacity .2s ease, transform .28s cubic-bezier(.2, .8, .2, 1);
}
#mfEditorBodyDesign.mfr-open .mfr-slot .mf-fields-panel { opacity: 1; transform: none; }

.mfr-head {
  position: sticky; top: 0; z-index: 8;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  height: 58px; box-sizing: border-box; padding: 0 16px 0 18px; background: var(--bg2); border-bottom: 1px solid var(--border);
}
.mfr-head b { display: block; font-family: 'Fraunces', Georgia, serif; font-size: 17px; font-weight: 600; color: var(--text); }
.mfr-head small { display: block; margin-top: 1px; font-size: 11px; color: var(--text3); }
.mfr-x {
  flex: none; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--surface2); color: var(--text2); cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.mfr-x:hover { border-color: var(--cyan); color: var(--text); }

.mfr-sec { display: none; flex-direction: column; gap: 16px; padding: 16px 18px 26px; }
.mfr-sec.on { display: flex; }

/* the old cards sit flat inside the panel */
.mfr-sec .mf-look-card { margin-bottom: 0; }
.mfr-sec .mf-brand-logo-block, .mfr-sec .mf-brand-color-block { min-width: 0; flex: none; }
.mfr-sec .mf-social-row { border-bottom: 0; padding-bottom: 0; }
.mfr-sec .mf-social-grid { grid-template-columns: 1fr; }
.mfr-sec .mf-attach-block { min-width: 0 !important; margin-top: 0 !important; }
.mfr-sec .mf-desc-row textarea { min-height: 84px; }
/* the add-a-field chips stay pinned under the panel header while the list scrolls */
.mfr-sec .mf-add-field-row { top: 58px; margin: 0 -18px; padding: 12px 18px 14px; }
.mfr-sec[data-sec="fields"] { padding-top: 0; }
.mfr-sec[data-sec="fields"] .mf-field-list { padding-top: 4px; }

/* ---- the preview gets the room ---- */
#mfEditorBodyDesign.mfr-on .mf-design-preview-col { max-width: none; }
#mfEditorBodyDesign.mfr-on .mf-design-preview-col .mf-preview-scroll {
  max-height: none; height: clamp(540px, calc(100vh - 215px), 1200px);
}
/* the Guided preview is as wide as the published page, with the content centred in it */
#mfEditorBodyDesign.mfr-on .mf-gd-host .mf-gd-screen,
#mfEditorBodyDesign.mfr-on .mf-gd-host .mf-gd-nav,
#mfEditorBodyDesign.mfr-on .mf-gd-host .mf-gd-brand {
  width: 100%; max-width: 820px; margin-left: auto; margin-right: auto; box-sizing: border-box;
}

/* ---- narrow screens: rail becomes a bar above, the panel opens under it ---- */
@media (max-width: 980px) {
  #mfEditorBodyDesign.mfr-on { grid-template-columns: minmax(0, 1fr); gap: 14px; transition: none; }
  .mfr-rail { position: static; flex-direction: row; overflow-x: auto; margin-right: 0; border-radius: 18px; }
  .mfr-btn { min-width: 66px; width: auto; flex: 1 0 auto; }
  .mfr-slot { position: static; display: none; overflow: visible; }
  #mfEditorBodyDesign.mfr-open .mfr-slot { display: block; }
  .mfr-slot .mf-fields-panel { width: 100%; margin-right: 0; max-height: 70vh; opacity: 1; transform: none; }
  #mfEditorBodyDesign.mfr-on .mf-design-preview-col .mf-preview-scroll { height: auto; max-height: 78vh; }
}
@media (prefers-reduced-motion: reduce) {
  #mfEditorBodyDesign.mfr-on, .mfr-slot .mf-fields-panel, .mfr-btn { transition: none; }
}
