/*
Theme Name: Superfoods
Author: Christopher Barnard
Author URI: 
Theme URI: 
Tags: full-site-editing, editor-style, block-styles, block-patterns
Text Domain: superfoods
Requires at least: 6.3
Requires PHP: 7.4
Tested up to: 6.3
Version: 1.0.0

License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/

/* h2 — section label pill */
h2.wp-block-heading {
	display: inline-block;
	font-size: clamp(0.95rem, 1.25vw, 1.1rem);
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	border: 1.5px solid currentColor;
	border-radius: 50px;
	padding: 0.4em 1.2em;
	line-height: 1.4;
}

/* Footer grid — first column wider */
footer.wp-block-template-part .alignwide.is-layout-grid {
	grid-template-columns: 2fr 1fr 1fr 1fr !important;
}

@media (max-width: 781px) {
	footer.wp-block-template-part .alignwide.is-layout-grid {
		grid-template-columns: 1fr !important;
	}

	footer.wp-block-template-part .alignwide > .wp-block-group:first-child {
		padding-right: 0;
	}
}

/* Footer first column — right padding */
footer.wp-block-template-part .alignwide > .wp-block-group:first-child {
	padding-right: 2rem;
}

/* Footer headings */
footer.wp-block-template-part h4.wp-block-heading {
	font-size: 0.75rem !important;
	text-transform: uppercase;
	letter-spacing: 0.08em;
}

body {
	-moz-osx-font-smoothing: grayscale;
	-webkit-font-smoothing: antialiased;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
}

.wp-site-blocks {
	flex: 1;
	display: flex;
	flex-direction: column;
}

.wp-site-blocks > footer.wp-block-template-part {
	margin-top: auto;
}

/* Top bar — home only */
body:not(.home) .sf-top-bar {
	display: none;
}

