/* ─────────────────────────────────────────────────────────────────────────
   designer.css - the collateral editor at /design. Loaded by that one page
   only (pages/design.php passes it through extra_head), never by
   Site::cssLinks(), because none of the other public pages should pay for
   editor chrome they never show.

   Namespaced .site-cm-* on the same rule as the rest of the public layer, and
   var(--token) only: not one hex lives in this file. The ink swatches are
   painted from --ink-* by JS, which reads them off :root - so a rebrand in
   theme.css moves the customer's own palette with it.

   THE AUDIENCE IS 50+. Every control is at least 44px on its shortest side,
   every label is a real <label>, and there is a keyboard or button path to
   everything a mouse can drag. Dragging on the canvas is the shortcut, never
   the only way in.
   ───────────────────────────────────────────────────────────────────────── */

.site-cm {
  --cm-header: 68px;              /* the sticky site header, mobile */
  --cm-bar: 128px;                /* the editor's own bar, mobile (it wraps) */
  --cm-rail-w: 320px;
  --cm-line: 1px solid var(--brand-ink-20);
  background: var(--brand-paper);
  border-block: var(--cm-line);
}
@media (min-width: 601px) { .site-cm { --cm-header: 80px; } }
@media (min-width: 901px) { .site-cm { --cm-bar: 76px; } }

/* Focus must be loud here. A customer who tabs into a 320px rail of small
   controls and cannot see where they are will use the mouse or give up. */
