/*
Theme Name: Hudson Race Series
Theme URI: https://10kseriesmalta.com
Update URI: false
Author: Johann Fenech
Description: Block theme for the Hudson Race Series (10K Series Malta). Athletic, bold, and free of page-builder dependencies — no Elementor, no trx_addons, no RevSlider.
Version: 1.4.0
Requires at least: 6.7
Tested up to: 7.1
Requires PHP: 8.1
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: hudson-race-series
Tags: block-patterns, full-site-editing, e-commerce, custom-colors, custom-logo, wide-blocks
*/

/* The palette is a deliberate light design. Declaring the scheme stops
   Chrome/Android "force dark" and similar from inverting it — which was
   turning the transparent sponsor SVG into a dark mark on a dark ground. */
:root { color-scheme: light; }

/* Design tokens live in theme.json. This file carries only what theme.json
   cannot express: pseudo-elements, motion, and a few structural details. */

/* ── Header ──────────────────────────────────────────────────────────────
   The brand logo is solid black on transparent, so it must be inverted to
   read on the ink header and footer. */
.hudson-header {
	position: sticky;
	top: 0;
	z-index: 100;
	border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.hudson-header .wp-block-site-logo img,
.hudson-footer .wp-block-site-logo img {
	filter: invert(1);
}

.hudson-nav a {
	color: inherit;
	position: relative;
	padding-block: 0.35rem;
}

/* Underline grows from the left on hover — reads as motion, not decoration. */
.hudson-nav a::after {
	content: "";
	position: absolute;
	inset-inline: 0;
	bottom: 0;
	height: 2px;
	background: var(--wp--preset--color--volt);
	transform: scaleX(0);
	transform-origin: left;
	transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.hudson-nav a:hover::after,
.hudson-nav .current-menu-item a::after {
	transform: scaleX(1);
}

.hudson-nav a:hover { text-decoration: none; }

/* ── Footer ──────────────────────────────────────────────────────────── */
.hudson-footer-list {
	list-style: none;
	padding-inline-start: 0;
	margin: 0;
}

.hudson-footer a {
	color: var(--wp--preset--color--grey-muted);
	transition: color 0.16s ease;
}

.hudson-footer a:hover {
	color: var(--wp--preset--color--white);
	text-decoration: none;
}

/* ── Buttons ─────────────────────────────────────────────────────────── */
.wp-element-button,
.wp-block-button__link {
	transition: background-color 0.18s ease, transform 0.18s ease;
}

.wp-element-button:active,
.wp-block-button__link:active {
	transform: translateY(1px);
}

.wp-block-button.is-style-outline > .wp-block-button__link {
	border: 2px solid currentColor;
	background: transparent;
}

/* ── Motion ──────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}

/* ── Home: hero ──────────────────────────────────────────────────────── */
.hudson-hero .wp-block-cover__inner-container {
	max-width: 82rem;
	margin-inline: auto;
	padding-inline: clamp(1.25rem, 5vw, 4rem);
	width: 100%;
}

.hudson-hero-title { text-wrap: balance; }

.hudson-hero-sub { max-width: 34rem; opacity: 0.92; }

/* ── Home: stat bar ──────────────────────────────────────────────────── */
.hudson-stats p { margin: 0; }

/* ── Home: race cards ────────────────────────────────────────────────── */
.hudson-race-card {
	background: var(--wp--preset--color--white);
	overflow: hidden;
	height: 100%;
	display: flex;
	flex-direction: column;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hudson-race-card:hover {
	transform: translateY(-3px);
	box-shadow: 0 12px 32px rgba(14, 14, 16, 0.12);
}

.hudson-race-card .wp-block-post-featured-image { margin: 0; }

.hudson-race-card .wp-block-post-title a { color: var(--wp--preset--color--ink); }
.hudson-race-card .wp-block-post-title a:hover { color: var(--wp--preset--color--red); text-decoration: none; }

/* Out-of-stock races: WooCommerce renders a "Read more" link instead of an
   add-to-cart button, so the card should read as closed rather than broken. */
.hudson-race-card .wp-block-woocommerce-product-price { color: var(--wp--preset--color--ink); }

/* ── Home: testimonials ──────────────────────────────────────────────── */
.hudson-quote {
	border-top: 3px solid var(--wp--preset--color--red);
	padding-top: var(--wp--preset--spacing--30);
}

/* ── Home: sponsors ──────────────────────────────────────────────────── */
.hudson-sponsors figure { margin: 0; }

.hudson-sponsors img {
	filter: grayscale(1);
	opacity: 0.65;
	transition: filter 0.2s ease, opacity 0.2s ease;
}

.hudson-sponsors img:hover { filter: none; opacity: 1; }

/* ── Inner pages: feature grid ───────────────────────────────────────── */
.hudson-feature {
	border-top: 3px solid var(--wp--preset--color--ink);
	padding-top: var(--wp--preset--spacing--30);
}

.hudson-feature h4 {
	margin: 0 0 0.5rem;
	letter-spacing: 0.01em;
}

.hudson-feature p { margin: 0; }

/* ── Inner pages: pull quotes ────────────────────────────────────────── */
.hudson-quote-block {
	border-left: 3px solid var(--wp--preset--color--red);
	padding-left: var(--wp--preset--spacing--40);
	margin-block: var(--wp--preset--spacing--50);
}

blockquote.hudson-quote-block p {
	font-size: var(--wp--preset--font-size--large);
	line-height: 1.55;
}

blockquote.hudson-quote-block cite {
	display: block;
	margin-top: var(--wp--preset--spacing--20);
	font-family: var(--wp--preset--font-family--display);
	font-size: 0.9rem;
	font-style: normal;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--wp--preset--color--ink);
}

/* ── Inner pages: closing CTA ────────────────────────────────────────── */
.hudson-cta h2 { margin: 0; }

/* ── Stat row (About) ────────────────────────────────────────────────── */
.hudson-stat-row p { margin: 0; }

.hudson-stat + .hudson-stat { border-left: 1px solid rgba(255, 255, 255, 0.14); padding-left: var(--wp--preset--spacing--40); }

.hudson-stat-num { font-variant-numeric: tabular-nums; }

.hudson-stat-label { margin-top: 0.4rem !important; opacity: 0.75; }

/* ── WooCommerce: classic cart & checkout ────────────────────────────────
   Cart and checkout stay on the classic shortcodes, so the PayPal flow is
   untouched. These rules only bring the default markup in line with the
   design system — they do not alter any form or payment behaviour. */
.hudson-woo-page .woocommerce table.shop_table,
.hudson-woo-page .woocommerce table.cart {
	border: 1px solid #E4E4E0;
	border-radius: 2px;
	border-collapse: collapse;
	width: 100%;
}

.hudson-woo-page .woocommerce table.shop_table th {
	font-family: var(--wp--preset--font-family--display);
	font-size: 0.9rem;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--wp--preset--color--ink);
	border-bottom: 2px solid var(--wp--preset--color--ink);
	padding: 0.9rem 1rem;
	text-align: left;
}

.hudson-woo-page .woocommerce table.shop_table td {
	padding: 1rem;
	border-bottom: 1px solid #EDEDEA;
	vertical-align: middle;
}

.hudson-woo-page .woocommerce table.shop_table img { width: 68px; height: auto; }

/* Section headings inside the checkout form */
.hudson-woo-page .woocommerce h3,
.hudson-woo-page .woocommerce-billing-fields h3,
.hudson-woo-page #order_review_heading {
	font-family: var(--wp--preset--font-family--display);
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: -0.01em;
	line-height: 1;
	font-size: var(--wp--preset--font-size--x-large);
	color: var(--wp--preset--color--ink);
}

