/* ============================================================
   KENG LEE® — PORTFOLIO V2 "EMBER"
   void / paper / ember — Syne + Inter + JetBrains Mono
   ============================================================ */

:root {
  --void: #0b0908;
  --coal: #17130f;
  --paper: #ede6db;
  --ember: #ff4d00;
  --smoke: #877d72;
  --hairline: rgba(237, 230, 219, 0.13);
  --pad: clamp(20px, 4vw, 60px);
  --display: 'Syne', 'Arial Black', sans-serif;
  --body: 'Inter', 'Helvetica Neue', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --ease: cubic-bezier(0.19, 1, 0.22, 1);
  --shot-h: clamp(320px, 58vh, 560px);
}

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

html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

body {
  background: var(--void);
  color: var(--paper);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

::selection { background: var(--ember); color: var(--void); }
::-webkit-scrollbar { width: 9px; }
::-webkit-scrollbar-track { background: var(--void); }
::-webkit-scrollbar-thumb { background: #2b241e; border-radius: 99px; }

a { color: inherit; text-decoration: none; }
ul { list-style: none; }
img, video { display: block; max-width: 100%; }
.mono { font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; }

a:focus-visible { outline: 2px solid var(--ember); outline-offset: 4px; }

/* split plumbing */
.char { display: inline-block; overflow: clip; vertical-align: top; }
.char > i { display: inline-block; font-style: normal; will-change: transform; }
.fill-char { transition: none; }

/* ============ LOADER ============ */
.loader { position: fixed; inset: 0; z-index: 999; display: grid; place-items: center; }
.loader__cols { position: absolute; inset: 0; display: flex; z-index: -1; }
.loader__cols span { flex: 1; background: var(--coal); }
.loader__word {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(44px, 9vw, 140px);
  letter-spacing: -0.02em; text-transform: uppercase;
  color: var(--paper);
}
.loader__meta {
  position: absolute; left: var(--pad); right: var(--pad); bottom: 28px;
  display: flex; justify-content: space-between;
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em;
  color: var(--smoke);
}
.loader__meta span:last-child { color: var(--ember); font-variant-numeric: tabular-nums; }

/* ============ CURSOR ============ */
.cursor {
  position: fixed; top: 0; left: 0; z-index: 998;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--paper);
  mix-blend-mode: difference;
  pointer-events: none;
  transform: translate(-50%, -50%);
  display: grid; place-items: center;
  transition: width 0.4s var(--ease), height 0.4s var(--ease);
}
.cursor--hover { width: 44px; height: 44px; }
.cursor--view { width: 96px; height: 96px; }
.cursor__label {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em;
  color: var(--void); opacity: 0;
}
.cursor--view .cursor__label { opacity: 1; }
@media (hover: none), (pointer: coarse) { .cursor { display: none; } }

/* ============ GRAIN + PROGRESS ============ */
.grain {
  position: fixed; inset: -100%; z-index: 900; pointer-events: none;
  width: 300%; height: 300%;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 220 220' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.72' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.05;
  animation: grain 0.7s steps(9) infinite;
}
@keyframes grain {
  0%, 100% { transform: translate(0, 0); }
  30% { transform: translate(-2.5%, 2%); }
  60% { transform: translate(2%, -3%); }
  85% { transform: translate(-3%, -2%); }
}
.progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 950; }
.progress span { display: block; height: 100%; width: 100%; background: var(--ember); transform: scaleX(0); transform-origin: left; }

/* ============ NAV ============ */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 940;
  display: flex; align-items: center; justify-content: space-between;
  padding: clamp(16px, 2.2vw, 26px) var(--pad);
  color: var(--paper);
  transition: color 0.45s ease;
}
.nav--dark { color: var(--void); }
.nav__brand { font-family: var(--display); font-weight: 800; font-size: 16px; letter-spacing: 0.01em; display: inline-block; }
.nav__brand span { color: var(--ember); transition: color 0.45s ease; }
.nav--dark .nav__brand span { color: var(--void); }
.nav__links { display: flex; gap: clamp(18px, 2.6vw, 40px); }
.nav__links a {
  position: relative; font-size: 13px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.14em; padding-bottom: 2px;
}
.nav__links a::after {
  content: ''; position: absolute; left: 0; bottom: 0; height: 1px; width: 100%;
  background: currentColor; transform: scaleX(0); transform-origin: right;
  transition: transform 0.4s var(--ease);
}
.nav__links a:hover::after { transform: scaleX(1); transform-origin: left; }
.nav__meta { display: flex; gap: 16px; opacity: 0.75; }
.nav__meta span:last-child { font-variant-numeric: tabular-nums; min-width: 72px; text-align: right; }

