/* ---------- Design tokens ---------- */

:root {
	/* Surfaces */
	--bg: #ffffff;
	--bg-alt: #fafaf9;
	--bg-inset: #f4f4f2;

	/* Ink */
	--ink: #15171a;
	--ink-muted: #52575c;
	--ink-subtle: #787e85;

	/* Accent (Cloudflare orange, dialled slightly) */
	--accent: #f38020;
	--accent-soft: #fff0e2;
	--accent-ink: #b4560f;

	/* Code surface */
	--code-bg: #0f1115;
	--code-ink: #e4e6eb;
	--code-ink-dim: #8c93a1;
	--code-chrome: #1a1d23;
	--code-border: #20232a;

	/* Syntax highlighting (subtle, not rainbow) */
	--tok-keyword: #f38020;
	--tok-string: #6ec187;
	--tok-comment: #6f7685;
	--tok-builtin: #78b0ff;
	--tok-number: #e0a15a;

	/* Scale */
	--radius: 12px;
	--radius-lg: 16px;
	--shadow-sm: 0 1px 2px rgba(15, 17, 21, 0.04);
	--shadow: 0 4px 20px rgba(15, 17, 21, 0.06),
		0 1px 3px rgba(15, 17, 21, 0.04);
	--shadow-lg: 0 20px 60px rgba(15, 17, 21, 0.12),
		0 2px 8px rgba(15, 17, 21, 0.06);

	--fs-mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
	--fs-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
		sans-serif;
}

/* ---------- Reset + base ---------- */

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
	scroll-behavior: smooth;
}

body {
	margin: 0;
	font-family: var(--fs-sans);
	font-feature-settings: "cv11", "ss01", "ss03";
	font-size: 17px;
	line-height: 1.6;
	color: var(--ink);
	background: var(--bg);
}

a {
	color: var(--accent-ink);
	text-decoration: none;
	border-bottom: 1px solid transparent;
	transition: border-color 120ms ease, color 120ms ease;
}

a:hover {
	color: var(--accent);
	border-bottom-color: currentColor;
}

h1,
h2,
h3 {
	font-weight: 700;
	letter-spacing: -0.02em;
	line-height: 1.1;
	margin: 0 0 0.5em;
	color: var(--ink);
}

h1 {
	font-size: clamp(2.25rem, 4.5vw, 3.75rem);
	letter-spacing: -0.03em;
}

h2 {
	font-size: clamp(1.625rem, 3vw, 2.25rem);
}

h3 {
	font-size: 1.125rem;
}

p {
	margin: 0 0 1em;
}

code {
	font-family: var(--fs-mono);
	font-size: 0.9em;
	background: var(--bg-inset);
	padding: 0.1em 0.35em;
	border-radius: 4px;
	color: var(--ink);
}

.container {
	max-width: 1120px;
	margin: 0 auto;
	padding: 0 24px;
}

/* ---------- Header ---------- */

.site-header {
	position: sticky;
	top: 0;
	z-index: 10;
	background: rgba(255, 255, 255, 0.8);
	backdrop-filter: saturate(180%) blur(12px);
	border-bottom: 1px solid var(--bg-inset);
}

.header-inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 24px;
}

.brand {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-weight: 700;
	font-size: 1.05rem;
	letter-spacing: -0.01em;
	color: var(--ink);
	border: none;
}

.brand:hover {
	color: var(--ink);
}

.brand-mark {
	color: var(--accent);
	font-size: 1.2em;
}

.site-nav {
	display: flex;
	gap: 28px;
	align-items: center;
	font-size: 0.95rem;
}

.site-nav a {
	color: var(--ink-muted);
	border: none;
}

.site-nav a:hover {
	color: var(--accent);
}

.site-nav .nav-external {
	padding: 6px 14px;
	border: 1px solid var(--bg-inset);
	border-radius: 8px;
	color: var(--ink);
}

.site-nav .nav-external:hover {
	border-color: var(--accent);
	color: var(--accent);
}

@media (max-width: 640px) {
	.site-nav a:not(.nav-external) {
		display: none;
	}
}

/* ---------- Breadcrumb strip (below header, above hero) ---------- */

