/* Dam Writers 4 — global styles (render-blocking; keep small).
   Tokens come from theme.json (--wp--preset--*, --wp--custom--*). No !important, no page-ID selectors.
   Block-specific CSS lives in assets/css/blocks/*.css (wp_enqueue_block_style).

   z-index plan
     auto/0   page content
     1        local stacking inside components
     20       .dwt-header (static, never overlaps content; establishes its stacking context)
     30       .dwt-language__menu (inside the header context only)
     100      .dwt-skip-link when focused
     9998     audit tool fixed overlays (dwfcc5.css) — always above the header
     top layer  native <dialog> (audit payment/recovery dialogs, .dwt-mobile-menu) — above everything
*/

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
:where(body:not(.dwv4-legacy), .is-dwv4) :where(h1, h2, h3, h4) { text-wrap: balance; }
:where(body:not(.dwv4-legacy), .is-dwv4) :where(p, li) { text-wrap: pretty; }
:focus-visible { outline: 3px solid var(--wp--preset--color--brand); outline-offset: 3px; border-radius: 4px; }

/* Header, main and footer sit flush (no root block gap between template parts). */
.wp-site-blocks > * + * { margin-block-start: 0; }

/* Links in running text: distinguishable without colour (BUILD-SPEC §9). */
:where(.wp-site-blocks) a:where(:not(.wp-element-button)) {
	text-decoration-thickness: 1px;
	text-underline-offset: 0.18em;
}
:where(.wp-site-blocks) a:where(:not(.wp-element-button)):hover { text-decoration-thickness: 2px; }

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

/* Block style variation "eyebrow" (styles/eyebrow.json) sizes to its text. */
.is-style-eyebrow { width: fit-content; }

/* ---------- skip link ---------- */
.dwt-skip-link {
	position: absolute;
	left: var(--wp--custom--gutter);
	top: 0.75rem;
	z-index: 100;
	padding: 0.625rem 1rem;
	border-radius: var(--wp--custom--radius--pill);
	background: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--white);
	font-weight: 700;
	font-size: var(--wp--preset--font-size--small);
	text-decoration: none;
	transform: translateY(-200%);
}
.dwt-skip-link:focus { transform: none; }

/* ---------- header ---------- */
.dwt-header {
	position: relative;
	z-index: 20;
	background: var(--wp--preset--color--white);
	border-bottom: 1px solid var(--wp--preset--color--border);
}
.dwt-header__inner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem 1rem;
	max-width: var(--wp--style--global--wide-size);
	margin-inline: auto;
	padding: 1rem var(--wp--custom--gutter);
}
.dwt-header :where(a) { text-decoration: none; }
/* The shell groups use flow layout in the editor; neutralise its block-gap margins here. */
:is(.dwt-header__inner, .dwt-header__actions, .dwt-footer__inner, .dwt-footer__grid) > * { margin-block: 0; }
.dwt-brand {
	margin: 0;
	font-size: 1.0625rem;
	font-weight: 800;
	letter-spacing: -0.01em;
	line-height: 1.2;
}
.dwt-brand a { color: var(--wp--preset--color--ink); }

.dwt-menu { list-style: none; margin: 0; padding: 0; }
.dwt-nav .dwt-menu {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 1.375rem;
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: 500;
}
.dwt-nav a {
	display: inline-block;
	padding-block: 0.375rem;
	color: var(--wp--preset--color--ink);
}
.dwt-nav a:hover { color: var(--wp--preset--color--brand-dark); }
.dwt-menu :is(.current-menu-item, .dwt-current-section) > a {
	color: var(--wp--preset--color--brand-dark);
	font-weight: 700;
}
.dwt-nav .sub-menu { display: none; }

.dwt-header__actions {
	display: flex;
	align-items: center;
	gap: 0.625rem;
}

