/* page-styles.css */
:root {
  --font-weight: 200;
}
/* General rules for elements within columns */
.column > .column-content-area > .page-element {
  width: 100%;
  box-sizing: border-box;
}

.column > .column-content-area > .page-element > .element-content {
  width: 100%;
  box-sizing: border-box;
}

/* Updated rule for .column .column-content-area from Canvas */
.column .column-content-area {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  width: 100%;
  min-width: 1px; /* Prevent collapsing to zero width */
  box-sizing: border-box;
  /* align-items: stretch; was removed to rely on browser default or more specific h-align rules */
  justify-content: inherit; /* Inherit vertical alignment */
}

/* Added specific rules for slideshow element within columns from Canvas */
.column > .column-content-area > .page-element.slideshow-element {
    width: 100%;
    box-sizing: border-box;
}

.column > .column-content-area > .page-element.slideshow-element > .element-content {
    width: 100%;
    box-sizing: border-box;
}


/* --- Existing relevant rules for context --- */

/* Page Container Styles */
.page-container {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  /* Match .container (menu-styles) so padding/empty scroll region matches site background. */
  background-color: var(--site-background-color, #ffffff);
  background-image: var(--site-background-image, none);
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  padding: 0px !important;
  margin: 0px !important;
}

/* Page Elements Container */
.page-elements-container {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 0px !important;
  background-color: var(--site-background-color, #ffffff);
  background-image: var(--site-background-image, none);
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  /* Add bottom padding to allow users to scroll all the way down past the content,
     ensuring the last element is fully visible even when the horizontal menu is fixed at the top.
     This prevents the menu from covering the bottom content. */
  padding-bottom: 100px !important;
}

/* Full-viewport column background (100vh): avoid default bottom pad — JS also sets 0 when applicable */
.page-elements-container:has(.column-container-element[style*="100vh"]) {
  padding-bottom: 0 !important;
}

/* Masonry Layout - Add bottom padding for scrolling past horizontal menu */
/* The masonry element is the container that holds the grid/masonry layout of gallery items.
   Adding padding-bottom here ensures users can scroll past all masonry items, even with
   the horizontal menu fixed at the top. This only applies to galleries, not regular pages. */
.masonry {
  padding-bottom: 100px !important;
}

/* Page Element Styling */
.page-element {
  margin-bottom: 20px;
  overflow: hidden;
  position: relative;
  border-radius: 0;
}

/* Element header styling - use luminance-based contrast so text/icons stay readable on any site background */
.page-element .element-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  cursor: move;
  z-index: 2;
  position: relative;
  background-color: rgba(241, 241, 241, 0.287) !important;
  border-bottom: 1px solid rgba(224, 224, 224, 0.305) !important;
  border-top-left-radius: 0 !important;
  border-top-right-radius: 0 !important;
  color: var(--edit-ui-text-color, #333);
}

.page-element .element-title {
  font-weight: 200;
  color: var(--edit-ui-text-color, #333);
}

.page-element .element-controls {
  display: flex;
  gap: 5px;
  align-items: center;
  color: var(--edit-ui-text-color, #555);
}

.page-element .element-controls .btn,
.page-element .element-controls .btn svg,
.page-element .drag-handle,
.page-element .drag-handle svg {
  color: var(--edit-ui-text-color, #555);
}

/* All header icons same color and opacity - no greyed-out appearance (visibility, lock, edit, duplicate, delete) */
.page-element .element-header .visibility-toggle,
.page-element .element-header .password-toggle,
.page-element .element-header .edit-btn,
.page-element .element-header .duplicate-btn,
.page-element .element-header .delete-btn {
  opacity: 1 !important;
}
.page-element .element-header .visibility-toggle svg,
.page-element .element-header .password-toggle svg,
.page-element .element-header .edit-btn svg,
.page-element .element-header .duplicate-btn svg,
.page-element .element-header .delete-btn svg {
  stroke: var(--edit-ui-text-color, #555) !important;
  color: var(--edit-ui-text-color, #555) !important;
  opacity: 1 !important;
}

/* Drag handle styling - same contrast, consistent opacity */
.page-element .drag-handle {
  cursor: grab;
  opacity: 1;
  transition: opacity 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-element .drag-handle svg {
  stroke: var(--edit-ui-text-color, #555) !important;
  color: var(--edit-ui-text-color, #555) !important;
}

.page-element .drag-handle:hover {
  opacity: 1;
}

.page-element .drag-handle:active {
  cursor: grabbing;
}

.page-element .element-content {
  padding: 0px; /* Base rule */
}

/* Text Element Styles */
.page-text-container {
  width: 100%;

}

.page-text {
  line-height: 1.5;
  color: var(--menu-color, #717171) !important;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--menu-font-family, inherit);
  font-weight: 200 !important; /* Literal 200 - Pico CSS sets --font-weight: 400 when it loads, which overrode var(--font-weight) and caused text to flash correct then get heavier */
}

.page-text p,
.page-text .ql-editor p {
  margin-bottom: 0 !important;
  color: var(--menu-color, #717171);
}

/* List styling - ensure lists inherit text color and font */
.page-text ul,
.page-text ol,
.page-text .ql-editor ul,
.page-text .ql-editor ol {
  margin-top: 0;
  margin-bottom: var(--typography-spacing-vertical, 1em);
  color: var(--menu-color, #717171) !important;
  font-family: var(--menu-font-family, inherit) !important;
  font-weight: 200 !important; /* Match paragraph font-weight */
  font-size: inherit !important;
  padding-left: var(--spacing, 1.5em);
  padding-right: 0;
}

.page-text li,
.page-text .ql-editor li {
  color: var(--menu-color, #717171) !important;
  font-family: var(--menu-font-family, inherit) !important;
  font-weight: 200 !important; /* Match paragraph font-weight */
  font-size: inherit !important;
  margin-bottom: 0.25em;
}

/* Ensure list markers (bullets) match text color and font-weight */
.page-text ul li::marker,
.page-text ol li::marker,
.page-text .ql-editor ul li::marker,
.page-text .ql-editor ol li::marker {
  color: var(--menu-color, #717171) !important;
  font-weight: 200 !important; /* Match text font-weight */
}

/* For nested lists */
.page-text ul ul,
.page-text ol ol,
.page-text ul ol,
.page-text ol ul,
.page-text .ql-editor ul ul,
.page-text .ql-editor ol ol,
.page-text .ql-editor ul ol,
.page-text .ql-editor ol ul {
  margin-top: 0.5em;
  margin-bottom: 0.5em;
}

.page-text > *:first-child {
  margin-top: 0 !important;
}

.page-text > *:last-child {
  margin-bottom: 0 !important;
}

/* Ensure all regular text elements use weight 200 */
.page-text, .page-text p, .page-text span, .page-text div,
.page-text li, .page-text td, .page-text th,
.page-text h1, .page-text h2, .page-text h3,
.page-text h4, .page-text h5, .page-text h6,
.page-text .ql-editor, .page-text .ql-editor p,
.page-text .ql-editor span, .page-text .ql-editor div,
.page-text .ql-editor li {
  font-weight: 200 !important;
}

/* Semantic headings inside text blocks — only when HTML contains h1–h6 (e.g. Quill). Paragraph-only legacy content unchanged. Inherits menu font unless Quill applies an explicit font-family on the heading. */
.page-text > :where(h1, h2, h3, h4, h5, h6) {
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  font-family: inherit;
  color: var(--menu-color, #717171);
}
.page-text > h1:first-child,
.page-text > h2:first-child,
.page-text > h3:first-child {
  margin-top: 0;
}
.page-text h1 { font-size: 2em; }
.page-text h2 { font-size: 1.5em; }
.page-text h3 { font-size: 1.3em; }
.page-text h4 { font-size: 1.1em; }

/* Ensure bold/strong tags use weight 600 for visible contrast with regular 200 weight */
.page-text strong, .page-text b,
.page-text .ql-editor strong, .page-text .ql-editor b {
  font-weight: 600 !important;
}

/* Image Element Styles */
.page-image-container {
  width: 100%;
  text-align: center;
  background-color: transparent;
}

@keyframes page-image-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Start hidden so decoded images never flash at opacity 1 before the first keyframe runs
   (avoids: brief visible → snap to 0 → fade to 1 on splash / column-over-video layouts). */
.page-image {
  max-width: 100%;
  height: auto;
  opacity: 0;
  animation: page-image-fade-in 1s ease-out both;
}

@media (prefers-reduced-motion: reduce) {
  .page-image {
    animation: none;
    opacity: 1;
  }
}

/* Sprint A: cropped / framed image presentation */
.page-image-presentation {
  max-width: 100%;
  box-sizing: border-box;
}

.page-image-frame {
  position: relative;
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
  background-color: rgba(0, 0, 0, 0.04);
}

.page-image-frame .page-image,
.page-image-frame .page-image.page-image--framed {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
  object-position: center;
}

.page-image-frame--natural .page-image {
  height: auto;
  width: 100%;
}

.page-image-container.image-align-left .page-image-presentation {
  margin-right: auto;
}

.page-image-container.image-align-right .page-image-presentation {
  margin-left: auto;
}

.page-image-container.image-align-center .page-image-presentation {
  margin-left: auto;
  margin-right: auto;
}

.element-edit-form .image-preview-frame {
  margin: 0 auto;
  max-width: 100%;
  background-color: rgba(0, 0, 0, 0.04);
}

.element-edit-form .image-preview-frame .image-preview {
  margin: 0;
  box-shadow: none;
}

/* Edit Form Styles - text color only; input/select/textarea background 10% alpha of text color; no outlines */
.element-edit-form {
  padding: 15px;
  background-color: #f9f9f989;
  color: var(--edit-ui-text-color, #333);
}

.element-edit-form label {
  display: block;
  margin-bottom: 5px;
  font-weight: 200;
  color: var(--edit-ui-text-color, #333);
}

.element-edit-form input[type="text"],
.element-edit-form input[type="url"],
.element-edit-form input[type="number"],
.element-edit-form textarea,
.element-edit-form select {
  width: 100%;
  padding: 8px;
  margin-bottom: 15px;
  color: var(--edit-ui-text-color, #333);
  background-color: color-mix(in srgb, var(--edit-ui-text-color, #333) 10%, transparent);
  border: none;
  border-radius: 0;
  box-sizing: border-box;
}

.element-edit-form textarea {
  min-height: 200px;
  resize: vertical;
}

/* Embed form URL feedback and help text - same simplified style */
.element-edit-form .url-feedback,
.element-edit-form .url-help-text {
  color: var(--edit-ui-text-color, #333);
  background-color: color-mix(in srgb, var(--edit-ui-text-color, #333) 10%, transparent);
  border: none;
  border-radius: 0;
}

.edit-form-buttons {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* Button element editor — cap form width so fields and footer actions feel intentional, not full-bleed */
.element-edit-form.page-manager-button-edit-form .page-manager-button-edit-shell {
  max-width: min(520px, 100%);
  margin-inline: auto;
  box-sizing: border-box;
}

.element-edit-form.page-manager-button-edit-form .page-manager-button-edit-shell label {
  color: rgba(51, 51, 51, 0.88);
}

.element-edit-form.page-manager-button-edit-form .edit-form-buttons {
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.element-edit-form.page-manager-button-edit-form .edit-form-buttons button {
  width: auto;
  flex: 0 0 auto;
  min-width: 7.5rem;
  padding-inline: 1.25rem;
}

.element-edit-form.page-manager-button-edit-form .page-manager-button-edit-shell input[type="color"] {
  width: 100%;
  max-width: 11rem;
  height: 2.5rem;
  padding: 2px;
  cursor: pointer;
}

/* Square checkboxes on the canvas editor (Pico otherwise draws a slim switch) — align with .edit-form .form-group */
.element-edit-form .form-group label input[type="checkbox"] {
  width: 25px !important;
  height: 25px !important;
  border-radius: 0 !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  border: 1px solid #ddd !important;
  background-color: white !important;
  cursor: pointer !important;
  margin-right: 8px !important;
  flex-shrink: 0 !important;
}

.element-edit-form .form-group label input[type="checkbox"]:checked {
  background-color: #4682b4 !important;
  border-color: #4682b4 !important;
  position: relative !important;
}

.element-edit-form .form-group label input[type="checkbox"]:checked::after {
  content: "✓" !important;
  position: absolute !important;
  color: white !important;
  font-size: 16px !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
}

/* Add Element Panel Styles - transparent so it blends with site; contrast text works with luminance UI */
.add-element-panel {
  margin: 20px 0;
  padding: 15px;
  background-color: transparent !important;
  border-radius: 0 !important;
  border: 1px solid #ddd;
  color: var(--edit-ui-text-color, #333);
}

.add-element-panel h3,
.add-element-panel h4 {
  margin-top: 0;
  font-size: 18px;
  color: var(--edit-ui-text-color, #333);
}

.add-element-panel .btn {
  color: var(--edit-ui-text-color, #333) !important;
  border-radius: 0 !important;
  opacity: 1 !important;
}

.add-element-panel .btn svg,
.add-element-panel .btn .icon {
  stroke: var(--edit-ui-text-color, #333) !important;
  color: var(--edit-ui-text-color, #333) !important;
  opacity: 1 !important;
}

.add-page-element-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  color: var(--edit-ui-text-color, #333);
}

.add-page-element-btn svg {
  margin-right: 8px;
  width: 18px;
  height: 18px;
  color: var(--edit-ui-text-color, #333);
}

/* Page Settings (metadata) panel - use contrast color so text is readable on any site background */
.page-metadata-container,
.page-metadata-container h3,
.page-metadata-container .metadata-summary,
.page-metadata-container .metadata-note {
  color: var(--edit-ui-text-color, #333);
}

.page-metadata-container .metadata-summary strong,
.page-metadata-container .metadata-note small {
  color: var(--edit-ui-text-color, #333);
}

/* Page Settings edit form (Content Padding, Meta Title/Description, SEO Tips) - luminance-based UI */
.element-edit-form .metadata-fields-container,
.element-edit-form .metadata-fields-container h4,
.element-edit-form .metadata-fields-container label,
.element-edit-form .metadata-fields-container .metadata-field-container {
  color: var(--edit-ui-text-color, #333);
}

.element-edit-form .page-padding-section {
  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
}
.element-edit-form .page-padding-section h4,
.element-edit-form .page-padding-section label {
  color: var(--edit-ui-text-color, #333);
}

/* Text color only; input background 10% alpha of text color; no outlines */
.element-edit-form .metadata-fields-container input[type="text"],
.element-edit-form .metadata-fields-container textarea {
  color: var(--edit-ui-text-color, #333);
  background-color: color-mix(in srgb, var(--edit-ui-text-color, #333) 10%, transparent);
  border: none;
  border-radius: 0;
}
.element-edit-form .metadata-fields-container input[type="text"]::placeholder,
.element-edit-form .metadata-fields-container textarea::placeholder {
  opacity: 0.7;
  color: var(--edit-ui-text-color, #333);
}

.element-edit-form .metadata-fields-container .char-counter {
  color: var(--edit-ui-text-color, #333);
}

.element-edit-form .seo-tips-container {
  background-color: color-mix(in srgb, var(--edit-ui-text-color, #333) 10%, transparent);
  border: none;
  border-radius: 0;
  color: var(--edit-ui-text-color, #333);
}
.element-edit-form .seo-tips-container h4,
.element-edit-form .seo-tips-container ul,
.element-edit-form .seo-tips-container li {
  color: var(--edit-ui-text-color, #333);
}

/* Editor Mode Styles - sharp corners on page manager UI elements */
.page-container.editing .page-element {
  position: relative;
  border: 1px dashed #cccccc30;
  border-radius: 0;
}

.page-container.editing .page-element:hover {
  border-color: #4682B4;
}

.page-container:not(.editing) .element-header {
  display: none !important;
}

/* --- Styles for Column Container Element --- */
.column-container-element {
  position: relative;
  overflow: hidden;
  color: var(--menu-color, #717171);
}

.column-container-element > .element-content {
  display: grid;
  gap: 15px;
  padding: 0;
  background-color: transparent;
  border: none;
  position: relative;
  z-index: 2;
  color: var(--menu-color, #717171);
}

/* Custom grid column widths: allow tracks to shrink (default .column min-width is 200px) */
.column-container-element > .element-content.column-widths-custom > .column {
  min-width: 0;
}

/* --- Column Styling (Individual Columns) --- */
.column {
  flex: 1;
  min-width: 200px;
  padding: 0;
  border: 1px dashed transparent;
  background-color: transparent;
  transition: background-color 0.2s ease, border-color 0.2s ease;
  display: flex;
  flex-direction: column;
  position: relative;
  color: var(--menu-color, #717171);
}

.column .column-header {
  display: none;
  align-items: center;
  justify-content: flex-end;
  padding: 5px 10px;
  background-color: #f1f1f100;
  min-height: 36px;
  box-sizing: border-box;
  position: relative;
  z-index: 3;
}

.editing .column .column-header {
  display: flex;
}

.column .column-header .column-controls {
   display: flex;
   align-items: center;
   gap: 5px;
   margin-left: auto;
}

.column .column-header .btn {
  border: none;
  background: none;
  padding: 4px;
  border-radius: 3px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  transition: opacity 0.2s ease, background-color 0.2s ease;
  width: 24px;
  height: 24px;
  background-color: rgba(0,0,0,0.05);
}
.column .column-header .btn:hover {
  opacity: 1;
  background-color: rgba(0,0,0,0.1);
}
.column .column-header .btn svg {
  width: 16px;
  height: 16px;
  stroke: var(--edit-ui-text-color, #555) !important;
  color: var(--edit-ui-text-color, #555) !important;
}

/* --- VIEW MODE Specifics for Columns & Content Area --- */
.page-element:not(.editing) .column {
    border-color: transparent;
    background-color: transparent;
    padding: 0;
    min-height: 0;
}
.page-element:not(.editing) .column:empty {
     display: none;
 }
.page-element:not(.editing) .column .column-content-area {
    padding: 0 !important;
    min-height: auto;
    border: none;
    background-color: transparent;
}

/* Horizontal & Vertical Alignment Classes for the COLUMN ITSELF */
.column.h-align-left > .column-content-area { align-items: flex-start !important; }
.column.h-align-center > .column-content-area { align-items: center !important; }
.column.h-align-right > .column-content-area { align-items: flex-end !important; }

.column.v-align-top > .column-content-area { justify-content: flex-start !important; }
.column.v-align-middle > .column-content-area { justify-content: center !important; }
.column.v-align-bottom > .column-content-area { justify-content: flex-end !important; }


/* Ensure specific nested containers (like page-slideshow-container) also behave */
.column .column-content-area .page-slideshow-container,
.column .column-content-area .page-image-container,
.column .column-content-area .page-text-container,
.column .column-content-area .page-map-container {
    width: 100%;
    box-sizing: border-box;
    padding: 10px;
}


/* Edit Mode Styling for Columns */
.editing .column {
  border-color: #dcdcdc;
  min-height: 80px;
}
.editing .column .column-content-area {
  padding: 10px;
  min-height: 60px;
  border: 1px dashed #a0a0a0;
  border-radius: 3px;
  background-color: rgba(0, 0, 0, 0.02);
}
.editing .column .column-content-area:empty::before {
  content: 'Drop elements here';
  display: block;
  text-align: center;
  color: #aaaaaa46;
  font-size: 14px;
  padding: 30px 10px;
  margin: auto;
  font-style: italic;
  flex-grow: 1;
}


/* Base slideshow container */
.page-slideshow-container {
  position: relative;
  width: 100%;
  background-color: transparent !important;
}

.slideshow-display {
  position: relative;
  overflow: hidden;
  width: 100%;
  background-color: transparent !important;
  border-radius: 0px;
}

.slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.5s ease-in-out;
  background-position: center;
  background-size: contain;
  background-repeat: no-repeat;
  background-color: transparent !important;
}

.slide:first-child {
  opacity: 1;
}

.slideshow-click-area {
  position: absolute;
  top: 0;
  height: 100%;
  width: 50%;
  cursor: pointer;
  z-index: 10;
  background: transparent;
}

.slideshow-click-left {
  left: 0;
}

.slideshow-click-right {
  right: 0;
}

.slideshow-sequencer-container{
  background-color: transparent;
  margin-top: 20px;
  border: 1px solid #ddd;
  padding: 15px;
  border-radius: 0px;
}

.slideshow-sequencer {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
  min-height: 120px;
}

.sequencer-item {
  position: relative;
  aspect-ratio: 1/1;
  background-color: #eee;
  border-radius: 0px;
  overflow: hidden;
  cursor: grab;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  transition: transform 0.2s, box-shadow 0.2s;
}

.sequencer-item:hover {
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
  transform: translateY(-2px);
}

.sequencer-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.remove-slide-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  padding: 0;
  background-color: rgba(200, 0, 0, 0.75);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 14px;
  line-height: 22px;
  text-align: center;
  cursor: pointer;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.2s ease, background-color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sequencer-item:hover .remove-slide-btn {
  opacity: 1;
}
.remove-slide-btn:hover {
  background-color: rgba(255, 0, 0, 0.9);
}

.slideshow-sequencer .sortable-ghost {
  opacity: 0.4;
  background-color: rgba(70, 130, 180, 0.1);
  border: 1px dashed #4682B4;
}

.slideshow-sequencer .sortable-chosen {
  box-shadow: 0 0 0 2px #4682B4, 0 4px 8px rgba(0,0,0,0.2);
  transform: scale(1.03);
}

.slideshow-sequencer .sortable-drag {
  opacity: 0.9;
  box-shadow: 0 5px 15px rgba(0,0,0,0.25);
}

.slideshow-settings-container input[type="number"],
.slideshow-settings-container input[type="range"] {
  width: 100%;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 0px;
  box-sizing: border-box;
  margin-bottom: 10px;
}
.slideshow-settings-container .dimension-row {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    gap: 10px;
}
.slideshow-settings-container .dimension-label {
    flex-basis: 120px;
    flex-shrink: 0;
    font-weight: 200;
}
.slideshow-settings-container .dimension-slider-container {
    flex-grow: 1;
    display: flex;
    align-items: center;
}
.slideshow-settings-container .dimension-value {
    min-width: 45px;
    text-align: right;
    font-size: 0.9em;
    color: #555;
}

.upload-slideshow-image-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background-color: #4682B4;
  color: white;
  border: none;
  border-radius: 0px;
  cursor: pointer;
  transition: background-color 0.3s ease;
  font-weight: 200;
}

.upload-slideshow-image-btn:hover {
  background-color: #3a6d96;
}

.upload-slideshow-image-btn svg {
  width: 18px;
  height: 18px;
}

.sequencer-empty-message {
  grid-column: 1 / -1;
  text-align: center;
  padding: 30px 20px;
  color: #888;
  font-style: italic;
  background-color: #f0f0f0;
  border-radius: 0px;
}

.slideshow-placeholder {
  padding: 40px 20px;
  text-align: center;
  border: 1px dashed #ccc;
  border-radius: 0px;
  background-color: #f7f7f7 !important;
  color: #777;
}

.show-full-images-container {
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.show-full-images-container > label {
    font-weight: 200;
    margin-bottom: 0;
}

.toggle-switch-container {
  display: flex;
  align-items: center;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .3s;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

input:checked + .toggle-slider {
  background-color: #4682B4;
}

input:checked + .toggle-slider:before {
  transform: translateX(26px);
}

.toggle-label {
  margin-left: 10px;
  font-size: 14px;
  color: #333;
}

.slideshow-range-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: #ddd;
  outline: none;
  margin: 10px 0;
  cursor: pointer;
}

.slideshow-range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #4682B4;
  cursor: pointer;
  box-shadow: 0 0 2px rgba(0,0,0,0.3);
}

.slideshow-range-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #4682B4;
  cursor: pointer;
  border: none;
  box-shadow: 0 0 2px rgba(0,0,0,0.3);
}


/* Image alignment classes */
.page-image-container.image-align-left { text-align: left; }
.page-image-container.image-align-center { text-align: center; }
.page-image-container.image-align-right { text-align: right; }

/* Quill alignment classes */
.page-text .ql-align-center { text-align: center !important; }
.page-text .ql-align-right { text-align: right !important; }
.page-text .ql-align-justify { text-align: justify !important; }
.page-text .ql-align-left { text-align: left !important; }

/* --- NEW STYLES FOR TEMPLATE SELECTION UI --- */
.page-custom-html-view {
  width: 100%;
  min-height: 100vh;
}
.page-custom-html-iframe {
  width: 100%;
  min-height: 100vh;
  border: none;
  display: block;
}
body.menu-hidden-on-page .page-custom-html-view,
body.menu-hidden-on-page .page-custom-html-iframe {
  min-height: 100vh;
}

.template-selection-wrapper {
    padding: 30px 20px;
    text-align: center;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin: 20px auto;
    max-width: 900px;
}
.template-selection-title {
    font-size: 1.8em;
    margin-bottom: 10px;
    color: #343a40;
}
.template-selection-description {
    font-size: 1.1em;
    color: #6c757d;
    margin-bottom: 30px;
}
.template-selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 25px;
    justify-content: center;
}
.template-card {
    border: 1px solid #dee2e6 !important;
    border-radius: 6px !important;
    padding: 14px !important;
    background-color: #f8f9fa00;
    cursor: pointer;
    transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
    text-align: center;
    overflow: hidden;
}
.template-card:hover,
.template-card:focus {
    transform: translateY(-2px) !important;
    box-shadow: 0 2px 2px rgba(0, 0, 0, 0.1) !important;
    border-color: #007bff;
}
.template-card:focus {
    outline: 2px solid #4682B4;
    outline-offset: 2px;
}
.template-preview {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 15px;
    background-color: #e9ecef;
    border: 1px solid #ced4da;
}
.template-name {
    font-weight: 500;
    margin-bottom: 5px;
    color: #495057;
    font-size: 1.1em;
}
.template-description {
    font-size: 0.9em;
    color: #6c757d;
    line-height: 1.4;
}
.template-loading {
     padding: 50px;
     text-align: center;
     font-size: 1.2em;
     color: #6c757d;
}

/* --- Column Alignment Edit Form Specific Styles --- */
.column-alignment-edit-form .alignment-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  max-width: 120px;
  margin: 10px auto 15px auto;
}

.column-alignment-edit-form .alignment-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 35px;
  height: 35px;
  padding: 0;
  border: 1px solid #ccc;
  border-radius: 4px;
  background-color: #fff;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
}

.column-alignment-edit-form .alignment-cell:hover {
  background-color: #f0f0f0;
  border-color: #bbb;
}

.column-alignment-edit-form .alignment-cell.active {
  background-color: #e0f2fe;
  border-color: #3b82f6;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.column-alignment-edit-form .alignment-cell svg {
  width: 20px;
  height: 20px;
  display: block;
}

/* --- Styles for Column Container with Slideshow Background --- */
.column-background-slideshow {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1;
  overflow: hidden;
  background-color: transparent;
}

/* Vimeo/YouTube column background (iframe cover sized in JS) */
.column-background-video-embed {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1;
  overflow: hidden;
  background-color: transparent;
}

.column-background-slideshow .slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  background-position: center;
  background-repeat: no-repeat;
}

/* Column background editor: multi-video rows (page-styles loads after menu-styles) */
.column-background-video-url-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.column-background-video-url-row .column-background-video-url-entry {
  flex: 1 1 0;
  min-width: 0;
  width: auto;
  max-width: none;
  margin-bottom: 0;
}

.column-background-video-url-row .column-background-remove-video-btn {
  flex: 0 0 auto;
  width: auto;
  min-width: 5.5rem;
  max-width: none;
  margin: 0;
  white-space: nowrap;
}

.column-background-add-video-btn {
  width: auto;
  max-width: none;
  margin: 0 0 12px 0;
  align-self: flex-start;
}

/* Optional scroll reveal for text and image page elements */
.page-element.page-element-scroll-fade .element-content {
  opacity: 0;
  transition: opacity 0.65s ease-out;
}

.page-element.page-element-scroll-fade.is-scroll-visible .element-content {
  opacity: 1;
}

/* Text blocks: wait 1s after entering the viewport, then fade in */
.page-element.text-element.page-element-scroll-fade.is-scroll-visible .element-content {
  transition-delay: 1s;
}

@media (prefers-reduced-motion: reduce) {
  .page-element.page-element-scroll-fade .element-content {
    opacity: 1;
    transition: none;
  }

  .page-element.text-element.page-element-scroll-fade.is-scroll-visible .element-content {
    transition-delay: 0s;
  }
}

.scrollable-text-wrapper {
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.2) transparent;
}

.scrollable-text-wrapper::-webkit-scrollbar {
  width: 6px;
}
.scrollable-text-wrapper::-webkit-scrollbar-track {
  background: transparent;
}
.scrollable-text-wrapper::-webkit-scrollbar-thumb {
  background-color: rgba(0,0,0,0.2);
  border-radius: 3px;
  border: 1px solid transparent;
}



.multi-image-dropzone {
  border: 2px dashed #ccc;
  border-radius: 4px;
  padding: 30px 20px;
  text-align: center;
  background-color: #f9f9f9;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-bottom: 15px;
}
.multi-image-dropzone:hover {
  border-color: #4682B4;
  background-color: #e3f2fd;
}
.multi-image-dropzone .upload-icon svg {
    width: 48px; height: 48px; stroke: #999; margin-bottom: 10px;
}
.multi-image-dropzone strong { display: block; margin-bottom: 5px; }

.upload-progress-container {
  margin-top: 15px;
  text-align: left;
}
.progress-text {
    font-size: 0.9em;
    color: #555;
    margin-bottom: 5px;
}
.progress-bar-container {
  height: 10px;
  background-color: #eee;
  border-radius: 5px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  width: 0%;
  background-color: #4682B4;
  transition: width 0.3s ease;
  border-radius: 5px;
}

.sortable-ghost {
  opacity: 0.4;
  background-color: #cce5ff85 !important;
  border: 1px dashed #007bff !important;
  border-radius: 4px;
}
.sortable-fallback {
  opacity: 0.7 !important;
  background-color: white;
  border-radius: 4px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
.sortable-drag-over-target {
   background-color: #d4edda65 !important;
   border-color: #28a745 !important;
}

.editing .column .column-content-area.sortable-drag-over-target {
   background-color: rgba(212, 237, 218, 0.5) !important;
   border: 1px dashed #155724 !important;
}

.custom-color-picker-dialog {
  background-color: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  z-index: 10001;
  display: flex;
  align-items: center;
  gap: 8px;
  position: absolute;
}
.custom-color-picker-dialog input[type="color"] {
  width: 30px;
  height: 30px;
  border: 1px solid #ddd;
  padding: 0;
  cursor: pointer;
  border-radius: 3px;
}
.custom-color-picker-dialog input[type="text"] {
  width: 70px;
  padding: 5px;
  border: 1px solid #ddd;
  border-radius: 3px;
  font-family: monospace;
  font-size: 12px;
}

@media (max-width: 768px) {
  .page-container {
    padding: 0;
  }

  .page-elements-container {
    padding: 0px;
  }

  .element-edit-form {
    padding: 10px;
    background-color: rgba(214, 214, 214, 0.1);  
  }

  .page-element .element-controls {
    gap: 2px;
      
  }

  .page-element .btn svg {
    width: 14px;
    height: 14px;
  }

  .template-selection-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
  }
  .template-card {
    padding: 10px !important;
  }
  .template-preview {
    height: 120px;
  }
}

@media (max-width: 480px) {
  .alignment-radio-group {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .column-alignment-edit-form .alignment-grid {
    max-width: 100px;
  }
  .column-alignment-edit-form .alignment-cell {
    width: 30px; height: 30px;
  }
  .column-alignment-edit-form .alignment-cell svg {
    width: 18px; height: 18px;
  }
  .edit-form-buttons {
    flex-direction: column;
    gap: 8px;
  }
  .edit-form-buttons button {
    width: 100%;
  }
  .element-edit-form.page-manager-button-edit-form .edit-form-buttons {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .element-edit-form.page-manager-button-edit-form .edit-form-buttons button {
    width: auto;
    flex: 1 1 auto;
    min-width: min(11rem, 100%);
    max-width: 100%;
  }
}

.element-edit-form {
  background-color: rgba(255, 255, 255, 0.4) !important;
}

.quill-embed {
  background-color: transparent !important;
  border: none !important;
}
.page-text p, .page-text .ql-editor p {
    font-weight: 200 !important;
}

/* fix for quill image embed button stretching */
.page-text input[type="image"],
.quill-embed input[type="image"] {
  width: auto !important;
  height: auto !important;
  max-width: 100% !important;
  object-fit: contain !important;
}


/* --- Mobile Column Stacking --- */
/* On screens 768px or less, make columns stack vertically instead of side-by-side. */
@media (max-width: 768px) {
  .column-container-element > .element-content {
    display: flex !important; /* Switch from grid to flex for better mobile stacking */
    flex-direction: column !important; /* Stack columns vertically */
    gap: 12px !important; /* Add consistent spacing between stacked columns */
  }

  /* Ensure each column takes full width when stacked */
  .column-container-element > .element-content > .column {
    width: 100% !important;
    min-width: 100% !important;
    margin-bottom: 0 !important; /* Remove any existing margins */
  }

  /* Remove any existing grid properties that might interfere */
  .column-container-element > .element-content {
    grid-template-columns: none !important;
    grid-template-rows: none !important;
    grid-auto-flow: unset !important;
  }
}


/* --- Mobile Scrolling & Layout Fix for Horizontal Menu --- */
@media (max-width: 768px) {
  /*
    This rule applies ONLY to the horizontal layout on mobile screens.
    It changes the main container from a fixed-height flexbox to a
    normal block element, which allows the page to scroll.
  */
  body.menu-layout-horizontal .container {
    display: block !important;    /* Override display:flex */
    height: auto !important;      /* Allow height to grow with content */
    overflow-y: visible !important; /* Prevent the container from trying to scroll */
  }

  /*
    This ensures the child gallery container also has its height
    reset, preventing a "double scrollbar" or clipped content issue.
  */
  body.menu-layout-horizontal .gallery-container {
    height: auto !important;
    overflow-y: visible !important;
  }
}

/* Password Protection Styles */
.password-toggle {
  background-color: rgba(0,0,0,0.05) !important;
  border: none !important;
  border-radius: 0px !important;
  padding: 4px !important;
  margin: 0 2px !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
}

.password-toggle:hover {
  background-color: rgba(0,0,0,0.1) !important;
}

.password-toggle.protected svg {
  stroke: #4682B4 !important;
  color: #4682B4 !important;
}

.password-toggle:not(.protected) svg {
  stroke: #999 !important;
  color: #999 !important;
}

.password-protection-overlay {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  background: rgba(0, 0, 0, 0.8) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  z-index: 1000 !important;
  color: white !important;
  font-family: var(--menu-font-family, inherit) !important;
}

.password-protection-overlay > div {
  text-align: center !important;
  padding: 20px !important;
  background: rgba(0, 0, 0, 0.9) !important;
  border-radius: 8px !important;
  max-width: 300px !important;
}

.password-protection-overlay button {
  background: #4682B4 !important;
  color: white !important;
  border: none !important;
  padding: 10px 20px !important;
  border-radius: 4px !important;
  cursor: pointer !important;
  font-size: 14px !important;
  transition: background-color 0.2s ease !important;
}

.password-protection-overlay button:hover {
  background: #5a9bd4 !important;
}

/* Gallery-level password protection overlay */
.gallery-password-protection-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  color: white;
  font-family: var(--menu-font-family, inherit);
}

.gallery-password-protection-overlay > div {
  text-align: center;
  padding: 40px;
  background: rgba(0, 0, 0, 0.95);
  border-radius: 12px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.gallery-password-protection-overlay h2 {
  margin: 0 0 10px 0;
  font-size: 24px;
  font-weight: 300;
  color: white;
}

.gallery-password-protection-overlay p {
  margin: 10px 0 20px 0;
  font-size: 16px;
  opacity: 0.8;
  color: white;
}

.gallery-password-protection-overlay input[type="password"] {
  width: 100%;
  padding: 12px;
  border: 1px solid #444;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  font-size: 16px;
  box-sizing: border-box;
  margin-bottom: 15px;
}

.gallery-password-protection-overlay input[type="password"]::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.gallery-password-protection-overlay input[type="password"]:focus {
  outline: none;
  border-color: #4682B4;
  background: rgba(255, 255, 255, 0.15);
}

.gallery-password-protection-overlay button {
  background: #4682B4;
  color: white;
  border: none;
  padding: 12px 30px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  width: 100%;
  transition: background-color 0.2s ease;
}

.gallery-password-protection-overlay button:hover {
  background: #5a9bd4;
}

.gallery-password-protection-overlay .error-message {
  color: #ff6b6b;
  margin-top: 10px;
  font-size: 14px;
  display: none;
}

/* Password indicator for gallery items */
.password-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin: 0 2px;
  color: #f39c12;
  opacity: 0.8;
  cursor: default;
}

.password-indicator .icon {
  width: 12px;
  height: 12px;
  stroke: #f39c12;
  fill: none;
}

.password-indicator:hover {
  opacity: 1;
}

/* Ensure the password indicator is properly styled in the sidebar */
.sidebar.editing .gallery-item-content .password-indicator {
  color: #f39c12 !important;
  opacity: 0.8 !important;
}

.sidebar.editing .gallery-item-content .password-indicator:hover {
  opacity: 1 !important;
}

.sidebar.editing .gallery-item-content .password-indicator .icon {
  stroke: #f39c12 !important;
  fill: none !important;
}

/* Password protected placeholder styling */
.password-protected-placeholder {
  box-sizing: border-box;
}

.password-protected-placeholder .unlock-content-btn svg {
  flex-shrink: 0;
  stroke: currentColor;
}

.password-protected-placeholder .unlock-content-btn span {
  font-weight: 500;
}

/* Gallery-level password toggle buttons */
.sidebar.editing .gallery-item-content .password-toggle {
  width: 24px !important;
  height: 24px !important;
  padding: 4px !important;
  border-radius: 0px !important;
  background-color: #888888e5 !important;
  border: none !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: all 0.2s ease !important;
  margin: 0 2px !important;
  cursor: pointer !important;
  color: white !important;
}

.sidebar.editing .gallery-item-content .password-toggle.protected {
  background-color: #f39c12 !important;
}

.sidebar.editing .gallery-item-content .password-toggle:hover {
  background-color: #707070e5 !important;
}

.sidebar.editing .gallery-item-content .password-toggle.protected:hover {
  background-color: #e67e22 !important;
}

.sidebar.editing .gallery-item-content .password-toggle svg {
  width: 12px !important;
  height: 12px !important;
  min-width: 12px !important;
  min-height: 12px !important;
  fill: none !important;
  stroke: white !important;
  color: white !important;
}

/* Embedded Content / Iframe Styles */
.page-embedded-content-container {
  width: 100%;
  box-sizing: border-box;
  position: relative;
  min-width: 0; /* Allow container to shrink if needed */
}

/* Background YouTube/Vimeo: width/margin set in JS (sidebar + column layouts break pure CSS vw/calc) */
.page-embedded-content-container.page-embedded-content-full-bleed {
  box-sizing: border-box;
  max-width: none;
}

/* Centered column flex can shrink page elements — stretch this row like slideshow row width */
.column .column-content-area > .page-element.page-element-embed-full-bleed {
  align-self: stretch !important;
  width: 100% !important;
  max-width: none !important;
}

.page-element.embedded-content-element:has(.page-embedded-content-full-bleed),
.column-container-element:has(.page-embedded-content-full-bleed) {
  overflow: visible;
}

/* JS sets iframe width/height to 16:9 cover (larger than wrapper, centered); wrapper clips like object-fit:cover */
.page-embedded-content-container.page-embedded-content-full-bleed .iframe-wrapper.iframe-video-background-fill {
  overflow: hidden !important;
}

/*
 * .gallery-container uses overflow-y: auto, which forces overflow-x to clip. Negative-margin
 * full-bleed must escape horizontally — move vertical scroll to .page-container while bleed is present.
 */
body:has(.page-embedded-content-full-bleed) .gallery-container {
  overflow: visible !important;
  min-height: 0;
  flex: 1 1 auto;
}

body:has(.page-embedded-content-full-bleed) .gallery-container .page-container {
  overflow-y: auto !important;
  flex: 1 1 auto !important;
  min-height: 0 !important;
  -webkit-overflow-scrolling: touch;
}

.iframe-wrapper {
  position: relative;
  width: 100%;
  display: block;
  box-sizing: border-box;
  min-width: 0; /* Ensure width can be calculated for padding-bottom percentage */
}

/* Ensure iframe displays correctly */
.iframe-wrapper iframe {
  display: block;
  border: 0;
  box-sizing: border-box;
}

/* Aspect ratio wrapper for responsive video embeds (16:9) */
.iframe-wrapper.iframe-aspect-ratio {
  position: relative !important;
  width: 100% !important;
  height: 0 !important;
  min-height: 0 !important;
  padding-bottom: 56.25% !important; /* 16:9 aspect ratio */
  display: block !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Ensure iframe fills the aspect ratio container */
.iframe-wrapper.iframe-aspect-ratio iframe {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  display: block !important;
  border: 0 !important;
  box-sizing: border-box !important;
  z-index: 1 !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

/* Map element (Leaflet) — match text alignment: .page-text-container (10px) + .page-text (5px) = 15px */
.page-element.map-element .element-content .page-map-container,
.column .column-content-area .page-map-container {
  padding: 15px !important;
  box-sizing: border-box !important;
  width: 100% !important;
}

.page-map-container {
  width: 100%;
  box-sizing: border-box;
  position: relative;
  min-width: 0;
  min-height: 280px;
}

.page-map-container .page-map-inner {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

.page-map-inner {
  width: 100%;
  height: 100%;
  min-height: 200px;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

.page-map-container .leaflet-container {
  font: inherit;
  z-index: 0;
}

/* Map attribution: monotone and minimal (license-compliant but subtle) */
.page-map-container .leaflet-control-attribution {
  font-size: 8px !important;
  line-height: 1.2 !important;
  color: #666 !important;
  background: rgba(255, 255, 255, 0.6) !important;
  padding: 2px 4px !important;
  margin: 0 !important;
}
.page-map-container .leaflet-control-attribution a {
  color: #666 !important;
}
.page-map-container .leaflet-control-attribution svg,
.page-map-container .leaflet-control-attribution img {
  opacity: 0.6;
  filter: grayscale(1);
  vertical-align: middle;
  max-height: 10px;
}

/* Map edit form: preview and search — height set by JS with !important */
.page-map-edit-preview-wrap {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 200px !important;
  display: block !important;
}

.page-map-edit-preview {
  box-sizing: border-box;
  width: 100% !important;
  min-width: 0;
  min-height: 200px !important;
  display: block !important;
}

.page-map-edit-preview .leaflet-container {
  font: inherit;
  width: 100% !important;
  height: 100% !important;
}

.page-map-edit-preview .leaflet-control-attribution {
  font-size: 8px !important;
  line-height: 1.2 !important;
  color: #666 !important;
  background: rgba(255, 255, 255, 0.6) !important;
  padding: 2px 4px !important;
  margin: 0 !important;
}
.page-map-edit-preview .leaflet-control-attribution a {
  color: #666 !important;
}
.page-map-edit-preview .leaflet-control-attribution svg,
.page-map-edit-preview .leaflet-control-attribution img {
  opacity: 0.6;
  filter: grayscale(1);
  vertical-align: middle;
  max-height: 10px;
}

/* White location pin (no shadow) */
.page-manager-map-pin {
  background: none !important;
  border: none !important;
}

.page-manager-map-pin img,
.leaflet-marker-icon.page-manager-map-pin + .leaflet-marker-shadow {
  display: none !important;
}

.element-edit-form .map-help-text {
  color: var(--edit-ui-text-color, #333);
  background-color: color-mix(in srgb, var(--edit-ui-text-color, #333) 10%, transparent);
  border: none;
  border-radius: 0;
}

/* Page Button element — published view (.button-element matches PageManager wrapper) */
.page-element.button-element .page-button-wrap,
.page-button-element .page-button-wrap {
  width: 100%;
  box-sizing: border-box;
  /* Default when not inside a column (or column has no h-align): match previous centered look */
  justify-content: center;
}

/* Respect column horizontal alignment (same axes as .column-content-area align-items) */
.column.h-align-left .page-element.button-element .page-button-wrap,
.column.h-align-left .page-button-element .page-button-wrap {
  justify-content: flex-start;
}

.column.h-align-center .page-element.button-element .page-button-wrap,
.column.h-align-center .page-button-element .page-button-wrap {
  justify-content: center;
}

.column.h-align-right .page-element.button-element .page-button-wrap,
.column.h-align-right .page-button-element .page-button-wrap {
  justify-content: flex-end;
}

.page-element.button-element .page-button-cta,
.page-button-element .page-button-cta {
  text-decoration: none;
}

/*
 * Global menu-styles resets every <button> (padding/outline/background !important).
 * Page CTAs set --page-btn-* vars inline from Page Manager (page-styles loads after menu-styles).
 */
html body .page-elements-container .page-element.button-element button.neon-page-btn.page-button-cta[type="button"],
html body .page-button-element button.neon-page-btn.page-button-cta[type="button"],
html body .page-gallery-container .page-elements-container .page-element.button-element button.neon-page-btn.page-button-cta[type="button"] {
  --background-color: transparent !important;
  --border-color: transparent !important;
  --color: inherit !important;
  --box-shadow: none !important;

  appearance: none !important;
  -webkit-appearance: none !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: var(--page-btn-gap, 8px) !important;
  padding: var(--page-btn-py, 14px) var(--page-btn-px, 24px) !important;
  margin: var(--page-btn-margin, 0) !important;
  border: none !important;
  border-radius: var(--page-btn-radius, 0) !important;
  cursor: pointer !important;
  line-height: 1.2 !important;
  box-sizing: border-box !important;
  max-width: 100% !important;

  font-size: var(--page-btn-fs, 16px) !important;
  font-family: var(--page-btn-ff, var(--menu-font-family, inherit)) !important;
  color: var(--page-btn-color, #ffffff) !important;
  background-color: var(--page-btn-bg, rgba(70, 130, 180, 1)) !important;

  outline: var(--page-btn-outline, none) !important;
  outline-offset: var(--page-btn-outline-os, 0) !important;
}

html body .page-elements-container .page-element.button-element button.neon-page-btn.page-button-cta[type="button"]:hover,
html body .page-button-element button.neon-page-btn.page-button-cta[type="button"]:hover,
html body .page-gallery-container .page-elements-container .page-element.button-element button.neon-page-btn.page-button-cta[type="button"]:hover {
  background-color: var(--page-btn-bg-hover, var(--page-btn-bg)) !important;
  color: var(--page-btn-color-hover, var(--page-btn-color)) !important;
}

html body .page-elements-container .page-element.button-element button.neon-page-btn.page-button-cta:focus,
html body .page-elements-container .page-element.button-element button.neon-page-btn.page-button-cta:focus-visible,
html body .page-button-element button.neon-page-btn.page-button-cta:focus,
html body .page-button-element button.neon-page-btn.page-button-cta:focus-visible,
html body .page-gallery-container .page-elements-container .page-element.button-element button.neon-page-btn.page-button-cta:focus,
html body .page-gallery-container .page-elements-container .page-element.button-element button.neon-page-btn.page-button-cta:focus-visible {
  outline: var(--page-btn-outline, none) !important;
  outline-offset: var(--page-btn-outline-os, 2px) !important;
  box-shadow: none !important;
  --box-shadow: none !important;
}

/* Layout block presets — tight grids from page-layout-lab (editable slots) */

.page-element.layout-block-element > .element-content {
  padding: 0;
  overflow: hidden;
}

.page-element.layout-block-element.editing .lb-root {
  outline: 1px dashed rgba(70, 130, 180, 0.45);
  outline-offset: 2px;
}

.lb-root {
  --lb-bg: #f4efe6;
  --lb-paper: #fffdf8;
  --lb-ink: #1c1814;
  --lb-muted: #6b635a;
  --lb-accent: #8b3a2a;
  --lb-rule: rgba(28, 24, 20, 0.12);
  width: 100%;
  box-sizing: border-box;
}

.layout-theme-covers.lb-root {
  --lb-bg: #f4efe6;
  --lb-paper: #fffdf8;
  --lb-ink: #1c1814;
  --lb-muted: #6b635a;
  --lb-accent: #8b3a2a;
  --lb-rule: rgba(28, 24, 20, 0.12);
  font-family: "Source Sans 3", system-ui, sans-serif;
  color: var(--lb-ink);
  background: var(--lb-paper);
}

.layout-theme-space-colony.lb-root {
  --lb-bg: #070b12;
  --lb-paper: #0f1623;
  --lb-ink: #e8eef7;
  --lb-muted: #8b9cb3;
  --lb-accent: #5eead4;
  --lb-rule: rgba(94, 234, 212, 0.15);
  font-family: "Space Grotesk", system-ui, sans-serif;
  color: var(--lb-ink);
  background: var(--lb-bg);
}

.layout-theme-smithsonian-pdia.lb-root {
  --lb-bg: #faf8f5;
  --lb-paper: #fffefb;
  --lb-ink: #2a2622;
  --lb-muted: #6f6860;
  --lb-accent: #8b4513;
  --lb-rule: #d8d2c8;
  font-family: "Libre Franklin", system-ui, sans-serif;
  color: var(--lb-ink);
  background: var(--lb-bg);
}

/* Cover filmstrip */
.lb-cover-filmstrip .lb-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: 1px solid var(--lb-rule);
}
.lb-cover-filmstrip .lb-slot {
  border-right: 1px solid var(--lb-rule);
  position: relative;
}
.lb-cover-filmstrip .lb-slot:last-child { border-right: none; }
.lb-cover-filmstrip .lb-slot img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  display: block;
}
.lb-cover-filmstrip .lb-caption {
  padding: 0.65rem 0.85rem;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--lb-muted);
  border-top: 1px solid var(--lb-rule);
  min-height: 2.5rem;
}
.lb-cover-filmstrip .lb-caption p { margin: 0; }

/* Space bento */
.lb-space-bento { padding: clamp(0.75rem, 2vw, 1.25rem); }
.lb-space-bento .lb-bento {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: clamp(0.65rem, 1.5vw, 0.85rem);
  max-width: 1100px;
  margin: 0 auto;
}
.lb-space-bento .lb-slot.large { grid-row: span 2; }
.lb-space-bento .lb-cell {
  position: relative;
  overflow: hidden;
  border-radius: 4px;
  border: 1px solid var(--lb-rule);
  background: var(--lb-paper);
}
.lb-space-bento .lb-cell img {
  width: 100%;
  height: 100%;
  min-height: 140px;
  object-fit: cover;
  display: block;
}
.lb-space-bento .lb-slot.large .lb-cell img { min-height: 100%; aspect-ratio: auto; }
.lb-space-bento .lb-label {
  position: absolute;
  left: 0.65rem;
  bottom: 0.55rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: rgba(7, 11, 18, 0.72);
  color: var(--lb-accent);
  padding: 0.25rem 0.45rem;
}
.lb-space-bento .lb-wide {
  margin-top: clamp(0.65rem, 1.5vw, 0.85rem);
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
}
.lb-space-bento .lb-wide .lb-cell img { aspect-ratio: 21 / 9; }

/* Archive row */
.lb-archive-row {
  padding: clamp(1rem, 3vw, 2rem);
  max-width: 1100px;
  margin: 0 auto;
}
.lb-archive-row .lb-plates {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(1rem, 2.5vw, 1.75rem);
}
.lb-archive-row .lb-plate {
  border: 1px solid var(--lb-rule);
  background: var(--lb-paper);
  box-shadow: 0 2px 0 var(--lb-rule);
}
.lb-archive-row .lb-plate-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--lb-rule);
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 0.85rem;
}
.lb-archive-row .lb-plate-head .lb-tag {
  font-family: "Libre Franklin", sans-serif;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  color: var(--lb-accent);
}
.lb-archive-row .lb-plate img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  display: block;
}
.lb-archive-row .lb-caption {
  padding: 0.85rem;
  font-size: 0.82rem;
  color: var(--lb-muted);
  border-top: 1px solid var(--lb-rule);
  min-height: 4rem;
}
.lb-archive-row .lb-caption p { margin: 0; }

/* Edit-mode slot controls */
.lb-slot { position: relative; }
.lb-slot-tools {
  display: none;
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 5;
  gap: 4px;
}
.page-element.editing .lb-slot-tools { display: flex; }
.lb-slot-tools button {
  font-size: 11px;
  padding: 4px 8px;
  border: 1px solid rgba(255,255,255,0.8);
  background: rgba(0,0,0,0.55);
  color: #fff;
  cursor: pointer;
  border-radius: 0;
}
.lb-slot-tools button:hover { background: rgba(70, 130, 180, 0.9); }
.lb-slot-placeholder {
  aspect-ratio: 3 / 4;
  background: var(--lb-rule);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--lb-muted);
  font-size: 0.75rem;
}

@media (max-width: 720px) {
  .lb-cover-filmstrip .lb-strip,
  .lb-archive-row .lb-plates { grid-template-columns: 1fr; }
  .lb-cover-filmstrip .lb-slot { border-right: none; border-bottom: 1px solid var(--lb-rule); }
  .lb-space-bento .lb-bento { grid-template-columns: 1fr; }
  .lb-space-bento .lb-slot.large { grid-row: span 1; }
}

.lb-unconfigured {
  background: #f8f8f8;
  border: 1px dashed #ccc;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lb-unconfigured-inner {
  text-align: center;
  padding: 1.5rem 1rem;
  color: #555;
}
.lb-unconfigured-icon {
  display: block;
  width: 32px;
  height: 32px;
  margin: 0 auto 0.65rem;
  border: 1px solid #bbb;
  border-radius: 2px;
  position: relative;
}
.lb-unconfigured-icon::before,
.lb-unconfigured-icon::after {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  height: 1px;
  background: #bbb;
}
.lb-unconfigured-icon::before { top: 10px; }
.lb-unconfigured-icon::after { top: 18px; left: 4px; width: 12px; }
.lb-unconfigured-title {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #333;
}
.lb-unconfigured-hint {
  margin: 0;
  font-size: 0.8rem;
  color: #888;
}
/**
 * Edit-mode panel UI (grayscale paper style).
 * Scoped to edit mode — does not affect live site view.
 */

body.edit-mode-active {
  --pe-paper: #e8e8e8;
  --pe-paper-elevated: #f5f5f5;
  --pe-paper-inset: #d4d4d4;
  --pe-ink: #1f1f1f;
  --pe-ink-muted: #5a5a5a;
  --pe-ink-faint: #888888;
  --pe-rule: rgba(0, 0, 0, 0.1);
  --pe-rule-strong: rgba(0, 0, 0, 0.16);
  --pe-focus-soft: rgba(0, 0, 0, 0.08);
  --pe-shadow: 0 8px 28px rgba(0, 0, 0, 0.08);
  --pe-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --pe-radius: 3px;
  --pe-font: "DM Sans", system-ui, -apple-system, sans-serif;
}

/* Expand the slot while a single element is being edited */
.page-container.editing .page-element.edit-mode {
  width: 100% !important;
  max-width: 100% !important;
}

.page-container.editing .column-container-element > .element-content > .column:has(> .column-content-area > .page-element.edit-mode) {
  grid-column: 1 / -1;
}

/* Image edit: use full content width so preview matches saved size */
.page-container.editing .pe-edit-shell.element-edit-form--image {
  width: 100%;
  max-width: none;
}

.page-container.editing .page-element.edit-mode:has(> .element-edit-form--image) {
  width: 100% !important;
  max-width: 100% !important;
}

body.edit-mode-active .pe-edit-shell {
  box-sizing: border-box;
  font-family: var(--pe-font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--pe-ink);
  background: var(--pe-paper-elevated) !important;
  border: 1px solid var(--pe-rule);
  box-shadow: var(--pe-shadow);
}

/* In-flow edit forms only — not floating overlay panels */
body.edit-mode-active .pe-edit-shell:not(.options-overlay):not(.image-uploader-modal):not(.image-uploader):not(.text-editor):not(.social-icon-modal) {
  width: 100%;
  max-width: min(920px, 100%);
  margin-inline: 0;
  padding: 1.15rem 1.25rem 1.35rem;
}

body.edit-mode-active .options-overlay.pe-edit-shell,
body.edit-mode-active .image-uploader-modal.pe-edit-shell,
body.edit-mode-active .image-uploader.pe-edit-shell,
body.edit-mode-active .text-editor.pe-edit-shell,
body.edit-mode-active .social-icon-modal.pe-edit-shell {
  width: auto;
  max-width: none;
  margin-inline: unset;
  padding: 0 !important;
}

body.edit-mode-active .pe-edit-shell label {
  font-weight: inherit;
}

body.edit-mode-active .pe-edit-shell input[type="text"],
body.edit-mode-active .pe-edit-shell input[type="url"],
body.edit-mode-active .pe-edit-shell input[type="number"],
body.edit-mode-active .pe-edit-shell textarea,
body.edit-mode-active .pe-edit-shell select,
body.edit-mode-active .pe-edit-shell .pe-input {
  margin-bottom: 0;
  border-radius: var(--pe-radius);
  border-color: var(--pe-rule-strong);
  font-family: var(--pe-font);
  box-sizing: border-box;
}

body.edit-mode-active .pe-edit-shell input[type="text"],
body.edit-mode-active .pe-edit-shell input[type="url"],
body.edit-mode-active .pe-edit-shell input[type="number"],
body.edit-mode-active .pe-edit-shell .pe-input {
  width: 100%;
  padding: 0.55rem 0.65rem;
  font-size: 13px;
  color: var(--pe-ink) !important;
  background-color: var(--pe-paper) !important;
  border: 1px solid var(--pe-rule-strong) !important;
}

body.edit-mode-active .pe-edit-shell input[type="text"]:focus,
body.edit-mode-active .pe-edit-shell input[type="url"]:focus,
body.edit-mode-active .pe-edit-shell input[type="number"]:focus,
body.edit-mode-active .pe-edit-shell .pe-input:focus {
  outline: none;
  border-color: var(--pe-ink) !important;
  box-shadow: 0 0 0 3px var(--pe-focus-soft);
}

body.edit-mode-active .pe-edit-shell .pe-edit-shell__title {
  margin: 0 0 1rem;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--pe-ink-muted);
}

body.edit-mode-active .pe-edit-shell .pe-edit-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0 1.25rem;
  align-items: start;
}

@media (min-width: 520px) {
  body.edit-mode-active .pe-edit-shell .pe-edit-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 768px) {
  body.edit-mode-active .pe-edit-shell.element-edit-form--image > .pe-edit-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

body.edit-mode-active .pe-edit-shell .pe-span-full {
  grid-column: 1 / -1;
}

body.edit-mode-active .pe-edit-shell .pe-section {
  padding: 0.85rem 0;
  border-top: 1px solid var(--pe-rule);
}

body.edit-mode-active .pe-edit-shell .pe-section:first-of-type,
body.edit-mode-active .pe-edit-shell .pe-edit-grid > .pe-section:first-child {
  border-top: none;
  padding-top: 0;
}

body.edit-mode-active .pe-edit-shell .pe-section__head {
  margin: 0 0 0.65rem;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--pe-ink-faint);
}

body.edit-mode-active .pe-edit-shell .pe-field {
  margin-bottom: 0.85rem;
}

body.edit-mode-active .pe-edit-shell .pe-field:last-child {
  margin-bottom: 0;
}

body.edit-mode-active .pe-edit-shell .pe-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--pe-ink-muted);
}

body.edit-mode-active .pe-edit-shell .pe-label__value {
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--pe-ink);
  font-size: 12px;
}

body.edit-mode-active .pe-edit-shell .pe-hint,
body.edit-mode-active .pe-edit-shell .edit-image-size-hint,
body.edit-mode-active .pe-edit-shell .edit-image-aspect-help {
  margin: 0.35rem 0 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--pe-ink-faint);
}

body.edit-mode-active .pe-edit-shell .pe-preview,
body.edit-mode-active .pe-edit-shell .image-preview-container.pe-preview {
  margin-bottom: 1rem;
  padding: 0.65rem;
  background: var(--pe-paper);
  border: 1px solid var(--pe-rule);
  text-align: center;
}

body.edit-mode-active .pe-edit-shell .pe-preview .image-preview,
body.edit-mode-active .pe-edit-shell .pe-preview .image-preview-frame {
  display: block;
  margin-inline: auto;
  max-width: 100%;
  box-shadow: none;
  border-radius: 0;
}

body.edit-mode-active .pe-edit-shell .pe-preview .image-placeholder {
  padding: 2.5rem 1rem;
  background: var(--pe-paper-inset);
  border: 1px dashed var(--pe-rule-strong);
  color: var(--pe-ink-faint);
}

body.edit-mode-active .pe-edit-shell input[type="range"],
body.edit-mode-active .pe-edit-shell .pe-range,
body.edit-mode-active .pe-edit-shell .slideshow-range-slider {
  -webkit-appearance: none !important;
  appearance: none !important;
  accent-color: var(--pe-ink) !important;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--pe-paper-inset) !important;
  outline: none;
  margin: 0.35rem 0 0;
  cursor: pointer;
  border: none;
}

body.edit-mode-active .pe-edit-shell input[type="range"]::-webkit-slider-runnable-track,
body.edit-mode-active .pe-edit-shell .pe-range::-webkit-slider-runnable-track,
body.edit-mode-active .pe-edit-shell .slideshow-range-slider::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: var(--pe-paper-inset) !important;
}

body.edit-mode-active .pe-edit-shell input[type="range"]::-webkit-slider-thumb,
body.edit-mode-active .pe-edit-shell .pe-range::-webkit-slider-thumb,
body.edit-mode-active .pe-edit-shell .slideshow-range-slider::-webkit-slider-thumb {
  -webkit-appearance: none !important;
  appearance: none !important;
  width: 14px !important;
  height: 14px !important;
  margin-top: -5px;
  border-radius: 50%;
  background: var(--pe-ink) !important;
  border: 2px solid var(--pe-paper-elevated) !important;
  box-shadow: var(--pe-shadow-sm);
  cursor: pointer;
}

body.edit-mode-active .pe-edit-shell input[type="range"]::-moz-range-track,
body.edit-mode-active .pe-edit-shell .pe-range::-moz-range-track,
body.edit-mode-active .pe-edit-shell .slideshow-range-slider::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: var(--pe-paper-inset) !important;
  border: none;
}

body.edit-mode-active .pe-edit-shell input[type="range"]::-moz-range-thumb,
body.edit-mode-active .pe-edit-shell .pe-range::-moz-range-thumb,
body.edit-mode-active .pe-edit-shell .slideshow-range-slider::-moz-range-thumb {
  width: 14px !important;
  height: 14px !important;
  border-radius: 50%;
  background: var(--pe-ink) !important;
  border: 2px solid var(--pe-paper-elevated) !important;
  box-shadow: var(--pe-shadow-sm);
  cursor: pointer;
}

body.edit-mode-active .pe-edit-shell .pe-select-wrap {
  position: relative;
}

body.edit-mode-active .pe-edit-shell .pe-select-wrap::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid var(--pe-ink-muted);
  border-bottom: 1.5px solid var(--pe-ink-muted);
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}

body.edit-mode-active .pe-edit-shell .pe-select,
body.edit-mode-active .pe-edit-shell .edit-image-aspect-ratio {
  width: 100%;
  padding: 0.55rem 2rem 0.55rem 0.65rem;
  font-family: var(--pe-font);
  font-size: 13px;
  color: var(--pe-ink);
  background: var(--pe-paper);
  border: 1px solid var(--pe-rule-strong);
  border-radius: var(--pe-radius);
  cursor: pointer;
  appearance: none;
}

body.edit-mode-active .pe-edit-shell .pe-select:focus,
body.edit-mode-active .pe-edit-shell .edit-image-aspect-ratio:focus {
  outline: none;
  border-color: var(--pe-ink);
  box-shadow: 0 0 0 3px var(--pe-focus-soft);
}

body.edit-mode-active .pe-edit-shell .pe-toggle-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

body.edit-mode-active .pe-edit-shell .pe-toggle {
  position: relative;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}

body.edit-mode-active .pe-edit-shell .pe-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

body.edit-mode-active .pe-edit-shell .pe-toggle__track {
  position: absolute;
  inset: 0;
  background: var(--pe-paper-inset);
  border: 1px solid var(--pe-rule-strong);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

body.edit-mode-active .pe-edit-shell .pe-toggle__track::before {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  left: 2px;
  top: 2px;
  background: var(--pe-paper-elevated);
  border-radius: 50%;
  box-shadow: var(--pe-shadow-sm);
  transition: transform 0.2s ease;
}

body.edit-mode-active .pe-edit-shell .pe-toggle input:checked + .pe-toggle__track {
  background: var(--pe-ink);
  border-color: var(--pe-ink);
}

body.edit-mode-active .pe-edit-shell .pe-toggle input:checked + .pe-toggle__track::before {
  transform: translateX(16px);
}

body.edit-mode-active .pe-edit-shell .pe-toggle__label,
body.edit-mode-active .pe-edit-shell .toggle-label {
  margin-left: 0;
  font-size: 13px;
  color: var(--pe-ink-muted);
}

body.edit-mode-active .pe-edit-shell .pe-segmented {
  display: inline-flex;
  padding: 3px;
  background: var(--pe-paper);
  border: 1px solid var(--pe-rule-strong);
  border-radius: var(--pe-radius);
  gap: 2px;
}

body.edit-mode-active .pe-edit-shell .pe-segmented label {
  margin: 0;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

body.edit-mode-active .pe-edit-shell .pe-segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

body.edit-mode-active .pe-edit-shell .pe-segmented__btn {
  display: block;
  padding: 0.35rem 0.75rem;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pe-ink-faint);
  border-radius: 2px;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
  user-select: none;
}

body.edit-mode-active .pe-edit-shell .pe-segmented input:checked + .pe-segmented__btn {
  background: var(--pe-paper-elevated);
  color: var(--pe-ink);
  box-shadow: var(--pe-shadow-sm);
}

body.edit-mode-active .pe-edit-shell .pe-check {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  cursor: pointer;
}

body.edit-mode-active .pe-edit-shell .pe-check input {
  position: absolute;
  opacity: 0;
}

body.edit-mode-active .pe-edit-shell .pe-check__box {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 1px;
  border: 1px solid var(--pe-rule-strong);
  border-radius: 2px;
  background: var(--pe-paper);
  display: grid;
  place-items: center;
}

/* Hide native Pico radios inside the paper shell (custom pe-segmented / pe-check UI) */
body.edit-mode-active .pe-edit-shell .pe-segmented input[type="radio"],
body.edit-mode-active .pe-edit-shell .pe-check input[type="checkbox"] {
  position: absolute !important;
  opacity: 0 !important;
  width: 0 !important;
  height: 0 !important;
  margin: 0 !important;
}

body.edit-mode-active .pe-edit-shell .pe-check input:checked + .pe-check__box {
  background: var(--pe-ink) !important;
  border-color: var(--pe-ink) !important;
}

body.edit-mode-active .pe-edit-shell .pe-check input:checked + .pe-check__box::after {
  content: "";
  width: 8px;
  height: 5px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translateY(-1px);
}

body.edit-mode-active .pe-edit-shell .pe-check__text {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--pe-ink-muted);
}

body.edit-mode-active .pe-edit-shell .pe-check__sub {
  display: block;
  margin-top: 0.15rem;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--pe-ink-faint);
}

body.edit-mode-active .pe-edit-shell .pe-inline-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: flex-end;
}

body.edit-mode-active .pe-edit-shell .pe-input-compact,
body.edit-mode-active .pe-edit-shell .edit-image-border-width,
body.edit-mode-active .pe-edit-shell .edit-image-border-radius {
  width: 4.5rem;
  padding: 0.45rem 0.5rem;
  font-family: var(--pe-font);
  font-size: 13px;
  color: var(--pe-ink);
  background: var(--pe-paper);
  border: 1px solid var(--pe-rule-strong);
  border-radius: var(--pe-radius);
}

body.edit-mode-active .pe-edit-shell .pe-color-swatch,
body.edit-mode-active .pe-edit-shell .edit-image-border-color {
  width: 2.75rem;
  height: 2.1rem;
  padding: 0;
  border: 1px solid var(--pe-rule-strong);
  border-radius: var(--pe-radius);
  cursor: pointer;
  background: var(--pe-paper);
}

body.edit-mode-active .pe-edit-shell .pe-color-swatch::-webkit-color-swatch-wrapper,
body.edit-mode-active .pe-edit-shell .edit-image-border-color::-webkit-color-swatch-wrapper {
  padding: 3px;
}

body.edit-mode-active .pe-edit-shell .pe-color-swatch::-webkit-color-swatch,
body.edit-mode-active .pe-edit-shell .edit-image-border-color::-webkit-color-swatch {
  border: none;
  border-radius: 1px;
}

body.edit-mode-active .pe-edit-shell .pe-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--pe-rule);
}

body.edit-mode-active .pe-edit-shell .pe-btn,
body.edit-mode-active .pe-edit-shell .upload-image-btn,
body.edit-mode-active .pe-edit-shell button.pe-btn,
html body.edit-mode-active body.edit-mode-active .pe-edit-shell button.pe-btn,
html body.edit-mode-active body.edit-mode-active .pe-edit-shell .upload-image-btn {
  --background-color: var(--pe-paper) !important;
  --border-color: var(--pe-rule-strong) !important;
  --border-width: 1px !important;
  --color: var(--pe-ink-muted) !important;
  display: inline-flex !important;
  align-items: center;
  gap: 0.4rem;
  width: auto !important;
  min-width: 0;
  margin: 0 !important;
  padding: 0.45rem 0.85rem !important;
  font-family: var(--pe-font);
  font-size: 11px !important;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--pe-ink-muted) !important;
  background-color: var(--pe-paper) !important;
  border: 1px solid var(--pe-rule-strong) !important;
  border-width: 1px !important;
  border-style: solid !important;
  border-radius: var(--pe-radius) !important;
  box-shadow: none !important;
  outline: none !important;
  cursor: pointer;
}

body.edit-mode-active .pe-edit-shell .pe-btn:hover,
body.edit-mode-active .pe-edit-shell .upload-image-btn:hover,
body.edit-mode-active .pe-edit-shell button.pe-btn:hover {
  --background-color: var(--pe-paper-elevated) !important;
  --border-color: rgba(0, 0, 0, 0.22) !important;
  --color: var(--pe-ink) !important;
  background-color: var(--pe-paper-elevated) !important;
  border-color: rgba(0, 0, 0, 0.22) !important;
  color: var(--pe-ink) !important;
}

body.edit-mode-active .pe-edit-shell .pe-btn--primary,
body.edit-mode-active .pe-edit-shell button.pe-btn--primary,
body.edit-mode-active .pe-edit-shell button.btn-primary.pe-btn,
html body.edit-mode-active body.edit-mode-active .pe-edit-shell button.pe-btn--primary {
  --background-color: var(--pe-paper) !important;
  --border-color: var(--pe-rule-strong) !important;
  --color: var(--pe-ink) !important;
  color: var(--pe-ink) !important;
  background-color: var(--pe-paper) !important;
  border: 1px solid var(--pe-rule-strong) !important;
}

body.edit-mode-active .pe-edit-shell .pe-btn--primary:hover,
body.edit-mode-active .pe-edit-shell button.pe-btn--primary:hover,
body.edit-mode-active .pe-edit-shell button.btn-primary.pe-btn:hover {
  --background-color: var(--pe-paper-elevated) !important;
  --border-color: rgba(0, 0, 0, 0.22) !important;
  --color: var(--pe-ink) !important;
  color: var(--pe-ink) !important;
  background-color: var(--pe-paper-elevated) !important;
  border-color: rgba(0, 0, 0, 0.22) !important;
}

body.edit-mode-active .pe-edit-shell .pe-btn svg,
body.edit-mode-active .pe-edit-shell .upload-image-btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  flex-shrink: 0;
}

body.edit-mode-active .pe-edit-shell .pe-footer-actions,
body.edit-mode-active .pe-edit-shell .edit-form-buttons {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.25rem;
  padding-top: 0;
  border-top: none;
}

body.edit-mode-active .pe-edit-shell .pe-footer-actions .btn-secondary,
body.edit-mode-active .pe-edit-shell .edit-form-buttons .btn-secondary,
body.edit-mode-active .pe-edit-shell .pe-footer-actions button.pe-btn,
body.edit-mode-active .pe-edit-shell .edit-form-buttons button.pe-btn:not(.pe-btn--primary) {
  --background-color: var(--pe-paper) !important;
  --border-color: var(--pe-rule-strong) !important;
  --color: var(--pe-ink-muted) !important;
  width: auto;
  padding: 0.45rem 0.85rem;
  font-family: var(--pe-font);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--pe-ink-muted) !important;
  background-color: var(--pe-paper) !important;
  border: 1px solid var(--pe-rule-strong) !important;
  border-radius: var(--pe-radius);
  box-shadow: none !important;
}

body.edit-mode-active .pe-edit-shell .image-link-section {
  margin-top: 0.5rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--pe-rule);
}

body.edit-mode-active .pe-edit-shell .image-link-section .pe-edit-grid--link {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0 1.25rem;
}

@media (min-width: 520px) {
  body.edit-mode-active .pe-edit-shell .image-link-section .pe-edit-grid--link {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 768px) {
  body.edit-mode-active .pe-edit-shell.element-edit-form--image .image-link-section .pe-edit-grid--link {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

body.edit-mode-active .pe-edit-shell .image-link-section .pe-edit-grid--link .pe-span-full {
  grid-column: 1 / -1;
}

body.edit-mode-active .pe-edit-shell .image-link-section h4 {
  margin: 0 0 0.65rem;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--pe-ink-faint);
}

body.edit-mode-active .pe-edit-shell .image-frame-height-row[hidden],
body.edit-mode-active .pe-edit-shell .image-frame-height-section[hidden] {
  display: none !important;
}

body.edit-mode-active .pe-edit-shell.element-edit-form--image .pe-preview,
body.edit-mode-active .pe-edit-shell.element-edit-form--image .image-preview-container.pe-preview {
  width: 100%;
  box-sizing: border-box;
}

body.edit-mode-active .pe-edit-shell .link-type-radio-group.pe-segmented {
  flex-wrap: wrap;
  width: 100%;
  margin-bottom: 0.85rem;
}

body.edit-mode-active .pe-edit-shell textarea,
body.edit-mode-active .pe-edit-shell .edit-text-content {
  width: 100%;
  min-height: 8rem;
  padding: 0.55rem 0.65rem;
  font-family: var(--pe-font);
  font-size: 13px;
  line-height: 1.45;
  color: var(--pe-ink) !important;
  background-color: var(--pe-paper) !important;
  border: 1px solid var(--pe-rule-strong) !important;
  border-radius: var(--pe-radius);
  resize: vertical;
  margin-bottom: 0.85rem;
  box-sizing: border-box;
}

body.edit-mode-active .pe-edit-shell textarea:focus,
body.edit-mode-active .pe-edit-shell .edit-text-content:focus {
  outline: none;
  border-color: var(--pe-ink) !important;
  box-shadow: 0 0 0 3px var(--pe-focus-soft);
}

/* Legacy edit forms: paper labels without markup changes */
body.edit-mode-active .pe-edit-shell > label:not(.pe-check):not(.pe-toggle),
body.edit-mode-active .pe-edit-shell .form-group > label:not(.pe-check),
body.edit-mode-active .pe-edit-shell .page-manager-button-edit-shell > label,
body.edit-mode-active .pe-edit-shell .settings-container > label,
body.edit-mode-active .pe-edit-shell .metadata-fields-container label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--pe-ink-muted);
}

body.edit-mode-active .pe-edit-shell h3,
body.edit-mode-active .pe-edit-shell h4,
body.edit-mode-active .pe-edit-shell .section-title {
  margin: 0 0 0.65rem;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--pe-ink-faint);
}

body.edit-mode-active .pe-edit-shell .rich-text-note,
body.edit-mode-active .pe-edit-shell .form-hint,
body.edit-mode-active .pe-edit-shell small {
  font-size: 12px;
  line-height: 1.4;
  color: var(--pe-ink-faint);
}

body.edit-mode-active .pe-edit-shell .page-manager-button-edit-shell,
body.edit-mode-active .pe-edit-shell .settings-container,
body.edit-mode-active .pe-edit-shell .metadata-fields-container {
  margin-top: 0.25rem;
}

body.edit-mode-active .pe-edit-shell.page-manager-button-edit-form {
  max-width: min(920px, 100%);
}

body.edit-mode-active .pe-edit-shell.element-edit-form--column-container {
  max-width: none;
  width: 100%;
}

body.edit-mode-active .pe-edit-shell .column-container-edit-footer {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--pe-rule);
}

body.edit-mode-active .pe-edit-shell .form-group label input[type="checkbox"]:checked {
  background-color: var(--pe-ink) !important;
  border-color: var(--pe-ink) !important;
}

/* Inline text editor (Quill) — lives outside pe-edit-shell */
:is(.page-container.editing, .sidebar.editing) .inline-editor-wrapper .text-width-container > div:first-child {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--pe-ink-faint);
}

:is(.page-container.editing, .sidebar.editing) .inline-editor-wrapper input[type="range"],
:is(.page-container.editing, .sidebar.editing) .inline-editor-wrapper .slideshow-range-slider {
  -webkit-appearance: none !important;
  appearance: none !important;
  accent-color: var(--pe-ink) !important;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--pe-paper-inset) !important;
  outline: none;
  margin: 0.35rem 0 0;
  cursor: pointer;
  border: none;
}

:is(.page-container.editing, .sidebar.editing) .inline-editor-wrapper input[type="range"]::-webkit-slider-runnable-track,
:is(.page-container.editing, .sidebar.editing) .inline-editor-wrapper .slideshow-range-slider::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: var(--pe-paper-inset) !important;
}

:is(.page-container.editing, .sidebar.editing) .inline-editor-wrapper input[type="range"]::-webkit-slider-thumb,
:is(.page-container.editing, .sidebar.editing) .inline-editor-wrapper .slideshow-range-slider::-webkit-slider-thumb {
  -webkit-appearance: none !important;
  appearance: none !important;
  width: 14px !important;
  height: 14px !important;
  margin-top: -5px;
  border-radius: 50%;
  background: var(--pe-ink) !important;
  border: 2px solid var(--pe-paper-elevated) !important;
  box-shadow: var(--pe-shadow-sm);
  cursor: pointer;
}

:is(.page-container.editing, .sidebar.editing) .inline-editor-wrapper input[type="range"]::-moz-range-track,
:is(.page-container.editing, .sidebar.editing) .inline-editor-wrapper .slideshow-range-slider::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: var(--pe-paper-inset) !important;
  border: none;
}

:is(.page-container.editing, .sidebar.editing) .inline-editor-wrapper input[type="range"]::-moz-range-thumb,
:is(.page-container.editing, .sidebar.editing) .inline-editor-wrapper .slideshow-range-slider::-moz-range-thumb {
  width: 14px !important;
  height: 14px !important;
  border-radius: 50%;
  background: var(--pe-ink) !important;
  border: 2px solid var(--pe-paper-elevated) !important;
  box-shadow: var(--pe-shadow-sm);
  cursor: pointer;
}

:is(.page-container.editing, .sidebar.editing) .inline-editor-wrapper .pe-check {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  cursor: pointer;
  margin-top: 0.85rem;
}

:is(.page-container.editing, .sidebar.editing) .inline-editor-wrapper .pe-check input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

:is(.page-container.editing, .sidebar.editing) .inline-editor-wrapper .pe-check__box {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 1px;
  border: 1px solid var(--pe-rule-strong);
  border-radius: 2px;
  background: var(--pe-paper);
  display: grid;
  place-items: center;
}

:is(.page-container.editing, .sidebar.editing) .inline-editor-wrapper .pe-check input:checked + .pe-check__box {
  background: var(--pe-ink) !important;
  border-color: var(--pe-ink) !important;
}

:is(.page-container.editing, .sidebar.editing) .inline-editor-wrapper .pe-check input:checked + .pe-check__box::after {
  content: "";
  width: 8px;
  height: 5px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translateY(-1px);
}

:is(.page-container.editing, .sidebar.editing) .inline-editor-wrapper .pe-check__text {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--pe-ink-muted);
}

:is(.page-container.editing, .sidebar.editing) .inline-editor-controls.pe-footer-actions,
:is(.page-container.editing, .sidebar.editing) .inline-editor-controls {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--pe-rule);
}

:is(.page-container.editing, .sidebar.editing) .inline-editor-controls .pe-btn,
.page-container.editing .add-element-panel .pe-btn,
.page-container.editing .add-element-container .pe-btn,
html body.edit-mode-active :is(.page-container.editing, .sidebar.editing) button.pe-btn {
  display: inline-flex !important;
  align-items: center;
  gap: 0.4rem;
  width: auto !important;
  min-width: 0;
  margin: 0 !important;
  padding: 0.45rem 0.85rem !important;
  font-family: var(--pe-font);
  font-size: 11px !important;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--pe-ink-muted) !important;
  background-color: var(--pe-paper) !important;
  border: 1px solid var(--pe-rule-strong) !important;
  border-radius: var(--pe-radius) !important;
  box-shadow: none !important;
  outline: none !important;
  cursor: pointer;
}

:is(.page-container.editing, .sidebar.editing) .inline-editor-controls .pe-btn:hover,
.page-container.editing .add-element-panel .pe-btn:hover,
.page-container.editing .add-element-container .pe-btn:hover {
  color: var(--pe-ink) !important;
  background-color: var(--pe-paper-elevated) !important;
  border-color: rgba(0, 0, 0, 0.22) !important;
}

:is(.page-container.editing, .sidebar.editing) .inline-editor-controls .pe-btn--primary,
.page-container.editing .add-element-panel .pe-btn--primary,
.page-container.editing .add-element-container .pe-btn--primary {
  color: var(--pe-ink) !important;
  background-color: var(--pe-paper) !important;
  border-color: var(--pe-rule-strong) !important;
}

.page-container.editing .add-element-container .add-page-element-btn.pe-btn {
  padding: 0.55rem 1rem !important;
}

.page-container.editing .add-element-panel .pe-footer-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.75rem;
}

html body.edit-mode-active .text-editor-overlay .pe-btn,
html body.edit-mode-active .image-uploader-overlay .pe-btn {
  display: inline-flex !important;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem !important;
  font-family: var(--pe-font, "DM Sans", system-ui, sans-serif);
  font-size: 11px !important;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--pe-ink-muted, #5a5a5a) !important;
  background-color: var(--pe-paper, #f5f5f5) !important;
  border: 1px solid var(--pe-rule-strong, rgba(0, 0, 0, 0.16)) !important;
  border-radius: var(--pe-radius, 3px) !important;
  box-shadow: none !important;
  cursor: pointer;
}

html body.edit-mode-active .text-editor-overlay .pe-btn--primary,
html body.edit-mode-active .image-uploader-overlay .pe-btn--primary {
  color: var(--pe-ink, #1f1f1f) !important;
}

html body.edit-mode-active .text-editor-overlay .text-editor .pe-check {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  cursor: pointer;
  margin-top: 0.85rem;
}

html body.edit-mode-active .text-editor-overlay .text-editor .pe-check input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

html body.edit-mode-active .text-editor-overlay .text-editor .pe-check__box {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 1px;
  border: 1px solid var(--pe-rule-strong, rgba(0, 0, 0, 0.16));
  border-radius: 2px;
  background: var(--pe-paper, #f5f5f5);
  display: grid;
  place-items: center;
}

html body.edit-mode-active .text-editor-overlay .text-editor .pe-check input:checked + .pe-check__box {
  background: var(--pe-ink, #1f1f1f) !important;
  border-color: var(--pe-ink, #1f1f1f) !important;
}

html body.edit-mode-active .text-editor-overlay .text-editor .pe-check input:checked + .pe-check__box::after {
  content: "";
  width: 8px;
  height: 5px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translateY(-1px);
}

html body.edit-mode-active .text-editor-overlay .text-editor .pe-check__text {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--pe-ink-muted, #5a5a5a);
}

html body.edit-mode-active .text-editor-overlay .text-editor input[type="range"],
html body.edit-mode-active .text-editor-overlay .text-editor .slideshow-range-slider {
  accent-color: var(--pe-ink, #1f1f1f) !important;
}

html body.edit-mode-active .text-editor-overlay .text-editor input[type="range"]::-webkit-slider-thumb,
html body.edit-mode-active .text-editor-overlay .text-editor .slideshow-range-slider::-webkit-slider-thumb {
  background: var(--pe-ink, #1f1f1f) !important;
}



/* Style Customizer (sidebar) */
.sidebar.editing .style-editor-wrapper {
  width: 100%;
  margin-top: 0.75rem;
}

.sidebar.editing .style-editor-panel.pe-edit-shell {
  width: 100%;
  max-width: 100%;
  background: var(--pe-paper-elevated) !important;
  border: 1px solid var(--pe-rule) !important;
  box-shadow: var(--pe-shadow);
}

.sidebar.editing .style-editor-panel.pe-edit-shell .style-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.sidebar.editing .style-editor-panel.pe-edit-shell .style-form .form-group {
  margin: 0;
}

.sidebar.editing .style-editor-panel.pe-edit-shell .style-form .form-group > label,
.sidebar.editing .style-editor-panel.pe-edit-shell .style-form .section-header h4 {
  display: block;
  margin: 0 0 0.35rem;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--pe-ink-faint);
}

.sidebar.editing .style-editor-panel.pe-edit-shell .style-form input[type="text"],
.sidebar.editing .style-editor-panel.pe-edit-shell .style-form input[type="color"],
.sidebar.editing .style-editor-panel.pe-edit-shell .style-form select,
.sidebar.editing .style-editor-panel.pe-edit-shell .style-form textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 0.45rem 0.55rem;
  font-family: var(--pe-font);
  font-size: 13px;
  color: var(--pe-ink);
  background: var(--pe-paper-elevated);
  border: 1px solid var(--pe-rule-strong);
  border-radius: var(--pe-radius);
}

.sidebar.editing .style-editor-panel.pe-edit-shell .style-form input[type="color"] {
  width: 2.75rem;
  height: 2.1rem;
  padding: 0;
}

.sidebar.editing .style-editor-panel.pe-edit-shell .style-form small {
  display: block;
  margin-top: 0.25rem;
  font-size: 12px;
  color: var(--pe-ink-faint);
}

.sidebar.editing .style-editor-panel.pe-edit-shell .section-header {
  margin-top: 0.5rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--pe-rule);
  border-bottom: none;
}

.sidebar.editing .style-editor-panel.pe-edit-shell .form-actions.pe-footer-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--pe-rule);
}

.sidebar.editing .style-editor-panel.pe-edit-shell .form-actions .pe-btn,
.sidebar.editing .style-editor-panel.pe-edit-shell .style-bg-image-row .pe-btn {
  display: inline-flex !important;
  align-items: center;
  gap: 0.4rem;
  width: auto !important;
  margin: 0 !important;
  padding: 0.45rem 0.85rem !important;
  font-family: var(--pe-font);
  font-size: 11px !important;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--pe-ink-muted) !important;
  background-color: var(--pe-paper-elevated) !important;
  border: 1px solid var(--pe-rule-strong) !important;
  border-radius: var(--pe-radius) !important;
  box-shadow: none !important;
  cursor: pointer;
}

.sidebar.editing .style-editor-panel.pe-edit-shell .form-actions .pe-btn--primary {
  color: var(--pe-ink) !important;
}

.sidebar.editing .style-editor-panel.pe-edit-shell .style-form .form-group label input[type="checkbox"] {
  accent-color: var(--pe-ink);
}

/* Add Page / menu item form (sidebar) */
body.edit-mode-active .add-form.pe-edit-shell {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  padding: 0 1rem;
  margin-top: 0.5rem;
  box-sizing: border-box;
}

body.edit-mode-active .add-form.pe-edit-shell.visible {
  max-height: 720px !important;
  overflow: visible !important;
  padding: 1.15rem 1.25rem 1.35rem !important;
  box-shadow: var(--pe-shadow) !important;
  background: var(--pe-paper-elevated) !important;
  border: 1px solid var(--pe-rule) !important;
}

body.edit-mode-active .add-form.pe-edit-shell .radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.85rem 0;
  padding: 0.2rem;
  background: var(--pe-paper-inset);
  border: 1px solid var(--pe-rule);
  border-radius: var(--pe-radius);
}

body.edit-mode-active .add-form.pe-edit-shell .radio-group label {
  flex: 1 1 auto;
  min-width: 5.5rem;
  margin: 0;
  padding: 0.4rem 0.55rem;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--pe-ink-muted);
  text-align: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--pe-radius);
  cursor: pointer;
}

body.edit-mode-active .add-form.pe-edit-shell .radio-group label:has(input:checked) {
  color: var(--pe-ink);
  background: var(--pe-paper-elevated);
  border-color: var(--pe-rule-strong);
  box-shadow: var(--pe-shadow-sm);
}

body.edit-mode-active .add-form.pe-edit-shell .radio-group input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

body.edit-mode-active .add-form.pe-edit-shell #galleryParentContainer {
  display: none !important;
}

body.edit-mode-active .add-form.pe-edit-shell #galleryParentContainer label {
  display: block;
  margin: 0.65rem 0 0.35rem;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--pe-ink-faint);
}

/* Site metadata editor (sidebar) */
body.edit-mode-active #metadataEditor.pe-edit-shell,
body.edit-mode-active .metadata-editor.pe-edit-shell {
  box-shadow: var(--pe-shadow) !important;
  background: var(--pe-paper-elevated) !important;
  border: 1px solid var(--pe-rule) !important;
  border-radius: var(--pe-radius);
  padding: 1.15rem 1.25rem 1.35rem !important;
}

body.edit-mode-active #metadataEditor.pe-edit-shell .form-group,
body.edit-mode-active .metadata-editor.pe-edit-shell .form-group {
  margin-bottom: 0.85rem !important;
}

body.edit-mode-active #metadataEditor.pe-edit-shell .form-group > label,
body.edit-mode-active .metadata-editor.pe-edit-shell .form-group > label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--pe-ink-faint);
}

body.edit-mode-active #metadataEditor.pe-edit-shell .form-group small,
body.edit-mode-active .metadata-editor.pe-edit-shell .form-group small {
  display: block;
  margin-top: 0.25rem;
  font-size: 12px;
  color: var(--pe-ink-faint);
}

body.edit-mode-active #metadataEditor.pe-edit-shell .section-header,
body.edit-mode-active .metadata-editor.pe-edit-shell .section-header {
  margin-top: 0.5rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--pe-rule);
}

body.edit-mode-active #metadataEditor.pe-edit-shell .section-header h4,
body.edit-mode-active .metadata-editor.pe-edit-shell .section-header h4 {
  margin: 0 0 0.35rem;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--pe-ink-faint);
}

body.edit-mode-active #metadataEditor.pe-edit-shell input[type="checkbox"],
body.edit-mode-active .metadata-editor.pe-edit-shell input[type="checkbox"] {
  accent-color: var(--pe-ink);
}

body.edit-mode-active #metadataEditor.pe-edit-shell .form-actions.pe-footer-actions,
body.edit-mode-active .metadata-editor.pe-edit-shell .form-actions.pe-footer-actions {
  margin-top: 1rem !important;
  padding-top: 0.85rem;
  border-top: 1px solid var(--pe-rule);
}

/* Page template picker (empty page) */
.page-container.editing .template-selection-wrapper.pe-edit-shell {
  max-width: min(920px, 100%);
  margin: 1.25rem auto;
  text-align: left;
}

.page-container.editing .template-selection-wrapper.pe-edit-shell .pe-edit-shell__title,
.page-container.editing .template-selection-wrapper.pe-edit-shell .template-selection-title {
  margin: 0 0 0.35rem;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--pe-ink-muted);
}

.page-container.editing .template-selection-wrapper.pe-edit-shell .template-selection-description {
  margin: 0 0 1rem;
  font-size: 13px;
  color: var(--pe-ink-faint);
}

.page-container.editing .template-selection-wrapper.pe-edit-shell .template-selection-grid {
  gap: 0.85rem;
}

.page-container.editing .template-selection-wrapper.pe-edit-shell .template-card {
  padding: 0.65rem !important;
  background: var(--pe-paper) !important;
  border: 1px solid var(--pe-rule-strong) !important;
  border-radius: var(--pe-radius) !important;
  box-shadow: none !important;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.page-container.editing .template-selection-wrapper.pe-edit-shell .template-card:hover,
.page-container.editing .template-selection-wrapper.pe-edit-shell .template-card:focus {
  transform: none !important;
  border-color: rgba(0, 0, 0, 0.22) !important;
  background: var(--pe-paper-elevated) !important;
  box-shadow: var(--pe-shadow-sm) !important;
  outline: none;
}

.page-container.editing .template-selection-wrapper.pe-edit-shell .template-card:focus-visible {
  outline: 2px solid var(--pe-ink);
  outline-offset: 2px;
}

.page-container.editing .template-selection-wrapper.pe-edit-shell .template-preview {
  height: 120px;
  margin-bottom: 0.55rem;
  border: 1px solid var(--pe-rule);
  border-radius: var(--pe-radius);
  background: var(--pe-paper-inset);
}

.page-container.editing .template-selection-wrapper.pe-edit-shell .template-name {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pe-ink);
}

.page-container.editing .template-selection-wrapper.pe-edit-shell .template-description {
  font-size: 12px;
  color: var(--pe-ink-faint);
}

body.edit-mode-active .pe-edit-shell .seo-tips-container {
  margin-top: 1rem;
  padding: 0.85rem;
  background: var(--pe-paper-inset);
  border: 1px solid var(--pe-rule);
  border-radius: var(--pe-radius);
}

body.edit-mode-active .pe-edit-shell .seo-tips-container h4 {
  margin: 0 0 0.5rem;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--pe-ink-faint);
}

body.edit-mode-active .pe-edit-shell .page-padding-section {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--pe-rule);
}

/* Add Sidebar Element form */
body.edit-mode-active #sidebarElementForm.pe-edit-shell,
body.edit-mode-active .sidebar-element-form.pe-edit-shell {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  padding: 0 1rem;
  margin-top: 0.5rem;
  box-sizing: border-box;
}

body.edit-mode-active #sidebarElementForm.pe-edit-shell.visible,
body.edit-mode-active .sidebar-element-form.pe-edit-shell.visible {
  max-height: 480px !important;
  overflow: visible !important;
  padding: 1.15rem 1.25rem 1.35rem !important;
  box-shadow: var(--pe-shadow) !important;
  background: var(--pe-paper-elevated) !important;
  border: 1px solid var(--pe-rule) !important;
  display: block !important;
}

body.edit-mode-active #sidebarElementForm.pe-edit-shell .pe-hint,
body.edit-mode-active .sidebar-element-form.pe-edit-shell .pe-hint {
  margin: 0 0 0.85rem;
  font-size: 13px;
  color: var(--pe-ink-faint);
}

body.edit-mode-active #sidebarElementForm.pe-edit-shell .radio-group,
body.edit-mode-active .sidebar-element-form.pe-edit-shell .radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 0.85rem;
  padding: 0.2rem;
  background: var(--pe-paper-inset);
  border: 1px solid var(--pe-rule);
  border-radius: var(--pe-radius);
}

body.edit-mode-active #sidebarElementForm.pe-edit-shell .radio-group label,
body.edit-mode-active .sidebar-element-form.pe-edit-shell .radio-group label {
  flex: 1 1 auto;
  min-width: 5.5rem;
  margin: 0;
  padding: 0.4rem 0.55rem;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--pe-ink-muted);
  text-align: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--pe-radius);
  cursor: pointer;
}

body.edit-mode-active #sidebarElementForm.pe-edit-shell .radio-group label:has(input:checked),
body.edit-mode-active .sidebar-element-form.pe-edit-shell .radio-group label:has(input:checked) {
  color: var(--pe-ink);
  background: var(--pe-paper-elevated);
  border-color: var(--pe-rule-strong);
  box-shadow: var(--pe-shadow-sm);
}

body.edit-mode-active #sidebarElementForm.pe-edit-shell .radio-group input[type="radio"],
body.edit-mode-active .sidebar-element-form.pe-edit-shell .radio-group input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

/* Sidebar element edit forms (image, social, languages) */
.sidebar.editing .element-edit-form.pe-edit-shell {
  max-width: 100%;
  margin: 0.5rem 0 1rem;
}

.sidebar.editing .element-edit-form.pe-edit-shell > .pe-label {
  display: block;
  margin: 0 0 0.35rem;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--pe-ink-faint);
}

