.ap-gallery-editor { min-width: 0; margin: 28px 0; padding: 20px 0 0; border: 0; border-top: 1px solid var(--border-color, #d4dadd); color: var(--text-main, #202c32); }
.ap-gallery-editor legend { display: flex; gap: 16px; align-items: center; color: var(--text-heading, #172d32); font-size: 18px; font-weight: 650; }
.ap-gallery-count { font-size: 13px; font-weight: 400; color: var(--text-muted, #53666b); }
.ap-gallery-editor-list { display: grid; gap: 18px; }
.ap-gallery-edit-row { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 18px; padding: 18px 0; border-bottom: 1px solid var(--border-color, #d4dadd); }
.ap-gallery-edit-preview img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: contain; border-radius: 4px; background: var(--input-bg, #eef2f4); }
.ap-gallery-edit-preview small { display: block; margin: 8px 0; color: var(--text-muted, #53666b); }
.ap-gallery-edit-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; min-width: 0; }
.ap-gallery-edit-fields label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; min-width: 0; }
.ap-gallery-edit-fields label:first-child, .ap-gallery-edit-fields label:nth-child(2), .ap-gallery-edit-fields label:last-child { grid-column: 1 / -1; }
.ap-gallery-editor .ap-gallery-edit-fields input { width: 100%; min-width: 0; box-sizing: border-box; padding: 9px 11px; background: var(--input-bg, #fff); color: inherit; border: 1px solid var(--border-color, #b7c1c5); border-radius: 4px; font: inherit; }
.ap-gallery-row-tools { display: flex; gap: 6px; flex-wrap: wrap; }
.ap-gallery-icon { width: 34px; height: 34px; display: inline-flex; justify-content: center; align-items: center; padding: 6px; border: 1px solid var(--border-color, #b7c1c5); background: var(--bg-card, #fff); color: var(--text-heading, #172d32); border-radius: 4px; cursor: pointer; }
.ap-gallery-icon:disabled { opacity: .4; cursor: default; }
.ap-gallery-icon svg { width: 18px; height: 18px; }
.ap-gallery-icon:focus-visible, .ap-gallery-open:focus-visible, .ap-gallery-upload-label:focus-within { outline: 2px solid var(--primary-color, #096d63); outline-offset: 3px; }
.ap-gallery-upload-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
.ap-gallery-upload-actions > span, .ap-gallery-rights-note { font-size: 12px; color: var(--text-muted, #53666b); line-height: 1.6; }
.ap-gallery-upload-label { position: relative; overflow: hidden; cursor: pointer; }
.ap-gallery-files { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.ap-gallery-editor[disabled] .ap-gallery-upload-actions, .ap-gallery-editor[disabled] .ap-gallery-row-tools { display: none; }
.ap-gallery-editor-status { min-height: 1.5em; font-size: 13px; color: var(--primary-color, #096d63); }
.ap-gallery-editor-status.is-error { color: var(--danger-color, #b13240); }
.ap-gallery-empty { font-size: 14px; color: var(--text-muted, #53666b); margin: 8px 0; }
.wp-admin .ap-gallery-editor .btn-soft { display: inline-flex; padding: 8px 12px; border: 1px solid #b7c1c5; border-radius: 4px; background: #fff; color: #172d32; cursor: pointer; }
.ap-article-body { min-width: 0; }
.ap-article-body:has(> .ap-term-gallery) { display: grid; grid-template-columns: minmax(0, 1fr) 260px; column-gap: 28px; align-items: start; }
.ap-article-body > .wiki-content { grid-column: 1; grid-row: 1; min-width: 0; }
.ap-term-gallery { grid-column: 2; grid-row: 1; min-width: 0; padding: 0 0 16px; border-top: 2px solid var(--primary-color); }
.ap-gallery-heading { display: flex; align-items: baseline; justify-content: space-between; padding: 12px 0; }
.ap-gallery-heading h2 { font: inherit; font-size: 15px; font-weight: 650; margin: 0; }
.ap-gallery-heading span { color: var(--text-muted); font-size: 12px; }
.ap-gallery-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ap-gallery-figure { margin: 0; min-width: 0; }
.ap-gallery-figure:first-child { grid-column: 1 / -1; margin-bottom: 8px; }
.ap-gallery-open { display: block; border: 1px solid var(--border-color); border-radius: 4px; overflow: hidden; background: var(--input-bg); }
.ap-gallery-open img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: contain; transition: opacity .15s; }
.ap-gallery-open:hover img { opacity: .82; }
.ap-gallery-figure figcaption { font-size: 13px; line-height: 1.6; margin-top: 8px; overflow-wrap: anywhere; }
.ap-gallery-figure figcaption small { display: block; color: var(--text-muted); font-size: 11px; }
.ap-gallery-figure:not(:first-child) figcaption { display: none; }
.ap-gallery-dialog { box-sizing: border-box; width: min(1180px, calc(100% - 32px)); max-width: none; height: min(900px, calc(100dvh - 40px)); max-height: none; padding: 0; border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-card, #fff); color: var(--text-main, #172d32); margin: auto; }
.ap-gallery-dialog::backdrop { background: rgba(0, 0, 0, .8); }
.ap-gallery-dialog[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.ap-gallery-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border-color); }
.ap-gallery-dialog-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
.ap-gallery-dialog-tools { display: flex; align-items: center; gap: 8px; }
.ap-gallery-stage { min-height: 0; overflow: auto; display: grid; place-items: center; padding: 12px; background: var(--bg-body); touch-action: pan-y; }
.ap-gallery-stage img { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; max-width: 100%; }
.ap-gallery-stage.is-zoomed { display: block; touch-action: auto; }
.ap-gallery-stage.is-zoomed img { width: auto; height: auto; max-width: none; max-height: none; }
.ap-gallery-dialog-foot { padding: 14px 18px; max-height: 26dvh; overflow-y: auto; border-top: 1px solid var(--border-color); overflow-wrap: anywhere; }
.ap-gallery-dialog-foot p { margin: 0 0 6px; font-size: 14px; }
.ap-gallery-dialog-foot small { color: var(--text-muted); font-size: 12px; }
.ap-gallery-dialog-foot a { color: var(--primary-color); font-size: 13px; margin-right: 16px; }
body.ap-gallery-modal-open { overflow: hidden; }
@media (max-width: 1279px) {
  .ap-article-body:has(> .ap-term-gallery) { display: block; }
  .ap-term-gallery { margin-bottom: 28px; }
  .ap-gallery-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .ap-gallery-figure:first-child { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 240px) minmax(0, 1fr); gap: 16px; align-items: center; }
}
@media (max-width: 600px) {
  .ap-gallery-edit-row { grid-template-columns: minmax(0, 1fr); }
  .ap-gallery-edit-preview { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 10px; align-items: center; }
  .ap-gallery-edit-preview small { grid-column: 2; }
  .ap-gallery-row-tools { grid-column: 2; }
  .ap-gallery-edit-fields { grid-template-columns: minmax(0, 1fr); }
  .ap-gallery-figure:first-child { display: block; }
  .ap-gallery-figure:first-child img { max-height: 220px; aspect-ratio: 16 / 9; }
  .ap-gallery-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .ap-gallery-dialog { width: calc(100% - 16px); height: calc(100dvh - 16px); }
  .ap-gallery-dialog-head { padding: 10px; }
  .ap-gallery-dialog-tools { gap: 4px; }
}
@media print {
  .ap-article-body:has(> .ap-term-gallery) { display: block !important; }
  .ap-term-gallery { color: #111 !important; background: #fff !important; border: 0; margin-bottom: 14px; break-inside: avoid; }
  .ap-gallery-grid, .ap-gallery-figure:first-child { display: block; }
  .ap-gallery-figure:first-child img { width: auto; max-width: 100%; height: auto; max-height: 55mm; aspect-ratio: auto; }
  .ap-gallery-figure figcaption, .ap-gallery-figure figcaption small { color: #111 !important; }
  .ap-gallery-heading, .ap-gallery-figure:not(:first-child), .ap-gallery-dialog { display: none !important; }
  .ap-gallery-open { background: #fff; border: 0; }
}
