/**
 * Bhumiwala base styles.
 *
 * Element defaults only — the shapes every page inherits before a single
 * component is written. Every value here comes from tokens.css; if you find
 * yourself typing a hex code or a pixel size below, it belongs in tokens.
 *
 * Component styles do not live here. They ship with the widget that owns them.
 */

/* ── Reset ──────────────────────────────────────────────────────────── */

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

body,
h1, h2, h3, h4, h5, h6,
p, figure, blockquote, dl, dd {
	margin: 0;
}

html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
	tab-size: 4;
}

/* Anchored scrolling must clear the sticky header, and the offset has to be
   the header's own height rather than a guess — functions.php sets the
   custom property, and the header component keeps it current. */
html:focus-within {
	scroll-behavior: smooth;
}

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

:target {
	scroll-margin-top: calc(var(--bw-header-height, 4.5rem) + var(--bw-space-4));
}

/* ── Document ───────────────────────────────────────────────────────── */

body {
	background-color: var(--bw-bg);
	color: var(--bw-text);
	font-family: var(--bw-font-sans);
	font-size: var(--bw-text-base);
	line-height: var(--bw-leading-normal);
	font-weight: var(--bw-weight-regular);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
	overflow-wrap: break-word;
}

/* ── Headings ───────────────────────────────────────────────────────── */

h1, h2, h3, h4, h5, h6 {
	font-family: var(--bw-font-display);
	font-weight: var(--bw-weight-semibold);
	line-height: var(--bw-leading-tight);
	letter-spacing: var(--bw-tracking-tight);
	color: var(--bw-text);
	text-wrap: balance;
}

h1 { font-size: var(--bw-display-1); }
h2 { font-size: var(--bw-display-2); }
h3 { font-size: var(--bw-display-3); }
h4 { font-size: var(--bw-text-lg); line-height: var(--bw-leading-snug); }
h5 { font-size: var(--bw-text-md); line-height: var(--bw-leading-snug); }
h6 {
	font-size: var(--bw-text-sm);
	line-height: var(--bw-leading-snug);
	letter-spacing: var(--bw-tracking-wide);
	text-transform: uppercase;
	color: var(--bw-text-muted);
}

/* Running text reads better short. Headings and UI copy are exempt because
   they are laid out deliberately. */
p {
	text-wrap: pretty;
}

/* ── Links ──────────────────────────────────────────────────────────── */

a {
	color: var(--bw-link);
	text-decoration-thickness: 1px;
	text-underline-offset: 0.15em;
	transition: color var(--bw-duration-fast) var(--bw-ease);
}

a:hover {
	color: var(--bw-link-hover);
}

/* ── Focus ──────────────────────────────────────────────────────────── */

/* One ring, everywhere, and only for keyboard users. Never remove it: a
   keyboard user with no visible focus cannot use the site at all. */
:focus-visible {
	outline: var(--bw-focus-width) solid var(--bw-focus);
	outline-offset: var(--bw-focus-offset);
	border-radius: var(--bw-radius-xs);
}

/* ── Media ──────────────────────────────────────────────────────────── */

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

img,
video {
	height: auto;
}

/* Any image without intrinsic dimensions is a layout-shift bug waiting to
   happen; this keeps the damage contained while it is being fixed. */
img:not([width]):not([height]) {
	aspect-ratio: 16 / 9;
	object-fit: cover;
}

/* ── Forms ──────────────────────────────────────────────────────────── */

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

textarea {
	resize: vertical;
}

button,
[type="button"],
[type="submit"],
[type="reset"] {
	cursor: pointer;
}

/* Tap targets. WCAG 2.2 AA asks for 24px minimum; 44px is what a thumb
   actually needs, so that is what interactive controls get. */
button,
[type="button"],
[type="submit"],
[type="reset"],
select {
	min-height: 44px;
}

/* ── Lists ──────────────────────────────────────────────────────────── */

ul, ol {
	padding-inline-start: var(--bw-space-5);
}

/* ── Tables ─────────────────────────────────────────────────────────── */

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

th,
td {
	text-align: start;
	padding: var(--bw-space-3);
	border-bottom: 1px solid var(--bw-border);
}

th {
	font-weight: var(--bw-weight-semibold);
	color: var(--bw-text);
}

/* ── Layout helpers ─────────────────────────────────────────────────── */

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

.bw-container--wide { max-width: var(--bw-container-wide); }
.bw-container--text { max-width: var(--bw-container-text); }

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

/* ── Accessibility utilities ────────────────────────────────────────── */

/* Visually hidden but still announced. The clip-path pairing is what keeps
   it hidden in browsers that ignore the legacy clip property. */
.bw-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

/* The skip link is the first thing a keyboard user meets. It must be
   invisible until focused and unmissable the moment it is. */
.bw-skip-link {
	position: absolute;
	inset-inline-start: var(--bw-space-4);
	inset-block-start: var(--bw-space-4);
	z-index: var(--bw-z-toast);
	transform: translateY(-200%);
	padding: var(--bw-space-3) var(--bw-space-5);
	background-color: var(--bw-bg);
	color: var(--bw-link);
	font-weight: var(--bw-weight-semibold);
	border-radius: var(--bw-radius-sm);
	box-shadow: var(--bw-shadow-lg);
	transition: transform var(--bw-duration-base) var(--bw-ease-out);
}

.bw-skip-link:focus {
	transform: translateY(0);
}

/* ── Print ──────────────────────────────────────────────────────────── */

@media print {
	.bw-no-print,
	.bw-skip-link {
		display: none !important;
	}

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