/* ================================================================
   ENSOUL DESIGN SYSTEM v3
   Stripe meets Linear meets a research paper.
   Sophisticated, not edgy. Clean, not crypto.
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&family=Plus+Jakarta+Sans:wght@500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
	/* Surfaces */
	--bg:             #09090b;
	--surface:        #111113;
	--surface-hover:  #161618;
	--surface-active: #1c1c1f;

	/* Borders */
	--border:         rgba(255,255,255,0.04);
	--border-hover:   rgba(255,255,255,0.08);
	--border-scroll:  rgba(255,255,255,0.06);

	/* Text */
	--text-1:         #fafafa;
	--text-2:         #a1a1aa;
	--text-3:         #52525b;

	/* Accent: purple, used surgically */
	--accent:         #7c5bf5;
	--accent-hover:   #6d4de0;
	--accent-subtle:  rgba(124,91,245,0.08);

	/* Live/success: green */
	--live:           #22c55e;
	--live-subtle:    rgba(34,197,94,0.1);

	/* Semantic */
	--warning:        #f59e0b;
	--error:          #ef4444;

	/* Code */
	--code-bg:        #0c0c0e;

	/* Typography */
	--font-display:   'Plus Jakarta Sans', system-ui, sans-serif;
	--font-body:      'IBM Plex Sans', system-ui, sans-serif;
	--font-mono:      'JetBrains Mono', 'SF Mono', monospace;

	/* Spacing */
	--sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
	--sp-5: 24px; --sp-6: 32px; --sp-7: 48px; --sp-8: 64px;
	--sp-9: 80px;

	/* Radius */
	--radius-sm: 6px; --radius-md: 8px; --radius-lg: 12px;

	/* Motion */
	--ease: cubic-bezier(0.4, 0, 0.2, 1);
	--dur: 200ms;
}

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
html, body { overflow-x: hidden; }

body {
	font-family: var(--font-body);
	background: var(--bg);
	color: var(--text-2);
	line-height: 1.7;
	font-size: 16px;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	padding-top: 56px; /* offset for fixed nav */
}

/* ── Typography ────────────────────────────────────────── */
h1, h2, h3, h4, h5 {
	font-family: var(--font-display);
	color: var(--text-1);
	line-height: 1.15;
	letter-spacing: -0.02em;
}
h1 { font-size: 4rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; }
h2 { font-size: 2.25rem; font-weight: 700; }
h3 { font-size: 1.25rem; font-weight: 600; }

a { color: var(--accent); text-decoration: none; transition: color var(--dur) var(--ease); }
a:hover { color: var(--text-1); text-decoration: underline; text-underline-offset: 3px; }

p { max-width: 800px; }

/* ── Code ──────────────────────────────────────────────── */
code, pre { font-family: var(--font-mono); }

code {
	background: var(--code-bg);
	padding: 2px 6px;
	border-radius: 4px;
	font-size: 0.875em;
	color: var(--text-1);
}

pre {
	background: var(--code-bg);
	border-left: 2px solid var(--accent);
	border-radius: var(--radius-md);
	padding: var(--sp-5);
	overflow-x: auto;
	font-size: 0.875em;
	line-height: 1.65;
	margin: var(--sp-4) 0;
}

pre code { background: none; padding: 0; font-size: inherit; }

/* Code block with title bar */
.code-block {
	background: var(--code-bg);
	border-radius: var(--radius-md);
	overflow: hidden;
}
.code-block-bar {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 10px 16px;
	border-bottom: 1px solid var(--border);
}
.code-block-dot {
	width: 10px;
	height: 10px;
	border-radius: 50%;
}
.code-block-bar .label {
	margin-left: 8px;
	font-family: var(--font-mono);
	font-size: 0.75rem;
	color: var(--text-3);
}
.code-block pre {
	margin: 0;
	border: none;
	border-left: none;
	border-radius: 0;
}

