/* NoteyStuff — base layer.
 *
 * Element-level defaults, layout primitives and focus behaviour. Everything here reads
 * semantic tokens from tokens.css. Selectors stay low-specificity so this layers over
 * Kadence rather than fighting it.
 */

/* ---------------------------------------------------------------
 * Document
 * --------------------------------------------------------------- */

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
}

body {
	background-color: var(--ns-color-bg);
	color: var(--ns-color-text);
	font-family: var(--ns-font-body);
	font-size: var(--ns-text-base);
	font-weight: var(--ns-weight-body);
	line-height: var(--ns-leading-body);
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

/* Nothing may push the page sideways. Verified at 320/390/768/1024/1280+. */
html,
body {
	overflow-x: clip;
}

/* ---------------------------------------------------------------
 * Typography
 * --------------------------------------------------------------- */

h1,
h2,
h3,
h4,
h5,
h6,
.ns-display {
	color: var(--ns-color-text);
	font-family: var(--ns-font-display);
	font-weight: var(--ns-weight-display);
	line-height: var(--ns-leading-tight);
	letter-spacing: var(--ns-tracking-tight);
	text-wrap: balance;
	margin-block: 0 var(--ns-space-4);
}

h1 { font-size: var(--ns-h1); }
h2 { font-size: var(--ns-h2); }
h3 { font-size: var(--ns-h3); }
h4 { font-size: var(--ns-h4); }

h5,
h6 {
	font-size: var(--ns-text-base);
	font-weight: var(--ns-weight-medium);
	letter-spacing: var(--ns-tracking-wide);
	text-transform: uppercase;
}

p {
	margin-block: 0 var(--ns-space-4);
	text-wrap: pretty;
}

p:last-child {
	margin-bottom: 0;
}

/* Long-form copy gets a readable measure; grid and card children opt out. */
.ns-prose > p,
.ns-prose > ul,
.ns-prose > ol {
	max-width: var(--ns-measure);
}

.ns-lead {
	font-size: var(--ns-text-lg);
	color: var(--ns-color-text-muted);
	max-width: var(--ns-measure-narrow);
}

.ns-eyebrow {
	font-size: var(--ns-text-xs);
	font-weight: var(--ns-weight-medium);
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--ns-color-accent-ink);
	margin-block: 0 var(--ns-space-2);
	display: block;
}

.ns-muted {
	color: var(--ns-color-text-muted);
}

small,
.ns-text-sm {
	font-size: var(--ns-text-sm);
}

strong,
b {
	font-weight: var(--ns-weight-medium);
}

/* ---------------------------------------------------------------
 * Links
 * --------------------------------------------------------------- */

a {
	color: var(--ns-color-link);
	text-decoration-thickness: 1px;
	text-underline-offset: 0.18em;
	transition: color var(--ns-transition);
}

a:hover {
	color: var(--ns-color-link-hover);
}

/* ---------------------------------------------------------------
 * Focus
 *
 * Kadence ships a `hide-focus-outline` body class that removes focus rings site-wide.
 * functions.php strips the class; this restores a real ring. :focus-visible means
 * pointer users still never see an outline on click, keyboard users always do.
 * --------------------------------------------------------------- */

:focus-visible {
	outline: var(--ns-focus-width) solid var(--ns-color-focus);
	outline-offset: var(--ns-focus-offset);
	border-radius: var(--ns-radius-sm);
}

/* On dark or saturated surfaces a plum ring can disappear — add a canvas halo. */
.ns-on-brand :focus-visible,
.ns-surface-dark :focus-visible {
	outline-color: var(--ns-canvas);
	box-shadow: 0 0 0 calc(var(--ns-focus-width) + var(--ns-focus-offset)) var(--ns-plum);
}

