/* =====================================================================
   KratosLabs — elegant, minimal, monochrome software studio
   Evolved from "The Engineer" (2016): same monochrome + weight-contrast
   DNA, modernised with Fraunces/Schibsted Grotesk and slow parallax.
   ===================================================================== */

:root {
	--paper:  #000000;
	--base:   #0a0a0a;
	--panel:  #141414;
	--ink:    #ffffff;
	--mute:   #8a8a8a;
	--line:   #292929;
	--accent: #dadada;
	--cream:  #fffdeb;

	--display: "Fraunces", Georgia, "Times New Roman", serif;
	--body: "Schibsted Grotesk", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;

	--ease: cubic-bezier(.16, 1, .3, 1);
	--ease-soft: cubic-bezier(.22, 1, .36, 1);

	--pad: clamp(22px, 6vw, 110px);
	--maxw: 1560px;
	--nav-h: 86px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
	-webkit-text-size-adjust: 100%;
	scroll-padding-top: var(--nav-h);
}

body {
	background: var(--base);
	color: var(--ink);
	font-family: var(--body);
	font-weight: 400;
	font-size: 17px;
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	font-optical-sizing: auto;
	overflow-x: hidden;
}

::selection { background: var(--ink); color: var(--paper); }

img { display: block; max-width: 100%; height: auto; }

a { color: inherit; text-decoration: none; }

:focus-visible {
	outline: 1.5px solid var(--accent);
	outline-offset: 4px;
}

/* ---- shared type ---- */
.eyebrow {
	font-family: var(--body);
	font-weight: 600;
	font-size: clamp(11px, 1vw, 13px);
	letter-spacing: .26em;
	text-transform: uppercase;
	color: var(--mute);
}

em { font-style: italic; }

/* =====================================================================
   GRAIN
   ===================================================================== */
