/* ==========================================================================
   Celia Noire — hero
   Full-bleed media, minimal type, two entrances.
   ========================================================================== */

.cn-hero {
	--cn-hero-overlay: 0.45;
	--cn-focal-d: center center;
	--cn-focal-m: center center;

	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-height: 100svh;
	padding: calc(var(--cn-gutter) + 4.5rem) var(--cn-gutter) calc(var(--cn-gutter) + 3rem);
	background: var(--cn-noir);
	color: var(--cn-ivory);
	overflow: hidden;
	text-align: center;
}

/* --------------------------------------------------------------------------
   Media
   -------------------------------------------------------------------------- */

.cn-hero__media,
.cn-hero__picture {
	position: absolute;
	inset: 0;
}

.cn-hero__image,
.cn-hero__video {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: var(--cn-focal-d);
}

.cn-hero__video {
	position: absolute;
	inset: 0;
	opacity: 0;
	transition: opacity var(--cn-dur-reveal) var(--cn-ease);
}

/* Only fades in once the file can actually play, so the poster never blinks. */
.cn-hero__video.is-playing {
	opacity: 1;
}

.cn-hero__scrim {
	position: absolute;
	inset: 0;
	background:
		linear-gradient(to bottom,
			rgba(10, 10, 10, 0.55) 0%,
			rgba(10, 10, 10, 0.1) 38%,
			rgba(10, 10, 10, 0.1) 62%,
			rgba(10, 10, 10, 0.6) 100%),
		rgba(10, 10, 10, var(--cn-hero-overlay));
}

/* --------------------------------------------------------------------------
   Sound toggle
   -------------------------------------------------------------------------- */

.cn-hero__sound {
	position: absolute;
	right: 28px;
	bottom: 28px;
	z-index: 3;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	color: var(--cn-ivory);
	background: rgba(10, 10, 10, 0.35);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	border: 1px solid rgba(198, 166, 100, 0.45);
	border-radius: 50%;
	opacity: 0.7;
	cursor: pointer;
	transition: opacity 220ms var(--cn-ease),
	            border-color 220ms var(--cn-ease),
	            transform 220ms var(--cn-ease);
}

.cn-hero__sound:hover,
.cn-hero__sound:focus-visible {
	opacity: 1;
	border-color: rgba(198, 166, 100, 0.85);
	transform: scale(1.05);
}

@media (max-width: 767px) {
	.cn-hero__sound {
		right: 16px;
		bottom: 16px;
		width: 39px;
		height: 39px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.cn-hero__sound {
		transition: none;
	}
}

/* --------------------------------------------------------------------------
   Content
   -------------------------------------------------------------------------- */

.cn-hero__inner {
	position: relative;
	z-index: 2;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: clamp(1.25rem, 3vw, 2.25rem);
	max-width: 60rem;
}

.cn-hero__title {
	margin: 0;
	color: var(--cn-ivory);
}

.cn-hero__wordmark {
	display: block;
	font-family: var(--cn-font-display);
	font-size: var(--cn-text-h1);
	font-weight: 400;
	letter-spacing: var(--cn-tracking-hero);
	line-height: 1;
	text-transform: uppercase;
	/* The tracking adds a trailing gap; pull it back so the mark reads centred. */
	margin-right: calc(var(--cn-tracking-hero) * -1);
}

.cn-hero__logo {
	width: min(24rem, 70vw);
	height: auto;
	margin-inline: auto;
}

.cn-hero__tagline {
	max-width: 34ch;
	font-size: var(--cn-text-sm);
	font-weight: 400;
	letter-spacing: var(--cn-tracking-wide);
	text-transform: uppercase;
	color: rgba(250, 246, 241, 0.82);
}

.cn-hero__actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.85rem;
	margin-top: 0.5rem;
}

/* --------------------------------------------------------------------------
   Content position — editable per breakpoint (Hero → "Položaj sadržaja").
   Centre reproduces the original, always-centred layout untouched; left/right
   keep the block clear of the model on the opposite side of the frame.
   Vertical centring on .cn-hero (justify-content) is unaffected either way.
   -------------------------------------------------------------------------- */

.cn-hero[data-cn-align-mobile="left"] {
	align-items: flex-start;
	text-align: left;
}

.cn-hero[data-cn-align-mobile="left"] .cn-hero__inner {
	align-items: flex-start;
}

.cn-hero[data-cn-align-mobile="left"] .cn-hero__actions {
	justify-content: flex-start;
}

.cn-hero[data-cn-align-mobile="right"] {
	align-items: flex-end;
	text-align: right;
}

.cn-hero[data-cn-align-mobile="right"] .cn-hero__inner {
	align-items: flex-end;
}

.cn-hero[data-cn-align-mobile="right"] .cn-hero__actions {
	justify-content: flex-end;
}

/* --------------------------------------------------------------------------
   Scroll hint
   -------------------------------------------------------------------------- */

.cn-hero__scroll {
	position: absolute;
	left: 50%;
	bottom: clamp(1.5rem, 4vh, 3rem);
	z-index: 2;
	transform: translateX(-50%);
	width: 1px;
	height: clamp(2.5rem, 6vh, 4rem);
	overflow: hidden;
	background: rgba(250, 246, 241, 0.22);
}

.cn-hero__scroll-line {
	display: block;
	width: 100%;
	height: 45%;
	background: var(--cn-gold);
	animation: cn-hero-scroll 2.6s var(--cn-ease) infinite;
}