/* Skip link — visible the moment it receives focus. */
.ns-skip-link {
	position: absolute;
	left: var(--ns-space-4);
	top: var(--ns-space-4);
	z-index: var(--ns-z-overlay);
	padding: var(--ns-space-3) var(--ns-space-4);
	background: var(--ns-color-surface);
	color: var(--ns-color-text);
	border-radius: var(--ns-radius-md);
	box-shadow: var(--ns-shadow-md);
	transform: translateY(-200%);
	transition: transform var(--ns-transition);
}

.ns-skip-link:focus {
	transform: translateY(0);
}

/* ---------------------------------------------------------------
 * Media
 * --------------------------------------------------------------- */

img,
picture,
svg,
video {
	max-width: 100%;
	height: auto;
	display: block;
}

/* Product and card imagery keeps one ratio so grids never go ragged. */
.ns-ratio-square { aspect-ratio: 1 / 1; }
.ns-ratio-portrait { aspect-ratio: 4 / 5; }
.ns-ratio-landscape { aspect-ratio: 3 / 2; }

.ns-ratio-square img,
.ns-ratio-portrait img,
.ns-ratio-landscape img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

hr {
	border: 0;
	border-top: 1px solid var(--ns-color-border);
	margin-block: var(--ns-space-6);
}

/* ---------------------------------------------------------------
 * Lists and tables
 * --------------------------------------------------------------- */

ul,
ol {
	padding-inline-start: 1.25em;
	margin-block: 0 var(--ns-space-4);
}

li + li {
	margin-top: var(--ns-space-2);
}

/* ...but not in navigation. The rule above is for prose lists. A menu lays its items out in a
 * row inside an `align-items: center` flex line, so an 8px top margin on every item except the
 * first centres them 4px lower than the first one — which is exactly why "Home" sat 4px above
 * every other link in the header (measured: a.top 101.6 vs 105.6). Scoped by role, not by one
 * selector, so the same class of bug cannot come back through a different menu. */
nav li + li,
.menu li + li,
.woocommerce-breadcrumb li + li {
	margin-top: 0;
}

.ns-list-plain {
	list-style: none;
	padding-inline-start: 0;
}

table {
	width: 100%;
	border-collapse: collapse;
	font-size: var(--ns-text-sm);
}

th,
td {
	padding: var(--ns-space-3);
	text-align: start;
	border-bottom: 1px solid var(--ns-color-border);
}

th {
	font-weight: var(--ns-weight-medium);
	color: var(--ns-color-text);
}

/* Wide tables scroll inside their own box instead of the page. */
.ns-table-scroll {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

/* ---------------------------------------------------------------
 * Layout primitives
 * --------------------------------------------------------------- */

.ns-container {
	width: 100%;
	max-width: var(--ns-container);
	margin-inline: auto;
	padding-inline: var(--ns-gutter);
}

.ns-container--wide { max-width: var(--ns-container-wide); }
.ns-container--narrow { max-width: var(--ns-container-narrow); }

.ns-section {
	padding-block: var(--ns-section-y);
}

.ns-section--tight {
	padding-block: calc(var(--ns-section-y) * 0.6);
}

.ns-section--quiet { background-color: var(--ns-color-surface-quiet); }
.ns-section--warm { background-color: var(--ns-color-surface-warm); }
.ns-section--accent { background-color: var(--ns-color-surface-accent); }

.ns-stack > * + * {
	margin-top: var(--ns-space-4);
}

.ns-stack-lg > * + * {
	margin-top: var(--ns-space-6);
}

.ns-cluster {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--ns-space-3);
}

/* Auto-fitting grid — no per-breakpoint column maths, and it cannot overflow at 320. */
.ns-grid {
	display: grid;
	gap: var(--ns-space-5);
	grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
}

.ns-grid--tight {
	gap: var(--ns-space-4);
	grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
}

.ns-section-head {
	display: flex;
	flex-wrap: wrap;
	align-items: end;
	justify-content: space-between;
	gap: var(--ns-space-4);
	margin-bottom: var(--ns-space-6);
}

.ns-section-head h2 {
	margin-bottom: 0;
}

/* Screen-reader-only, standard pattern. */
.ns-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}