.sidebar.editing .element-edit-form.pe-edit-shell .pe-section {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--pe-rule);
}

.sidebar.editing .element-edit-form.pe-edit-shell .pe-section:first-of-type,
.sidebar.editing .element-edit-form.pe-edit-shell .sidebar-edit-body > .pe-section:first-child {
  margin-top: 0.75rem;
  padding-top: 0;
  border-top: none;
}

.sidebar.editing .element-edit-form.pe-edit-shell .pe-section__head {
  margin: 0 0 0.65rem;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--pe-ink-faint);
}

.sidebar.editing .element-edit-form.pe-edit-shell .pe-field {
  margin-bottom: 0.85rem;
}

.sidebar.editing .element-edit-form.pe-edit-shell .pe-preview,
.sidebar.editing .element-edit-form.pe-edit-shell .image-preview-container.pe-preview {
  padding: 0.75rem;
  background: var(--pe-paper-inset);
  border: 1px solid var(--pe-rule);
  border-radius: var(--pe-radius);
}

.sidebar.editing .element-edit-form.pe-edit-shell .image-placeholder {
  padding: 2rem 1rem !important;
  background: var(--pe-paper) !important;
  border: 1px dashed var(--pe-rule-strong) !important;
  color: var(--pe-ink-faint) !important;
  border-radius: var(--pe-radius);
}