.breadcrumb-strip {
	padding: 16px 24px;
	font-size: 0.85rem;
	color: var(--ink-subtle);
	max-width: 1120px;
	margin: 0 auto;
}

.breadcrumb-strip a {
	color: var(--ink-muted);
	border: none;
}

.breadcrumb-strip a:hover {
	color: var(--accent-ink);
	border-bottom: 1px solid currentColor;
}

.breadcrumb-strip .breadcrumb-sep {
	margin: 0 8px;
	color: var(--ink-subtle);
}

.breadcrumb-strip strong {
	color: var(--ink);
	font-weight: 600;
}

/* ---------- Sections ---------- */

section {
	padding: 96px 0;
	border-bottom: 1px solid var(--bg-inset);
}

section:last-of-type {
	border-bottom: none;
}

.section-lede {
	color: var(--ink-muted);
	font-size: 1.125rem;
	max-width: 60ch;
	margin-bottom: 3rem;
}

/* ---------- Hero ---------- */

.hero {
	padding: 80px 0 72px;
	background:
		radial-gradient(
			circle at 20% 0%,
			rgba(243, 128, 32, 0.06) 0%,
			transparent 40%
		),
		radial-gradient(
			circle at 80% 20%,
			rgba(243, 128, 32, 0.04) 0%,
			transparent 40%
		);
}

.eyebrow {
	font-family: var(--fs-mono);
	font-size: 0.8rem;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--accent-ink);
	background: var(--accent-soft);
	padding: 6px 12px;
	border-radius: 999px;
	display: inline-block;
	margin-bottom: 24px;
}

.hero h1 {
	max-width: 20ch;
}

.hero h1 .accent {
	color: var(--accent);
}

.hero .lede {
	max-width: 62ch;
	font-size: 1.25rem;
	color: var(--ink-muted);
	margin-top: 24px;
}

.hero-trust {
	margin-top: 20px;
	padding: 14px 18px;
	border-left: 3px solid var(--accent);
	background: var(--accent-soft);
	border-radius: 0 var(--radius) var(--radius) 0;
	font-size: 0.95rem;
	color: var(--ink);
	max-width: 62ch;
}

.hero-cta {
	display: flex;
	gap: 12px;
	margin: 32px 0 56px;
	flex-wrap: wrap;
}

.hero-code {
	max-width: 720px;
}

/* ---------- Code blocks ---------- */

.code-chrome {
	display: flex;
	align-items: center;
	gap: 6px;
	background: var(--code-chrome);
	border: 1px solid var(--code-border);
	border-bottom: none;
	border-radius: var(--radius) var(--radius) 0 0;
	padding: 10px 16px;
}

.dot {
	display: inline-block;
	width: 11px;
	height: 11px;
	border-radius: 50%;
}

.dot.red {
	background: #ff5f57;
}
.dot.yellow {
	background: #febc2e;
}
.dot.green {
	background: #28c840;
}

.code-label {
	margin-left: 12px;
	font-family: var(--fs-mono);
	font-size: 0.78rem;
	color: var(--code-ink-dim);
}

pre {
	margin: 0;
	background: var(--code-bg);
	border: 1px solid var(--code-border);
	border-radius: 0 0 var(--radius) var(--radius);
	padding: 20px 24px;
	overflow-x: auto;
	box-shadow: var(--shadow-lg);
}

pre code {
	background: none;
	padding: 0;
	color: var(--code-ink);
	font-family: var(--fs-mono);
	font-size: 0.88rem;
	line-height: 1.65;
}

.tok-keyword {
	color: var(--tok-keyword);
}
.tok-string {
	color: var(--tok-string);
}
.tok-comment {
	color: var(--tok-comment);
	font-style: italic;
}
.tok-builtin {
	color: var(--tok-builtin);
}
.tok-number {
	color: var(--tok-number);
}

/* ---------- Buttons ---------- */

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 12px 22px;
	font-family: var(--fs-sans);
	font-weight: 600;
	font-size: 0.95rem;
	border-radius: 8px;
	border: 1px solid transparent;
	cursor: pointer;
	transition: transform 80ms ease, background 120ms ease, border-color 120ms
		ease, box-shadow 120ms ease;
	text-decoration: none;
}

