/* YouWall: frontend styles. */

.youwall,
.youwall-lightbox {
	--youwall-columns: 4;
	--youwall-per-view: 4;
	--youwall-gap: 12px;
	--youwall-radius: 12px;
	--youwall-border-width: 0px;
	--youwall-border-color: #fff;
	--youwall-tile-bg: #1a1a1a;
	--youwall-btn-bg: #ff0000;
	--youwall-btn-color: #fff;
	--youwall-overlay: rgba(0, 0, 0, 0.85);
}

.youwall {
	box-sizing: border-box;
	width: 100%;
	margin: 0 0 1.5em;
}

.youwall *,
.youwall *::before,
.youwall *::after {
	box-sizing: border-box;
}

/*
 * Many themes and page builders style every <button> on the site (colors,
 * pill shapes, padding). The video tiles and controls are buttons, so these
 * selectors repeat the class name to outrank such site-wide rules.
 */
.youwall .youwall__tile.youwall__tile,
.youwall .youwall__more-btn.youwall__more-btn,
.youwall .youwall__tab.youwall__tab,
.youwall .youwall__arrow.youwall__arrow,
.youwall .youwall__autoplay.youwall__autoplay,
.youwall .youwall__dot.youwall__dot,
.youwall-lightbox .youwall-lightbox__close.youwall-lightbox__close {
	box-sizing: border-box;
	width: auto;
	height: auto;
	min-width: 0;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: none;
	box-shadow: none;
	color: inherit;
	font: inherit;
	letter-spacing: normal;
	line-height: inherit;
	text-align: inherit;
	text-decoration: none;
	text-shadow: none;
	text-transform: none;
	transition: none;
	-webkit-appearance: none;
	appearance: none;
	cursor: pointer;
}

/* ── Grid ─────────────────────────────────────────────────────────── */

.youwall__grid,
.youwall__track {
	list-style: none;
	margin: 0;
	padding: 0;
}

.youwall__grid {
	display: grid;
	grid-template-columns: repeat(var(--youwall-columns), minmax(0, 1fr));
	gap: var(--youwall-gap);
}

.youwall__item {
	margin: 0;
	padding: 0;
	min-width: 0;
}

@media (max-width: 960px) {
	.youwall__grid { grid-template-columns: repeat(min(var(--youwall-columns), 3), minmax(0, 1fr)); }
	.youwall__grid--landscape { grid-template-columns: repeat(min(var(--youwall-columns), 2), minmax(0, 1fr)); }
}

@media (max-width: 600px) {
	.youwall__grid { grid-template-columns: repeat(min(var(--youwall-columns), 2), minmax(0, 1fr)); }
	.youwall__grid--landscape { grid-template-columns: minmax(0, 1fr); }
}

/* ── Tile ─────────────────────────────────────────────────────────── */

.youwall .youwall__tile.youwall__tile {
	position: relative;
	display: block;
	width: 100%;
	cursor: pointer;
	color: inherit;
	font: inherit;
	text-align: left;
	border-radius: var(--youwall-radius);
}

.youwall .youwall__tile.youwall__tile:focus-visible {
	outline: 3px solid currentColor;
	outline-offset: 3px;
}

.youwall__thumb {
	position: relative;
	display: block;
	overflow: hidden;
	border-radius: var(--youwall-radius);
	border: var(--youwall-border-width) solid var(--youwall-border-color);
	background: var(--youwall-tile-bg);
	aspect-ratio: 9 / 16;
}

.youwall__tile--landscape .youwall__thumb {
	aspect-ratio: 16 / 9;
}

.youwall__thumb img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	object-fit: cover;
	transition: transform 0.3s ease;
}

.youwall .youwall__tile.youwall__tile:hover .youwall__thumb img,
.youwall .youwall__tile.youwall__tile:focus-visible .youwall__thumb img {
	transform: scale(1.04);
}

.youwall__play {
	position: absolute;
	top: 50%;
	left: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 52px;
	height: 52px;
	margin: -26px 0 0 -26px;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.55);
	color: #fff;
	opacity: 0;
	transition: opacity 0.2s ease;
	pointer-events: none;
}

.youwall .youwall__tile.youwall__tile:hover .youwall__play,
.youwall .youwall__tile.youwall__tile:focus-visible .youwall__play {
	opacity: 1;
}

