/*
 * Offer stage — "ticket" (إدارة فعاليات): an event.
 * The navigation is the event programme (a line of numbered items); the
 * chosen offer is a ticket on a lit stage: the item's name and line on the
 * ticket, the stub torn along a perforation with «الفقرة ٠١», a code and the
 * company's name. A new item drops in under the spotlights.
 */

.gb-offer-stage--ticket {
	--gb-offer-enter: gb-ticket-in;
	--gb-offer-enter-time: 0.65s;
}

/* ---------- Programme (tabs) ---------- */

.gb-offer-stage--ticket .gb-os-panel-head {
	padding-inline: 0;
	font-family: var(--gb-font-display);
	font-size: var(--gb-step-2);
	color: var(--gb-color-navy);
}

.gb-offer-stage--ticket[data-gb-offer-ready] .gb-offer-stage__tabs {
	position: relative;
	gap: 0;
}

/* The programme's line, through the item numbers. */
.gb-offer-stage--ticket[data-gb-offer-ready] .gb-offer-stage__tabs::before {
	content: "";
	position: absolute;
	inset-block: 1.4rem;
	inset-inline-start: calc(var(--gb-space-xs) + 1.1rem - 1px);
	inline-size: 2px;
	background: repeating-linear-gradient(to bottom, var(--gb-color-neutral-300) 0 4px, transparent 4px 9px);
}

.gb-offer-stage--ticket .gb-offer-tab {
	position: relative;
	min-block-size: 3.25rem;
	color: var(--gb-color-navy);
}

.gb-os-slot {
	position: relative;
	display: grid;
	place-items: center;
	inline-size: 2.2rem;
	aspect-ratio: 1;
	border: 2px solid var(--gb-color-neutral-300);
	border-radius: 50%;
	background-color: var(--gb-surface);
	font-size: 0.78rem;
	font-weight: var(--gb-weight-bold);
	font-variant-numeric: tabular-nums;
}

.gb-offer-stage--ticket .gb-offer-tab:hover .gb-os-slot {
	border-color: var(--gb-primary);
}

.gb-offer-stage--ticket .gb-offer-tab[aria-selected="true"] {
	font-weight: var(--gb-weight-bold);
}

.gb-offer-stage--ticket .gb-offer-tab[aria-selected="true"] .gb-os-slot {
	border-color: var(--gb-accent);
	background-color: var(--gb-accent);
	color: var(--gb-color-neutral-0);
	box-shadow: 0 0 0 4px rgb(250 95 30 / 0.18);
}

/* ---------- The stage ---------- */