/* ── Layout ────────────────────────────────────────────── */
.container { max-width: 1080px; margin: 0 auto; padding: 0 var(--sp-5); }

.section { padding: var(--sp-9) 0; }

.divider { height: 1px; background: var(--border); }

/* ── Nav ───────────────────────────────────────────────── */
.nav {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 1000;
	background: rgba(9, 9, 11, 0.8);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	border-bottom: 1px solid transparent;
	transition: border-color 300ms;
}
.nav.scrolled { border-bottom-color: var(--border-scroll); }

.nav-inner {
	max-width: 1080px;
	margin: 0 auto;
	padding: 0 var(--sp-5);
	height: 56px;
	display: flex;
	align-items: center;
}

.nav-logo {
	font-family: var(--font-display);
	font-size: 1rem;
	font-weight: 800;
	color: var(--text-1);
	display: inline-flex;
	align-items: center;
	gap: 8px;
	letter-spacing: 0.005em;
}
.nav-logo:hover { color: var(--text-1); }
.nav-logo svg { flex-shrink: 0; }

.nav-live {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	margin-left: 12px;
	font-size: 0.6875rem;
	color: var(--live);
	font-weight: 500;
}
.nav-live-dot {
	width: 5px;
	height: 5px;
	border-radius: 50%;
	background: var(--live);
	animation: pulse 2.5s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }

.nav-links {
	display: flex;
	gap: var(--sp-5);
	align-items: center;
	margin: 0 auto;
}
.nav-links a { color: var(--text-3); font-size: 0.875rem; font-weight: 500; }
.nav-links a:hover { color: var(--text-1); }

.nav-cta {
	margin-left: auto;
	background: var(--accent);
	color: #fff !important;
	padding: 7px 18px;
	border-radius: var(--radius-sm);
	font-size: 0.8125rem;
	font-weight: 600;
	transition: background var(--dur) var(--ease);
}
.nav-cta:hover { background: var(--accent-hover); color: #fff !important; }

.nav-toggle {
	display: none;
	background: none;
	border: none;
	color: var(--text-2);
	font-size: 1.2rem;
	cursor: pointer;
	margin-left: auto;
	padding: 8px;
}

@media (max-width: 768px) {
	.nav-links {
		display: none;
		flex-direction: column;
		position: fixed;
		top: 56px;
		right: 0;
		bottom: 0;
		width: 260px;
		background: var(--surface);
		border-left: 1px solid var(--border);
		padding: var(--sp-5);
		gap: var(--sp-4);
		margin: 0;
		z-index: 200;
	}
	.nav-links.open { display: flex; }
	.nav-toggle { display: block; }
	.nav-cta { margin-left: 0; text-align: center; }
	.nav-live { display: none; }
}

/* ── Buttons ───────────────────────────────────────────── */
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--sp-2);
	padding: 10px 22px;
	border-radius: var(--radius-sm);
	font-family: var(--font-body);
	font-weight: 600;
	font-size: 0.875rem;
	border: none;
	cursor: pointer;
	transition: all var(--dur) var(--ease);
	text-decoration: none;
}

.btn-primary {
	background: var(--accent);
	color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); color: #fff; transform: scale(1.02); }
.btn-primary:active { transform: scale(0.98); }

.btn-ghost {
	background: transparent;
	color: var(--text-1);
	border: 1px solid rgba(255,255,255,0.3);
}
.btn-ghost:hover { color: var(--accent); border-color: var(--accent); transform: scale(1.02); }
.btn-ghost:active { transform: scale(0.98); }

.btn-lg { padding: 14px 28px; font-size: 0.9375rem; }

/* ── Cards ─────────────────────────────────────────────── */
.card {
	background: var(--surface);
	border: 1px solid transparent;
	border-radius: var(--radius-lg);
	padding: var(--sp-6);
	transition: transform var(--dur) var(--ease), background var(--dur) var(--ease);
	position: relative;
}
.card::before {
	content: "";
	position: absolute;
	top: -1px;
	left: var(--sp-5);
	right: var(--sp-5);
	height: 2px;
	background: linear-gradient(90deg, transparent, var(--accent), transparent);
	opacity: 0;
	transition: opacity var(--dur) var(--ease);
	border-radius: 1px;
}
.card:hover {
	transform: translateY(-2px);
	background: var(--surface-hover);
}
.card:hover::before { opacity: 1; }