.youwall__play svg {
	width: 26px;
	height: 26px;
}

.youwall__num {
	position: absolute;
	top: 8px;
	left: 8px;
	z-index: 1;
	min-width: 26px;
	padding: 2px 7px;
	border-radius: 99px;
	background: rgba(0, 0, 0, 0.6);
	color: #fff;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.6;
	text-align: center;
}

.youwall__duration {
	position: absolute;
	right: 8px;
	bottom: 8px;
	padding: 1px 6px;
	border-radius: 4px;
	background: rgba(0, 0, 0, 0.8);
	color: #fff;
	font-size: 12px;
	line-height: 1.5;
}

/*
 * Shorts: title over the bottom of the cover. Videos: title below it.
 * Fixed sizes, so a theme's large body font cannot blow the tiles up.
 */
.youwall__info {
	display: block;
	padding: 8px 2px 0;
	font-size: 14px;
	line-height: 1.35;
	letter-spacing: normal;
}

.youwall__tile--landscape .youwall__info {
	min-height: 3.2em;
	font-size: 15px;
}

.youwall__tile--portrait .youwall__info {
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	padding: 56px 14px 14px;
	border-radius: 0 0 var(--youwall-radius) var(--youwall-radius);
	background: linear-gradient(to top, rgba(0, 0, 0, 0.82) 0%, rgba(0, 0, 0, 0.55) 45%, rgba(0, 0, 0, 0) 100%);
	color: #fff;
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}

