/** Shared by the WordPress editor and front end. */
.scg-surface {
  container: scg / inline-size;
  box-sizing: border-box;
  width: 100%;
  padding: clamp(24px, 4%, 48px);
  background: #eae6dd;
  border-radius: 4px;
}
.scg-gallery {
  display: grid;
  grid-template-columns: repeat(var(--scg-cols, 5), minmax(0, 1fr));
  gap: 32px 28px;
  gap: clamp(28px, 3.8cqw, 48px) clamp(22px, 3cqw, 36px);
  align-items: center;
  isolation: isolate;
}
.scg-gallery *, .scg-lightbox * { box-sizing: border-box; }
.scg-gallery .scg-item {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
  max-width: none;
  margin: 0;
  padding: 0;
  border: 0;
}
.scg-gallery .scg-card {
  display: block;
  position: relative;
  width: 100%;
  min-width: 0;
  padding: 10px 10px 18px;
  border: 0;
  border-radius: 3px;
  background: #fffefa;
  color: #5e574a;
  text-decoration: none;
  box-shadow: 0 2px 3px #493e2520, 0 10px 24px -10px #493e2542;
  transform: translate(var(--scg-dx, 0%), var(--scg-dy, 0%)) rotate(var(--scg-rot, 0deg));
  transform-origin: 50% 50%;
  transition: transform 820ms cubic-bezier(0.22, 0.08, 0.2, 1), box-shadow 680ms ease-out;
  cursor: zoom-in;
  -webkit-tap-highlight-color: transparent;
}
.scg-gallery .scg-photo { overflow: hidden; border-radius: 1px; background: #dedbd4; }
.scg-gallery .scg-card .scg-photo img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  margin: 0;
  border: 0;
  border-radius: 0;
  object-fit: cover;
  filter: none;
  box-shadow: none;
}
.scg-gallery .scg-caption {
  display: block;
  position: static;
  margin: 9px 0 -6px;
  padding: 0;
  color: #645b4e;
  font-family: Georgia, 'Songti SC', 'Noto Serif CJK SC', serif;
  font-style: italic;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.45;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  text-wrap: pretty;
}
.scg-gallery .scg-item:focus-within { z-index: 3; }
[data-scg-paper] .scg-gallery a.scg-card:focus:not(:focus-visible) { outline: none; }
.scg-gallery a.scg-card:focus-visible { outline: 3px solid #705b39; outline-offset: 5px; }
.scg-gallery a.scg-card[data-scg-pointer-return]:focus { outline: none; }
@media (hover: hover) and (pointer: fine) {
  .scg-gallery .scg-item:hover { z-index: 2; }
  .scg-gallery:not(.scg-editor) .scg-item:hover .scg-card:not([data-scg-resting]) {
    transition: transform 700ms cubic-bezier(0.2, 0.9, 0.3, 1.2), box-shadow 520ms ease-out;
    transform: translate(var(--scg-dx, 0%), calc(var(--scg-dy, 0%) - 9px)) rotate(calc(var(--scg-rot, 0deg) * 1.18)) scale(1.045);
    box-shadow: 0 3px 5px #493e2520, 0 19px 32px -12px #493e2560;
  }
}
@container scg (max-width: 900px) { .scg-gallery { grid-template-columns: repeat(min(var(--scg-cols, 5), 4), minmax(0, 1fr)); } }
@container scg (max-width: 700px) { .scg-gallery { grid-template-columns: repeat(min(var(--scg-cols, 5), 3), minmax(0, 1fr)); } }
@container scg (max-width: 500px) {
  .scg-gallery { grid-template-columns: repeat(min(var(--scg-cols, 5), 2), minmax(0, 1fr)); gap: 28px 20px; }
  .scg-gallery .scg-card { padding: 7px 7px 14px; }
  .scg-gallery .scg-caption { font-size: 12px; margin-top: 7px; }
}
@container scg (max-width: 230px) { .scg-gallery { grid-template-columns: minmax(0, 1fr); } }
@supports not (container-type: inline-size) {
  @media (max-width: 900px) { .scg-gallery { grid-template-columns: repeat(min(var(--scg-cols, 5), 3), minmax(0, 1fr)); } }
  @media (max-width: 540px) { .scg-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
  .scg-gallery[data-preview='mobile'] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* Photos remain visible even if JavaScript fails or is disabled. */
.scg-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  padding: max(66px, env(safe-area-inset-top)) 72px max(24px, env(safe-area-inset-bottom));
  color: #faf7ef;
  overscroll-behavior: contain;
  animation: scg-open 180ms ease-out;
}
.scg-lightbox-bg { position: absolute; inset: 0; background: #181713f5; }
.scg-lightbox-box { position: relative; z-index: 1; min-height: 0; display: flex; align-items: center; justify-content: center; pointer-events: auto; }
.scg-lightbox-box .scg-lightbox-img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 2px;
  filter: none;
  box-shadow: 0 12px 50px #0005;
}
.scg-return-photo { position: fixed; z-index: 3; overflow: hidden; border-radius: 1px; pointer-events: none; transform-origin: center; }
.scg-return-photo .scg-return-img { display: block; width: 100%; height: 100%; max-width: none; margin: 0; border: 0; border-radius: 0; object-fit: cover; }
/* Preserve the settled caption spacing; status changes must not move the photo. */
.scg-lightbox-footer { position: relative; z-index: 1; max-height: 25vh; overflow: auto; text-align: center; padding: 16px 0 6px; }
.scg-lightbox-cap { margin: 0; font: italic 16px/1.6 Georgia, 'Songti SC', serif; overflow-wrap: anywhere; }
.scg-lightbox-status { position: fixed; top: 20px; left: 80px; right: 80px; max-height: 42px; overflow: auto; margin: 0; font: 13px/1.5 system-ui, sans-serif; color: #d2cbbf; }
.scg-lightbox-count { position: absolute; top: 22px; left: 26px; z-index: 2; font: 13px/1.5 system-ui, sans-serif; font-variant-numeric: tabular-nums; }
.scg-lightbox button {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid #fff3;
  border-radius: 50%;
  background: #ffffff0d;
  color: #fff;
  font: 26px/1 system-ui, sans-serif;
  cursor: pointer;
  touch-action: manipulation;
}
.scg-lightbox button:hover { background: #fff2; }
.scg-lightbox button:focus-visible { outline: 2px solid #fff; outline-offset: 4px; }
.scg-lightbox-close { top: 12px; right: 18px; }
.scg-lightbox-prev { top: calc(50% - 22px); left: 14px; }
.scg-lightbox-next { top: calc(50% - 22px); right: 14px; }
.scg-lightbox [hidden] { display: none !important; }
@keyframes scg-open { from { opacity: 0; } to { opacity: 1; } }
@media (max-width: 540px) {
  .scg-lightbox { padding: 68px 12px 76px; }
  .scg-lightbox-prev, .scg-lightbox-next { top: auto; bottom: max(16px, env(safe-area-inset-bottom)); }
  .scg-lightbox-prev { left: calc(50% - 56px); }
  .scg-lightbox-next { right: calc(50% - 56px); }
  .scg-lightbox-cap { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .scg-gallery .scg-card, .scg-gallery:not(.scg-editor) .scg-item:hover .scg-card:not([data-scg-resting]), .scg-lightbox { transition: none; animation: none; }
}
/* Editor controls sit outside the photographic surface. */
.scg-editor-shell { min-width: 0; }
.editor-styles-wrapper .wp-block.scg-editor-shell { width: min(var(--scg-editor-width, 1356px), 100%); max-width: none; }
.scg-preview-scroll { width: 100%; overflow-x: auto; overscroll-behavior-x: contain; }
.scg-preview-scroll:focus-visible { outline: 2px solid #2778b9; outline-offset: 2px; }
.scg-preview-frame { margin: 0 auto; max-width: none; }
.scg-preview-frame > .scg-surface { padding: clamp(24px, 4%, 48px); }
.scg-preview-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.scg-gallery.scg-editor .scg-card { cursor: default; }
.scg-empty { border: 1px dashed #b7afa2; border-radius: 4px; padding: 36px 24px; text-align: center; background: #f8f6f1; }
.scg-empty p, .scg-hint { color: #6b6459; font: 12px/1.6 system-ui, sans-serif; }
.scg-list { margin-top: 20px; border-top: 1px solid #e0dcd5; padding-top: 14px; }
.scg-list-title { font-size: 13px; color: #635d54; margin: 0 0 12px; }
.scg-list-row { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid #e8e3db; border-radius: 4px; background: #faf9f6; margin-bottom: 8px; }
.scg-drag-handle { padding: 12px 4px; font-size: 24px; cursor: grab; user-select: none; }
.scg-list-thumb[draggable], .scg-gallery.scg-editor .scg-editor-card[draggable] { cursor: grab; }
.scg-editor-shell .is-dragging { opacity: .45; cursor: grabbing; }
.scg-editor-shell .is-drop-target { outline: 3px dashed #2778b9; outline-offset: 3px; }
.scg-list-thumb { width: 44px; height: 52px; object-fit: cover; flex-shrink: 0; border-radius: 2px; }
.scg-list-mid { flex: 1; min-width: 0; display: grid; gap: 6px; }
.scg-list-input { box-sizing: border-box; width: 100%; border: 1px solid #b6b0a6; border-radius: 3px; padding: 7px 9px; font: 13px/1.4 system-ui, sans-serif; color: #302c25; background: #fff; }
.scg-list-acts { display: flex; gap: 2px; flex-shrink: 0; }
@media (max-width: 480px) { .scg-list-row { flex-wrap: wrap; } .scg-list-acts { margin-left: auto; } }
/* Album settings remain local to the gallery; editor interaction never starts the viewer. */
.scg-background-warm-gray { background-color: #eae6dd; }
.scg-background-sage { background-color: #dce1d7; }
.scg-background-whitewood { background-color: #eee7da; background-image: repeating-linear-gradient(89deg, #b6a38308 0 1px, transparent 1px 8px); }
.scg-background-tabletop { background-color: #d9c3a5; background-image: repeating-linear-gradient(1deg, #775b3708 0 1px, transparent 2px 7px); }
.scg-background-linen { background-color: #e6dfd2; background-image: repeating-linear-gradient(0deg, #685c3d08 0 1px, transparent 1px 3px), repeating-linear-gradient(90deg, #fff5 0 1px, transparent 1px 3px); }
.scg-background-paper { background-color: #f2eee6; background-image: radial-gradient(#897c5c12 .5px, transparent .7px); background-size: 4px 4px; }
/* Legacy flat-gallery edge choices never overlay the 8794 paper material. */
.scg-surface:not([data-scg-paper]).scg-border-none .scg-card { box-shadow: 0 2px 5px #493e251c; }
.scg-surface:not([data-scg-paper]).scg-border-ink .scg-card { outline: 1px solid #82745d55; outline-offset: -1px; }
.scg-surface:not([data-scg-paper]).scg-border-shadow .scg-card { box-shadow: 0 2px 4px #493e252a, 0 16px 26px -8px #493e2566; }
.scg-surface:not([data-scg-paper]) .scg-card[data-scg-border='none'] { box-shadow: 0 2px 5px #493e251c; }
.scg-surface:not([data-scg-paper]) .scg-card[data-scg-border='ink'] { outline: 1px solid #82745d55; outline-offset: -1px; }
.scg-surface:not([data-scg-paper]) .scg-card[data-scg-border='shadow'] { box-shadow: 0 2px 4px #493e252a, 0 16px 26px -8px #493e2566; }
.scg-gallery .scg-photo picture { display: contents; }
.scg-gallery .scg-item[data-paper-format] { container-type: inline-size; }
.scg-gallery .scg-item[data-paper-format='classic'] { --format-paper-ratio: 88.47 / 107.52; --format-photo-ratio: 76.801 / 78.94; --format-edge: 6.59489cqw; --format-top: 7.23409cqw; --format-bottom: 25.07065cqw; }
.scg-gallery .scg-item[data-paper-format='mini'] { --format-paper-ratio: 54 / 86; --format-photo-ratio: 46 / 62; --format-edge: 7.40741cqw; --format-top: 11.11111cqw; --format-bottom: 33.33333cqw; }
.scg-gallery .scg-item[data-paper-format='wide'] { --format-paper-ratio: 108 / 86; --format-photo-ratio: 99 / 62; --format-edge: 4.16667cqw; --format-top: 5.55556cqw; --format-bottom: 16.66667cqw; }
.scg-gallery .scg-item[data-paper-format] .scg-card { aspect-ratio: var(--format-paper-ratio); padding: var(--format-top) var(--format-edge) var(--format-bottom); }
.scg-gallery .scg-item[data-paper-format] .scg-photo { aspect-ratio: var(--format-photo-ratio); }
.scg-gallery .scg-item[data-paper-format] .scg-caption { position: absolute; display: flex; align-items: center; justify-content: center; left: var(--format-edge); right: var(--format-edge); bottom: 0; height: var(--format-bottom); margin: 0; line-height: 1.35; overflow: hidden; }
.scg-gallery.scg-editor .scg-editor-card { appearance: none; text-align: inherit; font: inherit; cursor: pointer; transition: none; }
.scg-gallery.scg-editor .scg-item.is-selected .scg-card { outline: 3px solid #705b39; outline-offset: 5px; }
.scg-gallery.scg-editor .scg-editor-card:focus-visible { outline: 3px solid #2778b9; outline-offset: 5px; }
.scg-gallery .scg-add-card { min-height: 130px; padding: 12px; display: flex; align-items: center; justify-content: center; border: 1px dashed #9c927d; background: #ffffff35; border-radius: 4px; }
.scg-selection-summary, .scg-single-editor-head { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin: 16px 0; padding: 12px; background: #f2eee5; border: 1px solid #c9c1b3; border-radius: 4px; font: 13px/1.5 system-ui, sans-serif; }
.scg-stats { margin: 16px 0; padding: 12px; background: #f5f3ee; font: 13px/1.7 system-ui, sans-serif; font-variant-numeric: tabular-nums; }
.scg-stats > .scg-hint { display: block; }
.scg-list-meta { color: #625a4e; font: 12px/1.5 system-ui, sans-serif; }
.scg-list-acts { flex-wrap: wrap; justify-content: flex-end; max-width: 180px; }
.scg-list-mid > strong { font: 600 13px/1.5 system-ui, sans-serif; }
.scg-upload-advice { color: #625a4e; margin: 16px 0; font: 12px/1.7 system-ui, sans-serif; }
.scg-photo-modal { width: min(980px, calc(100vw - 32px)); max-width: 100%; }
.scg-experience-modal { width: min(1480px, calc(100vw - 32px)); max-width: 100%; }
.scg-single-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 1fr); gap: 28px; }
.scg-single-preview { align-self: start; padding: 24px; }
.scg-single-preview .scg-gallery { display: block; max-width: 330px; margin: 0 auto; }
.scg-single-preview .scg-card { transform: none; cursor: default; }
.scg-single-preview .scg-caption { font-size: 18px; }
.scg-single-fields { min-width: 0; }
.scg-full-comparison { font: 12px/1.6 system-ui, sans-serif; }
.scg-full-comparison img { margin-top: 12px; object-fit: contain; }
.scg-crop-warning { background: #f6f0df; color: #665124; padding: 10px 12px; font: 12px/1.6 system-ui, sans-serif; }
.scg-modal-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 12px; margin-top: 20px; padding-top: 16px; border-top: 1px solid #ded9cf; }
@media (max-width: 600px) {
  .scg-single-layout { grid-template-columns: minmax(0, 1fr); }
  .scg-single-preview { padding: 18px; }
  .scg-single-preview .scg-gallery { max-width: 230px; }
  .scg-list-acts { max-width: none; }
  .scg-selection-summary .components-button { min-height: 44px; }
}
.scg-experience-frame { display: block; border: 1px solid #d9d3c9; width: 100%; height: min(72vh, 900px); min-height: 360px; background: #faf8f3; }

/* Match the accepted demo treatment for the Momo Zhuanji caption only. */
[data-scg-paper] .scg-gallery .scg-caption[data-liuyt-webfont-id="momo-zhuanji"] {
  font-size: 16px;
  font-weight: 500;
  font-style: normal;
  font-synthesis: none;
  -webkit-text-stroke: .18px currentColor;
}
