/*
Theme Name: WordPress
Theme URI:
Author:
Author URI:
Description: Custom WordPress theme built with AppBuilder
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.4
Requires PHP: 8.0
License: GNU General Public License v2 or later
Text Domain: my-theme
*/

/*
 * Component styling lives in assets/css/design-tokens.css and
 * assets/css/main.css, both enqueued from functions.php, and in pages.css
 * and order.css, enqueued from there too.
 *
 * This file carries the theme metadata plus the RESPONSIVE FOUNDATION that
 * every template inherits: the shared breakpoints, fluid typography and the
 * overflow guards that keep any page scroll-free from 320px upwards.
 * It is enqueued last (depends on franchesco-main), so these rules win.
 *
 * SHARED BREAKPOINTS — use only these three, everywhere in the theme:
 *   max-width: 480px   phones                    (--bp-sm)
 *   max-width: 768px   large phones / phablets   (--bp-md)
 *   max-width: 1024px  tablets                   (--bp-lg)
 * Above 1024px nothing below changes: the desktop layout is untouched.
 */

/* ---------- Fluid typography ----------
   Each clamp() maxes out at the exact token value used before, so type above
   1024px is pixel-identical; only narrow viewports scale down. Body copy is
   never scaled below 1rem (16px) so it stays readable on any device. */

:root {
	--text-base: 1rem;
	--text-lg: clamp(1.0625rem, 1rem + 0.35vw, 1.125rem);
	--text-xl: clamp(1.1875rem, 1.1rem + 0.5vw, 1.333rem);
	--text-2xl: clamp(1.45rem, 1.25rem + 1.1vw, 1.777rem);
	--text-3xl: clamp(1.75rem, 1.35rem + 2.1vw, 2.369rem);
	--text-4xl: clamp(2.125rem, 1.5rem + 3.2vw, 3.157rem);

	/* Gutters shrink on phones but hold at 1.5rem from ~600px up. */
	--container-padding: clamp(1rem, 4vw, 1.5rem);
}

/* ---------- Overflow guards ----------
   Relative units everywhere plus these rules mean no element can push the
   viewport wider than the screen at 320–414px. */

html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
}

body {
	min-width: 0;
	overflow-wrap: break-word;
}

h1,
h2,
h3,
h4,
h5,
h6 {
	overflow-wrap: break-word;
}

/* Long unbreakable strings (addresses, e-mails, phone numbers, URLs). */
a[href^="mailto:"],
a[href^="tel:"],
a[href^="http"] {
	overflow-wrap: anywhere;
}

/* Media never escapes its parent. */
img,
svg,
video,
canvas,
audio,
iframe,
embed,
object {
	max-width: 100%;
}

img,
video,
canvas {
	height: auto;
}

iframe,
embed,
object {
	border: 0;
}

/* Grid and flex items default to min-width:auto, which is what makes a long
   word or a wide image stretch the whole row. Reset it for every theme grid. */
[class*="-grid"] > *,
[class*="-cards"] > *,
.franchesco-split > *,
.franchesco-contact > * {
	min-width: 0;
}

/* Wide blocks that cannot reflow scroll inside themselves, never the page. */
table {
	width: 100%;
	max-width: 100%;
	border-collapse: collapse;
}

.wp-block-table,
figure.wp-block-table,
.franchesco-prose table {
	display: block;
	overflow-x: auto;
	max-width: 100%;
}

pre,
code {
	max-width: 100%;
	overflow-wrap: break-word;
}

pre {
	overflow-x: auto;
}

/* ---------- Embedded maps and other third-party frames ----------
   An embed arrives with intrinsic width/height attributes (600x450 for a
   Google Maps or OpenStreetMap iframe). Capping max-width alone leaves it
   600px wide inside a 288px column on a 320px phone only because the
   attribute wins over the container; forcing width:100% makes it track the
   container in both directions, so it can never scroll the page sideways. */

iframe[src*="maps"],
iframe[src*="openstreetmap"],
.franchesco-map__embed,
.franchesco-prose iframe,
.franchesco-embed iframe {
	display: block;
	width: 100%;
	max-width: 100%;
}

/* Nothing anywhere may add a horizontal scrollbar. clip (not hidden) is used
   deliberately: overflow:hidden on the root creates a scroll container and
   breaks the sticky header, clip does not. */
html {
	overflow-x: clip;
}

/* ---------- Touch targets — site-wide, WCAG 2.5.5 ----------
   Every interactive control is at least 44x44 CSS px. Buttons and icon
   controls get the floor at every width; text links inside lists, the
   navigation and the footer get it from the tablet breakpoint down, where
   a finger rather than a cursor is doing the pointing. */

.franchesco-btn,
button,
input[type="submit"],
input[type="button"],
input[type="reset"],
[role="button"] {
	min-height: 44px;
}

.franchesco-btn,
.franchesco-nav-toggle,
.franchesco-mini-cart,
.franchesco-header__call,
.franchesco-social__link,
.franchesco-qty__step {
	min-width: 44px;
}

/* An inline <a> ignores min-height, so anything that must be a target is
   laid out as a flex box first. */
.franchesco-btn,
.franchesco-header__call,
.franchesco-social__link,
.franchesco-mini-cart {
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

/* ---------- Tablet — max-width: 1024px (--bp-lg) ---------- */

@media (max-width: 1024px) {
	.franchesco-container {
		max-width: 100%;
	}

	/* Touch input from here down: text links that act as controls get the
	   same 44px floor as the buttons. */
	.franchesco-footer__list a,
	.franchesco-footer .franchesco-nav__list a,
	.franchesco-nav a,
	.franchesco-lang-switcher__link,
	.franchesco-location__actions a,
	.franchesco-map__actions a {
		display: inline-flex;
		align-items: center;
		min-height: 44px;
	}
}

/* ---------- Large phone — max-width: 768px (--bp-md) ---------- */

@media (max-width: 768px) {
	/* 16px on form controls also stops iOS Safari zooming on focus. */
	input,
	select,
	textarea,
	button {
		font-size: max(1rem, var(--text-sm));
	}

	.franchesco-btn {
		font-size: 1rem;
	}
}

/* ---------- Phone — max-width: 480px (--bp-sm) ---------- */

@media (max-width: 480px) {
	body {
		font-size: 1rem; /* never below 16px */
	}

	/* Full-width, thumb-sized actions instead of buttons sitting side by side. */
	.franchesco-btn {
		width: 100%;
		min-height: 2.75rem;
	}

	.franchesco-hero__actions,
	.franchesco-cta-band__actions {
		flex-direction: column;
		align-items: stretch;
		width: 100%;
	}
}
