.blocks-controls {
	display: flex;
	align-items: center;
	justify-content: flex-start;
	gap: 16px;
	padding: 14px 20px;
	position: sticky;
	background: var(--surface);
	border-bottom: 1px solid var(--border);
	box-shadow: 0 1px 0 var(--border);
	z-index: 19;
	transition: transform 0.2s ease;
	flex-wrap: wrap;
}

.blocks-controls.is-hidden {
	transform: translateY(-150%);
}

.blocks-search-toggle {
	display: none;
	position: relative;
	z-index: 6;
	width: 34px;
	height: 34px;
	flex-shrink: 0;
	border-radius: 50%;
	border: 1px solid var(--border-strong);
	background: var(--surface);
	color: var(--text-primary);
	align-items: center;
	justify-content: center;
	cursor: pointer;
	font-size: 20px;
	line-height: 1;
}

.blocks-search-toggle svg {
	width: 16px;
	height: 16px;
}

.blocks-search-wrap {
	position: relative;
	width: 100%;
	max-width: 360px;
}

.blocks-search-icon {
	position: absolute;
	left: 11px;
	top: 50%;
	transform: translateY(-50%);
	width: 14px;
	height: 14px;
	color: var(--text-muted);
	pointer-events: none;
}

.blocks-search {
	font-size: 13px;
	padding: 8px 30px 8px 32px;
	border-radius: 999px;
	border: 1px solid var(--border-strong);
	background: var(--bg);
	color: var(--text-primary);
	width: 100%;
}

.blocks-search-clear {
	position: absolute;
	right: 6px;
	top: 50%;
	transform: translateY(-50%);
	display: flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	padding: 0;
	border: none;
	background: none;
	color: var(--text-muted);
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
}

.blocks-search-clear:hover {
	color: var(--text-primary);
}

@media (max-width: 640px) {
	.blocks-search-toggle {
		display: flex;
		position: absolute;
		right: 0;
		top: 50%;
		transform: translateY(-50%);
	}

	/* Below 16px, iOS Safari auto-zooms the whole page in when this input
	   gets focus — that's the "zooms into the page" Nick saw. */
	.blocks-search {
		font-size: 16px;
	}

	.blocks-search-wrap {
		display: flex;
		position: absolute;
		inset: 0;
		right: 44px;
		/* The base rule's `width: 100%` otherwise wins over this `right` inset (an
		   explicit width takes precedence over left+right for an absolutely
		   positioned box), silently cancelling the reserved space next to the
		   toggle button — exactly the stacking bug this inset was meant to fix
		   in the first place. */
		width: auto;
		max-width: none;
		align-items: center;
		background: var(--bg);
		z-index: 5;
		opacity: 0;
		visibility: hidden;
		transform: scale(0.97);
		transform-origin: right center;
		pointer-events: none;
		transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
	}

	.blocks-search-wrap.is-open {
		opacity: 1;
		visibility: visible;
		transform: scale(1);
		pointer-events: auto;
	}
}

.blocks-chips {
	display: flex;
	gap: 2px;
	overflow-x: auto;
	flex: 1;
	min-width: 80px;
	-webkit-mask-image: linear-gradient(to right, black calc(100% - 28px), transparent 100%);
	mask-image: linear-gradient(to right, black calc(100% - 28px), transparent 100%);
}

.blocks-chip {
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.02em;
	padding: 7px 12px;
	border-radius: 6px;
	border: none;
	background: transparent;
	color: var(--text-secondary);
	white-space: nowrap;
	cursor: pointer;
}

.blocks-chip:hover {
	color: var(--text-primary);
}

.blocks-chip.is-active {
	background: var(--text-primary);
	color: var(--bg);
}

/* Segmented control — deliberately NOT chip-styled, so it can't be confused
   with the category filter chips (a single joined pill, not a row of them). */
.blocks-sort {
	display: inline-flex;
	flex-shrink: 0;
	padding: 3px;
	border-radius: 999px;
	background: var(--bg);
	border: 1px solid var(--border-strong);
}

.blocks-sort-btn {
	font-size: 12px;
	padding: 5px 12px;
	border-radius: 999px;
	border: none;
	background: transparent;
	color: var(--text-secondary);
	cursor: pointer;
}

.blocks-sort-btn.is-active {
	background: var(--text-primary);
	color: var(--bg);
}