.kicker { color: var(--smoke); text-transform: uppercase; margin-bottom: clamp(22px, 4vh, 44px); }

/* ============ HERO ============ */
.hero { height: 200vh; }
.hero__pin { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: clip; }
.hero__eyebrow {
  position: absolute; top: clamp(70px, 10vh, 110px); left: var(--pad); z-index: 5;
  color: var(--smoke); text-transform: uppercase;
}
.hero__frame { position: absolute; inset: 0; display: grid; place-items: center; }
.hero__window {
  width: clamp(280px, 40vw, 620px);
  height: clamp(190px, 27vw, 420px);
  overflow: clip; border-radius: 4px;
  background: var(--coal);
}
.hero__window video { width: 100%; height: 100%; object-fit: cover; }
.hero__title {
  position: absolute; inset: 0; z-index: 4; pointer-events: none;
  font-family: var(--display); font-weight: 800;
  font-size: clamp(44px, 8.6vw, 158px);
  line-height: 0.86; letter-spacing: -0.035em; text-transform: uppercase;
  mix-blend-mode: difference; color: #fff;
}
.hero__word { position: absolute; white-space: nowrap; }
.hero__word--top { top: clamp(120px, 16vh, 200px); left: var(--pad); }
.hero__word--bottom { bottom: clamp(120px, 18vh, 210px); right: var(--pad); }
.hero__foot {
  position: absolute; left: var(--pad); right: var(--pad); bottom: clamp(24px, 5vh, 48px);
  z-index: 5; display: flex; justify-content: space-between; align-items: flex-end;
}
.hero__note { font-size: clamp(14px, 1.2vw, 17px); color: var(--paper); }
.hero__scroll { text-align: right; color: var(--smoke); line-height: 1.9; }

/* ============ MANIFESTO ============ */
.manifesto { padding: clamp(140px, 24vh, 280px) var(--pad); max-width: 1280px; }
.manifesto__text {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(28px, 4.4vw, 68px);
  line-height: 1.06; letter-spacing: -0.02em; text-transform: uppercase;
}
.manifesto__text .fill-char { color: rgba(237, 230, 219, 0.13); }
.manifesto__row { display: flex; justify-content: space-between; align-items: flex-end; gap: 40px; margin-top: clamp(30px, 6vh, 64px); }
.manifesto__sub { max-width: 44ch; color: var(--smoke); font-size: clamp(15px, 1.2vw, 17px); }
.manifesto__arrow { font-size: clamp(40px, 5vw, 80px); color: var(--ember); line-height: 1; }

/* ============ WORK — HORIZONTAL ============ */
.work { position: relative; }
.work__pin { position: relative; overflow: clip; }
.work__track {
  display: flex; align-items: center; height: 100vh; height: 100svh;
  gap: clamp(40px, 6vw, 110px);
  padding: 0 var(--pad);
  width: max-content; will-change: transform;
}
.panel { position: relative; flex-shrink: 0; }
.panel--intro { width: min(78vw, 900px); }
.panel__heading {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(58px, 10.5vw, 180px);
  line-height: 0.88; letter-spacing: -0.03em; text-transform: uppercase;
}
.panel__heading sup { font-size: 0.22em; color: var(--ember); letter-spacing: 0; vertical-align: 2.1em; }
.panel__years { margin-top: clamp(24px, 4vh, 44px); color: var(--smoke); line-height: 1.9; text-transform: uppercase; }

