#gallery.bento-gallery {
  position: relative;
  padding-top: clamp(4.5rem, 7vw, 7rem);
  padding-bottom: clamp(4.5rem, 7vw, 7rem);
}

#gallery .bento-gallery__shell {
  display: grid;
  gap: clamp(1.4rem, 3vw, 2.4rem);
}

#gallery .bento-gallery__header {
  max-width: 52rem;
  display: grid;
  gap: 0.9rem;
}

#gallery .bento-gallery__header .eyebrow {
  margin-bottom: 0.2rem;
}

#gallery .bento-gallery__header h2 {
  max-width: 18ch;
}

#gallery .bento-gallery__header p {
  max-width: 44rem;
}

#gallery .bento-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(0.35rem, 0.45vw, 0.6rem);
  grid-auto-flow: dense;
}

#gallery .bento-card {
  position: relative;
  overflow: hidden;
  border-radius: 1.35rem;
  box-shadow: 0 1rem 2.5rem rgba(17, 17, 17, 0.08);
  min-height: clamp(16rem, 62vw, 23rem);
  transform: translateZ(0);
  transition:
    transform 260ms cubic-bezier(0.175, 0.885, 0.32, 1.275),
    box-shadow 260ms ease;
}

#gallery .bento-card.dragging {
  opacity: 0.55;
  transform: scale(0.98);
}

#gallery .bento-card.is-drop-target {
  outline: 1px solid rgba(255, 255, 255, 0.7);
  outline-offset: -1px;
}

#gallery .bento-card__button {
  all: unset;
  cursor: pointer;
  display: block;
  width: 100%;
  height: 100%;
}

#gallery .bento-card__media {
  position: absolute;
  inset: 0;
}

#gallery .bento-card__media img,
#gallery .bento-card__media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

#gallery .bento-card__media video {
  pointer-events: none;
}

#gallery .bento-modal__media {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

#gallery .bento-modal__media img,
#gallery .bento-modal__media video {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

#gallery .bento-card__overlay {
  position: absolute;
  inset: auto 0 0;
  padding: 1.1rem 1.1rem 1.15rem;
  display: grid;
  gap: 0.35rem;
  background: linear-gradient(180deg, rgba(17, 17, 17, 0) 0%, rgba(17, 17, 17, 0.82) 100%);
  color: #fff;
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity 260ms ease,
    transform 260ms cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#gallery .bento-card__tag {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

#gallery .bento-card__overlay h3 {
  font-family: "Space Grotesk", "Inter", sans-serif;
  font-size: clamp(1.2rem, 2vw, 1.65rem);
  line-height: 0.96;
  letter-spacing: -0.05em;
  margin: 0;
}

#gallery .bento-card__overlay p {
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.95rem;
}

#gallery .media-spinner {
  position: absolute;
  inset: auto 1rem 1rem auto;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-top-color: rgba(255, 255, 255, 0.92);
  opacity: 0;
  pointer-events: none;
  animation: gallery-spin 0.85s linear infinite;
}

#gallery .media-spinner.is-visible {
  opacity: 1;
}

@keyframes gallery-spin {
  to { transform: rotate(360deg); }
}

#gallery .col-span-2 { grid-column: span 2; }
#gallery .col-span-3 { grid-column: span 3; }
#gallery .row-span-2 { grid-row: span 2; }
#gallery .row-span-3 { grid-row: span 3; }

@media (hover: hover) and (pointer: fine) {
  #gallery .bento-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 1.5rem 3rem rgba(17, 17, 17, 0.12);
  }

  #gallery .bento-card:hover .bento-card__overlay,
  #gallery .bento-card:focus-within .bento-card__overlay {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (hover: none) {
  #gallery .bento-card__overlay {
    opacity: 1;
    transform: none;
  }
}

@media (min-width: 720px) {
  #gallery .bento-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: clamp(8.8rem, 14vw, 11.8rem);
  }

  #gallery .bento-card {
    min-height: 0;
  }
}

