/* --------------------------------------------------------------------------
   Review overlay — a thin yellow ring around every block edited in a round
   of client feedback, so the edits can be walked through on the live page.

   Off unless <html> carries .show-edits, which edits.js only adds for
   ?edits=1 or the toggle button. A visitor who never asks for it is served
   the ordinary page, byte for byte.

   Everything here draws with `outline`, never `border` or `margin`: an
   outline is painted outside the box and takes no space, so switching the
   layer on cannot move a single pixel of the real layout. That is the whole
   point — what the client sees ringed is exactly what ships once the rings
   come off.

   Remove the layer for good with: python3 tools/unmark-edits.py
   -------------------------------------------------------------------------- */

html.show-edits [data-edit] {
  outline: 1px solid var(--yellow);
  outline-offset: 5px;
  border-radius: 3px;
  /* Anchors the number badge. No offsets, so nothing shifts. */
  position: relative;
}

/* On the blue sections the yellow is already loud; keep the same weight but
   let it sit a touch brighter so it does not read as a rendering artefact. */
html.show-edits .drench [data-edit],
html.show-edits .hero [data-edit] {
  outline-color: var(--yellow);
}

/* The number of her comment, small enough to ignore while reading. */
html.show-edits [data-edit]::after {
  content: "№" attr(data-edit);
  position: absolute;
  top: -0.65rem;
  right: -0.4rem;
  z-index: var(--z-sticky);
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  background: var(--yellow);
  color: var(--blue);
  font-family: var(--font-body);
  font-size: 0.62rem;
  font-weight: 700;
  font-style: normal;
  line-height: 1.5;
  letter-spacing: 0.04em;
  text-transform: none;
  pointer-events: none;
  white-space: nowrap;
}

/* What the block used to say, on hover. Built from the data attributes so a
   new round of edits needs no new CSS. */
html.show-edits [data-edit-was]::before {
  content: "Було: " attr(data-edit-was);
  position: absolute;
  bottom: calc(100% + 0.75rem);
  left: 0;
  z-index: var(--z-header);
  max-width: min(34rem, 80vw);
  width: max-content;
  padding: 0.45rem 0.7rem;
  border-radius: 8px;
  background: var(--blue);
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 400;
  font-style: normal;
  line-height: 1.45;
  letter-spacing: 0;
  text-align: left;
  text-transform: none;
  white-space: normal;
  opacity: 0;
  visibility: hidden;
  transition: opacity 140ms ease;
  pointer-events: none;
}

html.show-edits [data-edit-was]:hover::before,
html.show-edits [data-edit-was]:focus-within::before {
  opacity: 1;
  visibility: visible;
}

/* Blocks near the right edge would push the label off screen. */
html.show-edits [data-edit-side="right"]::before {
  left: auto;
  right: 0;
}

/* --- the toggle, built by edits.js ---------------------------------------- */

.editbar {
  position: fixed;
  z-index: var(--z-menu);
  left: var(--gutter);
  bottom: var(--gutter);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.4rem 0.3rem 0.7rem;
  border: 1.5px solid var(--blue);
  border-radius: 999px;
  background: var(--yellow);
  color: var(--blue);
  font-family: var(--font-body);
  font-size: 0.76rem;
  line-height: 1.3;
  box-shadow: 0 2px 14px oklch(0.316 0.209 269 / 0.18);
}

.editbar__count {
  font-weight: 700;
}

.editbar__btn {
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  padding: 0.2rem 0.6rem;
  border: 1.5px solid var(--blue);
  border-radius: 999px;
  background: var(--blue);
  color: var(--yellow);
}

.editbar__btn:hover {
  background: transparent;
  color: var(--blue);
}

/* Hidden state: the bar stays, so whoever is presenting can switch back. */
html:not(.show-edits) .editbar {
  background: var(--paper-raise);
  color: var(--ink-muted, var(--blue));
}

html:not(.show-edits) .editbar__btn {
  background: transparent;
  color: var(--blue);
}

@media print {
  .editbar {
    display: none;
  }
}
