/*
Theme Name: Sammy's Frozen Pizza Co.
Theme URI: https://sammysfrozenpizza.com
Author: Third Wish Creative
Author URI: https://thirdwishcreative.com
Description: Custom classic PHP + Gutenberg theme for Sammy's Frozen Pizza Co.
Requires at least: 6.7
Tested up to: 6.9
Requires PHP: 7.4
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: sammys
Update URI: false
Tags: one-column, custom-colors, custom-menu, custom-logo, editor-style, featured-images, block-styles, wide-blocks
*/

/*
 * Frontend overrides that can't live in theme.json belong here.
 * Design tokens (colors, type, spacing) are defined in theme.json — edit those there.
 */

/* Link underline thickness — see https://github.com/WordPress/gutenberg/issues/42319 */
a {
	text-decoration-thickness: 1px !important;
	text-underline-offset: 0.15em;
}

/* Skip link */
.skip-link {
	position: absolute;
	left: -9999px;
	top: 0;
	z-index: 999;
	padding: 0.75rem 1rem;
	background: var(--wp--preset--color--black);
	color: var(--wp--preset--color--white);
}
.skip-link:focus {
	left: 0;
}

.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	border: 0;
	word-wrap: normal !important;
}

/* ==========================================================================
   Site header  (WON-334)
   Pre-design scaffold styling — refine against the prototype.
   ========================================================================== */
.site-header {
	position: sticky;
	top: 0;
	z-index: 100;
	background-color: var(--wp--preset--color--tan);
	/* Breathing room at the very top of the page lives here as a margin
	   instead of as padding that animates on scroll. The header keeps a
	   single compact size, sticks to top:0 once the user has scrolled past
	   this margin, and never reflows mid-scroll (which was causing the
	   jitter from the old padding tween). */
	margin-top: 2.25rem;
}

.site-header__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1.5rem;
	max-width: var(--wp--style--global--content-size, 1230px);
	margin-inline: auto;
	padding: 0.75rem clamp(1rem, 4vw, 2rem);
}

/* Push the first content block down a bit instead of putting a margin on
   the sticky header. Margins on sticky elements ride along with them and
   create a "phantom" gap when stuck; padding-top on .site-main is always-on,
   predictable, and gives the resting page symmetric breathing room with
   the header's top margin. */
.site-main {
	padding-top: 2.25rem;
}

.site-header__brand .custom-logo {
	display: block;
	height: auto;
	max-height: 60px;
	width: auto;
	transition: filter 0.2s ease;
}

/* Hover state mirrors the nav link: red wordmark turns black. The logo is a
   single-color PNG/SVG so brightness(0) collapses every opaque pixel to black
   without needing a swapped asset. */
.site-header__brand .custom-logo-link:hover .custom-logo,
.site-header__brand .custom-logo-link:focus-visible .custom-logo {
	filter: brightness(0);
}

.site-header__brand .site-title {
	font-family: var(--wp--preset--font-family--md-nichrome);
	font-size: 1.75rem;
	line-height: 1;
	color: var(--wp--preset--color--red);
	text-decoration: none;
}

.site-nav__menu {
	display: flex;
	align-items: center;
	gap: clamp(1rem, 2.5vw, 2rem);
	margin: 0;
	padding: 0;
	list-style: none;
}

.site-nav__menu a {
	font-family: var(--wp--preset--font-family--md-nichrome);
	font-weight: 700;
	font-size: var(--wp--preset--font-size--button);
	text-transform: uppercase;
	letter-spacing: 0.05em;
	text-decoration: none;
	color: var(--wp--preset--color--red);
	transition: color 0.2s ease;
}

.site-nav__menu a:hover,
.site-nav__menu .current-menu-item > a {
	color: var(--wp--preset--color--black);
}

/* Mobile toggle */
.site-header__toggle {
	display: none;
	flex-direction: column;
	justify-content: center;
	gap: 5px;
	width: 44px;
	height: 44px;
	padding: 0;
	background: transparent;
	border: 0;
	cursor: pointer;
}

