/**
 * NLS Property Hub — design tokens + curated real-estate presets.
 *
 * ALL tokens are declared on the single .nlsph wrapper (NEVER on :root / html /
 * body) so the plugin never affects the host theme. There are NO global resets;
 * only elements inside .nlsph are styled. Fonts are SELF-HOSTED (see @font-face
 * below) — no external/CDN request is ever made.
 *
 * 3 curated presets (data-nlsph-preset on the wrapper):
 *   mediterranean — warm terracotta + olive, the default Costa-del-Sol feel
 *   noir          — high-contrast luxury dark
 *   coastal       — airy blue/sand, light & spacious
 *
 * RTL-safe: components use logical properties (margin-inline, inset-inline, …)
 * so the same CSS works under dir="rtl" with no overrides.
 */

/* ---------------------------------------------------------------------------
 * Self-hosted fonts (woff2 bundled under assets/fonts/). font-display: swap
 * keeps first paint fast; the local() hint avoids a download when present.
 * ------------------------------------------------------------------------- */
@font-face {
	font-family: "NLSPH Sans";
	src: local("Inter"),
		url("../fonts/inter-variable.woff2") format("woff2-variations");
	font-weight: 300 800;
	font-style: normal;
	font-display: swap;
}

@font-face {
	font-family: "NLSPH Serif";
	src: local("Fraunces"),
		url("../fonts/fraunces-variable.woff2") format("woff2-variations");
	font-weight: 400 700;
	font-style: normal;
	font-display: swap;
}

/* ---------------------------------------------------------------------------
 * Base tokens (shared by all presets). Declared on the wrapper, not :root.
 * ------------------------------------------------------------------------- */
.nlsph {
	/* Typography */
	--nlsph-font-sans: "NLSPH Sans", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	--nlsph-font-serif: "NLSPH Serif", Georgia, "Times New Roman", serif;
	--nlsph-fs-xs: 0.75rem;
	--nlsph-fs-sm: 0.875rem;
	--nlsph-fs-base: 1rem;
	--nlsph-fs-lg: 1.125rem;
	--nlsph-fs-xl: 1.375rem;
	--nlsph-fs-2xl: 1.75rem;
	--nlsph-fs-3xl: 2.25rem;
	--nlsph-lh: 1.55;
	--nlsph-lh-tight: 1.2;

	/* Spacing scale */
	--nlsph-space-1: 0.25rem;
	--nlsph-space-2: 0.5rem;
	--nlsph-space-3: 0.75rem;
	--nlsph-space-4: 1rem;
	--nlsph-space-5: 1.5rem;
	--nlsph-space-6: 2rem;
	--nlsph-space-8: 3rem;

	/* Radii + borders */
	--nlsph-radius-sm: 6px;
	--nlsph-radius: 12px;
	--nlsph-radius-lg: 20px;
	--nlsph-border: 1px solid var(--nlsph-line);

	/* Control boundaries are NOT decoration. WCAG 2.2 SC 1.4.11 requires 3:1 for
	 * the visual information that identifies a control (input, select, ghost
	 * button), because their background matches the surface and the border is the
	 * only thing making them visible. --nlsph-line is the DECORATIVE rule colour
	 * (panel edges, dividers), which 1.4.11 exempts, and measures ~1.3-1.4:1 on
	 * every preset — correct there, unusable here. Each preset sets its own
	 * tone-matched value below; on noir the border is LIGHTER than the surface. */
	--nlsph-control-border: #8a7a66; /* 4.15:1 on #ffffff */

	/* Elevation */
	--nlsph-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
	--nlsph-shadow: 0 6px 20px rgba(0, 0, 0, 0.10);
	--nlsph-shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.16);

	/* Motion */
	--nlsph-transition: 160ms cubic-bezier(0.2, 0, 0.2, 1);

	/* Layout */
	--nlsph-card-min: 280px;
	--nlsph-container: 1200px;

	/* Default (mediterranean) palette — overridden by preset blocks below.
	 * Contrast pairs are chosen for WCAG AA (>= 4.5:1 for text). */
	--nlsph-bg: #fbf7f2;
	--nlsph-surface: #ffffff;
	--nlsph-surface-2: #f4ece2;
	--nlsph-text: #2a2320;
	--nlsph-text-muted: #6b5d52;
	--nlsph-line: #e6d8c8;
	--nlsph-brand: #b4502e;
	--nlsph-brand-ink: #ffffff;
	--nlsph-brand-hover: #963f22;
	--nlsph-accent: #5c6b3f;
	--nlsph-focus: #1d4ed8;
	--nlsph-badge-bg: #2a2320;
	--nlsph-badge-ink: #ffffff;

	/* Apply base typography only to our subtree (no global reset). */
	color: var(--nlsph-text);
	font-family: var(--nlsph-font-sans);
	font-size: var(--nlsph-fs-base);
	line-height: var(--nlsph-lh);
	box-sizing: border-box;
}

