/* ==========================================================================
   Hero slider — the original Multicerame slides (bright interior photographs and their
   sentences), with a glass tile panel holding one 2D ceramic composition per slide.
   front-page.php, template-parts/hero-art.php, assets/js/hero-art.js
   ========================================================================== */

@property --hs-p {
	syntax: "<percentage>";
	inherits: false;
	initial-value: 100%;
}

.hs {
	--hs-gold: #d9b36a;
	--hs-line: rgba(255, 255, 255, 0.82);
	--hs-ease: cubic-bezier(0.22, 1, 0.36, 1);
	position: relative;
	display: grid;
	grid-template-rows: 1fr auto auto;
	height: 100svh;
	min-height: 520px;
	max-height: 1100px;
	padding-top: var(--header-h);
	background: #d9d6d0;
	color: var(--c-white);
	overflow: hidden;
	isolation: isolate;
}
/* The legacy dark hero veil is not used: the photographs stay bright. */
.hs::before {
	content: none;
}

/* ------------------------------------------------------------ Photographs */
.hs__media {
	position: absolute;
	inset: 0;
	z-index: -2;
}
.hs__img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	opacity: 0;
	transform: scale(1.05);
	transition: opacity 900ms ease-out, transform 10s linear;
}
.hs__img.is-active {
	z-index: 2;
	opacity: 1;
	transform: scale(1);
}
.hs__img.is-prev {
	z-index: 1;
	opacity: 1;
}
/* Slide change: the next photograph is laid tile by tile (a grid of squares growing from
   their centres), the way a floor is laid. */