.site-cm :focus-visible {
  outline: 3px solid var(--brand-accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ── Top bar ──────────────────────────────────────────────────────────────── */
.site-cm-bar {
  position: sticky; top: var(--cm-header); z-index: 45;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  background: var(--white);
  border-bottom: var(--cm-line);
}
.site-cm-bar-title { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.site-cm-bar-title h1 {
  font-family: var(--font-display); font-weight: 600; font-size: 1.25rem; line-height: 1.1;
  margin: 0; color: var(--brand-primary);
}
.site-cm-bar-title p { margin: 2px 0 0; font-size: var(--fs-xs); color: var(--text-muted); }
.site-cm-back {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-width: 44px; min-height: 44px; padding-inline: var(--space-2);
  color: var(--text-soft); text-decoration: none; border: var(--cm-line); border-radius: 2px;
}
.site-cm-back:hover { color: var(--brand-accent); border-color: var(--brand-accent); text-decoration: none; }
.site-cm-back-label { font-size: var(--fs-sm); font-weight: 700; }

.site-cm-bar-tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.site-cm-group { display: flex; align-items: center; gap: var(--space-1); }
.site-cm-group--end { margin-left: auto; gap: var(--space-2); }

.site-cm-tool {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 44px; min-width: 44px; padding: 0 var(--space-3);
  background: var(--white); color: var(--brand-ink-80);
  border: var(--cm-line); border-radius: 2px;
  font-family: var(--font-body); font-weight: 700; font-size: var(--fs-sm); line-height: 1;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.site-cm-tool svg { flex: none; }
.site-cm-tool:hover:not(:disabled) { border-color: var(--brand-primary); color: var(--brand-primary); }
/* A greyed-out Undo is information: it says there is nothing to undo. Hiding it
   instead would make the button appear and disappear under the cursor. */
.site-cm-tool:disabled { opacity: .38; cursor: not-allowed; }
.site-cm-tool--icon { padding: 0; }
.site-cm-tool--icon span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.site-cm-tool--go { background: var(--brand-accent); border-color: var(--brand-accent); color: var(--white); }
.site-cm-tool--go:hover:not(:disabled) { background: var(--brand-primary); border-color: var(--brand-primary); color: var(--white); }
.site-cm-tool--danger:hover:not(:disabled) { border-color: var(--st-danger-fg); color: var(--st-danger-fg); }
.site-cm-tool[aria-pressed="true"] { background: var(--brand-primary); border-color: var(--brand-primary); color: var(--white); }

/* On a phone the bar wraps to four rows and eats a quarter of the screen while
   staying stuck to the top. The three tool groups go icon-only there; the labels
   stay in the DOM for a screen reader, and the two buttons that end the job -
   Save, Download - and the one that sends it keep their words. */
@media (max-width: 700px) {
  .site-cm-tool--tight span {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
  }
  .site-cm-tool--tight { padding: 0; }
  .site-cm-bar-title p { display: none; }
}

.site-cm-zoom select {
  min-height: 44px; min-width: 88px; padding: 0 var(--space-2);
  border: var(--cm-line); border-radius: 2px; background: var(--white);
  font-family: var(--font-body); font-weight: 700; font-size: var(--fs-sm); color: var(--brand-ink-80);
}

/* ── Body: rail + stage ───────────────────────────────────────────────────── */
.site-cm-body { display: grid; grid-template-columns: 1fr; }
@media (min-width: 901px) {
  .site-cm-body { grid-template-columns: var(--cm-rail-w) minmax(0, 1fr); align-items: start; }
}

/* ── The rail ─────────────────────────────────────────────────────────────── */
.site-cm-rail { background: var(--white); border-right: var(--cm-line); }
@media (min-width: 901px) {
  .site-cm-rail {
    position: sticky; top: calc(var(--cm-header) + var(--cm-bar));
    max-height: calc(100vh - var(--cm-header) - var(--cm-bar));
    overflow-y: auto; overscroll-behavior: contain;
  }
}
/* Under 900px the rail is a bottom sheet: the design is what you came to see, so
   it gets the screen, and the palette is one tap away at the thumb end. */
@media (max-width: 900px) {
  .site-cm-rail {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 46;
    border-right: 0; border-top: 2px solid var(--brand-primary);
    box-shadow: var(--shadow-lg);
  }
  .site-cm-rail-inner { max-height: 0; overflow: hidden; }
  .site-cm-rail.is-open .site-cm-rail-inner { max-height: 66vh; overflow-y: auto; overscroll-behavior: contain; }
  .site-cm-stage-wrap { padding-bottom: 72px; }
}

.site-cm-sheet-handle {
  display: none; width: 100%; align-items: center; justify-content: space-between;
  min-height: 56px; padding: 0 var(--space-4);
  background: var(--white); border: 0; cursor: pointer;
  font-family: var(--font-body); font-weight: 700; font-size: var(--fs-md); color: var(--brand-primary);
}
.site-cm-sheet-handle svg { transition: transform var(--transition); }
.site-cm-rail.is-open .site-cm-sheet-handle svg { transform: rotate(180deg); }
@media (max-width: 900px) { .site-cm-sheet-handle { display: flex; } }

/* ── Collapsible sections ─────────────────────────────────────────────────── */
.site-cm-sec { border-bottom: var(--cm-line); }
.site-cm-sec h2 { margin: 0; font-size: inherit; }
.site-cm-sec-head {
  display: flex; width: 100%; align-items: center; justify-content: space-between; gap: var(--space-2);
  min-height: 52px; padding: 0 var(--space-4);
  background: transparent; border: 0; cursor: pointer; text-align: left;
  font-family: var(--font-body); font-weight: 700; font-size: var(--fs-md);
  letter-spacing: .01em; color: var(--brand-primary);
}
.site-cm-sec-head:hover { background: var(--brand-paper); }
.site-cm-sec-head svg { flex: none; color: var(--text-muted); transition: transform var(--transition); }
.site-cm-sec-head[aria-expanded="true"] svg { transform: rotate(180deg); }
/* The body is hidden by the `hidden` attribute from JS, not by a CSS sibling
   rule: the button lives inside an <h2>, so it is never actually adjacent to the
   panel it controls and the selector that looked right could never match. */
.site-cm-sec-body { padding: 0 var(--space-4) var(--space-4); }

.site-cm-note { margin: 0 0 var(--space-3); font-size: var(--fs-xs); color: var(--text-muted); line-height: 1.5; }
.site-cm-subhead {
  margin: var(--space-4) 0 var(--space-2);
  font-size: var(--fs-xs); font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  color: var(--text-muted);
}

/* ── Thumbnails: templates, photos, graphics ──────────────────────────────── */
.site-cm-thumbs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
.site-cm-thumb {
  display: grid; gap: var(--space-2); justify-items: center;
  padding: var(--space-2); min-height: 44px;
  background: var(--white); border: 2px solid var(--brand-ink-20); border-radius: 2px;
  cursor: pointer; text-align: center;
  font-family: var(--font-body); font-size: var(--fs-xs); font-weight: 700; color: var(--brand-ink-80);
  transition: border-color var(--transition), background var(--transition);
}
.site-cm-thumb:hover { border-color: var(--brand-steel); }
/* The chosen template has to be obvious at a glance, not on inspection - a thin
   ring reads as a hover state and the customer re-clicks the one they are on. */
.site-cm-thumb[aria-pressed="true"] { border-color: var(--brand-accent); background: var(--brand-paper); }
.site-cm-thumb[aria-pressed="true"] .site-cm-thumb-name { color: var(--brand-accent); }
.site-cm-thumb canvas, .site-cm-thumb img {
  display: block; max-width: 100%; height: auto;
  border: 1px solid var(--brand-ink-20); background: var(--white);
}
.site-cm-thumb-name { line-height: 1.25; }

.site-cm-thumbs--photos .site-cm-thumb img { aspect-ratio: 1; object-fit: cover; width: 100%; }

.site-cm-graphic-group + .site-cm-graphic-group { margin-top: var(--space-4); }
.site-cm-graphic-group h3 {
  margin: 0 0 var(--space-2);
  font-family: var(--font-body); font-size: var(--fs-xs); font-weight: 700;
  letter-spacing: .16em; text-transform: uppercase; color: var(--text-muted);
}
.site-cm-glyphs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-2); }
.site-cm-glyph {
  display: grid; place-items: center;
  width: 100%; aspect-ratio: 1; min-height: 44px; padding: var(--space-2);
  background: var(--white); border: 2px solid var(--brand-ink-20); border-radius: 2px;
  color: var(--brand-primary); cursor: pointer;
}
.site-cm-glyph:hover { border-color: var(--brand-accent); color: var(--brand-accent); }
.site-cm-glyph svg { width: 100%; height: 100%; }

/* ── Add-text buttons and the object list ─────────────────────────────────── */
.site-cm-stack { display: grid; gap: var(--space-2); }
.site-cm-add {
  display: grid; gap: 2px; min-height: 56px; padding: var(--space-2) var(--space-3);
  background: var(--white); border: 2px solid var(--brand-ink-20); border-radius: 2px;
  cursor: pointer; text-align: left;
}
.site-cm-add:hover { border-color: var(--brand-accent); }
.site-cm-add b { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; color: var(--brand-primary); }
.site-cm-add span { font-size: var(--fs-xs); color: var(--text-muted); }

.site-cm-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-1); }
.site-cm-list button {
  display: grid; gap: 2px; width: 100%; min-height: 44px; padding: var(--space-2) var(--space-3);
  background: var(--white); border: 1px solid var(--brand-ink-20); border-radius: 2px;
  cursor: pointer; text-align: left;
}
.site-cm-list button:hover { border-color: var(--brand-accent); }
.site-cm-list button[aria-current="true"] { border-color: var(--brand-accent); background: var(--brand-paper); }
.site-cm-list .k { font-size: var(--fs-xs); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); }
.site-cm-list .v { font-size: var(--fs-sm); color: var(--brand-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Upload ───────────────────────────────────────────────────────────────── */
.site-cm-upload {
  position: relative; display: grid; gap: var(--space-1); place-items: center; text-align: center;
  min-height: 120px; padding: var(--space-4);
  border: 2px dashed var(--brand-ink-20); background: var(--brand-paper); cursor: pointer;
  color: var(--brand-ink-80);
}
.site-cm-upload:hover, .site-cm-upload:focus-within { border-color: var(--brand-accent); background: var(--white); }
.site-cm-upload b { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; }
.site-cm-upload span { font-size: var(--fs-xs); color: var(--text-muted); }
.site-cm-upload input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.site-cm-hidden-file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* ── Colours ──────────────────────────────────────────────────────────────── */
.site-cm-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin-bottom: var(--space-3); }
.site-cm-switch button {
  min-height: 44px; padding: 0 var(--space-2);
  background: var(--white); border: 1px solid var(--brand-ink-20); cursor: pointer;
  font-family: var(--font-body); font-weight: 700; font-size: var(--fs-xs); color: var(--text-soft);
}
.site-cm-switch button + button { border-left: 0; }
.site-cm-switch button[aria-pressed="true"] { background: var(--brand-primary); border-color: var(--brand-primary); color: var(--white); }

.site-cm-swatches { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--space-2); }
.site-cm-swatch {
  width: 100%; aspect-ratio: 1; min-height: 44px;
  border: 2px solid var(--brand-ink-20); border-radius: 2px; cursor: pointer;
  background: var(--cm-swatch);
}
.site-cm-swatch:hover { border-color: var(--brand-primary); }

