/*!
 * Component: Cookie consent banner (.mw-cookie-banner)
 *
 * Topic 20 LAUNCH-WP2 — T1 trade-off (self-hosted minimal banner). Rendered
 * client-side by assets/js/cookie-consent.js when localStorage has no recorded
 * choice. Banner is global (not template-scoped) so the same styles ship on
 * every page; the JS short-circuits when a choice already exists, so the
 * runtime cost on repeat visits is zero markup.
 *
 * Theme tokens:
 *   - Background: var(--studio-dark, #040420) — studio-tier dark surface.
 *   - Foreground: #FFF1D6 (cream) — paired with studio-dark for AA-contrast.
 *     There is no canonical --studio-cream token in theme-tokens.css; we use
 *     the same cream hex as --kw-cream because it is the only cream-tone the
 *     studio brand has shipped. If a dedicated --studio-cream token is added
 *     later, switch the references below.
 *   - Accent: var(--wp--preset--color--accent-violet, #7C5CFF) — primary CTA.
 *   - Focus: var(--wp--preset--color--kw-gold, #F4C430) — matches site-wide
 *     focus-visible convention from _button.css.
 *
 * @package Mystwood_Studios_AB
 * @since   Topic 20 LAUNCH-WP2
 */

.mw-cookie-banner {
	position: fixed;
	left: 1rem;
	right: 1rem;
	bottom: 1rem;
	max-width: 720px;
	margin: 0 auto;
	padding: 1.25rem 1.5rem;
	background: var(--studio-dark, #040420);
	color: #FFF1D6;
	border: 1px solid rgba(255, 241, 214, 0.15);
	border-radius: 12px;
	box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45), 0 4px 12px rgba(0, 0, 0, 0.3);
	font-family: var(--wp--preset--font-family--body, "Poppins", system-ui, sans-serif);
	font-size: 0.95rem;
	line-height: 1.5;
	z-index: 9999;
	opacity: 1;
	transition: opacity 250ms ease-out, transform 250ms ease-out;
}

/* Subtle backdrop blur where supported — purely aesthetic, no fallback needed
 * because the solid background already provides full readability. */
@supports (backdrop-filter: blur(6px)) {
	.mw-cookie-banner {
		background: rgba(4, 4, 32, 0.92);
		backdrop-filter: blur(6px);
		-webkit-backdrop-filter: blur(6px);
	}
}

.mw-cookie-banner.is-fading {
	opacity: 0;
	transform: translateY(8px);
}

.mw-cookie-banner__inner {
	display: flex;
	flex-direction: column;
	gap: 0.85rem;
}

.mw-cookie-banner__title {
	margin: 0;
	font-family: var(--wp--preset--font-family--display, system-ui, sans-serif);
	font-size: 1.15rem;
	font-weight: 700;
	letter-spacing: 0.02em;
	color: #FFF1D6;
}

.mw-cookie-banner__body {
	margin: 0;
	color: rgba(255, 241, 214, 0.88);
}

.mw-cookie-banner__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.6rem;
	align-items: center;
	margin-top: 0.25rem;
}

/* --- Button tiers ---------------------------------------------------- *
 * Three tiers per WP-2 spec:
 *   --primary    Accept all      — filled accent button (lifts on hover).
 *   --secondary  Essential only  — outlined button on the dark surface.
 *   --tertiary   Read policy     — text-only link (underlined on hover).
 * Sized smaller than the global .mw-btn so the banner stays compact on
 * mobile sheet layout. Focus-visible matches site-wide kw-gold outline. */
.mw-cookie-banner__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.6rem 1.15rem;
	font-family: var(--wp--preset--font-family--display, system-ui, sans-serif);
	font-size: 0.95rem;
	font-weight: 400;
	letter-spacing: 0.04em;
	line-height: 1;
	border-radius: 9999px;
	border: 2px solid transparent;
	cursor: pointer;
	text-decoration: none;
	transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease,
		border-color 0.18s ease, filter 0.18s ease;
}