/* Top bar — full width */
.sf-top-bar {
	width: 100vw;
	max-width: 100vw;
	margin-top: 0 !important;
	margin-left: calc(50% - 50vw);
	margin-right: calc(50% - 50vw);
	box-sizing: border-box;
	background: #FAFAF7 !important;
	color: var(--wp--preset--color--contrast) !important;
	padding-top: 0.25rem !important;
	padding-bottom: 0.25rem !important;
	font-size: 0.95rem !important;
	border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

/* ── Header fade-in animations ── */
@keyframes sf-fade-up {
	from {
		opacity: 0;
		transform: translateY(-8px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes sf-fade-in {
	from { opacity: 0; }
	to   { opacity: 1; }
}

/* Hero — top gradient overlay for nav legibility */
.home .wp-block-cover::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 50%;
	background: linear-gradient(to bottom, rgba(0, 0, 0, 0.75) 0%, transparent 100%);
	z-index: 1;
	pointer-events: none;
}

/* Hero badge */
.wp-block-cover__inner-container > p:first-child {
	animation: sf-fade-in 0.6s ease both;
	animation-delay: 0.1s;
}

/* Hero heading */
.wp-block-cover__inner-container h1 {
	animation: sf-fade-in 0.6s ease both;
	animation-delay: 0.35s;
	font-size: clamp(2.25rem, 3vw, 5rem) !important;
}

/* Hero buttons */
.wp-block-cover__inner-container .wp-block-buttons {
	animation: sf-fade-in 0.6s ease both;
	animation-delay: 0.6s;
}

/* ── Register Modal ── */
.sf-modal {
	position: fixed;
	inset: 0;
	z-index: 9999;
	display: flex;
	align-items: center;
	justify-content: center;
}

.sf-modal[hidden] {
	display: none;
}

.sf-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
}

.sf-modal__dialog {
	position: relative;
	background: #FAFAF7;
	border-radius: 10px;
	padding: 2.5rem;
	width: min(480px, 92vw);
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.sf-modal__close {
	position: absolute;
	top: 1rem;
	right: 1rem;
	background: none;
	border: none;
	font-size: 1.5rem;
	cursor: pointer;
	line-height: 1;
	color: var(--wp--preset--color--contrast);
	padding: 0.25rem;
}

.sf-modal__title {
	margin: 0 0 1rem;
	font-size: var(--wp--preset--font-size--large);
}

.sf-modal__subtitle {
	margin: 0 0 1.5rem;
	color: #666;
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.3;
}

.sf-modal__field {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	margin-bottom: 1rem;
}

.sf-modal__field label {
	font-size: 0.7rem;
	font-weight: 600;
}

.sf-modal__field input {
	padding: 0.6rem 0.85rem;
	border: 1px solid #ddd;
	border-radius: 5px;
	font-size: var(--wp--preset--font-size--small);
	width: 100%;
}

.sf-modal__field input:focus {
	outline: 2px solid var(--wp--preset--color--primary);
	border-color: transparent;
}

.sf-modal__submit {
	width: 100%;
	padding: 0.7rem 1rem;
	background: var(--wp--preset--color--primary);
	color: #fff;
	border: none;
	border-radius: 5px;
	font-size: var(--wp--preset--font-size--small);
	font-weight: 700;
	cursor: pointer;
	margin-top: 0.5rem;
	transition: opacity 0.2s ease;
}

.sf-modal__submit:hover {
	opacity: 0.85;
}

.sf-modal__divider {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	margin: 1rem 0;
	color: #aaaaaa;
	font-size: 0.75rem;
}

.sf-modal__divider::before,
.sf-modal__divider::after {
	content: '';
	flex: 1;
	height: 1px;
	background: #eeeeee;
}

#sf-google-btn {
	margin-bottom: 0.25rem;
}

#sf-google-btn > div {
	width: 100% !important;
}

.sf-modal__login-link {
	text-align: center;
	margin: 0.5rem 0 0;
	font-size: 0.75rem;
	font-family: var(--wp--preset--font-family--lora);
	color: #555;
}

/* Search toggle icon */
.sf-search-toggle {
	background: none;
	border: none;
	cursor: pointer;
	align-items: center;
	color: currentColor !important;
	display: flex;
	gap: 0.5em;
	line-height: 1;
	padding: 0.5em;
	text-decoration: none !important;
	white-space: nowrap;
}

/* Search overlay */
.sf-search-overlay {
	position: fixed;
	left: 0;
	width: 100%;
	z-index: 999;
	background: #FAFAF7;
	box-shadow: 0 4px 24px rgba(0,0,0,0.12);
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s ease;
}

.sf-search-overlay.is-open {
	opacity: 1;
	pointer-events: auto;
}

.sf-search-overlay__form {
	display: flex;
	align-items: center;
	max-width: 1440px;
	margin: 0 auto;
	padding: 1rem 40px;
	gap: 0.75rem;
}

.sf-search-overlay__input {
	flex: 1;
	border: none;
	outline: none;
	font-size: 1.1rem;
	font-family: var(--wp--preset--font-family--dm-sans);
	color: var(--wp--preset--color--contrast);
	background: none;
	min-width: 0;
}

.sf-search-overlay__input::placeholder {
	color: #aaa;
}

.sf-search-overlay__submit,
.sf-search-overlay__close {
	background: none;
	border: none;
	cursor: pointer;
	color: var(--wp--preset--color--contrast);
	display: flex;
	align-items: center;
	padding: 0.25rem;
	transition: opacity 0.15s ease;
}

.sf-search-overlay__submit:hover,
.sf-search-overlay__close:hover {
	opacity: 0.6;
}

/* Hero search */
.sf-hero-search {
	display: flex;
	align-items: center;
	margin-top: 1.75rem;
	background: rgba(255, 255, 255, 0.15);
	border: 1.5px solid rgba(255, 255, 255, 0.6);
	border-radius: 50px;
	padding: 0.3rem 0.3rem 0.3rem 1.25rem;
	backdrop-filter: blur(6px);
	max-width: 480px;
	margin-left: auto;
	margin-right: auto;
}

.sf-hero-search__input {
	flex: 1;
	background: none;
	border: none;
	outline: none;
	color: #ffffff;
	font-size: 0.9rem;
	font-family: var(--wp--preset--font-family--dm-sans);
	min-width: 0;
}

.sf-hero-search__input::placeholder {
	color: rgba(255, 255, 255, 0.7);
}

.sf-hero-search__btn {
	flex-shrink: 0;
	background: #ffffff;
	border: none;
	border-radius: 50px;
	width: 36px;
	height: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	color: var(--wp--preset--color--contrast);
	transition: opacity 0.2s ease;
}

.sf-hero-search__btn:hover {
	opacity: 0.85;
}

/* Since badge */
.sf-since-badge {
	display: inline-block;
	background: rgba(255, 255, 255, 0.15);
	color: #ffffff;
	border: 1px solid rgba(255, 255, 255, 0.5);
	border-radius: 50px;
	padding: 0.3em 1em;
	font-size: 0.8rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	font-family: var(--wp--preset--font-family--lora);
	backdrop-filter: blur(4px);
}

/* Global button colour */
.wp-block-button__link,
.wp-element-button {
	background-color: #078542 !important;
	color: #ffffff !important;
	border-color: #078542 !important;
	transition: transform 0.2s ease, opacity 0.2s ease, background-color 0.2s ease !important;
}

.wp-block-button__link:hover {
	transform: translateY(-2px);
	opacity: 0.9;
}

/* Hero buttons — size */
.wp-block-cover .wp-block-button__link {
	font-size: 1.15rem !important;
	padding: 0.4em 0.9em !important;
}

/* Hero buttons — equal width */
.wp-block-cover .wp-block-buttons .wp-block-button {
	flex: 1;
	max-width: 220px;
}

.wp-block-cover .wp-block-buttons .wp-block-button .wp-block-button__link {
	width: 100% !important;
	text-align: center;
}

@media (max-width: 480px) {
	.wp-block-cover .wp-block-buttons {
		flex-direction: column !important;
		align-items: stretch !important;
	}

	.wp-block-cover .wp-block-buttons .wp-block-button {
		max-width: 100%;
		width: 100%;
	}
}

/* Hero buttons — hover */
.wp-block-cover .wp-block-button.is-style-outline .wp-block-button__link:hover {
	background: #ffffff !important;
	color: #000000 !important;
}

.wp-block-cover .wp-block-button:not(.is-style-outline) .wp-block-button__link:hover {
	background: rgba(255, 255, 255, 0.85) !important;
}

/* Hero buttons — colours */
.wp-block-cover .wp-block-button.is-style-outline .wp-block-button__link {
	background-color: transparent !important;
	color: #ffffff !important;
	border-color: #ffffff !important;
}

.wp-block-cover .wp-block-button:not(.is-style-outline) .wp-block-button__link {
	background-color: #FAFAF7 !important;
	color: #000000 !important;
	border-color: transparent !important;
}

/* Header buttons */
header.wp-block-template-part .wp-block-buttons .wp-block-button:first-child .wp-block-button__link {
	background: transparent !important;
	color: #ffffff !important;
	border: 2px solid #ffffff !important;
	font-family: var(--wp--preset--font-family--lora) !important;
}

header.wp-block-template-part .wp-block-buttons .wp-block-button:last-child .wp-block-button__link {
	background: #ffffff !important;
	color: #000000 !important;
	border: 2px solid #ffffff !important;
	font-family: var(--wp--preset--font-family--lora) !important;
}

/* Header white text */
header.wp-block-template-part .wp-block-site-title a {
	color: #ffffff;
}

/* Account + cart bubble */
header.wp-block-template-part .sf-header-icons {
	border-radius: 50px;
	padding: 0.3rem 0.75rem;
	gap: 0.75rem;
}

header.wp-block-template-part .sf-header-icons .wc-block-mini-cart__button,
header.wp-block-template-part .sf-header-icons .wc-block-customer-account__account-icon {
	color: #000000;
}

/* White icons + transparent bubble on home page before scroll */
.home header.wp-block-template-part:not(.is-scrolled) .sf-header-icons {
	background: transparent;
	border-color: #ffffff;
}

.home header.wp-block-template-part:not(.is-scrolled) .wc-block-mini-cart__button,
.home header.wp-block-template-part:not(.is-scrolled) .wp-block-woocommerce-customer-account a,
.home header.wp-block-template-part:not(.is-scrolled) .wc-block-mini-cart__icon,
.home header.wp-block-template-part:not(.is-scrolled) .wc-block-customer-account__account-icon {
	color: #ffffff;
}

/* Light background on inner pages */
body:not(.home) header.wp-block-template-part {
	background: #f9f9f7;
	border-bottom: 1px solid #eeeeee;
}

/* Header content — constrain to 1440px on all pages */
header.wp-block-template-part .wc-blocks-header-pattern {
	max-width: 1440px;
	margin-left: auto;
	margin-right: auto;
	box-sizing: border-box;
	padding-top: 12px !important;
	padding-bottom: 12px !important;
	padding-left: 0 !important;
	padding-right: 0 !important;
}

@media (max-width: 781px) {
	body {
		--wp--style--root--padding-left: 1rem;
		--wp--style--root--padding-right: 1rem;
	}

	header.wp-block-template-part .wc-blocks-header-pattern {
		padding-left: 20px !important;
		padding-right: 20px !important;
	}
}

/* Mobile: icons left of burger */
@media (max-width: 1280px) {
	header.wp-block-template-part .wc-blocks-header-pattern .wp-block-column:nth-child(2) {
		order: 3;
		padding-left: 0 !important;
	}

	header.wp-block-template-part .wc-blocks-header-pattern .wp-block-column:nth-child(3) {
		order: 2;
	}

	/* Equalise icon spacing */
	header.wp-block-template-part .sf-header-icons {
		justify-content: flex-end;
		gap: 0.75rem;
	}

	header.wp-block-template-part .sf-header-icons .sf-search-toggle,
	header.wp-block-template-part .sf-header-icons .wc-block-mini-cart__button,
	header.wp-block-template-part .sf-header-icons .wp-block-woocommerce-customer-account a {
		padding: 0;
		margin: 0;
		display: flex;
		align-items: center;
	}

	header.wp-block-template-part .sf-nav__toggle {
		padding: 0;
		margin: 0;
	}
}

/* Logo size */
header.wp-block-template-part .wp-block-site-logo img {
	width: 84px !important;
	height: auto !important;
}

/* Logo on inner pages */
body:not(.home) header.wp-block-template-part .wp-block-site-logo img {
	width: 84px !important;
	height: auto !important;
}


/* Smooth logo resize */
header.wp-block-template-part .wp-block-site-logo img {
	transition: width 0.3s ease, height 0.3s ease;
}

/* Fixed header on front page only */
.home header.wp-block-template-part {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	z-index: 100;
	transition: background 0.3s ease;
}

.home.admin-bar header.wp-block-template-part {
	top: 32px;
}

@media screen and (max-width: 782px) {
	.home.admin-bar header.wp-block-template-part {
		top: 46px;
	}
}

/* White background + compact size once scrolled */
.home header.wp-block-template-part {
	transition: background 0.3s ease, padding 0.3s ease;
}

.home header.wp-block-template-part.is-scrolled {
	background: #FAFAF7 !important;
	color: var(--wp--preset--color--contrast);
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.home header.wp-block-template-part.is-scrolled .wp-block-group.wc-blocks-header-pattern {
	padding-top: 10px !important;
	padding-bottom: 10px !important;
}

.home header.wp-block-template-part.is-scrolled .wp-block-site-logo img {
	width: 52px !important;
	height: auto !important;
	transition: width 0.3s ease, height 0.3s ease;
}

.home header.wp-block-template-part.is-scrolled .wp-block-site-title a,
.home header.wp-block-template-part.is-scrolled .wc-block-mini-cart__button,
.home header.wp-block-template-part.is-scrolled .wc-block-customer-account__account-icon,
.home header.wp-block-template-part.is-scrolled .sf-nav__list li a {
	color: var(--wp--preset--color--contrast);
}

.home header.wp-block-template-part.is-scrolled .wc-block-mini-cart__button svg,
.home header.wp-block-template-part.is-scrolled .wc-block-customer-account__account-icon svg {
	width: 24px !important;
	height: 24px !important;
}

/* Section headings with trailing line */
.sf-section-header .wp-block-heading {
	font-size: 1.4rem;
	white-space: nowrap;
	text-transform: none;
	letter-spacing: 0;
}

.sf-section-header {
	display: flex;
	align-items: center;
	gap: 1rem;
	margin-bottom: 1.5rem;
}

.sf-section-header::after {
	content: '';
	flex: 1;
	height: 1px;
	background: currentColor;
	opacity: 0.15;
}

