/* ============================================================
   khaicreative.com — HOME PAGE (v2)
   Loaded on the front page only, after style.css.
   Classes use the kh- prefix so they never clash with the
   older kn- sections still used on the About and Work pages.

   SECTIONS
   01. Home tokens + shared pieces
   (02. the preloader now lives in style.css, it runs on every page)
   03. Hero
   04. Hello
   05. Featured Work (marquee + carousel)
   06. Services
   07. Responsive
   08. Reveal animations
   ============================================================ */


/* ============================================================
   01. HOME TOKENS + SHARED PIECES
   ============================================================ */
:root {
  --kh-hero: #333333;          /* hero backdrop */
  --kh-dark: #201E1E;          /* Featured Work section */
  --kh-paper: #FFFFFF;         /* Hello + Services sections */
  --kh-ink-dark: #201E1E;      /* text on white */
  --kh-rule: #C4C4C4;          /* lines on white */
  --kh-gutter: clamp(20px, 3vw, 56px);
}
.kh-page { background: var(--kh-dark); }
.kh-page *, .kh-page *::before, .kh-page *::after { box-sizing: border-box; }
.kh-page img { display: block; max-width: 100%; }
.kh-page a, .kh-page a:hover, .kh-page a:focus, .kh-page a:visited { color: inherit; text-decoration: none; }
.kh-page button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

