.gallery-shell {
  width: min(calc(100% - 32px), 920px);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-flow: dense;
  gap: 14px;
  width: calc(100% - 28px);
  margin-left: 28px;
}

.gallery-card {
  min-width: 0;
  padding: 7px 7px 8px;
  border: 1px solid #e9a8b4;
  color: #87171d;
  background: #fffafa;
  font: inherit;
  text-align: left;
  cursor: zoom-in;
  box-shadow: 2px 2px 0 #f7e1e3;
  transition: transform 120ms ease, border-color 120ms ease;
}

.gallery-card-wide {
  grid-column: auto;
}

.gallery-card:hover,
.gallery-card:focus-visible {
  border-color: #b92f51;
  transform: translateY(-3px);
}

.gallery-card:focus-visible {
  outline: 2px solid #d54a67;
  outline-offset: 2px;
}

.gallery-card[hidden] {
  display: none;
}

.gallery-frame {
  position: relative;
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid #f2c9d0;
  background-color: #fff;
  background-image: linear-gradient(45deg, #fff7f8 25%, transparent 25%), linear-gradient(-45deg, #fff7f8 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #fff7f8 75%), linear-gradient(-45deg, transparent 75%, #fff7f8 75%);
  background-position: 0 0, 0 7px, 7px -7px, -7px 0;
  background-size: 14px 14px;
}

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

.gallery-caption {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 3px 0;
}

.gallery-caption strong {
  overflow: hidden;
  font-style: italic;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gallery-caption small {
  flex: 0 0 auto;
  color: #ad6a77;
  font-size: 10px;
  white-space: nowrap;
}

.gallery-empty {
  width: calc(100% - 28px);
  margin: 30px 0 30px 28px;
  color: #984657;
  text-align: center;
  font-style: italic;
}

.gallery-return {
  margin-top: 24px;
}

.gallery-return .media-return-home-button {
  font-size: 18px;
}

.gallery-lightbox {
  width: min(calc(100% - 40px), calc(100vh + 290px), 1090px);
  max-width: none;
  max-height: calc(100vh - 40px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 0;
  color: #262626;
  background: #000;
  box-shadow: 0 8px 32px rgba(0, 0, 0, .45);
  scrollbar-width: none;
}

.gallery-lightbox::-webkit-scrollbar { display: none; }

.gallery-lightbox.is-full-image {
  width: min(calc(100% - 32px), 1400px);
  height: calc(100vh - 32px);
  max-height: calc(100vh - 32px);
}

html.gallery-lightbox-open,
body.gallery-lightbox-open {
  overflow: hidden;
}

.gallery-lightbox::backdrop {
  background: rgba(0, 0, 0, .92);
}

.gallery-lightbox-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
}

.gallery-lightbox-layout[hidden] { display: none; }

.gallery-lightbox-media {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  aspect-ratio: 1;
  margin: 0;
  background: #000;
}

.gallery-lightbox-media > img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.gallery-lightbox-details {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  color: #262626;
  background: #fff;
  font-family: Arial, Helvetica, sans-serif;
}

.gallery-lightbox-heading {
  padding: 14px 18px 0;
}

.gallery-lightbox-heading::after {
  display: block;
  width: 100%;
  margin-top: 12px;
  border-bottom: 2px dotted #ef9cab;
  content: "";
}

.gallery-lightbox-heading h2 {
  margin: 0;
  color: #87171d;
  font: italic 700 27px/1.15 Georgia, "Times New Roman", serif;
}

.gallery-lightbox-heading time {
  display: block;
  margin: 0;
  color: #a75b69;
  font: 14px/1.3 Georgia, "Times New Roman", serif;
}

.gallery-lightbox-date-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 5px;
}

.media-body .gallery-lightbox-date-line a,
.media-body .gallery-lightbox-date-line a:link,
.media-body .gallery-lightbox-date-line a:visited {
  color: #a75b69;
  font: italic 14px/1.3 Georgia, "Times New Roman", serif;
  text-decoration: none;
}

.media-body .gallery-lightbox-date-line a:hover,
.media-body .gallery-lightbox-date-line a:focus-visible {
  color: #87171d;
  text-decoration: underline;
}

.gallery-lightbox-description {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
  padding: 11px 18px 16px;
  overflow: hidden;
}

.gallery-lightbox-heading .gallery-lightbox-camera {
  margin: 5px 0 0;
  color: #984657;
  font: 14px/1.4 Georgia, "Times New Roman", serif;
}

.gallery-lightbox-heading .gallery-lightbox-camera[hidden] { display: none; }

.gallery-lightbox-description h3 {
  margin: 0 0 3px;
  color: #87171d;
  font: 700 16px/1.4 Georgia, "Times New Roman", serif;
}

.gallery-lightbox-description-text {
  min-height: 0;
  overflow: hidden;
}

.gallery-lightbox-description.is-expanded .gallery-lightbox-description-text {
  padding-right: 7px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: #a31325 #f8e8eb;
  scrollbar-width: thin;
}

.gallery-lightbox-description p {
  margin: 0;
  color: #984657;
  font: 14px/1.5 Georgia, "Times New Roman", serif;
}

.media-body .gallery-description-more {
  justify-self: start;
  margin-top: 7px;
  padding: 0;
  color: #87171d;
  background: transparent;
  font: italic 700 13px/1.3 Georgia, "Times New Roman", serif;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.media-body .gallery-description-more[hidden] {
  display: none;
}

.gallery-lightbox-meta {
  padding: 15px 18px;
  border-top: 1px solid #dbdbdb;
}

.media-body .gallery-lightbox-meta button {
  display: block;
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #87171d;
  color: #fff;
  background: #87171d;
  font: italic 700 13px/1.2 Georgia, "Times New Roman", serif;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.media-body .gallery-lightbox-meta button:hover,
.media-body .gallery-lightbox-meta button:focus-visible {
  color: #fff;
  background: #b92f51;
}

.gallery-lightbox button {
  border: 0;
  cursor: pointer;
}

.gallery-lightbox-close {
  position: fixed;
  z-index: 3;
  top: 12px;
  right: 16px;
  width: 36px;
  height: 36px;
  padding: 0;
  color: #fff;
  background: transparent;
  font: 32px/1 Arial, sans-serif;
  text-shadow: 0 1px 4px #000;
}

.gallery-lightbox-arrow {
  position: absolute;
  z-index: 2;
  top: 50%;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  color: #262626;
  background: rgba(255, 255, 255, .92);
  font-size: 0;
  transform: translateY(-50%);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .32);
}

.gallery-lightbox-arrow::before {
  display: block;
  width: 8px;
  height: 8px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  content: "";
}

.gallery-lightbox-arrow[hidden] { display: none; }

.gallery-lightbox-previous::before { transform: translate(1px, 6.5px) rotate(-135deg); }
.gallery-lightbox-next::before { transform: translate(-2px, 6.5px) rotate(45deg); }

.gallery-lightbox button:hover,
.gallery-lightbox button:focus-visible {
  opacity: .72;
}

.gallery-lightbox button:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.gallery-lightbox-previous { left: 12px; }
.gallery-lightbox-next { right: 12px; }

.gallery-image-position {
  position: absolute;
  right: 12px;
  bottom: 12px;
  padding: 4px 8px;
  border-radius: 12px;
  color: #fff;
  background: rgba(0, 0, 0, .62);
  font: 11px/1.2 Arial, Helvetica, sans-serif;
}

.gallery-image-position[hidden] { display: none; }

.gallery-full-view {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-height: 0;
  background: #000;
}

.gallery-full-view[hidden] { display: none; }

.gallery-full-view > img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.gallery-full-view-back {
  position: absolute;
  z-index: 3;
  top: 14px;
  left: 14px;
  padding: 9px 13px;
  color: #fff;
  background: rgba(0, 0, 0, .72);
  font: italic 700 13px/1.2 Georgia, "Times New Roman", serif;
  box-shadow: 0 1px 5px rgba(0, 0, 0, .35);
}

.gallery-full-view-back:hover,
.gallery-full-view-back:focus-visible {
  background: rgba(135, 23, 29, .92);
  opacity: 1 !important;
}

@media (max-width: 680px) {
  .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .gallery-lightbox {
    width: min(calc(100% - 20px), 560px);
    max-height: calc(100vh - 24px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .gallery-lightbox-layout {
    display: flex;
    flex-direction: column;
    height: auto;
  }

  .gallery-lightbox-media {
    flex: 0 0 auto;
    width: 100%;
    height: min(55vh, 100vw);
    aspect-ratio: auto;
  }

  .gallery-lightbox-details {
    position: relative;
    z-index: 1;
    display: block;
    flex: 0 0 auto;
  }

  .gallery-lightbox-heading,
  .gallery-lightbox-description,
  .gallery-lightbox-meta {
    position: relative;
    background: #fff;
  }

}

@media (max-width: 560px) {
  .gallery-grid,
  .gallery-empty {
    width: 100%;
    margin-left: 0;
  }

}

@media (max-width: 390px) {
  .gallery-grid { grid-template-columns: 1fr; }
  .gallery-caption strong { white-space: normal; }
}

@media (prefers-reduced-motion: reduce) {
  .gallery-card { transition: none; }
}

/* === GALLERY POST CREATOR === */
.gallery-admin-shell { width: min(calc(100% - 32px), 760px); }
.gallery-manager-shell { width: min(calc(100% - 32px), 900px); }
.gallery-admin-card { padding: 16px; }
.gallery-admin-card .form-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.media-body .gallery-admin-card .form-notice a,
.media-body .gallery-admin-card .form-notice a:link,
.media-body .gallery-admin-card .form-notice a:visited {
  margin-left: auto;
  color: #426642;
}
.gallery-post-form small { color: #9a6b74; font-weight: 400; }
.gallery-upload-field {
  padding: 0;
  border: 0;
  color: #7b2737;
  background: transparent;
}
.gallery-upload-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.gallery-upload-heading div { display: grid; gap: 3px; }
.gallery-upload-heading small { display: block; }
.gallery-upload-heading > span {
  flex: 0 0 auto;
  color: #87171d;
  font: italic 700 12px/1.2 Georgia, "Times New Roman", serif;
}
.gallery-drop-zone {
  display: grid !important;
  place-items: center;
  gap: 3px;
  min-height: 92px;
  padding: 14px;
  border: 2px dashed #dca3ae;
  color: #87171d !important;
  background: #fff;
  text-align: center;
  cursor: pointer;
}
.gallery-drop-zone strong { font: italic 700 15px/1.2 Georgia, "Times New Roman", serif; }
.gallery-drop-zone span { color: #9a6b74; font-size: 12px; }
.gallery-drop-zone:hover,
.gallery-drop-zone:focus-within,
.gallery-drop-zone.is-dragging {
  border-color: #b92f51;
  background: #fff7f8;
}
.gallery-drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  opacity: 0;
}
.gallery-upload-error { margin: 8px 0 0; color: #a31325; }
.gallery-upload-error:empty { display: none; }
.gallery-upload-previews { display: grid; gap: 10px; margin-top: 14px; }
.gallery-upload-previews:empty { display: none; }
.gallery-upload-preview {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 12px;
  padding: 9px;
  border: 1px solid #efc4cb;
  background: #fff;
}
.gallery-upload-preview > img {
  display: block;
  width: 110px;
  aspect-ratio: 1;
  border: 1px solid #f2c9d0;
  object-fit: cover;
}
.gallery-upload-preview > div { display: grid; align-content: start; gap: 7px; min-width: 0; }
.gallery-upload-preview-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.gallery-upload-preview-info {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.gallery-upload-preview-info small {
  color: #9a6b74;
  font-size: 11px;
}
.gallery-upload-preview-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
}
.gallery-photo-order-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid #dca3ae;
  color: #a31325;
  background: #fff7f8;
  font: 700 17px/1 Georgia, "Times New Roman", serif;
  cursor: pointer;
}
.gallery-photo-order-button:hover,
.gallery-photo-order-button:focus-visible { border-color: #a31325; background: #f7e1e3; }
.gallery-photo-order-button:disabled { opacity: .35; cursor: default; }
.gallery-upload-preview strong {
  overflow: hidden;
  color: #87171d;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gallery-upload-preview-remove {
  flex: 0 0 auto;
  padding: 3px 7px;
  border: 1px solid #dca3ae;
  color: #a31325;
  background: #fff7f8;
  font: 12px/1.2 Georgia, "Times New Roman", serif;
  cursor: pointer;
}
.gallery-upload-preview-remove:hover,
.gallery-upload-preview-remove:focus-visible { border-color: #a31325; background: #f7e1e3; }
.gallery-upload-preview label { gap: 4px; }
.gallery-upload-preview textarea { min-height: 64px; }
.gallery-manage-list { margin-top: 18px; }
.gallery-bulk-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  margin: 18px 0 0;
  padding-top: 14px;
  border-top: 1px dotted #ef9cab;
}
.gallery-select-all { display: inline-flex; align-items: center; gap: 6px; color: #7b2737; cursor: pointer; }
.gallery-select-all input { width: 15px; height: 15px; margin: 0; accent-color: #87171d; }
.gallery-bulk-delete-button {
  padding: 6px 10px;
  border: 1px solid #b02434;
  background: #fff7f8;
  text-decoration: none;
}
.gallery-bulk-delete-button:disabled { opacity: .45; cursor: not-allowed; }
.gallery-manage-row { grid-template-columns: 22px 54px minmax(0, 1fr) auto; }
.gallery-post-selector {
  display: grid;
  place-items: center;
  align-self: stretch;
  cursor: pointer;
}
.gallery-post-selector input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: #87171d;
}
.gallery-manage-row > img {
  display: block;
  width: 54px;
  aspect-ratio: 1;
  border: 1px solid #efc4cb;
  object-fit: cover;
}
.gallery-manage-post {
  display: grid;
  gap: 0;
}
.gallery-manager-actions { flex-wrap: wrap; justify-content: flex-end; }
.gallery-status-action { white-space: nowrap; }
.media-body .gallery-edit-action,
.media-body .gallery-edit-action:link,
.media-body .gallery-edit-action:visited {
  color: #87171d;
  text-decoration: none;
}
.gallery-photo-list-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  width: max-content;
  margin: 0;
  padding: 0;
  border: 0;
  color: #87171d;
  background: transparent;
  font: 11px/1.3 Georgia, "Times New Roman", serif;
  cursor: pointer;
}
.gallery-photo-list-toggle span:first-child { color: #666; }
.gallery-photo-list-toggle span:last-child { text-decoration: underline; text-underline-offset: 2px; }
.gallery-photo-list-toggle .footer-diamond { color: #d98a99; font-size: .55em; }
.gallery-photo-list-toggle:hover span:last-child,
.gallery-photo-list-toggle:focus-visible span:last-child { color: #b92f51; }
.gallery-photo-list-toggle:focus-visible { outline: 1px dotted #b92f51; outline-offset: 2px; }
.gallery-photo-delete {
  grid-column: 2 / -1;
  display: grid;
  gap: 7px;
  width: 100%;
  margin: 0;
}
.gallery-photo-delete[hidden] { display: none; }
.gallery-photo-delete-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 7px;
  margin-top: 0;
  border: 1px solid #efc4cb;
  background: #fffafa;
}
.gallery-photo-delete-row > img {
  display: block;
  width: 54px;
  aspect-ratio: 1;
  border: 1px solid #efc4cb;
  object-fit: cover;
}
.gallery-photo-delete-row form { margin: 0; }
.gallery-photo-delete-row .danger-action {
  padding: 6px 9px;
  white-space: nowrap;
}
.gallery-photo-description-preview {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.gallery-photo-description-preview strong {
  color: #87171d;
  font: 14px/1.2 Georgia, "Times New Roman", serif;
}
.gallery-photo-description-preview p {
  overflow: hidden;
  margin: 0;
  color: #984657;
  font: 12px/1.35 Georgia, "Times New Roman", serif;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gallery-photo-description-preview small {
  overflow: hidden;
  color: #9a6b74;
  font: 11px/1.3 Georgia, "Times New Roman", serif;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gallery-photo-description-preview p:only-child { color: #9a6b74; }
.gallery-photo-edit-toggle { padding: 6px 11px; }
.gallery-photo-description-form {
  display: grid;
  grid-column: 2 / -1;
  gap: 4px;
  min-width: 0;
  padding-top: 3px;
}
.gallery-photo-description-form[hidden] { display: none; }
.gallery-photo-description-form label {
  color: #87171d;
  font: 14px/1.2 Georgia, "Times New Roman", serif;
}
.gallery-photo-description-form > div {
  display: flex;
  align-items: stretch;
  gap: 7px;
  min-width: 0;
}
.gallery-photo-description-form textarea {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 42px;
  padding: 6px 7px;
  box-sizing: border-box;
  border: 1px solid #efc4cb;
  border-radius: 0;
  color: #984657;
  background: #fff;
  font: 12px/1.35 Georgia, "Times New Roman", serif;
  resize: vertical;
}
.gallery-photo-description-form input {
  width: 100%;
  min-width: 0;
  padding: 6px 7px;
  box-sizing: border-box;
  border: 1px solid #efc4cb;
  border-radius: 0;
  color: #984657;
  background: #fff;
  font: 12px/1.35 Georgia, "Times New Roman", serif;
}
.gallery-photo-description-form input:focus,
.gallery-photo-description-form textarea:focus {
  outline: 2px solid #efb7c1;
  outline-offset: 1px;
}
.gallery-photo-description-form .secondary-action {
  align-self: stretch;
  padding-inline: 12px;
}

.manager-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 18px;
  padding: 14px 0 0;
  border-top: 1px dotted #ef9cab;
  color: #7d5960;
  background: transparent;
  font-size: 11px;
}
.manager-page-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.pagination-button {
  display: inline-grid;
  min-width: 28px;
  min-height: 32px;
  place-items: center;
  box-sizing: border-box;
  padding: 5px 6px;
  border: 1px solid #ef9cab;
  border-radius: 0;
  color: #87171d;
  background: #fff;
  text-decoration: none;
}
.pagination-button:hover,
.pagination-button:focus-visible { color: #87171d; background: #f7e1e3; }
.pagination-button.is-current { border-color: #ef9cab; color: #ef9cab; background: #fff; }
.pagination-direction,
.pagination-direction:visited {
  min-width: 44px;
  padding-inline: 5px;
  border-color: #87171d;
  color: #fff;
  background: #87171d;
}
.pagination-direction:hover,
.pagination-direction:focus-visible { color: #fff; background: #b92f51; }
.pagination-ellipsis { border-color: transparent; background: transparent; }

@media (max-width: 560px) {
  .gallery-upload-preview { grid-template-columns: 76px minmax(0, 1fr); }
  .gallery-upload-preview > img { width: 76px; }
  .gallery-manage-row { grid-template-columns: 22px 54px minmax(0, 1fr); }
  .gallery-manager-actions { grid-column: 2 / -1; justify-content: flex-start; }
  .gallery-photo-delete { grid-column: 2 / -1; width: 100%; margin: 0; }
  .gallery-photo-delete-row { grid-template-columns: 48px minmax(0, 1fr) auto; }
  .gallery-photo-delete-row > img { width: 48px; }
  .gallery-photo-delete-row > form:not(.gallery-photo-description-form) { grid-column: 3; }
  .gallery-photo-edit-toggle { grid-column: 2; justify-self: start; }
  .gallery-photo-description-form { grid-column: 2 / -1; }
  .gallery-photo-description-form > div { align-items: flex-start; flex-direction: column; }
  .gallery-photo-description-form .secondary-action { align-self: flex-start; }
  .gallery-bulk-actions { align-items: flex-end; flex-direction: column; }
}
