/* Peritia v3 concept library — shared design system.
 * Locked brand guardrails: colors, fonts, spacing primitives only.
 * Individual concept pages extend or override via their own <style>.
 */

@import url("https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500&family=JetBrains+Mono:wght@400;500;700&display=swap");

:root {
	/* Brand core */
	--navy: #001e4b;
	--navy-deep: #000a1f;
	--navy-rich: #001536;
	--orange: #ff9933;
	--orange-a11y: #c25400;
	--orange-glow: #ffb866;
	--teal: #00737f;
	--teal-deep: #003c3f;
	--teal-light: #2a8a94;
	--sky: #e2f3f7;
	--cream: #fafaf8;
	--charcoal: #273338;
	--charcoal-soft: #3a4a52;
	--white: #ffffff;
	--ink: #0a0a0a;

	/* Type */
	--serif: "DM Serif Display", Georgia, serif;
	--sans: "DM Sans", system-ui, -apple-system, sans-serif;
	--mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

	/* Scale */
	--fs-xs: 11px;
	--fs-sm: 13px;
	--fs-base: 17px;
	--fs-md: 20px;
	--fs-lg: 28px;
	--fs-xl: 44px;
	--fs-2xl: 64px;
	--fs-3xl: 96px;
	--fs-4xl: 140px;
	--fs-mega: clamp(72px, 14vw, 240px);

	/* Spacing (4px base) */
	--s1: 4px;
	--s2: 8px;
	--s3: 12px;
	--s4: 16px;
	--s5: 24px;
	--s6: 32px;
	--s7: 48px;
	--s8: 64px;
	--s9: 96px;
	--s10: 128px;
	--s11: 192px;

	/* Radii */
	--r-sm: 4px;
	--r-md: 8px;
	--r-lg: 16px;
	--r-xl: 28px;
	--r-full: 9999px;

	/* Motion */
	--ease: cubic-bezier(0.2, 0.8, 0.2, 1);
	--ease-snap: cubic-bezier(0.85, 0, 0.15, 1);
	--t-fast: 150ms;
	--t-mid: 350ms;
	--t-slow: 750ms;
}

/* Reset + base */
*,
*::before,
*::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}
html {
	scroll-behavior: smooth;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}
body {
	font-family: var(--sans);
	font-size: var(--fs-base);
	line-height: 1.55;
	color: var(--charcoal);
	background: var(--cream);
	min-height: 100vh;
}
img,
svg {
	display: block;
	max-width: 100%;
}
a {
	color: inherit;
	text-decoration: none;
}
button {
	font: inherit;
	cursor: pointer;
	border: none;
	background: none;
	color: inherit;
}

/* Typography utility classes */
.serif {
	font-family: var(--serif);
	font-weight: 400;
}
.sans {
	font-family: var(--sans);
}
.mono {
	font-family: var(--mono);
}
.italic {
	font-style: italic;
}
.eyebrow {
	font-family: var(--sans);
	font-size: var(--fs-xs);
	font-weight: 700;
	letter-spacing: 0.18em;
	text-transform: uppercase;
}
.h1-display {
	font-family: var(--serif);
	font-size: clamp(48px, 8vw, 112px);
	line-height: 0.95;
	letter-spacing: -0.02em;
}
.h1-mega {
	font-family: var(--serif);
	font-size: var(--fs-mega);
	line-height: 0.85;
	letter-spacing: -0.03em;
}

/* Centered nav — biscochitos reference */
.nav-centered {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	height: 72px;
	z-index: 100;
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	padding: 0 var(--s6);
	background: rgba(250, 250, 248, 0.85);
	backdrop-filter: saturate(1.4) blur(14px);
	-webkit-backdrop-filter: saturate(1.4) blur(14px);
	border-bottom: 1px solid rgba(0, 30, 75, 0.06);
}
.nav-centered.on-dark {
	background: rgba(0, 10, 31, 0.85);
	border-bottom-color: rgba(255, 255, 255, 0.08);
	color: var(--white);
}
.nav-logo {
	font-family: var(--serif);
	font-size: 22px;
	letter-spacing: -0.01em;
}
.nav-logo::after {
	content: ".";
	color: var(--orange);
}
.nav-links {
	display: flex;
	gap: var(--s6);
	justify-content: center;
	font-size: 14px;
	font-weight: 500;
}
.nav-links a {
	transition: opacity var(--t-fast) var(--ease);
}
.nav-links a:hover {
	opacity: 0.6;
}
.nav-cta {
	display: flex;
	gap: var(--s3);
	justify-content: flex-end;
	align-items: center;
}
.btn {
	display: inline-flex;
	align-items: center;
	gap: var(--s2);
	padding: 12px 22px;
	border-radius: var(--r-full);
	font-weight: 600;
	font-size: 14px;
	transition:
		transform var(--t-fast) var(--ease),
		background var(--t-fast) var(--ease),
		color var(--t-fast) var(--ease);
	cursor: pointer;
	border: 1px solid transparent;
}
.btn:hover {
	transform: translateY(-1px);
}
.btn-primary {
	background: var(--orange);
	color: var(--navy);
}
.btn-primary:hover {
	background: var(--orange-glow);
}
.btn-ghost {
	background: transparent;
	border-color: currentColor;
}
.btn-dark {
	background: var(--navy);
	color: var(--white);
}
.btn-dark:hover {
	background: var(--navy-rich);
}

