/* ==========================================================================
   Diwan Motion & Effects — Frontend Stylesheet
   --------------------------------------------------------------------------
   Strictly effects, hover states, motion helpers, decorative overlay
   positioning, and code-generated UI (preloader, cursor, marquee pause).
   NO font-family rules, NO page colors/backgrounds, NO content spacing.
   All visual design tokens remain editable in the WordPress Block Editor.
   ========================================================================== */

:root {
	--dm-fx-dark: #191919;
	--dm-fx-gold: #bf8a4a;
	--dm-fx-light: #f7f1e8;
	--dm-fx-ease: cubic-bezier(0.77, 0, 0.18, 1);
	--dm-fx-ease-out: cubic-bezier(0.19, 1, 0.22, 1);
}

/* ==========================================================================
   1. Smooth Scroll (Lenis) & Preloader Scroll Lock
   ========================================================================== */
html.lenis,
html.lenis body {
	height: auto;
}

/* Native smooth scrolling (e.g. Blocksy's `html { scroll-behavior: smooth }`) must stay off
   whenever motion runs: ScrollTrigger jumps to the top on refresh to re-measure, and a smooth
   jump measures every trigger from the wrong scroll position after a window resize.
   Not tied to `.lenis-smooth`, which Lenis toggles on and off at runtime. */
html.dm-motion,
html.dm-motion body,
html.lenis,
html.lenis body {
	scroll-behavior: auto !important;
}

.dm-is-loading,
.dm-is-loading body {
	overflow: hidden;
}

/* ==========================================================================
   2. Heritage Logo Preloader (Logo + Slim Gold Progress Bar + Curtain Wipe)
   ========================================================================== */
.dm-preloader {
	position: fixed;
	inset: 0;
	z-index: 99999;
	background-color: var(--dm-fx-dark);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 28px;
	pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
	/* Failsafe: auto-dismiss if scripts are blocked or delayed by a cache plugin */
	.dm-preloader {
		animation: dm-preloader-failsafe 0.4s ease 4.5s forwards;
	}
}

@keyframes dm-preloader-failsafe {
	to {
		opacity: 0;
		visibility: hidden;
	}
}

.dm-preloader__logo {
	position: relative;
	width: 132px;
	display: block;
}

.dm-preloader__logo-img,
.dm-preloader__logo img {
	width: 100%;
	height: auto;
	display: block;
}

.dm-preloader__logo-gold {
	position: absolute;
	inset: 0;
	background-color: var(--dm-fx-gold);
	-webkit-mask: var(--dm-logo-mask) center / 100% 100% no-repeat;
	mask: var(--dm-logo-mask) center / 100% 100% no-repeat;
	opacity: 0;
	will-change: opacity, clip-path;
}

.dm-preloader__track {
	width: 140px;
	height: 1px;
	background: rgba(244, 239, 231, 0.16);
	overflow: hidden;
	position: relative;
}

.dm-preloader__fill {
	width: 100%;
	height: 100%;
	background: var(--dm-fx-gold);
	transform: scaleX(0);
	transform-origin: left center;
	will-change: transform;
}

/* ==========================================================================
   3. Floating Custom Cursor ("View" Disc on Cards, Pointer Devices Only)
   ========================================================================== */
.dm-cursor {
	position: fixed;
	left: 0;
	top: 0;
	z-index: 99990;
	display: grid;
	place-items: center;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background-color: var(--dm-fx-gold);
	color: var(--dm-fx-light);
	font-size: 11px;
	letter-spacing: 0.15em;
	text-transform: uppercase;
	pointer-events: none;
	opacity: 0;
	will-change: transform, width, height, opacity;
	transition:
		width 0.35s var(--dm-fx-ease),
		height 0.35s var(--dm-fx-ease),
		opacity 0.25s ease,
		background-color 0.3s ease;
}

.dm-cursor.is-ready {
	opacity: 1;
}

.dm-cursor span {
	opacity: 0;
	transition: opacity 0.2s ease;
}

.dm-cursor.is-view {
	width: 86px;
	height: 86px;
	background-color: rgba(191, 138, 74, 0.94);
}

.dm-cursor.is-view span {
	opacity: 1;
}

