/**
 * Bouldering London — theme styles.
 *
 * theme.json owns the design tokens. This file covers what it cannot express:
 * the motif treatments, header behaviour, archive layouts and the dark variant.
 */

/* ---------------------------------------------------------------------------
   Foundations
   ------------------------------------------------------------------------ */

:root {
	--bldn-transition: 0.18s cubic-bezier( 0.4, 0, 0.2, 1 );
	--bldn-topo: rgb( 210 112 63 / 12% );
}

html {
	scroll-behavior: smooth;
}

/*
 * Shared section container. Every full-width section on the site drops its
 * content into one of these so the homepage, the directory and the footer all
 * line up at the same width with the same side gutters. Backgrounds can still
 * run edge to edge on the alignfull parent; only the content is capped here.
 */
.bldn-wrap {
	box-sizing: border-box;
	width: 100%;
	max-width: 1400px;
	margin-inline: auto;
	padding-inline: clamp( 1.25rem, 5vw, 3.5rem );
}

@media ( prefers-reduced-motion: reduce ) {
	html {
		scroll-behavior: auto;
	}

	*,
	*::before,
	*::after {
		transition-duration: 0.01ms !important;
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
	}
}

body {
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
}

/* Visible focus everywhere, not just on links. */
:where( a, button, input, select, textarea, summary, [tabindex] ):focus-visible {
	outline: 2px solid var( --wp--preset--color--sandstone );
	outline-offset: 2px;
	border-radius: 3px;
}

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

.skip-link:focus {
	position: fixed !important;
	top: 1rem;
	left: 1rem;
	z-index: 100;
	width: auto;
	height: auto;
	padding: 0.75rem 1.25rem;
	clip: auto;
	background: var( --wp--preset--color--basalt );
	color: var( --wp--preset--color--chalk );
	border-radius: var( --wp--custom--radius--small );
	text-decoration: none;
}

/* ---------------------------------------------------------------------------
   Header
   ------------------------------------------------------------------------ */

.bldn-header {
	position: sticky;
	top: 0;
	z-index: 30;
	backdrop-filter: saturate( 180% ) blur( 12px );
	background: rgb( 251 250 247 / 88% );
	border-bottom: 1px solid var( --wp--preset--color--grit );
	transition: box-shadow var( --bldn-transition );
}

.bldn-header.is-scrolled {
	box-shadow: 0 1px 3px rgb( 35 40 47 / 8% );
}

.bldn-logo svg {
	display: block;
	height: 68px;
	width: auto;
}

/* Match the site-logo block to the fallback mark's presence. */
.bldn-header .wp-block-site-logo img {
	height: 68px;
	width: auto;
}

/* Keep the header content aligned to the same gutter as the page sections. */
.bldn-header > .wp-block-group {
	box-sizing: border-box;
	max-width: 1400px;
	margin-inline: auto;
	padding-inline: clamp( 1.25rem, 5vw, 3.5rem );
}

/* Larger, clearer primary navigation. */
.bldn-header .wp-block-navigation {
	font-size: 1.1875rem;
}

.bldn-logo .bldn-logo__mark {
	fill: var( --wp--preset--color--sandstone );
}

.bldn-logo .bldn-logo__text {
	fill: var( --wp--preset--color--basalt );
}

/* Theme toggle -------------------------------------------------------------- */

.bldn-theme-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	color: var( --wp--preset--color--concrete );
	background: transparent;
	border: 1px solid var( --wp--preset--color--grit );
	border-radius: var( --wp--custom--radius--pill );
	cursor: pointer;
	transition: color var( --bldn-transition ), border-color var( --bldn-transition );
}

.bldn-theme-toggle:hover {
	color: var( --wp--preset--color--sandstone );
	border-color: var( --wp--preset--color--sandstone );
}

/* Swap sun for moon once dark is active, so the icon shows the current state
   rather than the action — matching how the aria-label is written. */
.bldn-theme-toggle[ aria-pressed="true" ] svg circle {
	r: 5;
}

.bldn-theme-toggle[ aria-pressed="true" ] svg path {
	opacity: 0;
}

/* Navigation ---------------------------------------------------------------- */

.wp-block-navigation .wp-block-navigation-item__content {
	font-family: var( --wp--preset--font-family--display );
	font-weight: 500;
	text-decoration: none;
	transition: color var( --bldn-transition );
}

.wp-block-navigation .wp-block-navigation-item__content:hover {
	color: var( --wp--preset--color--sandstone );
}

.wp-block-navigation .current-menu-item .wp-block-navigation-item__content {
	color: var( --wp--preset--color--sandstone );
}

/* ---------------------------------------------------------------------------
   Motifs — abstract, restrained. Hold geometry and topo contours.
   ------------------------------------------------------------------------ */

/*
 * Topographic contour lines used as a section divider. Built from repeating
 * gradients rather than an image so it costs nothing and scales cleanly.
 */
.bldn-topo {
	position: relative;
}

.bldn-topo::after {
	content: "";
	position: absolute;
	inset-inline: 0;
	bottom: 0;
	height: 3px;
	background-image: repeating-linear-gradient(
		90deg,
		var( --bldn-topo ) 0,
		var( --bldn-topo ) 14px,
		transparent 14px,
		transparent 24px
	);
}

/* A soft chalk-dust bloom behind hero content. */
.bldn-chalk-bloom {
	position: relative;
	isolation: isolate;
}

.bldn-chalk-bloom::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background:
		radial-gradient( 60% 55% at 18% 8%, rgb( 210 112 63 / 9% ) 0%, transparent 60% ),
		radial-gradient( 45% 45% at 88% 82%, rgb( 43 127 212 / 6% ) 0%, transparent 65% );
	pointer-events: none;
}

