/*
 * The ring of demo cards on the gallery page of the dx theme (Ring, ring.js).
 * Colours, fonts and radii are the theme's own tokens.
 */

/* The grid and its search bar give way to the ring once the script is on. */
.dxz-ring .dxz-has-ring .dx-demos__grid,
.dxz-ring .dxz-has-ring .dx-demos__bar,
.dxz-ring .dxz-has-ring .dx-demos__empty { display: none; }

/*
 * Opening: the page is black, the cards gather into a small ring in the middle
 * of the screen, then the ring opens into its place while the black lifts off
 * the rest of the page. html.dxz-ring-intro is set in <head> (Gallery::ring_head)
 * and taken off by ring.js; .dxz-ring-reveal starts the lift.
 */
html.dxz-ring-intro body::after {
	content: "";
	position: fixed;
	inset: 0;
	z-index: 9998;
	background: #050506;
}
html.dxz-ring-reveal body::after {
	opacity: 0;
	pointer-events: none;
	transition: opacity 2.2s cubic-bezier(.4, 0, .2, 1);
}
/* The section must not hold the ring under the black. */
.dxz-ring-intro .dxz-has-ring .dx-demos { z-index: auto; }
.dxz-ring-intro .dxr { z-index: 9999; overflow-y: visible; }
.dxz-ring-intro .dxr::before,
.dxz-ring-intro .dxr::after { opacity: 0; }
.dxz-ring-reveal .dxr::before,
.dxz-ring-reveal .dxr::after { opacity: 1; }

/*
 * With the ring, the page is one screen: a small heading under the header and
 * the ring's centre in the middle of the screen (ring.js sets its top and the
 * section's height).
 */
.dxz-ring .dxz-has-ring .dx-demos { padding-block-start: calc(var(--dx-header-h) + clamp(18px, 3vh, 36px)); }
.dxz-ring .dxz-has-ring .dx-demos__in { position: relative; align-content: start; padding-block: 0; }
.dxz-ring .dxz-has-ring .dx-demos__head { gap: 10px; }
.dxz-ring .dxz-has-ring .dx-demos__title { font-size: clamp(1.4rem, .9rem + 1.5vw, 2.4rem); }
.dxz-ring .dxz-has-ring .dx-demos__title:lang(ar) { font-size: clamp(1.3rem, .9rem + 1.2vw, 2.1rem); }
.dxz-ring .dxz-has-ring .dx-demos__text { font-size: var(--dx-fs-sm); }

.dxr {
	position: absolute;
	inset-inline: var(--dx-gutter);
	height: clamp(360px, 54vh, 560px);
	overflow: hidden;
	overflow: clip;
	direction: ltr;
	cursor: grab;
	touch-action: pan-y;
	-webkit-user-select: none;
	user-select: none;
}
.dxr[hidden] { display: none; }
.dxr.is-grabbing { cursor: grabbing; }
/* The cards fade into the page at both ends. */
.dxr::before,
.dxr::after {
	content: "";
	position: absolute;
	top: 0;
	bottom: 0;
	z-index: 2;
	width: 7%;
	pointer-events: none;
	transition: opacity 1.2s;
}
.dxr::before { left: 0; background: linear-gradient(90deg, var(--dx-bg), transparent); }
.dxr::after { right: 0; background: linear-gradient(270deg, var(--dx-bg), transparent); }
.dxr-lens { position: absolute; inset: 0; perspective-origin: 50% 44%; }
.dxr-ring { position: absolute; left: 50%; top: 44%; width: 0; height: 0; transform-style: preserve-3d; }