@media (hover: none), (pointer: coarse) {
	.dm-cursor {
		display: none !important;
	}
}

/* ==========================================================================
   4. Hover Interactions (Buttons, Arrow Links, Card Zoom)
   ========================================================================== */

/* Upward fill wipe on block buttons */
.dm-fx-magnetic .wp-block-button__link,
.dm-hero .wp-block-button__link,
.dm-catering .wp-block-button__link,
.dm-cta .wp-block-button__link,
.dm-retail .wp-block-button__link {
	position: relative;
	overflow: hidden;
	isolation: isolate;
}

.dm-fx-magnetic .wp-block-button__link::before,
.dm-hero .wp-block-button__link::before,
.dm-catering .wp-block-button__link::before,
.dm-cta .wp-block-button__link::before,
.dm-retail .wp-block-button__link::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background-color: var(--dm-fx-dark);
	transform: translateY(101%);
	transition: transform 0.55s var(--dm-fx-ease);
}

.dm-fx-magnetic .wp-block-button__link:hover::before,
.dm-fx-magnetic .wp-block-button__link:focus-visible::before,
.dm-hero .wp-block-button__link:hover::before,
.dm-catering .wp-block-button__link:hover::before,
.dm-cta .wp-block-button__link:hover::before,
.dm-retail .wp-block-button__link:hover::before {
	transform: translateY(0);
}

.dm-fx-magnetic.is-style-outline .wp-block-button__link::before,
.dm-hero .is-style-outline .wp-block-button__link::before,
.dm-catering .is-style-outline .wp-block-button__link::before,
.dm-cta .is-style-outline .wp-block-button__link::before,
.dm-retail .is-style-outline .wp-block-button__link::before {
	background-color: currentColor;
	opacity: 0.16;
}

/* Sliding arrow links (screen-reader silent via CSS content alt-text syntax) */
.dm-fx-arrow a,
a.dm-fx-arrow {
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
	text-decoration: none;
}

.dm-fx-arrow a::after,
a.dm-fx-arrow::after {
	content: "\2192";
	content: "\2192" / "";
	display: inline-block;
	transition: transform 0.5s var(--dm-fx-ease);
}

@media (prefers-reduced-motion: no-preference) {
	.dm-fx-arrow a:hover::after,
	.dm-fx-arrow a:focus-visible::after,
	a.dm-fx-arrow:hover::after,
	a.dm-fx-arrow:focus-visible::after {
		transform: translateX(6px);
	}
}

/* Card image hover zoom using standalone `scale` so it composes cleanly with GSAP `transform` */
@media (prefers-reduced-motion: no-preference) {
	.dm-retail__card .wp-block-image img,
	.dm-shop__photo > .wp-block-cover__image-background,
	.dm-news .wp-block-post-featured-image img {
		transition: scale 1.1s var(--dm-fx-ease);
	}

	.dm-retail__card:hover .dm-retail__media .wp-block-image img,
	.dm-retail__card:hover .wp-block-image img,
	.dm-shop:hover .dm-shop__photo > .wp-block-cover__image-background,
	.dm-news > li:hover .wp-block-post-featured-image img {
		scale: 1.06;
	}
}

/* Preserve high-contrast keyboard focus rings even inside clipped cards */
.dm-retail__card a:focus-visible,
.dm-shop a:focus-visible,
.dm-news a:focus-visible,
.dm-fx-arrow a:focus-visible,
a.dm-fx-arrow:focus-visible {
	outline: 2px solid var(--dm-fx-gold);
	outline-offset: 3px;
}

/* ==========================================================================
   5. Motion Helpers & Structural Clipping Frames
   ========================================================================== */
.dm-fx-parallax,
.dm-fx-clip,
.dm-fx-grow,
.dm-retail__media,
.dm-retail__card .wp-block-image,
.dm-shop__photo,
.dm-news .wp-block-post-featured-image {
	overflow: hidden;
}

.dm-retail__card .wp-block-image {
	border-radius: 2px;
}

.dm-img-focus-left img {
	object-position: 22% 50%;
}

