html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: auto;
  min-height: 100%;
  overflow-x: visible;
  overflow-y: auto;
  font-family: Helvetica, sans-serif;
  background: white;
  box-sizing: border-box;
}

*,
*::before,
*::after {
  box-sizing: inherit;
}

.grid {
  display: grid;
  gap: 8px;
  width: 100%;
  grid-template-columns: repeat(1, minmax(0, 1fr));
}

.square-wrapper {
  position: relative;
  width: 100%;
  min-width: 0;
}

.square {
  aspect-ratio: 1 / 1;
  overflow: hidden;
  cursor: pointer;
  /* Skip layout/paint for tiles outside the viewport. `auto` remembers each
     tile's real size after its first render, so there's no scroll jump. */
  content-visibility: auto;
  contain-intrinsic-size: auto 300px;
}

.square img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: blur(10px);
  transform: scale(1.3);
}

.caption {
  display: none;
}

#sticky-caption {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  font-family: Arial, Helvetica, sans-serif;
  font-size: clamp(60px, 9vw, 220px);
  color: white;
  line-height: 1;
  mix-blend-mode: difference;
  pointer-events: none;
  z-index: 9999;
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: left;
  text-align: left;
  overflow: visible;
}

@media (max-width: 600px) {
  #sticky-caption {
    font-size: clamp(32px, 8vw, 80px);
  }
}
.stack-line {
  line-height: 1.25;
  margin-bottom: -0.1em;
}

.stack-line.large {
  line-height: 0.82;
  margin-bottom: -0.12em;
}
#lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: none;
  text-align: center;
}

#lightbox.open {
  pointer-events: auto;
}

#lightbox img {
  width: min(50vw, 50vh);
  height: min(50vw, 50vh);
  object-fit: cover;
  filter: blur(12px);
  transform: scale(1.6);
  cursor: default;
  opacity: 0;
  transition: opacity 0.35s ease-in-out;
  display: block;
}

#lightbox.open img {
  opacity: 1;
}

#lightbox-inner {
  position: relative;
  width: min(50vw, 50vh);
  height: min(50vw, 50vh);
  overflow: visible;
}

#lightbox-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-family: Arial, Helvetica, sans-serif;
  font-size: clamp(20px, 5vw, 42px);
  margin: 0;
  opacity: 0;
  transition: opacity 0.35s ease;
  mix-blend-mode: difference;
  pointer-events: none;
  text-align: center;
  width: 90%;
  text-wrap: balance;
}

#lightbox.open #lightbox-text {
  opacity: 1;
}

#lightbox-heart {
  position: absolute;
  bottom: -52px;
  right: -52px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.35s ease;
  mix-blend-mode: difference;
}

#lightbox.open #lightbox-heart {
  opacity: 1;
}

#lightbox-heart svg {
  width: 100%;
  height: 100%;
}

#lightbox-heart path {
  fill: none;
  stroke: white;
  stroke-width: 4px;
  transition: fill 0.2s ease;
}

#lightbox-heart.liked path {
  fill: white;
}

#login-overlay {
  position: fixed;
  inset: 0;
  background: white;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  cursor: pointer;
  pointer-events: auto;
  transition: opacity 0.2s ease;
  overflow: hidden;
}

#login-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

#login-avatar {
  position: absolute;
  width: 400px;
  height: 400px;
  object-fit: cover;
  pointer-events: none;
  display: block;
  filter: blur(20px);
  transform: scale(1.1);
}

#login-text {
  font-family: Arial, Helvetica, sans-serif;
  /* 20vw on wide screens, floored at 150px so it stays bold on phones. The
     floor only stops the shrink, so there's still no jump across breakpoints. */
  font-size: max(150px, 20vw);
  color: black;
  letter-spacing: -0.02em;
  user-select: none;
  white-space: nowrap;
  line-height: 1;
  pointer-events: none;
  position: relative;
  z-index: 1;
  mix-blend-mode: difference;
  color: white;
}

/* ── The only change: transition added between each breakpoint step ── */

@media (max-width: 600px) {
  .grid {
    grid-template-columns: 1fr;
  }
  #lightbox img {
    width: 70vw;
    height: 70vw;
  }
  #lightbox-inner {
    width: 70vw;
    height: 70vw;
  }
  #lightbox-text {
    font-size: clamp(20px, 7vw, 32px);
  }
}

@media (min-width: 601px) and (max-width: 800px) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 801px) and (max-width: 870px) {
  .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (min-width: 871px) and (max-width: 1100px) {
  .grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 1101px) and (max-width: 1180px) {
  .grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}
@media (min-width: 1181px) and (max-width: 1260px) {
  .grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}
@media (min-width: 1261px) and (max-width: 1340px) {
  .grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }
}
@media (min-width: 1341px) and (max-width: 1400px) {
  .grid {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }
}

@media (min-width: 1401px) and (max-width: 1475px) {
  .grid {
    grid-template-columns: repeat(10, minmax(0, 1fr));
  }
}
@media (min-width: 1476px) and (max-width: 1550px) {
  .grid {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }
}
@media (min-width: 1551px) and (max-width: 1625px) {
  .grid {
    grid-template-columns: repeat(13, minmax(0, 1fr));
  }
}
@media (min-width: 1626px) and (max-width: 1700px) {
  .grid {
    grid-template-columns: repeat(16, minmax(0, 1fr));
  }
}

@media (min-width: 1701px) {
  .grid {
    grid-template-columns: repeat(32, minmax(0, 1fr));
    gap: 4px;
  }
}