/* Device-stage lightbox for single entries. */
html.ca-lb-open { overflow: hidden; }

.ca-lb { position: fixed; inset: 0; z-index: 100000; display: grid; grid-template-rows: 1fr auto auto; align-items: center; justify-items: center; padding: 72px 96px 24px; opacity: 0; visibility: hidden; transition: opacity .35s ease, visibility .35s; color: #fff; }
.ca-lb.-visible { opacity: 1; visibility: visible; }
.ca-lb-backdrop { position: absolute; inset: -60px; background: #111013 center / cover no-repeat; filter: blur(48px) saturate(1.2) brightness(.35); transform: scale(1.1); transition: background-image .5s ease; }

.ca-lb-stage { position: relative; width: 100%; height: 100%; min-height: 0; display: grid; place-items: center; }
.ca-lb-device { grid-area: 1 / 1; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 40px 120px rgba(0, 0, 0, .6), 0 0 0 1px rgba(255, 255, 255, .08); transition: opacity .45s ease, transform .55s cubic-bezier(.2, .8, .2, 1); }
.ca-lb-device.-entering { opacity: 0; transform: translateY(24px) scale(.96); }
.ca-lb-device.-leaving { opacity: 0; transform: translateY(-16px) scale(.98); }

/* Browser window: sized to the 16:9 screenshot within the free space. */
.ca-lb-device.-browser { width: min(100%, calc((100vh - 230px) * 16 / 9 )); border-radius: 14px; background: #201f24; }
.ca-lb-bar { display: flex; align-items: center; gap: 16px; height: 40px; padding: 0 16px; background: #26252b; flex: none; }
.ca-lb-dots { width: 52px; height: 12px; background: radial-gradient(circle 6px at 6px 6px, #ff5f57 98%, transparent) 0 0 / 20px 12px no-repeat, radial-gradient(circle 6px at 6px 6px, #febc2e 98%, transparent) 20px 0 / 20px 12px no-repeat, radial-gradient(circle 6px at 6px 6px, #28c840 98%, transparent) 40px 0 / 20px 12px no-repeat; flex: none; }
.ca-lb-url { flex: 1; max-width: 420px; margin: 0 auto; padding: 4px 14px; border-radius: 8px; background: #34333a; color: #c8c8cd; font-size: 13px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ca-lb-device.-browser .ca-lb-screen img { display: block; width: 100%; height: auto; }

/* Phone: sized to the free height. */
.ca-lb-device.-phone { position: relative; height: min(100%, 860px); aspect-ratio: 9 / 16; padding: 12px; border-radius: 48px; background: #0b0b0d; box-shadow: 0 40px 120px rgba(0, 0, 0, .6), inset 0 0 0 2px #46464e; }
.ca-lb-notch { position: absolute; top: 22px; left: 50%; width: 30%; height: 22px; transform: translateX(-50%); border-radius: 14px; background: #0b0b0d; z-index: 1; }
.ca-lb-device.-phone .ca-lb-screen { flex: 1; overflow: hidden; border-radius: 38px; }
.ca-lb-device.-phone .ca-lb-screen img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; }

/* Poster: the designed cover, full height, no frame. */
.ca-lb-device.-poster { height: 100%; aspect-ratio: 9 / 16; border-radius: 18px; }
.ca-lb-device.-poster .ca-lb-screen img { display: block; width: 100%; height: 100%; object-fit: contain; }

.ca-lb-info { position: relative; display: flex; gap: 14px; align-items: baseline; padding: 18px 0 14px; font-size: 15px; }
.ca-lb-caption { font-weight: 600; }
.ca-lb-counter { opacity: .6; font-variant-numeric: tabular-nums; }

.ca-lb-thumbs { position: relative; display: flex; gap: 10px; max-width: 100%; overflow-x: auto; padding: 4px; scrollbar-width: none; }
.ca-lb-thumb { flex: none; width: 96px; height: 64px; padding: 0; border: 0; border-radius: 8px; overflow: hidden; background: #000; opacity: .45; cursor: pointer; outline: 2px solid transparent; outline-offset: 2px; transition: opacity .25s, outline-color .25s; }
.ca-lb-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; }
.ca-lb-thumb:is(:hover, :focus-visible) { opacity: .8; }
.ca-lb-thumb.-active { opacity: 1; outline-color: #d90a2c; }

.ca-lb-close, .ca-lb-nav { position: absolute; display: grid; place-items: center; width: 52px; height: 52px; padding: 0; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .1); color: #fff; cursor: pointer; backdrop-filter: blur(8px); transition: background .25s, transform .25s; }
.ca-lb-close:is(:hover, :focus-visible), .ca-lb-nav:is(:hover, :focus-visible) { background: rgba(255, 255, 255, .22); }
.ca-lb-close:focus-visible, .ca-lb-nav:focus-visible { outline: 2px solid #d90a2c; outline-offset: 3px; }
.ca-lb-close { top: 20px; right: 20px; }
.ca-lb-close::before, .ca-lb-close::after { content: ""; grid-area: 1 / 1; width: 18px; height: 2px; background: currentColor; transform: rotate(45deg); }
.ca-lb-close::after { transform: rotate(-45deg); }
.ca-lb-nav { top: calc(50% - 26px - 40px); }
.ca-lb-nav.-prev { left: 24px; }
.ca-lb-nav.-next { right: 24px; }
.ca-lb-nav::before { content: ""; width: 12px; height: 12px; border: solid currentColor; border-width: 2px 2px 0 0; transform: translateX(-2px) rotate(45deg); }
.ca-lb-nav.-prev::before { transform: translateX(2px) rotate(-135deg); }

/* Phones: the device fills the screen width, swipe to move, swipe down to close; thumbnails make way for the counter. */
@media (max-width: 767px) {
	.ca-lb { padding: 64px 12px 20px; grid-template-rows: 1fr auto; }
	.ca-lb-thumbs, .ca-lb-nav { display: none; }
	.ca-lb-device.-browser { width: 100%; border-radius: 10px; }
	.ca-lb-bar { height: 30px; gap: 10px; padding: 0 10px; }
	.ca-lb-dots { transform: scale(.75); transform-origin: left center; }
	.ca-lb-url { font-size: 11px; padding: 2px 10px; }
	.ca-lb-device.-phone { height: auto; width: min(100%, calc((100vh - 150px) * 9 / 16)); }
	.ca-lb-close { top: 12px; right: 12px; width: 44px; height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
	.ca-lb, .ca-lb-device, .ca-lb-backdrop { transition: none; }
}
