/* Copy editing UI. Blue marks the editing tool so it can't be mistaken for the wireframe itself. */
:root {
  --copy-accent: #1d4ed8;
  --copy-accent-soft: rgba(29, 78, 216, .08);
}

/* Hide copy until saved edits are applied, so the old text doesn't flash. Removed after 700ms at most. */
html.copy-pending body > header,
html.copy-pending body > main,
html.copy-pending body > footer { visibility: hidden; }

/* ---------------------------------------------------------------- page */
.copy-editing [contenteditable='true'] {
  outline: 1px dashed transparent;
  outline-offset: 3px;
  cursor: text;
  transition: outline-color .12s, background-color .12s;
}
.copy-editing [contenteditable='true']:hover { outline-color: var(--copy-accent); }
.copy-editing [contenteditable='true']:focus { outline: 2px solid var(--copy-accent); background: var(--copy-accent-soft); }
.copy-editing [data-copy-edited] { box-shadow: inset 3px 0 0 var(--copy-accent); padding-left: 6px; }
.copy-flash { outline: 3px solid var(--copy-accent) !important; outline-offset: 4px; }

/* Room for the bar so it never covers the footer. */
.copy-editing { padding-bottom: 120px; }

.wirebar button[data-copy-toggle][aria-pressed='true'] { background: var(--copy-accent); color: #fff; }

/* ----------------------------------------------------------------- bar */
.copybar {
  display: none;
  position: fixed;
  left: 50%;
  bottom: 64px;
  transform: translateX(-50%);
  z-index: 960;
  align-items: center;
  gap: 4px;
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 6px 6px 6px 14px;
  background: var(--copy-accent);
  color: #fff;
  font: 500 12.5px/1.35 var(--font-grotesque, system-ui, sans-serif);
  box-shadow: 0 6px 24px rgba(0, 0, 0, .18);
}
.copy-editing .copybar { display: flex; }
.copybar__who { font-weight: 700; white-space: nowrap; margin-right: 8px; }
.copybar__hint { opacity: .85; margin-right: 8px; }
.copybar button,
.copypanel button,
.copylogin button {
  appearance: none;
  font: inherit;
  cursor: pointer;
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  padding: 7px 12px;
  white-space: nowrap;
}
.copybar button:hover { background: rgba(255, 255, 255, .16); }
.copybar button[data-act='done'] { background: #fff; color: var(--copy-accent); border-color: #fff; }

/* --------------------------------------------------------------- panel */
.copypanel {
  position: fixed;
  right: 16px;
  bottom: 120px;
  z-index: 961;
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100vh - 180px);
  overflow: auto;
  background: #fff;
  color: #111;
  border: 1px solid #d5d5d5;
  box-shadow: 0 10px 36px rgba(0, 0, 0, .18);
  font: 400 13px/1.45 var(--font-grotesque, system-ui, sans-serif);
}
.copypanel[hidden] { display: none; }
.copypanel__head {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: #fff;
  border-bottom: 1px solid #ebebeb;
}
.copypanel__head button { border: 0; font-size: 20px; line-height: 1; padding: 2px 6px; }
.copypanel__empty { padding: 16px 14px; color: #5a5a5a; margin: 0; }
.copypanel__item { padding: 12px 14px; border-bottom: 1px solid #ebebeb; }
.copypanel__item p { margin: 0 0 6px; }
.copypanel__meta { color: #8c8c8c; font-size: 11.5px; }
.copypanel__was,
.copypanel__now { display: grid; grid-template-columns: 40px 1fr; gap: 8px; }
.copypanel__was { color: #8c8c8c; text-decoration: line-through; }
.copypanel__was span,
.copypanel__now span { text-decoration: none; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; padding-top: 2px; }
.copypanel__now span { color: var(--copy-accent); }
.copypanel__acts { display: flex; gap: 6px; justify-content: flex-end; margin-top: 4px; }
.copypanel__acts button { padding: 5px 10px; font-size: 12px; color: var(--copy-accent); }

/* --------------------------------------------------------------- toast */
.copytoast {
  position: fixed;
  left: 50%;
  top: 18px;
  transform: translate(-50%, -12px);
  z-index: 970;
  padding: 9px 16px;
  background: #111;
  color: #fff;
  font: 500 13px/1.3 var(--font-grotesque, system-ui, sans-serif);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s, transform .18s;
}
.copytoast.is-on { opacity: 1; transform: translate(-50%, 0); }
.copytoast.is-bad { background: #b91c1c; }

/* --------------------------------------------------------------- login */
.copylogin {
  width: min(400px, calc(100vw - 32px));
  padding: 28px;
  border: 1px solid #d5d5d5;
  color: #111;
  background: #fff;
  font: 400 14px/1.5 var(--font-grotesque, system-ui, sans-serif);
}
.copylogin::backdrop { background: rgba(17, 17, 17, .45); }
.copylogin h2 { margin: 0 0 8px; font-size: 20px; line-height: 1.2; }
.copylogin p { margin: 0 0 16px; color: #5a5a5a; }
.copylogin label { display: block; margin-bottom: 12px; font-weight: 600; font-size: 13px; }
.copylogin input {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 10px 12px;
  border: 1px solid #8c8c8c;
  font: inherit;
  font-weight: 400;
  box-sizing: border-box;
}
.copylogin input:focus { outline: 2px solid var(--copy-accent); outline-offset: 1px; }
.copylogin__err { color: #b91c1c !important; min-height: 1.5em; margin-bottom: 8px !important; }
.copylogin__row { display: flex; justify-content: flex-end; gap: 8px; }
.copylogin .is-primary { background: var(--copy-accent); border-color: var(--copy-accent); color: #fff; }

@media (max-width: 760px) {
  .copybar { bottom: 56px; flex-wrap: wrap; justify-content: flex-end; }
  .copybar__hint { display: none; }
  .copybar__who { flex: 1; }
  .copypanel { right: 16px; bottom: 160px; max-height: calc(100vh - 240px); }
}

@media (prefers-reduced-motion: reduce) {
  .copytoast, .copy-editing [contenteditable='true'] { transition: none; }
}