@media (max-width: 640px) {
	.blocks-controls {
		flex-wrap: wrap;
		row-gap: 10px;
		column-gap: 10px;
	}

	.blocks-chips {
		flex-basis: 100%;
		order: 3;
		gap: 8px;
	}

	/* On mobile there's no hover state to hint interactivity, so chips get a
	   visible tappable background instead of the flat desktop text style,
	   and touch targets grow closer to the ~44px comfortable-tap guideline. */
	.blocks-chip {
		background: var(--surface);
		border: 1px solid var(--border-strong);
		padding: 8px 14px;
	}

	.blocks-chip.is-active {
		border-color: var(--text-primary);
	}

	.blocks-search {
		padding-top: 10px;
		padding-bottom: 10px;
	}

	.blocks-sort-btn {
		padding: 8px 14px;
	}
}

.blocks-active-filter {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 14px 20px 0;
	padding: 6px 8px 6px 14px;
	width: fit-content;
	border-radius: 999px;
	background: rgba(212, 83, 126, 0.16);
	color: #f0a8c0;
	font-size: 13px;
}

.blocks-active-filter[hidden] {
	display: none;
}

.blocks-active-filter button {
	width: 20px;
	height: 20px;
	border-radius: 50%;
	border: none;
	background: rgba(255, 255, 255, 0.15);
	color: inherit;
	cursor: pointer;
	line-height: 1;
	font-size: 14px;
}

.blocks-wall {
	padding: 16px 20px 40px;
}

.blocks-grid {
	display: flex;
	gap: 14px;
	align-items: flex-start;
}

.blocks-col {
	display: flex;
	flex-direction: column;
	gap: 14px;
	flex: 1;
	min-width: 0;
}

.blocks-card {
	position: relative;
	border-radius: 12px;
	overflow: hidden;
	background: var(--surface);
	cursor: pointer;
	border: none;
	padding: 0;
	display: block;
	width: 100%;
	text-align: left;
}

.blocks-card-media-btn {
	display: block;
	width: 100%;
	border: none;
	margin: 0;
	padding: 0;
	background: none;
	font: inherit;
	color: inherit;
	text-align: left;
	cursor: pointer;
}

.blocks-card-media {
	position: relative;
	width: 100%;
}

.blocks-card-media img,
.blocks-card-media video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.blocks-play {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.92);
	display: flex;
	align-items: center;
	justify-content: center;
	pointer-events: none;
}

.blocks-play::after {
	content: "";
	border-style: solid;
	border-width: 7px 0 7px 11px;
	border-color: transparent transparent transparent #16161a;
	margin-left: 2px;
}

.blocks-badge {
	position: absolute;
	font-size: 10px;
	padding: 3px 8px;
	border-radius: 6px;
	line-height: 1.4;
}

.blocks-badge-sponsored {
	top: 8px;
	left: 8px;
	background: rgba(0, 0, 0, 0.62);
	color: #fff;
}

.blocks-badge-duration {
	bottom: 8px;
	right: 8px;
	background: rgba(0, 0, 0, 0.62);
	color: #fff;
}

.blocks-card-caption {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 10px;
}

.blocks-card-caption .blocks-badge-likes {
	font-size: 13px;
	font-weight: 500;
	color: var(--text-secondary);
	display: flex;
	align-items: center;
	gap: 6px;
	flex-shrink: 0;
}

/* Same solid pill treatment as the modal's performer link — shown before tags,
   always in full (never part of the tag-fitting/truncation loop), since who's in
   a video takes priority over descriptive tags when space is tight. */
.blocks-card-performer {
	font-size: 11px;
	font-weight: 700;
	font-family: inherit;
	padding: 3px 9px;
	border: none;
	border-radius: 999px;
	background: #fff;
	color: #16161a;
	white-space: nowrap;
	flex-shrink: 0;
	cursor: pointer;
}

.blocks-card-performer:hover {
	background: #e2e2e2;
}

/* Only ever holds whole tags — wall.js measures and stops adding before this
   would overflow, so nothing here ever gets visually cut off mid-word. */
.blocks-card-tags {
	display: flex;
	align-items: center;
	gap: 6px;
	overflow: hidden;
	flex: 1;
	min-width: 0;
}

.blocks-card-tag {
	font-size: 11px;
	font-weight: 600;
	font-family: inherit;
	padding: 3px 9px;
	border: none;
	border-radius: 999px;
	background: #d4537e;
	color: #fff;
	white-space: nowrap;
	flex-shrink: 0;
	cursor: pointer;
}