.dxr-card {
	position: absolute;
	top: -80px;
	left: -128px;
	display: block;
	width: 256px;
	height: 160px;
	opacity: 0;
	transform-style: preserve-3d;
	-webkit-user-drag: none;
}
.dxr-card:focus-visible { outline: none; }
.dxr-tilt { position: absolute; inset: 0; display: block; transform-style: preserve-3d; }
.dxr-frame {
	position: absolute;
	inset: -9px;
	border: 3px solid var(--dx-primary);
	border-radius: 24px;
	box-shadow: 0 40px 80px -30px var(--dx-primary);
	clip-path: inset(0 100% 0 0 round 24px);
	transition: clip-path .55s var(--dx-ease);
}
.dxr-card:hover .dxr-frame,
.dxr-card:focus-visible .dxr-frame { clip-path: inset(0 0 0 0 round 24px); }
.dxr-face {
	position: absolute;
	inset: 0;
	overflow: hidden;
	background: var(--dx-surface);
	border-radius: 16px;
	box-shadow: 0 18px 36px -24px rgb(0 0 0 / .45);
	-webkit-backface-visibility: hidden;
	backface-visibility: hidden;
	-webkit-box-reflect: below 10px linear-gradient(transparent 52%, rgb(255 255 255 / .28));
}
.dxr-face.is-flipped { transform: rotateY(180deg); }
.dxr-face img {
	position: absolute;
	inset: 0;
	width: 100%;
	max-width: none;
	height: 100%;
	object-fit: cover;
	object-position: top;
	pointer-events: none;
}
.dxr-num {
	position: absolute;
	left: 14px;
	bottom: 14px;
	display: flex;
	align-items: center;
	gap: 7px;
	padding: 4px 10px;
	font-family: var(--dx-font-tech);
	font-size: 13px;
	line-height: 1.4;
	color: #fff;
	background: rgb(0 0 0 / .5);
	border-radius: var(--dx-radius-pill);
	transition: opacity .3s;
}
.dxr-num::before { content: ""; width: 6px; height: 6px; background: var(--dx-primary); border-radius: 50%; }
/* The demo's category and name: a bar above the card, clear of the screenshot. */
.dxr-label {
	position: absolute;
	inset: auto 0 calc(100% + 18px);
	-webkit-backface-visibility: hidden;
	backface-visibility: hidden;
	display: grid;
	grid-template-columns: 1fr auto;
	align-items: end;
	column-gap: 8px;
	padding: 10px 14px;
	color: var(--dx-on-primary);
	background: var(--dx-primary);
	border-radius: 12px;
	clip-path: inset(0 100% 0 0 round 12px);
	transition: clip-path .5s var(--dx-ease) .05s;
}
.dxr-cat {
	grid-column: 1 / 3;
	font-family: var(--dx-font-ui);
	font-size: 11px;
	line-height: 1.4;
	letter-spacing: var(--dx-tracking-ui);
	text-transform: uppercase;
}
.dxr-title {
	min-width: 0;
	overflow: hidden;
	font-family: var(--dx-font-body);
	font-size: 19px;
	font-weight: 600;
	line-height: 1.3;
	white-space: nowrap;
	text-overflow: ellipsis;
}
.dxr-arrow { font-size: 17px; line-height: 1.3; transform: translate(-6px, 6px); transition: transform .5s var(--dx-ease-spring) .15s; }
.dxr-card:hover .dxr-label,
.dxr-card:focus-visible .dxr-label { clip-path: inset(0 0 0 0 round 12px); }
.dxr-card:hover .dxr-arrow,
.dxr-card:focus-visible .dxr-arrow { transform: none; }
.dxr-card:hover .dxr-num,
.dxr-card:focus-visible .dxr-num { opacity: 0; }
:lang(ar) .dxr-label { direction: rtl; }

/* Touch screens have no hover: the name is always on the card. */
@media (hover: none) {
	.dxr-label { clip-path: none; }
	.dxr-arrow { transform: none; }
	.dxr-num { display: none; }
}

/* The theme's light look (Android and other touch screens): no reflection, no glow. */
.dx-ui-lite .dxr-face { -webkit-box-reflect: none; box-shadow: none; }
.dx-ui-lite .dxr-frame { box-shadow: none; }

@media (max-width: 820px) {
	.dxr { height: clamp(300px, 46vh, 420px); }
}
