/**
 * AtlasHomeDeco — base
 * Design tokens, reset, typography and utilities.
 *
 * Every colour, size and rhythm value in the theme resolves back to a token
 * declared here. To re-skin the theme, change these and nothing else.
 */

/* -------------------------------------------------------------------------
 * 1. Tokens
 * ---------------------------------------------------------------------- */

:root {
	/* Palette — warm, low-chroma, photography-first. */
	--ahd-ivory: #FBF9F5;
	--ahd-cream: #F4EFE7;
	--ahd-sand: #E9E1D4;
	--ahd-sand-deep: #D8CBB6;
	--ahd-terracotta: #B0603C;
	--ahd-terracotta-soft: #C98B63;
	--ahd-brown: #8A6E58;
	--ahd-burgundy: #6E2A34;
	--ahd-charcoal: #2B2724;
	--ahd-charcoal-deep: #1C1917;

	/* Semantic roles. */
	--ahd-bg: var(--ahd-ivory);
	--ahd-bg-alt: var(--ahd-cream);
	--ahd-bg-dark: var(--ahd-charcoal-deep);
	--ahd-text: var(--ahd-charcoal);
	--ahd-text-soft: #6C6259;
	--ahd-text-faint: #96897C;
	--ahd-text-invert: #F6F1E9;
	--ahd-line: rgba(43, 39, 36, 0.12);
	--ahd-line-soft: rgba(43, 39, 36, 0.07);
	--ahd-line-invert: rgba(246, 241, 233, 0.18);
	--ahd-accent: var(--ahd-terracotta);
	--ahd-accent-ink: #FFFFFF;
	--ahd-focus: var(--ahd-burgundy);

	/* Typography. */
	--ahd-font-display: "Cormorant Garamond", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
	--ahd-font-body: "Jost", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

	/* A fluid scale: comfortable on a phone, generous on a large screen. */
	--ahd-text-xs: 0.75rem;
	--ahd-text-sm: 0.8125rem;
	--ahd-text-base: clamp(0.9375rem, 0.9rem + 0.18vw, 1.0625rem);
	--ahd-text-lg: clamp(1.0625rem, 1rem + 0.3vw, 1.1875rem);
	--ahd-text-xl: clamp(1.25rem, 1.15rem + 0.5vw, 1.5rem);
	--ahd-display-sm: clamp(1.75rem, 1.4rem + 1.5vw, 2.5rem);
	--ahd-display-md: clamp(2.125rem, 1.6rem + 2.4vw, 3.5rem);
	--ahd-display-lg: clamp(2.5rem, 1.6rem + 3.9vw, 5rem);

	/* Weights and interface casing are set from the control panel. */
	--ahd-body-weight: 300;
	--ahd-heading-weight: 400;
	--ahd-btn-transform: uppercase;

	--ahd-leading-tight: 1.08;
	--ahd-leading-snug: 1.28;
	--ahd-leading-normal: 1.62;
	--ahd-tracking-wide: 0.14em;
	--ahd-tracking-wider: 0.2em;

	/* Space — a 4px base, named by role rather than size. */
	--ahd-space-2xs: 0.25rem;
	--ahd-space-xs: 0.5rem;
	--ahd-space-sm: 0.75rem;
	--ahd-space-md: 1rem;
	--ahd-space-lg: 1.5rem;
	--ahd-space-xl: 2rem;
	--ahd-space-2xl: 3rem;
	--ahd-space-3xl: 4.5rem;
	--ahd-section: clamp(3.5rem, 2rem + 6vw, 7.5rem);
	--ahd-section-tight: clamp(2.5rem, 1.5rem + 4vw, 4.5rem);

	/* Structure. */
	--ahd-wrap: 1360px;
	--ahd-footer-bg: var(--ahd-charcoal-deep);
	--ahd-footer-text: rgba(246, 241, 233, 0.72);
	--ahd-footer-heading: var(--ahd-text-invert);
	--ahd-footer-line: rgba(246, 241, 233, 0.18);
	--ahd-footer-link-hover: var(--ahd-terracotta-soft);
	--ahd-wrap-narrow: 760px;
	--ahd-gutter: clamp(1.125rem, 0.6rem + 2.4vw, 3rem);
	--ahd-radius: 2px;
	--ahd-radius-lg: 3px;
	--ahd-header-h: 76px;
	--ahd-header-h-sm: 60px;

	/* Motion — restrained by design. */
	--ahd-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
	--ahd-dur: 320ms;
	--ahd-dur-fast: 180ms;

	/* Elevation — barely there. */
	--ahd-shadow-sm: 0 1px 2px rgba(43, 39, 36, 0.04);
	--ahd-shadow: 0 10px 30px -18px rgba(43, 39, 36, 0.35);
	--ahd-shadow-lg: 0 40px 80px -40px rgba(43, 39, 36, 0.4);

	--ahd-z-header: 100;
	--ahd-z-overlay: 200;
	--ahd-z-toast: 300;
}