.panel[data-panel] { width: clamp(340px, 42vw, 640px); }
.panel__num {
  position: absolute; top: -0.52em; left: -0.06em;
  z-index: 2; pointer-events: none;
  font-family: var(--display); font-weight: 800;
  font-size: clamp(90px, 10.5vw, 190px); line-height: 1;
  color: transparent;
  -webkit-text-stroke: 2px var(--ember);
  text-shadow: 0 2px 24px rgba(11, 9, 8, 0.45);
}
.panel__card { position: relative; z-index: 1; display: block; }
.panel__media {
  position: relative;
  height: var(--shot-h);
  overflow: clip; border-radius: 4px; background: var(--coal);
}
/* outer layer: GSAP drives horizontal parallax here */
.panel__inner { width: 112%; margin-left: -6%; height: 100%; will-change: transform; }
/* inner layer: CSS pans the frame stack vertically on hover */
.panel__scroll {
  will-change: transform;
  transform: translateY(0);
  transition: transform 0.9s var(--ease);
}
.panel__scroll img {
  width: 100%; display: block;
  aspect-ratio: 1440 / 900; /* reserve height so the strip measures correctly */
  filter: saturate(0.94);
  transition: filter 0.5s ease;
}
.panel__card:hover .panel__scroll {
  transform: translateY(calc(-100% + var(--shot-h)));
  transition: transform 6s cubic-bezier(0.33, 0, 0.15, 1);
}
.panel__card:hover .panel__scroll img { filter: saturate(1.06); }
/* live-preview affordance */
.panel__media::after {
  content: 'LIVE SITE';
  position: absolute; right: 12px; top: 12px; z-index: 2;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em;
  padding: 5px 10px; border-radius: 99px;
  background: rgba(11, 9, 8, 0.62); color: var(--paper);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  opacity: 0; transition: opacity 0.4s ease;
}
.panel__card:hover .panel__media::after { opacity: 1; }
.panel__meta {
  display: flex; justify-content: space-between; align-items: baseline; gap: 18px;
  padding-top: 16px; border-top: 1px solid var(--hairline); margin-top: 14px;
}
.panel__meta h3 {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(22px, 2.4vw, 36px); letter-spacing: -0.01em;
  transition: color 0.4s ease;
}
.panel__card:hover .panel__meta h3 { color: var(--ember); }
.panel__meta p { color: var(--smoke); text-align: right; }

.work__hud {
  position: absolute; left: var(--pad); right: var(--pad); bottom: 26px;
  display: flex; align-items: center; gap: 22px;
  color: var(--smoke); font-variant-numeric: tabular-nums;
}
.work__line { flex: 1; height: 1px; background: var(--hairline); position: relative; }
.work__line i { position: absolute; inset: 0; background: var(--ember); transform: scaleX(0); transform-origin: left; }

/* ============ SERVICES — STACKING CARDS ============ */
.services { padding: clamp(140px, 22vh, 260px) var(--pad); border-top: 1px solid var(--hairline); }
.services__title {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(52px, 9.5vw, 160px);
  line-height: 0.9; letter-spacing: -0.03em; text-transform: uppercase;
  margin-bottom: clamp(50px, 9vh, 110px);
}
.services__stack { display: grid; gap: 22px; max-width: 1080px; margin: 0 auto; }
.scard {
  position: sticky;
  background: var(--coal);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  padding: clamp(26px, 3.6vw, 52px);
  will-change: transform;
}
.scard:nth-child(1) { top: calc(14vh + 0px); }
.scard:nth-child(2) { top: calc(14vh + 34px); }
.scard:nth-child(3) { top: calc(14vh + 68px); }
.scard:nth-child(4) { top: calc(14vh + 102px); }
.scard__head { display: flex; align-items: baseline; gap: clamp(16px, 2.4vw, 36px); margin-bottom: 14px; }
.scard__head .mono { color: var(--ember); }
.scard__head h3 {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(24px, 3vw, 46px); letter-spacing: -0.015em; flex: 1;
}
.scard__arrow { font-size: clamp(20px, 2.2vw, 32px); color: var(--smoke); transition: transform 0.4s var(--ease), color 0.4s ease; }
.scard:hover .scard__arrow { transform: translate(6px, -6px); color: var(--ember); }
.scard p { color: var(--smoke); max-width: 56ch; font-size: 15px; }