.gb-offer-stage--ticket[data-gb-offer-ready] .gb-offer-stage__screen {
	display: grid;
	min-block-size: clamp(21rem, 30vw, 25rem);
	overflow: hidden;
	border-radius: 1.25rem;
	background:
		radial-gradient(60% 35% at 50% 100%, rgb(0 202 190 / 0.22), transparent 70%),
		linear-gradient(to bottom, #0A1B33, var(--gb-color-navy) 60%, #081426);
	box-shadow: 0 2rem 4rem -2rem rgb(12 35 66 / 0.55);
}

.gb-offer-stage--ticket[data-gb-offer-ready] .gb-offer-stage__view {
	place-items: center;
	padding: var(--gb-space-l) var(--gb-space-m);
}

/* Two spotlights from the top. */
.gb-os-spot i {
	position: absolute;
	inset-block-start: -10%;
	inline-size: 45%;
	block-size: 120%;
	background: linear-gradient(to bottom, rgb(255 255 255 / 0.16), transparent 80%);
	clip-path: polygon(45% 0, 55% 0, 100% 100%, 0 100%);
	transform-origin: 50% 0;
}

.gb-os-spot i:first-child {
	left: 2%;
	rotate: -16deg;
}

.gb-os-spot i:last-child {
	right: 2%;
	rotate: 16deg;
}

/* ---------- The ticket (panel) ---------- */

.gb-offer-stage--ticket[data-gb-offer-ready] .gb-offer {
	position: relative;
	z-index: 3;
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	inline-size: min(100%, 34rem);
	border-radius: 1rem;
	background-color: var(--gb-bg);
	box-shadow: 0 1.5rem 3rem -1rem rgb(0 0 0 / 0.55);
}

.gb-offer-stage--ticket[data-gb-offer-ready] .gb-offer__body {
	align-content: center;
	padding: var(--gb-space-m);
}

.gb-offer-stage--ticket[data-gb-offer-ready] .gb-offer__number {
	display: none;
}

.gb-offer-stage--ticket[data-gb-offer-ready] .gb-offer__title {
	font-size: var(--gb-step-3);
}

/* The stub: perforation on its edge, a notch at each end. */
.gb-os-stub {
	position: relative;
	display: grid;
	align-content: center;
	justify-items: center;
	gap: 0.35rem;
	inline-size: 8.5rem;
	padding: var(--gb-space-s);
	border-inline-start: 2px dashed var(--gb-color-neutral-300);
	border-start-end-radius: 1rem;
	border-end-end-radius: 1rem;
	background-color: var(--gb-primary);
	color: var(--gb-color-navy);
	text-align: center;
}

.gb-os-stub::before,
.gb-os-stub::after {
	content: "";
	position: absolute;
	inset-inline-start: -0.8rem;
	inline-size: 1.5rem;
	aspect-ratio: 1;
	border-radius: 50%;
	background-color: #0B1C34;
}

.gb-os-stub::before {
	inset-block-start: -0.75rem;
}

.gb-os-stub::after {
	inset-block-end: -0.75rem;
}

.gb-os-stub__label {
	font-size: 0.8rem;
	font-weight: var(--gb-weight-bold);
}

.gb-os-stub b {
	font-family: var(--gb-font-display);
	font-size: var(--gb-step-5);
	line-height: 1;
	font-variant-numeric: tabular-nums;
}

/* A code, for the look. */
.gb-os-stub__code {
	inline-size: 5rem;
	block-size: 2rem;
	background: repeating-linear-gradient(to right, var(--gb-color-navy) 0 2px, transparent 2px 4px, var(--gb-color-navy) 4px 5px, transparent 5px 8px, var(--gb-color-navy) 8px 11px, transparent 11px 12px);
}

.gb-os-stub__brand {
	font-size: 0.7rem;
	font-weight: var(--gb-weight-bold);
	opacity: 0.8;
}

/* ---------- Motion ---------- */

@keyframes gb-ticket-in {
	0% {
		opacity: 0;
		translate: 0 -3rem;
		rotate: -4deg;
	}

	60% {
		opacity: 1;
		translate: 0 0.3rem;
		rotate: 1deg;
	}

	100% {
		opacity: 1;
		translate: 0 0;
		rotate: 0deg;
	}
}

@keyframes gb-ticket-sweep {
	0% {
		rotate: var(--gb-spot-from);
	}

	50% {
		rotate: var(--gb-spot-mid);
	}

	100% {
		rotate: var(--gb-spot-from);
	}
}

.gb-os-spot i:first-child {
	--gb-spot-from: -16deg;
	--gb-spot-mid: -4deg;
}

.gb-os-spot i:last-child {
	--gb-spot-from: 16deg;
	--gb-spot-mid: 4deg;
}

@media (prefers-reduced-motion: no-preference) {
	:root:not([data-gb-experience="STATIC_ACCESSIBLE"]) .gb-offer-stage--ticket[data-gb-switch] .gb-os-spot i {
		animation: gb-ticket-sweep 0.9s var(--gb-ease-in-out) both;
	}
}

/* ---------- Phones: the programme as a row; the stub folds under the ticket ---------- */

@media (max-width: 47.99rem) {
	.gb-offer-stage--ticket[data-gb-offer-ready] .gb-offer-stage__tabs::before {
		content: none;
	}

	.gb-offer-stage--ticket .gb-offer-tab {
		min-block-size: 2.75rem;
		padding-inline: 0.3rem 0.8rem;
		border-radius: var(--gb-radius-pill);
		background-color: var(--gb-bg);
		box-shadow: inset 0 0 0 1px var(--gb-border);
		font-size: 0.85rem;
	}

	.gb-os-slot {
		inline-size: 1.9rem;
	}

	.gb-offer-stage--ticket[data-gb-offer-ready] .gb-offer {
		grid-template-columns: minmax(0, 1fr);
	}

	.gb-os-stub {
		grid-template-columns: auto auto 1fr;
		align-items: center;
		justify-items: start;
		inline-size: auto;
		padding: var(--gb-space-xs) var(--gb-space-s);
		border-inline-start: 0;
		border-block-start: 2px dashed var(--gb-color-neutral-300);
		border-radius: 0 0 1rem 1rem;
		text-align: start;
	}

	.gb-os-stub::before,
	.gb-os-stub::after {
		inset-block-start: -0.8rem;
		inset-block-end: auto;
	}

	.gb-os-stub::before {
		inset-inline-start: -0.75rem;
	}

	.gb-os-stub::after {
		inset-inline-start: auto;
		inset-inline-end: -0.75rem;
	}

	.gb-os-stub b {
		font-size: var(--gb-step-3);
	}

	.gb-os-stub__code {
		justify-self: end;
	}

	.gb-os-stub__brand {
		display: none;
	}
}

/* ---------- Revision 4: the event itself, on the ticket's photo side ---------- */

.gb-offer-stage--ticket[data-gb-offer-ready] .gb-offer:has(.gb-os-scene) {
	grid-template-columns: minmax(7rem, 0.7fr) minmax(0, 1fr) auto;
	inline-size: min(100%, 40rem);
}

.gb-offer-stage--ticket[data-gb-offer-ready] .gb-os-scene {
	block-size: 100%;
	min-block-size: 9rem;
	margin: 0;
	object-fit: cover;
	border-start-start-radius: 1rem;
	border-end-start-radius: 1rem;
	border-start-end-radius: 0;
	border-end-end-radius: 0;
}

@media (max-width: 40rem) {
	.gb-offer-stage--ticket[data-gb-offer-ready] .gb-offer:has(.gb-os-scene) {
		grid-template-columns: minmax(0, 1fr);
	}

	.gb-offer-stage--ticket[data-gb-offer-ready] .gb-os-scene {
		aspect-ratio: 16 / 9;
		min-block-size: 0;
		border-radius: 1rem 1rem 0 0;
	}
}