/* -------------------------------------------------------------------------
 * 2. Reset
 * ---------------------------------------------------------------------- */

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
	scroll-behavior: smooth;
	scroll-padding-top: calc(var(--ahd-header-h) + 24px);

	/* `clip` rather than `hidden`: it contains the full-bleed decorative
	   elements without creating a scroll container, which would silently
	   break the sticky header. */
	overflow-x: clip;
}

body {
	margin: 0;
	background-color: var(--ahd-bg);
	color: var(--ahd-text);
	font-family: var(--ahd-font-body);
	font-size: var(--ahd-text-base);
	font-weight: var(--ahd-body-weight);
	line-height: var(--ahd-leading-normal);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	overflow-x: clip;
}

body.is-locked {
	overflow: hidden;
}

h1, h2, h3, h4, h5, h6 {
	margin: 0 0 var(--ahd-space-md);
	font-family: var(--ahd-font-display);
	font-weight: var(--ahd-heading-weight);
	line-height: var(--ahd-leading-snug);
	letter-spacing: -0.01em;
	color: var(--ahd-text);
	text-wrap: balance;
}

h1 { font-size: var(--ahd-display-md); line-height: var(--ahd-leading-tight); }
h2 { font-size: var(--ahd-display-sm); }
h3 { font-size: var(--ahd-text-xl); }
h4 { font-size: var(--ahd-text-lg); }

p {
	margin: 0 0 var(--ahd-space-md);
	text-wrap: pretty;
}

p:last-child {
	margin-bottom: 0;
}

/*
 * Links inherit their colour so a link is legible on whatever ground it sits
 * on — ivory, sand or deep charcoal — and components (buttons, cards, chips)
 * set their own colour on top.
 *
 * Deliberately a bare `a`, at the lowest possible specificity. theme.json does
 * NOT define elements.link: if it did, WordPress would emit
 * `:root :where(a:where(:not(.wp-element-button)))`, which outranks this rule
 * *and* every single-class component rule such as `.btn--primary:hover` —
 * painting accent-coloured text onto accent-coloured buttons. Keep the link
 * colour out of theme.json and this stays the weakest rule in the cascade,
 * which is exactly what it should be.
 */
a {
	color: inherit;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.22em;
	transition: color var(--ahd-dur-fast) var(--ahd-ease);
}

a:hover {
	color: var(--ahd-accent);
}

img,
svg,
video,
picture {
	max-width: 100%;
	height: auto;
	display: block;
}

button,
input,
select,
textarea {
	font: inherit;
	color: inherit;
}

button {
	cursor: pointer;
	background: none;
	border: 0;
	padding: 0;
}

ul, ol {
	margin: 0 0 var(--ahd-space-md);
	padding-left: 1.25rem;
}

figure {
	margin: 0;
}

table {
	border-collapse: collapse;
	width: 100%;
}

hr {
	border: 0;
	border-top: 1px solid var(--ahd-line);
	margin: var(--ahd-space-2xl) 0;
}

::selection {
	background: var(--ahd-sand-deep);
	color: var(--ahd-charcoal);
}

/* -------------------------------------------------------------------------
 * 3. Focus & accessibility
 * ---------------------------------------------------------------------- */

:focus-visible {
	outline: 2px solid var(--ahd-focus);
	outline-offset: 3px;
	border-radius: 1px;
}

/* Only remove the default ring where a visible alternative exists. */
:focus:not(:focus-visible) {
	outline: none;
}

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

.skip-link:focus {
	background: var(--ahd-charcoal);
	color: var(--ahd-text-invert);
	clip: auto !important;
	clip-path: none;
	display: block;
	font-size: var(--ahd-text-sm);
	height: auto;
	left: var(--ahd-space-md);
	line-height: normal;
	padding: 14px 22px;
	text-decoration: none;
	top: var(--ahd-space-md);
	width: auto;
	z-index: 100000;
	letter-spacing: 0.05em;
	text-transform: uppercase;
}

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

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

/* -------------------------------------------------------------------------
 * 4. Layout primitives
 * ---------------------------------------------------------------------- */