.site-header__toggle-bar {
	display: block;
	width: 28px;
	height: 3px;
	border-radius: 2px;
	background-color: var(--wp--preset--color--red);
	transition: transform 0.2s ease, opacity 0.2s ease;
}

@media (max-width: 900px) {
	.site-header__toggle {
		display: flex;
	}

	.site-nav {
		position: fixed;
		inset: 0;
		display: flex;
		align-items: center;
		justify-content: center;
		background-color: var(--wp--preset--color--tan);
		opacity: 0;
		visibility: hidden;
		transform: translateY(-100%);
		transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
	}

	.site-header.is-nav-open .site-nav {
		opacity: 1;
		visibility: visible;
		transform: translateY(0);
	}

	.site-nav__menu {
		flex-direction: column;
		gap: 1.5rem;
		text-align: center;
	}

	.site-nav__menu a {
		font-size: 1.75rem;
	}

	body.has-nav-open {
		overflow: hidden;
	}

	/* Burger → X */
	.site-header.is-nav-open .site-header__toggle-bar:nth-child(1) {
		transform: translateY(8px) rotate(45deg);
	}
	.site-header.is-nav-open .site-header__toggle-bar:nth-child(2) {
		opacity: 0;
	}
	.site-header.is-nav-open .site-header__toggle-bar:nth-child(3) {
		transform: translateY(-8px) rotate(-45deg);
	}
}

/* ==========================================================================
   Site footer  (WON-335)
   Design (Figma node 73:329): tan band, big red wordmark centered.
   No nav, no copyright — just the brand mark.
   ========================================================================== */
.site-footer {
	background-color: var(--wp--preset--color--tan);
	padding-block: clamp(3rem, 8vw, 6.5rem);
}

.site-footer__inner {
	max-width: var(--wp--style--global--content-size, 1230px);
	margin-inline: auto;
	padding-inline: clamp(1rem, 4vw, 2rem);
	text-align: center;
}

/* Same custom-logo asset as the header, displayed much larger here.
   The wordmark SVG scales cleanly so a single asset handles both spots. */
.site-footer .custom-logo-link {
	display: inline-block;
	max-width: 716px;
	width: 100%;
}

.site-footer .custom-logo {
	max-height: none;
	width: 100%;
	height: auto;
	display: block;
}