/* Scoped box-sizing for descendants ONLY (not a global * reset). */
.nlsph *,
.nlsph *::before,
.nlsph *::after {
	box-sizing: border-box;
}

/* ---------------------------------------------------------------------------
 * Preset: mediterranean (default — explicit selector for clarity/override).
 * ------------------------------------------------------------------------- */
.nlsph[data-nlsph-preset="mediterranean"] {
	--nlsph-bg: #fbf7f2;
	--nlsph-surface: #ffffff;
	--nlsph-surface-2: #f4ece2;
	--nlsph-text: #2a2320;
	--nlsph-text-muted: #6b5d52;
	--nlsph-line: #e6d8c8;
	--nlsph-control-border: #8a7a66; /* 4.15:1 on #ffffff (SC 1.4.11) */
	--nlsph-brand: #b4502e;
	--nlsph-brand-ink: #ffffff;
	--nlsph-brand-hover: #963f22;
	--nlsph-accent: #5c6b3f;
	--nlsph-focus: #1d4ed8;
	--nlsph-badge-bg: #2a2320;
	--nlsph-badge-ink: #ffffff;
}

/* ---------------------------------------------------------------------------
 * Preset: noir (high-contrast luxury dark).
 * ------------------------------------------------------------------------- */
.nlsph[data-nlsph-preset="noir"] {
	--nlsph-bg: #121212;
	--nlsph-surface: #1c1c1e;
	--nlsph-surface-2: #262629;
	--nlsph-text: #f4f1ea;
	--nlsph-text-muted: #b7b1a6;
	--nlsph-line: #34343a;
	--nlsph-control-border: #77777f; /* 3.83:1 on #1c1c1e — lighter than the surface (SC 1.4.11) */
	--nlsph-brand: #c9a35a;
	--nlsph-brand-ink: #1a1a1a;
	--nlsph-brand-hover: #d9b873;
	--nlsph-accent: #9fb3c8;
	--nlsph-focus: #8ab4ff;
	--nlsph-badge-bg: #c9a35a;
	--nlsph-badge-ink: #1a1a1a;
	--nlsph-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
	--nlsph-shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.6);
}

/* ---------------------------------------------------------------------------
 * Preset: coastal (airy blue + sand, light & spacious).
 * ------------------------------------------------------------------------- */
.nlsph[data-nlsph-preset="coastal"] {
	--nlsph-bg: #f3f8fb;
	--nlsph-surface: #ffffff;
	--nlsph-surface-2: #e7f1f6;
	--nlsph-text: #14303d;
	--nlsph-text-muted: #4f6b78;
	--nlsph-line: #d4e4ec;
	--nlsph-control-border: #6f8b9c; /* 3.59:1 on #ffffff (SC 1.4.11) */
	--nlsph-brand: #0e6e8c;
	--nlsph-brand-ink: #ffffff;
	--nlsph-brand-hover: #0a5870;
	--nlsph-accent: #c98a3a;
	--nlsph-focus: #0b4f8a;
	--nlsph-badge-bg: #0e6e8c;
	--nlsph-badge-ink: #ffffff;
	--nlsph-radius: 16px;
	--nlsph-radius-lg: 24px;
}

/* ---------------------------------------------------------------------------
 * Accessibility primitives (scoped). Visible keyboard focus everywhere.
 * ------------------------------------------------------------------------- */
.nlsph :where(a, button, input, select, textarea, [tabindex]):focus-visible {
	outline: 3px solid var(--nlsph-focus);
	outline-offset: 2px;
	border-radius: var(--nlsph-radius-sm);
}

/* Respect reduced-motion preference. */
@media (prefers-reduced-motion: reduce) {
	.nlsph * {
		transition-duration: 0.01ms !important;
		animation-duration: 0.01ms !important;
	}
}

/* Visually-hidden helper (scoped). */
.nlsph .nlsph-sr-only {
	position: absolute;
	inline-size: 1px;
	block-size: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}
