/* ============================================================
   Markital homepage art direction. Front page only.

   The brief was "make it beautiful", not "make it different". The palette
   stays: lime #7CE02A is the logo's own green and the only chromatic accent.
   What this file adds is DEPTH - a living field behind the page, grain,
   elevation on cards, and rhythm between sections - plus the cool teal and a
   whisper of amber that already exist as tokens but were barely used.

   Rules kept from earlier mistakes:
   - Nothing here redefines --ink, --bg, --line, --muted, --accent or --ease
     on a class. New tokens get new names.
   - Everything animates transform/opacity only, so CLS stays 0.
   - The hero H1 is never animated: it is the LCP element.
   ============================================================ */

:root {
	/* New names, so nothing existing is shadowed. These sit on :root and NOT
	   on .site-home: .mk-field and .mk-progress are children of <body>, so
	   while the tokens were scoped to .site-home their rgba() never resolved
	   and both silently rendered nothing at all. */
	--mk-teal: 23, 140, 120;
	--mk-amber: 240, 180, 41;
	--mk-lime: 124, 224, 42;
}

/* ============================================================
   1. The living field
   Three very large, very soft colour bodies drifting behind everything.
   This is what turns a flat near-black page into one with air in it.
   ============================================================ */
.mk-field {
	position: fixed;
	inset: 0;
	z-index: -1;
	overflow: hidden;
	pointer-events: none;
	contain: strict;
}

.mk-field__blob {
	position: absolute;
	border-radius: 50%;
	will-change: transform;
	opacity: .55;
}

/* no blur filter on purpose - a soft radial gradient is already soft, and
   filter: blur() on a surface this large is the expensive way to do it */
.mk-field__blob--a {
	width: 70vmax;
	height: 70vmax;
	top: -22vmax;
	left: -14vmax;
	background: radial-gradient(circle, rgba(var(--mk-lime), .13), transparent 62%);
	animation: mk-drift-a 34s ease-in-out infinite alternate;
}

.mk-field__blob--b {
	width: 62vmax;
	height: 62vmax;
	top: 18vmax;
	right: -20vmax;
	background: radial-gradient(circle, rgba(var(--mk-teal), .16), transparent 64%);
	animation: mk-drift-b 43s ease-in-out infinite alternate;
}

.mk-field__blob--c {
	width: 54vmax;
	height: 54vmax;
	bottom: -24vmax;
	left: 22vmax;
	background: radial-gradient(circle, rgba(var(--mk-amber), .055), transparent 66%);
	animation: mk-drift-c 51s ease-in-out infinite alternate;
}

@keyframes mk-drift-a {
	from { transform: translate3d(0, 0, 0) scale(1); }
	to   { transform: translate3d(9vmax, 6vmax, 0) scale(1.14); }
}
@keyframes mk-drift-b {
	from { transform: translate3d(0, 0, 0) scale(1.08); }
	to   { transform: translate3d(-11vmax, -7vmax, 0) scale(.94); }
}
@keyframes mk-drift-c {
	from { transform: translate3d(0, 0, 0) scale(.96); }
	to   { transform: translate3d(7vmax, -9vmax, 0) scale(1.18); }
}

:root[data-theme="light"] .mk-field__blob { opacity: .4; }
:root[data-theme="light"] .mk-field__blob--a { background: radial-gradient(circle, rgba(var(--mk-lime), .14), transparent 62%); }
:root[data-theme="light"] .mk-field__blob--b { background: radial-gradient(circle, rgba(var(--mk-teal), .10), transparent 64%); }

/* ============================================================
   2. Grain
   A single inline SVG, no extra request. At 3.5% it is invisible as texture
   and very visible as "this was designed" - it kills the plastic flatness
   large dark gradients otherwise have.
   ============================================================ */
.mk-grain {
	position: fixed;
	inset: 0;
	z-index: 100;
	pointer-events: none;
	opacity: .035;
	mix-blend-mode: overlay;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
	background-size: 180px 180px;
}

:root[data-theme="light"] .mk-grain { opacity: .022; }

/* ============================================================
   3. Elevation: the top-edge highlight
   One hairline of light along the top of every raised surface. This is the
   single cheapest thing that separates premium dark UI from flat dark UI.
   ============================================================ */
.site-home .svc::before,
.site-home .tile::before,
.site-home .shot::before {
	content: "";
	position: absolute;
	top: 0;
	left: 12%;
	right: 12%;
	height: 1px;
	z-index: 3;
	pointer-events: none;
	background: linear-gradient(90deg, transparent, rgba(var(--ink-rgb), .34), transparent);
}

:root[data-theme="light"] .site-home .svc::before,
:root[data-theme="light"] .site-home .tile::before,
:root[data-theme="light"] .site-home .shot::before {
	background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .85), transparent);
}

.site-home .svc--lead::before { left: 6%; right: 6%; }

