/**
 * NSCB base styles: reset, element defaults, accessibility.
 * No components or page layouts belong here.
 */

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

* {
	margin: 0;
}

html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
	color-scheme: dark;
	scroll-behavior: smooth;
	scroll-padding-top: calc(var(--nscb-header-height) + var(--nscb-space-4));
}

/* Column layout keeps the footer at the bottom of short pages. */
body {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
	min-height: 100dvh;
	background-color: var(--nscb-color-bg);
	color: var(--nscb-color-text);
	font-family: var(--nscb-font-body);
	font-size: var(--nscb-font-size-base);
	font-weight: var(--nscb-font-weight-regular);
	line-height: var(--nscb-leading-normal);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4,
h5,
h6 {
	font-family: var(--nscb-font-heading);
	font-weight: var(--nscb-font-weight-heading);
	line-height: var(--nscb-leading-tight);
	letter-spacing: var(--nscb-tracking-tight);
	overflow-wrap: break-word;
	text-wrap: balance;
}

h1 { font-size: var(--nscb-text-4xl); }
h2 { font-size: var(--nscb-text-3xl); }
h3 { font-size: var(--nscb-text-2xl); }
h4 { font-size: var(--nscb-text-xl); }
h5 { font-size: var(--nscb-text-lg); }
h6 { font-size: var(--nscb-text-md); }

p,
li,
figcaption {
	overflow-wrap: break-word;
	text-wrap: pretty;
}

a {
	color: inherit;
	text-decoration-color: var(--nscb-color-accent);
	text-decoration-thickness: 1px;
	text-underline-offset: 0.2em;
	transition: color var(--nscb-duration-fast) var(--nscb-ease-standard);
}

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

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

img,
video {
	height: auto;
}

/* Photos held back until a script loads them (nscb_defer_image()): no alt-text
   flash while empty; without JavaScript their <noscript> copy is shown instead. */
img[data-defer-src] {
	color: transparent;
}

.no-js img[data-defer-src] {
	display: none;
}

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

button {
	cursor: pointer;
}

button:disabled {
	cursor: not-allowed;
}

textarea {
	resize: vertical;
}

table {
	border-collapse: collapse;
}

hr {
	border: 0;
	border-top: 1px solid var(--nscb-color-border);
}

::selection {
	background-color: var(--nscb-color-highlight);
	color: var(--nscb-color-highlight-text);
}

/* Visible keyboard focus everywhere (the highlight color reads clearly on every
   dark surface); no outline for mouse clicks. */
:focus-visible {
	outline: 2px solid var(--nscb-color-highlight);
	outline-offset: 3px;
	border-radius: var(--nscb-radius-sm);
}

:focus:not(:focus-visible) {
	outline: none;
}

/* The hidden attribute always wins over component display rules. */
[hidden] {
	display: none !important;
}

/* Layout: centred content column with mobile-safe side padding. */
.nscb-container {
	width: 100%;
	max-width: calc(var(--nscb-container-xl) + 2 * var(--nscb-gutter));
	margin-inline: auto;
	padding-inline: max(var(--nscb-gutter), env(safe-area-inset-left)) max(var(--nscb-gutter), env(safe-area-inset-right));
}

.nscb-container--narrow {
	max-width: calc(var(--nscb-container-md) + 2 * var(--nscb-gutter));
}

.site-main {
	flex: 1 0 auto;
}

.site-main:focus {
	outline: none;
}

/* Temporary fallback-template spacing until page templates exist. */
.nscb-fallback {
	padding-block: var(--nscb-space-7);
}

.nscb-fallback article > * + * {
	margin-top: var(--nscb-space-4);
}

/* WordPress core accessibility helpers. */
.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;
}

.screen-reader-text:focus {
	background-color: var(--nscb-color-surface);
	clip: auto !important;
	clip-path: none;
	color: var(--nscb-color-text);
	display: block;
	height: auto;
	left: var(--nscb-space-2);
	padding: var(--nscb-space-3) var(--nscb-space-4);
	top: var(--nscb-space-2);
	width: auto;
	z-index: var(--nscb-z-modal);
}

/* Duotone icons (inc/icons.php): a soft highlight-tinted fill under the
   outline. On a highlight-colored background the fill follows the icon's own
   color instead, so it stays visible. */
.nscb-icon__tone {
	fill: var(--nscb-icon-tone, var(--nscb-color-highlight));
	stroke: none;
	opacity: var(--nscb-icon-tone-opacity, 0.3);
}

.nscb-btn,
.nscb-round--accent {
	--nscb-icon-tone: currentColor;
	--nscb-icon-tone-opacity: 0.2;
}

/* 3D icons (inc/icons-3d.php). The gradient sprite takes no space; it is not
   display:none, which would disable its gradients in some browsers. */
.nscb-icon3d-sprite {
	position: absolute;
	width: 0;
	height: 0;
	overflow: hidden;
}

.nscb-icon3d--tile {
	display: block;
	flex: none;
	width: 3rem;
	height: auto;
	aspect-ratio: 48 / 50;
	filter: drop-shadow(0 6px 12px color-mix(in srgb, var(--nscb-color-highlight) 16%, transparent));
	transition: transform var(--nscb-duration-base) var(--nscb-ease-out), filter var(--nscb-duration-base) var(--nscb-ease-standard);
}

/* Lift and glow when the icon's own link, or the row it labels, is hovered. */
a:hover > .nscb-icon3d--tile,
a:focus-visible > .nscb-icon3d--tile,
a:hover .nscb-icon3d--tile,
li:has(> a:hover) > .nscb-icon3d--tile {
	transform: translateY(-2px);
	filter: drop-shadow(0 10px 16px color-mix(in srgb, var(--nscb-color-highlight) 34%, transparent));
}

.nscb-icon3d--bare {
	overflow: visible;
	filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.45));
}

@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;
	}
}
