/**
 * Allura Medical - base layer.
 *
 * Design tokens, reset, typography and layout utilities. Everything else in
 * the theme is built from these values; change a token here and it cascades.
 */

/*--------------------------------------------------------------
1. Design tokens
--------------------------------------------------------------*/
:root {
	/*
	 * The five site colours, as RGB triplets.
	 *
	 * Everything below — and every translucent value anywhere in the theme —
	 * is built from these, via rgba(var(--am-ink-rgb), .5) and friends. That
	 * keeps overlays, scrims and shadows on-palette by construction: there is
	 * no way to introduce a sixth hue without editing this block.
	 */
	--am-white-rgb: 255, 255, 255;
	--am-ink-rgb: 14, 13, 11;
	--am-brand-rgb: 137, 111, 92;
	--am-line-rgb: 230, 225, 222;
	--am-soft-rgb: 249, 246, 246;
	/* Cool off-white, used behind the accreditation logo strip. */
	--am-cool-rgb: 247, 250, 251;

	/* Brand palette */
	--am-brand: rgb(var(--am-brand-rgb));
	/*
	 * Hover / active state for brand elements. The palette contains no darker
	 * taupe, so interactions resolve to ink — a genuine state change without
	 * inventing a sixth colour. Set this to rgb(var(--am-brand-rgb)) to remove
	 * the effect, or to any palette token to change it.
	 */
	--am-brand-dark: rgb(var(--am-ink-rgb));
	--am-brand-soft: rgba(var(--am-brand-rgb), .08);

	/* Neutrals */
	--am-ink: rgb(var(--am-ink-rgb));
	--am-body: rgb(var(--am-ink-rgb));
	--am-muted: rgb(var(--am-brand-rgb));
	--am-line: rgb(var(--am-line-rgb));
	--am-white: rgb(var(--am-white-rgb));

	/* Surfaces */
	--am-surface: rgb(var(--am-white-rgb));
	--am-surface-tint: rgb(var(--am-line-rgb));
	--am-surface-soft: rgb(var(--am-soft-rgb));
	--am-surface-cool: rgb(var(--am-cool-rgb));

	/* Accents */
	--am-star: rgb(var(--am-brand-rgb));

	/*
	 * Form field outline at rest. This is a seventh colour, deliberately outside
	 * the palette above: the palette's lightest line (230, 225, 222) is warm and
	 * too faint to read as an input edge against a white card, so the form takes
	 * a neutral grey instead. Kept as its own token rather than folded into
	 * --am-placeholder, which also colours placeholder text.
	 */
	--am-field-rgb: 168, 168, 168;
	--am-field-border: rgb(var(--am-field-rgb));

	/* Placeholder text, matched to the field outline it sits inside. */
	--am-placeholder: rgb(var(--am-field-rgb));

	/* Typography */
	--am-font-display: "Playfair Display", Georgia, "Times New Roman", serif;
	--am-font-body: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

	--am-fs-hero: clamp(2.75rem, 5.2vw, 4.5rem);
	--am-fs-h2: clamp(2rem, 3.4vw, 3rem);
	--am-fs-h3: clamp(1.6rem, 2.4vw, 2.25rem);
	--am-fs-h4: 1.5rem;
	--am-fs-lead: clamp(1.05rem, 1.3vw, 1.25rem);
	--am-fs-base: 1rem;
	--am-fs-ui: 1.125rem;
	--am-fs-small: .875rem;

	--am-lh-display: 1.13;
	--am-lh-body: 1.6;

	/* Layout */
	--am-container: 1392px;
	--am-gutter: clamp(20px, 3.7vw, 56px);
	--am-section-y: clamp(56px, 7vw, 100px);

	/* Spacing scale */
	--am-space-1: 4px;
	--am-space-2: 8px;
	--am-space-3: 14px;
	--am-space-4: 20px;
	--am-space-5: 28px;
	--am-space-6: 40px;
	--am-space-7: 56px;
	--am-space-8: 80px;

	/* Scroll reveal */
	--am-reveal-shift: 56px;
	--am-reveal-duration: 1.15s;
	--am-reveal-delay: .15s;
	--am-reveal-ease: cubic-bezier(.16, 1, .3, 1);

	/* Effects */
	--am-radius: 4px;
	--am-radius-lg: 8px;
	--am-shadow: 0 1px 2px rgba(var(--am-ink-rgb), .04), 0 12px 32px rgba(var(--am-ink-rgb), .06);
	--am-transition: .25s cubic-bezier(.4, 0, .2, 1);
	--am-scrim: rgba(var(--am-ink-rgb), .45);
}

