/**
 * Nelvin global styles.
 * Shared by every block: container, logo crop, buttons, section headings.
 * Colors/fonts come from theme.json presets (CSS custom properties).
 */

:root {
	--nelvin-primary: var(--wp--preset--color--primary, #fe6b00);
	--nelvin-secondary: var(--wp--preset--color--secondary, #5512a0);
	--nelvin-text: var(--wp--preset--color--contrast, #333);
	--nelvin-muted: var(--wp--preset--color--muted, #5a4136);
	--nelvin-subtle: var(--wp--preset--color--subtle, #8e7164);
	--nelvin-placeholder: var(--wp--preset--color--placeholder, #9ca3af);
	--nelvin-base: var(--wp--preset--color--base, #fbf9f8);
	--nelvin-surface: var(--wp--preset--color--surface, #f6f3f2);
	--nelvin-surface-2: var(--wp--preset--color--surface-2, #f0eded);
	--nelvin-surface-3: var(--wp--preset--color--surface-3, #eae8e7);
	--nelvin-light: var(--wp--preset--color--light, #e4e2e1);
	--nelvin-border: var(--wp--preset--color--border, #e2bfb0);
	--nelvin-border-soft: rgba(226, 191, 176, 0.3);
	--nelvin-sale: var(--wp--preset--color--sale, #ba1a1a);
	--nelvin-container: 1440px;
	--nelvin-gutter: 24px;
}

/*
 * Site width = Styles › Layout › "Wide width" in the Site Editor (incl. the
 * 24px side padding). WordPress defines that variable on <body>, so it is
 * read here rather than on :root.
 */
body {
	--nelvin-container: var(--wp--style--global--wide-size, 1440px);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

.wp-site-blocks {
	padding-top: 0;
	padding-bottom: 0;
}

/* Sticky header sticks to the page, not to its template-part wrapper. */
.nelvin-header-part,
.wp-block-template-part:has(> .nelvin-header) {
	display: contents;
}

/* Template main area: blocks control their own width. */
.nelvin-main {
	margin-block-start: 0 !important;
}

.nelvin-main > * {
	margin-block-start: 0;
	margin-block-end: 0;
}

.nelvin-container {
	box-sizing: border-box;
	width: 100%;
	max-width: var(--nelvin-container);
	margin-inline: auto;
	padding-inline: var(--nelvin-gutter);
}

.nelvin-section,
.nelvin-section *,
.nelvin-section *::before,
.nelvin-section *::after {
	box-sizing: border-box;
}

.nelvin-section {
	width: 100%;
	max-width: none;
	margin: 0;
}

/*
 * Resets use :where() (zero specificity) so component rules such as
 * `margin: 0 auto` on a centred <ul> always win.
 */
:where(.nelvin-section) img {
	display: block;
	max-width: 100%;
}

:where(.nelvin-section) :where(p, h1, h2, h3, h4, ul) {
	margin: 0;
}

/* Zero specificity so component classes (e.g. .nelvin-btn) always win. */
:where(.nelvin-section) a {
	text-decoration: none;
	color: inherit;
}

/* ---------- Logo (crop of exported Figma artboard) ---------- */
.nelvin-logo {
	display: inline-flex;
	flex-shrink: 0;
}

/*
 * Width comes from the block setting (--nelvin-logo-w, inline on the link);
 * --nelvin-logo-scale shrinks it on small screens.
 */
.nelvin-logo--footer {
	--nelvin-logo-w: 160px;
}

.nelvin-logo__crop {
	position: relative;
	display: block;
	overflow: hidden;
	width: calc(var(--nelvin-logo-w, 130px) * var(--nelvin-logo-scale, 1));
	aspect-ratio: 130 / 55;
}

/* Uploaded logo (any aspect ratio). */
.nelvin-logo__img {
	display: block;
	width: calc(var(--nelvin-logo-w, 130px) * var(--nelvin-logo-scale, 1));
	max-width: 100%;
	height: auto;
	max-height: 96px;
	object-fit: contain;
	object-position: left center;
}

.nelvin-logo__crop img {
	position: absolute;
	top: -140.14%;
	left: -94.14%;
	width: 288.29%;
	height: 380.28%;
	max-width: none !important;
}

/* ---------- Section heading ---------- */
.nelvin-section-head {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 16px;
	width: 100%;
}

.nelvin-section-head__titles {
	display: flex;
	flex-direction: column;
	gap: 2.5px;
	padding-top: 5.5px;
}

.nelvin-section-head--center {
	justify-content: center;
	text-align: center;
}

.nelvin-section-head--center .nelvin-section-head__titles {
	align-items: center;
	max-width: 576px;
}

.nelvin-eyebrow {
	color: var(--nelvin-primary);
	font-size: 12px;
	font-weight: 700;
	line-height: 16px;
	letter-spacing: 0.6px;
	text-transform: uppercase;
}

.nelvin-heading {
	color: var(--nelvin-text);
	font-size: 16px;
	font-weight: 400;
	line-height: 24px;
}

.nelvin-section-head__intro {
	padding-top: 5.5px;
	color: var(--nelvin-muted);
	font-size: 16px;
	line-height: 24px;
}

.nelvin-link-arrow {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	color: var(--nelvin-text);
	font-size: 14px;
	font-weight: 700;
	line-height: 20px;
	letter-spacing: 0.14px;
	white-space: nowrap;
	transition: color 0.2s ease;
}

.nelvin-link-arrow:hover,
.nelvin-link-arrow:focus-visible {
	color: var(--nelvin-primary);
}

.nelvin-link-arrow .nelvin-icon {
	transition: transform 0.2s ease;
}

.nelvin-link-arrow:hover .nelvin-icon {
	transform: translateX(2px);
}

/* ---------- Badge / pill ---------- */
.nelvin-badge {
	display: inline-flex;
	align-items: flex-start;
	padding: 3.5px 8px;
	border-radius: 4px;
	background: var(--nelvin-secondary);
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	line-height: 16px;
	letter-spacing: 0.24px;
	white-space: nowrap;
}

/* ---------- Buttons ---------- */
.nelvin-btn {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 16px 48px;
	border: 0;
	border-radius: 8px;
	font-family: inherit;
	font-size: 14px;
	font-weight: 700;
	line-height: 20px;
	letter-spacing: 0.14px;
	white-space: nowrap;
	cursor: pointer;
	transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.nelvin-btn:hover {
	transform: translateY(-1px);
}

.nelvin-btn:focus-visible,
.nelvin-section a:focus-visible,
.nelvin-section button:focus-visible,
.nelvin-section input:focus-visible,
.nelvin-section select:focus-visible {
	outline: 2px solid var(--nelvin-secondary);
	outline-offset: 2px;
}

.nelvin-btn--secondary {
	background: var(--nelvin-secondary);
	color: #fff;
	box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

.nelvin-btn--secondary:hover {
	background: #4a0f8c;
	color: #fff;
}

/* Figma 17/49 padding is inside-stroke → 16/48 + 1px border = 54px tall. */
.nelvin-btn--glass {
	padding: 16px 48px;
	border: 1px solid rgba(251, 249, 248, 0.3);
	background: rgba(251, 249, 248, 0.1);
	color: var(--nelvin-base);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
}

.nelvin-btn--glass:hover {
	background: rgba(251, 249, 248, 0.2);
	color: var(--nelvin-base);
}

.nelvin-btn--light {
	background: var(--nelvin-base);
	color: var(--nelvin-text);
	box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

.nelvin-btn--light:hover {
	color: var(--nelvin-primary);
}

/* ---------- Newsletter form (newsletter block + footer) ---------- */
.nelvin-newsletter-form__row {
	display: flex;
	gap: 8px;
}

.nelvin-newsletter-form__input {
	flex: 1 0 0;
	min-width: 0;
	padding: 18px 16px;
	border: 1px solid transparent;
	border-radius: 8px;
	background: var(--nelvin-base);
	color: var(--nelvin-text);
	font-family: inherit;
	font-size: 16px;
	line-height: normal;
}

.nelvin-newsletter-form__input::placeholder {
	color: var(--nelvin-placeholder);
	opacity: 1;
}

.nelvin-newsletter-form__input[aria-invalid="true"] {
	border-color: var(--nelvin-sale);
}

.nelvin-newsletter-form__btn {
	flex-shrink: 0;
	padding: 17.5px 48px 18.5px;
	border: 0;
	border-radius: 8px;
	background: var(--nelvin-secondary);
	color: #fff;
	font-family: inherit;
	font-size: 14px;
	font-weight: 700;
	line-height: 20px;
	letter-spacing: 0.14px;
	white-space: nowrap;
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.nelvin-newsletter-form__btn:hover {
	background: #4a0f8c;
}

.nelvin-newsletter-form__btn:disabled {
	opacity: 0.7;
	cursor: wait;
}

.nelvin-newsletter-form__hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.nelvin-newsletter-form__msg {
	margin: 8px 0 0;
	font-size: 14px;
	line-height: 20px;
}

.nelvin-newsletter-form__msg:empty {
	display: none;
}

.nelvin-newsletter-form--banner .nelvin-newsletter-form__msg {
	color: #fff;
}

.nelvin-newsletter-form--banner.is-error .nelvin-newsletter-form__msg {
	font-weight: 700;
}

.nelvin-newsletter-form--compact .nelvin-newsletter-form__row {
	gap: 4px;
}

/* Figma 206×36: padding 9/16/10 + 17px text (incl. 1px transparent border). */
.nelvin-newsletter-form--compact .nelvin-newsletter-form__input {
	padding: 8px 15px 9px;
	border-radius: 4px;
	background: var(--nelvin-light);
	font-size: 14px;
	line-height: 17px;
}

.nelvin-newsletter-form--compact .nelvin-newsletter-form__btn {
	padding: 8px 16px;
	border-radius: 4px;
	background: var(--nelvin-primary);
}

.nelvin-newsletter-form--compact .nelvin-newsletter-form__btn:hover {
	background: #e25f00;
}

.nelvin-newsletter-form--compact.is-success .nelvin-newsletter-form__msg {
	color: #1a7f37;
}

.nelvin-newsletter-form--compact.is-error .nelvin-newsletter-form__msg {
	color: var(--nelvin-sale);
}

@media (max-width: 480px) {

	.nelvin-newsletter-form--banner .nelvin-newsletter-form__row {
		flex-direction: column;
	}
}

/* ---------- Accessibility ---------- */
.nelvin-sr-only {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.nelvin-skip-link:focus {
	position: fixed;
	z-index: 100000;
	top: 8px;
	left: 8px;
	width: auto;
	height: auto;
	padding: 12px 16px;
	clip: auto;
	background: #fff;
	color: var(--nelvin-text);
}

@media (prefers-reduced-motion: reduce) {

	.nelvin-section *,
	.nelvin-section *::before,
	.nelvin-section *::after {
		transition: none !important;
		animation: none !important;
	}
}

@media (max-width: 781px) {

	:root {
		--nelvin-gutter: 16px;
	}

	.nelvin-btn {
		padding: 14px 28px;
	}

	.nelvin-btn--glass {
		padding: 13px 27px; /* + 1px border = same height as .nelvin-btn */
	}
}

/*
 * WooCommerce inserts a "View cart" link after an AJAX add-to-cart button.
 * Where the side cart exists it opens instead (with View Cart / Checkout),
 * so the extra link would only break the card layout.
 */
body:has(#nelvin-side-cart) .nelvin-section .added_to_cart.wc-forward {
	display: none;
}

/* ---------- Star rating (CSS mask) ----------
 * Partial fill = --nelvin-stars (%). Used by the Customer Reviews block
 * and the product page reviews tab.
 */
.nelvin-stars {
	--nelvin-star-size: 16px;
	display: inline-block;
	flex-shrink: 0;
	width: calc(var(--nelvin-star-size) * 5);
	height: var(--nelvin-star-size);
	background: linear-gradient(90deg, #f59e0b var(--nelvin-stars, 0%), var(--nelvin-light) var(--nelvin-stars, 0%));
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.2l2.95 6.2 6.8.82-5 4.7 1.3 6.75L12 17.3l-6.05 3.37 1.3-6.75-5-4.7 6.8-.82z'/%3E%3C/svg%3E") left center / var(--nelvin-star-size) var(--nelvin-star-size) repeat-x;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.2l2.95 6.2 6.8.82-5 4.7 1.3 6.75L12 17.3l-6.05 3.37 1.3-6.75-5-4.7 6.8-.82z'/%3E%3C/svg%3E") left center / var(--nelvin-star-size) var(--nelvin-star-size) repeat-x;
}

.nelvin-stars--md {
	--nelvin-star-size: 20px;
}

.nelvin-stars--lg {
	--nelvin-star-size: 24px;
}
