/* Flickr Album Embed */
.fae { margin: 1.5em 0; }
.fae__title { margin: 0 0 .75em; }
.fae__grid { gap: var(--fae-gap); }
.fae__item { position: relative; margin: 0; padding: 0; overflow: hidden; border-radius: var(--fae-radius); background: rgba(127,127,127,.12); }
.fae__link { display: block; height: 100%; cursor: zoom-in; }
.fae:not([data-fae-lightbox]) .fae__link { cursor: pointer; }
.fae__item img { display: block; width: 100%; height: 100%; max-width: none; margin: 0; object-fit: cover; transition: transform .4s ease, opacity .3s; }
.fae__link:hover img, .fae__link:focus-visible img { transform: scale(1.03); }
.fae__link:focus-visible { outline: 3px solid currentColor; outline-offset: -3px; }

/* Justified rows: every photo keeps its shape, rows fill the width. */
.fae--justified .fae__grid { display: flex; flex-wrap: wrap; }
.fae--justified .fae__grid::after { content: ""; flex-grow: 999999; }
.fae--justified .fae__item { flex-basis: calc(var(--fae-row) * var(--r)); aspect-ratio: var(--r); }

/* Square grid */
.fae--grid .fae__grid { display: grid; grid-template-columns: repeat(var(--fae-cols), minmax(0, 1fr)); }
.fae--grid .fae__item { aspect-ratio: 1; }

/* Masonry columns */
.fae--masonry .fae__grid { display: block; column-count: var(--fae-cols); column-gap: var(--fae-gap); }
.fae--masonry .fae__item { break-inside: avoid; margin-bottom: var(--fae-gap); aspect-ratio: var(--r); }

@media (max-width: 900px) {
	.fae--grid .fae__grid { grid-template-columns: repeat(var(--fae-cols-md), minmax(0, 1fr)); }
	.fae--masonry .fae__grid { column-count: var(--fae-cols-md); }
}
@media (max-width: 600px) {
	.fae--justified .fae__item { flex-basis: calc(var(--fae-row-sm) * var(--r)); }
	.fae--grid .fae__grid { grid-template-columns: repeat(var(--fae-cols-sm), minmax(0, 1fr)); }
	.fae--masonry .fae__grid { column-count: var(--fae-cols-sm); }
}

/* Captions */
.fae--cap-none .fae__cap { display: none; }
.fae--cap-hover .fae__cap {
	position: absolute; left: 0; right: 0; bottom: 0; padding: 2em .75em .6em;
	color: #fff; font-size: .85em; line-height: 1.3; pointer-events: none;
	background: linear-gradient(transparent, rgba(0,0,0,.7));
	opacity: 0; transform: translateY(6px); transition: opacity .25s, transform .25s;
}
.fae--cap-hover .fae__item:hover .fae__cap,
.fae--cap-hover .fae__item:focus-within .fae__cap { opacity: 1; transform: none; }
@media (hover: none) { .fae--cap-hover .fae__cap { display: none; } }
.fae--cap-below .fae__item { overflow: visible; background: none; aspect-ratio: auto; }
.fae--cap-below .fae__link { height: auto; overflow: hidden; border-radius: var(--fae-radius); aspect-ratio: var(--r); }
.fae--grid.fae--cap-below .fae__link { aspect-ratio: 1; }
.fae--cap-below .fae__cap { padding: .4em .1em 0; font-size: .85em; line-height: 1.3; opacity: .8; }

.fae .fae__item[hidden] { display: none !important; }
.fae[data-fae-random]:not(.is-ready) .fae__grid { visibility: hidden; }

/* Pagination */
.fae__pager { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; margin: 1.25em 0 0; }
.fae__pager:empty { display: none; }
.fae__pager button {
	min-width: 2.5em; padding: .55em .9em; margin: 0;
	font: inherit; font-size: .9em; line-height: 1.2; color: inherit;
	background: transparent; border: 1px solid currentColor; border-radius: 999px;
	opacity: .75; cursor: pointer; transition: opacity .2s, background .2s;
}
.fae__pager button:hover, .fae__pager button:focus-visible { opacity: 1; background: rgba(127,127,127,.15); }
.fae__pager button[aria-current="page"] { opacity: 1; font-weight: 700; background: rgba(127,127,127,.2); }
.fae__pager button:disabled { opacity: .3; cursor: default; background: transparent; }
.fae__pager .fae__more { padding: .7em 1.6em; }
.fae__pager .fae__dots { padding: 0 .25em; opacity: .6; }

.fae__credit { margin: .75em 0 0; font-size: .85em; text-align: right; }

/* Lightbox */
html.fae-lock { overflow: hidden; }
.fae-lb { position: fixed; inset: 0; z-index: 999999; display: flex; flex-direction: column; background: rgba(10,10,10,.96); color: #eee; font-family: system-ui, -apple-system, sans-serif; outline: none; }
.fae-lb[hidden] { display: none; }
.fae-lb__stage { position: relative; flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; padding: 56px 64px 12px; }
.fae-lb__img { max-width: 100%; max-height: 100%; object-fit: contain; box-shadow: 0 10px 40px rgba(0,0,0,.5); transition: opacity .2s; user-select: none; -webkit-user-drag: none; }
.fae-lb.is-loading .fae-lb__img { opacity: .25; }
.fae-lb.is-loading .fae-lb__stage::after { content: ""; position: absolute; width: 36px; height: 36px; border: 3px solid rgba(255,255,255,.25); border-top-color: #fff; border-radius: 50%; animation: fae-spin .8s linear infinite; }
@keyframes fae-spin { to { transform: rotate(360deg); } }
.fae-lb__bar { display: flex; gap: 16px; align-items: baseline; justify-content: space-between; padding: 10px 20px 18px; font-size: 14px; }
.fae-lb__text { min-width: 0; }
.fae-lb__cap { font-weight: 600; }
.fae-lb__desc { opacity: .7; margin-top: 2px; max-height: 3.9em; overflow: auto; }
.fae-lb__meta { display: flex; gap: 16px; white-space: nowrap; opacity: .8; }
.fae-lb__meta a { color: inherit; }
.fae-lb button { position: absolute; display: grid; place-items: center; width: 48px; height: 48px; padding: 0; border: 0; border-radius: 50%; background: rgba(255,255,255,.08); color: #fff; cursor: pointer; transition: background .2s; }
.fae-lb button:hover, .fae-lb button:focus-visible { background: rgba(255,255,255,.22); outline: none; }
.fae-lb button svg { width: 24px; height: 24px; }
.fae-lb__close { top: 10px; right: 12px; }
.fae-lb__prev { left: 10px; top: 50%; transform: translateY(-50%); }
.fae-lb__next { right: 10px; top: 50%; transform: translateY(-50%); }
.fae-lb.is-single .fae-lb__prev, .fae-lb.is-single .fae-lb__next { display: none; }
@media (max-width: 600px) {
	.fae-lb__stage { padding: 56px 0 8px; }
	.fae-lb__prev, .fae-lb__next { display: none !important; } /* swipe instead */
	.fae-lb__bar { flex-direction: column; gap: 6px; }
}