/* Fallback when no custom logo is set */
.site-footer__title {
	font-family: var(--wp--preset--font-family--md-nichrome);
	color: var(--wp--preset--color--red);
	font-size: var(--wp--preset--font-size--x-large);
	text-decoration: none;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

/* ==========================================================================
   Page chrome
   ========================================================================== */
.page-header {
	margin-block: clamp(2rem, 5vw, 3.5rem) clamp(1.5rem, 3vw, 2rem);
}

/* ==========================================================================
   Halftone card — brand signature treatment
   Outlined rounded rectangle wrapped by a band of red dots, used by the
   Home hero, interior heroes, and the shared "No Salad Party" CTA.
   The dot band is a pseudo-element using the dot-border SVG as a 9-slice
   border-image (approach lifted from the mysammys theme).
   ========================================================================== */
.wp-block-group.is-style-halftone-card {
	position: relative;
	border: 4px solid var(--wp--preset--color--red);
	border-radius: 10px;
	padding: clamp(2.5rem, 6vw, 4.5rem);
	/*
	 * Reserve 42px on each side for the ::before halftone band, which is
	 * absolutely positioned with inset:-42px. Without this, an alignwide
	 * card fills wideSize and the outer dot columns get clipped at the
	 * viewport edge. max-width keeps the card narrower than its parent
	 * by exactly the halftone reach, so the pseudo never overflows.
	 */
	max-width: calc(100% - 84px);
	margin: 42px auto;
	background-color: var(--wp--preset--color--tan);
}

.wp-block-group.is-style-halftone-card::before {
	content: '';
	position: absolute;
	inset: -42px;
	pointer-events: none;
	border: 42px solid transparent;
	border-image: url('assets/images/dot-border.svg') 42 round;
}

/* The halftone band sits outside the card — let descendants stack above it. */
.wp-block-group.is-style-halftone-card > * {
	position: relative;
	z-index: 1;
}

/* On smaller screens shrink the dot band so it doesn't overpower the card. */
@media (max-width: 640px) {
	.wp-block-group.is-style-halftone-card {
		max-width: calc(100% - 48px);
		padding: clamp(1.5rem, 6vw, 2.5rem);
		margin: 24px auto;
	}
	.wp-block-group.is-style-halftone-card::before {
		inset: -24px;
		border-width: 24px;
		border-image-slice: 42;
	}
}

/* ==========================================================================
   Home hero — pizzas image inside the halftone card
   ========================================================================== */
.sammys-home-hero__image img {
	border-radius: 10px;
	display: block;
	width: 100%;
	height: auto;
}

/* ==========================================================================
   Featured Pizzas grid (WON-339)
   Each card is a rounded photo with a tan multiply overlay (warm/aged look
   from the Figma design: `bg-[#f6ebdf] mix-blend-multiply`).
   ========================================================================== */
.sammys-pizza-card__image {
	position: relative;
	margin: 0;
	border-radius: 10px;
	overflow: hidden;
}

.sammys-pizza-card__image::after {
	content: '';
	position: absolute;
	inset: 0;
	background-color: var(--wp--preset--color--tan);
	mix-blend-mode: multiply;
	pointer-events: none;
}

.sammys-pizza-card__image img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* ==========================================================================
   Shared Salad Party CTA — pizza slice photo (WON-343)
   Matches the design's rounded-[10px] on the image.
   ========================================================================== */
.sammys-salad-cta__image img {
	border-radius: 10px;
	display: block;
	width: 100%;
	height: auto;
}

/* ==========================================================================
   Our Story narrative — Sam & Louise photo (WON-346) + decorative badges
   The badges, curved arrow and "Sam & Louise" caption are positioned absolute
   relative to the photo wrapper, scaled with the photo via percentages.
   Reference: Figma node 73:440 (Our Story 2), photo container @ x=940,y=673,
   290×281, badges/arrow at the offsets below.
   ========================================================================== */
.sammys-story-narrative__photo-frame {
	position: relative;
	/* Reserve room around the photo so the slice-ring badge can poke up
	   above and the caption + arrow can sit below. */
	padding-top: 18%;
	padding-bottom: 22%;
}

.sammys-story-narrative__photo {
	margin: 0;
	position: relative;
	z-index: 1;
}

.sammys-story-narrative__photo img {
	border-radius: 10px;
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Both ornaments are now self-contained SVGs (no layer stacking). */
.sammys-story-narrative__badge {
	position: absolute;
	display: block;
	z-index: 2;
}

/* Top badge — red disc + curved "FAMILY · TRADITIONS · FRIENDS" text,
   poking above the photo's top-right corner. */
.sammys-story-narrative__badge--top {
	width: 40%;
	top: 0;
	right: 5%;
}

/* Bottom badge — halftone ring + tan inner disc + hand+pizza illustration,
   overlapping the photo's bottom-right corner. */
.sammys-story-narrative__badge--bottom {
	width: 48%;
	bottom: 12%;
	right: -10%;
}

/* "Sam & Louise" caption + arrow — single self-contained SVG anchored to
   the bottom-left of the photo frame at the design spec's 152px width. */
.sammys-story-narrative__caption {
	position: absolute;
	left: 0;
	bottom: 0;
	width: 152px;
	height: auto;
	max-width: 50%;
	z-index: 2;
	pointer-events: none;
}

/* ==========================================================================
   Baking Instructions photo (WON-355)
   ========================================================================== */
.sammys-baking-section__photo {
	margin: 0;
}
.sammys-baking-section__photo img {
	border-radius: 10px;
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* ==========================================================================
   Fundraising — order-form image (WON-359)
   Matches the design's `shadow-[4px_4px_14px_0px_rgba(0,0,0,0.1)]` drop.
   ========================================================================== */
.sammys-fundraising-intro__form-img {
	margin: 0;
}
.sammys-fundraising-intro__form-img img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	box-shadow: 4px 4px 14px rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   Wholesale / Contact Gravity Form (WON-365)
   IMPORTANT: GF appends `_wrapper` to our cssClass, so the wrapper ends up as
   `.sammys-inquiry-form_wrapper`, NOT `.sammys-inquiry-form`. All selectors
   target that. Also overrides Orbital-theme CSS variables where useful.
   Values are pulled from the Figma design (node 80:910).
   ========================================================================== */
/* All selectors are scoped to the `#sammys-inquiry-form` wrapper we drop
   around the [gravityform] shortcode in the wholesale-inquiry pattern —
   one ID in the selector gives every rule (1,0,0) specificity, enough to
   reliably beat the Orbital theme's `#gform_wrapper_1[data-form-index="0"]`
   inline-injected styles without resorting to `!important` everywhere.
   Only the width override keeps !important, since `.ginput_container`
   widths also have a layout-shifting inline component. */

#sammys-inquiry-form .gform_fields {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 1.5rem 1rem;
}

/* Default: each field spans both columns (most fields in the design are wide) */
#sammys-inquiry-form .gfield {
	grid-column: 1 / -1;
}

/* Email (id=4) + Phone (id=5) and State (id=8) + Zip (id=9) sit 50/50 */
#sammys-inquiry-form #field_1_4,
#sammys-inquiry-form #field_1_5,
#sammys-inquiry-form #field_1_8,
#sammys-inquiry-form #field_1_9 {
	grid-column: auto;
}