.site-cm-more {
  grid-column: 1 / -1; min-height: 44px; border: 2px dashed var(--brand-ink-20); border-radius: 4px;
  background: none; color: var(--brand-primary); font-weight: 700; cursor: pointer;
}
.site-cm-more:hover { border-color: var(--brand-primary); }

/* ── Ask for a change (the idle state of the context bar) ─────────────────── */
.site-cm-ask { display: flex; align-items: center; gap: var(--space-2); flex: 1 1 100%; }
.site-cm-ask input {
  flex: 1 1 auto; min-width: 0; min-height: 44px; padding: 0 var(--space-3);
  border: var(--cm-line); border-radius: 22px; background: var(--white); font: inherit; font-size: var(--fs-md);
}
.site-cm-ask input:focus { outline: none; border-color: var(--brand-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-accent) 18%, transparent); }
.site-cm-ask-clip { position: relative; width: 44px; height: 44px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 22px; background: var(--brand-card); color: var(--brand-primary); cursor: pointer; }
.site-cm-ask-clip input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.site-cm-ask-chip { position: relative; flex: 0 0 auto; }
.site-cm-ask-chip[hidden] { display: none; }
.site-cm-ask-chip img { display: block; width: 44px; height: 44px; object-fit: cover; border-radius: 8px; border: 2px solid var(--brand-accent); }
.site-cm-ask-chip button { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border: 0; border-radius: 50%; background: var(--brand-primary); color: var(--white); font-size: 15px; line-height: 1; cursor: pointer; }
.site-cm-ask-mic, .site-cm-ask-go {
  min-height: 44px; border-radius: 22px; border: 0; cursor: pointer; font: inherit; font-weight: 700;
}
.site-cm-ask-mic { width: 44px; display: grid; place-items: center; background: var(--brand-card); color: var(--brand-primary); }
.site-cm-ask-mic[aria-pressed="true"] { background: var(--ink-red); color: var(--white); }
.site-cm-ask-go { padding: 0 var(--space-4); background: var(--brand-primary); color: var(--white); white-space: nowrap; }
.site-cm-ask[aria-busy="true"] .site-cm-ask-go { opacity: .6; cursor: progress; }

