/**
 * TD Homes — global design-system styles.
 *
 * Only styles shared by several blocks live here: layout tokens, the section
 * rail, label typography, buttons and links. Block-specific styles live in
 * each block's style.css. Colors and fonts come from theme.json presets.
 */

/* Layout system (from the Figma frames, which use auto-layout padding):
   - --td-gutter   outer page gutter, equal left and right. On dark sections
                   the left gutter holds the 40px rail (40 + 16 = 56).
   - --td-content  maximum main content width: the 1920px reference minus two
                   56px gutters. Below that the content is fluid.
   - --td-frame    content + gutters: the box full-bleed sections lay their own
                   grid in (hero stage, feature strip). */
:root {
	--td-gutter: 20px;
	--td-rail: 40px;
	--td-rule: rgba(126, 127, 130, 0.3);
	--td-content: 1808px;
	--td-frame: calc(var(--td-content) + 2 * var(--td-gutter));
	--td-ease: cubic-bezier(0.25, 0.1, 0.25, 1);

	/* Vertical rhythm from the frames: section padding and the gap between
	   parts of one section (also spacing presets "Section" / "Section gap"). */
	--td-section-space: 80px;
	--td-section-gap: 48px;
}

@media (min-width: 600px) {

	:root {
		--td-gutter: 32px;
		--td-frame: calc(var(--td-content) + 2 * var(--td-gutter));
	}
}

@media (min-width: 1024px) {

	:root {
		--td-gutter: 70px;
		--td-frame: calc(var(--td-content) + 2 * var(--td-gutter));
		--td-section-space: 150px;
		--td-section-gap: 64px;
	}
}

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

::selection {
	background: var(--wp--preset--color--champagne);
	color: var(--wp--preset--color--ink);
}

/* Header, main and footer stack edge to edge. */
.wp-site-blocks > * {
	margin-block-start: 0;
}

/* Sections stack edge to edge: override the flow/constrained layout block gap
   (core's `:root :where(.is-layout-flow) > *` rule). */
.td-section,
.is-layout-flow > .td-section,
.is-layout-constrained > .td-section {
	margin-block: 0;
}

:where(.td-section) {
	position: relative;
	box-sizing: border-box;
}

:where(.td-section) *,
:where(.td-section) *::before,
:where(.td-section) *::after {
	box-sizing: border-box;
}

/* Spacing inside sections is set by each block (core adds margins to e.g.
   figure). Specificity stays at one class so block styles, which load after
   this file, always win. */
.td-section :where(h1, h2, h3, h4, h5, h6, p, figure, blockquote, ul, ol) {
	margin: 0;
}

:where(.td-section) img {
	display: block;
	max-width: 100%;
}

/* Sections are full-bleed; .td-container holds the main content column
   (fluid, equal gutters, capped at --td-content). */
.td-container {
	width: 100%;
	max-width: var(--td-frame);
	margin-inline: auto;
	padding-inline: var(--td-gutter);
}

/* Decorative 40px rail with a hairline on the left edge of dark sections
   (desktop only). */
@media (min-width: 1024px) {

	.td-rail::before {
		content: "";
		position: absolute;
		inset: 0 auto 0 0;
		width: var(--td-rail);
		border-right: 1px solid var(--td-rule);
		pointer-events: none;
	}
}

/* "CTA regular" text style from the design system. */
.td-label {
	font-family: var(--wp--preset--font-family--sans);
	font-size: 12px;
	font-weight: 500;
	line-height: 13px;
	letter-spacing: 0.15em;
	text-transform: uppercase;
}

/* Checklist (td_checklist()): label-style items in a column; colour, gaps
   and markers come from the block using it. */