@media (prefers-reduced-motion: no-preference) {
	.dm-fx-grow {
		clip-path: inset(12% 12% 12% 12%);
	}
}

/* Hero Cover oversized background for zoom-out + scroll parallax without exposing edges */
.dm-hero {
	overflow: hidden;
	position: relative;
}

.dm-hero > .wp-block-cover__image-background {
	inset: -6%;
	width: 112%;
	height: 112%;
	max-width: none;
	will-change: transform;
}

.dm-hero .wp-block-cover__inner-container {
	position: static;
}

.dm-hero__content {
	position: relative;
	z-index: 2;
}

.dm-hero__content > .kt-inside-inner-col > .wp-block-kadence-column {
	margin-inline: 0 !important;
}

.dm-hero .wp-block-buttons {
	gap: 18px;
	flex-wrap: wrap;
}

/* Statement Cover oversized background for vertical parallax */
.dm-statement {
	overflow: hidden;
}

.dm-statement > .wp-block-cover__image-background {
	height: 120%;
	will-change: transform;
}

/* SplitText / fallback word & character wrappers */
.dm-fx-words .dm-word,
.dm-fx-flip .dm-word,
.dm-char {
	display: inline-block;
}

.dm-line-mask {
	display: block;
	overflow: hidden;
	padding-bottom: 0.12em;
}

.dm-fx-flip {
	perspective: 800px;
}

/* Shops 3D perspective stage (targets Kadence's inner flex wrapper) */
.dm-shops > .kt-inside-inner-col {
	perspective: 1200px;
}

.dm-shop {
	transform-style: preserve-3d;
}

@media (max-width: 767px) {
	.wp-block-kadence-column.kb-section-dir-horizontal.dm-shops > .kt-inside-inner-col > .dm-shop,
	.dm-shops > .kt-inside-inner-col > .dm-shop {
		flex: 0 0 100% !important;
		width: 100%;
		max-width: 100%;
	}
}

/* Marquee seamless horizontal loop + WCAG 2.2.2 pause/play button */
.dm-marquee {
	position: relative;
	overflow: hidden;
}

.dm-marquee__track,
.dm-marquee__track > .kt-inside-inner-col {
	width: max-content;
}

.dm-marquee__track > .kt-inside-inner-col > * {
	flex: none;
	white-space: nowrap;
}

.dm-marquee__toggle {
	position: absolute;
	right: 14px;
	top: 50%;
	translate: 0 -50%;
	z-index: 3;
	min-width: 30px;
	min-height: 30px;
	padding: 4px 8px;
	border-radius: 2px;
	border: 1px solid rgba(28, 23, 18, 0.32);
	background-color: rgba(191, 138, 74, 0.92);
	color: var(--dm-fx-dark);
	font-size: 11px;
	line-height: 1;
	cursor: pointer;
	opacity: 0;
	transition: opacity 0.25s ease, background-color 0.2s ease;
}

.dm-marquee:hover .dm-marquee__toggle,
.dm-marquee:focus-within .dm-marquee__toggle,
.dm-marquee__toggle:focus-visible {
	opacity: 1;
}

.dm-marquee__toggle:focus-visible {
	outline: 2px solid var(--dm-fx-dark);
	outline-offset: 2px;
}

/* Retail Pinned Horizontal Gallery
   Note: Kadence sets `.kb-section-dir-horizontal > .kt-inside-inner-col > .wp-block-kadence-column { flex: 1 }`
   with (0,4,0) specificity. Inside a `width: max-content` rail, `flex-grow: 1` + `width: auto` expands cards
   to the intrinsic image width (~1550px). Locking `flex: 0 0 ...` + definite `width`/`max-width` prevents
   blowout and scales card height proportionally so sticky header + 40px gap + title + cards + progress bar fit inside 100svh. */
.dm-retail {
	overflow: hidden;
	--dm-sticky-header-h: 120px;
	--dm-retail-card-w: clamp(220px, min(23vw, calc((100svh - var(--dm-sticky-header-h) - 255px) * 0.76)), 330px);
}

.dm-retail .pin-spacer {
	max-width: none !important;
	margin-inline: 0 !important;
}

.dm-retail__rail,
.dm-retail__rail > .kt-inside-inner-col {
	width: max-content;
}