.btn:active {
	transform: translateY(1px);
}

.btn-primary {
	background: var(--ink);
	color: #fff;
	border-color: var(--ink);
}

.btn-primary:hover {
	background: var(--accent-ink);
	border-color: var(--accent-ink);
	color: #fff;
}

.btn-ghost {
	background: transparent;
	color: var(--ink);
	border-color: rgba(21, 23, 26, 0.15);
}

.btn-ghost:hover {
	border-color: var(--ink);
	color: var(--ink);
}

/* ---------- Why ---------- */

.why {
	background: var(--bg-alt);
}

.why h2 {
	max-width: 22ch;
	margin-bottom: 48px;
}

.why-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
	gap: 40px 48px;
}

.why-item h3 {
	color: var(--accent);
	font-family: var(--fs-mono);
	font-size: 0.92rem;
	letter-spacing: -0.005em;
	margin-bottom: 8px;
	font-weight: 600;
	text-transform: none;
}

.why-item p {
	color: var(--ink-muted);
	margin: 0;
}

/* ---------- Work TAPKit does for you ---------- */

.work h2 {
	max-width: 22ch;
	margin-bottom: 16px;
}

.work-list {
	list-style: none;
	padding: 0;
	margin: 0 0 48px;
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
	gap: 32px 40px;
}

.work-list li {
	padding-left: 20px;
	border-left: 2px solid var(--accent);
}

.work-list h3 {
	font-size: 1rem;
	font-weight: 600;
	margin-bottom: 8px;
	color: var(--ink);
}

.work-list p {
	color: var(--ink-muted);
	font-size: 0.95rem;
	margin: 0;
}

.work-list code {
	font-size: 0.85em;
}

.work-footer {
	max-width: 52ch;
	color: var(--ink-muted);
	font-size: 1.05rem;
	padding: 24px 28px;
	border-left: 3px solid var(--accent);
	background: var(--accent-soft);
	border-radius: 0 var(--radius) var(--radius) 0;
	margin: 0;
}

/* ---------- How it works ---------- */

.how-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
	gap: 24px;
}

.how-card {
	background: var(--bg);
	border: 1px solid var(--bg-inset);
	border-radius: var(--radius-lg);
	padding: 32px;
	position: relative;
	transition: border-color 120ms ease, box-shadow 120ms ease,
		transform 120ms ease;
}

.how-card:hover {
	border-color: rgba(243, 128, 32, 0.3);
	box-shadow: var(--shadow);
	transform: translateY(-2px);
}

.how-card-num {
	font-family: var(--fs-mono);
	font-size: 0.85rem;
	color: var(--accent);
	margin-bottom: 16px;
	font-weight: 600;
}

.how-card h3 {
	font-size: 1.2rem;
	margin-bottom: 4px;
}

.how-card h3 code {
	background: transparent;
	padding: 0;
	color: inherit;
	font-size: 1em;
}

.how-card-sub {
	color: var(--ink-subtle);
	font-size: 0.9rem;
	margin-bottom: 16px;
}

.how-card p:last-child {
	color: var(--ink-muted);
	margin: 0;
	font-size: 0.97rem;
}

/* ---------- Demo ---------- */

.demo {
	background: var(--bg-alt);
}

.demo-panel {
	background: var(--bg);
	border: 1px solid var(--bg-inset);
	border-radius: var(--radius-lg);
	padding: 24px;
	box-shadow: var(--shadow);
}

.demo-controls {
	display: flex;
	gap: 12px;
	align-items: center;
	flex-wrap: wrap;
	margin-bottom: 16px;
}

.demo-label {
	font-family: var(--fs-mono);
	font-size: 0.85rem;
	color: var(--ink-muted);
}

#target-url {
	flex: 1;
	min-width: 260px;
	font-family: var(--fs-mono);
	font-size: 0.9rem;
	padding: 10px 14px;
	border: 1px solid var(--bg-inset);
	border-radius: 8px;
	color: var(--ink);
	background: var(--bg);
	outline: none;
	transition: border-color 120ms ease, box-shadow 120ms ease;
}