/* Helix placement helpers */
.helix-anchor {
	position: relative;
}
.helix-bleed-right {
	position: absolute;
	right: -8vw;
	top: 50%;
	transform: translateY(-50%);
	width: 60vw;
	pointer-events: none;
}

/* Animation utilities */
@keyframes fadeUp {
	from {
		opacity: 0;
		transform: translateY(18px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}
@keyframes tickerSlide {
	from {
		transform: translateX(0);
	}
	to {
		transform: translateX(-50%);
	}
}

/* ─────────────────────────────────────────────
   Crawler — reusable infinite horizontal ticker.
   Apply .crawler to the clipping wrapper, .crawler__track
   to the scrolling row. Content must be duplicated inline
   (or set data-clone="true" and crawler.js will clone it).
   Velocity is px/sec via data-velocity or --crawler-velocity;
   JS measures track width and sets --crawler-duration.
   ───────────────────────────────────────────── */
.crawler {
	overflow: hidden;
	position: relative;
	min-width: 0;
	max-width: 100%;
	-webkit-mask-image: linear-gradient(
		to right,
		transparent,
		black 6%,
		black 94%,
		transparent
	);
	mask-image: linear-gradient(
		to right,
		transparent,
		black 6%,
		black 94%,
		transparent
	);
}
.crawler__track {
	display: inline-flex;
	gap: var(--crawler-gap, var(--s7));
	white-space: nowrap;
	will-change: transform;
	animation: crawlerScroll var(--crawler-duration, 40s) linear infinite;
}
.crawler:hover .crawler__track {
	animation-play-state: paused;
}
@keyframes crawlerScroll {
	from {
		transform: translateX(0);
	}
	to {
		transform: translateX(-50%);
	}
}
@media (prefers-reduced-motion: reduce) {
	.crawler__track {
		animation: none !important;
		transform: translateX(0);
	}
	.crawler {
		overflow-x: auto;
	}
}
@keyframes pulse {
	0%,
	100% {
		opacity: 0.6;
	}
	50% {
		opacity: 1;
	}
}
.fadeup {
	animation: fadeUp 0.9s var(--ease) both;
}

/* Rotating word (biscochitos reference) */
.rotator {
	display: inline-block;
	color: var(--orange-a11y);
	font-style: italic;
	position: relative;
}

/* Scroll containers */
.snap-y {
	scroll-snap-type: y mandatory;
	overflow-y: scroll;
	height: 100vh;
}
.snap-item {
	scroll-snap-align: start;
	min-height: 100vh;
}

/* Stat block */
.stat {
	font-family: var(--serif);
	font-size: var(--fs-2xl);
	line-height: 1;
	color: var(--orange-a11y);
}
.stat-label {
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.12em;
	opacity: 0.6;
	margin-top: var(--s2);
}

/* Dark mode base */
.on-navy {
	background: var(--navy);
	color: var(--white);
}
.on-navy-deep {
	background: var(--navy-deep);
	color: var(--white);
}
.on-charcoal {
	background: var(--charcoal);
	color: var(--cream);
}
.on-cream {
	background: var(--cream);
	color: var(--charcoal);
}
.on-sky {
	background: var(--sky);
	color: var(--navy);
}
.on-teal {
	background: var(--teal);
	color: var(--white);
}

/* Grain / noise overlay (premium feel) */
.grain::before {
	content: "";
	position: absolute;
	inset: 0;
	pointer-events: none;
	opacity: 0.035;
	mix-blend-mode: multiply;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='0.95' /%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' /%3E%3C/svg%3E");
}

/* Chip */
.chip {
	display: inline-flex;
	align-items: center;
	gap: var(--s2);
	padding: 6px 12px;
	border-radius: var(--r-full);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	border: 1px solid currentColor;
}
.chip.filled {
	background: var(--orange);
	color: var(--navy);
	border-color: var(--orange);
}
.chip.teal {
	background: var(--teal);
	color: var(--white);
	border-color: var(--teal);
}

/* Divider */
.rule {
	height: 1px;
	background: currentColor;
	opacity: 0.15;
}

/* Scrollbar polish */
::-webkit-scrollbar {
	width: 10px;
	height: 10px;
}
::-webkit-scrollbar-track {
	background: transparent;
}
::-webkit-scrollbar-thumb {
	background: rgba(0, 30, 75, 0.2);
	border-radius: 10px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}

/* ─────────────────────────────────────────────
   Meta nav — concept library toolbar
   Injected by meta-nav.js on every page except _index.html.
   Sits above the primary site nav. Thin, dark, mono type.
   ───────────────────────────────────────────── */
.meta-nav {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 9999;
	height: 38px;
	background: rgba(0, 10, 31, 0.96);
	backdrop-filter: blur(14px);
	-webkit-backdrop-filter: blur(14px);
	border-bottom: 1px solid rgba(255, 153, 51, 0.25);
	font-family: var(--mono);
	font-size: 10px;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: rgba(255, 255, 255, 0.75);
}
.meta-nav-inner {
	max-width: 1600px;
	height: 100%;
	margin: 0 auto;
	padding: 0 20px;
	display: flex;
	align-items: center;
	gap: 20px;
}
.meta-nav a {
	text-decoration: none;
	color: inherit;
}
.meta-nav .mn-gallery {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	color: var(--orange);
	font-weight: 700;
	padding: 5px 12px;
	border-radius: 999px;
	border: 1px solid rgba(255, 153, 51, 0.35);
	transition:
		background 0.2s var(--ease),
		border-color 0.2s var(--ease),
		color 0.2s var(--ease);
	white-space: nowrap;
}
.meta-nav .mn-gallery:hover {
	background: rgba(255, 153, 51, 0.18);
	border-color: var(--orange);
	color: var(--orange-glow);
}
.meta-nav .mn-gallery .mn-icon {
	font-size: 9px;
	line-height: 1;
	transform: translateY(-0.5px);
}
.meta-nav .mn-switcher {
	display: flex;
	gap: 2px;
	margin-left: auto;
}
.meta-nav .mn-pill {
	display: inline-flex;
	align-items: baseline;
	gap: 6px;
	padding: 5px 12px;
	border-radius: 999px;
	color: rgba(255, 255, 255, 0.5);
	border: 1px solid transparent;
	transition:
		background 0.2s var(--ease),
		color 0.2s var(--ease),
		border-color 0.2s var(--ease);
	white-space: nowrap;
}
.meta-nav .mn-pill:hover {
	color: rgba(255, 255, 255, 0.95);
	background: rgba(255, 255, 255, 0.06);
}
.meta-nav .mn-pill.active {
	color: var(--navy);
	background: var(--orange);
	border-color: var(--orange);
	font-weight: 700;
}
.meta-nav .mn-pill .mn-num {
	font-size: 10px;
	font-weight: 700;
}
.meta-nav .mn-pill .mn-name {
	font-size: 9px;
	opacity: 0.8;
}
.meta-nav .mn-pill.active .mn-name {
	opacity: 1;
	color: var(--navy);
}
.meta-nav .mn-label {
	font-size: 9px;
	opacity: 0.4;
	margin-left: auto;
	white-space: nowrap;
}
.meta-nav .mn-switcher ~ .mn-label {
	margin-left: 0;
}

/* Body nudge — makes room for the fixed meta nav and pushes the primary
 * nav down so the two bars stack cleanly. */
body.has-meta-nav {
	padding-top: 38px;
}
body.has-meta-nav nav.nav-centered,
body.has-meta-nav nav.nav-v6 {
	top: 38px;
}

/* ─────────────────────────────────────────────
   Hamburger drawer — shown on mobile only.
   The .mn-hamburger button is injected by meta-nav.js.
   Tapping it opens the <dialog class="meta-drawer">.
   ───────────────────────────────────────────── */
.mn-hamburger {
	display: none;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	margin-left: auto;
	background: transparent;
	border: 1px solid rgba(255, 153, 51, 0.35);
	border-radius: 8px;
	color: var(--orange);
	cursor: pointer;
	padding: 0;
}
.mn-hamburger svg {
	width: 18px;
	height: 18px;
}
.mn-hamburger:hover {
	background: rgba(255, 153, 51, 0.15);
	border-color: var(--orange);
}

.meta-drawer {
	position: fixed;
	top: 0;
	right: 0;
	left: auto;
	margin: 0;
	height: 100dvh;
	max-height: 100dvh;
	width: min(88vw, 360px);
	border: none;
	padding: 0;
	background: var(--navy-deep);
	color: var(--cream);
	box-shadow: -20px 0 60px -20px rgba(0, 0, 0, 0.8);
	transform: translateX(100%);
	transition:
		transform 0.32s var(--ease),
		display 0.32s allow-discrete,
		overlay 0.32s allow-discrete;
}
.meta-drawer[open] {
	transform: translateX(0);
}
@starting-style {
	.meta-drawer[open] {
		transform: translateX(100%);
	}
	.meta-drawer[open]::backdrop {
		background-color: rgba(0, 0, 0, 0);
	}
}
.meta-drawer::backdrop {
	background: rgba(0, 10, 31, 0.7);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	transition:
		display 0.32s allow-discrete,
		overlay 0.32s allow-discrete,
		background-color 0.32s var(--ease);
}
body:has(.meta-drawer[open]) {
	overflow: hidden;
}

.md-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 18px 22px 12px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.md-head .brand {
	font-family: var(--serif);
	font-size: 22px;
	color: var(--cream);
}
.md-head .brand .dot {
	color: var(--orange);
}
.md-close {
	background: transparent;
	border: 1px solid rgba(255, 255, 255, 0.15);
	color: var(--cream);
	width: 36px;
	height: 36px;
	border-radius: 8px;
	cursor: pointer;
	font-size: 22px;
	line-height: 1;
	display: flex;
	align-items: center;
	justify-content: center;
}
.md-close:hover {
	background: rgba(255, 153, 51, 0.15);
	border-color: var(--orange);
	color: var(--orange);
}

.md-body {
	overflow-y: auto;
	height: calc(100dvh - 68px);
	padding: 18px 22px 32px;
}
.md-section {
	margin-bottom: 28px;
}
.md-section-label {
	font-family: var(--mono);
	font-size: 10px;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--orange);
	margin-bottom: 10px;
}
.md-gallery-link {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 12px 16px;
	background: rgba(255, 153, 51, 0.12);
	border: 1px solid rgba(255, 153, 51, 0.35);
	color: var(--orange);
	text-decoration: none;
	border-radius: 10px;
	font-family: var(--mono);
	font-size: 11px;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	font-weight: 700;
	margin-bottom: 18px;
	min-height: 44px;
}
.md-versions {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
}
.md-versions a {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 2px;
	padding: 12px 14px;
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 10px;
	color: rgba(250, 250, 248, 0.85);
	text-decoration: none;
	min-height: 56px;
}
.md-versions a.active {
	background: var(--orange);
	color: var(--navy);
	border-color: var(--orange);
}
.md-versions .md-v-label {
	font-family: var(--mono);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.12em;
}
.md-versions .md-v-name {
	font-size: 10px;
	opacity: 0.7;
}
.md-versions a.active .md-v-name {
	opacity: 1;
}
.md-sitenav {
	display: flex;
	flex-direction: column;
	gap: 4px;
}
.md-sitenav a,
.md-sitenav button {
	display: flex;
	align-items: center;
	padding: 14px 16px;
	background: transparent;
	border: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: 10px;
	color: var(--cream);
	text-decoration: none;
	font-family: var(--sans);
	font-size: 16px;
	text-align: left;
	min-height: 48px;
	cursor: pointer;
}
.md-sitenav a:hover,
.md-sitenav button:hover {
	background: rgba(255, 153, 51, 0.08);
	border-color: rgba(255, 153, 51, 0.35);
}
.md-sitenav .md-cta {
	background: var(--orange);
	color: var(--navy);
	border-color: var(--orange);
	font-weight: 700;
	justify-content: center;
	font-family: var(--mono);
	font-size: 12px;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	margin-top: 8px;
}
.md-sitenav .md-cta:hover {
	background: var(--orange-glow);
	color: var(--navy);
}

@media (max-width: 900px) {
	.meta-nav {
		height: 48px;
		padding: 0;
	}
	.meta-nav-inner {
		height: 100%;
		padding: 0 14px;
		gap: 10px;
	}
	.meta-nav .mn-switcher,
	.meta-nav .mn-label {
		display: none;
	}
	.meta-nav .mn-gallery {
		font-size: 9px;
		padding: 6px 10px;
	}
	.mn-hamburger {
		display: inline-flex;
	}
	body.has-meta-nav {
		padding-top: 48px;
	}
	body.has-meta-nav nav.nav-centered,
	body.has-meta-nav nav.nav-v6 {
		top: 48px;
	}
}