.td-checklist {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.td-checklist__item {
	display: flex;
	align-items: flex-start;
	gap: 8px;
}

.td-checklist__item .td-icon {
	flex: none;
	width: 12px;
	height: 12px;
}

/* Section titles and body text shared by blocks (design text styles; colour
   comes from each block): section title H1 36/44 → 48/56, display title
   40/48 → 64/64 at 1440, body 14/22 → 16/25. */
.td-title {
	text-wrap: balance;
	font-family: var(--wp--preset--font-family--serif);
	font-size: 36px;
	font-weight: 400;
	line-height: 44px;
}

.td-title--display {
	font-size: 40px;
	line-height: 48px;
}

.td-body {
	font-size: 14px;
	line-height: 22px;
}

@media (min-width: 1024px) {

	.td-title {
		font-size: 48px;
		line-height: 56px;
	}

	.td-title--display {
		font-size: clamp(48px, 4.45vw, 64px);
		line-height: 1;
	}

	.td-body {
		font-size: 16px;
		line-height: 25px;
	}
}

/* Buttons ------------------------------------------------------------------ */

.td-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 16px;
	padding: 16px 24px;
	border: 0;
	border-radius: 0;
	font-family: var(--wp--preset--font-family--sans);
	font-size: 12px;
	font-weight: 500;
	line-height: 13px;
	letter-spacing: 0.15em;
	text-align: center;
	text-decoration: none;
	text-transform: uppercase;
	white-space: nowrap;
	cursor: pointer;
	transition: background-color 0.2s var(--td-ease), color 0.2s var(--td-ease), background-size 0.25s var(--td-ease);
}

.td-btn--light {
	background-color: var(--wp--preset--color--sand);
	color: var(--wp--preset--color--ink);
}

/* Hover and focus: bronze (the palette's #ad7a53). The former hover, ivory,
   is nearly the same colour as sand. A softer option was a darker sand,
   #d5c1a9 (sand 25% + champagne 75%). */
.td-btn--light:hover,
.td-btn--light:focus-visible {
	background-color: #ad7a53;
	color: var(--wp--preset--color--ink);
}

.td-btn--dark {
	background-color: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--ivory);
}

.td-btn--dark:hover,
.td-btn--dark:focus-visible {
	background-color: #1c2335;
	color: var(--wp--preset--color--ivory);
}

.td-btn--accent {
	background-color: var(--wp--preset--color--bronze);
	color: var(--wp--preset--color--ink);
}

.td-btn--accent:hover,
.td-btn--accent:focus-visible {
	background-color: var(--wp--preset--color--champagne);
	color: var(--wp--preset--color--ink);
}

/* Plain text links (footer legal, CTA contact…) change colour smoothly.
   Zero specificity: components with their own transition keep it. */
:where(a) {
	transition: color 0.2s var(--td-ease);
}

/* Text button: label with a 1px rule 4px below it (22px tall in total). */
.td-btn--text,
.td-link {
	padding: 2px 0 7px;
	background: linear-gradient(currentcolor, currentcolor) left bottom 2px / 100% 1px no-repeat;
}

.td-btn--text {
	color: var(--wp--preset--color--ivory);
}

/* Navigation-style link: rule is hidden until hover, focus or current page.
   Colour comes from the context (each block sets it). Block-level, so a
   menu item is exactly the link's 22px height (no text line box around it). */
.td-link {
	display: flex;
	width: fit-content;
	align-items: center;
	gap: 8px;
	background-size: 0 1px;
	color: inherit;
	font-family: var(--wp--preset--font-family--sans);
	font-size: 12px;
	font-weight: 500;
	line-height: 13px;
	letter-spacing: 0.15em;
	text-decoration: none;
	text-transform: uppercase;
	transition: background-size 0.25s var(--td-ease), color 0.2s var(--td-ease);
}

.td-link:hover,
.td-link:focus-visible,
.td-link[aria-current="page"] {
	background-size: 100% 1px;
}

/* Text link with an arrow (td_arrow_link()). */
.td-link--arrow .td-icon {
	width: 12px;
	height: 12px;
}

/* Focus ------------------------------------------------------------------- */

.td-section :focus-visible,
.td-btn:focus-visible {
	outline: none;
}

/* Icons ------------------------------------------------------------------- */

.td-icon {
	display: block;
	flex: none;
	width: 24px;
	height: 24px;
	stroke-width: 1;
	stroke-linecap: square;
}

/* Utilities --------------------------------------------------------------- */

.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	border: 0;
	white-space: nowrap;
	overflow-wrap: normal;
}

.screen-reader-text:focus {
	z-index: 100000;
	top: 8px;
	left: 8px;
	width: auto;
	height: auto;
	padding: 16px 24px;
	clip-path: none;
	background: var(--wp--preset--color--sand);
	color: var(--wp--preset--color--ink);
}

@media (prefers-reduced-motion: reduce) {

	*,
	*::before,
	*::after {
		transition-duration: 0.01ms !important;
		animation-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}
