/* ============================================================
   khaicreative.com — SINGLE PROJECT PAGE (single-portfolio.php)
   Desktop: project details stay fixed on the left, the project scrolls on the right.
   Phones / small tablets (900px and below): details on top, images underneath.
   ============================================================ */

.kp {
  --kn-bg: #201E1E;
  --kn-ink: #F2F0EB;
  --kn-muted: #A8A49C;
  --kn-blue: #1D59D9;
  --kn-line: rgba(242, 240, 235, .16);
  --kp-display: "Anton", Impact, sans-serif;
  --kp-body: "Archivo", system-ui, sans-serif;
  --kp-mono: "DM Mono", monospace;
  --kp-ease: cubic-bezier(.77, 0, .18, 1);
  --kp-g: clamp(20px, 3vw, 56px);
  --kp-top: 68px;                       /* header height at the top of the page (the script measures it) */
  --kp-stick: 68px;                     /* header height once you scroll (the script measures it) */
  --kp-gap: clamp(10px, 1.2vw, 18px);   /* space between images */
  display: grid;
  grid-template-columns: minmax(340px, 36%) minmax(0, 1fr);
  align-items: start;
  background: var(--kn-bg);
  color: var(--kn-ink);
  font-family: var(--kp-body);
  -webkit-font-smoothing: antialiased;
}
.kp *, .kp *::before, .kp *::after { box-sizing: border-box; }
.kp a { color: inherit; text-decoration: none; }
.kp img, .kp video { display: block; max-width: 100%; }

.kp-label {
  margin: 0;
  font: 400 clamp(11px, .9vw, 13px)/1.4 var(--kp-mono);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--kn-muted);
}

/* ---------- LEFT: project details (stays in place) ---------- */
.kp-info {
  position: sticky;
  top: var(--kp-stick);
  height: calc(100vh - var(--kp-stick));
  display: flex;
  flex-direction: column;
  padding: clamp(28px, 3.4vw, 52px) var(--kp-g) clamp(22px, 2.4vw, 36px);
  border-right: 1px solid var(--kn-line);
  overflow-y: auto;                    /* very short screens: the panel scrolls on its own */
  scrollbar-width: none;
}
.kp-info::-webkit-scrollbar { display: none; }

.kp-top { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.kp .kp-back { display: inline-flex; align-items: center; gap: 10px; color: var(--kn-ink); }
.kp-back svg { width: 14px; height: 14px; transition: transform .4s var(--kp-ease); }
.kp-back:hover svg { transform: translateX(-4px); }

.kp-title {
  margin: clamp(28px, 4vh, 56px) 0 0;
  margin-left: calc(.7px - .038em);
  font-family: var(--kp-display);
  font-weight: 400;
  font-size: clamp(44px, 4.8vw, 96px);
  line-height: .9;
  letter-spacing: -.005em;
  text-transform: uppercase;
  color: #fff;
}
.kp-title > span { display: block; overflow: hidden; padding-top: .06em; margin-top: -.06em; }
.kp-title b { display: block; font-weight: 400; transform: translateY(110%); animation: kp-up 1.1s var(--kp-ease) .2s forwards; }
.kp-title > span:nth-child(2) b { animation-delay: .3s; }
.kp-title > span:nth-child(3) b { animation-delay: .4s; }
.kp-title > span:nth-child(n+4) b { animation-delay: .5s; }
@keyframes kp-up { to { transform: none; } }

.kp-summary { margin: clamp(18px, 2.4vh, 28px) 0 0; max-width: 42ch; font-size: clamp(15px, 1.15vw, 18px); line-height: 1.5; color: var(--kn-ink); }

.kp-meta { margin: clamp(22px, 3vh, 36px) 0 0; padding: 0; border-top: 1px solid var(--kn-line); }
.kp-meta > div { display: grid; grid-template-columns: 110px 1fr; gap: 16px; align-items: baseline; padding: 12px 0; border-bottom: 1px solid var(--kn-line); }
.kp-meta dt { margin: 0; }
.kp-meta dd { margin: 0; font-size: 14px; line-height: 1.4; color: var(--kn-ink); }

.kp-actions { display: flex; gap: 20px; align-items: center; margin-top: clamp(20px, 2.6vh, 30px); }
.kp-actions .kn-btn svg { width: 11px; height: 11px; }

/* bottom of the panel: image counter + progress line */
.kp-foot { margin-top: auto; padding-top: clamp(24px, 3vh, 40px); }
.kp-progress { display: flex; align-items: center; gap: 14px; padding-top: 16px; border-top: 1px solid var(--kn-line); }
.kp-count { font: 400 12px/1 var(--kp-mono); letter-spacing: .06em; white-space: nowrap; color: rgba(242, 240, 235, .4); }
.kp-count b { font-weight: 400; color: var(--kn-ink); }
.kp-bar { position: relative; flex: 1; height: 1px; background: rgba(242, 240, 235, .25); overflow: hidden; }
.kp-bar i { position: absolute; inset: 0; background: var(--kn-blue); transform-origin: 0 50%; transform: scaleX(0); }

/* ---------- RIGHT: the project ---------- */
.kp-media { display: flex; flex-direction: column; gap: var(--kp-gap); padding: var(--kp-gap); min-height: 100vh; }
.kp-pair { display: grid; grid-template-columns: 1fr 1fr; gap: var(--kp-gap); }
.kp-fig { margin: 0; position: relative; overflow: hidden; background: #2A2727; }
.kp-fig img, .kp-fig video { width: 100%; height: auto; }
.kp-pair .kp-fig img { height: 100%; object-fit: cover; }   /* a pair always lines up, even if the two sizes differ a little */

/* curtain wipe as each image scrolls in */
.kp-fig::after { content: ""; position: absolute; inset: -1px; background: var(--kn-bg); transform-origin: 50% 0; transition: transform 1.2s var(--kp-ease); pointer-events: none; }
.kp-fig.is-in::after { transform: scaleY(0); }
.kp-fig img, .kp-fig video { transform: scale(1.06); transition: transform 1.6s var(--kp-ease); }
.kp-fig.is-in img, .kp-fig.is-in video { transform: none; }
/* no script = no wipe */
html:not(.kn-js) .kp-fig::after { display: none; }

/* ---------- Desktop: room for the fixed header ---------- */
@media (min-width: 901px) {
  .kp { padding-top: var(--kp-top); }
}

/* ---------- Phones + small tablets: stack ---------- */
@media (max-width: 900px) {
  .kp { grid-template-columns: minmax(0, 1fr); }
  .kp-info { position: static; height: auto; overflow: visible; border-right: 0; border-bottom: 1px solid var(--kn-line); padding-top: calc(var(--kp-top) + 32px); }
  .kp-foot { display: none; }
  .kp-title { font-size: clamp(44px, 13vw, 96px); }
  .kp-media { min-height: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .kp-title b { animation: none; transform: none; }
  .kp-fig::after { display: none; }
  .kp-fig img, .kp-fig video { transform: none; transition: none; }
}