/* ============ ABOUT ============ */
.about {
  display: grid; grid-template-columns: 6fr 5fr;
  gap: clamp(40px, 7vw, 120px);
  padding: clamp(140px, 22vh, 260px) var(--pad);
  border-top: 1px solid var(--hairline);
}
.about__left { position: sticky; top: 14vh; align-self: start; }
.about__title {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(42px, 6vw, 108px);
  line-height: 0.9; letter-spacing: -0.03em; text-transform: uppercase;
  margin-bottom: clamp(26px, 5vh, 50px);
}
.about__bio { color: var(--smoke); font-size: clamp(15px, 1.3vw, 18px); max-width: 46ch; margin-bottom: clamp(30px, 6vh, 60px); }
.about__facts li {
  display: grid; grid-template-columns: 130px 1fr; gap: 18px;
  padding: 14px 0; border-top: 1px solid var(--hairline);
  text-transform: uppercase; color: var(--smoke);
  transition: color 0.35s ease, padding-left 0.35s var(--ease);
}
.about__facts li:last-child { border-bottom: 1px solid var(--hairline); }
.about__facts li:hover { color: var(--ember); padding-left: 8px; }
.about__facts li span:first-child { color: var(--paper); }
.about__facts li:hover span:first-child { color: var(--ember); }
.about__right { display: grid; gap: clamp(30px, 5vh, 60px); }
.about__img { position: relative; overflow: clip; border-radius: 4px; aspect-ratio: 3 / 4; background: var(--coal); }
.about__img img { width: 100%; height: 100%; object-fit: cover; will-change: transform; transform: scale(1.14); }
.about__img figcaption {
  position: absolute; left: 12px; bottom: 12px;
  padding: 6px 12px; border-radius: 99px;
  background: rgba(11, 9, 8, 0.6); color: var(--paper);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.about__img:nth-child(2) { margin-top: clamp(-10px, 4vh, 40px); }

/* ============ CONTACT — EMBER SLAB ============ */
.contact {
  position: relative;
  background: var(--ember); color: var(--void);
  padding: 0 var(--pad) 28px;
  overflow: clip;
}
.contact .kicker { color: rgba(11, 9, 8, 0.62); }
.contact__marquee {
  border-bottom: 1px solid rgba(11, 9, 8, 0.25);
  padding: clamp(14px, 2vh, 24px) 0;
  margin: 0 calc(-1 * var(--pad)) clamp(60px, 10vh, 120px);
  overflow: clip;
}
.contact__mtrack { display: flex; white-space: nowrap; will-change: transform; }
.contact__mtrack span {
  flex-shrink: 0;
  font-family: var(--display); font-weight: 800;
  font-size: clamp(28px, 4vw, 64px); text-transform: uppercase; letter-spacing: -0.01em;
  color: transparent; -webkit-text-stroke: 1.5px var(--void);
}
.contact__title {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(80px, 16vw, 300px);
  line-height: 0.84; letter-spacing: -0.03em; text-transform: uppercase;
  margin-bottom: clamp(40px, 8vh, 90px);
}
.contact__title > span { display: block; }
.contact__title sup { font-size: 0.18em; vertical-align: 2.4em; letter-spacing: 0; }
.contact__indent { margin-left: clamp(40px, 12vw, 260px); }
.contact__row {
  display: flex; justify-content: space-between; align-items: center; gap: 30px; flex-wrap: wrap;
  padding-bottom: clamp(70px, 12vh, 140px);
}
.contact__btn {
  display: inline-block;
  background: var(--void); color: var(--paper);
  font-size: clamp(15px, 1.5vw, 20px); font-weight: 500;
  padding: clamp(18px, 2.2vw, 26px) clamp(30px, 3.8vw, 54px);
  border-radius: 99px;
  transition: transform 0.4s var(--ease);
}
.contact__btn:hover { transform: scale(1.04); }
.contact__socials { display: flex; gap: clamp(18px, 3vw, 40px); }
.contact__socials a {
  position: relative; color: rgba(11, 9, 8, 0.72); letter-spacing: 0.12em;
  transition: color 0.3s ease;
}
.contact__socials a:hover { color: var(--void); }
.footer {
  display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  padding-top: 22px; border-top: 1px solid rgba(11, 9, 8, 0.3);
  color: rgba(11, 9, 8, 0.72); text-transform: uppercase;
}
.footer a:hover { color: var(--void); }
#footClock { font-variant-numeric: tabular-nums; }

/* ============ RESPONSIVE ============ */
@media (max-width: 900px) {
  .work__track { flex-direction: column; height: auto; width: auto; align-items: stretch; gap: 70px; padding: 0 var(--pad) 90px; }
  .panel--intro, .panel[data-panel] { width: auto; }
  .panel__media { height: auto; aspect-ratio: 16 / 10; }
  .panel__inner { width: 100%; margin-left: 0; }
  .panel__num { display: none; }
  .work__hud { display: none; }
  .about { grid-template-columns: 1fr; }
  .about__left { position: static; }
  .hero__word--top { left: var(--pad); }
  .hero__word--bottom { right: var(--pad); }
}
@media (max-width: 720px) {
  .nav__links { display: none; }
  .hero__title { font-size: clamp(24px, 8.4vw, 44px); }
  .hero__word--top { top: clamp(100px, 14vh, 160px); }
  .hero__word--bottom { bottom: clamp(210px, 30vh, 280px); }
  .hero__foot { flex-direction: column; align-items: flex-start; gap: 16px; }
  .hero__scroll { text-align: left; }
  .manifesto__arrow { display: none; }
  .contact__title { font-size: clamp(48px, 14vw, 72px); }
  .contact__indent { margin-left: clamp(24px, 8vw, 60px); }
  .contact__row { flex-direction: column; align-items: flex-start; }
  .footer { justify-content: flex-start; }
  .about__facts li { grid-template-columns: 96px 1fr; }
}

/* ============ REDUCED MOTION ============ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .grain { display: none; }
  .manifesto__text .fill-char { color: var(--paper); }
  .hero { height: auto; }
  .hero__pin { position: static; }
}