.kh-label {
  margin: 0;
  font-family: var(--kn-font-mono);
  font-size: clamp(11px, .95vw, 14px);
  line-height: 1.4;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.kh-h {
  margin: 0;
  font-family: var(--kn-font-body);
  font-weight: 600;
  font-stretch: 108%;
  text-transform: uppercase;
  letter-spacing: -.01em;
  line-height: .95;
}
.kh-actions { display: flex; align-items: center; flex-wrap: wrap; gap: clamp(16px, 2vw, 28px); }

/* white sections: blue labels + buttons */
.kh-light { background: var(--kh-paper); color: var(--kh-ink-dark); }
.kh-light .kh-label { color: var(--kn-blue); }
.kh-light .kn-btn, .kh-light .kn-txt, .kh-light a.kn-btn, .kh-light a.kn-txt { color: var(--kn-blue); }
/* rounded buttons on white: solid blue at rest; on hover a white fill pushes up from the bottom, leaving a blue outline */
.kh-light .kn-btn, .kh-light a.kn-btn { background: var(--kn-blue); border-color: var(--kn-blue); color: #fff; --btn-fill: #fff; --btn-on: var(--kn-blue); }
.kh-light .kn-btn:hover, .kh-light .kn-btn:focus-visible { color: var(--kn-blue); border-color: var(--kn-blue); }

/* dark sections: cream buttons */
.kh-dark .kn-btn { color: var(--kn-ink); border-color: rgba(242, 240, 235, .55); --btn-fill: var(--kn-ink); --btn-on: #201E1E; }
.kh-dark .kn-btn:hover, .kh-dark .kn-btn:focus-visible { color: #201E1E; border-color: var(--kn-ink); }
.kh-dark .kn-txt { color: var(--kn-ink); }


/* ============================================================
   03. HERO
   ============================================================ */
.kh-hero {
  position: relative;
  min-height: max(640px, 100svh);
  overflow: hidden;
  isolation: isolate;
  background: var(--kh-hero);
  color: #fff;
}
/* photo layer: full-bleed, shown as-is (no fade or darkening) */
.kh-hero__photo { position: absolute; inset: 0; z-index: -2; overflow: hidden; }
.kh-hero__frame { position: absolute; inset: 0; }
.kh-hero__frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;   /* move the crop here, e.g. 50% 30% shows more of the top */
}
.kh-hero__inner {
  position: relative;
  min-height: inherit;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, .48fr);
  grid-template-rows: auto 1fr auto;
  column-gap: clamp(24px, 4vw, 64px);
  padding: calc(84px + clamp(40px, 6.5vw, 110px)) var(--kh-gutter) clamp(28px, 4.2vw, 64px);
}
.kh-hero__eyebrow {
  grid-column: 1 / -1;
  margin-bottom: clamp(8px, 1vw, 16px);
  font-size: clamp(10px, .85vw, 12px);
  letter-spacing: .28em;
  color: rgba(242, 240, 235, .8);
}
.kh-hero__name {
  grid-column: 1;
  grid-row: 2;
  align-self: start;
  margin: 0;
  font-family: var(--kn-font-display);
  font-weight: 400;
  font-size: clamp(84px, 16.4vw, 330px);
  line-height: .88;
  letter-spacing: -.005em;
  text-transform: uppercase;
  color: #fff;
}
/* Anton's K and N start a hair to the right of their box; pull the name left so its
   edge lines up exactly with "Portfolio Vol. 26" and "Scroll to Explore" */
.kh-hero__name .kh-mask { margin-left: calc(.7px - .038em); }
.kh-hero__intro {
  grid-column: 2;
  grid-row: 2;
  align-self: start;
  max-width: 34ch;
  margin: -.33em 0 0;          /* lifts the first line so its letters line up with the top of KHAI */
  font-size: clamp(15px, 1.3vw, 21px);
  font-weight: 400;
  line-height: 1.5;
  color: #fff;
}
.kh-hero__foot {
  grid-column: 1 / -1;
  grid-row: 3;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: end;
  margin-top: clamp(32px, 5vw, 80px);
}
/* the 3 bottom links: two lines of text + an arrow; bottoms line up, the middle one is centered on the page */
.kh-page .kh-hero__foot a {
  display: inline-flex;
  align-items: flex-end;
  gap: .55em;
  width: max-content;
  padding-bottom: 3px;
  font-size: clamp(13px, 1.15vw, 18px);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(currentColor, currentColor) no-repeat 100% 100% / 0 1px;
  transition: background-size .5s var(--kn-ease), color .35s ease;
}
.kh-lk__txt span { display: block; }
.kh-hero__foot svg { flex: none; width: 1em; height: 1em; margin-bottom: .08em; transition: transform .45s var(--kn-ease); }
.kh-page .kh-hero__foot a:hover, .kh-page .kh-hero__foot a:focus-visible { color: var(--kn-blue); background-size: 100% 1px; background-position: 0 100%; }
.kh-lk--down:hover svg  { transform: translateY(3px); }
.kh-lk--up:hover svg    { transform: translate(2px, -2px); }
.kh-lk--right:hover svg { transform: translateX(3px); }
.kh-hero__foot a:nth-child(1) { justify-self: start; }
.kh-hero__foot a:nth-child(2) { justify-self: center; }
.kh-hero__foot a:nth-child(3) { justify-self: end; }
/* hover: each line flips up on its own and the same words roll in from below in blue
   (the blue copy is a text-shadow one line below; line 2 follows a beat after line 1) */
.kh-page .kh-hero__foot .kh-lk__txt span { overflow: hidden; color: #fff; }
.kh-page .kh-hero__foot .kh-lk__txt i { display: block; font-style: normal; text-shadow: 0 1.15em var(--kn-blue); transition: transform .6s var(--kn-ease); }
.kh-page .kh-hero__foot .kh-lk__txt span + span i { transition-delay: .07s; }
.kh-page .kh-hero__foot a:hover .kh-lk__txt i,
.kh-page .kh-hero__foot a:focus-visible .kh-lk__txt i { transform: translateY(-1.15em); }
@media (prefers-reduced-motion: reduce) {
  .kh-page .kh-hero__foot .kh-lk__txt span { color: inherit; }
  .kh-page .kh-hero__foot .kh-lk__txt i { text-shadow: none; transition: none; transform: none !important; }
}


/* ============================================================
   04. HELLO
   ============================================================ */
.kh-hello { padding: clamp(56px, 5.5vw, 96px) var(--kh-gutter) clamp(96px, 11vw, 200px); }
.kh-hello__body { max-width: 980px; margin-left: 38%; }
.kh-hello__text {
  margin: 14px 0 clamp(28px, 3.4vw, 52px);
  font-size: clamp(21px, 2.3vw, 40px);
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: -.012em;
  color: var(--kh-ink-dark);
}


/* ============================================================
   05. FEATURED WORK — marquee + carousel
   ============================================================ */
.kh-work {
  --kh-card-w: clamp(280px, 38vw, 580px);   /* card width */
  --kh-gap: clamp(16px, 2vw, 28px);
  overflow: hidden;
  padding: clamp(28px, 3.4vw, 52px) 0 clamp(48px, 4.8vw, 80px);
  background: var(--kh-dark);
  color: var(--kn-ink);
}
.kh-work > .kh-label { padding: 0 var(--kh-gutter); color: rgba(242, 240, 235, .8); }

/* marquee headline: two identical groups; the strip slides left by one group, then loops */
.kh-work__title {
  position: relative;
  margin: clamp(14px, 1.8vw, 28px) 0 clamp(30px, 4.4vw, 64px);
  padding-top: .02em;
  font-size: 10.5vw;
  line-height: .86;
  letter-spacing: -.025em;
  white-space: nowrap;
  color: #fff;
}
.kh-work__title::before, .kh-work__title::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--kn-line);
  transform-origin: 0 50%;
  transition: transform 1.4s var(--kn-ease);
}
.kh-work__title::before { top: 0; }
.kh-work__title::after { bottom: 0; }
.kh-marquee { display: flex; width: max-content; animation: kh-marquee var(--kh-marquee-speed, 32s) linear infinite; }
.kh-work__title:hover .kh-marquee { animation-play-state: paused; }
.kh-marquee__group { display: flex; flex: none; align-items: center; }
.kh-marquee__item { padding: 0 .28em; }
.kh-marquee__star { flex: none; width: .32em; height: .32em; margin: 0 .1em; fill: var(--kn-blue); }
@keyframes kh-marquee { to { transform: translateX(-50%); } }

/* carousel track */
.kh-work__track {
  display: flex;
  gap: var(--kh-gap);
  margin: 0;
  padding: 0 var(--kh-gutter);
  list-style: none;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--kh-gutter);
  scroll-behavior: smooth;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.kh-work__track::-webkit-scrollbar { display: none; }
@media (hover: hover) and (pointer: fine) { .kh-work__track { cursor: grab; } }
.kh-work__track.is-dragging { cursor: grabbing; scroll-snap-type: none; scroll-behavior: auto; user-select: none; }
.kh-work__track.is-dragging .kh-card { pointer-events: none; }
.kh-work__track img { -webkit-user-drag: none; user-select: none; }

/* card */
.kh-card {
  position: relative;
  flex: 0 0 var(--kh-card-w);
  aspect-ratio: .8;
  overflow: hidden;
  isolation: isolate;
  scroll-snap-align: start;
  background: #2A2727;
  color: #fff;
}
.kh-card img {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 0;
  transition: transform 1.2s var(--kn-ease);
}
/* overlay: a slight gradient all the time (heavier at the bottom), and a darker wash on hover */
.kh-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(32, 30, 30, .08) 0%, rgba(32, 30, 30, .18) 45%, rgba(32, 30, 30, .72) 100%);
}
.kh-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: rgba(32, 30, 30, .38);       /* hover darkness */
  opacity: 0;
  transition: opacity .6s var(--kn-ease);
}
.kh-card:hover::before, .kh-card:focus-visible::before { opacity: 1; }
.kh-card:hover img { transform: scale(1.04); }
.kh-card__meta { position: absolute; left: 8%; right: 8%; bottom: clamp(24px, 3.4vw, 56px); }
.kh-card__num { display: block; margin-bottom: clamp(8px, .9vw, 14px); font-family: var(--kn-font-mono); font-size: 12px; letter-spacing: .08em; }
.kh-card__row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.kh-card__title { font-size: clamp(24px, 2.9vw, 48px); line-height: 1; color: #fff; }
.kh-card__row svg { width: clamp(20px, 2.3vw, 38px); height: auto; flex: none; transition: transform .5s var(--kn-ease); }
.kh-card:hover .kh-card__row svg { transform: translate(4px, -4px); }

/* controls */
.kh-work__ctrl { display: flex; align-items: center; gap: clamp(12px, 1.6vw, 24px); margin-top: clamp(18px, 2.4vw, 32px); padding: 0 var(--kh-gutter); }
.kh-work__count { font-family: var(--kn-font-mono); font-size: 12px; letter-spacing: .06em; white-space: nowrap; color: rgba(242, 240, 235, .35); }
.kh-work__count b { font-weight: 400; color: var(--kn-ink); }
.kh-work__bar { position: relative; flex: 1; height: 1px; overflow: hidden; background: rgba(242, 240, 235, .3); }
.kh-work__bar i { position: absolute; inset: 0 auto 0 0; width: 25%; height: 1px; background: var(--kn-blue); transition: transform .4s cubic-bezier(.2, .7, .1, 1), width .4s; }
.kh-work__nav { display: flex; gap: 6px; }
.kh-work__nav button {
  display: grid;
  place-items: center;
  width: clamp(30px, 2.6vw, 40px);
  height: clamp(30px, 2.6vw, 40px);
  border: 1px solid rgba(242, 240, 235, .7);
  border-radius: 50%;
  transition: background-color .3s, color .3s;
}
.kh-work__nav button:hover { background: var(--kn-ink); color: #201E1E; }
.kh-work__nav button:disabled { opacity: .3; pointer-events: none; }
.kh-work__nav svg { width: 13px; height: 13px; }
.kh-work > .kh-actions { margin-top: clamp(22px, 2.6vw, 40px); padding: 0 var(--kh-gutter); }


/* ============================================================
   06. SERVICES
   ============================================================ */
.kh-svc { padding: clamp(56px, 7.5vw, 128px) var(--kh-gutter) clamp(72px, 8vw, 140px); }
.kh-svc__wrap { max-width: 1060px; margin: 0 auto; }   /* centered on the page */
.kh-svc__title { margin: 10px 0 clamp(4px, .6vw, 10px); font-size: clamp(30px, 4.3vw, 74px); color: var(--kh-ink-dark); }
.kh-svc__list { margin: 0 0 clamp(28px, 3.4vw, 52px); padding: 0; list-style: none; }
.kh-page .kh-svc__list a {
  position: relative;
  display: grid;
  grid-template-columns: clamp(54px, 9.2vw, 160px) 1fr auto;
  align-items: center;
  padding: clamp(16px, 2.2vw, 34px) 0;
  color: var(--kh-ink-dark);
  transition: padding-left .5s var(--kn-ease);
}
.kh-svc__list a::after {        /* the dividing line (it draws in on scroll) */
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--kh-rule);
  transform-origin: 0 50%;
  transition: transform 1.2s var(--kn-ease) var(--d, 0s);
}
.kh-svc__num { font-family: var(--kn-font-mono); font-size: clamp(18px, 2.6vw, 44px); line-height: 1; letter-spacing: -.02em; }
.kh-svc__name { font-family: var(--kn-font-body); font-weight: 500; font-stretch: 110%; font-size: clamp(17px, 2.55vw, 43px); line-height: 1.05; letter-spacing: -.005em; text-transform: uppercase; transition: color .3s; }
.kh-svc__list svg { width: clamp(18px, 2.5vw, 40px); height: auto; transition: transform .5s var(--kn-ease), color .3s; }
.kh-page .kh-svc__list a:hover { padding-left: 10px; }
.kh-svc__list a:hover svg { transform: translate(4px, -4px); color: var(--kn-blue); }
.kh-svc__list a:hover .kh-svc__name { color: var(--kn-blue); }
/* hover: a blue line wipes in over the bottom border (left to right), and wipes out to the right on leave. No indent. */
.kh-svc__list a::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  height: 1px;
  background: var(--kn-blue);
  transform: scaleX(0);
  transform-origin: 100% 50%;
  transition: transform .6s var(--kn-ease);
}
.kh-svc__list a:hover::before, .kh-svc__list a:focus-visible::before { transform: scaleX(1); transform-origin: 0 50%; }
.kh-page .kh-svc__list a:hover { padding-left: 0; }
/* hover: the service name flips up and the same words roll in from below in blue (works on 1 or 2 lines) */
.kh-roll { position: relative; display: block; overflow: hidden; margin: -.08em 0; }
.kh-roll__a, .kh-roll__b { display: block; padding: .08em 0; transition: transform .6s var(--kn-ease); }
.kh-roll__a { color: var(--kh-ink-dark); }
.kh-roll__b { position: absolute; left: 0; top: 0; width: 100%; color: var(--kn-blue); transform: translateY(100%); }
.kh-svc__list a:hover .kh-roll__a, .kh-svc__list a:focus-visible .kh-roll__a { transform: translateY(-100%); }
.kh-svc__list a:hover .kh-roll__b, .kh-svc__list a:focus-visible .kh-roll__b { transform: translateY(0); }
@media (prefers-reduced-motion: reduce) {
  .kh-roll__a, .kh-roll__b { transition: none; }
}