.mw-cookie-banner__btn--primary {
	background: var(--wp--preset--color--accent-violet, #7C5CFF);
	color: #ffffff;
	border-color: var(--wp--preset--color--accent-violet, #7C5CFF);
}

.mw-cookie-banner__btn--primary:hover {
	transform: translateY(-2px);
	filter: brightness(1.06);
}

.mw-cookie-banner__btn--secondary {
	background: transparent;
	color: #FFF1D6;
	border-color: rgba(255, 241, 214, 0.55);
}

.mw-cookie-banner__btn--secondary:hover {
	background: rgba(255, 241, 214, 0.08);
	border-color: #FFF1D6;
}

.mw-cookie-banner__btn--tertiary {
	background: transparent;
	color: rgba(255, 241, 214, 0.85);
	border-color: transparent;
	padding-left: 0.5rem;
	padding-right: 0.5rem;
}

.mw-cookie-banner__btn--tertiary:hover {
	color: #FFF1D6;
	text-decoration: underline;
	text-underline-offset: 4px;
}

.mw-cookie-banner__btn:focus-visible {
	outline: 3px solid var(--wp--preset--color--kw-gold, #F4C430);
	outline-offset: 3px;
}

/* --- Mobile: full-width sheet --------------------------------------- *
 * Below 720px viewport the banner stretches edge-to-edge and shrinks
 * the corner radius so it reads as an attached bottom sheet rather than
 * a floating card. Buttons go full-width so the touch targets stay
 * comfortable. */
@media (max-width: 720px) {
	.mw-cookie-banner {
		left: 0;
		right: 0;
		bottom: 0;
		max-width: none;
		margin: 0;
		border-radius: 12px 12px 0 0;
		border-left: none;
		border-right: none;
		border-bottom: none;
		padding: 1.1rem 1.25rem 1.25rem;
	}

	.mw-cookie-banner__actions {
		flex-direction: column;
		align-items: stretch;
	}

	.mw-cookie-banner__btn {
		width: 100%;
	}

	.mw-cookie-banner__btn--tertiary {
		text-align: center;
	}
}

/* --- Reduced motion ------------------------------------------------- *
 * Skip the fade-out transition for visitors who have requested reduced
 * motion. The banner is removed from the DOM in the same animation frame
 * by the JS path that branches on matchMedia. */
@media (prefers-reduced-motion: reduce) {
	.mw-cookie-banner,
	.mw-cookie-banner.is-fading {
		transition: none;
		transform: none;
	}
}

/* --- Print: banner is purely interactive, never print. -------------- */
@media print {
	.mw-cookie-banner {
		display: none !important;
	}
}

/* --- Footer "manage preferences" reopen control (Topic 31 GROWTH-WP5) --- *
 * Renders inside .site-footer__menu--legal as a plain <a> server-side
 * (inc/components/footer.php); assets/js/cookie-consent.js upgrades it to a
 * real <button type="button"> on load via the data-mw-consent-reopen hook.
 * A <button> does not inherit the sibling `.site-footer__menu a` anchor
 * styling (browser UA button defaults), so both forms are styled here,
 * explicitly, to read identically to the legal links beside it. */
.mw-consent-reopen {
	display: inline;
	background: transparent;
	border: none;
	padding: 0;
	margin: 0;
	font: inherit;
	color: rgba(255, 255, 255, 0.85);
	text-decoration: none;
	font-size: 0.9375rem;
	cursor: pointer;
	transition: color 0.15s ease;
}

.mw-consent-reopen:hover,
.mw-consent-reopen:focus-visible {
	color: var(--mw-footer-accent, #6765E8);
}

.mw-consent-reopen:focus-visible {
	outline: 2px solid var(--mw-footer-accent, #6765E8);
	outline-offset: 2px;
	border-radius: 2px;
}

/* No [dir="rtl"] override needed: every rule above is either symmetric
 * (padding/margin: 0) or a logical/paint-only property (color, outline,
 * font, background) — nothing here is a physical left/right value that
 * mirrors incorrectly under RTL. Matches the documented convention in
 * assets/css/components/_press-kit.css. */