@keyframes cn-hero-scroll {
	0%   { transform: translateY(-110%); }
	55%  { transform: translateY(230%); }
	100% { transform: translateY(230%); }
}

/* --------------------------------------------------------------------------
   Entrance — logo, tagline, buttons, in that order
   -------------------------------------------------------------------------- */

/* Entrance animation only applies when JS confirmed it can run it (see the
   `cn-js` class set synchronously in header.php). Without it — JS disabled
   or blocked — the content is visible from the first paint. `:where()` keeps
   the `cn-js` condition from adding specificity, so the reduced-motion
   override below still wins exactly as it did before this gating. */
:where(.cn-js) .cn-hero__title,
:where(.cn-js) .cn-hero__tagline,
:where(.cn-js) .cn-hero__actions {
	opacity: 0;
	transform: translateY(12px);
}

:where(.cn-js) .cn-hero.is-ready .cn-hero__title,
:where(.cn-js) .cn-hero.is-ready .cn-hero__tagline,
:where(.cn-js) .cn-hero.is-ready .cn-hero__actions {
	opacity: 1;
	transform: none;
	transition: opacity var(--cn-dur-reveal) var(--cn-ease),
	            transform var(--cn-dur-reveal) var(--cn-ease);
}

.cn-hero.is-ready .cn-hero__tagline { transition-delay: 120ms; }
.cn-hero.is-ready .cn-hero__actions { transition-delay: 240ms; }

/* --------------------------------------------------------------------------
   Mobile
   -------------------------------------------------------------------------- */

@media (max-width: 767px) {
	.cn-hero__image,
	.cn-hero__video {
		object-position: var(--cn-focal-m);
	}

	.cn-hero__wordmark {
		letter-spacing: 0.2em;
		margin-right: -0.2em;
	}

	.cn-hero__actions {
		flex-direction: column;
		align-items: center;
		align-self: stretch;
		gap: 0.7rem;
	}

	.cn-hero__actions .cn-btn {
		width: min(85%, 320px);
		min-height: 48px;
	}
}

/* --------------------------------------------------------------------------
   Tablet portrait (768–899) — its own layout, not a premature desktop one.
   Always centred regardless of the align fields: at this width a left/right
   block with the desktop max-width reads as off-centre and, worse, wide
   enough for the one-line wordmark to land across the model's face. True
   desktop starts at 900px, matching the header's own nav breakpoint.
   -------------------------------------------------------------------------- */

@media (min-width: 768px) and (max-width: 899px) {
	.cn-hero,
	.cn-hero[data-cn-align-mobile="left"],
	.cn-hero[data-cn-align-mobile="right"] {
		align-items: center;
		text-align: center;
	}

	.cn-hero__image,
	.cn-hero__video {
		object-position: var(--cn-focal-m);
	}

	.cn-hero__inner,
	.cn-hero[data-cn-align-mobile="left"] .cn-hero__inner,
	.cn-hero[data-cn-align-mobile="right"] .cn-hero__inner {
		align-items: center;
		max-width: 28rem;
		margin-inline: auto;
	}

	.cn-hero__wordmark {
		letter-spacing: 0.2em;
		margin-right: -0.2em;
	}

	.cn-hero__actions,
	.cn-hero[data-cn-align-mobile="left"] .cn-hero__actions,
	.cn-hero[data-cn-align-mobile="right"] .cn-hero__actions {
		flex-direction: column;
		align-items: center;
		justify-content: center;
		gap: 0.7rem;
	}

	.cn-hero__actions .cn-btn {
		width: min(85%, 320px);
		min-height: 48px;
	}
}

@media (min-width: 900px) {
	.cn-hero[data-cn-align-desktop="left"],
	.cn-hero[data-cn-align-desktop="right"] {
		/* Wider, more deliberate side margins than the site's usual gutter —
		   this is what keeps the block off the model on a full-bleed frame. */
		padding-inline: var(--cn-edge-gutter);
	}

	.cn-hero[data-cn-align-desktop="left"] {
		align-items: flex-start;
		text-align: left;
	}

	.cn-hero[data-cn-align-desktop="left"] .cn-hero__inner {
		align-items: flex-start;
		max-width: 37.5rem; /* ~600px */
	}

	.cn-hero[data-cn-align-desktop="left"] .cn-hero__actions {
		justify-content: flex-start;
	}

	.cn-hero[data-cn-align-desktop="right"] {
		align-items: flex-end;
		text-align: right;
	}

	.cn-hero[data-cn-align-desktop="right"] .cn-hero__inner {
		align-items: flex-end;
		max-width: 37.5rem;
	}

	.cn-hero[data-cn-align-desktop="right"] .cn-hero__actions {
		justify-content: flex-end;
	}

	.cn-hero[data-cn-align-desktop="center"] {
		align-items: center;
		text-align: center;
	}

	.cn-hero[data-cn-align-desktop="center"] .cn-hero__inner {
		align-items: center;
		max-width: 60rem;
	}

	.cn-hero[data-cn-align-desktop="center"] .cn-hero__actions {
		justify-content: center;
	}
}

@media (prefers-reduced-motion: reduce) {
	.cn-hero__title,
	.cn-hero__tagline,
	.cn-hero__actions {
		opacity: 1;
		transform: none;
	}

	.cn-hero__scroll-line {
		animation: none;
		height: 100%;
		opacity: 0.5;
	}
}