.grain {
	position: fixed;
	inset: 0;
	z-index: 60;
	pointer-events: none;
	opacity: .05;
	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='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* =====================================================================
   LOADER
   ===================================================================== */
.loader {
	position: fixed;
	inset: 0;
	z-index: 200;
	background: var(--paper);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: opacity .8s var(--ease), visibility .8s;
}
html:not(.js) .loader { display: none; }   /* no JS at all → never show the overlay */
.loader.is-hidden { opacity: 0; visibility: hidden; }
.loader__mark path {
	stroke-dasharray: var(--len, 240);
	stroke-dashoffset: var(--len, 240);
}
.loader.is-drawing .loader__mark path {
	transition: stroke-dashoffset 1.25s var(--ease-soft);
	stroke-dashoffset: 0;
}

/* =====================================================================
   NAV
   ===================================================================== */
.nav {
	position: fixed;
	top: 0; left: 0; right: 0;
	z-index: 100;
	height: var(--nav-h);
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 var(--pad);
	mix-blend-mode: difference;        /* stays legible over any section */
	opacity: 0;
	transform: translateY(-12px);
	transition: opacity .7s var(--ease), transform .7s var(--ease);
	pointer-events: none;
}
.nav.is-visible { opacity: 1; transform: none; pointer-events: auto; }

.nav__brand {
	display: inline-flex;
	align-items: center;
	gap: 11px;
	color: var(--ink);
}
.nav__mark { display: block; }
.nav__word {
	font-family: var(--display);
	font-weight: 500;
	font-size: 21px;
	letter-spacing: .01em;
}
.nav__word em { font-style: italic; opacity: .85; }

.nav__links {
	display: flex;
	gap: clamp(18px, 2.4vw, 40px);
}
.nav__links a {
	font-size: 13px;
	font-weight: 500;
	letter-spacing: .12em;
	text-transform: uppercase;
	color: var(--ink);
	position: relative;
	padding: 4px 0;
}
.nav__links a::after {
	content: "";
	position: absolute;
	left: 0; bottom: 0;
	width: 100%; height: 1px;
	background: currentColor;
	transform: scaleX(0);
	transform-origin: left;
	transition: transform .5s var(--ease);
}
.nav__links a:hover::after { transform: scaleX(1); }

.nav__toggle {
	display: none;
	width: 34px; height: 34px;
	background: none; border: 0; cursor: pointer;
	color: var(--ink);
	position: relative;
}
.nav__toggle-lines,
.nav__toggle-lines::before,
.nav__toggle-lines::after {
	content: "";
	position: absolute;
	left: 4px;
	width: 26px; height: 1.6px;
	background: currentColor;
	transition: transform .4s var(--ease), opacity .3s var(--ease);
}
.nav__toggle-lines { top: 16px; }
.nav__toggle-lines::before { top: -7px; }
.nav__toggle-lines::after  { top: 7px; }
.nav.is-open .nav__toggle-lines { transform: rotate(45deg); }
.nav.is-open .nav__toggle-lines::before { transform: translateY(7px) rotate(-90deg); }
.nav.is-open .nav__toggle-lines::after  { opacity: 0; }

/* fullscreen menu (legacy slide-down) */
.menu {
	position: fixed;
	inset: 0;
	z-index: 90;
	background: rgba(0, 0, 0, .96);
	transform: translateY(-100%);
	transition: transform .8s var(--ease);
	display: flex;
	align-items: center;
	justify-content: center;
}
.menu.is-open { transform: translateY(0); }
.menu { overscroll-behavior: contain; }
.menu__inner { display: flex; flex-direction: column; gap: clamp(8px, 2vh, 22px); padding: var(--pad); }
.menu__inner a {
	font-family: var(--display);
	font-weight: 400;
	font-size: clamp(2.4rem, 11vw, 5rem);
	line-height: 1.05;
	letter-spacing: -.01em;
	color: var(--ink);
	display: flex;
	align-items: baseline;
	gap: 18px;
	transition: opacity .4s var(--ease), transform .5s var(--ease);
}
.menu__inner a span {
	font-family: var(--body);
	font-size: 13px;
	font-weight: 600;
	letter-spacing: .2em;
	color: var(--mute);
}
.menu__inner a:hover { opacity: .55; }

/* =====================================================================
   LAYOUT — Swiss left-aligned rail + body
   ===================================================================== */
.section {
	position: relative;
	max-width: var(--maxw);
	margin: 0 auto;
	padding: clamp(96px, 16vh, 220px) var(--pad);
	display: grid;
	grid-template-columns: minmax(0, 230px) minmax(0, 1fr);
	gap: clamp(28px, 5vw, 90px);
}
.section--ethos { background:
	linear-gradient(180deg, var(--paper), var(--base)); }

.rail {
	display: flex;
	flex-direction: column;
	gap: 8px;
}
.rail__num {
	font-family: var(--body);
	font-weight: 600;
	font-size: 13px;
	letter-spacing: .2em;
	color: var(--mute);
}
.rail__label {
	font-family: var(--display);
	font-weight: 400;
	font-size: clamp(1.4rem, 2.2vw, 2.1rem);
	line-height: 1;
	color: var(--accent);
	position: sticky;
	top: calc(var(--nav-h) + 8px);
}

.section__body { min-width: 0; }

/* =====================================================================
   HERO
   ===================================================================== */
.hero {
	position: relative;
	min-height: 100vh;          /* fallback for browsers without svh */
	min-height: 100svh;
	display: flex;
	flex-direction: column;
	justify-content: center;
	padding: var(--nav-h) var(--pad) clamp(70px, 12vh, 130px);
	overflow: hidden;
	background: var(--paper);
}
.hero__bg {
	position: absolute;
	inset: -8% 0 0 0;
	z-index: 0;
	will-change: transform;
}
.hero__bg img {
	width: 100%;
	height: 116%;
	object-fit: cover;
	object-position: center;
	filter: grayscale(1) contrast(1.05) brightness(.5);
	opacity: .42;
}
.hero::after {                        /* gradient so type always reads */
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
	background:
		radial-gradient(120% 90% at 30% 40%, transparent 0%, rgba(0,0,0,.55) 70%),
		linear-gradient(180deg, rgba(0,0,0,.6) 0%, rgba(0,0,0,.2) 40%, rgba(10,10,10,.95) 100%);
	pointer-events: none;
}
.hero__grid {
	position: absolute;
	inset: -2px;
	z-index: 1;
	pointer-events: none;
	opacity: .5;
	background-image:
		linear-gradient(to right, var(--line) 1px, transparent 1px),
		linear-gradient(to bottom, var(--line) 1px, transparent 1px);
	background-size: clamp(60px, 9vw, 120px) clamp(60px, 9vw, 120px);
	-webkit-mask-image: radial-gradient(120% 80% at 50% 35%, #000 0%, transparent 72%);
	        mask-image: radial-gradient(120% 80% at 50% 35%, #000 0%, transparent 72%);
	transform: translate3d(calc(var(--px, 0) * 14px), calc(var(--py, 0) * 14px), 0);
}
.hero__mark {
	position: absolute;
	z-index: 1;
	right: clamp(-40px, 2vw, 60px);
	top: 50%;
	width: clamp(280px, 42vw, 640px);
	height: auto;
	transform: translate3d(calc(var(--px, 0) * -10px), calc(-50% + var(--py, 0) * -10px), 0);
	opacity: .07;
	pointer-events: none;
}

.hero__inner { position: relative; z-index: 2; max-width: 1200px; }
.hero__eyebrow { margin-bottom: clamp(20px, 3vh, 38px); }

.hero__title {
	font-family: var(--display);
	font-weight: 480;
	font-size: clamp(4rem, 19vw, 17rem);
	line-height: .82;
	letter-spacing: -.035em;
	font-variation-settings: "opsz" 144;
}
.hero__title .line { display: block; overflow: hidden; }
.hero__title em { font-style: italic; font-weight: 360; }

.hero__tagline {
	margin-top: clamp(22px, 3.4vh, 44px);
	font-family: var(--display);
	font-weight: 380;
	font-size: clamp(1.5rem, 3.4vw, 2.9rem);
	line-height: 1.1;
	letter-spacing: -.01em;
	color: var(--ink);
}
.hero__sub {
	margin-top: 14px;
	font-size: clamp(15px, 1.4vw, 18px);
	color: var(--mute);
	letter-spacing: .01em;
}

.hero__cue {
	position: absolute;
	z-index: 2;
	left: var(--pad);
	bottom: clamp(28px, 5vh, 54px);
	display: flex;
	align-items: center;
	gap: 14px;
	color: var(--mute);
}
.hero__cue-line {
	width: 64px; height: 1px;
	background: currentColor;
	transform-origin: left;
	animation: cue 3.4s var(--ease) infinite;
}
.hero__cue-label {
	font-size: 11px; font-weight: 600;
	letter-spacing: .26em; text-transform: uppercase;
}
@keyframes cue {
	0%, 100% { transform: scaleX(.4); opacity: .5; }
	50% { transform: scaleX(1); opacity: 1; }
}

/* =====================================================================
   01 — ETHOS
   ===================================================================== */
.statement {
	font-family: var(--display);
	font-weight: 360;
	font-size: clamp(1.9rem, 5.2vw, 4.4rem);
	line-height: 1.08;
	letter-spacing: -.02em;
	max-width: 16ch;
}

/* =====================================================================
   02 — CAPABILITIES
   ===================================================================== */
.caps { list-style: none; }
.cap {
	position: relative;
	display: grid;
	grid-template-columns: 64px 1fr;
	gap: clamp(14px, 2vw, 40px);
	align-items: baseline;
	padding: clamp(26px, 4vw, 50px) 0;
}
.cap__index {
	font-family: var(--body);
	font-weight: 600;
	font-size: 13px;
	letter-spacing: .14em;
	color: var(--mute);
}
.cap__title {
	font-family: var(--display);
	font-weight: 420;
	font-size: clamp(2rem, 6vw, 5rem);
	line-height: 1;
	letter-spacing: -.025em;
}
.cap__desc {
	margin-top: 16px;
	color: var(--mute);
	font-size: clamp(15px, 1.5vw, 19px);
	max-width: 34ch;
}
.divider {
	position: absolute;
	left: 0; bottom: 0;
	width: 100%; height: 1px;
	background: var(--line);
	transform: scaleX(0);
	transform-origin: left;
	transition: transform 1.2s var(--ease);
}
.cap.in-view .divider { transform: scaleX(1); }

/* =====================================================================
   03 — WORK
   ===================================================================== */
.work__lead {
	font-family: var(--display);
	font-weight: 380;
	font-size: clamp(1.6rem, 4vw, 3.2rem);
	line-height: 1.05;
	letter-spacing: -.02em;
	max-width: 18ch;
	margin-bottom: clamp(46px, 8vh, 110px);
}
.plates {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: clamp(16px, 2.4vw, 40px);
	align-items: start;
}
.plate:nth-child(2) { margin-top: clamp(40px, 9vw, 120px); }
.plate:nth-child(3) { margin-top: clamp(14px, 4vw, 60px); }

.plate__media {
	position: relative;
	overflow: hidden;
	aspect-ratio: 4 / 5;
	background: var(--panel);
}
/* the layer is what the parallax JS translates; the img owns the hover scale —
   separate nodes so the two transforms never collide */
.plate__layer {
	position: absolute;
	inset: -12% 0;
	will-change: transform;
}
.plate__layer img {
	width: 100%; height: 100%;
	object-fit: cover;
	filter: grayscale(1) contrast(1.04) brightness(.82);
	transform: scale(1.03);
	transition: transform 1.1s var(--ease), filter .8s var(--ease);
}
.plate:hover .plate__layer img { transform: scale(1.08); filter: grayscale(1) contrast(1) brightness(.6); }

.plate__overlay {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, .25);
	opacity: 0;
	transition: opacity .6s var(--ease);
}
.plate:hover .plate__overlay { opacity: 1; }
.plate__title {
	font-family: var(--display);
	font-weight: 400;
	font-style: italic;
	font-size: clamp(1.6rem, 3vw, 2.6rem);
	letter-spacing: -.01em;
	transform: translateY(14px);
	transition: transform .6s var(--ease);
}
.plate:hover .plate__title { transform: none; }

.plate__meta {
	margin-top: 16px;
	display: flex;
	gap: 12px;
	font-size: 13px;
	letter-spacing: .08em;
	color: var(--mute);
	text-transform: uppercase;
}
.plate__meta span { color: var(--accent); }

/* =====================================================================
   04 — APPROACH (the one cream surface — a legacy nod)
   ===================================================================== */
.section--approach {
	max-width: none;
	width: 100%;
	background: var(--cream);
	color: var(--base);
	padding-left: var(--pad);
	padding-right: var(--pad);
	grid-template-columns: minmax(0, 230px) minmax(0, 1fr);
}
/* note: no overflow:hidden here — it would turn this section into a scroll
   container and break the sticky rail label. The marquees self-clip. */
.section--approach .rail__num,
.section--approach .plate__meta { color: #6f6d5e; }
.section--approach .rail__label { color: #1a1a14; }

.approach__principle {
	font-family: var(--display);
	font-weight: 380;
	font-size: clamp(2rem, 6vw, 5rem);
	line-height: 1;
	letter-spacing: -.025em;
	color: var(--base);
	max-width: 14ch;
}

.marquee {
	grid-column: 1 / -1;
	margin: 0 calc(var(--pad) * -1);
	margin-top: clamp(40px, 7vh, 90px);
	overflow: hidden;
	-webkit-mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
	        mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
}
.marquee + .marquee { margin-top: clamp(4px, 1vh, 12px); }
.marquee__track {
	display: flex;
	width: max-content;
	animation: marquee 36s linear infinite;
}
.marquee--rev .marquee__track { animation-duration: 44s; animation-direction: reverse; }
.marquee:hover .marquee__track { animation-play-state: paused; }
.marquee__track span {
	font-family: var(--display);
	font-weight: 420;
	font-size: clamp(2.6rem, 9vw, 8rem);
	line-height: 1.05;
	letter-spacing: -.03em;
	color: var(--base);
	white-space: nowrap;
	padding-right: .55em;   /* spacing on the item (not flex gap) so the -50% loop is seamless */
}
.marquee__track span::after { content: " —"; color: #b9b69f; }
.marquee__track span.o {
	color: transparent;
	-webkit-text-stroke: 1.2px #1a1a14;
	font-style: italic;
	font-weight: 360;
}
@keyframes marquee { to { transform: translateX(-50%); } }

/* =====================================================================
   05 — CONTACT
   ===================================================================== */
.section--contact { background: var(--paper); padding-bottom: clamp(110px, 18vh, 240px); }
.contact__title {
	font-family: var(--display);
	font-weight: 400;
	font-size: clamp(2.6rem, 9vw, 8rem);
	line-height: .96;
	letter-spacing: -.035em;
}
.contact__title em { font-style: italic; font-weight: 340; }
.contact__note {
	margin-top: clamp(24px, 4vh, 44px);
	color: var(--mute);
	font-size: clamp(15px, 1.5vw, 18px);
}
.contact__reveal { margin-top: clamp(30px, 5vh, 54px); }

.reveal-btn {
	display: inline-flex;
	align-items: center;
	gap: 12px;
	background: none;
	border: 1px solid var(--line);
	color: var(--ink);
	font-family: var(--body);
	font-weight: 500;
	font-size: 15px;
	letter-spacing: .08em;
	text-transform: uppercase;
	padding: 16px 30px;
	border-radius: 999px;
	cursor: pointer;
	transition: border-color .5s var(--ease), background-color .5s var(--ease), color .5s var(--ease);
	will-change: transform;
}
.reveal-btn:hover { border-color: var(--accent); background: var(--ink); color: var(--paper); }

.email-link {
	display: inline-flex;
	flex-direction: column;
	gap: 4px;
	font-family: var(--display);
	font-weight: 400;
	font-style: italic;
	font-size: clamp(1.8rem, 5vw, 3.4rem);
	letter-spacing: -.01em;
	color: var(--ink);
}
.email-link svg { width: 100%; height: 8px; overflow: visible; }
.email-link path {
	fill: none;
	stroke: var(--accent);
	stroke-width: 1.4;
	stroke-dasharray: var(--len, 400);
	stroke-dashoffset: var(--len, 400);
	transition: stroke-dashoffset 1.1s var(--ease-soft);
}
.email-link.is-drawn path { stroke-dashoffset: 0; }
.email-link--static { text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 1px; }

/* =====================================================================
   FOOTER
   ===================================================================== */
.footer {
	max-width: var(--maxw);
	margin: 0 auto;
	padding: clamp(40px, 7vh, 90px) var(--pad) clamp(34px, 5vh, 60px);
	border-top: 1px solid var(--line);
	display: flex;
	flex-direction: column;
	gap: clamp(20px, 5vh, 48px);
}
.footer__row {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 20px;
	flex-wrap: wrap;
}
.footer__brand {
	font-family: var(--display);
	font-weight: 500;
	font-size: clamp(1.4rem, 3vw, 2.2rem);
}
.footer__loc, .footer__row--end span {
	font-size: 13px;
	letter-spacing: .14em;
	text-transform: uppercase;
	color: var(--mute);
}
.footer__motto {
	font-family: var(--display);
	font-style: italic;
	font-size: clamp(15px, 1.6vw, 19px);
	color: var(--accent);
}
.footer__legal {
	font-style: normal;
	font-size: 13px;
	line-height: 1.7;
	letter-spacing: .03em;
	color: var(--mute);
}

/* =====================================================================
   MOTION PRIMITIVES (IntersectionObserver-driven, universal)
   ===================================================================== */
/* All "hidden until revealed" states are gated behind .js so the page
   degrades to fully visible if JavaScript is unavailable. */
.js .reveal {
	opacity: 0;
	transform: translateY(26px);
	filter: blur(8px);
	transition: opacity .9s var(--ease), transform .9s var(--ease), filter .9s var(--ease);
	transition-delay: calc(var(--delay, 0) * 110ms);
}
.reveal.in-view { opacity: 1; transform: none; filter: none; }

.js .reveal-line {
	clip-path: inset(0 0 102% 0);
	transform: translateY(.28em);
	opacity: 0;
	transition: clip-path 1.05s var(--ease), transform 1.05s var(--ease), opacity 1.05s var(--ease);
}
.reveal-line.in-view { clip-path: inset(0 0 -12% 0); transform: none; opacity: 1; }

/* hero intro — sequenced rise (independent of the scroll observer) */
.js .hero-rise {
	opacity: 0;
	transform: translateY(20px);
	filter: blur(6px);
	transition: opacity .9s var(--ease), transform .9s var(--ease), filter .9s var(--ease);
	transition-delay: calc(var(--seq, 0) * 110ms + 220ms);
}
.hero.is-ready .hero-rise { opacity: 1; transform: none; filter: none; }

/* word-by-word (JS splits text into .w > span) */
.reveal-words .w {
	display: inline-block;
	overflow: hidden;
	vertical-align: top;
	padding-bottom: .12em;
	margin-bottom: -.12em;
}
.js .reveal-words .w > span {
	display: inline-block;
	transform: translateY(112%);
	transition: transform .9s var(--ease);
	transition-delay: calc(var(--i, 0) * 55ms);
}
.reveal-words.in-view .w > span { transform: translateY(0); }

/* hero title pre-split words */
.hero__title .w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .1em; margin-bottom: -.1em; }
.js .hero__title .w > span { display: inline-block; transform: translateY(115%); transition: transform 1s var(--ease); transition-delay: calc(var(--i, 0) * 90ms + 120ms); }
.hero.is-ready .hero__title .w > span { transform: translateY(0); }

/* =====================================================================
   RESPONSIVE
   ===================================================================== */
@media (max-width: 900px) {
	.nav__links { display: none; }
	.nav__toggle { display: block; }
	.nav { mix-blend-mode: normal; background: linear-gradient(180deg, rgba(0,0,0,.7), transparent); }

	.section { grid-template-columns: 1fr; gap: 26px; }
	.rail { flex-direction: row; align-items: baseline; gap: 14px; }
	.rail__label { position: static; }

	.plates { grid-template-columns: 1fr; gap: 30px; }
	.plate:nth-child(2), .plate:nth-child(3) { margin-top: 0; }
	.plate__media { aspect-ratio: 16 / 11; }
	.plate__overlay { opacity: 1; background: linear-gradient(0deg, rgba(0,0,0,.5), transparent 60%); align-items: flex-end; justify-content: flex-start; padding: 22px; }
	.plate__title { transform: none; font-size: 1.7rem; }
}

@media (max-width: 540px) {
	body { font-size: 16px; }
	.hero__cue { display: none; }
	.hero__title { line-height: .86; }
}

/* =====================================================================
   REDUCED MOTION — everything lands in its final, visible state
   ===================================================================== */
@media (prefers-reduced-motion: no-preference) {
	html { scroll-behavior: smooth; }
}
@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after {
		animation-duration: .001ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: .001ms !important;
	}
	.reveal, .reveal-line, .reveal-words .w > span, .hero__title .w > span, .hero-rise { opacity: 1 !important; transform: none !important; filter: none !important; clip-path: none !important; }
	.loader { display: none; }
	.hero__bg, .plate__layer, .cap__index { transform: none !important; }
	.marquee__track { animation: none !important; transform: none !important; }
	.divider { transform: scaleX(1) !important; }
	.loader__mark path, .email-link path { stroke-dashoffset: 0 !important; }
}