/* Language switch: <details> keeps working without JS; header.js adds outside-click/Escape. */
.dwt-language { position: relative; }
.dwt-language > summary {
	display: inline-flex;
	align-items: center;
	gap: 0.25rem;
	min-height: 2.25rem;
	padding: 0.375rem 0.75rem;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--pill);
	color: var(--wp--preset--color--ink);
	font-size: 0.75rem;
	font-weight: 700;
	white-space: pre;
	cursor: pointer;
	list-style: none;
}
.dwt-language > summary::-webkit-details-marker { display: none; }
.dwt-language > summary:hover,
.dwt-language[open] > summary { background: var(--wp--preset--color--surface); }
.dwt-language__menu {
	position: absolute;
	right: 0;
	top: calc(100% + 0.5rem);
	z-index: 30;
	display: grid;
	min-width: 10rem;
	padding: 0.375rem;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 12px;
	background: var(--wp--preset--color--white);
	box-shadow: var(--wp--preset--shadow--card);
}
.dwt-language__menu a {
	padding: 0.5rem 0.75rem;
	border-radius: 8px;
	color: var(--wp--preset--color--ink);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
}
.dwt-language__menu a:hover { background: var(--wp--preset--color--surface); }
.dwt-language__menu a[aria-current="page"] { color: var(--wp--preset--color--brand-dark); }

.dwt-contact-button,
.dwt-menu-toggle {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	min-height: 2.25rem;
	padding: 0.4375rem 0.875rem;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--pill);
	background: var(--wp--preset--color--white);
	color: var(--wp--preset--color--ink);
	font: inherit;
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
}
.dwt-contact-button:hover,
.dwt-menu-toggle:hover { background: var(--wp--preset--color--surface); color: var(--wp--preset--color--ink); }

/* Mobile menu: hidden until JS is available (html.dwt-js) and the viewport is narrow. */
.dwt-mobile { display: contents; }
.dwt-menu-toggle { display: none; }
.dwt-menu-toggle__icon,
.dwt-menu-toggle__icon::before,
.dwt-menu-toggle__icon::after {
	display: block;
	width: 14px;
	height: 2px;
	border-radius: 2px;
	background: currentColor;
}
.dwt-menu-toggle__icon { position: relative; }
.dwt-menu-toggle__icon::before,
.dwt-menu-toggle__icon::after { content: ""; position: absolute; left: 0; }
.dwt-menu-toggle__icon::before { top: -5px; }
.dwt-menu-toggle__icon::after { top: 5px; }
.dwt-menu-toggle__icon.is-open { background: transparent; }
.dwt-menu-toggle__icon.is-open::before { top: 0; transform: rotate(45deg); }
.dwt-menu-toggle__icon.is-open::after { top: 0; transform: rotate(-45deg); }

.dwt-mobile-menu {
	width: 100%;
	max-width: 100%;
	height: auto;
	max-height: 100dvh;
	margin: 0;
	inset: 0 0 auto 0;
	padding: 1rem var(--wp--custom--gutter) 1.5rem;
	border: 0;
	border-bottom: 1px solid var(--wp--preset--color--border);
	background: var(--wp--preset--color--white);
	color: var(--wp--preset--color--ink);
	overflow-y: auto;
	overscroll-behavior: contain;
}
.dwt-mobile-menu::backdrop { background: rgb(22 30 41 / 0.45); }
.dwt-mobile-menu__bar { display: flex; justify-content: flex-end; }
.dwt-mobile-menu .dwt-menu-close { display: inline-flex; }
.dwt-mobile-menu__nav .dwt-menu { display: grid; margin-top: 0.75rem; }
.dwt-mobile-menu__nav a {
	display: block;
	padding: 0.875rem 0;
	border-bottom: 1px solid var(--wp--preset--color--border);
	color: var(--wp--preset--color--ink);
	font-size: 1.125rem;
	font-weight: 700;
	text-decoration: none;
}
.dwt-mobile-menu__nav .sub-menu { list-style: none; margin: 0; padding-left: 1rem; }
.dwt-mobile-menu__nav .sub-menu a { font-size: 1rem; font-weight: 600; }

