#pg-site-gallery {
  --photo-blue: #244f80;
  --photo-wash: #eef5fc;
  --photo-line: #afc4db;
  --photo-gold: #ffcf40;
  display: grid;
  gap: 22px;
  margin-top: 18px;
  min-width: 0;
}
body.dark #pg-site-gallery {
  --photo-blue: #b7d6ff;
  --photo-wash: #1a304d;
  --photo-line: #506e93;
}
#pg-site-gallery [hidden] {display: none !important;}
#pg-site-gallery svg {
  width: 19px; height: 19px; flex: 0 0 auto;
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}
#pg-site-gallery .pg-capture-panel {
  display: grid;
  grid-template-columns: minmax(160px, .75fr) minmax(260px, 1.7fr);
  gap: clamp(18px, 3vw, 40px);
  align-items: start;
  padding: clamp(16px, 2vw, 28px);
  margin: 0;
  border: 0; border-radius: 20px;
  background: linear-gradient(120deg, color-mix(in srgb, var(--photo-wash) 68%, var(--card)), var(--card) 46%);
  overflow: visible;
}
.pg-photo-project, .pg-photo-uploader, .pg-file-preview > div, .pg-drop-empty > div {min-width: 0;}
.pg-photo-project label, #pg-site-gallery .pg-photo-uploader h2 {
  display: block; color: var(--ink); margin: 0 0 12px;
  font-size: 1rem; line-height: 1.35; font-weight: 650;
}
.pg-photo-project :is(select,.select2-container) {width: 100% !important; max-width: 100%; min-width: 0;}
.pg-photo-drop {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 106px;
  padding: 16px 18px; border: 1.5px dashed var(--photo-line); border-radius: 18px;
  background: var(--photo-wash); transition: background 150ms, border-color 150ms;
}
.pg-photo-drop.pg-dragging {border-color: var(--photo-blue); background: color-mix(in srgb, var(--photo-blue) 16%, var(--photo-wash));}
.pg-drop-empty, .pg-file-preview {display: flex; align-items: center; gap: 12px; min-width: 0;}
.pg-drop-empty strong, .pg-file-preview strong {display: block; overflow-wrap: anywhere; line-height: 1.25; color: var(--ink); font-weight: 650;}
.pg-drop-empty small, .pg-file-preview small {display: block; color: var(--mut); margin: 5px 0 0; line-height: 1.35;}
.pg-upload-icon {
  position: relative; display: grid; flex: 0 0 auto; place-items: center; width: 46px; height: 46px;
  background: var(--card); color: var(--photo-blue); border-radius: 15px; box-shadow: 0 3px 12px #112b4612;
}
.pg-upload-icon::after {content: ''; position: absolute; right: 6px; top: 6px; width: 6px; height: 6px; background: var(--photo-gold); border-radius: 50%;}
#pg-site-gallery .pg-upload-icon svg {width: 25px; height: 25px;}
.pg-file-preview img {width: 66px; height: 62px; flex: 0 0 auto; object-fit: cover; border-radius: 11px;}
#pg-site-gallery .pg-file-select, #pg-site-gallery .pg-file-save, #pg-site-gallery .pg-file-clear {
  min-height: 40px; padding: 8px 15px; flex-shrink: 0; line-height: 1.2; gap: 7px;
}
#pg-site-gallery .pg-file-select {background: var(--card); color: var(--photo-blue); border-color: var(--photo-line);}
#pg-site-gallery .pg-file-save {border: none; background: var(--photo-gold); color: #172b41;}
#pg-site-gallery .pg-file-save:disabled {color: var(--mut); background: var(--soft, var(--bg)); cursor: default;}
#pg-site-gallery .pg-file-clear {background: transparent; border: none; color: var(--mut);}
.pg-photo-save-row {display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: 7px 12px; margin-top: 12px;}
.pg-file-actions {margin-inline-start: auto; display: flex; align-items: center; gap: 5px;}
.pg-upload-message {margin: 0; font-size: .83rem; color: var(--mut); flex: 1 1 170px; overflow-wrap: anywhere;}
.pg-upload-message:empty {display: none;}
.pg-upload-message.pg-photo-error {color: #a53430;}
body.dark .pg-upload-message.pg-photo-error {color: #ffa9a4;}
.pg-photo-library, .pg-photo-collection {min-width: 0; display: grid; gap: 12px;}
.pg-photo-library {gap: 22px;}
.pg-photo-section-head {display: flex; gap: 9px; align-items: center;}
.pg-photo-section-head h2 {margin: 0; font-size: 1.06rem; font-weight: 650;}
.pg-photo-section-head span {
  padding: 2px 9px; min-width: 26px; border-radius: 99px; text-align: center; font-size: .82rem; font-weight: 650;
  color: var(--photo-blue); background: color-mix(in srgb, var(--photo-blue) 10%, var(--card));
}
.pg-photo-grid {display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 235px), 1fr)); gap: 14px;}
.pg-photo-card {
  display: flex; flex-direction: column; min-width: 0; margin: 0; overflow: hidden;
  border-radius: 17px; background: var(--card); box-shadow: var(--shadow);
}
#pg-site-gallery .pg-photo-thumb {
  display: block; border: 0; border-radius: 0 !important; padding: 0; margin: 0; width: 100%;
  aspect-ratio: 16 / 9; overflow: hidden; background: var(--photo-wash); cursor: zoom-in;
}
.pg-photo-thumb img {width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .18s ease;}
.pg-photo-thumb:hover img {transform: scale(1.035);}
#pg-site-gallery :is(.pg-photo-thumb,.pg-photo-tool):focus-visible {outline: 3px solid var(--photo-blue); outline-offset: -3px;}
.pg-photo-card figcaption {display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: 12px 14px;}
.pg-photo-text {display: grid; min-width: 0; gap: 4px; text-align: start;}
.pg-photo-text strong {color: var(--ink); line-height: 1.25; font-size: .94rem; font-weight: 620; overflow-wrap: anywhere;}
.pg-photo-text small, .pg-photo-full figcaption {color: var(--mut); font-size: .78rem; overflow-wrap: anywhere; line-height: 1.4;}
.pg-photo-controls {display: inline-flex; gap: 4px; flex-shrink: 0;}
#pg-site-gallery .pg-photo-tool {
  display: inline-grid; place-content: center; padding: 0; flex-shrink: 0;
  width: 31px; height: 31px; min-width: 31px; min-height: 31px; border: 0;
  background: var(--photo-wash); color: var(--photo-blue);
}
#pg-site-gallery .pg-photo-tool svg {width: 16px; height: 16px;}
.pg-photo-empty {display: flex; gap: 11px; align-items: center; padding: 14px 16px; background: var(--card); border-radius: 14px; color: var(--mut);}
.pg-photo-empty p {margin: 0; font-size: .87rem;}
.pg-photo-full {margin: 0; display: grid; gap: 10px;}
.pg-photo-full img {display: block; max-height: 57vh; width: 100%; object-fit: contain; border-radius: 12px; background: var(--bg);}
@media (max-width: 960px) {
  #pg-site-gallery .pg-capture-panel {grid-template-columns: minmax(0, 1fr); gap: 18px;}
}
@media (max-width: 580px) {
  .pg-photo-drop {flex-wrap: wrap; align-items: center; padding: 14px; gap: 12px;}
  .pg-drop-empty, .pg-file-preview {flex: 1 1 185px;}
  .pg-photo-save-row {align-items: start;}
  .pg-photo-grid {grid-template-columns: repeat(auto-fill,minmax(min(100%, 190px),1fr));}
}
@media (prefers-reduced-motion: reduce) {.pg-photo-thumb img,.pg-photo-drop {transition: none;}}