/* ============================================================
   4. Section rhythm
   Hairline dividers that fade out at the edges, so sections read as stacked
   slabs rather than one long scroll.
   ============================================================ */
/* .sec--offer and .sec--work already own ::before in site-home.css, so the
   divider uses ::after throughout rather than fighting over one pseudo. */
.site-home .sec--steps::after,
.site-home .sec--work::after,
.site-home .sec--who::after,
.site-home .sec--cta::after {
	content: "";
	position: absolute;
	top: 0;
	left: 8%;
	right: 8%;
	height: 1px;
	pointer-events: none;
	background: linear-gradient(90deg, transparent, var(--line), transparent);
}

/* ============================================================
   5. Steps: a rail that fills as you scroll
   This was the flattest section on the page. --fill is written by home-fx.js
   from 0 to 1 as the section crosses the viewport.
   ============================================================ */
.site-home .steps {
	position: relative;
	--fill: 0;
}

.site-home .steps::before,
.site-home .steps::after {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 2px;
	border-radius: 2px;
}

.site-home .steps::before { background: var(--line); }

.site-home .steps::after {
	background: linear-gradient(90deg, var(--accent), rgba(var(--mk-teal), .9));
	transform: scaleX(var(--fill));
	transform-origin: left center;
	box-shadow: 0 0 16px rgba(var(--mk-lime), .45);
}

/* the number becomes a lit node once the rail reaches it */
.site-home .step {
	border-top-color: transparent;
	transition: color .4s var(--ease);
}

.site-home .step__n {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 9px;
}

.site-home .step__n::before {
	content: "";
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--line);
	transition: background-color .45s var(--ease), box-shadow .45s var(--ease);
}

.site-home .step.is-lit .step__n::before {
	background: var(--accent);
	box-shadow: 0 0 0 4px rgba(var(--mk-lime), .18);
}

/* ============================================================
   6. Work tiles: a light sweep on hover
   The lift already existed. The sweep is what makes it feel physical.
   ============================================================ */
.site-home .tile::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 2;
	pointer-events: none;
	opacity: 0;
	background: linear-gradient(104deg, transparent 38%, rgba(255, 255, 255, .13) 50%, transparent 62%);
	transform: translateX(-62%);
	transition: opacity .2s linear;
}

.site-home .tile:hover::after,
.site-home .tile:focus-visible::after {
	opacity: 1;
	animation: mk-sweep .85s var(--ease);
}

@keyframes mk-sweep {
	from { transform: translateX(-62%); }
	to   { transform: translateX(62%); }
}

.site-home .tile__go {
	transition: transform .35s var(--ease), opacity .35s var(--ease);
}

.site-home .tile:hover .tile__go { transform: translateX(3px); }

/* ============================================================
   7. The cream band
   It was a hard cut between two very dark sections. Softening the entry and
   exit makes the contrast feel deliberate rather than abrupt.
   ============================================================ */
.site-home .sec--proof {
	position: relative;
	border-radius: 28px 28px 0 0;
}

.site-home .sec--who {
	border-radius: 28px 28px 0 0;
	margin-top: -24px;
	/* the section is otherwise transparent, so the rounded top has nothing to
	   round against. Just under opaque, so the field still whispers through. */
	background: rgba(var(--bg-rgb), .96);
}

.site-home .sec--proof::after {
	content: "";
	position: absolute;
	inset: auto 0 0;
	height: 1px;
	background: rgba(var(--on-cream-rgb), .10);
}

.site-home .proof li {
	transition: border-color .4s var(--ease);
}

.site-home .proof li:hover { border-left-color: var(--accent-on-cream); }

/* ============================================================
   8. Scroll progress
   A 2px lime rule at the very top. Cheap, and it makes a long page feel
   navigable rather than endless.
   ============================================================ */
.mk-progress {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	height: 2px;
	z-index: 120;
	pointer-events: none;
	transform: scaleX(var(--p, 0));
	transform-origin: left center;
	background: linear-gradient(90deg, var(--accent), rgba(var(--mk-teal), .95));
}

/* ============================================================
   9. Magnetic buttons
   --bx / --by are written by home-fx.js, in pixels, mouse only.
   ============================================================ */
.site-home .btn.is-magnetic {
	transform: translate3d(var(--bx, 0px), var(--by, 0px), 0);
	transition: transform .35s var(--ease), background-color .25s, color .25s, border-color .25s, box-shadow .25s;
}

/* ============================================================
   10. Hero: a quiet scroll cue
   ============================================================ */
.mk-cue {
	position: absolute;
	left: 50%;
	bottom: 18px;
	z-index: 2;
	display: grid;
	justify-items: center;
	gap: 7px;
	transform: translateX(-50%);
	font-size: 10.5px;
	font-weight: 800;
	letter-spacing: .2em;
	text-transform: uppercase;
	color: var(--dim);
	opacity: 0;
	animation: mk-cue-in .7s var(--ease) 1.1s forwards;
}