@media (min-width: 1120px) {
  #gallery .bento-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-auto-rows: clamp(9rem, 10vw, 12.5rem);
  }
}

.bento-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}

.bento-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.bento-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(28px) saturate(1.1);
  -webkit-backdrop-filter: blur(28px) saturate(1.1);
}

.bento-modal__viewport {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: clamp(1rem, 2vw, 2rem);
}

.bento-modal__shell {
  position: relative;
  width: min(100%, 1360px);
  height: min(100%, 920px);
  display: grid;
  align-items: center;
  justify-items: center;
}

.bento-modal__content {
  width: min(100%, 1180px);
  height: 100%;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 1rem;
  justify-items: stretch;
  opacity: 0;
  transform: translateY(18px) scale(0.96);
  transition:
    transform 500ms cubic-bezier(0.175, 0.885, 0.32, 1.275),
    opacity 260ms ease;
}

.bento-modal.is-open .bento-modal__content {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.bento-modal__close {
  position: absolute;
  top: clamp(0.25rem, 2vw, 0.75rem);
  right: clamp(0.25rem, 2vw, 0.75rem);
  z-index: 3;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.16);
  color: var(--text);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 0.75rem 1.75rem rgba(17, 17, 17, 0.12);
  display: grid;
  place-items: center;
  font-size: 1.2rem;
}

.bento-modal__nav {
  position: absolute;
  top: 50%;
  z-index: 3;
  width: 52px;
  height: 52px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.16);
  color: var(--text);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 0.75rem 1.75rem rgba(17, 17, 17, 0.12);
  display: grid;
  place-items: center;
  font-size: 2rem;
  line-height: 1;
  transform: translateY(-50%);
}

.bento-modal__nav--prev {
  left: clamp(0.25rem, 2vw, 0.75rem);
}

.bento-modal__nav--next {
  right: clamp(0.25rem, 2vw, 0.75rem);
}

.bento-modal__nav:disabled {
  opacity: 0.45;
  pointer-events: none;
}

.bento-modal__stage {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border-radius: 0;
  overflow: hidden;
  background: transparent;
  border: 0;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bento-modal__media {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.bento-modal__info {
  width: min(100%, 760px);
  padding: 1rem 1.15rem 1.05rem;
  border-radius: 1.2rem;
  background: rgba(255, 255, 255, 0.64);
  border: 1px solid rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 1rem 2rem rgba(17, 17, 17, 0.08);
  text-align: left;
}

.bento-modal__kind {
  display: inline-flex;
  padding: 0.24rem 0.6rem;
  border-radius: 999px;
  background: rgba(121, 112, 102, 0.12);
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 0.65rem;
}

.bento-modal__info h3 {
  margin: 0 0 0.35rem;
  font-family: "Space Grotesk", "Inter", sans-serif;
  font-size: clamp(1.5rem, 2.6vw, 2.6rem);
  line-height: 0.98;
  letter-spacing: -0.05em;
}

.bento-modal__info p {
  margin: 0;
  color: rgba(26, 26, 26, 0.72);
}

.bento-dock {
  position: absolute;
  left: 50%;
  bottom: clamp(0.85rem, 2vw, 1.4rem);
  transform: translate(calc(-50% + var(--dock-x, 0px)), var(--dock-y, 0px));
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.65rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.38);
  box-shadow: 0 1.8rem 4rem rgba(17, 17, 17, 0.16);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  cursor: grab;
  user-select: none;
  touch-action: none;
  z-index: 4;
}

#gallery .bento-dock:active {
  cursor: grabbing;
}

.dock-thumb {
  position: relative;
  width: 52px;
  height: 72px;
  border-radius: 0.85rem;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 0.8rem 1.4rem rgba(17, 17, 17, 0.14);
  transform: rotate(var(--thumb-rotate, 0deg));
  transition:
    transform 240ms cubic-bezier(0.175, 0.885, 0.32, 1.275),
    box-shadow 240ms ease,
    border-color 240ms ease;
  flex: 0 0 auto;
}