.blocks-card-tag:hover {
	background: #c04570;
}

.blocks-like-emoji {
	font-size: 19px;
	line-height: 1;
}

.blocks-sentinel {
	height: 1px;
}

.blocks-empty {
	text-align: center;
	color: var(--text-muted);
	padding: 40px 0;
}

.blocks-modal {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.85);
	display: flex;
	align-items: center;
	justify-content: center;
	overflow-y: auto;
	padding: 40px 0;
	z-index: 100;
}

.blocks-modal[hidden] {
	display: none;
}

.blocks-modal-panel {
	width: min(720px, 90vw);
	max-height: 100%;
	margin: auto;
}

.blocks-modal-body {
	width: 100%;
	aspect-ratio: 1 / 1;
	background: #000;
	border-radius: 8px;
	overflow: hidden;
}

.blocks-modal-body iframe {
	width: 100%;
	height: 100%;
	border: 0;
}

.blocks-modal-close {
	position: fixed;
	top: 20px;
	right: 24px;
	font-size: 28px;
	line-height: 1;
	background: none;
	border: none;
	color: #fff;
	cursor: pointer;
}

/* Two fixed rows, always: categories (+ performer) + like button on top, tags
   below. Categories are always few (a handful at most) so that row never needs
   to wrap in practice; tags are the ones that can run long and wrap freely on
   their own row, without ever competing with the like button for space. */
.blocks-modal-meta {
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 12px 4px;
}

.blocks-modal-top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
}

.blocks-modal-categories {
	display: flex;
	gap: 6px;
	flex-wrap: wrap;
	min-width: 0;
}

.blocks-modal-actions {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-shrink: 0;
}

.blocks-share-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	padding: 0;
	border-radius: 999px;
	border: 1px solid #444;
	background: transparent;
	color: #fff;
	cursor: pointer;
	flex-shrink: 0;
}

.blocks-share-btn svg {
	width: 16px;
	height: 16px;
}

.blocks-share-btn.is-copied {
	background: #d4537e;
	border-color: #d4537e;
}

.blocks-modal-tags {
	display: flex;
	gap: 6px;
	flex-wrap: wrap;
}

/* Category: flat, squared-off, muted uppercase label — reads as "info", not a button.
   Sized up slightly from the tag pills below since there are always fewer of them
   sharing the row with the like button. */
.blocks-modal-categories .blocks-chip {
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	padding: 6px 11px;
	border-radius: 4px;
	border: 1px solid #444;
	background: transparent;
	color: #999;
	cursor: default;
}

/* Same shape/size as a category chip — sits right alongside them — just
   color-coded (brand pink, matching the tag chips' clickable color) and
   actually interactive, so it reads as "same family, different kind of thing"
   rather than needing its own separate row. */
.blocks-modal-categories .blocks-chip-performer {
	border-color: #d4537e;
	color: #ff9dc6;
	cursor: pointer;
}

.blocks-modal-categories .blocks-chip-performer:hover {
	background: rgba(212, 83, 126, 0.15);
}

/* Tag: bright pill, sentence case — reads as clickable/actionable. */
.blocks-tag-chip {
	font-size: 12px;
	font-weight: 600;
	padding: 5px 12px;
	border-radius: 999px;
	border: none;
	background: rgba(212, 83, 126, 0.25);
	color: #ff9dc6;
	cursor: pointer;
}

.blocks-tag-chip:hover {
	background: rgba(212, 83, 126, 0.4);
}

.blocks-like-btn {
	display: flex;
	align-items: center;
	gap: 5px;
	padding: 5px 12px;
	border-radius: 999px;
	border: 1px solid #444;
	background: transparent;
	color: #fff;
	cursor: pointer;
	flex-shrink: 0;
}

.blocks-like-btn.is-liked {
	background: #d4537e;
	border-color: #d4537e;
}

.blocks-like-icon {
	font-size: 19px;
	line-height: 1;
}

.blocks-modal-related {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 8px;
	padding: 4px;
}

.blocks-modal-related .blocks-card-media {
	aspect-ratio: 1 / 1;
}

.blocks-footer {
	text-align: center;
	font-size: 13px;
	color: var(--text-muted);
	padding: 24px 20px 40px;
}

.blocks-footer a {
	color: var(--text-muted);
}
