/**
 * Kraftrs — special effects & bespoke component visuals
 */

/* =====================================================================
   HERO BACKDROP — subtle grid + ambient glow (no loud orbs)
   ===================================================================== */
.kf-hero-bg {
	position: absolute;
	inset: 0;
	z-index: 0;
	overflow: hidden;
	pointer-events: none;
}
.kf-hero-bg::before {
	content: '';
	position: absolute;
	inset: 0;
	background-image:
		linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
		linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
	background-size: 60px 60px;
	-webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 35%, #000 0%, transparent 75%);
	mask-image: radial-gradient(ellipse 70% 60% at 50% 35%, #000 0%, transparent 75%);
	opacity: 0.6;
}
.kf-hero-bg::after {
	content: '';
	position: absolute;
	top: -25%;
	left: 50%;
	transform: translateX(-50%);
	width: min(1000px, 100%);
	height: 700px;
	background: radial-gradient(circle, rgba(230,158,44,0.16) 0%, rgba(230,158,44,0.05) 35%, transparent 70%);
	animation: kf-glow-breathe 8s ease-in-out infinite alternate;
}
@keyframes kf-glow-breathe {
	from { opacity: 0.7; transform: translateX(-50%) scale(0.95); }
	to   { opacity: 1;   transform: translateX(-50%) scale(1.05); }
}

/* =====================================================================
   HERO SPLIT LAYOUT
   ===================================================================== */
.kf-hero-split { position: relative; overflow: hidden; }

.kf-hero-inner {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: clamp(2.5rem, 5vw, 5rem);
	align-items: center;
	max-width: 1200px;
	margin: 0 auto;
	position: relative;
	z-index: 1;
}

.kf-hero-copy {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
}

/* Display headline — 32-46px, respects column width */
.kf-hero-headline {
	font-size: clamp(1.875rem, 1rem + 2.6vw, 2.75rem);
	font-weight: 800;
	line-height: 1.05;
	letter-spacing: -0.035em;
	color: var(--kf-white);
	margin: 0 0 1.25rem;
}

.kf-hero-sub {
	font-size: clamp(0.975rem, 0.85rem + 0.5vw, 1.125rem);
	color: var(--kf-foreground-alt);
	line-height: 1.72;
	margin: 0 0 2.25rem;
	max-width: 52ch;
}

.kf-hero-ctas {
	display: flex;
	gap: 0.875rem;
	flex-wrap: wrap;
	margin-bottom: 1.75rem;
}

.kf-cta-primary {
	display: inline-flex;
	align-items: center;
	background: var(--kf-accent);
	color: #1a1205;
	border-radius: var(--kf-radius-xl);
	padding: 0.875rem 2rem;
	font-weight: 700;
	font-size: 0.975rem;
	text-decoration: none;
	box-shadow: 0 6px 22px rgba(230,158,44,0.22);
	transition: background 0.25s var(--kf-ease), transform 0.25s var(--kf-ease), box-shadow 0.25s var(--kf-ease);
	white-space: nowrap;
}
.kf-cta-primary:hover {
	background: var(--kf-accent-light);
	color: #1a1205;
	transform: translateY(-2px);
	box-shadow: 0 12px 34px rgba(230,158,44,0.35);
}

.kf-cta-ghost {
	display: inline-flex;
	align-items: center;
	border: 1px solid rgba(230,158,44,0.45);
	border-radius: var(--kf-radius-xl);
	padding: 0.875rem 2rem;
	font-weight: 500;
	font-size: 0.975rem;
	color: var(--kf-white);
	text-decoration: none;
	background: rgba(230,158,44,0.06);
	transition: border-color 0.25s var(--kf-ease), background 0.25s var(--kf-ease);
	white-space: nowrap;
}
.kf-cta-ghost:hover {
	border-color: var(--kf-border-amber);
	background: var(--kf-glow-soft);
	color: var(--kf-white);
}

.kf-hero-trust {
	font-size: 0.8125rem;
	font-weight: 500;
	color: var(--kf-meta);
	margin: 0;
	line-height: 1.6;
}

.kf-hero-visual {
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}
.kf-hero-visual .kf-orbit {
	width: 100%;
	max-width: 460px;
}

/* Mobile: stack, visual below */
@media (max-width: 780px) {
	.kf-hero-inner {
		grid-template-columns: 1fr;
		gap: 3rem;
		text-align: center;
	}
	.kf-hero-copy { align-items: center; margin-top: 20vw; }
	.kf-hero-sub  { max-width: 100%; }
	.kf-hero-visual { overflow: visible; }
	.kf-hero-visual .kf-orbit { max-width: min(320px, calc(100vw - 4rem)); }
}

/* =====================================================================
   AGENTIC HERO DIAGRAM — store ⇄ agent ⇄ infra node network (SVG)
   ===================================================================== */
.kf-orbit {
	position: relative;
	width: 100%;
	max-width: 520px;
	margin: 0 auto;
	aspect-ratio: 1;
}
.kf-orbit svg { width: 100%; height: 100%; overflow: visible; }
.kf-orbit .kf-link {
	stroke: rgba(230,158,44,0.35);
	stroke-width: 1.5;
	fill: none;
	stroke-dasharray: 5 7;
	animation: kf-dash 1.4s linear infinite;
}
@keyframes kf-dash { to { stroke-dashoffset: -24; } }
.kf-orbit .kf-pulse { fill: var(--kf-accent); }
.kf-node {
	position: absolute;
	transform: translate(-50%, -50%);
	display: flex; flex-direction: column; align-items: center; gap: 0.4rem;
	text-align: center;
	z-index: 2;
	text-decoration: none;
}
a.kf-node:hover .kf-node-chip {
	border-color: var(--kf-accent);
	box-shadow: 0 8px 30px rgba(0,0,0,0.5), 0 0 20px rgba(230,158,44,0.25), inset 0 0 12px rgba(230,158,44,0.08);
	transform: scale(1.08);
	transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
a.kf-node .kf-node-chip {
	transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.kf-node-chip {
	width: 60px; height: 60px; border-radius: 16px;
	display: flex; align-items: center; justify-content: center;
	background: rgba(21,16,10,0.9);
	border: 1px solid rgba(230,158,44,0.3);
	color: var(--kf-accent);
	box-shadow: 0 8px 30px rgba(0,0,0,0.5), inset 0 0 12px rgba(230,158,44,0.08);
	backdrop-filter: blur(6px);
}
.kf-node-chip svg { width: 28px; height: 28px; stroke: currentColor; fill: none; stroke-width: 1.7; }
.kf-node-label { font-size: 0.72rem; font-weight: 600; color: var(--kf-foreground-alt); letter-spacing: 0.02em; }
.kf-node--center .kf-node-chip {
	width: 84px; height: 84px; border-radius: 22px;
	background: linear-gradient(160deg, rgba(230,158,44,0.22), rgba(21,16,10,0.95));
	border-color: var(--kf-accent);
	color: var(--kf-accent-light);
	animation: kf-float-soft 5s ease-in-out infinite;
}
.kf-node--center .kf-node-chip svg { width: 40px; height: 40px; }
@keyframes kf-float-soft { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

.kf-node--c { top: 50%; left: 50%; }
.kf-node--n { top: 11%; left: 50%; }
.kf-node--e { top: 50%; left: 88%; }
.kf-node--s { top: 89%; left: 50%; }
.kf-node--w { top: 50%; left: 12%; }

/* =====================================================================
   AI AGENT CHAT DEMO  (AI Agents page showpiece)
   ===================================================================== */
.kf-chat {
	max-width: 440px;
	margin: 0 auto;
	background: linear-gradient(180deg, rgba(255,255,255,0.03), transparent), var(--kf-card);
	border: 1px solid var(--kf-border);
	border-radius: var(--kf-radius-lg);
	box-shadow: var(--kf-shadow-hover);
	overflow: hidden;
}
.kf-chat__bar {
	display: flex; align-items: center; gap: 0.6rem;
	padding: 0.9rem 1.1rem;
	border-bottom: 1px solid var(--kf-border);
	background: rgba(0,0,0,0.25);
}
.kf-chat__avatar {
	width: 32px; height: 32px; border-radius: 50%;
	background: linear-gradient(135deg, var(--kf-accent-light), var(--kf-accent));
	display: flex; align-items: center; justify-content: center;
	color: #1a1205; flex-shrink: 0;
}
.kf-chat__avatar svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.kf-chat__title { font-size: 0.9rem; font-weight: 600; color: var(--kf-white); }
.kf-chat__status { font-size: 0.72rem; color: var(--kf-accent); display: flex; align-items: center; gap: 0.35rem; }
.kf-chat__status .kf-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--kf-accent); }
.kf-chat__body { padding: 1.25rem; display: flex; flex-direction: column; gap: 0.85rem; height: 320px; overflow-y: auto; overflow-x: hidden; }
/* Prevent demo card from reflowing grid when messages are appended */
.kf-chat-demo { width: 100%; }
.kf-msg {
	max-width: 82%;
	padding: 0.7rem 1rem;
	border-radius: 16px;
	font-size: 0.92rem;
	line-height: 1.5;
	opacity: 0;
	transform: translateY(10px);
	animation: kf-msg-in 0.5s var(--kf-ease) forwards;
}
@keyframes kf-msg-in { to { opacity: 1; transform: none; } }
.kf-msg--user { align-self: flex-end; background: var(--kf-accent); color: #1a1205; border-bottom-right-radius: 5px; font-weight: 500; }
.kf-msg--bot { align-self: flex-start; background: rgba(255,255,255,0.05); color: var(--kf-foreground); border: 1px solid var(--kf-border); border-bottom-left-radius: 5px; }
.kf-msg--tool {
	align-self: flex-start; font-size: 0.78rem; color: var(--kf-meta);
	background: rgba(230,158,44,0.06); border: 1px dashed var(--kf-border-amber);
	display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.45rem 0.8rem;
}
.kf-msg--tool svg { width: 14px; height: 14px; color: var(--kf-accent); stroke: currentColor; fill: none; stroke-width: 1.8; }
.kf-typing { display: inline-flex; gap: 4px; }
.kf-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--kf-meta); animation: kf-blink 1.2s infinite; }
.kf-typing span:nth-child(2) { animation-delay: 0.2s; }
.kf-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes kf-blink { 0%,100% { opacity: 0.3; } 50% { opacity: 1; } }

/* =====================================================================
   TIMELINE (How it works / deployment)
   ===================================================================== */
.kf-timeline { position: relative; }
.kf-step { position: relative; }
.kf-step__num {
	font-size: clamp(2.5rem, 5vw, 3.5rem);
	font-weight: 800; line-height: 1;
	color: transparent;
	-webkit-text-stroke: 1.5px var(--kf-border-amber);
	letter-spacing: -0.04em;
	display: block; margin-bottom: 0.75rem;
}
.kf-card:hover .kf-step__num { color: var(--kf-glow-soft); -webkit-text-stroke-color: var(--kf-accent); }

/* =====================================================================
   PORTRAIT / AVATAR FRAME (About page placeholder)
   ===================================================================== */
.kf-portrait {
	position: relative;
	border-radius: var(--kf-radius-lg);
	overflow: hidden;
	aspect-ratio: 4 / 5;
	background:
		radial-gradient(80% 60% at 30% 10%, rgba(230,158,44,0.22), transparent 60%),
		linear-gradient(160deg, #1a130a, #0b0804);
	border: 1px solid var(--kf-border-amber);
	display: flex; align-items: center; justify-content: center;
}
.kf-portrait__mono {
	font-size: clamp(4rem, 12vw, 8rem);
	font-weight: 800; color: var(--kf-accent);
	opacity: 0.85; letter-spacing: -0.04em;
}
.kf-portrait__ring {
	position: absolute; inset: 14px;
	border: 1px dashed rgba(230,158,44,0.3);
	border-radius: calc(var(--kf-radius-lg) - 6px);
	pointer-events: none;
}

/* =====================================================================
   SWAPPABLE IMAGE SLOTS
   ===================================================================== */
.kf-img-slot {
	position: relative;
	border-radius: var(--kf-radius-lg);
	overflow: hidden;
	border: 1px solid var(--kf-border);
	box-shadow: 0 24px 64px rgba(0,0,0,0.45), inset 0 0 0 1px rgba(255,255,255,0.04);
}
.kf-img-slot__img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center top;
}
/* Hero image slot — sits in right column beside orbit */
.kf-img-slot--hero { aspect-ratio: 4 / 3; max-width: 560px; }
/* Founder portrait */
.kf-img-slot--founder { aspect-ratio: 4 / 5; }
/* Full-bleed section bg slot */
.kf-img-slot--bg {
	position: absolute; inset: 0; border-radius: 0; border: 0;
	z-index: 0; overflow: hidden;
}
.kf-img-slot--bg .kf-img-slot__img { opacity: 0.18; }
.kf-img-slot--bg + * { position: relative; z-index: 1; }

/* =====================================================================
   GLOBAL FX LAYER — aurora · grain · cursor glow
   ===================================================================== */
.kf-fx-layer {
	position: fixed; inset: 0; z-index: -1;
	pointer-events: none; overflow: hidden;
}

/* Drifting amber aurora */
.kf-aurora {
	position: absolute; inset: 0;
	background:
		radial-gradient(ellipse 80% 60% at 10% 20%, rgba(230,158,44,0.055) 0%, transparent 60%),
		radial-gradient(ellipse 60% 50% at 90% 80%, rgba(180,110,20,0.04) 0%, transparent 55%),
		radial-gradient(ellipse 70% 40% at 55% 50%, rgba(230,158,44,0.025) 0%, transparent 65%);
	animation: kf-aurora-drift 18s ease-in-out infinite alternate;
}

/* Film grain */
.kf-grain {
	position: absolute; inset: -50%;
	width: 200%; height: 200%;
	opacity: 0.038;
	mix-blend-mode: overlay;
	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 type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
	background-repeat: repeat;
	animation: kf-grain-shift 0.2s steps(1) infinite;
}

/* Cursor-follow glow (driven by --gx/--gy in main.js) */
.kf-page-glow {
	position: fixed;
	left: var(--gx, 50vw);
	top: var(--gy, 50vh);
	transform: translate(-50%, -50%);
	width: 600px; height: 600px;
	border-radius: 50%;
	background: radial-gradient(circle, rgba(230,158,44,0.06) 0%, transparent 65%);
	pointer-events: none;
	transition: left 0.15s ease-out, top 0.15s ease-out;
	will-change: left, top;
}

/* Soft section divider */
.kf-section + .kf-section-dark,
.kf-section-dark + .kf-section {
	position: relative;
}
.kf-section + .kf-section-dark::before,
.kf-section-dark + .kf-section::before {
	content: '';
	display: block;
	position: absolute; top: 0; left: 10%; right: 10%; height: 1px;
	background: linear-gradient(90deg, transparent, rgba(230,158,44,0.2), transparent);
}

/* =====================================================================
   Reduced motion
   ===================================================================== */
@media (prefers-reduced-motion: reduce) {
	.kf-hero-bg::after, .kf-node--center .kf-node-chip, .kf-orbit .kf-link { animation: none !important; }
	.kf-msg { opacity: 1 !important; transform: none !important; animation: none !important; }
	.kf-aurora, .kf-grain, .kf-page-glow { display: none !important; }
}