.dm-retail__rail > .kt-inside-inner-col {
	padding-inline: max(24px, calc((100vw - 1240px) / 2));
}

.wp-block-kadence-column.kb-section-dir-horizontal.dm-retail__rail > .kt-inside-inner-col > .wp-block-kadence-column,
.dm-retail__rail > .kt-inside-inner-col > * {
	flex: 0 0 var(--dm-retail-card-w) !important;
	width: var(--dm-retail-card-w);
	max-width: var(--dm-retail-card-w);
	min-width: 0;
}

.dm-retail__media,
.dm-retail__card > .kt-inside-inner-col {
	position: relative;
}

/* Vertically center "The full collection" + button inside the stretched rail row */
.dm-retail__end {
	display: flex;
}

.dm-retail__end > .kt-inside-inner-col {
	height: 100%;
	width: 100%;
	justify-content: center;
}

/* Keep the pinned stage strictly within 100svh across all viewports with sticky-header (120px) + 40px clearance */
.dm-retail__pin > .kt-inside-inner-col {
	height: 100vh;
	height: 100svh;
	max-height: 100vh;
	max-height: 100svh;
	padding-top: calc(var(--dm-sticky-header-h, 120px) + 40px) !important;
	padding-bottom: clamp(22px, 3svh, 40px) !important;
	justify-content: space-between !important;
	row-gap: clamp(14px, 2svh, 28px) !important;
	box-sizing: border-box;
}

.dm-retail__pin > .kt-inside-inner-col > .kb-row-layout-wrap {
	width: 100%;
}

/* Short viewports (set by JS when cards can't fit beside the intro): let the stage grow so the
   intro scrolls up under the header and only the cards + progress bar stay pinned on screen. */
.dm-retail.dm-retail--tall .dm-retail__pin > .kt-inside-inner-col {
	height: auto;
	max-height: none;
	justify-content: flex-start !important;
}

/* Card captions: when the title and "Shop Now" sit side by side (Kadence tablet/mobile layout),
   wrap the link under the title instead of breaking "Shop Now" across two lines. */
.dm-retail__card .kt-inside-inner-col:has(> .dm-fx-arrow) {
	flex-wrap: wrap;
	row-gap: 4px;
}

.dm-retail__card .dm-fx-arrow {
	white-space: nowrap;
}

/* Centered compact Retail scroll progress bar: light Brand Gold track fills to solid Brand Gold */
.dm-retail__progress-track {
	position: relative;
	width: clamp(160px, 18vw, 220px);
	height: 3px;
	margin-inline: auto;
	border-radius: 999px;
	background-color: rgba(191, 138, 74, 0.28);
	overflow: hidden;
}