/* Form controls */
.hudson-woo-page .woocommerce form .form-row input.input-text,
.hudson-woo-page .woocommerce form .form-row textarea,
.hudson-woo-page .woocommerce form .form-row select,
.hudson-woo-page .woocommerce .select2-container .select2-selection--single {
	border: 1px solid #D6D6D1;
	border-radius: 2px;
	padding: 0.7rem 0.85rem;
	font-family: inherit;
	font-size: 1rem;
	background: var(--wp--preset--color--white);
}

.hudson-woo-page .woocommerce form .form-row input.input-text:focus,
.hudson-woo-page .woocommerce form .form-row textarea:focus,
.hudson-woo-page .woocommerce form .form-row select:focus {
	outline: 2px solid var(--wp--preset--color--red);
	outline-offset: 1px;
	border-color: transparent;
}

.hudson-woo-page .woocommerce form .form-row label {
	font-size: 0.9rem;
	font-weight: 500;
	color: var(--wp--preset--color--ink);
	margin-bottom: 0.3rem;
	display: block;
}

.hudson-woo-page .woocommerce .required { color: var(--wp--preset--color--red); }

/* Totals panel */
.hudson-woo-page .cart_totals,
.hudson-woo-page #order_review {
	background: var(--wp--preset--color--paper);
	padding: var(--wp--preset--spacing--40);
	border-radius: 2px;
}

/* Product page: keep the summary column readable next to the gallery */
.hudson-product-summary .wp-block-post-title { line-height: 0.95; }

.hudson-product .quantity input.qty {
	border: 1px solid #D6D6D1;
	border-radius: 2px;
	padding: 0.6rem 0.4rem;
	width: 4.5rem;
}

.hudson-product .wp-block-woocommerce-product-meta {
	margin-top: var(--wp--preset--spacing--40);
	padding-top: var(--wp--preset--spacing--30);
	border-top: 1px solid #E4E4E0;
	font-size: 0.9rem;
	color: var(--wp--preset--color--grey);
}