/*
 * One screen, as the person looking at it actually has one.
 *
 * svh rather than vh, so the foot of a full-screen block is not left
 * behind a phone's own browser chrome. --am-chrome is what the WordPress
 * admin bar takes off the top for anyone logged in — it is fixed over the
 * viewport and pushes the document down past itself, so a plain 100vh
 * block starts late, ends off the bottom, and the page scrolls by exactly
 * that much. A visitor is never logged in and the token is zero for them.
 *
 * Declared on body rather than :root because body is where WordPress puts
 * the admin-bar class, and a var() resolves against the element that
 * declares it rather than the one that uses it. Both have to be here.
 */
body {
	--am-chrome: 0px;
	--am-screen: calc(100vh - var(--am-chrome));
}

@supports (height: 1svh) {
	body {
		--am-screen: calc(100svh - var(--am-chrome));
	}
}

body.admin-bar {
	--am-chrome: 32px;
}

@media screen and (max-width: 782px) {
	body.admin-bar {
		--am-chrome: 46px;
	}
}

/* Narrower than this the admin bar scrolls away with the page instead. */
@media screen and (max-width: 600px) {
	body.admin-bar {
		--am-chrome: 0px;
	}
}

/*--------------------------------------------------------------
2. Reset
--------------------------------------------------------------*/
*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
	scroll-behavior: smooth;
}