.wrap {
	width: 100%;
	max-width: var(--ahd-wrap);
	margin-inline: auto;
	padding-inline: var(--ahd-gutter);
}

.wrap--narrow {
	max-width: calc(var(--ahd-wrap-narrow) + var(--ahd-gutter) * 2);
}

.wrap--wide {
	max-width: 1680px;
}

.section {
	padding-block: var(--ahd-section);
}

.section--tight {
	padding-block: var(--ahd-section-tight);
}

.section.alt {
	background: var(--ahd-bg-alt);
}

.section + .section.alt,
.section.alt + .section {
	margin-top: 0;
}

.center {
	text-align: center;
}

.cluster {
	display: flex;
	flex-wrap: wrap;
	gap: var(--ahd-space-md);
	align-items: center;
}

.cluster--center {
	justify-content: center;
}

/* Two-column editorial split. */
.split {
	display: grid;
	gap: clamp(2rem, 1rem + 4vw, 5rem);
	align-items: center;
}

@media (min-width: 900px) {
	.split {
		grid-template-columns: 1fr 1fr;
	}

	.split--media-right .split__media {
		order: 2;
	}

	.split--tall {
		grid-template-columns: 0.9fr 1fr;
		align-items: stretch;
	}

	.split--tall .split__body {
		align-self: center;
	}
}

.split__media {
	position: relative;
}

.split__caption {
	margin-top: var(--ahd-space-sm);
	font-size: var(--ahd-text-xs);
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--ahd-text-faint);
}

/* Main + aside. */
.layout {
	display: grid;
	gap: clamp(2rem, 1rem + 3vw, 4rem);
	padding-block: var(--ahd-section-tight);
}

@media (min-width: 1000px) {
	.layout--sidebar {
		grid-template-columns: minmax(0, 1fr) 300px;
	}

	.layout--toc {
		grid-template-columns: 240px minmax(0, 1fr);
	}
}

/* -------------------------------------------------------------------------
 * 5. Typography helpers
 * ---------------------------------------------------------------------- */

.eyebrow {
	margin: 0 0 var(--ahd-space-sm);
	font-family: var(--ahd-font-body);
	font-size: var(--ahd-text-xs);
	font-weight: 500;
	letter-spacing: var(--ahd-tracking-wider);
	text-transform: uppercase;
	color: var(--ahd-brown);
}

.eyebrow--light {
	color: rgba(246, 241, 233, 0.78);
}

.eyebrow a {
	text-decoration: none;
}

.accent {
	font-style: italic;
	color: var(--ahd-terracotta);
	font-weight: 300;
}

.display-title {
	font-size: var(--ahd-display-lg);
	line-height: var(--ahd-leading-tight);
	margin-bottom: var(--ahd-space-lg);
}

.lead {
	font-size: var(--ahd-text-lg);
	line-height: 1.58;
	color: var(--ahd-text-soft);
	max-width: 56ch;
}

.section-head {
	margin-bottom: clamp(2rem, 1rem + 3vw, 3.5rem);
}

.section-head--center {
	text-align: center;
	max-width: 62ch;
	margin-inline: auto;
}

.section-head--left {
	max-width: 56ch;
}

.section-head--split {
	display: flex;
	flex-wrap: wrap;
	gap: var(--ahd-space-lg);
	align-items: flex-end;
	justify-content: space-between;
	margin-bottom: clamp(2rem, 1rem + 3vw, 3.5rem);
}

.section-head--split > div {
	max-width: 52ch;
}

.section-head__title {
	font-size: var(--ahd-display-sm);
	margin-bottom: var(--ahd-space-sm);
}

.section-head__text {
	color: var(--ahd-text-soft);
	font-size: var(--ahd-text-lg);
	margin: 0;
}

.section-head--center .section-head__text {
	margin-inline: auto;
}

.section-foot {
	margin-top: clamp(2rem, 1rem + 2vw, 3rem);
	text-align: center;
}

.section-foot--mobile-only {
	display: block;
}

@media (min-width: 700px) {
	.section-foot--mobile-only {
		display: none;
	}
}

