/* Visual editor: footer entry + login modal + frame adjust + edit chrome */

#visual-editor {
  position: relative;
  z-index: 10000;
}

.ve-bar {
  position: fixed;
  top: 0.75rem;
  right: 0.75rem;
  left: auto;
  bottom: auto;
  transform: none;
  width: auto;
  max-width: min(440px, calc(100% - 1.5rem));
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem 0.65rem;
  padding: 0.45rem 0.55rem;
  border-radius: 12px;
  background: rgba(28, 24, 22, 0.94);
  color: #f7f1ec;
  box-shadow: 0 10px 28px rgba(20, 16, 14, 0.28);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.ve-bar[hidden] {
  display: none !important;
}

.ve-bar__left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.65rem;
  min-width: 0;
}

.ve-bar__brand {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.8;
}

.ve-user {
  font-size: 0.75rem;
  opacity: 0.72;
}

.ve-status {
  font-size: 0.75rem;
  opacity: 0.9;
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ve-status--ok {
  color: #b7e0c2;
}

.ve-status--err {
  color: #f0b4b4;
}

.ve-bar__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.ve-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  border-radius: 999px;
  padding: 0.4rem 0.7rem;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.ve-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.ve-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ve-btn--primary {
  background: #c17a85;
  border-color: transparent;
}

.ve-btn--primary:hover {
  background: #a96470;
}

.ve-btn--accent {
  background: #e8d7c8;
  color: #2a221f;
  border-color: transparent;
}

.ve-login,
.ve-frame {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(18, 14, 12, 0.28);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.ve-login[hidden],
.ve-frame[hidden] {
  display: none !important;
}

html.ve-login-open body > *:not(#visual-editor),
html.ve-frame-open body > *:not(#visual-editor) {
  filter: blur(6px);
  pointer-events: none;
  user-select: none;
}

.ve-login__card,
.ve-frame__card {
  width: min(380px, 100%);
  background: #faf6f2;
  color: #2a221f;
  border-radius: 18px;
  padding: 1.25rem 1.35rem 1.35rem;
  display: grid;
  gap: 0.75rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  pointer-events: auto;
}

.ve-frame__card {
  width: min(460px, 100%);
}

.ve-login__card h3,
.ve-frame__card h3 {
  margin: 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.55rem;
}

.ve-login__card p,
.ve-frame__card > p {
  margin: 0;
  font-size: 0.9rem;
  opacity: 0.78;
}

.ve-login__card label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
}

.ve-login__card input {
  border: 1px solid rgba(42, 34, 31, 0.18);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  font: inherit;
  background: #fff;
}

.ve-login__error,
.ve-frame__error {
  color: #a33b3b !important;
  opacity: 1 !important;
  font-size: 0.85rem !important;
}

.ve-login__actions,
.ve-frame__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.45rem;
  margin-top: 0.25rem;
}

.ve-login__actions .ve-btn,
.ve-frame__actions .ve-btn {
  color: #2a221f;
  border-color: rgba(42, 34, 31, 0.16);
  background: #fff;
}

.ve-login__actions .ve-btn--primary,
.ve-frame__actions .ve-btn--primary {
  color: #fff;
  background: #c17a85;
  border-color: transparent;
}

.ve-frame__stage {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: 14px;
  background: #ddd5ce;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.ve-frame__stage.is-dragging {
  cursor: grabbing;
}

.ve-frame__stage img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--ve-x, 50%) var(--ve-y, 50%);
  transform-origin: var(--ve-x, 50%) var(--ve-y, 50%);
  transform: scale(var(--ve-zoom, 1));
  display: block;
  pointer-events: none;
  user-select: none;
}

.ve-frame__zoom {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.55rem;
  align-items: center;
  font-size: 0.82rem;
  font-weight: 600;
}

.ve-frame__zoom input[type="range"] {
  width: 100%;
}

body.is-visual-editing .ve-target,
body.is-visual-editing .ve-img-host {
  outline: 2px dashed rgba(193, 122, 133, 0.75);
  outline-offset: 3px;
}

body.is-visual-editing .ve-target--rel,
body.is-visual-editing .ve-img-host {
  position: relative;
}

body.is-visual-editing .ve-target.is-ve-active,
body.is-visual-editing .ve-img-host:has(img.is-ve-active),
body.is-visual-editing .ve-img-host:has(video.is-ve-active),
body.is-visual-editing .ve-img-host.is-ve-active {
  outline-color: #c17a85;
  outline-style: solid;
  background: rgba(193, 122, 133, 0.06);
}

body.is-visual-editing .ve-hit {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  z-index: 20;
  border: 0;
  border-radius: 999px;
  padding: 0.35rem 0.65rem;
  background: #2a221f;
  color: #fff;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  pointer-events: auto;
}

body.is-visual-editing .ve-hit:hover {
  background: #c17a85;
}

body.is-visual-editing a.ve-target,
body.is-visual-editing .ve-target a {
  pointer-events: none;
}

body.is-visual-editing .ve-target[contenteditable="true"] {
  pointer-events: auto;
  caret-color: #c17a85;
}

/* Zoom must crop inside the card — never grow the card */
.ve-img-host,
.book-card__media,
.look,
.about__media,
.contacts__visual,
.course-card__media {
  overflow: hidden !important;
  contain: paint;
}

body.is-visual-editing .ve-img-host {
  position: relative;
}

.ve-img-host > img,
.book-card__media img,
.look img,
.about__media img,
.contacts__visual img,
.course-card__media img {
  max-width: none;
}

@media (max-width: 640px) {
  .ve-bar {
    top: auto;
    bottom: 0.75rem;
    right: 0.55rem;
    left: 0.55rem;
    max-width: none;
  }

  .ve-status {
    display: none;
  }
}