body {
	margin: 0;
	background-color: var(--am-surface);
	color: var(--am-body);
	font-family: var(--am-font-body);
	font-size: var(--am-fs-base);
	line-height: var(--am-lh-body);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

img,
svg,
video,
iframe {
	max-width: 100%;
	height: auto;
}

img,
video {
	display: block;
}

figure {
	margin: 0;
}

ul, ol {
	margin: 0;
	padding: 0;
}

li {
	list-style: none;
}

button {
	font: inherit;
	color: inherit;
}

hr {
	height: 1px;
	margin: var(--am-space-6) 0;
	border: 0;
	background-color: var(--am-line);
}

/*--------------------------------------------------------------
3. Typography
--------------------------------------------------------------*/
h1, h2, h3, h4, h5, h6 {
	margin: 0;
	color: var(--am-ink);
	font-family: var(--am-font-display);
	font-weight: 400;
	line-height: var(--am-lh-display);
}

h1 { font-size: var(--am-fs-hero); }

/*
 * The display scale is built for the artboard, where its floor is a
 * minimum. On a phone that floor is the size: 5.2vw of 390px is 20px, so
 * every h1 sat at the 44px bottom of the clamp regardless of the handset.
 * A steeper ramp over a lower floor lets the width matter again, and it
 * meets the desktop value exactly at the breakpoint, so nothing jumps.
 */
@media (max-width: 767px) {
	:root {
		--am-fs-hero: clamp(2rem, 8.5vw, 2.75rem);
	}
}
h2 { font-size: var(--am-fs-h2); }
h3 { font-size: var(--am-fs-h3); }
h4 { font-size: var(--am-fs-h4); }

p {
	margin: 0;
}

a {
	color: inherit;
	text-decoration: none;
	transition: color var(--am-transition), opacity var(--am-transition);
}

a:hover,
a:focus {
	color: var(--am-brand);
}

strong {
	font-weight: 700;
}

blockquote {
	margin: 0;
}

/* Editor / rich text content */
.am-prose > * + * {
	margin-top: 1.25em;
}

.am-prose p,
.am-prose li {
	font-size: var(--am-fs-lead);
	line-height: 1.65;
	color: var(--am-body);
}

.am-prose ul,
.am-prose ol {
	padding-left: 1.35em;
}

.am-prose li {
	list-style: disc;
	margin-bottom: .4em;
}

.am-prose ol li {
	list-style: decimal;
}

.am-prose a {
	color: var(--am-brand);
	text-decoration: underline;
	text-underline-offset: .2em;
}

/*
 * Headings inside written content.
 *
 * The display scale is built for section titles standing alone on a page —
 * an h2 there is up to 48px. As a subheading in a privacy policy that is a
 * shout, and h2 and h3 are barely distinguishable from each other at the
 * top of the clamp. These are their own, smaller, and spaced by what comes
 * before them rather than after: a heading belongs to the text under it.
 */
.am-prose h2,
.am-prose h3,
.am-prose h4 {
	margin-top: 2em;
	margin-bottom: .6em;
	line-height: 1.2;
}

.am-prose h2 {
	font-size: clamp(1.5rem, 2.2vw, 1.875rem);
}

.am-prose h3 {
	font-size: clamp(1.25rem, 1.7vw, 1.4rem);
}

/*
 * The fourth level is where a serif stops helping: by this depth it is a
 * label on a clause, and the body face reads as one.
 */
.am-prose h4 {
	color: var(--am-ink);
	font-family: var(--am-font-body);
	font-size: var(--am-fs-lead);
	font-weight: 600;
}

/*
 * A two-tone heading, set the way the section heads elsewhere on the site
 * set one: "Built around the patient, / not the procedure." — first half in
 * ink, second half in brand, upright, and the same face, size and weight as
 * each other. Colour is the only thing that separates them.
 *
 * These pages reach that through the editor rather than through fields, so
 * the two halves arrive as <strong> and <em>. Left to the browser they read
 * as two different things rather than one heading: <strong> takes 700
 * against the heading's own 400, and <em> arrives slanted and in the same
 * ink as the words in front of it — so the phrase had no colour to set it
 * apart, and both a slant and a weight that the design never asked for.
 * The markup stays as the editor wrote it; only how it is drawn changes.
 *
 * Family and size are inherited on purpose rather than stated. An h2's
 * halves are h2-sized and an h4's are the body face at the body size, so a
 * heading always agrees with itself whatever level it is.
 */
.am-prose :is( h2, h3, h4 ) :is( strong, b ) {
	font-weight: inherit;
}

.am-prose :is( h2, h3, h4 ) :is( em, i ) {
	color: var(--am-muted);
	font-family: inherit;
	font-size: inherit;
	font-weight: inherit;
	font-style: normal;
}

/* The first heading has the masthead above it, which is spacing enough. */
.am-prose > :first-child {
	margin-top: 0;
}

/*
 * Tables. A cookie policy is mostly one of these, and the browser default
 * — no borders, columns sized by whichever cell happens to be longest — is
 * not readable at any width.
 *
 * The wrapper scrolls rather than the page: four columns of cookie names
 * will not fit a phone at any type size, and a table that widens the
 * document takes every paragraph with it.
 */
.am-prose table {
	width: 100%;
	border-collapse: collapse;
	font-size: var(--am-fs-base);
}

.am-prose th,
.am-prose td {
	padding: 12px 14px;
	border-bottom: 1px solid var(--am-line);
	text-align: left;
	vertical-align: top;
	line-height: 1.5;
}

.am-prose th {
	color: var(--am-ink);
	font-weight: 600;
	border-bottom-width: 2px;
}

.am-prose td {
	color: var(--am-body);
}

.am-prose .wp-block-table,
.am-prose figure.wp-block-table {
	overflow-x: auto;
	margin: 0;
}

/* A quotation in written content, as distinct from a testimonial. */
.am-prose blockquote {
	padding-left: var(--am-space-4);
	border-left: 2px solid var(--am-brand);
	color: var(--am-muted);
}

.am-prose hr {
	margin-block: 2em;
	border: 0;
	border-top: 1px solid var(--am-line);
}

/*--------------------------------------------------------------
4. Layout utilities
--------------------------------------------------------------*/
.am-container {
	width: 100%;
	max-width: calc(var(--am-container) + var(--am-gutter) * 2);
	margin-inline: auto;
	padding-inline: var(--am-gutter);
}

.am-section {
	padding-block: var(--am-section-y);
}

.am-section--tint {
	background-color: var(--am-surface-tint);
}

.am-section--soft {
	background-color: var(--am-surface-soft);
}

.am-section--cool {
	background-color: var(--am-surface-cool);
}

.am-section--dark {
	background-color: var(--am-ink);
	color: var(--am-white);
}

.am-section--dark h1,
.am-section--dark h2,
.am-section--dark h3,
.am-section--dark h4 {
	color: var(--am-white);
}

/* Thin horizontal rule that fills the space between two items. */
.am-rule {
	flex: 1 1 auto;
	height: 1px;
	min-width: 24px;
	background-color: var(--am-brand);
}

/*--------------------------------------------------------------
4b. Scroll reveal
--------------------------------------------------------------*/
/*
 * Section contents rise into place as they enter the viewport.
 *
 * The hiding is gated on .am-anim, which a small inline script in the head
 * adds. That script also removes the class again if the main script has not
 * reported in, so a JavaScript failure can never leave the page permanently
 * blank — the worst case is that everything simply shows.
 *
 * The target list is wrapped in :where() so it carries no specificity of its
 * own. Without that, a three-class selector like ".am-hero .am-stats" outweighs
 * ".is-revealed" and the element stays invisible for good — which is exactly
 * what happened to the hero counters. :where() makes the reveal rule always
 * win, whatever is added to the list later.
 */
.am-anim :where(
	.am-section:not(.am-process) > .am-container,
	.am-process .am-section-head,
	.am-hero__content,
	.am-hero .am-stats,
	.am-cta__inner,
	.am-sitewide-widget
) {
	opacity: 0;
	transform: translateY(var(--am-reveal-shift));
	will-change: opacity, transform;
}

.am-anim .is-revealed {
	opacity: 1;
	transform: none;
	transition:
		opacity var(--am-reveal-duration) var(--am-reveal-ease) var(--am-reveal-delay),
		transform var(--am-reveal-duration) var(--am-reveal-ease) var(--am-reveal-delay);
	/* Once it has arrived, stop reserving a compositor layer for it. */
	will-change: auto;
}

/*
 * The hero is on screen the instant the page loads, so it arrives with no
 * delay — waiting would read as the page hesitating rather than as motion.
 */
.am-hero__content,
.am-hero .am-stats {
	--am-reveal-delay: 0s;
}

/*
 * Sections clip their own overflow so the offset can never widen the page or
 * add a stray scrollbar while an element is still travelling.
 */
.am-section,
.am-hero,
.am-cta {
	overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
	/* Show everything immediately; movement is the whole effect here. */
	.am-anim :where(
		.am-section:not(.am-process) > .am-container,
		.am-process .am-section-head,
		.am-hero__content,
		.am-hero .am-stats,
		.am-cta__inner,
		.am-sitewide-widget
	) {
		opacity: 1;
		transform: none;
		transition: none;
	}
}

/*--------------------------------------------------------------
5. Accessibility
--------------------------------------------------------------*/
.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.screen-reader-text:focus {
	display: block;
	top: 8px;
	left: 8px;
	z-index: 100000;
	width: auto;
	height: auto;
	padding: 14px 22px;
	clip: auto;
	background-color: var(--am-white);
	border-radius: var(--am-radius);
	box-shadow: var(--am-shadow);
	color: var(--am-ink);
	font-size: var(--am-fs-small);
	font-weight: 700;
	text-decoration: none;
}

:focus-visible {
	outline: 2px solid var(--am-brand);
	outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

	*,
	*::before,
	*::after {
		animation-duration: .01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: .01ms !important;
		scroll-behavior: auto !important;
	}
}

/*--------------------------------------------------------------
6. WordPress core classes
--------------------------------------------------------------*/
.alignleft {
	float: left;
	margin: .3rem 1.5rem 1.25rem 0;
}

.alignright {
	float: right;
	margin: .3rem 0 1.25rem 1.5rem;
}

.aligncenter {
	display: block;
	margin-inline: auto;
}

.alignwide {
	max-width: var(--am-container);
}

.alignfull {
	max-width: 100%;
}

.wp-caption-text,
.wp-block-image figcaption {
	color: var(--am-muted);
	font-size: var(--am-fs-small);
	text-align: center;
}

.sticky,
.bypostauthor {
	display: block;
}

.gallery {
	display: grid;
	gap: var(--am-space-4);
	grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}