.dm-retail__progress-track > hr.wp-block-separator.dm-retail__progress {
	position: absolute;
	inset: 0;
	width: 100% !important;
	max-width: none !important;
	height: 100% !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 999px;
	background-color: var(--dm-fx-gold, #bf8a4a) !important;
	color: var(--dm-fx-gold, #bf8a4a) !important;
	opacity: 1 !important;
	transform-origin: left center;
	will-change: transform;
}

@media (max-width: 767px) {
	.dm-retail {
		--dm-sticky-header-h: 88px;
		--dm-retail-card-w: clamp(185px, min(68vw, calc((100svh - var(--dm-sticky-header-h) - 290px) * 0.76)), 255px);
	}

	.dm-retail__rail > .kt-inside-inner-col {
		padding-inline: 20px;
	}
}

/* Catering service numbers (01/02/03): equal width so the service titles line up */
.dm-catering__service .kb-section-dir-horizontal > .kt-inside-inner-col > p:first-child {
	flex-shrink: 0;
	min-width: 1.6em;
	font-variant-numeric: tabular-nums;
}

/* Responsive fallback for News 3-column grid on smaller viewports */
@media (max-width: 960px) {
	.dm-news.is-layout-grid {
		grid-template-columns: 1fr !important;
	}
}

/* ==========================================================================
   6. Decorative Overlay Positioning (Starbursts, Badge, Card Numbers, Scroll Cue)
   ========================================================================== */
.dm-fx-burst {
	position: absolute;
	margin: 0 !important;
	pointer-events: none;
}

.dm-fx-burst img {
	height: auto;
	display: block;
}

/* Allow starbursts inside Kadence rows/columns to position relative to the full-bleed <section> corners */
.dm-about,
.dm-cta {
	position: relative;
	overflow: hidden;
}

.dm-about > .kt-row-column-wrap,
.dm-cta > .kt-row-column-wrap,
.dm-about > .kt-row-column-wrap > .wp-block-kadence-column:not(.dm-about__media),
.dm-about > .kt-row-column-wrap > .wp-block-kadence-column:not(.dm-about__media) > .kt-inside-inner-col,
.dm-cta > .kt-row-column-wrap > .wp-block-kadence-column,
.dm-cta > .kt-row-column-wrap > .wp-block-kadence-column > .kt-inside-inner-col {
	position: static !important;
}

.dm-about > .kt-row-column-wrap > .wp-block-kadence-column > .kt-inside-inner-col > :not(.dm-fx-burst),
.dm-cta > .kt-row-column-wrap > .wp-block-kadence-column > .kt-inside-inner-col > :not(.dm-fx-burst) {
	position: relative;
	z-index: 1;
}

.dm-hero__star {
	right: -8vw;
	top: 50%;
	z-index: 1;
	translate: 0 -50%;
	opacity: 0.24;
}

.dm-about__star {
	left: -190px;
	top: -190px;
	right: auto;
	bottom: auto;
	z-index: 0;
	opacity: 0.85;
}

.dm-cta__star--left {
	left: -210px;
	bottom: -210px;
	top: auto;
	right: auto;
	z-index: 0;
}

.dm-cta__star--right {
	right: -210px;
	top: -210px;
	left: auto;
	bottom: auto;
	z-index: 0;
}

@media (max-width: 767px) {
	.dm-about__star {
		width: 320px !important;
		left: -120px;
		top: -120px;
	}

	.dm-cta__star--left {
		width: 320px !important;
		left: -125px;
		bottom: -125px;
	}

	.dm-cta__star--right {
		width: 320px !important;
		right: -125px;
		top: -125px;
	}
}

/* Rotating circular heritage seal on About photo */
.dm-about__media {
	position: relative;
}

.dm-about__badge {
	position: absolute;
	left: -60px;
	bottom: 60px;
	z-index: 3;
	margin: 0 !important;
	pointer-events: none;
}

@media (max-width: 1024px) {
	.dm-about__badge {
		left: auto;
		right: -12px;
		bottom: -36px;
		width: 120px;
	}
}

/* Retail category index number (01–06) overlaid at top-left of card image */
.dm-retail__num {
	position: absolute;
	top: 18px;
	left: 20px;
	z-index: 2;
	mix-blend-mode: difference;
	pointer-events: none;
}

/* Hero bottom "Scroll" indicator with dripping vertical gold line (centered across viewports) */
.dm-hero__scroll-cue {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 34px;
	z-index: 2;
	width: max-content;
	margin-inline: auto !important;
	display: flex;
	align-items: center;
	gap: 14px;
}

@media (max-width: 767px) {
	.dm-hero__scroll-cue {
		bottom: 24px;
	}
}

.dm-hero__scroll-cue::before {
	content: "";
	width: 1px;
	height: 56px;
	background:
		linear-gradient(var(--dm-fx-gold), var(--dm-fx-gold)) 0 -28px / 1px 28px no-repeat,
		color-mix(in srgb, currentColor 28%, transparent);
}

@media (prefers-reduced-motion: no-preference) {
	.dm-hero__scroll-cue::before {
		animation: dm-scroll-drip 2s var(--dm-fx-ease) infinite;
	}
}

@keyframes dm-scroll-drip {
	to {
		background-position: 0 56px, 0 0;
	}
}

/* ==========================================================================
   7. Reduced Motion Preferences (Case-by-Case Final States)
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
	.dm-preloader {
		display: none !important;
	}

	.dm-is-loading,
	.dm-is-loading body {
		overflow: visible;
	}

	.dm-marquee__toggle {
		display: none;
	}
}
