/* litvinov.ee — works gallery block (#gallery) and its lightbox. Uses the tokens of /style.css. */
#gallery { --band: var(--mist); }
#gallery .sub { margin-bottom: 2.25rem; }
.grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem 1rem; }
@media (min-width: 760px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.5rem; } }
.work { margin: 0; }
.work-link { position: relative; display: block; overflow: hidden; aspect-ratio: 3 / 4; background: var(--sand); }
.work-link img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.2, .6, .2, 1); }
.work-link:hover img { transform: scale(1.04); }
.work-title { margin: .6rem 0 0; font: 600 .85rem/1.35 system-ui, sans-serif; letter-spacing: .04em; color: var(--head); }
.work-badges { position: absolute; left: .6rem; bottom: .6rem; display: flex; gap: .35rem; }
.work-badges span { padding: .3rem .6rem; border-radius: 2rem; background: rgba(43, 36, 32, .8); color: #fff; font: 600 .72rem/1 system-ui, sans-serif; letter-spacing: .08em; }
.work-link:focus-visible, .lb button:focus-visible { outline: 2px solid var(--tan-text); outline-offset: 3px; }

/* ---------- lightbox ---------- */
.lb { width: 100vw; max-width: none; height: 100dvh; max-height: none; margin: 0; padding: 0; border: 0; background: #1b1613; color: #f1ebe3; overflow: hidden; }
.lb[open] { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; }
.lb::backdrop { background: #1b1613; }
.lb button { font-family: system-ui, sans-serif; cursor: pointer; }
.lb-bar { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; padding: 1rem 1.25rem; }
.lb-title { margin: 0; font: 700 1.1rem/1.2 system-ui, sans-serif; letter-spacing: .06em; text-transform: uppercase; color: #fff; }
.lb-meta { margin: .3rem 0 0; font: 500 .85rem/1.4 system-ui, sans-serif; color: #bdb2a6; }
.lb-actions { display: flex; align-items: center; gap: .6rem; flex: none; }
.lb-close { width: 2.5rem; height: 2.5rem; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .1); color: #fff; font-size: 1.6rem; line-height: 1; }
.lb-close:hover { background: rgba(255, 255, 255, .2); }

.lb-stage { position: relative; display: flex; align-items: center; justify-content: center; min-height: 0; padding: 0 3.5rem; overflow: hidden; touch-action: pan-y; }
.lb-img { min-width: 0; min-height: 0; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; transition: opacity .25s; }
.lb-img.is-loading { opacity: 0; }
.lb-nav { position: absolute; top: 50%; width: 2.75rem; height: 2.75rem; margin-top: -1.375rem; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .1); color: #fff; font-size: 1.8rem; line-height: 1; }
.lb-nav:hover { background: rgba(255, 255, 255, .22); }
.lb-prev { left: .5rem; }
.lb-next { right: .5rem; }

.lb-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 1.25rem 1.1rem; }
.lb-thumbs { display: flex; gap: .5rem; overflow-x: auto; min-width: 0; padding: 2px; }
.lb-thumbs button { flex: none; width: 3.5rem; height: 3.5rem; padding: 0; border: 2px solid transparent; border-radius: 2px; background: none; opacity: .55; overflow: hidden; }
.lb-thumbs button[aria-current="true"] { border-color: var(--tan); opacity: 1; }
.lb-thumbs img { width: 100%; height: 100%; object-fit: cover; }
.lb-count { font: 500 .85rem/1 system-ui, sans-serif; color: #bdb2a6; white-space: nowrap; }
.lb-work { padding: .55rem .9rem; border: 1px solid rgba(255, 255, 255, .25); border-radius: 2rem; background: none; color: #f1ebe3; font: 600 .75rem/1 system-ui, sans-serif; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.lb-work:hover { background: rgba(255, 255, 255, .12); }
@media (max-width: 640px) {
  .lb-stage { padding: 0 .5rem; }
  .lb-nav { background: rgba(27, 22, 19, .6); }
  .lb-foot { flex-wrap: wrap; justify-content: center; }
  .lb-thumbs { order: -1; width: 100%; justify-content: safe center; }
}
@media (prefers-reduced-motion: reduce) { .work-link img, .lb-img, .chip { transition: none; } }
