.bento-top__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: calc((100cqw - 46px) / 2);
  gap: 14px;
  padding: 16px;
  background: #f0f9ff;
}
.bento-top .bento-top__tile {
  display: block;
  position: relative;
  min-width: 0;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  background: #e2eef6;
  border: 2px solid white;
  border-radius: 20px;
  box-shadow: 0 4px 12px #185c922e;
  cursor: zoom-in;
}
.bento-top .bento-top__tile img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.bento-top .bento-top__tile:focus-visible,
.bento-top .bento-top__close:focus-visible {
  outline: 3px solid #1185b8;
  outline-offset: 2px;
}
@media (width < 768px) {
  .bento-top .bento-top__hide-mobile { display: none; }
}
@media (768px <= width < 1025px) {
  .bento-top__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: calc((100cqw - 60px) / 3); }
  .bento-top .bento-top__hide-small { display: none; }
}
@media (min-width: 1025px) {
  .bento-top__grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-auto-rows: calc((100cqw - 116px) / 5);
    padding: 23px 30px;
  }
  .bento-top .bento-top__tile { border-radius: 28px; }
}
@media (1025px <= width < 1600px) {
  .bento-top .bento-top__hide-desktop { display: none; }
  .bento-top--desktop-classic { --bento-tall: span 2; --bento-column-1: 1; --bento-column-2: 2; --bento-column-3: 3; --bento-column-4: 4; --bento-column-5: 5; }
}
@media (min-width: 1600px) {
  .bento-top .bento-top__hide-large { display: none; }
  .bento-top--large-classic { --bento-tall: span 2; --bento-column-1: 1; --bento-column-2: 2; --bento-column-3: 3; --bento-column-4: 4; --bento-column-5: 5; }
  .bento-top__grid { max-width: none; margin-inline: 0; }
}
@media (min-width: 1025px) {
  .bento-top__tile:nth-child(1) { grid-column: var(--bento-column-1, auto); grid-row: var(--bento-tall, auto); }
  .bento-top__tile:nth-child(2),
  .bento-top__tile:nth-child(3) { grid-column: var(--bento-column-2, auto); }
  .bento-top__tile:nth-child(4),
  .bento-top__tile:nth-child(5) { grid-column: var(--bento-column-3, auto); }
  .bento-top__tile:nth-child(6) { grid-column: var(--bento-column-4, auto); grid-row: var(--bento-tall, auto); }
  .bento-top__tile:nth-child(7) { grid-column: var(--bento-column-5, auto); grid-row: var(--bento-tall, auto); }
  .bento-top__grid { grid-auto-flow: row dense; }
}
.bento-top__dialog {
  position: fixed;
  inset: 0;
  width: max-content;
  height: max-content;
  max-width: 94vw;
  max-height: 90dvh;
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: #101c24;
  overflow: hidden;
  cursor: zoom-out;
}
.bento-top__dialog::backdrop {
  background: rgb(9 24 38 / 72%);
  backdrop-filter: blur(9px);
}
.bento-top__dialog img {
  display: block;
  width: auto;
  height: auto;
  max-width: 94vw;
  max-height: 90dvh;
  object-fit: contain;
}
.bento-top .bento-top__close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #10222dec;
  color: white;
  font: 28px/1 sans-serif;
  cursor: pointer;
}

/* Desktop photos stay in a single two-row bento band. */
.bento-top { width: 100%; min-width: 0; container-type: inline-size; }
.bento-top__grid { width: 100%; box-sizing: border-box; }
.bento-top__extras { display: contents; }
@media (1025px <= width < 1600px) {
  .bento-top { --bento-columns: var(--bento-desktop-columns, 5); }
}
@media (min-width: 1600px) {
  .bento-top { --bento-columns: var(--bento-large-columns, 5); }
}
@media (min-width: 1025px) {
  .bento-top__grid {
    grid-template-columns: repeat(var(--bento-columns), minmax(0, 1fr));
    grid-auto-rows: calc((100cqw - 60px - (var(--bento-columns) - 1) * 14px) / var(--bento-columns));
  }
  .bento-top__extras > .bento-top__tile {
    grid-column: auto;
    grid-row: span 2;
  }
}

/* Gallery controls in the native dialog. */
.bento-top__dialog {
  width: min(1100px, 94vw);
  max-height: 94dvh;
  color: white;
  cursor: default;
}
.bento-top__stage {
  position: relative;
  display: grid;
  place-items: center;
}
.bento-top__dialog .bento-top__preview {
  width: 100%;
  height: min(70dvh, 850px);
  max-height: 70dvh;
  object-fit: contain;
  cursor: zoom-out;
}
.bento-top .bento-top__previous,
.bento-top .bento-top__next {
  position: absolute;
  z-index: 1;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid #ffffff80;
  border-radius: 50%;
  background: #10222de6;
  color: white;
  font: 34px/1 sans-serif;
  cursor: pointer;
}
.bento-top__previous { left: 10px; }
.bento-top__next { right: 10px; }
.bento-top .bento-top__close { z-index: 2; }
.bento-top__counter { margin: 6px 0; text-align: center; font: 14px/1.4 sans-serif; }
.bento-top__thumbnails {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 12px 12px;
}
.bento-top__thumbnails button {
  flex: 0 0 58px;
  width: 58px;
  height: 58px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 7px;
  overflow: hidden;
  background: #263b49;
  cursor: pointer;
}
.bento-top__thumbnails button[aria-pressed="true"] { border-color: #35c9ff; }
.bento-top__dialog .bento-top__thumbnails img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.bento-top__dialog button:focus-visible { outline: 3px solid #35c9ff; outline-offset: -3px; }
.bento-top__dialog [hidden] { display: none !important; }
@media (max-height: 500px) {
  .bento-top__dialog .bento-top__preview { height: 52dvh; max-height: 52dvh; }
}

/* Reserved tile geometry prevents layout shifts while photos decode. */
.bento-top__tile,
.bento-top__thumbnails button,
.bento-top__stage {
  background-color: #dbe8ef;
}
.bento-top__tile:has(> img.is-loading),
.bento-top__thumbnails button:has(> img.is-loading),
.bento-top__stage:has(> img.is-loading) {
  background-image: linear-gradient(100deg, transparent 25%, #ffffff70 50%, transparent 75%);
  background-size: 200% 100%;
  animation: bento-skeleton 1.4s linear infinite;
}
.bento-top img.is-loading { opacity: 0; }
.bento-top img.is-loaded { opacity: 1; transition: opacity .2s ease; }
.bento-top img.is-error { opacity: 0; }
@keyframes bento-skeleton {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .bento-top__tile,
  .bento-top__thumbnails button,
  .bento-top__stage { animation: none !important; }
  .bento-top img.is-loaded { transition: none; }
}