.section-link {
	margin-top: var(--ahd-space-lg);
	font-size: var(--ahd-text-sm);
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.section-link a {
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
	text-decoration: none;
	border-bottom: 1px solid var(--ahd-line);
	padding-bottom: 3px;
}

.section-link a:hover {
	border-color: var(--ahd-accent);
}

/* Long-form content. */
.prose {
	color: var(--ahd-text-soft);
	max-width: 68ch;
}

.prose > * + * {
	margin-top: var(--ahd-space-md);
}

.prose h2,
.prose h3,
.prose h4 {
	color: var(--ahd-text);
	margin-top: var(--ahd-space-2xl);
	margin-bottom: var(--ahd-space-sm);
}

.prose h2 { font-size: var(--ahd-display-sm); }
.prose h3 { font-size: var(--ahd-text-xl); }

.prose a {
	color: var(--ahd-text);
	text-decoration: underline;
	text-decoration-color: var(--ahd-sand-deep);
}

.prose a:hover {
	color: var(--ahd-accent);
	text-decoration-color: currentColor;
}

.prose ul,
.prose ol {
	padding-left: 1.15rem;
}

.prose li + li {
	margin-top: 0.4em;
}

.prose img {
	border-radius: var(--ahd-radius);
	margin-block: var(--ahd-space-xl);
}

.prose blockquote {
	margin: var(--ahd-space-xl) 0;
	padding-left: var(--ahd-space-lg);
	border-left: 2px solid var(--ahd-terracotta);
	font-family: var(--ahd-font-display);
	font-size: var(--ahd-text-xl);
	font-style: italic;
	color: var(--ahd-text);
}

.prose--lead {
	font-size: var(--ahd-text-lg);
	line-height: 1.6;
}

.prose--columns {
	max-width: none;
	margin-top: var(--ahd-space-2xl);
}

@media (min-width: 800px) {
	.prose--columns {
		columns: 2;
		column-gap: clamp(2rem, 4vw, 4rem);
	}

	.prose--columns p {
		break-inside: avoid;
		margin-bottom: var(--ahd-space-md);
	}
}

/* -------------------------------------------------------------------------
 * 6. Images
 * ---------------------------------------------------------------------- */

.img-cover,
.ahd-img {
	width: 100%;
	height: auto;
}

.img-cover {
	object-fit: cover;
}

/* Wrapping figure controls the ratio; the image fills it. */
.split__media img,
.space-card__media img,
.product-card__img,
.story__media img,
.custom-cta__media img,
.guide-figure img,
.contact-image img,
.gallery-3 img,
.media-pair img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: var(--ahd-radius);
}

.ahd-placeholder {
	position: relative;
	width: 100%;
	aspect-ratio: var(--ahd-ph-ratio, 4 / 5);
	overflow: hidden;
	border-radius: var(--ahd-radius);
	background: var(--ahd-sand);
}

.ahd-placeholder svg {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
}

/* -------------------------------------------------------------------------
 * 7. Icons & small utilities
 * ---------------------------------------------------------------------- */

.ahd-icon {
	flex: none;
	display: inline-block;
	vertical-align: middle;
}

.link-arrow {
	display: inline-flex;
	align-items: center;
	gap: 0.55em;
	font-size: var(--ahd-text-sm);
	font-weight: 400;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	text-decoration: none;
	color: var(--ahd-text);
	padding-bottom: 4px;
	border-bottom: 1px solid var(--ahd-line);
	transition: border-color var(--ahd-dur-fast) var(--ahd-ease), color var(--ahd-dur-fast) var(--ahd-ease);
}

.link-arrow .ahd-icon {
	transition: transform var(--ahd-dur) var(--ahd-ease);
}

.link-arrow:hover {
	color: var(--ahd-accent);
	border-color: currentColor;
}

.link-arrow:hover .ahd-icon {
	transform: translateX(4px);
}

.link-arrow--head {
	white-space: nowrap;
}

@media (max-width: 699px) {
	.link-arrow--head {
		display: none;
	}
}

/* Honeypot — visually gone, still in the accessibility tree for bots only. */
.ahd-hp {
	position: absolute !important;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.spinner-dot {
	display: inline-block;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: var(--ahd-terracotta);
	animation: ahd-pulse 1.1s var(--ahd-ease) infinite;
}

@keyframes ahd-pulse {
	0%, 100% { opacity: 0.25; transform: scale(0.8); }
	50% { opacity: 1; transform: scale(1.1); }
}

@keyframes ahd-fade-up {
	from { opacity: 0; transform: translateY(14px); }
	to { opacity: 1; transform: none; }
}

/* Reveal-on-scroll, applied by main.js only when motion is welcome. */
[data-ahd-reveal] {
	opacity: 0;
}

[data-ahd-reveal].is-revealed {
	animation: ahd-fade-up 700ms var(--ahd-ease) forwards;
}

@media (prefers-reduced-motion: reduce) {
	[data-ahd-reveal] {
		opacity: 1;
		animation: none;
	}
}