.hs__img.is-laying {
	opacity: 1;
	transition: transform 10s linear;
	-webkit-mask-image:
		linear-gradient(90deg, transparent calc(50% - var(--hs-p) / 2), #000 0 calc(50% + var(--hs-p) / 2), transparent 0),
		linear-gradient(180deg, transparent calc(50% - var(--hs-p) / 2), #000 0 calc(50% + var(--hs-p) / 2), transparent 0);
	-webkit-mask-size: calc(100% / 8) calc(100% / 5);
	-webkit-mask-composite: source-in;
	mask-image:
		linear-gradient(90deg, transparent calc(50% - var(--hs-p) / 2), #000 0 calc(50% + var(--hs-p) / 2), transparent 0),
		linear-gradient(180deg, transparent calc(50% - var(--hs-p) / 2), #000 0 calc(50% + var(--hs-p) / 2), transparent 0);
	mask-size: calc(100% / 8) calc(100% / 5);
	mask-composite: intersect;
	animation: hs-lay 1300ms cubic-bezier(0.65, 0, 0.35, 1) both;
}
@keyframes hs-lay {
	from {
		--hs-p: 0%;
	}
	to {
		--hs-p: 101%;
	}
}

/* Only the edges are shaded: white header on top, caption at the bottom. */
.hs__scrim {
	position: absolute;
	inset: 0;
	z-index: -1;
	pointer-events: none;
	background:
		linear-gradient(180deg, rgba(10, 10, 11, 0.5) 0, rgba(10, 10, 11, 0.12) calc(var(--header-h) + 30px), rgba(10, 10, 11, 0) calc(var(--header-h) + 140px)),
		linear-gradient(0deg, rgba(10, 10, 11, 0.55) 0, rgba(10, 10, 11, 0.22) 24%, rgba(10, 10, 11, 0) 42%);
}

/* ------------------------------------------------------------ Caption */
.hs__body {
	grid-row: 2;
	padding-bottom: var(--sp-5);
}
.hs__slides {
	display: grid;
}
.hs-slide {
	grid-area: 1 / 1;
	align-self: end;
	visibility: hidden;
	opacity: 0;
	transition: opacity 400ms ease-out, visibility 0s linear 400ms;
}
.hs-slide.is-active {
	visibility: visible;
	opacity: 1;
	transition: opacity 600ms ease-out 250ms, visibility 0s;
}
.hs-slide__caption {
	display: flex;
	align-items: stretch;
	gap: 0.55em;
	max-width: 24ch;
	margin: 0;
	font-size: clamp(1.6rem, 0.9rem + 2.3vw, 3.1rem);
	font-weight: 300;
	line-height: 1.12;
	letter-spacing: -0.01em;
	text-shadow: 0 1px 24px rgba(0, 0, 0, 0.35);
}
.hs-slide__caption strong {
	font-weight: 700;
}
/* The original slides open with a bold "|": drawn here as a gold bar. */
.hs-slide__bar {
	flex: none;
	width: 3px;
	margin: 0.12em 0;
	background: var(--hs-gold);
	transform: scaleY(0);
	transform-origin: top;
	transition: transform 300ms ease-in;
}
.hs-slide__text {
	clip-path: inset(0 100% 0 0);
	transform: translateX(-12px);
	transition: clip-path 300ms ease-in, transform 300ms ease-in;
}
.hs-slide.is-active .hs-slide__bar {
	transform: none;
	transition: transform 700ms var(--hs-ease) 350ms;
}
.hs-slide.is-active .hs-slide__text {
	clip-path: inset(0 -2% 0 0);
	transform: none;
	transition: clip-path 1300ms var(--hs-ease) 550ms, transform 1300ms var(--hs-ease) 550ms;
}
.hs-slide__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--sp-3) var(--sp-5);
	margin-top: var(--sp-5);
	opacity: 0;
	transition: opacity 300ms ease-in;
}
.hs-slide.is-active .hs-slide__actions {
	opacity: 1;
	transition: opacity 700ms ease-out 1100ms;
}
.hs-slide__link {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	min-height: 44px;
	color: var(--c-white);
	font-weight: 500;
	text-decoration: underline;
	text-decoration-color: rgba(217, 179, 106, 0.8);
	text-underline-offset: 6px;
	text-shadow: 0 1px 14px rgba(0, 0, 0, 0.4);
}
.hs-slide__link .icon {
	width: 18px;
	height: 18px;
	transition: transform var(--dur) var(--ease-out);
}
.hs-slide__link:hover .icon {
	transform: translateX(4px);
}

/* ------------------------------------------------------------ Controls (in flow: nothing overlaps) */
.hs .hero__controls {
	position: relative;
	bottom: auto;
	grid-row: 3;
	/* Clear of the fixed WhatsApp button (bottom left, about 70px high). */
	padding-bottom: 76px;
}
.hs .hero__arrows button {
	border-color: rgba(255, 255, 255, 0.55);
	background: rgba(10, 10, 11, 0.18);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
}
.hs .hero__arrows button:hover {
	background: var(--c-white);
}
.hs .hero__scroll {
	color: var(--c-white);
}

/* ------------------------------------------------------------ Glass tile panel */
.hs-panel {
	position: absolute;
	z-index: 0;
	top: calc(var(--header-h) + clamp(18px, 5vh, 56px));
	right: max(var(--gutter, 24px), calc((100% - var(--wrap, 1280px)) / 2 + var(--gutter, 24px)));
	width: clamp(240px, 25vw, 400px);
	aspect-ratio: 1;
	pointer-events: none;
	animation: hs-panel-in 1200ms var(--hs-ease) 200ms both;
}
@keyframes hs-panel-in {
	from {
		opacity: 0;
		transform: translateY(-18px);
		clip-path: inset(0 0 100% 0);
	}
	to {
		opacity: 1;
		transform: none;
		clip-path: inset(0 -40px -40px -40px);
	}
}
/* Layers: two tiles set behind the glass, slightly offset, breathing slowly. */
.hs-panel__layer {
	position: absolute;
	inset: 0;
	border: 1px solid rgba(255, 255, 255, 0.5);
	transform: translate(-16px, 16px);
	animation: hs-drift 9s ease-in-out infinite alternate;
}
.hs-panel__layer--2 {
	border-color: rgba(217, 179, 106, 0.55);
	transform: translate(-32px, 32px);
	animation-duration: 12s;
	animation-name: hs-drift-2;
}
@keyframes hs-drift {
	to {
		transform: translate(-20px, 20px);
	}
}
@keyframes hs-drift-2 {
	to {
		transform: translate(-38px, 38px);
	}
}
.hs-panel__glass {
	position: absolute;
	inset: 0;
	background: linear-gradient(145deg, rgba(32, 32, 35, 0.66), rgba(14, 14, 16, 0.78));
	-webkit-backdrop-filter: blur(22px) saturate(1.2);
	backdrop-filter: blur(22px) saturate(1.2);
	box-shadow: 0 30px 60px -28px rgba(0, 0, 0, 0.65), inset 0 0 0 1px rgba(255, 255, 255, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
/* Gold corner marks, as on a calibrated tile. */
.hs-panel__glass::before,
.hs-panel__glass::after {
	content: "";
	position: absolute;
	width: 18px;
	height: 18px;
	border: 0 solid var(--hs-gold);
}
.hs-panel__glass::before {
	top: 8px;
	left: 8px;
	border-top-width: 1px;
	border-left-width: 1px;
}
.hs-panel__glass::after {
	right: 8px;
	bottom: 8px;
	border-right-width: 1px;
	border-bottom-width: 1px;
}
.hs-panel__defs {
	position: absolute;
}

/* ------------------------------------------------------------ Compositions */
.hs-scene {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	max-width: none;
	overflow: visible;
	fill: none;
	opacity: 0;
	transition: opacity 350ms ease-in;
}
.hs-scene.is-active {
	opacity: 1;
	transition: opacity 600ms ease-out 300ms;
}
/* Reset quietly once the scene has faded out. */
.hs-scene:not(.is-active) * {
	transition-duration: 0s !important;
	transition-delay: 380ms !important;
	animation: none !important;
}

.a-line {
	stroke: var(--hs-line);
	stroke-width: 1;
}
.a-gold {
	stroke: var(--hs-gold);
	stroke-width: 1.3;
}
.a-guide {
	stroke: rgba(255, 255, 255, 0.28);
	stroke-width: 0.8;
	stroke-dasharray: 2 4;
}
.a-dot,
.a-dot rect {
	fill: var(--hs-gold);
	stroke: none;
}
.a-tick {
	stroke: rgba(255, 255, 255, 0.6);
}
.a-glazed {
	stroke: var(--hs-gold);
	stroke-width: 1.2;
}

/* Motion primitives (each element sets --t: delay, optional --d: duration). */
.a-draw {
	stroke-dasharray: 1;
	stroke-dashoffset: 1;
	transition: stroke-dashoffset var(--d, 1000ms) var(--hs-ease) var(--t, 0ms);
}
.is-active .a-draw {
	stroke-dashoffset: 0;
}
/* Dotted trend line: revealed left to right instead of drawn. */
.a-dash.a-draw {
	stroke-dasharray: 0.012 0.012;
	stroke-dashoffset: 0;
	clip-path: inset(0 100% 0 0);
	transition: clip-path var(--d, 1000ms) var(--hs-ease) var(--t, 0ms);
}
.is-active .a-dash.a-draw {
	clip-path: inset(0 0 0 0);
}
.a-fade {
	opacity: 0;
	transition: opacity var(--d, 700ms) ease-out var(--t, 0ms);
}
.is-active .a-fade {
	opacity: 1;
}
.a-rise {
	transform: scaleY(0);
	transform-box: fill-box;
	transform-origin: 50% 100%;
	transition: transform 800ms var(--hs-ease) var(--t, 0ms);
}
.is-active .a-rise {
	transform: none;
}
.a-pop {
	opacity: 0;
	transform: scale(0.4);
	transform-box: fill-box;
	transform-origin: center;
	transition: opacity 400ms ease-out var(--t, 0ms), transform 700ms var(--hs-ease) var(--t, 0ms);
}
.is-active .a-pop {
	opacity: 1;
	transform: none;
}

/* Scene 0: light passing over the slab inside the arch. */
.is-active .a-sheen {
	animation: hs-sheen 5.5s ease-in-out 4.2s infinite;
}
@keyframes hs-sheen {
	0% {
		translate: 0 0;
	}
	55%,
	100% {
		translate: 440px 0;
	}
}

/* Scene 1: 500 tesserae spread from the centre; a few glow like stores lighting up. */
.hs-tess {
	fill: rgba(255, 255, 255, 0.7);
	opacity: 0;
	transform: scale(0.2);
	transform-box: fill-box;
	transform-origin: center;
	transition: opacity 500ms ease-out, transform 600ms var(--hs-ease);
	transition-delay: calc(200ms + var(--r) * 1500ms);
}
.is-active .hs-tess {
	opacity: var(--o, 0.55);
	transform: none;
}
.hs-tess.is-lit {
	fill: var(--hs-gold);
	--o: 1;
}
.is-active .hs-tess.is-lit {
	animation: hs-glow 3.2s ease-in-out calc(2000ms + var(--g) * 3000ms) infinite;
}
@keyframes hs-glow {
	0%,
	100% {
		opacity: 1;
	}
	50% {
		opacity: 0.35;
	}
}
.hs-count {
	fill: var(--c-white);
	font-size: 40px;
	font-weight: 300;
	letter-spacing: -0.02em;
	font-variant-numeric: tabular-nums;
}
.hs-small {
	fill: rgba(255, 255, 255, 0.78);
	font-size: 12px;
}
.hs-small--gold {
	fill: var(--hs-gold);
	font-size: 16px;
}
.hs-big {
	fill: var(--c-white);
	font-size: 76px;
	font-weight: 200;
	letter-spacing: -0.04em;
	font-stretch: 112%;
}
.hs-year {
	fill: rgba(255, 255, 255, 0.78);
	font-size: 9.5px;
	font-variant-numeric: tabular-nums;
}
.hs-year--gold {
	fill: var(--hs-gold);
	font-size: 11px;
}

/* Scene 3: raw edges, the scan, then the rectified tile. */
.a-rough {
	stroke: rgba(255, 255, 255, 0.75);
	stroke-width: 1;
	stroke-dasharray: 3 3;
	opacity: 0;
}
.is-active .a-rough {
	animation: hs-rough 2600ms ease-out 300ms both;
}
@keyframes hs-rough {
	0% {
		opacity: 0;
	}
	15%,
	75% {
		opacity: 1;
	}
	100% {
		opacity: 0;
	}
}
.hs-scan path {
	stroke: #f3dfae;
	stroke-width: 1.5;
}
.hs-scan {
	opacity: 0;
}
.is-active .hs-scan {
	animation: hs-scan 1600ms cubic-bezier(0.45, 0, 0.55, 1) 700ms both, hs-scan-again 6s ease-in-out 5s infinite;
}
@keyframes hs-scan {
	0% {
		opacity: 1;
		translate: 0 0;
	}
	90% {
		opacity: 1;
		translate: 0 150px;
	}
	100% {
		opacity: 0;
		translate: 0 150px;
	}
}
@keyframes hs-scan-again {
	0% {
		opacity: 0;
		translate: 0 0;
	}
	10% {
		opacity: 0.55;
	}
	45% {
		opacity: 0.55;
		translate: 0 150px;
	}
	55%,
	100% {
		opacity: 0;
		translate: 0 150px;
	}
}

/* ------------------------------------------------------------ Responsive */
@media (max-width: 899px) {
	.hs {
		min-height: 600px;
	}
	.hs__scrim {
		background:
			linear-gradient(180deg, rgba(10, 10, 11, 0.5) 0, rgba(10, 10, 11, 0) calc(var(--header-h) + 60px)),
			linear-gradient(0deg, rgba(10, 10, 11, 0.72) 0, rgba(10, 10, 11, 0.45) 32%, rgba(10, 10, 11, 0) 55%);
	}
	.hs-panel {
		top: calc(var(--header-h) + 16px);
		right: 16px;
		width: clamp(150px, 42vw, 220px);
	}
	.hs-panel__layer {
		transform: translate(-8px, 8px);
		animation: none;
	}
	.hs-panel__layer--2 {
		transform: translate(-16px, 16px);
	}
	.hs-slide__caption {
		font-size: clamp(1.5rem, 1rem + 2.6vw, 2rem);
	}
	.hs-slide__actions {
		margin-top: var(--sp-4);
	}
}
/* Short screens: a smaller panel keeps clear of the caption. */
@media (min-width: 900px) and (max-height: 640px) {
	.hs-panel {
		width: clamp(190px, 19vw, 260px);
	}
}

@media (prefers-reduced-motion: reduce) {
	.hs__img,
	.hs__img.is-active {
		transform: none;
		transition: opacity 400ms ease-out;
	}
	.hs-panel,
	.hs-panel__layer,
	.hs-panel__layer--2 {
		animation: none;
	}
	.hs *,
	.hs *::before,
	.hs *::after {
		transition-delay: 0s !important;
		animation-delay: 0s !important;
	}
	.hs-scene *,
	.hs-slide * {
		transition-duration: 0s !important;
		animation: none !important;
	}
	.hs-scan {
		opacity: 0 !important;
	}
}

/* ==========================================================================
   Slide 2: map of Morocco in tesserae
   ========================================================================== */
.hs-map__land {
	fill: rgba(255, 255, 255, 0.04);
	stroke: none;
}
.hs-map__line {
	stroke: rgba(255, 255, 255, 0.85);
	stroke-width: 0.8;
	stroke-linejoin: round;
}
.hs-tess.is-lit {
	filter: drop-shadow(0 0 1.6px rgba(217, 179, 106, 0.95));
}
.hs-tess.is-hq {
	fill: #f3dfae;
	filter: drop-shadow(0 0 2px rgba(243, 223, 174, 0.9));
}



/* ==========================================================================
   Slide 1: three 60 × 120 tiles in 3D beside the headline (template-parts/hero-tiles.php,
   assets/js/hero-tiles.js). The glass panel is not shown on this slide.
   ========================================================================== */
.hs-panel {
	transition: opacity 500ms ease-out, visibility 0s;
}
.hs[data-slide="0"] .hs-panel,
.hs[data-slide="1"] .hs-panel {
	visibility: hidden;
	opacity: 0;
	transition: opacity 300ms ease-in, visibility 0s linear 300ms;
}
.hs-tiles {
	position: absolute;
	z-index: 0;
	top: calc(var(--header-h) + clamp(24px, 6vh, 64px));
	right: 0;
	bottom: clamp(70px, 11vh, 110px);
	left: 50%;
	pointer-events: none;
	visibility: hidden;
	opacity: 0;
	transition: opacity 400ms ease-in, visibility 0s linear 400ms;
}
.hs-tiles.is-ready.is-active {
	visibility: visible;
	opacity: 1;
	transition: opacity 300ms ease-out, visibility 0s;
}
.hs-tiles__canvas,
.hs-tiles__lines,
.hs-tiles__labels {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
}
.hs-tiles__canvas canvas {
	display: block;
	width: 100% !important;
	height: 100% !important;
}
.hs-tiles__lines {
	overflow: visible;
}
.hs-tiles__lines line {
	stroke: rgba(255, 255, 255, 0.9);
	stroke-width: 1;
}
.hs-tiles__lines circle {
	fill: var(--hs-gold);
	stroke: #fff;
	stroke-width: 1.5;
}
.hs-tiles__lines,
.hs-tiles__labels {
	opacity: 0;
	transition: opacity 250ms ease-in;
}
.hs-tiles.is-called .hs-tiles__lines,
.hs-tiles.is-called .hs-tiles__labels {
	opacity: 1;
	transition: opacity 700ms ease-out;
}
.hs-call {
	position: absolute;
	top: 0;
	left: 0;
	display: grid;
	gap: 1px;
	padding: 7px 12px 8px;
	border-left: 2px solid var(--hs-gold);
	background: rgba(14, 14, 15, 0.55);
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
	color: #fff;
	font-size: 0.8125rem;
	line-height: 1.3;
	white-space: nowrap;
}
.hs-call strong {
	font-weight: 600;
}
.hs-call span {
	color: rgba(255, 255, 255, 0.78);
	font-size: 0.75rem;
}
@media (max-width: 899px) {
	.hs-tiles {
		left: 0;
		bottom: 46%;
	}
}
@media (prefers-reduced-motion: reduce) {
	.hs-tiles,
	.hs-tiles__lines,
	.hs-tiles__labels {
		transition: none;
	}
}

/* The 60 × 120 of the timeline (slide 4): one step further back, it rises out of the ground. */
.hs-emerge {
	transform: translateY(96px);
	transform-box: view-box;
	transition: transform 1700ms cubic-bezier(0.16, 1, 0.3, 1) var(--t, 0ms);
}
.is-active .hs-emerge {
	transform: none;
}
.hs-emerge__shadow {
	fill: rgba(0, 0, 0, 0.35);
	stroke: none;
}

/* ==========================================================================
   Slide 1: the 20-year teaser video (template-parts/hero-intro.php), 10 s, muted. It plays
   below the header; main.js moves on when it ends (it fades to black, then the next photograph
   is laid over it).
   ========================================================================== */
.hs-intro {
	background: #080808; /* the video's own edges */
	overflow: hidden;
}
/* The intro sits on dark: keep the scrim out of its way. */
.hs[data-slide="0"] .hs__scrim {
	opacity: 0;
}
.hs__scrim {
	transition: opacity 900ms ease-out;
}
.hs-intro__video {
	position: absolute;
	top: var(--header-h);
	left: 0;
	width: 100%;
	height: calc(100% - var(--header-h));
	max-width: none;
	object-fit: cover;
	background: #080808;
}
/* Portrait screens (phones, tablets upright): the WHOLE frame is shown — logo, "MULTICERAME" and
   "2006 – 2026" are never cropped. Full width at 16:9, centred in the space between the header and
   the slider controls; the video's own black ground continues around it. */
@media (max-aspect-ratio: 1/1) {
	.hs-intro__video {
		top: calc(var(--header-h) + (100% - var(--header-h) - var(--hs-controls-h, 150px)) / 2);
		left: 50%;
		/* 145 % only trims the plain dark margins of the frame: the mark, "MULTICERAME" and the
		   dates sit in its middle half and stay entirely visible, larger. */
		width: 145%;
		height: auto;
		aspect-ratio: 16 / 9;
		translate: -50% -50%;
		object-fit: contain;
		/* The frame's edges melt into the black ground (no visible rectangle). */
		-webkit-mask-image: radial-gradient(70% 62% at 50% 50%, #000 70%, transparent 100%);
		mask-image: radial-gradient(70% 62% at 50% 50%, #000 70%, transparent 100%);
	}
}
@media (prefers-reduced-motion: reduce) {
	.hs-emerge {
		transform: none;
	}
}