#target-url:focus {
	border-color: var(--accent);
	box-shadow: 0 0 0 3px rgba(243, 128, 32, 0.12);
}

.demo-notice {
	min-height: 0;
	color: var(--ink-subtle);
	font-size: 0.85rem;
	margin-bottom: 8px;
	font-family: var(--fs-mono);
}

.demo-notice.error {
	color: #c33131;
}

.demo-notice.ok {
	color: #1f8a45;
}

.demo-terminal {
	border-radius: var(--radius);
	overflow: hidden;
}

.demo-terminal pre {
	border-radius: 0 0 var(--radius) var(--radius);
	box-shadow: none;
	min-height: 260px;
	max-height: 560px;
	overflow-y: auto;
}

/* Terminal output formatting — the runner emits classed spans we style here */
.demo-terminal .line {
	display: block;
}

.demo-terminal .pass {
	color: #6ec187;
}
.demo-terminal .fail {
	color: #ff8073;
}
.demo-terminal .dim {
	color: var(--code-ink-dim);
}
.demo-terminal .muted {
	color: var(--code-ink-dim);
}
.demo-terminal .header {
	color: #fff;
	font-weight: 600;
}
.demo-terminal .summary-pass {
	color: #6ec187;
	font-weight: 600;
}
.demo-terminal .summary-fail {
	color: #ff8073;
	font-weight: 600;
}

/* ---------- Quick start ---------- */

.step {
	margin-bottom: 40px;
}

.step:last-child {
	margin-bottom: 0;
}

.step h3 {
	margin-bottom: 12px;
	font-size: 1.1rem;
	font-weight: 600;
}

.step-num {
	color: var(--accent);
	font-family: var(--fs-mono);
	margin-right: 6px;
}

.step-body {
	color: var(--ink-muted);
	margin-bottom: 16px;
}

/* ---------- FAQ ---------- */

.faq {
	background: var(--bg-alt);
}

.faq-grid {
	max-width: 760px;
}

.faq details {
	border-top: 1px solid var(--bg-inset);
	padding: 20px 0;
}

.faq details:last-child {
	border-bottom: 1px solid var(--bg-inset);
}

.faq summary {
	cursor: pointer;
	font-weight: 600;
	font-size: 1.02rem;
	list-style: none;
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding-right: 8px;
}

.faq summary::-webkit-details-marker {
	display: none;
}

.faq summary::after {
	content: "+";
	font-weight: 400;
	font-size: 1.4rem;
	color: var(--ink-subtle);
	transition: transform 160ms ease;
}

.faq details[open] summary::after {
	content: "−";
}

.faq details p {
	color: var(--ink-muted);
	margin: 12px 0 0;
}

/* ---------- CTA ---------- */

.cta {
	text-align: center;
	padding: 96px 0 120px;
}

.cta h2 {
	max-width: 18ch;
	margin: 0 auto 16px;
}

.cta p {
	color: var(--ink-muted);
	max-width: 48ch;
	margin: 0 auto 32px;
	font-size: 1.1rem;
}

.cta-buttons {
	display: flex;
	gap: 12px;
	justify-content: center;
	flex-wrap: wrap;
}

/* ---------- Footer ---------- */

.site-footer {
	background: var(--bg-inset);
	padding: 32px 0;
	font-size: 0.88rem;
	color: var(--ink-muted);
}

.site-footer p {
	margin: 0 0 8px;
}

.site-footer .footer-links {
	margin: 0;
}

.site-footer a {
	color: var(--ink-muted);
	border: none;
}

.site-footer a:hover {
	color: var(--accent-ink);
}

.footer-meta {
	margin-top: 12px;
	color: var(--ink-subtle);
	font-size: 0.82rem;
	font-family: var(--fs-mono);
}

.footer-meta time {
	font-family: var(--fs-mono);
}

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
	section {
		padding: 64px 0;
	}

	.hero {
		padding: 48px 0 64px;
	}

	pre {
		padding: 16px;
	}

	pre code {
		font-size: 0.78rem;
	}

	.demo-controls {
		flex-direction: column;
		align-items: stretch;
	}

	#target-url {
		width: 100%;
	}
}
