/**
 * NovaPress — base.css
 * Reset/normalize, design-token fallbacks, base typography, links,
 * media, forms, accessibility helpers.
 *
 * The --np-* custom properties below are FALLBACK defaults matching the
 * framework design defaults. inc/enqueue.php novapress_dynamic_css()
 * overrides them in :root from the saved design options.
 *
 * @package NovaPress
 */

/* -------------------------------------------------------------------------
 * Design token fallbacks (overridden by dynamic CSS)
 * ---------------------------------------------------------------------- */
:root {
	--np-color-primary: #2563eb;
	--np-color-secondary: #1e293b;
	--np-color-accent: #f59e0b;
	--np-color-bg: #ffffff;
	--np-color-text: #1f2937;
	--np-color-muted: #6b7280;
	--np-color-border: #e5e7eb;

	--np-radius: 8px;
	--np-container: 1200px;

	--np-font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	--np-font-heading: var(--np-font-body);

	--np-fs-base: 16px;
	--np-fs-h1: 2.5rem;
	--np-fs-h2: 2rem;
	--np-fs-h3: 1.5rem;
	--np-fs-h4: 1.25rem;
	--np-fs-small: 0.875rem;

	--np-space: 1rem;

	--np-btn-radius: 8px;
}

/* -------------------------------------------------------------------------
 * Modern reset / normalize
 * ---------------------------------------------------------------------- */
*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
	-webkit-tap-highlight-color: transparent;
	scroll-behavior: smooth;
}

body {
	margin: 0;
	min-height: 100vh;
	font-family: var(--np-font-body);
	font-size: var(--np-fs-base);
	line-height: 1.6;
	color: var(--np-color-text);
	background-color: var(--np-color-bg);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
}

/* Remove default list styling only where the theme owns the list. */
main:where(:not(article) *) {
	/* placeholder to keep specificity utilities predictable */
}

h1,
h2,
h3,
h4,
h5,
h6,
p,
figure,
blockquote,
dl,
dd {
	margin: 0 0 var(--np-space);
}

/* -------------------------------------------------------------------------
 * Base typography
 * ---------------------------------------------------------------------- */
h1,
h2,
h3,
h4,
h5,
h6 {
	font-family: var(--np-font-heading);
	line-height: 1.2;
	font-weight: 700;
	color: var(--np-color-secondary);
	text-wrap: balance;
}

h1 {
	font-size: var(--np-fs-h1);
}

h2 {
	font-size: var(--np-fs-h2);
}

h3 {
	font-size: var(--np-fs-h3);
}

h4 {
	font-size: var(--np-fs-h4);
}

h5 {
	font-size: 1.125rem;
}

h6 {
	font-size: 1rem;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

p {
	text-wrap: pretty;
}

small,
.np-small {
	font-size: var(--np-fs-small);
}

strong,
b {
	font-weight: 700;
}

blockquote {
	padding-left: var(--np-space);
	border-left: 4px solid var(--np-color-primary);
	color: var(--np-color-muted);
	font-style: italic;
}

code,
kbd,
pre,
samp {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 0.9em;
}

pre {
	overflow-x: auto;
	padding: var(--np-space);
	background-color: var(--np-color-secondary);
	color: #f8fafc;
	border-radius: var(--np-radius);
}

hr {
	border: 0;
	height: 1px;
	background-color: var(--np-color-border);
	margin: calc(var(--np-space) * 2) 0;
}

ul,
ol {
	margin: 0 0 var(--np-space);
	padding-left: 1.5em;
}

/* -------------------------------------------------------------------------
 * Links
 * ---------------------------------------------------------------------- */
a {
	color: var(--np-color-primary);
	text-decoration: underline;
	text-underline-offset: 0.15em;
	transition: color 0.2s ease, opacity 0.2s ease;
}

a:hover,
a:focus {
	color: var(--np-color-secondary);
}

/* -------------------------------------------------------------------------
 * Media
 * ---------------------------------------------------------------------- */
img,
picture,
video,
canvas,
svg,
iframe {
	display: block;
	max-width: 100%;
	height: auto;
}

img {
	border-style: none;
	font-style: italic;
	background-repeat: no-repeat;
	background-size: cover;
	vertical-align: middle;
}

figure {
	margin: 0 0 var(--np-space);
}

figcaption {
	font-size: var(--np-fs-small);
	color: var(--np-color-muted);
	margin-top: calc(var(--np-space) * 0.5);
}

/* -------------------------------------------------------------------------
 * Tables
 * ---------------------------------------------------------------------- */
table {
	width: 100%;
	border-collapse: collapse;
	margin: 0 0 var(--np-space);
}

th,
td {
	padding: 0.5em 0.75em;
	text-align: left;
	border-bottom: 1px solid var(--np-color-border);
}

th {
	font-weight: 700;
	color: var(--np-color-secondary);
}

/* -------------------------------------------------------------------------
 * Forms — base element styling
 * ---------------------------------------------------------------------- */
input,
button,
textarea,
select,
optgroup {
	font-family: inherit;
	font-size: 100%;
	line-height: inherit;
	color: inherit;
	margin: 0;
}

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

button:disabled,
[type="submit"]:disabled {
	cursor: not-allowed;
	opacity: 0.6;
}

input,
textarea,
select {
	width: 100%;
	max-width: 100%;
	padding: 0.65em 0.85em;
	background-color: var(--np-color-bg);
	color: var(--np-color-text);
	border: 1px solid var(--np-color-border);
	border-radius: var(--np-radius);
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="checkbox"],
input[type="radio"] {
	width: auto;
	accent-color: var(--np-color-primary);
}

textarea {
	min-height: 8rem;
	resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
	outline: none;
	border-color: var(--np-color-primary);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--np-color-primary) 25%, transparent);
}

::placeholder {
	color: var(--np-color-muted);
	opacity: 1;
}

label {
	display: inline-block;
	font-weight: 600;
}

fieldset {
	border: 1px solid var(--np-color-border);
	border-radius: var(--np-radius);
	padding: var(--np-space);
	margin: 0 0 var(--np-space);
}

/* -------------------------------------------------------------------------
 * Accessibility helpers
 * ---------------------------------------------------------------------- */
.np-visually-hidden {
	position: absolute !important;
	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;
}

.np-skip-link {
	position: absolute;
	top: -100%;
	left: var(--np-space);
	z-index: 1000;
	padding: 0.75em 1.25em;
	background-color: var(--np-color-primary);
	color: #ffffff;
	text-decoration: none;
	border-radius: 0 0 var(--np-radius) var(--np-radius);
	transition: top 0.2s ease;
}

.np-skip-link:focus {
	top: 0;
	color: #ffffff;
}

/* -------------------------------------------------------------------------
 * Focus styles — visible only for keyboard users
 * ---------------------------------------------------------------------- */
:focus-visible {
	outline: 3px solid var(--np-color-primary);
	outline-offset: 2px;
	border-radius: 2px;
}

/* Remove outline for mouse/touch focus where :focus-visible is supported. */
:focus:not(:focus-visible) {
	outline: none;
}

/* -------------------------------------------------------------------------
 * Reduced motion
 * ---------------------------------------------------------------------- */
@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;
	}
}