.mk-cue__line {
	width: 1px;
	height: 34px;
	background: linear-gradient(180deg, var(--accent), transparent);
	transform-origin: top center;
	animation: mk-cue-run 2.1s var(--ease) infinite;
}

@keyframes mk-cue-in { to { opacity: 1; } }
@keyframes mk-cue-run {
	0%   { transform: scaleY(0); opacity: 0; }
	35%  { transform: scaleY(1); opacity: 1; }
	100% { transform: scaleY(1) translateY(34px); opacity: 0; }
}

@media (max-width: 860px) { .mk-cue { display: none; } }

/* ============================================================
   Narrow screens: keep the field, drop the drift.
   Three animating surfaces that size is not a fair ask of a budget phone.
   ============================================================ */
@media (max-width: 700px) {
	.mk-field__blob {
		animation: none;
		opacity: .45;
	}
	.site-home .sec--proof,
	.site-home .sec--who { border-radius: 20px 20px 0 0; }
}

/* ============================================================
   Reduced motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
	.mk-field__blob { animation: none; }
	.site-home .tile:hover::after,
	.site-home .tile:focus-visible::after { animation: none; opacity: 0; }
	.site-home .steps::after { transition: none; }
	.site-home .btn.is-magnetic { transform: none; transition: none; }
	.mk-cue { animation: none; opacity: 1; }
	.mk-cue__line { animation: none; }
}

/* ============================================================
   11. Ember field (canvas)
   Injected as the first child of .hero and .sec--cta. Both already have
   position: relative, so the canvas is clipped to the section without any
   extra wrapper.
   ============================================================ */
.mk-embers {
	position: absolute;
	inset: 0;
	z-index: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
}

/* .hero__glow and .cta__aurora are positioned, so without this the content
   (which is static) would paint underneath the decoration. */
.site-home .hero > .wrap,
.site-home .sec--cta > .wrap {
	position: relative;
	z-index: 1;
}

.site-home .sec--cta { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
	.mk-embers { display: none; }
}

/* ============================================================
   12. Homepage FAQ
   Native <details>, so it opens without JavaScript and is keyboard
   accessible for free. The only work here is hiding the default marker and
   animating the chevron.
   ============================================================ */
.site-home .faq {
	display: grid;
	gap: 10px;
	max-width: 880px;
}

.site-home .faq__item {
	border: 1px solid var(--edge);
	border-radius: 16px;
	background: linear-gradient(168deg, var(--raise-2), rgba(var(--ink-rgb), .012));
	transition: border-color .3s var(--ease), background-color .3s var(--ease);
}

.site-home .faq__item[open] { border-color: var(--edge-lit); }
.site-home .faq__item:hover { border-color: var(--edge-lit); }

.site-home .faq__q {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 18px;
	padding: 18px clamp(18px, 2vw, 24px);
	cursor: pointer;
	list-style: none;
	font-family: var(--font-display);
	font-weight: 600;
	font-size: clamp(.98rem, 1.5vw, 1.12rem);
	line-height: 1.35;
	letter-spacing: -.02em;
	color: var(--ink);
}

/* the default disclosure triangle, in both engines */
.site-home .faq__q::-webkit-details-marker { display: none; }
.site-home .faq__q::marker { content: ""; }

.site-home .faq__q:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: -2px;
	border-radius: 16px;
}

.site-home .faq__mark {
	position: relative;
	flex: none;
	width: 18px;
	height: 18px;
}

.site-home .faq__mark::before,
.site-home .faq__mark::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 0;
	width: 100%;
	height: 2px;
	margin-top: -1px;
	border-radius: 2px;
	background: var(--accent);
	transition: transform .3s var(--ease), opacity .3s var(--ease);
}

.site-home .faq__mark::after { transform: rotate(90deg); }
.site-home .faq__item[open] .faq__mark::after { transform: rotate(0deg); opacity: 0; }

.site-home .faq__a {
	padding: 0 clamp(18px, 2vw, 24px) 20px;
}

.site-home .faq__a p {
	margin: 0;
	max-width: 68ch;
	font-size: 14.5px;
	line-height: 1.7;
	color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
	.site-home .faq__item,
	.site-home .faq__mark::before,
	.site-home .faq__mark::after { transition: none; }
}

/* ============================================================
   13. Reveal on scroll (pages other than the homepage)
   Hiding is opt-in: ambient.js puts .mk-rv-on on <html> and only then does
   anything become invisible. A script failure can never blank the page.
   ============================================================ */
.mk-rv-on .mk-rv {
	opacity: 0;
	transform: translate3d(0, 14px, 0);
	transition: opacity .6s var(--ease), transform .6s var(--ease);
	transition-delay: var(--rv-d, 0ms);
}

.mk-rv-on .mk-rv.is-in {
	opacity: 1;
	transform: none;
}

@media (prefers-reduced-motion: reduce) {
	.mk-rv-on .mk-rv { opacity: 1; transform: none; transition: none; }
}
