/* Editor-only chrome for edit/preview mode. Loaded by the public layout only
   when editor_mode? / preview_mode? is true, so public visitors never get it. */
.public-site--editing {
  padding-top: 3.25rem;
}

.cms-editor-bar {
  --editor-bg: #f8faf9;
  --editor-border: #d8e1de;
  --editor-text: #17211e;
  --editor-muted: #5f6f69;
  --editor-soft: #eef3f1;
  --editor-soft-hover: #e2ebe8;
  --editor-accent: #0d766d;
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 3.25rem;
  padding: 0 1rem;
  border-bottom: 1px solid var(--editor-border);
  background: var(--editor-bg);
  color: var(--editor-text);
  font: 0.9rem/1 ui-sans-serif, system-ui, sans-serif;
  box-shadow: 0 1px 12px rgba(15, 35, 31, 0.08);
}

.cms-editor-bar__group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.cms-editor-bar__title {
  font-weight: 700;
}

.cms-page-dropdown {
  --dropdown-menu-top: calc(100% + 0.45rem);
  --dropdown-menu-max-height: min(28rem, calc(100vh - 5rem));
}

.cms-editor-bar__title-button {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  max-width: min(24rem, 34vw);
  padding: 0.28rem 0.45rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--editor-text);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.cms-editor-bar__title-button:hover,
.cms-editor-bar__title-button:focus-visible {
  background: var(--editor-soft);
  outline: none;
}

.cms-editor-bar__title-button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cms-page-dropdown .dropdown-menu {
  min-width: 18rem;
}

.cms-page-dropdown .dropdown-menu a.cms-page-dropdown__item {
  display: grid;
  gap: 0.18rem;
  min-width: 18rem;
}

.cms-page-dropdown .dropdown-menu a.cms-page-dropdown__item[hidden] {
  display: none;
}

.cms-page-dropdown__name {
  color: var(--editor-text);
  font-weight: 800;
}

.cms-page-dropdown__path {
  color: var(--editor-muted);
  font-size: 0.78rem;
}

.cms-editor-bar__back {
  color: var(--editor-text);
  text-decoration: none;
  padding: 0.35rem 0.55rem;
  border-radius: 6px;
  background: var(--editor-soft);
  font-weight: 700;
}

.cms-editor-bar__back:hover {
  background: var(--editor-soft-hover);
}

.cms-editor-bar__mode {
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: var(--editor-soft);
  color: var(--editor-muted);
  font-size: 0.78rem;
}