/* ── Responsive: explicit grid behaviour ─────────────────────────────────
   Core's grid layout with a fixed columnCount does not reliably collapse
   on small screens, so the breakpoints are declared here rather than left
   to whatever the block editor emits. */
@media (max-width: 900px) {
	.hudson-race-grid .wp-block-post-template.is-layout-grid,
	.wp-block-query.alignwide .wp-block-post-template.is-layout-grid,
	.wp-block-woocommerce-related-products .is-layout-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.hudson-features.is-layout-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
	.hudson-race-grid .wp-block-post-template.is-layout-grid,
	.wp-block-query.alignwide .wp-block-post-template.is-layout-grid,
	.wp-block-woocommerce-related-products .is-layout-grid,
	.hudson-features.is-layout-grid,
	.hudson-stat-row.is-layout-grid {
		grid-template-columns: 1fr;
	}

	/* Stat row: dividers become horizontal once stacked */
	.hudson-stat + .hudson-stat {
		border-left: 0;
		padding-left: 0;
		border-top: 1px solid rgba(255, 255, 255, 0.14);
		padding-top: var(--wp--preset--spacing--30);
	}

	/* Header: keep the logo and controls on one comfortable row */
	.hudson-header .wp-block-site-logo img { max-width: 132px; }

	/* Hero: tighten the stacked CTAs */
	.hudson-hero .wp-block-buttons { gap: 0.6rem; }
	.hudson-hero .wp-block-button { width: 100%; }
	.hudson-hero .wp-block-button__link { display: block; text-align: center; }

	/* Product page: gallery above summary, both full width */
	.hudson-product .wp-block-columns { gap: var(--wp--preset--spacing--50); }

	/* Cart/checkout tables get cramped at this width */
	.hudson-woo-page .woocommerce table.shop_table th,
	.hudson-woo-page .woocommerce table.shop_table td { padding: 0.6rem 0.5rem; font-size: 0.9rem; }
	.hudson-woo-page .woocommerce table.shop_table img { width: 48px; }
}

/* The stat bar on the home page wraps rather than squashing */
@media (max-width: 782px) {
	.hudson-stats .wp-block-group { gap: 0.5rem var(--wp--preset--spacing--30); }
	.hudson-stats p { font-size: 0.85rem !important; }
}

/* ── Order confirmation ──────────────────────────────────────────────────
   The status block emits its own <h1>Order received</h1>. The template
   already provides a heading, so that one is both a duplicate H1 and —
   because headings are painted ink-on-ink here — invisible, leaving a
   243px hole under the title. Hide it and keep the message. */
.hudson-confirmation .wc-block-order-confirmation-status h1 {
	display: none;
}

.hudson-confirmation .wc-block-order-confirmation-status p {
	margin: 0;
	color: inherit;
}

.hudson-confirmation .wc-block-order-confirmation-summary {
	border: 1px solid #E4E4E0;
	border-radius: 2px;
	padding: var(--wp--preset--spacing--40);
}

/* ── Race filter (replaces the catalog sort dropdown) ────────────────── */
.hudson-race-filter {
	display: flex;
	gap: 0.35rem;
	flex-wrap: wrap;
}

.hudson-race-filter__item {
	font-family: var(--wp--preset--font-family--display);
	font-size: 1rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	line-height: 1;
	padding: 0.6rem 1rem;
	border: 1px solid #D6D6D1;
	border-radius: 2px;
	color: var(--wp--preset--color--ink);
	background: var(--wp--preset--color--white);
	transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.hudson-race-filter__item:hover {
	border-color: var(--wp--preset--color--ink);
	text-decoration: none;
}

.hudson-race-filter__item.is-current {
	background: var(--wp--preset--color--ink);
	border-color: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--white);
}

.hudson-race-filter__item:focus-visible {
	outline: 2px solid var(--wp--preset--color--red);
	outline-offset: 2px;
}

/* ── Sponsor row ground ──────────────────────────────────────────────────
   emvigee and Blaze are rasters with white backgrounds baked in; the
   timing mark is a transparent SVG. Without an explicit ground the SVG is
   the only one that depends on whatever is behind it. */
.hudson-sponsors {
	background: var(--wp--preset--color--white);
	padding-block: var(--wp--preset--spacing--30);
	border-radius: 2px;
}

.hudson-sponsors img {
	/* Slightly stronger than the rasters: a line-art mark loses more
	   contrast to opacity than a logo sitting on its own white box. */
	opacity: 0.72;
}

@media (max-width: 600px) {
	.hudson-sponsors {
		gap: var(--wp--preset--spacing--40) !important;
		padding-block: var(--wp--preset--spacing--40);
	}
}