/* Grade circuit chips — colour doing a job, never decoration. */
.bldn-grade {
	display: inline-flex;
	align-items: center;
	gap: 0.375rem;
	font-size: var( --wp--preset--font-size--small );
	font-weight: 600;
}

.bldn-grade::before {
	content: "";
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: currentcolor;
}

.bldn-grade--yellow { color: #8a6800; }
.bldn-grade--green  { color: #1d6f4a; }
.bldn-grade--blue   { color: #1c5da0; }
.bldn-grade--red    { color: #a33228; }
.bldn-grade--purple { color: #5b3fa8; }

/* ---------------------------------------------------------------------------
   Cards and grids used by patterns
   ------------------------------------------------------------------------ */

.bldn-panel {
	background: var( --wp--preset--color--paper );
	border: 1px solid var( --wp--preset--color--grit );
	border-radius: var( --wp--custom--radius--medium );
	transition: border-color var( --bldn-transition ), transform var( --bldn-transition ), box-shadow var( --bldn-transition );
}

.bldn-panel:hover {
	border-color: var( --wp--preset--color--sandstone );
	box-shadow: var( --wp--preset--shadow--soft );
}

.bldn-stat {
	font-family: var( --wp--preset--font-family--display );
	font-size: var( --wp--preset--font-size--xx-large );
	font-weight: 700;
	line-height: 1;
	letter-spacing: -0.03em;
	color: var( --wp--preset--color--sandstone );
}

.bldn-eyebrow {
	font-family: var( --wp--preset--font-family--display );
	font-size: var( --wp--preset--font-size--small );
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var( --wp--preset--color--concrete );
}

/* ---------------------------------------------------------------------------
   Venue archive and single
   ------------------------------------------------------------------------ */

.bldn-venue-hero {
	position: relative;
	overflow: hidden;
	border-radius: var( --wp--custom--radius--large );
}

.bldn-venue-hero img {
	width: 100%;
	height: clamp( 240px, 38vw, 440px );
	object-fit: cover;
}

/* The verified badge is the site's whole proposition — give it presence
   without letting it shout over the venue name. */
.bldn-verified-badge {
	display: inline-flex;
	align-items: center;
	gap: 0.4375rem;
	padding: 0.3125rem 0.75rem;
	font-size: var( --wp--preset--font-size--small );
	font-weight: 600;
	color: #1d6f4a;
	background: #edf7f1;
	border-radius: var( --wp--custom--radius--pill );
}

.bldn-verified-badge::before {
	content: "";
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: currentcolor;
}

/* ---------------------------------------------------------------------------
   Footer
   ------------------------------------------------------------------------ */

.bldn-footer {
	border-top: 1px solid var( --wp--preset--color--grit );
}

.bldn-footer a {
	text-decoration: none;
}

.bldn-footer a:hover {
	text-decoration: underline;
}

/* ---------------------------------------------------------------------------
   Dark variant
   ------------------------------------------------------------------------ */

@media ( prefers-color-scheme: dark ) {
	:root:not( [ data-theme="light" ] ) {
		--wp--preset--color--chalk: #16181c;
		--wp--preset--color--paper: #1e2126;
		--wp--preset--color--grit: #2f343b;
		--wp--preset--color--basalt: #f1efea;
		--wp--preset--color--concrete: #9aa1ab;
		--wp--preset--color--sandstone: #e08a5c;
		--wp--preset--color--sandstone-deep: #f0a077;
		--bldn-topo: rgb( 224 138 92 / 18% );
	}

	:root:not( [ data-theme="light" ] ) .bldn-header {
		background: rgb( 22 24 28 / 88% );
	}

	:root:not( [ data-theme="light" ] ) .bldn-verified-badge {
		color: #7fd4a8;
		background: #14301f;
	}

	:root:not( [ data-theme="light" ] ) .bldn-grade--yellow { color: #e8c257; }
	:root:not( [ data-theme="light" ] ) .bldn-grade--green  { color: #7fd4a8; }
	:root:not( [ data-theme="light" ] ) .bldn-grade--blue   { color: #7fb3ea; }
	:root:not( [ data-theme="light" ] ) .bldn-grade--red    { color: #eb9189; }
	:root:not( [ data-theme="light" ] ) .bldn-grade--purple { color: #b39ee8; }
}

/* Explicit toggle wins over the system preference in both directions. */
:root[ data-theme="dark" ] {
	--wp--preset--color--chalk: #16181c;
	--wp--preset--color--paper: #1e2126;
	--wp--preset--color--grit: #2f343b;
	--wp--preset--color--basalt: #f1efea;
	--wp--preset--color--concrete: #9aa1ab;
	--wp--preset--color--sandstone: #e08a5c;
	--wp--preset--color--sandstone-deep: #f0a077;
	--bldn-topo: rgb( 224 138 92 / 18% );
}

:root[ data-theme="dark" ] .bldn-header {
	background: rgb( 22 24 28 / 88% );
}

:root[ data-theme="dark" ] .bldn-verified-badge {
	color: #7fd4a8;
	background: #14301f;
}

/* ---------------------------------------------------------------------------
   Print — a gym page should print as a useful reference card
   ------------------------------------------------------------------------ */

@media print {
	.bldn-header,
	.bldn-footer,
	.bldn-filters,
	.bldn-map,
	.bldn-compare {
		display: none !important;
	}

	body {
		background: #fff;
		color: #000;
	}
}