/* Shorts: one bold line, cut off with "…", like YouTube's own Shorts shelf. */
.youwall__tile--portrait .youwall__title {
	display: block;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.3;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.youwall__tile--portrait .youwall__meta {
	margin-top: 4px;
	font-size: 13px;
	opacity: 0.85;
}

.youwall__title {
	display: -webkit-box;
	overflow: hidden;
	font-size: 1em;
	font-weight: 600;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

.youwall__meta {
	display: block;
	overflow: hidden;
	margin-top: 3px;
	font-size: 12px;
	opacity: 0.8;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* ── Load more ────────────────────────────────────────────────────── */

.youwall__more {
	margin-top: 24px;
	text-align: center;
}

.youwall__more[hidden] {
	display: none;
}

.youwall .youwall__more-btn.youwall__more-btn {
	display: inline-block;
	padding: 11px 30px;
	border: 0;
	border-radius: 8px;
	background: var(--youwall-btn-bg);
	color: var(--youwall-btn-color);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

.youwall .youwall__more-btn.youwall__more-btn:hover {
	filter: brightness(0.92);
}

.youwall .youwall__more-btn.youwall__more-btn:focus-visible {
	outline: 3px solid var(--youwall-btn-bg);
	outline-offset: 3px;
}

.youwall .youwall__more-btn.youwall__more-btn:disabled {
	opacity: 0.6;
	cursor: wait;
}

.youwall__status {
	margin: 8px 0 0;
	min-height: 1em;
	font-size: 0.85em;
	text-align: center;
	opacity: 0.8;
}

.youwall__status:empty {
	margin: 0;
	min-height: 0;
}

.youwall__panel[aria-busy="true"] .youwall__grid {
	opacity: 0.6;
}

/* ── Tabs ─────────────────────────────────────────────────────────── */

.youwall__tabs {
	display: flex;
	gap: 6px;
	margin-bottom: 16px;
	border-bottom: 1px solid rgba(127, 127, 127, 0.3);
}

.youwall .youwall__tab.youwall__tab {
	margin: 0 0 -1px;
	padding: 10px 18px;
	border: 0;
	border-bottom: 3px solid transparent;
	background: none;
	color: inherit;
	font: inherit;
	font-weight: 600;
	opacity: 0.7;
	cursor: pointer;
}

.youwall .youwall__tab.youwall__tab[aria-selected="true"] {
	border-bottom-color: var(--youwall-btn-bg);
	opacity: 1;
}

.youwall .youwall__tab.youwall__tab:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: -2px;
}

.youwall__panel[hidden] {
	display: none;
}

/* ── Slider ───────────────────────────────────────────────────────── */

.youwall__slider {
	--youwall-shown: var(--youwall-per-view);
}

.youwall__slider-row {
	position: relative;
	display: flex;
	align-items: center;
	gap: 8px;
}

.youwall__viewport {
	flex: 1;
	min-width: 0;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
}

.youwall__viewport::-webkit-scrollbar {
	display: none;
}

.youwall__track {
	display: flex;
	gap: var(--youwall-gap);
}

.youwall__track > .youwall__item {
	flex: 0 0 calc((100% - (var(--youwall-shown) - 1) * var(--youwall-gap)) / var(--youwall-shown));
	scroll-snap-align: start;
}

@media (max-width: 960px) {
	.youwall__slider { --youwall-shown: min(var(--youwall-per-view), 3); }
}

@media (max-width: 600px) {
	.youwall__slider { --youwall-shown: min(var(--youwall-per-view), 2); }
	.youwall__track.youwall__grid--landscape { --youwall-shown: 1; }
}

.youwall .youwall__arrow.youwall__arrow,
.youwall .youwall__autoplay.youwall__autoplay {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 1px solid rgba(127, 127, 127, 0.35);
	border-radius: 50%;
	background: #fff;
	color: #1e1e1e;
	cursor: pointer;
}

.youwall .youwall__arrow.youwall__arrow:disabled {
	opacity: 0.35;
	cursor: default;
}

.youwall .youwall__arrow.youwall__arrow:focus-visible,
.youwall .youwall__autoplay.youwall__autoplay:focus-visible,
.youwall .youwall__dot.youwall__dot:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.youwall .youwall__arrow.youwall__arrow svg,
.youwall .youwall__autoplay.youwall__autoplay svg {
	width: 20px;
	height: 20px;
}

.youwall .youwall__autoplay.youwall__autoplay {
	width: 32px;
	height: 32px;
}

.youwall__slider-controls {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	margin-top: 14px;
}

.youwall__dots {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 4px;
}

.youwall .youwall__dot.youwall__dot {
	width: 24px;
	height: 24px;
	padding: 0;
	border: 0;
	background: none;
	cursor: pointer;
}

.youwall .youwall__dot.youwall__dot::before {
	content: "";
	display: block;
	width: 8px;
	height: 8px;
	margin: auto;
	border-radius: 50%;
	background: rgba(127, 127, 127, 0.5);
	transition: transform 0.2s;
}

.youwall .youwall__dot.youwall__dot[aria-current="true"]::before {
	background: var(--youwall-btn-bg);
	transform: scale(1.35);
}

/* ── Lightbox ─────────────────────────────────────────────────────── */

.youwall-locked,
.youwall-locked body {
	overflow: hidden;
}

.youwall-lightbox {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
}

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

.youwall-lightbox__backdrop {
	position: absolute;
	inset: 0;
	background: var(--youwall-overlay);
}

.youwall-lightbox__content {
	position: relative;
	width: min(400px, 100%, calc((100vh - 96px) * 9 / 16));
}

.youwall-lightbox.is-landscape .youwall-lightbox__content {
	width: min(1100px, 100%, calc((100vh - 96px) * 16 / 9));
}

.youwall-lightbox__frame {
	overflow: hidden;
	border-radius: 12px;
	background: #000;
	aspect-ratio: 9 / 16;
}

.youwall-lightbox.is-landscape .youwall-lightbox__frame {
	aspect-ratio: 16 / 9;
}

.youwall-lightbox__frame iframe {
	display: block;
	width: 100%;
	height: 100%;
	border: 0;
}

.youwall-lightbox .youwall-lightbox__close.youwall-lightbox__close {
	position: absolute;
	top: -48px;
	right: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.15);
	color: #fff;
	cursor: pointer;
}

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

/* ── Notice (only shown to editors) ───────────────────────────────── */

.youwall-notice {
	margin: 0 0 1.5em;
	padding: 12px 16px;
	border-left: 4px solid #d63638;
	background: #fcf0f1;
	color: #1e1e1e;
	font-size: 14px;
	line-height: 1.5;
}

.youwall-notice em {
	display: block;
	margin-top: 4px;
	color: #50575e;
	font-size: 12px;
}

@media (prefers-reduced-motion: reduce) {
	.youwall *,
	.youwall-lightbox * {
		transition: none !important;
	}

	.youwall__viewport {
		scroll-behavior: auto;
	}
}

/* Phones swipe the slider, so the arrows go (kept last so it wins over the arrow rule above). */
@media (max-width: 600px) {
	.youwall .youwall__arrow.youwall__arrow {
		display: none;
	}
}