/* ── Quick actions beside the selection (designer.js showPop) ─────────────── */
.site-cm-pop {
  position: absolute; left: 0; top: 0; z-index: 5; transform: translate(var(--pop-x, 0), var(--pop-y, 0));
  display: grid; gap: 6px; padding: 8px; max-width: min(380px, calc(100% - 8px));
  background: var(--white); border: 1px solid var(--brand-ink-20); border-radius: 10px;
  box-shadow: 0 10px 28px rgba(19, 47, 96, .18);
}
.site-cm-pop[hidden] { display: none; }
.site-cm-pop-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.site-cm-pop-btn {
  min-height: 36px; padding: 0 10px; border: 1px solid var(--brand-ink-20); border-radius: 18px;
  background: var(--white); color: var(--brand-primary); font: inherit; font-size: .875rem; font-weight: 600; cursor: pointer;
}
.site-cm-pop-btn:hover { border-color: var(--brand-accent); }
.site-cm-pop-btn.is-key { background: var(--brand-primary); color: var(--white); border-color: var(--brand-primary); }
.site-cm-pop-btn.is-serif { font-family: 'Newsreader', Georgia, serif; }
.site-cm-pop-btn.is-script { font-family: 'Great Vibes', cursive; font-size: 1.15rem; font-weight: 400; }
.site-cm-pop-btn.is-bold { font-family: 'Oswald', sans-serif; letter-spacing: .02em; }
.site-cm-pop-dots { display: inline-flex; gap: 6px; }
.site-cm-pop-dot {
  width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--brand-ink-20); background: var(--cm-swatch); cursor: pointer; padding: 0;
}
.site-cm-pop-dot[aria-pressed="true"] { border-color: var(--brand-primary); box-shadow: 0 0 0 2px var(--white) inset; }

