/* fxhash NFT Display — front-end styles */

.fxnd-gallery {
	display: grid;
	grid-template-columns: repeat(var(--fxnd-cols, 3), minmax(0, 1fr));
	gap: clamp(0.75rem, 2vw, 1.5rem);
	margin: 1.5rem 0;
}

.fxnd-cols-1 { --fxnd-cols: 1; }
.fxnd-cols-2 { --fxnd-cols: 2; }
.fxnd-cols-3 { --fxnd-cols: 3; }
.fxnd-cols-4 { --fxnd-cols: 4; }
.fxnd-cols-5 { --fxnd-cols: 5; }
.fxnd-cols-6 { --fxnd-cols: 6; }

@media (max-width: 900px) {
	.fxnd-gallery { --fxnd-cols: 2; }
}

@media (max-width: 560px) {
	.fxnd-gallery { --fxnd-cols: 1; }
}

.fxnd-card {
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
}

.fxnd-frame {
	position: relative;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	border-radius: 4px;
	background: #f2f2f2;
	display: flex;
	align-items: center;
	justify-content: center;
}

.fxnd-frame-single {
	aspect-ratio: 1 / 1;
	width: 100%;
}

.fxnd-preview,
.fxnd-iframe {
	width: 100%;
	height: 100%;
	display: block;
	border: 0;
}

.fxnd-preview {
	object-fit: contain;
	transition: opacity 0.25s ease;
}

.fxnd-preview.is-loading { opacity: 0.35; }

.fxnd-placeholder {
	font-size: 0.85rem;
	color: #767676;
	padding: 1rem;
	text-align: center;
}

/* Live-render control, revealed on hover and always visible to keyboard users. */
.fxnd-live-btn {
	position: absolute;
	inset-inline-end: 0.6rem;
	inset-block-end: 0.6rem;
	padding: 0.35rem 0.8rem;
	font-size: 0.78rem;
	line-height: 1.4;
	border: 0;
	border-radius: 999px;
	background: rgba(17, 17, 17, 0.82);
	color: #fff;
	cursor: pointer;
	opacity: 0;
	transition: opacity 0.2s ease, background 0.2s ease;
}

.fxnd-frame:hover .fxnd-live-btn,
.fxnd-live-btn:focus-visible,
.fxnd-frame.is-live .fxnd-live-btn {
	opacity: 1;
}