@media (max-width: 900px) {
	/* No JS: the menu wraps onto its own row under the brand. */
	.dwt-nav { order: 3; flex-basis: 100%; }
	/* With JS: the row is replaced by the Menu button. */
	.dwt-js .dwt-nav { display: none; }
	.dwt-js .dwt-menu-toggle { display: inline-flex; }
}
@media (max-width: 600px) {
	/* The Contact item stays reachable in the menu; the pill is dropped to fit 320px. */
	.dwt-js .dwt-contact-button { display: none; }
	.dwt-header__actions { gap: 0.5rem; }
}

/* ---------- main ---------- */
.dw-main { display: block; }
.dwt-page-head { padding-block: var(--wp--preset--spacing--50) var(--wp--preset--spacing--20); }
.dwt-page-head + .dwt-content { padding-bottom: var(--wp--preset--spacing--60); }
.dwt-main--404,
.dwt-main--blog,
.dwt-main--archive,
.dwt-main--index,
.dwt-main--search { padding-bottom: var(--wp--preset--spacing--60); }

/* Content Audit hero (4.0 pattern contract): the pattern's outer Group carries
   `dwv4-audit-hero`, its two-column Columns/Group carries `dwv4-audit-hero__grid`.
   While the tool runs or shows a report, the hero becomes one column. */
.dwv4-audit-hero:has(.dwfcc5-progress.is-active, .dwfcc5-report-output:not(:empty)) .dwv4-audit-hero__grid {
	grid-template-columns: minmax(0, 1fr);
	flex-direction: column;
}
.dwv4-audit-hero:has(.dwfcc5-progress.is-active, .dwfcc5-report-output:not(:empty)) .dwv4-audit-hero__grid > * {
	flex-basis: 100%;
	width: 100%;
	max-width: none;
}

/* ---------- footer ---------- */
.dwt-footer {
	background: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--ink-soft);
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.6;
}
.dwt-footer__inner {
	max-width: var(--wp--style--global--wide-size);
	margin-inline: auto;
	padding: 4rem var(--wp--custom--gutter) 1.75rem;
}
.dwt-footer__grid {
	display: grid;
	grid-template-columns: minmax(0, 1.6fr) repeat(2, minmax(0, 1fr));
	gap: 2.5rem;
}
.dwt-footer :where(p) { margin: 0; }
.dwt-footer a { color: var(--wp--preset--color--ink-soft); text-decoration: none; }
.dwt-footer a:hover { color: var(--wp--preset--color--white); text-decoration: underline; }
.dwt-footer :focus-visible { outline-color: var(--wp--preset--color--pink-on-ink); }
.dwt-footer__name { font-size: 1.125rem; font-weight: 800; line-height: 1.2; }
.dwt-footer__name a { color: var(--wp--preset--color--white); }
.dwt-footer__text { margin-top: 0.75rem; max-width: 40ch; }
.dwt-footer__mail { margin-top: 0.875rem; }
.dwt-footer__mail a { color: var(--wp--preset--color--pink-on-ink); font-weight: 600; }
.dwt-footer__heading {
	margin: 0;
	color: var(--wp--preset--color--white);
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: 800;
	letter-spacing: 0.08em;
	line-height: 1.3;
	text-transform: uppercase;
}
.dwt-footer__col ul { display: grid; gap: 0.5625rem; margin: 0.875rem 0 0; padding: 0; list-style: none; }
.dwt-footer__inner > .dwt-footer__meta {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 0.625rem;
	margin-top: 3rem;
	padding-top: 1.25rem;
	border-top: 1px solid var(--wp--preset--color--ink-line);
	font-size: var(--wp--preset--font-size--x-small);
}
@media (max-width: 860px) {
	.dwt-footer__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.dwt-footer__grid > .dwt-footer__brand { grid-column: 1 / -1; }
}
@media (max-width: 520px) { .dwt-footer__grid { grid-template-columns: minmax(0, 1fr); } }

/* No transitions/animations in the shell, so nothing to stop for prefers-reduced-motion. */