.cms-editor-bar__publish {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.4rem 0.9rem;
  border: 0;
  border-radius: 6px;
  background: var(--editor-accent);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.cms-publish-dropdown {
  --dropdown-menu-left: auto;
  --dropdown-menu-right: 0;
  --dropdown-menu-top: calc(100% + 0.45rem);
}

.cms-publish-dropdown .dropdown-menu button {
  padding-block: 0.65rem;
  border: 0;
  background: transparent;
  color: var(--editor-text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

/* Editable affordances: a subtle outline on hover so editors see what's editable. */
.public-site--editing .editable {
  outline: 1px dashed transparent;
  outline-offset: 3px;
  transition: outline-color 0.12s ease;
}

.public-site--editing .editable:hover,
.public-site--editing .editable:focus-within {
  outline-color: #0d766d;
}

.public-site--editing .editable .ProseMirror {
  caret-color: #0d766d;
  min-width: 1ch;
}

.public-site--editing .editable .ProseMirror:focus {
  outline: 2px solid #0d766d;
  outline-offset: 2px;
}

.public-site--editing .editable--plain_text .ProseMirror {
  padding-inline: 0.16em;
}

.public-site--editing .editable--plain_text .ProseMirror p {
  margin: 0;
  color: inherit;
  font: inherit;
  line-height: inherit;
  text-shadow: inherit;
  text-transform: inherit;
}

.public-site--editing .editable--rich_text .ProseMirror {
  min-height: 2.5rem;
  padding: 0.25rem 0.4rem;
}

.public-site--editing.public-site--galeb .galeb-article-body .editable--rich_text .ProseMirror {
  min-height: 0;
  padding: 0;
}

.public-site--editing.public-site--galeb .galeb-article-body .editable--rich_text [data-tiptap-image] {
  padding: 0;
  border-radius: 0;
}

.public-site--editing.public-site--galeb .galeb-article-body .editable--rich_text [data-tiptap-image] img {
  border-radius: 0;
  padding: 0;
}

/* Rich-text formatting toolbar. Its active editor computes these coordinates
   from the first editable area in the same content section. */
.public-site--editing .editable--rich_text .tiptap-toolbar {
  display: none;
  position: fixed;
  top: var(--cms-toolbar-top, 4.25rem);
  right: var(--cms-toolbar-right, max(1rem, calc((100vw - 76rem) / 2 + 1rem)));
  left: var(--cms-toolbar-left, auto);
  z-index: 1100;
  width: 14.5rem;
  font-size: 1rem;
  max-height: calc(100vh - var(--cms-toolbar-top, 4.25rem) - 1rem);
  overflow: visible;
  align-content: flex-start;
  padding: 0.35rem 0.45rem;
  border: 1px solid #d6e2de;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 30px rgba(15, 40, 35, 0.18);
  color: #1f2d29;
}

.public-site--editing .editable--rich_text.is-toolbar-active .tiptap-toolbar {
  display: flex;
}

@media (max-width: 720px) {
  .public-site--editing .editable--rich_text .tiptap-toolbar {
    inset: auto 0.75rem 0.75rem 0.75rem;
    width: auto;
    max-height: 40vh;
    overflow-y: auto;
  }
}

/* Language switcher with per-locale status dots. */
.cms-lang {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.55rem;
  border-radius: 6px;
  color: var(--editor-muted);
  text-decoration: none;
}

.cms-lang.is-current {
  color: var(--editor-text);
  background: var(--editor-soft);
}

.cms-lang__dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: currentColor;
}

.cms-lang--published .cms-lang__dot { background: #2f8b57; }
.cms-lang--draft .cms-lang__dot { background: #b57910; }
.cms-lang--missing .cms-lang__dot { background: #b84b43; }

.cms-editor-bar__locales {
  flex: 1 1 auto;
  justify-content: center;
  min-width: 0;
}

.cms-editor-bar__language-list {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 1 auto;
  gap: 0.25rem;
  min-width: 0;
}

.cms-editor-bar__copy-slot {
  flex: 0 0 auto;
  display: flex;
  gap: 0.4rem;
  justify-content: flex-start;
}

.cms-editor-bar__copy,
.cms-editor-bar__translate,
.cms-editor-bar__publish {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.9rem;
  border: 0;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.cms-editor-bar__copy {
  background: var(--editor-soft);
  color: var(--editor-text);
}

.cms-editor-bar__translate {
  background: #163b50;
  color: #fff;
}

.cms-editor-bar__publish {
  background: var(--editor-accent);
  color: #fff;
}

.cms-editor-bar__source-menu {
  display: inline-flex;
}

.cms-editor-bar__switch {
  color: var(--editor-accent);
  text-decoration: none;
  padding: 0.38rem 0.65rem;
  border-radius: 6px;
  font-weight: 800;
}

.cms-editor-bar__switch:hover {
  background: var(--editor-soft);
}

/* Blitz dialog used by the editor bar for page / locale settings. The
   turbo-frame wrapping the dialog content is inline by default, so a
   width on the inner div doesn't propagate to <dialog> — size the
   dialog itself instead. */
dialog:has(.dialog-content--page-settings) {
  width: min(56rem, 92vw);
}

.cms-translation-dialog {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(23, 33, 30, 0.35);
  backdrop-filter: blur(2px);
}

.cms-translation-dialog__panel {
  width: min(32rem, 100%);
  padding: 1.25rem;
  border-radius: 8px;
  background: #fff;
  color: var(--editor-text);
  box-shadow: 0 24px 70px rgba(10, 20, 18, 0.28);
  font: 0.95rem/1.45 ui-sans-serif, system-ui, sans-serif;
}

.cms-translation-dialog__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.cms-translation-dialog__header h2 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.2;
}

.cms-translation-dialog__close {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--editor-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.cms-translation-dialog__close:hover {
  background: var(--editor-soft);
  color: var(--editor-text);
}

.cms-translation-dialog__message {
  margin: 0 0 0.9rem;
  color: var(--editor-text);
}

.cms-translation-progress {
  height: 1.35rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--editor-soft);
}

.cms-translation-progress__bar {
  min-width: 2.5rem;
  height: 100%;
  display: grid;
  place-items: center;
  background: var(--editor-accent);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
  transition: width 0.25s ease;
}

.cms-translation-dialog__meta {
  margin: 0.85rem 0 0;
  color: var(--editor-muted);
}

.cms-translation-dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.55rem;
  margin-top: 1rem;
}

.cms-translation-dialog__primary,
.cms-translation-dialog__secondary {
  padding: 0.5rem 0.8rem;
  border-radius: 6px;
  border: 0;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.cms-translation-dialog__primary {
  background: var(--editor-accent);
  color: #fff;
}

.cms-translation-dialog__secondary {
  background: var(--editor-soft);
  color: var(--editor-text);
}