.sidebar.editing .element-edit-form.pe-edit-shell .upload-image-btn {
  display: inline-flex !important;
  margin: 0.65rem 0 0 !important;
}

.sidebar.editing .element-edit-form.pe-edit-shell .alignment-radio-group.pe-segmented,
.sidebar.editing .element-edit-form.pe-edit-shell .pe-segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.35rem;
  padding: 0.2rem;
  background: var(--pe-paper-inset);
  border: 1px solid var(--pe-rule);
  border-radius: var(--pe-radius);
}

.sidebar.editing .element-edit-form.pe-edit-shell .pe-segmented label,
.sidebar.editing .element-edit-form.pe-edit-shell .alignment-radio-group.pe-segmented label {
  flex: 1 1 auto;
  min-width: 4.5rem;
  margin: 0;
  padding: 0.4rem 0.55rem;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--pe-ink-muted);
  text-align: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--pe-radius);
  cursor: pointer;
}

.sidebar.editing .element-edit-form.pe-edit-shell .pe-segmented label:has(input:checked),
.sidebar.editing .element-edit-form.pe-edit-shell .alignment-radio-group.pe-segmented label:has(input:checked) {
  color: var(--pe-ink);
  background: var(--pe-paper-elevated);
  border-color: var(--pe-rule-strong);
  box-shadow: var(--pe-shadow-sm);
}

