.project-gallery {
  --gallery-text: #fff8ea;
  --gallery-border: rgba(240, 198, 109, 0.34);
  --gallery-surface: #161614;
  --gallery-accent: #f0c66d;
  min-width: 0;
}

html[data-theme="light"] .project-gallery {
  --gallery-text: #27231e;
  --gallery-border: #b7afa1;
  --gallery-surface: #fff;
  --gallery-accent: #9c701f;
}

.project-gallery__toolbar,
.project-gallery__navigation,
.project-gallery__views {
  display: flex;
  align-items: center;
  gap: 8px;
}

.project-gallery__toolbar { justify-content: space-between; }
.project-gallery [hidden] { display: none !important; }
.project-gallery__filter { min-height: 44px; }

.project-gallery__tool {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 10px;
  border: 1px solid var(--gallery-border);
  border-radius: 5px;
  background: var(--gallery-surface);
  color: var(--gallery-text);
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease;
}

.project-gallery__tool img,
.project-gallery__more img { filter: invert(1); }
html[data-theme="light"] .project-gallery__tool img,
html[data-theme="light"] .project-gallery__more img { filter: none; }
.project-gallery__tool[aria-pressed="true"] { border-color: var(--gallery-accent); box-shadow: inset 0 0 0 1px var(--gallery-accent); }
.project-gallery__tool:hover:not(:disabled) { border-color: var(--gallery-accent); }
.project-gallery__tool:disabled { opacity: 0.35; cursor: default; }
.project-gallery__position { min-width: 72px; color: var(--gallery-text); text-align: center; font-size: 13px; font-variant-numeric: tabular-nums; }
.project-gallery__track { position: relative; }
.project-gallery__link { display: block; width: 100%; height: 100%; color: inherit; cursor: zoom-in; -webkit-tap-highlight-color: transparent; }
.project-gallery__tool:focus-visible,
.project-gallery__more:focus-visible,
.project-gallery__link:focus-visible { outline: 3px solid var(--gallery-accent); outline-offset: -4px; }

.project-gallery__expand {
  position: absolute;
  left: 12px;
  top: 12px;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.75);
  pointer-events: none;
}
.project-gallery__expand::after {
  content: "";
  position: absolute;
  inset: 8px;
  background: url("../vendor/lucide/maximize-2.svg") center / contain no-repeat;
  filter: invert(1);
}
.project-gallery[data-project-layout="grid"] .project-gallery__track {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: visible;
  scroll-snap-type: none;
}
.project-gallery[data-project-layout="grid"] .project-gallery__card { width: 100%; min-width: 0; }
.project-gallery__more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 18px;
  border: 1px solid var(--gallery-border);
  border-radius: 5px;
  background: var(--gallery-surface);
  color: var(--gallery-text);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.pswp--main-projects { z-index: 12000; --pswp-bg: #0b0b0b; }
.pswp--main-projects .pswp__top-bar { padding-top: env(safe-area-inset-top, 0px); }
.pswp--main-projects .pswp__project-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  min-height: 64px;
  padding: 16px max(20px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px));
  color: #fff;
  background: #0b0b0b;
  text-align: center;
  font-size: 16px;
  line-height: 1.4;
  pointer-events: none;
}
.pswp--main-projects .pswp__button--arrow { display: block; width: 48px; height: 64px; background: rgba(0, 0, 0, 0.6); }
.pswp--main-projects .pswp__button--arrow .pswp__icn { left: 8px; width: 32px; }
.pswp--main-projects .pswp__button--arrow--next .pswp__icn { right: 8px; left: auto; }

@media (max-width: 980px) {
  .project-gallery[data-project-layout="grid"] .project-gallery__track { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .project-gallery[data-project-layout="grid"] .project-gallery__track { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .project-gallery[data-project-layout="grid"] .project-gallery__card-caption { padding: 24px 10px 10px; min-height: 68px; }
  .project-gallery[data-project-layout="grid"] .project-gallery__card-caption strong { font-size: 14px; }
  .project-gallery[data-project-layout="grid"] .project-gallery__card-caption span { font-size: 11px; }
  .project-gallery[data-project-layout="grid"] .project-gallery__expand { width: 28px; height: 28px; left: 8px; top: 8px; }
  .project-gallery[data-project-layout="grid"] .project-gallery__expand::after { inset: 6px; }
  .pswp--main-projects .pswp__project-caption { font-size: 14px; }
  .pswp--main-projects .pswp__button--arrow { width: 44px; height: 52px; }
}
@media (prefers-reduced-motion: reduce) {
  .project-gallery__tool { transition: none; }
}