/* Labels — Trade Gothic Next LT Pro Bold, red, 18px, uppercase, 0.05em */
#sammys-inquiry-form .gfield_label {
	font-family: var(--wp--preset--font-family--trade-gothic);
	color: var(--wp--preset--color--red);
	font-weight: 700;
	font-size: 1.125rem;   /* 18px */
	letter-spacing: 0.05em;
	line-height: 1.2;
	text-transform: uppercase;
	margin-bottom: 0.5rem;
	display: block;
}

/* Required indicator — swap "(Required)" for a visible "*", keep the
   original text in the DOM for screen readers so the field is still
   announced as required. */
#sammys-inquiry-form .gfield_required_text {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

#sammys-inquiry-form .gfield_required:not(.gfield_required_text)::after {
	content: "*";
	color: var(--wp--preset--color--red);
	margin-left: 0.05em;
}

/* Width fix — the `.ginput_container` wrapper that Gravity Forms inserts
   around each input has a layout-affecting inline rule from Orbital. !important
   on width here is the only safe way to make Email/Phone/State/Zip fill their
   50% grid cell. */
#sammys-inquiry-form .ginput_container,
#sammys-inquiry-form .ginput_complex {
	width: 100% !important;
	max-width: 100% !important;
	box-sizing: border-box;
}

#sammys-inquiry-form .ginput_container input,
#sammys-inquiry-form .ginput_container select,
#sammys-inquiry-form .ginput_container textarea {
	width: 100% !important;
	max-width: 100% !important;
	box-sizing: border-box;
}

/* Inputs / selects / textarea — white pill cards
   (10px radius, asymmetric 22px-left padding per design 80:991/80:1004) */
#sammys-inquiry-form input[type="text"],
#sammys-inquiry-form input[type="email"],
#sammys-inquiry-form input[type="tel"],
#sammys-inquiry-form input[type="url"],
#sammys-inquiry-form input[type="number"],
#sammys-inquiry-form select,
#sammys-inquiry-form textarea {
	padding: 10px 10px 10px 22px;
	border: 0;
	border-radius: 10px;
	background-color: #fff;
	color: rgba(0, 0, 0, 0.9);
	font-family: var(--wp--preset--font-family--trade-gothic);
	font-size: 1rem;        /* 16px per design */
	line-height: 1.2;
	box-shadow: none;
}