/* ── Saved-on-our-side bar under the title (designer.js draft) ──────────── */
.site-cm-savebar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 2px; font-size: .8125rem; }
.site-cm-savebar[hidden] { display: none; }
.site-cm-savebar-state { color: var(--ink-green); font-weight: 700; }
.site-cm-savebar-state::before { content: "\2713  "; }
.site-cm-savebar > button { padding: 0; border: 0; background: none; color: var(--brand-accent); font: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.site-cm-savebar-email { display: flex; gap: 6px; flex-basis: 100%; }
.site-cm-savebar-email[hidden] { display: none; }
.site-cm-savebar-email input { min-height: 36px; padding: 0 10px; border: var(--cm-line); border-radius: 18px; font: inherit; min-width: 0; flex: 1 1 200px; }
.site-cm-savebar-email button { min-height: 36px; padding: 0 14px; border: 0; border-radius: 18px; background: var(--brand-primary); color: var(--white); font: inherit; font-weight: 700; cursor: pointer; }

/* ── Generated options (staff) ───────────────────────────────────────────── */
.site-cm-options { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.site-cm-options span { font-weight: 700; font-size: var(--fs-sm); color: var(--text-soft); margin-right: var(--space-1); }
.site-cm-options button {
  min-height: 40px; padding: 0 var(--space-3); border: 2px solid var(--brand-ink-20); border-radius: 20px;
  background: var(--white); color: var(--brand-primary); font: inherit; font-weight: 700; cursor: pointer;
}
.site-cm-options button[aria-pressed="true"] { border-color: var(--brand-primary); background: var(--brand-card); }

/* ── Colours and type ─────────────────────────────────────────────────────── */
.site-cm-pals { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: var(--space-2); }
.site-cm-pal {
  display: grid; grid-template-columns: repeat(4, 1fr); min-height: 44px; padding: 0;
  border: 2px solid var(--brand-ink-20); border-radius: 4px; overflow: hidden; cursor: pointer; background: none;
}
.site-cm-pal i { background: var(--cm-swatch); }
.site-cm-pal:hover { border-color: var(--brand-steel); }
.site-cm-pal[aria-pressed="true"] { border-color: var(--brand-primary); box-shadow: 0 0 0 2px var(--brand-card); }
.site-cm-typesets { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: var(--space-2); margin-top: var(--space-3); }
.site-cm-typeset {
  display: grid; justify-items: start; gap: 2px; min-height: 56px; padding: var(--space-2) var(--space-3);
  border: 2px solid var(--brand-ink-20); border-radius: 4px; background: none; cursor: pointer; text-align: left; color: inherit;
}
.site-cm-typeset b { font-family: var(--cm-font); font-size: 1.5rem; font-weight: 600; line-height: 1; }
.site-cm-typeset span { font-size: 0.8125rem; color: var(--brand-ink-80); }
.site-cm-typeset[aria-pressed="true"] { border-color: var(--brand-primary); }

/* ── Stage ────────────────────────────────────────────────────────────────── */
.site-cm-stage-wrap { display: grid; gap: var(--space-3); padding: var(--space-4); min-width: 0; }

.site-cm-restore {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--white); border-left: 3px solid var(--brand-accent);
}
.site-cm-restore p { margin: 0; font-size: var(--fs-sm); color: var(--text-soft); }

.site-cm-stage {
  display: grid; place-items: center;
  padding: var(--space-5) var(--space-4);
  background: var(--brand-paper-2);
  overflow: auto;
  /* A press sheet on a light table. The dot grid is the same one the hero uses,
     so the editor reads as part of the site rather than a bolted-on tool. */
  background-image: radial-gradient(var(--brand-ink-20) 1px, transparent 1.2px);
  background-size: 18px 18px;
}
.site-cm-paper { position: relative; box-shadow: var(--shadow-lg); background: var(--white); }
.site-cm-paper canvas { display: block; }

/* ── Guides ───────────────────────────────────────────────────────────────── */
/* Drawn in the DOM, never on the canvas. A guide that lives as a canvas object
   is a guide that prints - and a red trim line baked into a customer's Christmas
   card is a reprint the shop pays for. */
.site-cm-guides { position: absolute; inset: 0; pointer-events: none; }
.site-cm-guides[hidden] { display: none; }
.site-cm-guide { position: absolute; }
.site-cm-guide span {
  position: absolute; top: 0; left: 0; transform: translateY(-100%);
  padding: 1px 4px; font-family: var(--font-body); font-size: 10px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; line-height: 1.4; white-space: nowrap;
  color: var(--white);
}
.site-cm-guide--bleed { inset: 0; outline: 1px dashed var(--brand-steel); outline-offset: -1px; }
.site-cm-guide--bleed span { background: var(--brand-steel); }
.site-cm-guide--trim { inset: var(--cm-trim, 0); outline: 1px solid var(--brand-accent-bright); outline-offset: -1px; }
.site-cm-guide--trim span { background: var(--brand-accent); }
.site-cm-guide--safe { inset: var(--cm-safe, 0); outline: 1px dashed var(--ink-cyan); outline-offset: -1px; }
.site-cm-guide--safe span { background: var(--ink-cyan); }
/* Labels stack outside the sheet at the top; at small zoom they would sit on top
   of one another, so only the trim label survives on a narrow screen. */
.site-cm-guide--safe span, .site-cm-guide--bleed span { display: none; }
@media (min-width: 601px) { .site-cm-guide--safe span, .site-cm-guide--bleed span { display: block; } }
.site-cm-guide--trim span { left: auto; right: 0; }
.site-cm-guide--safe span { top: 100%; transform: none; }

/* ── Selection context bar ────────────────────────────────────────────────── */
.site-cm-context {
  /* One compact bar: the words box sits IN the row beside the controls rather
     than under it, so the bar is one control tall in every state. designer.js
     still measures the tallest state and holds the bar at it, so selecting
     something never shoves the design down the page. */
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-3);
  min-height: 56px;
  padding: var(--space-2) var(--space-3);
  background: var(--white); border: var(--cm-line); border-left: 3px solid var(--brand-primary);
}
.site-cm-context > .site-cm-context-row { flex: 1 1 auto; }
.site-cm-context > .site-cm-ctl--words { order: -1; flex: 1 1 260px; }
.site-cm-context-idle { margin: 0; align-self: center; max-width: 68ch; font-size: var(--fs-sm); color: var(--text-soft); }
.site-cm-context-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-3); }
.site-cm-context-what {
  font-family: var(--font-body); font-weight: 700; font-size: var(--fs-xs);
  letter-spacing: .14em; text-transform: uppercase; color: var(--brand-accent);
  align-self: center; margin-right: auto;
}
.site-cm-ctl { display: grid; gap: var(--space-1); }
.site-cm-ctl > span { font-size: var(--fs-xs); font-weight: 700; color: var(--text-muted); }
.site-cm-ctl input[type="number"] {
  width: 84px; min-height: 44px; padding: 0 var(--space-2);
  border: var(--cm-line); border-radius: 2px; background: var(--white);
  font-family: var(--font-body); font-size: var(--fs-md);
}
.site-cm-ctl input[type="color"] {
  width: 56px; height: 44px; padding: 2px; border: var(--cm-line); border-radius: 2px;
  background: var(--white); cursor: pointer;
}
.site-cm-ctl--acts { display: flex; gap: var(--space-1); align-items: flex-end; }
.site-cm-ctl--words { grid-template-columns: 1fr; }
.site-cm-ctl--words textarea {
  width: 100%; min-height: 44px; max-height: 96px; padding: var(--space-2) var(--space-3);
  border: var(--cm-line); border-radius: 2px; background: var(--white); resize: vertical;
  font-family: var(--font-body); font-size: var(--fs-md); line-height: 1.4;
}
.site-cm-ctl--words textarea:focus { border-color: var(--brand-accent); }
.site-cm-seg { display: flex; }
.site-cm-seg button {
  min-height: 44px; padding: 0 var(--space-3);
  background: var(--white); border: 1px solid var(--brand-ink-20); cursor: pointer;
  font-family: var(--font-body); font-weight: 700; font-size: var(--fs-sm); color: var(--text-soft);
}
.site-cm-seg button + button { border-left: 0; }
.site-cm-seg button[aria-pressed="true"] { background: var(--brand-primary); border-color: var(--brand-primary); color: var(--white); }