/* ── Badges ────────────────────────────────────────────── */
.badge {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 3px 10px;
	border-radius: 100px;
	font-size: 0.6875rem;
	font-weight: 600;
	letter-spacing: 0.03em;
}
.badge-live { background: var(--live-subtle); color: var(--live); }

/* ── Section Header ────────────────────────────────────── */
.sh { margin-bottom: var(--sp-7); }
.sh-eyebrow {
	font-family: var(--font-mono);
	font-size: 0.75rem;
	font-weight: 500;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	color: var(--text-3);
	margin-bottom: var(--sp-3);
}
.sh h2 { margin-bottom: var(--sp-3); }

/* ── Scroll reveal ─────────────────────────────────────── */
.fade-in {
	opacity: 0;
	transform: translateY(20px);
	transition: opacity 600ms ease-out, transform 600ms ease-out;
}
.fade-in.visible {
	opacity: 1;
	transform: translateY(0);
}
.stagger > .fade-in:nth-child(1) { transition-delay: 0ms; }
.stagger > .fade-in:nth-child(2) { transition-delay: 100ms; }
.stagger > .fade-in:nth-child(3) { transition-delay: 200ms; }
.stagger > .fade-in:nth-child(4) { transition-delay: 300ms; }
.stagger > .fade-in:nth-child(5) { transition-delay: 400ms; }
.stagger > .fade-in:nth-child(6) { transition-delay: 500ms; }
.stagger > .fade-in:nth-child(7) { transition-delay: 600ms; }

/* ── Grids ─────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: repeat(2,1fr); gap: var(--sp-4); }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: var(--sp-4); }
@media (max-width: 768px) { .grid-2,.grid-3 { grid-template-columns: 1fr; } }

/* ── Footer ────────────────────────────────────────────── */
.footer { border-top: 1px solid var(--border); padding: var(--sp-7) 0; }
.footer-inner {
	max-width: 1080px; margin: 0 auto; padding: 0 var(--sp-5);
	display: flex; justify-content: space-between; align-items: center;
	flex-wrap: wrap; gap: var(--sp-5);
}
.footer-links { display: flex; gap: var(--sp-5); flex-wrap: wrap; }
.footer-links a { color: var(--text-3); font-size: 0.8125rem; }
.footer-links a:hover { color: var(--text-2); }
.footer-right { color: var(--text-3); font-size: 0.8125rem; font-style: italic; }

@media (max-width: 600px) {
	.footer-inner { flex-direction: column; align-items: center; text-align: center; }
	.footer-links { justify-content: center; }
}

/* ── Accessibility ─────────────────────────────────────── */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Mobile-safe overflow handling ─────────────────────── */
img, svg, video { max-width: 100%; height: auto; }
pre, code { word-break: normal; }
pre { max-width: 100%; overflow-x: auto; }
table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.card, .card-flat { overflow: hidden; }

/* ── Responsive type ───────────────────────────────────── */
@media (max-width: 768px) {
	h1 { font-size: 2.5rem; }
	h2 { font-size: 1.75rem; }
	.section { padding: var(--sp-8) 0; }
	.btn, .btn-lg { min-height: 44px; } /* touch target */
}
@media (max-width: 480px) {
	h1 { font-size: 2rem; line-height: 1.1; }
	h2 { font-size: 1.5rem; }
	.section { padding: var(--sp-7) 0; }
	.container { padding: 0 var(--sp-4); }
	/* Reduce nav logo size on very narrow */
	.nav-inner { gap: var(--sp-3); padding: 0 var(--sp-4); }
	.nav-live { display: none; }
}