.fxnd-live-btn:hover { background: #000; }

.fxnd-live-btn:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

.fxnd-caption {
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
	font-size: 0.85rem;
	line-height: 1.4;
}

.fxnd-title { font-weight: 600; }

.fxnd-meta {
	color: #767676;
	font-size: 0.78rem;
}

/* Single token layout */

.fxnd-single {
	display: grid;
	gap: 1.25rem;
	margin: 1.5rem 0;
}

@media (min-width: 780px) {
	.fxnd-single {
		grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
		align-items: start;
	}
}

.fxnd-details h3 { margin: 0 0 0.5rem; }

.fxnd-description {
	font-size: 0.9rem;
	line-height: 1.6;
	white-space: pre-line;
}

.fxnd-facts {
	margin: 1rem 0;
	display: grid;
	gap: 0.4rem;
	font-size: 0.85rem;
}

.fxnd-fact {
	display: grid;
	grid-template-columns: 6.5rem minmax(0, 1fr);
	gap: 0.5rem;
}

.fxnd-fact dt {
	color: #767676;
	margin: 0;
}

.fxnd-fact dd {
	margin: 0;
	overflow-wrap: anywhere;
}

.fxnd-features {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
}

.fxnd-features li {
	display: flex;
	gap: 0.35rem;
	padding: 0.25rem 0.6rem;
	border: 1px solid rgba(0, 0, 0, 0.12);
	border-radius: 999px;
	font-size: 0.75rem;
}

.fxnd-feature-name { color: #767676; }
.fxnd-feature-value { font-weight: 600; }

.fxnd-notice {
	padding: 0.75rem 1rem;
	border-inline-start: 3px solid #c9c9c9;
	background: #f6f6f6;
	font-size: 0.875rem;
}

@media (prefers-color-scheme: dark) {
	.fxnd-frame { background: #1b1b1b; }
	.fxnd-features li { border-color: rgba(255, 255, 255, 0.18); }
	.fxnd-notice { background: #1b1b1b; border-color: #444; }
}

@media (prefers-reduced-motion: reduce) {
	.fxnd-preview,
	.fxnd-live-btn { transition: none; }
}

/* Project pages */

.fxnd-project { margin: 1.5rem 0; }

.fxnd-project-header {
	margin-bottom: 1.5rem;
	max-width: 62ch;
}

.fxnd-project-name {
	margin: 0 0 0.35rem;
	line-height: 1.2;
}

.fxnd-project-facts {
	margin: 0 0 0.9rem;
	font-size: 0.82rem;
	color: #767676;
}

.fxnd-project-description p {
	margin: 0 0 0.75rem;
	font-size: 0.95rem;
	line-height: 1.65;
}

.fxnd-tags {
	list-style: none;
	margin: 0.9rem 0 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem;
}

.fxnd-tags li {
	padding: 0.15rem 0.55rem;
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.06);
	font-size: 0.72rem;
	color: #555;
}

/* Project index cards */

.fxnd-project-card .fxnd-frame { aspect-ratio: 4 / 3; }

.fxnd-project-link {
	display: block;
	width: 100%;
	height: 100%;
}

.fxnd-project-card .fxnd-title a {
	text-decoration: none;
	color: inherit;
}

.fxnd-project-card .fxnd-title a:hover { text-decoration: underline; }

@media (prefers-color-scheme: dark) {
	.fxnd-tags li {
		background: rgba(255, 255, 255, 0.12);
		color: #bbb;
	}
}

/* An image no gateway could deliver: keep the slot, drop the broken icon. */
.fxnd-preview.fxnd-failed {
	visibility: hidden;
}

.fxnd-frame:has(.fxnd-preview.fxnd-failed)::after {
	content: attr(data-fxnd-empty);
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 0.8rem;
	color: #767676;
	padding: 1rem;
	text-align: center;
}

/* Project cover, shown above the description */

.fxnd-cover {
	aspect-ratio: 1 / 1;
	margin-bottom: 1.5rem;
	border-radius: 6px;
}

@media (max-width: 600px) {
	.fxnd-cover { aspect-ratio: 1 / 1; }
}

/* A card that opens the lightbox */

.fxnd-frame.is-zoomable { cursor: zoom-in; }

.fxnd-frame.is-zoomable:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

/* Lightbox */

html.fxnd-lightbox-open { overflow: hidden; }

.fxnd-lightbox {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: clamp(0.75rem, 3vw, 2.5rem);
}

.fxnd-lightbox[hidden] { display: none; }

.fxnd-lightbox-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.88);
}

.fxnd-lightbox-panel {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	width: min(100%, 1100px);
	max-height: 100%;
}

/* Square, and capped by both viewport dimensions. fxhash generators size
   their canvas to the frame width, so a non-square frame makes the artwork
   overflow and show only a corner. */
.fxnd-lightbox-stage {
	flex: 0 0 auto;
	width: min(100%, calc(100vh - 9rem));
	aspect-ratio: 1 / 1;
	height: auto;
	margin: 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #111;
	border-radius: 4px;
	overflow: hidden;
	transition: opacity 0.45s ease;
}

/* Held between two artworks while the next one is put in place. */
.fxnd-lightbox-stage.is-fading { opacity: 0; }

.fxnd-lightbox-stage iframe {
	width: 100%;
	height: 100%;
	border: 0;
	display: block;
}

/* Never upscale a still beyond its own pixels: an 800px preview blown up
   to 1100px just looks soft. */
.fxnd-lightbox-stage img {
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	display: block;
}

.fxnd-lightbox-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	flex-wrap: wrap;
	color: #fff;
}

.fxnd-lightbox-meta {
	display: flex;
	flex-direction: column;
	gap: 0.1rem;
	font-size: 0.9rem;
	min-width: 0;
}

.fxnd-lightbox-owner {
	font-size: 0.78rem;
	color: rgba(255, 255, 255, 0.65);
}

.fxnd-lightbox-actions {
	display: flex;
	gap: 0.5rem;
	flex-shrink: 0;
}

.fxnd-lightbox-actions button {
	padding: 0.4rem 0.95rem;
	font-size: 0.82rem;
	border: 1px solid rgba(255, 255, 255, 0.35);
	border-radius: 999px;
	background: transparent;
	color: #fff;
	cursor: pointer;
}

.fxnd-lightbox-actions button:hover {
	background: rgba(255, 255, 255, 0.14);
}

