.wg-gallery, .wf-wrap {
  min-width: 0;
  color: #10233f;
}
.wg-gallery [hidden], .wf-wrap [hidden] { display: none !important; }
.wg-gallery {scroll-margin-top:24px}
.pg .wg-gallery h2 {margin:0 0 20px}
.wg-toolbar, .wg-filters, .wg-view-top, .wg-view-bottom, .wg-controls, .wf-actions {
  display: flex;
  align-items: center;
}
.wg-toolbar {
  justify-content: space-between;
  gap: 15px;
  padding-bottom: 22px;
  margin-bottom: 26px;
  border-bottom: 1px solid #dce3e8;
}
.wg-filters { flex-wrap: wrap; gap: 8px; }
.wg-filter, .wf-wrap input, .wf-wrap select, .wf-wrap button, .wg-control {
  font: inherit;
}
.wg-filter {
  min-height: 42px;
  padding: 8px 16px;
  border-radius: 32px;
  border: 1px solid #cbd6de;
  background: #fff;
  color: #243f57;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .18s, color .18s;
}
.wg-filter:hover { background: #eaf3f8; }
.wg-filter[aria-pressed="true"] { background: #10233f; border-color: #10233f; color: white; }
.wg-count { white-space: nowrap; color: #526678; font-size: .85rem; }
.wg-grid { columns: 3; column-gap: clamp(16px, 2.2vw, 32px); }
.wg-item { margin: 0 0 27px; break-inside: avoid; }
.wg-thumb {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: 8px;
  background: #e9e8e2;
}
.wg-thumb img { display: block; max-width: 100%; width: 100%; height: auto; transition: transform .32s ease; }
.wg-thumb:hover img { transform: scale(1.018); }
.wg-expand {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #fff;
  background: rgb(16 35 63 / 82%);
}
.wg-item figcaption { display: grid; gap: 3px; margin: 11px 0 0; }
.wg-caption-cat, .wg-view-caption span { font-size: .76rem; color: #546777; }
.wg-item figcaption strong { font-size: 1.08rem; line-height: 1.3; font-weight: 650; }
.wg-viewing { overflow: hidden; }
.wg-dialog {
  box-sizing: border-box;
  width: min(960px, 94vw);
  max-height: 96vh;
  max-height: 96dvh;
  padding: 14px 18px;
  margin: auto;
  border: 1px solid #38475c;
  border-radius: 12px;
  background: #101e32;
  color: white;
}
.wg-dialog::backdrop { background: rgb(4 12 25 / 88%); }
.wg-dialog[open] { animation: wg-open .18s ease-out; }
.wg-view-top, .wg-view-bottom { justify-content: space-between; gap: 12px; }
.wg-view-top { margin-bottom: 10px; }
.wg-view-top span { font-size: .84rem; color: #c7d4e1; font-variant-numeric: tabular-nums; }
.wg-large {
  display: block;
  width: 100%;
  height: min(68vh, 760px);
  height: min(68dvh, 760px);
  object-fit: contain;
}
.wg-view-bottom { margin-top: 12px; }
.wg-view-caption { display: grid; gap: 3px; }
.wg-view-caption span { color: #b9cbd8; }
.wg-view-caption strong { line-height: 1.3; }
.wg-controls { gap: 6px; }
.wg-control {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border: 1px solid #617184;
  border-radius: 50%;
  color: white;
  background: transparent;
  cursor: pointer;
}
.wg-control:hover { background: #293b51; }
.wf-wrap {
  border: 1px solid #cfdbe2;
  padding: clamp(20px, 4vw, 40px);
  border-radius: 14px;
  background: #fff;
}
.wf-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 0 0 14px;
  border-bottom: 1px solid #dce3e8;
}
.wf-tabs a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 15px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #395369;
  font-weight: 650;
  text-decoration: none;
  scroll-margin-top: 110px;
}
.wf-tabs a[aria-current] { color: #10233f; background: #eaf2f7; border-color: #d4e5ee; }
.wf-tabs a:hover, .wf-edit:hover { text-decoration: underline; text-underline-offset: 3px; }
.wf-wrap .wf-intro { max-width: 64ch; color: #415668; margin: 18px 0 23px; font-size: 1rem; line-height: 1.6; }
.wf-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; }
.wf-mode-fields { margin: 16px 0 22px; }
.wf-field { min-width: 0; }
.wf-field label { display: block; margin-bottom: 7px; color: #243a50; font-size: .88rem; font-weight: 650; }
.wf-field input, .wf-field select {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 47px;
  padding: 9px 10px;
  background: white;
  border: 1px solid #a6b6c2;
  border-radius: 5px;
  color: #152c45;
  font-size: 1rem;
}
.wf-field input::placeholder { color: #647787; opacity: 1; }
.wf-field [aria-invalid="true"] { border-color: #b3263d; }
.wf-error { display: block; margin-top: 5px; color: #a41f37; font-size: .88rem; }
.wf-wrap .wf-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 46px;
  padding: 10px 17px;
  border: 0;
  border-radius: 6px;
  background: #10233f;
  color: white;
  font: inherit;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}
.wf-wrap .wf-action:hover { background: #224365; }
.wf-wrap .wf-preview h3 { margin: 24px 0 12px; }
.wf-wrap .wf-message {
  margin: 0 0 20px;
  padding: 16px 18px;
  border-left: 3px solid #4b9ed2;
  background: #f1f6f9;
  color: #223a50;
  line-height: 1.65;
  overflow-wrap: anywhere;
  white-space: pre-line;
}
.wf-actions { flex-wrap: wrap; gap: 12px; }
.wf-edit {
  padding: 8px;
  min-height: 44px;
  border: 0;
  background: transparent;
  color: #264e6e;
  cursor: pointer;
}
.wg-gallery :focus-visible, .wf-wrap :focus-visible { outline: 3px solid #2470a2; outline-offset: 3px; }
.wg-dialog :focus-visible { outline-color: #9ad4f7; }

html[data-theme="dark"] :is(.wg-gallery, .wf-wrap) {
  --widget-surface: #142238;
  --widget-raised: #20344b;
  --widget-line: #53667c;
  --widget-text: #eff4f8;
  --widget-secondary: #bdcbd9;
  --widget-action: #a3d3f1;
  color: var(--widget-text);
  color-scheme: dark;
}
html[data-theme="dark"] :is(.wg-toolbar, .wf-tabs) { border-color: var(--widget-line); }
html[data-theme="dark"] :is(.wg-count, .wg-caption-cat, .wf-wrap .wf-intro) { color: var(--widget-secondary); }
html[data-theme="dark"] :is(.wg-filter, .wf-wrap, .wf-field input, .wf-field select) {
  background: var(--widget-surface);
  color: var(--widget-text);
  border-color: var(--widget-line);
}
html[data-theme="dark"] .wg-filter:hover { background: var(--widget-raised); }
html[data-theme="dark"] :is(.wf-wrap .wf-action, .wg-filter[aria-pressed="true"]) {
  background: var(--widget-action);
  border-color: var(--widget-action);
  color: #10233f;
}
html[data-theme="dark"] .wf-wrap .wf-action:hover { background: #c0e4fb; }
html[data-theme="dark"] :is(.wf-tabs a, .wf-field label) { color: var(--widget-text); }
html[data-theme="dark"] .wf-tabs a[aria-current], html[data-theme="dark"] .wf-wrap .wf-message {
  background: var(--widget-raised);
  color: var(--widget-text);
}
html[data-theme="dark"] .wf-tabs a[aria-current] { border-color: var(--widget-line); }
html[data-theme="dark"] .wf-field input::placeholder { color: var(--widget-secondary); }
html[data-theme="dark"] .wf-field [aria-invalid="true"] { border-color: #f097a3; }
html[data-theme="dark"] .wf-error { color: #ffa5b0; }
html[data-theme="dark"] :is(.wf-edit, .wf-wrap noscript a) { color: var(--widget-action); }
html[data-theme="dark"] :is(.wg-gallery, .wf-wrap) :focus-visible { outline-color: #93d2fa; }

@keyframes wg-open { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 949px) {
  .wg-grid { columns: 2; }
  .wg-toolbar { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 549px) {
  .wg-grid { columns: 1; }
  .wg-item { margin-bottom: 22px; }
  .wg-filter { padding: 8px 12px; }
  .wg-dialog { padding: 11px; }
  .wf-fields { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .wg-gallery *, .wf-wrap * { animation: none !important; transition: none !important; }
  .wg-thumb:hover img { transform: none; }
}