#sammys-inquiry-form textarea {
	padding: 22px 10px 10px 22px;
	min-height: 7rem;
	resize: vertical;
}

#sammys-inquiry-form ::placeholder {
	color: rgba(0, 0, 0, 0.25);
	opacity: 1;
}

#sammys-inquiry-form input:focus,
#sammys-inquiry-form select:focus,
#sammys-inquiry-form textarea:focus {
	outline: 2px solid var(--wp--preset--color--red);
	outline-offset: 1px;
}

#sammys-inquiry-form .gform_footer {
	grid-column: 1 / -1;
	margin-top: 1.5rem;
	padding: 0;
	display: flex;
	justify-content: flex-start;
}

/* Submit button — true pill (border-radius 100px), 22px MD Nichrome,
   tan text on red, 15/20 padding to match the design's other pill buttons. */
#sammys-inquiry-form .gform_button {
	background-color: var(--wp--preset--color--red);
	color: var(--wp--preset--color--tan);
	font-family: var(--wp--preset--font-family--md-nichrome);
	font-size: var(--wp--preset--font-size--button);  /* 22px */
	font-weight: 700;
	line-height: 1;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	padding: 15px 20px;
	border: 0;
	border-radius: 999px;
	box-shadow: none;
	cursor: pointer;
}

#sammys-inquiry-form .gform_button:hover,
#sammys-inquiry-form .gform_button:focus {
	background-color: var(--wp--preset--color--black);
	color: var(--wp--preset--color--tan);
}

/* Single column on small screens */
@media (max-width: 640px) {
	#sammys-inquiry-form .gform_fields {
		grid-template-columns: 1fr;
	}
	#sammys-inquiry-form #field_1_4,
	#sammys-inquiry-form #field_1_5,
	#sammys-inquiry-form #field_1_8,
	#sammys-inquiry-form #field_1_9 {
		grid-column: 1 / -1;
	}
}

/* ==========================================================================
   Sammy's Through the Years — Swiper coverflow carousel (WON-347)
   Splide-style "padding" effect via slide width: each slide is
   `(container width − 2 × peek)` wide, so the prev/next show as a strip of
   `peek` on either side of the centered active. Tune `--peek` to taste.
   Selectors include `.swiper.sammys-...` to outweigh Swiper's bundled CSS.
   ========================================================================== */
/* Wrap = positioning context for the prev/next pills (they sit BELOW the
   swiper, so they have to live outside `.swiper` — which keeps its default
   overflow:hidden so side slides don't escape the wide container). */
.sammys-traditions-carousel-wrap {
	position: relative;
	width: 100%;
	margin-inline: auto;
}

.swiper.sammys-traditions-carousel {
	--peek: clamp(2rem, 9vw, 10rem);
	position: relative;
	width: 100%;
	margin-inline: auto;
	padding-block: 1.5rem;
	/* overflow stays hidden (Swiper default) → slides are contained, the
	   alignwide wrapper isn't blown out by the loop'd extra slides. */
}

.swiper.sammys-traditions-carousel .swiper-wrapper {
	align-items: center;
}

.swiper.sammys-traditions-carousel .swiper-slide.sammys-traditions-carousel__slide {
	width: calc(100% - 2 * var(--peek));
	aspect-ratio: 602 / 388;
	border-radius: 10px;
	overflow: hidden;
	background-color: var(--wp--preset--color--tan);
	transition: opacity 0.4s ease;
	opacity: 0.55;
}

.swiper.sammys-traditions-carousel .swiper-slide.swiper-slide-active {
	opacity: 1;
}

.sammys-traditions-carousel__slide img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 10px;
}