.fxnd-lightbox-actions button:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

.fxnd-lightbox-actions button[hidden] { display: none; }

/* Edition figures under the project title */

.fxnd-edition {
	list-style: none;
	margin: 0 0 1.1rem;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	align-items: stretch;
	gap: 0.4rem 1.4rem;
}

.fxnd-edition-item {
	display: flex;
	flex-direction: column;
	line-height: 1.25;
}

.fxnd-edition-value {
	font-size: 1.05rem;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
}

.fxnd-edition-label {
	font-size: 0.7rem;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: #767676;
}

.fxnd-edition-item[title] { cursor: help; }

.fxnd-edition-status {
	align-self: center;
	padding: 0.2rem 0.6rem;
	border: 1px solid rgba(0, 0, 0, 0.18);
	border-radius: 999px;
	font-size: 0.72rem;
	letter-spacing: 0.03em;
	text-transform: uppercase;
	color: #555;
}

.fxnd-edition-status.is-sold-out {
	border-color: transparent;
	background: #111;
	color: #fff;
}

/* Collector names link to the block explorer */

.fxnd-owner-link {
	color: inherit;
	text-decoration: underline;
	text-decoration-color: rgba(128, 128, 128, 0.55);
	text-underline-offset: 0.15em;
}

.fxnd-owner-link:hover,
.fxnd-owner-link:focus-visible { text-decoration-color: currentColor; }

/* Moving through an edition without leaving the enlarged view */

.fxnd-lightbox-view {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 0;
}

.fxnd-lightbox-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 2.75rem;
	height: 2.75rem;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0 0 0.2rem;
	font-size: 1.9rem;
	line-height: 1;
	border: 1px solid rgba(255, 255, 255, 0.25);
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.45);
	color: #fff;
	cursor: pointer;
	opacity: 0.55;
	transition: opacity 0.2s ease, background 0.2s ease;
}

.fxnd-lightbox-nav:hover,
.fxnd-lightbox-nav:focus-visible {
	opacity: 1;
	background: rgba(0, 0, 0, 0.75);
}

.fxnd-lightbox-nav:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

.fxnd-lightbox-nav[hidden] { display: none; }

.fxnd-lightbox-prev { inset-inline-start: 0.35rem; }
.fxnd-lightbox-next { inset-inline-end: 0.35rem; }

.fxnd-lightbox-count {
	align-self: center;
	font-size: 0.78rem;
	font-variant-numeric: tabular-nums;
	color: rgba(255, 255, 255, 0.65);
}

.fxnd-lightbox-owner a { color: inherit; }

/* Presentation mode: the artwork takes the whole screen, and the controls
   step back while a slideshow is running. */

.fxnd-lightbox:fullscreen { background: #000; }

.fxnd-lightbox.is-fullscreen .fxnd-lightbox-panel {
	width: 100%;
	height: 100%;
	justify-content: center;
}

.fxnd-lightbox.is-fullscreen .fxnd-lightbox-stage {
	width: min(100%, calc(100vh - 6rem));
}

.fxnd-lightbox.is-fullscreen.is-playing .fxnd-lightbox-bar,
.fxnd-lightbox.is-fullscreen.is-playing .fxnd-lightbox-nav {
	opacity: 0.12;
	transition: opacity 0.6s ease;
}

.fxnd-lightbox.is-fullscreen.is-playing .fxnd-lightbox-bar:hover,
.fxnd-lightbox.is-fullscreen.is-playing .fxnd-lightbox-bar:focus-within,
.fxnd-lightbox.is-fullscreen.is-playing .fxnd-lightbox-nav:hover,
.fxnd-lightbox.is-fullscreen.is-playing .fxnd-lightbox-nav:focus-visible {
	opacity: 1;
}

@media (max-width: 560px) {
	.fxnd-lightbox-nav {
		width: 2.25rem;
		height: 2.25rem;
		font-size: 1.5rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.fxnd-lightbox-stage,
	.fxnd-lightbox-nav,
	.fxnd-lightbox-bar { transition: none; }
}

@media (prefers-color-scheme: dark) {
	.fxnd-edition-label { color: #999; }

	.fxnd-edition-status {
		border-color: rgba(255, 255, 255, 0.24);
		color: #bbb;
	}

	.fxnd-edition-status.is-sold-out {
		background: #f2f2f2;
		color: #111;
	}
}