.sidebar.editing .element-edit-form.pe-edit-shell .pe-segmented input[type="radio"],
.sidebar.editing .element-edit-form.pe-edit-shell .alignment-radio-group.pe-segmented input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.sidebar.editing .element-edit-form.pe-edit-shell .preview-grid {
  padding: 0.65rem;
  background: var(--pe-paper);
  border: 1px solid var(--pe-rule);
  border-radius: var(--pe-radius);
}

/* Social icons grid in edit mode */
.sidebar.editing .social-icons-grid .social-icon-slot {
  border: 1px dashed var(--pe-rule-strong) !important;
  border-radius: var(--pe-radius);
  background: var(--pe-paper) !important;
}

.sidebar.editing .social-icons-grid .add-social-icon {
  color: var(--pe-ink-muted) !important;
  background: transparent !important;
  border: none !important;
}

/* Social icon modals */
body.edit-mode-active .social-icon-overlay {
  background-color: rgba(0, 0, 0, 0.45) !important;
}

body.edit-mode-active .social-icon-modal.pe-edit-shell,
body.edit-mode-active .image-uploader-modal.pe-edit-shell,
body.edit-mode-active .image-uploader.pe-edit-shell,
body.edit-mode-active .text-editor.pe-edit-shell {
  box-shadow: var(--pe-shadow) !important;
  background: var(--pe-paper-elevated) !important;
  border: 1px solid var(--pe-rule) !important;
  border-radius: var(--pe-radius);
  padding: 1.15rem 1.25rem 1.35rem !important;
  max-height: 80vh;
  overflow-y: auto;
}