/* ── Status line ──────────────────────────────────────────────────────────── */
/* One live region for every message the editor has: saved, exported, clamped,
   out of storage. A toast that fades is the wrong shape for a message like
   "exported at 293 dpi" - it is a fact about the file, and it should stay put. */
.site-cm-status {
  /* Pinned where the eye is, not at the foot of the page: every save, export,
     change and error shows here, and stays until the next or until it is read. */
  position: fixed; left: 50%; bottom: 24px; z-index: 60; transform: translateX(-50%);
  max-width: min(640px, calc(100% - 32px)); margin: 0; padding: 12px 20px; border-radius: 24px;
  background: var(--brand-primary); color: var(--white); box-shadow: 0 10px 30px rgba(19, 47, 96, .3);
  font-size: var(--fs-sm); font-weight: 700; text-align: center;
}
.site-cm-status:empty, .site-cm-status.is-gone { display: none; }
.site-cm-status.is-ok { background: var(--ink-green); }
.site-cm-status.is-bad { background: var(--ink-red); }
@media (prefers-reduced-motion: no-preference) {
  .site-cm-status.is-new { animation: site-cm-pill .25s ease-out; }
}
@keyframes site-cm-pill { from { opacity: 0; transform: translate(-50%, 8px); } }
@media (max-width: 900px) { .site-cm-status { bottom: 96px; } }