.dock-thumb:nth-child(odd) { --thumb-rotate: -14deg; }
.dock-thumb:nth-child(even) { --thumb-rotate: 14deg; }

.dock-thumb img,
.dock-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.dock-thumb.is-active {
  border-color: rgba(255, 255, 255, 0.95);
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.9),
    0 0 0 6px rgba(121, 112, 102, 0.16),
    0 0.95rem 1.8rem rgba(121, 112, 102, 0.28);
}

.dock-thumb.is-active::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.88) inset;
  pointer-events: none;
}

.dock-thumb:hover,
.dock-thumb:focus-visible {
  transform: rotate(0deg) translateY(-8px) scale(1.1);
  z-index: 2;
}

body.has-bento-modal {
  overflow: hidden;
}

.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.gallery-lightbox.is-open {
  opacity: 1;
  pointer-events: auto;
}

.gallery-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.24);
  backdrop-filter: blur(24px) saturate(1.08);
  -webkit-backdrop-filter: blur(24px) saturate(1.08);
}

.gallery-lightbox__viewport {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: clamp(0.75rem, 1.8vw, 1.5rem);
}

.gallery-lightbox__shell {
  position: relative;
  width: min(100%, 1220px);
  height: min(calc(100svh - 4rem), 840px);
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 0.85rem;
  align-items: center;
  justify-items: stretch;
}

.gallery-lightbox__content {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 0.85rem;
  min-width: 0;
}

.gallery-lightbox__stage {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.gallery-lightbox__image {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.gallery-lightbox__meta {
  width: min(100%, 760px);
  justify-self: center;
  padding: 0.9rem 1rem 0.95rem;
  border-radius: 1.2rem;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.42);
  box-shadow: 0 1rem 2rem rgba(17, 17, 17, 0.08);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.gallery-lightbox__counter {
  display: inline-flex;
  margin-bottom: 0.5rem;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  background: rgba(121, 112, 102, 0.12);
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.gallery-lightbox__title {
  margin: 0 0 0.28rem;
  font-family: "Space Grotesk", "Inter", sans-serif;
  font-size: clamp(1.35rem, 2.1vw, 2.2rem);
  line-height: 0.98;
  letter-spacing: -0.05em;
}

.gallery-lightbox__desc {
  margin: 0;
  color: rgba(26, 26, 26, 0.72);
}

.gallery-lightbox__close,
.gallery-lightbox__nav {
  position: absolute;
  z-index: 3;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.2);
  color: var(--text);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 0.75rem 1.75rem rgba(17, 17, 17, 0.12);
  display: grid;
  place-items: center;
}

.gallery-lightbox__close {
  top: clamp(0.25rem, 2vw, 0.75rem);
  right: clamp(0.25rem, 2vw, 0.75rem);
  font-size: 1.2rem;
}

.gallery-lightbox__nav {
  top: 50%;
  transform: translateY(-50%);
  transition: transform 180ms ease, background-color 180ms ease, border-color 180ms ease;
}

.gallery-lightbox__nav::before {
  content: "";
  width: 9px;
  height: 9px;
  border-top: 2px solid currentColor;
  border-left: 2px solid currentColor;
  transform: rotate(-45deg);
  margin-left: 2px;
}

.gallery-lightbox__nav--next::before {
  transform: rotate(135deg);
  margin-left: 0;
  margin-right: 2px;
}

.gallery-lightbox__nav:hover,
.gallery-lightbox__nav:focus-visible {
  background: rgba(255, 255, 255, 0.32);
  border-color: rgba(255, 255, 255, 0.52);
  transform: translateY(-50%) scale(1.04);
}

.gallery-lightbox__nav--prev {
  left: clamp(0.25rem, 2vw, 0.75rem);
}

.gallery-lightbox__nav--next {
  right: clamp(0.25rem, 2vw, 0.75rem);
}

.gallery-lightbox__nav:disabled {
  opacity: 0.45;
  pointer-events: none;
}

body.has-gallery-lightbox {
  overflow: hidden;
}