body.edit-mode-active .image-uploader-modal.pe-edit-shell .pe-edit-shell__title,
body.edit-mode-active .image-uploader.pe-edit-shell .pe-edit-shell__title {
  margin: 0;
  flex: 1;
}

body.edit-mode-active .social-icon-modal__header,
body.edit-mode-active .uploader-header,
body.edit-mode-active .text-editor.pe-edit-shell .editor-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

body.edit-mode-active .social-icon-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
}

body.edit-mode-active .social-icon-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  padding: 0.85rem 0.55rem;
  background: var(--pe-paper);
  border: 1px solid var(--pe-rule-strong);
  border-radius: var(--pe-radius);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

body.edit-mode-active .social-icon-option:hover {
  background: var(--pe-paper-elevated);
  border-color: rgba(0, 0, 0, 0.22);
}

body.edit-mode-active .social-icon-option--custom {
  border-style: dashed;
}

body.edit-mode-active .social-icon-option__svg {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--pe-ink-muted);
}

body.edit-mode-active .social-icon-option__label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pe-ink-muted);
}

body.edit-mode-active .image-uploader-overlay {
  background-color: rgba(0, 0, 0, 0.45) !important;
}

body.edit-mode-active .image-uploader-overlay .uploader-header .pe-btn {
  min-width: auto;
  padding: 0.15rem 0.4rem !important;
  font-size: 20px !important;
  line-height: 1;
  letter-spacing: 0;
  text-transform: none;
  background: transparent !important;
  border: none !important;
}