.site-cm-noscript {
  margin: 0; padding: var(--space-5) var(--space-4);
  background: var(--white); border-left: 3px solid var(--brand-accent); font-size: var(--fs-md);
}

@media (prefers-reduced-motion: reduce) {
  .site-cm * { transition: none !important; animation: none !important; }
}

/* ── Design faces (SIL OFL, self-hosted, static weights - Designer::fonts()) ──
   Only this page loads them: they are the customer's type, not the site's. */
@font-face { font-family: 'Cormorant Garamond'; src: url('../fonts/cormorant-garamond-500.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Cormorant Garamond'; src: url('../fonts/cormorant-garamond-700.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Playfair Display'; src: url('../fonts/playfair-display-400.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Playfair Display'; src: url('../fonts/playfair-display-700.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Libre Baskerville'; src: url('../fonts/libre-baskerville-400.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Libre Baskerville'; src: url('../fonts/libre-baskerville-700.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Great Vibes'; src: url('../fonts/great-vibes-400.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Montserrat'; src: url('../fonts/montserrat-500.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Montserrat'; src: url('../fonts/montserrat-800.woff2') format('woff2'); font-weight: 800; font-style: normal; font-display: swap; }
@font-face { font-family: 'Oswald'; src: url('../fonts/oswald-500.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Oswald'; src: url('../fonts/oswald-700.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }

/* Phones: the context bar is as tall as its content (designer.js skips the
   reserved height below 900px), and the ask box sits on one compact line. */
@media (max-width: 900px) {
  .site-cm-context { min-height: 0; }
  .site-cm-ask-go { padding: 0 var(--space-3); }
  .site-cm-ask input { font-size: 1rem; }
}