/* Prev / Next controls — circular red, sits below the slides.
   Selectors override Swiper's runtime hiding classes (button-lock,
   button-hidden, navigation-disabled) and translateZ lifts the buttons
   above the 3D-transformed coverflow slides so they aren't depth-clipped. */
.swiper.sammys-traditions-carousel .sammys-traditions-carousel__nav,
.sammys-traditions-carousel__nav {
	position: absolute;
	bottom: -3.5rem;
	left: 50%;
	z-index: 30;
	width: 44px;
	height: 44px;
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	border: 0;
	border-radius: 999px;
	background-color: var(--wp--preset--color--red);
	color: var(--wp--preset--color--tan);
	cursor: pointer;
	opacity: 1 !important;
	pointer-events: auto !important;
	transition: background-color 0.2s ease;
}

/* Hover/focus colour change */
.sammys-traditions-carousel__nav:hover,
.sammys-traditions-carousel__nav:focus-visible {
	background-color: var(--wp--preset--color--black);
}

/* Position the pair side-by-side at the bottom centre, with translateZ
   so the buttons sit in front of any coverflow depth-shifted slide */
.swiper.sammys-traditions-carousel .sammys-traditions-carousel__prev,
.sammys-traditions-carousel__prev {
	transform: translate3d(calc(-50% - 32px), 0, 1px);
}

.swiper.sammys-traditions-carousel .sammys-traditions-carousel__next,
.sammys-traditions-carousel__next {
	transform: translate3d(calc(-50% + 32px), 0, 1px);
}

/* Subdued look on the edges (only relevant when loop:false; harmless otherwise) */
.sammys-traditions-carousel__nav.swiper-button-disabled {
	opacity: 0.4 !important;
	cursor: not-allowed;
}

/* Add room below the slides so the prev/next don't overlap the next section */
.sammys-traditions {
	padding-bottom: 7rem !important;
}

/* ==========================================================================
   Scroll animations (assets/js/scroll-animations.js)
   --------------------------------------------------------------------------
   The script tags elements with `is-scroll-fade` / `is-ornament-reveal` /
   `is-video-fade` on load, then adds `is-visible` when the IntersectionObserver
   fires. CSS owns the visuals so reduced-motion users (where the JS bails)
   never see a hidden state. Each transition lasts long enough to read but
   short enough to not block scroll momentum.
   ========================================================================== */

/* Section fade-up: opacity + small Y, 0.6s power2.out-ish */
.is-scroll-fade {
	opacity: 0;
	transform: translateY(24px);
	transition:
		opacity 0.6s cubic-bezier(0.215, 0.61, 0.355, 1),
		transform 0.6s cubic-bezier(0.215, 0.61, 0.355, 1);
	will-change: opacity, transform;
}
.is-scroll-fade.is-visible {
	opacity: 1;
	transform: none;
}

/* Ornament reveal: back.out(1.4) overshoot, 0.5s with a small lead-in delay
   so it lands after the photo has settled, not on top of an empty frame. */
.is-ornament-reveal {
	opacity: 0;
	transform: scale(0.85);
	transition:
		opacity 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s,
		transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s;
	will-change: opacity, transform;
}
.is-ornament-reveal.is-visible {
	opacity: 1;
	transform: none;
}

/* Video crossfade over its poster image. Starts at 0; tag bumps to 1 on
   the `playing` event so we never expose the first decoded frame jump. */
.is-video-fade {
	opacity: 0;
	transition: opacity 0.8s ease-in-out;
}
.is-video-fade.is-visible {
	opacity: 1;
}

/* Honor reduced-motion: skip all transitions, show everything as-is. The JS
   already bails for this MQ, but the CSS guard handles edge cases (no-JS,
   user toggling the OS setting mid-session, etc.). */
@media (prefers-reduced-motion: reduce) {
	.is-scroll-fade,
	.is-ornament-reveal,
	.is-video-fade {
		opacity: 1;
		transform: none;
		transition: none;
	}
}