body.edit-mode-active .image-uploader-overlay .drop-zone,
body.edit-mode-active .image-uploader .drop-zone {
  border: 1px dashed var(--pe-rule-strong) !important;
  background: var(--pe-paper) !important;
  color: var(--pe-ink-muted) !important;
  border-radius: var(--pe-radius);
  padding: 2.5rem 1.25rem;
  text-align: center;
  cursor: pointer;
  margin-bottom: 0.85rem;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

body.edit-mode-active .image-uploader-overlay .drop-zone:hover,
body.edit-mode-active .image-uploader .drop-zone:hover {
  background: var(--pe-paper-inset) !important;
  border-color: rgba(0, 0, 0, 0.22) !important;
}

body.edit-mode-active .image-uploader-overlay .drop-zone.is-dragover,
body.edit-mode-active .image-uploader .drop-zone.is-dragover {
  border-color: var(--pe-ink-muted) !important;
  background: var(--pe-paper-inset) !important;
}

body.edit-mode-active .image-uploader-overlay .format-info.pe-hint {
  margin-bottom: 0.75rem;
}

body.edit-mode-active .image-uploader-overlay .image-uploader-preview,
body.edit-mode-active .image-uploader .image-preview {
  display: block;
  max-width: 100%;
  max-height: 300px;
  margin: 0 auto 0.85rem;
  border: 1px solid var(--pe-rule-strong);
  border-radius: var(--pe-radius);
  box-shadow: none;
}

body.edit-mode-active .image-uploader-overlay .image-uploader-footer,
body.edit-mode-active .image-uploader .pe-footer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

body.edit-mode-active .image-uploader-overlay .image-uploader-alignment,
body.edit-mode-active .image-uploader .pe-field.image-uploader-alignment {
  margin-bottom: 0.75rem;
}

body.edit-mode-active .image-uploader-overlay .preview-container .pe-label,
body.edit-mode-active .image-uploader .preview-container .pe-label {
  display: block;
  margin-bottom: 0.35rem;
}

body.edit-mode-active .image-uploader-overlay .preview-container .pe-segmented,
body.edit-mode-active .image-uploader .preview-container .pe-segmented {
  max-width: 320px;
}

/* Sidebar text inline editor shell */
.sidebar.editing .inline-editor-wrapper {
  margin: 0.5rem 0 1rem;
  padding: 1.15rem 1.25rem 1.35rem;
  background: var(--pe-paper-elevated) !important;
  border: 1px solid var(--pe-rule) !important;
  box-shadow: var(--pe-shadow) !important;
  border-radius: var(--pe-radius);
  font-family: var(--pe-font);
}

.sidebar.editing .inline-editor-wrapper .inline-editor-container,
.sidebar.editing .inline-editor-wrapper .quill-editor-container {
  border: 1px solid var(--pe-rule-strong) !important;
  border-radius: var(--pe-radius);
  background: var(--pe-paper) !important;
}

.sidebar.editing .inline-editor-wrapper .ql-toolbar.ql-snow {
  border: none !important;
  border-bottom: 1px solid var(--pe-rule) !important;
  background: var(--pe-paper-inset) !important;
}

.sidebar.editing .inline-editor-wrapper .ql-container.ql-snow {
  border: none !important;
  background: var(--pe-paper) !important;
}

/* Edition Publisher — grayscale paper edit UI */
body.edit-mode-active .edition-publisher-overlay {
  background: var(--pe-paper-elevated, #f5f5f5) !important;
  box-shadow: var(--pe-shadow, 0 8px 28px rgba(0, 0, 0, 0.08)) !important;
  border-right: 1px solid var(--pe-rule, rgba(0, 0, 0, 0.1));
  font-family: var(--pe-font, "DM Sans", system-ui, -apple-system, sans-serif);
  color: var(--pe-ink, #1f1f1f);
}

body.edit-mode-active .edition-publisher-container {
  padding: 1.15rem 1.25rem 1.35rem !important;
  gap: 1rem !important;
}

body.edit-mode-active .edition-publisher-overlay label,
body.edit-mode-active .edition-publisher-overlay .section-title,
body.edit-mode-active .edition-publisher-overlay .metadata-section-header {
  font-size: 10px !important;
  font-weight: 600 !important;
  letter-spacing: 0.1em !important;
  text-transform: uppercase !important;
  color: var(--pe-ink-muted, #5a5a5a) !important;
}

body.edit-mode-active .edition-publisher-overlay .dropzone {
  border: 1px dashed var(--pe-rule-strong, rgba(0, 0, 0, 0.16)) !important;
  background: var(--pe-paper, #e8e8e8) !important;
  border-radius: var(--pe-radius, 3px) !important;
  color: var(--pe-ink-muted, #5a5a5a) !important;
  min-height: 150px;
}

body.edit-mode-active .edition-publisher-overlay .dropzone:hover {
  background: var(--pe-paper-inset, #d4d4d4) !important;
}

body.edit-mode-active .edition-publisher-overlay .dropzone.highlight {
  border-color: var(--pe-ink-muted, #5a5a5a) !important;
  background: var(--pe-paper-inset, #d4d4d4) !important;
}

body.edit-mode-active .edition-publisher-overlay .dropzone .icon {
  stroke: var(--pe-ink-muted, #5a5a5a) !important;
  color: var(--pe-ink-muted, #5a5a5a) !important;
}

body.edit-mode-active .edition-publisher-container .sequencer-slot,
body.edit-mode-active .edition-publisher-overlay .sequencer-slot {
  background: var(--pe-paper, #e8e8e8) !important;
  border: 1px dashed var(--pe-rule-strong, rgba(0, 0, 0, 0.16)) !important;
  border-radius: var(--pe-radius, 3px) !important;
}

body.edit-mode-active .edition-publisher-container .sequencer-slot.drop-target,
body.edit-mode-active .edition-publisher-container .image-item.drop-target {
  border-color: var(--pe-ink-muted, #5a5a5a) !important;
  background: var(--pe-paper-inset, #d4d4d4) !important;
  transform: none;
}

body.edit-mode-active .edition-publisher-container .image-item,
body.edit-mode-active .edition-publisher-overlay .image-item {
  background: var(--pe-paper-elevated, #f5f5f5) !important;
  border: 1px solid var(--pe-rule-strong, rgba(0, 0, 0, 0.16)) !important;
  border-radius: var(--pe-radius, 3px) !important;
}

body.edit-mode-active .edition-publisher-overlay .image-item .remove-btn,
body.edit-mode-active .edition-publisher-overlay .image-item .preview-icon,
body.edit-mode-active .edition-publisher-overlay .image-item .caption-button,
body.edit-mode-active .edition-publisher-overlay .image-item .lightbox-button,
body.edit-mode-active .edition-publisher-overlay .image-item .hide-button {
  width: 18px !important;
  height: 18px !important;
  min-width: 18px !important;
  min-height: 18px !important;
  padding: 0 !important;
  background: var(--pe-paper-elevated, #f5f5f5) !important;
  border: 1px solid var(--pe-rule-strong, rgba(0, 0, 0, 0.16)) !important;
  color: var(--pe-ink-muted, #5a5a5a) !important;
  font-size: 10px !important;
  font-weight: 600;
  border-radius: var(--pe-radius, 3px) !important;
  box-sizing: border-box !important;
}

body.edit-mode-active .edition-publisher-overlay .image-item .remove-btn {
  top: 3px !important;
  left: 3px !important;
}

body.edit-mode-active .edition-publisher-overlay .image-item .caption-button {
  top: 3px !important;
  right: 3px !important;
  bottom: auto !important;
}

body.edit-mode-active .edition-publisher-overlay .image-item .lightbox-button {
  top: 3px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  font-size: 11px !important;
}

body.edit-mode-active .edition-publisher-overlay .image-item .hide-button {
  bottom: 3px !important;
  left: 3px !important;
  background: var(--pe-paper-elevated, #f5f5f5) !important;
}

body.edit-mode-active .edition-publisher-overlay .image-item .hide-button.active {
  background: var(--pe-paper-elevated, #f5f5f5) !important;
  color: var(--pe-ink, #1f1f1f) !important;
  border-color: rgba(0, 0, 0, 0.28) !important;
}

body.edit-mode-active .edition-publisher-overlay .image-item .hide-button .icon {
  width: 11px !important;
  height: 11px !important;
  margin: 0 !important;
}

body.edit-mode-active .edition-publisher-overlay .preview-icon.active {
  background: var(--pe-ink, #1f1f1f) !important;
  border-color: var(--pe-ink, #1f1f1f) !important;
  color: #fff !important;
}

body.edit-mode-active .edition-publisher-overlay .url-import-form input[type="text"] {
  padding: 0.55rem 0.65rem !important;
  font-size: 13px !important;
  color: var(--pe-ink, #1f1f1f) !important;
  background: var(--pe-paper, #e8e8e8) !important;
  border: 1px solid var(--pe-rule-strong, rgba(0, 0, 0, 0.16)) !important;
  border-radius: var(--pe-radius, 3px) !important;
}

body.edit-mode-active .edition-publisher-overlay .url-import-form button,
body.edit-mode-active .edition-publisher-overlay .module-publish-button,
body.edit-mode-active .edition-publisher-overlay .publish-button {
  padding: 0.45rem 0.85rem !important;
  font-size: 11px !important;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--pe-ink, #1f1f1f) !important;
  background: var(--pe-paper, #e8e8e8) !important;
  border: 1px solid var(--pe-rule-strong, rgba(0, 0, 0, 0.16)) !important;
  border-radius: var(--pe-radius, 3px) !important;
}

body.edit-mode-active .edition-publisher-overlay .url-import-form button:hover,
body.edit-mode-active .edition-publisher-overlay .module-publish-button:hover,
body.edit-mode-active .edition-publisher-overlay .publish-button:hover {
  background: var(--pe-paper-inset, #d4d4d4) !important;
}

body.edit-mode-active .edition-publisher-overlay #importProgress {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pe-ink-muted, #5a5a5a);
  margin-top: 0.5rem;
}

body.edit-mode-active .edition-publisher-overlay .image-item.loading-placeholder {
  background: var(--pe-paper, #e8e8e8) !important;
  border: 1px dashed var(--pe-rule-strong, rgba(0, 0, 0, 0.16)) !important;
}

body.edit-mode-active .edition-publisher-overlay .modal-content {
  background: var(--pe-paper-elevated, #f5f5f5) !important;
  border: 1px solid var(--pe-rule, rgba(0, 0, 0, 0.1)) !important;
  border-radius: var(--pe-radius, 3px) !important;
  box-shadow: var(--pe-shadow, 0 8px 28px rgba(0, 0, 0, 0.08)) !important;
  color: var(--pe-ink, #1f1f1f) !important;
}

/* Edition Publisher — image metadata / caption edit panel */
body.edit-mode-active .caption-overlay-backdrop {
  background-color: rgba(0, 0, 0, 0.45) !important;
}

body.edit-mode-active .caption-overlay {
  background-color: var(--pe-paper-elevated, #f5f5f5) !important;
  border: 1px solid var(--pe-rule, rgba(0, 0, 0, 0.1)) !important;
  border-radius: var(--pe-radius, 3px) !important;
  box-shadow: var(--pe-shadow, 0 8px 28px rgba(0, 0, 0, 0.08)) !important;
  font-family: var(--pe-font, "DM Sans", system-ui, -apple-system, sans-serif);
  color: var(--pe-ink, #1f1f1f);
  padding: 1.15rem 1.25rem 1.35rem !important;
}

body.edit-mode-active .caption-overlay .field-container label {
  font-size: 10px !important;
  font-weight: 600 !important;
  letter-spacing: 0.1em !important;
  text-transform: uppercase !important;
  color: var(--pe-ink-muted, #5a5a5a) !important;
}

body.edit-mode-active .caption-overlay .single-line-input,
body.edit-mode-active .caption-overlay .multi-line-input {
  padding: 0.55rem 0.65rem !important;
  font-size: 13px !important;
  font-family: var(--pe-font, "DM Sans", system-ui, -apple-system, sans-serif) !important;
  color: var(--pe-ink, #1f1f1f) !important;
  background: var(--pe-paper, #e8e8e8) !important;
  border: 1px solid var(--pe-rule-strong, rgba(0, 0, 0, 0.16)) !important;
  border-radius: var(--pe-radius, 3px) !important;
}

body.edit-mode-active .caption-overlay .single-line-input:focus,
body.edit-mode-active .caption-overlay .multi-line-input:focus {
  outline: none !important;
  border-color: var(--pe-ink, #1f1f1f) !important;
  box-shadow: 0 0 0 3px var(--pe-focus-soft, rgba(0, 0, 0, 0.08));
}

body.edit-mode-active .caption-overlay .info-save-button,
body.edit-mode-active .caption-overlay .info-close-button {
  width: 28px !important;
  height: 28px !important;
  min-width: 28px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 14px !important;
  line-height: 1 !important;
  border-radius: var(--pe-radius, 3px) !important;
  box-sizing: border-box !important;
  cursor: pointer;
}

body.edit-mode-active .caption-overlay .info-save-button {
  background: var(--pe-ink, #1f1f1f) !important;
  color: #fff !important;
  border: 1px solid var(--pe-ink, #1f1f1f) !important;
}

body.edit-mode-active .caption-overlay .info-save-button:hover {
  background: #333 !important;
  border-color: #333 !important;
}

body.edit-mode-active .caption-overlay .info-close-button {
  background: var(--pe-paper, #e8e8e8) !important;
  color: var(--pe-ink-muted, #5a5a5a) !important;
  border: 1px solid var(--pe-rule-strong, rgba(0, 0, 0, 0.16)) !important;
}

body.edit-mode-active .caption-overlay .info-close-button:hover {
  background: var(--pe-paper-inset, #d4d4d4) !important;
  color: var(--pe-ink, #1f1f1f) !important;
}

body.edit-mode-active .caption-overlay .ql-toolbar.ql-snow {
  border: 1px solid var(--pe-rule-strong, rgba(0, 0, 0, 0.16)) !important;
  border-bottom: none !important;
  border-radius: var(--pe-radius, 3px) var(--pe-radius, 3px) 0 0 !important;
  background: var(--pe-paper-inset, #d4d4d4) !important;
  font-family: var(--pe-font, "DM Sans", system-ui, -apple-system, sans-serif);
}

body.edit-mode-active .caption-overlay .ql-container.ql-snow {
  border: 1px solid var(--pe-rule-strong, rgba(0, 0, 0, 0.16)) !important;
  border-radius: 0 0 var(--pe-radius, 3px) var(--pe-radius, 3px) !important;
  background: var(--pe-paper, #e8e8e8) !important;
}

body.edit-mode-active .caption-overlay .ql-editor {
  color: var(--pe-ink, #1f1f1f);
  font-family: var(--pe-font, "DM Sans", system-ui, -apple-system, sans-serif);
  font-size: 13px;
  min-height: 100px;
}

body.edit-mode-active .caption-overlay .ql-editor a {
  color: var(--pe-ink, #1f1f1f);
  text-decoration: underline;
}

body.edit-mode-active .caption-overlay .ql-editor.ql-blank::before {
  color: var(--pe-ink-faint, #888888);
  font-style: normal;
}

body.edit-mode-active .caption-overlay .ql-snow .ql-stroke {
  stroke: var(--pe-ink-muted, #5a5a5a) !important;
}

body.edit-mode-active .caption-overlay .ql-snow .ql-fill {
  fill: var(--pe-ink-muted, #5a5a5a) !important;
}

body.edit-mode-active .caption-overlay .ql-snow .ql-picker {
  color: var(--pe-ink-muted, #5a5a5a) !important;
}

body.edit-mode-active .caption-overlay .ql-snow .ql-picker-options {
  background: var(--pe-paper-elevated, #f5f5f5) !important;
  border: 1px solid var(--pe-rule-strong, rgba(0, 0, 0, 0.16)) !important;
  border-radius: var(--pe-radius, 3px) !important;
}

body.edit-mode-active .caption-overlay .ql-snow .ql-picker-item:hover,
body.edit-mode-active .caption-overlay .ql-snow .ql-picker-item.ql-selected {
  color: var(--pe-ink, #1f1f1f) !important;
}

body.edit-mode-active .caption-overlay .ql-snow.ql-toolbar button:hover,
body.edit-mode-active .caption-overlay .ql-snow .ql-toolbar button.ql-active,
body.edit-mode-active .caption-overlay .ql-snow .ql-toolbar .ql-picker-label:hover,
body.edit-mode-active .caption-overlay .ql-snow .ql-toolbar .ql-picker-label.ql-active {
  color: var(--pe-ink, #1f1f1f) !important;
}

body.edit-mode-active .caption-overlay .ql-snow.ql-toolbar button:hover .ql-stroke,
body.edit-mode-active .caption-overlay .ql-snow .ql-toolbar button.ql-active .ql-stroke,
body.edit-mode-active .caption-overlay .ql-snow .ql-toolbar .ql-picker-label:hover .ql-stroke,
body.edit-mode-active .caption-overlay .ql-snow .ql-toolbar .ql-picker-label.ql-active .ql-stroke {
  stroke: var(--pe-ink, #1f1f1f) !important;
}

body.edit-mode-active .caption-overlay .ql-snow.ql-toolbar button:hover .ql-fill,
body.edit-mode-active .caption-overlay .ql-snow .ql-toolbar button.ql-active .ql-fill {
  fill: var(--pe-ink, #1f1f1f) !important;
}

body.edit-mode-active .caption-overlay .hashtag-container {
  background-color: var(--pe-paper, #e8e8e8) !important;
  border: 1px solid var(--pe-rule-strong, rgba(0, 0, 0, 0.16)) !important;
  border-radius: var(--pe-radius, 3px) !important;
}

body.edit-mode-active .caption-overlay .hashtag-container > div:first-child div {
  color: var(--pe-ink-muted, #5a5a5a) !important;
  font-weight: 600 !important;
  letter-spacing: 0.1em !important;
}

body.edit-mode-active .caption-overlay .hashtag-container button {
  color: var(--pe-ink-muted, #5a5a5a) !important;
}

body.edit-mode-active .caption-overlay .hashtag-container button:hover {
  color: var(--pe-ink, #1f1f1f) !important;
}

body.edit-mode-active .caption-overlay .hashtag-display span {
  background-color: var(--pe-paper-elevated, #f5f5f5) !important;
  color: var(--pe-ink, #1f1f1f) !important;
  border: 1px solid var(--pe-rule-strong, rgba(0, 0, 0, 0.16)) !important;
  border-radius: var(--pe-radius, 3px) !important;
}

body.edit-mode-active .caption-overlay .hashtag-display span:hover {
  background-color: var(--pe-paper-inset, #d4d4d4) !important;
  border-color: var(--pe-ink-muted, #5a5a5a) !important;
}

body.edit-mode-active .caption-overlay .hashtag-edit-mode {
  border-top-color: var(--pe-rule, rgba(0, 0, 0, 0.1)) !important;
}

body.edit-mode-active .caption-overlay .hashtag-edit-item {
  background-color: var(--pe-paper-elevated, #f5f5f5) !important;
  border: 1px solid var(--pe-rule-strong, rgba(0, 0, 0, 0.16)) !important;
  border-radius: var(--pe-radius, 3px) !important;
  color: var(--pe-ink, #1f1f1f) !important;
}

body.edit-mode-active .caption-overlay .hashtag-edit-item:hover {
  background-color: var(--pe-paper-inset, #d4d4d4) !important;
}

body.edit-mode-active .caption-overlay .hashtag-edit-mode input[type="text"] {
  padding: 0.4rem 0.55rem !important;
  font-size: 12px !important;
  color: var(--pe-ink, #1f1f1f) !important;
  background: var(--pe-paper-elevated, #f5f5f5) !important;
  border: 1px solid var(--pe-rule-strong, rgba(0, 0, 0, 0.16)) !important;
  border-radius: var(--pe-radius, 3px) !important;
}

body.edit-mode-active .caption-overlay .hashtag-edit-mode button {
  padding: 0.4rem 0.65rem !important;
  font-size: 10px !important;
  font-weight: 600 !important;
  letter-spacing: 0.1em !important;
  text-transform: uppercase !important;
  color: var(--pe-ink, #1f1f1f) !important;
  background: var(--pe-paper-elevated, #f5f5f5) !important;
  border: 1px solid var(--pe-rule-strong, rgba(0, 0, 0, 0.16)) !important;
  border-radius: var(--pe-radius, 3px) !important;
}

body.edit-mode-active .caption-overlay .hashtag-edit-mode button:hover {
  background: var(--pe-paper-inset, #d4d4d4) !important;
}

@media (max-width: 520px) {
  body.edit-mode-active .pe-edit-shell {
    padding: 1rem;
  }

  body.edit-mode-active .pe-edit-shell .pe-edit-grid {
    grid-template-columns: 1fr;
  }
}