/* ============================================================
   07. RESPONSIVE
   ============================================================ */
@media (max-width: 760px) {
  .kh-work { --kh-card-w: 78vw; }
  .kh-hero__inner { grid-template-columns: 1fr; grid-template-rows: auto auto 1fr auto; padding-top: calc(68px + 40px); }
  .kh-hero__name { font-size: 27vw; }
  .kh-hero__intro { grid-column: 1; grid-row: 3; align-self: end; max-width: 30ch; margin: 28px 0 0; }
  .kh-hero__foot { grid-row: 4; margin-top: 28px; }
  .kh-hello__body { margin-left: 0; }
  .kh-work__title { font-size: 10.2vw; }
}


/* ============================================================
   08. REVEAL ANIMATIONS
   Hidden starting states only apply while JavaScript is running
   (html.kn-js), so the page still shows everything if scripts fail.
   ============================================================ */
.kh-mask { display: block; overflow: hidden; padding-top: .06em; margin-top: -.06em; }
.kh-word { display: block; }

@keyframes kh-curtain-mask { from { clip-path: inset(100% 0 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes kh-curtain-img { from { transform: translateY(12%) scale(1.06); } to { transform: none; } }
@keyframes kh-slide-up { from { transform: translateY(130%); } to { transform: none; } }
@keyframes kh-fade-up { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }

/* hero: photo curtain, name slides up, details fade in */
.kn-js .kh-hero.kn-wait .kh-hero__photo { clip-path: inset(100% 0 0 0); }
.kn-js .kh-hero.kn-wait .kh-word, .kn-js .kh-hero.kn-wait .kh-hero__fade { opacity: 0; }
.kh-hero.kn-go .kh-hero__photo { animation: kh-curtain-mask 1.3s var(--kn-ease) both; }
.kh-hero.kn-go .kh-hero__frame img { animation: kh-curtain-img 1.6s var(--kn-ease) both; }
.kh-hero.kn-go .kh-word { animation: kh-slide-up 1.1s var(--kn-ease) both; }
.kh-hero.kn-go .kh-word--1 { animation-delay: .25s; }
.kh-hero.kn-go .kh-word--2 { animation-delay: .4s; }
.kh-hero.kn-go .kh-hero__fade { animation: kh-fade-up .9s var(--kn-ease) var(--d, 0s) both; }

/* scroll reveals: data-kn="up | mask | rule | curtain | row" and data-kn-lines */
.kn-js .kh-page [data-kn="up"], .kn-js .kh-page [data-kn="row"] {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 1s var(--kn-ease) var(--d, 0s), transform 1s var(--kn-ease) var(--d, 0s);
}
.kn-js .kh-page [data-kn].is-in { opacity: 1; transform: none; }
.kn-js .kh-page [data-kn="mask"] .kh-word, .kn-js .kh-page [data-kn="rule"] .kh-word { transform: translateY(110%); transition: transform 1.1s var(--kn-ease) .1s; }
.kn-js .kh-page [data-kn].is-in .kh-word { transform: none; }
.kn-js .kh-page [data-kn="rule"]::before, .kn-js .kh-page [data-kn="rule"]::after, .kn-js .kh-page [data-kn="row"] a::after { transform: scaleX(0); }
.kn-js .kh-page [data-kn="rule"].is-in::before, .kn-js .kh-page [data-kn="rule"].is-in::after, .kn-js .kh-page [data-kn="row"].is-in a::after { transform: none; }
.kn-js .kh-work__title:not(.is-in) .kh-marquee { animation-play-state: paused; }   /* starts on "Featured Work" once in view */

.kn-js .kh-page [data-kn="curtain"] { clip-path: inset(100% 0 0 0); transition: clip-path 1.3s var(--kn-ease) var(--d, 0s); }
.kn-js .kh-page [data-kn="curtain"] img { transform: translateY(10%) scale(1.08); }
.kn-js .kh-page [data-kn="curtain"] .kh-card__meta { opacity: 0; transform: translateY(20px); transition: opacity .9s var(--kn-ease) calc(var(--d, 0s) + .55s), transform .9s var(--kn-ease) calc(var(--d, 0s) + .55s); }
.kn-js .kh-page [data-kn="curtain"].is-in { clip-path: inset(0 0 0 0); }
.kn-js .kh-page [data-kn="curtain"].is-in img { transform: none; transition: transform 1.6s var(--kn-ease) var(--d, 0s); }
.kn-js .kh-page [data-kn="curtain"].is-in:hover img { transform: scale(1.04); transition-delay: 0s; }
.kn-js .kh-page [data-kn="curtain"].is-in .kh-card__meta { opacity: 1; transform: none; }

/* Hello paragraph: rises line by line, then each word darkens as you scroll (words are wrapped by kn-home.js) */
.kh-w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .12em; margin-bottom: -.12em; }
.kh-w > span { display: inline-block; }
.kn-js [data-kn-lines] .kh-w > span { transform: translateY(105%); transition: transform 1s var(--kn-ease) var(--d, 0s), color .35s ease; }
.kn-js [data-kn-lines].is-in .kh-w > span { transform: none; }
.kn-js [data-kn-highlight] .kh-w > span { color: var(--kh-hl-off, #C9C9C9); }   /* start color */
.kn-js [data-kn-highlight] .kh-w.is-lit > span { color: var(--kh-hl-on, #201E1E); } /* end color */

@media (prefers-reduced-motion: reduce) {
  .kh-marquee { animation: none; }
  .kn-js .kh-hero.kn-wait .kh-hero__photo, .kn-js .kh-page [data-kn="curtain"] { clip-path: none; }
  .kn-js .kh-hero.kn-wait .kh-word, .kn-js .kh-hero.kn-wait .kh-hero__fade,
  .kn-js .kh-page [data-kn], .kn-js .kh-page [data-kn] .kh-word, .kn-js .kh-page [data-kn] img,
  .kn-js .kh-page [data-kn] .kh-card__meta, .kn-js [data-kn-lines] .kh-w > span { opacity: 1 !important; transform: none !important; }
  .kn-js .kh-page [data-kn]::before, .kn-js .kh-page [data-kn]::after, .kn-js .kh-page [data-kn] a::after { transform: none !important; }
  .kh-page *, .kh-page *::before, .kh-page *::after { transition: none !important; animation: none !important; }
}