/* ==========================================================================
   Brand identity case study: Kalpnk. Imagination, resolved.
   ========================================================================== */
.kp { --k: #0a0a0a; --w: #e5e4e2; --g: #536879; --f-display: "Inter", ui-sans-serif, system-ui, sans-serif; --f-text: "Inter", ui-sans-serif, system-ui, sans-serif; font-family: var(--f-text); }
.kp-h { margin: 0; font: 500 clamp(1.8rem, 1.3rem + 1.5vw, 2.8rem)/1.1 var(--f-display); letter-spacing: -0.025em; color: #fff; }
.kp-h--ink { color: var(--k); }

/* ---------- The gate ---------- */
.kp-film .st-reel__stage { background: var(--k); color: #fff; }
.kp-strip { position: absolute; inset: 0; will-change: transform; }
.kp-frame { position: absolute; left: 0; width: 100%; height: 100%; margin: 0; overflow: hidden; }
.kp-frame:nth-child(2) { top: calc(100% + 14px); }
.kp-frame img { display: block; max-width: none; will-change: transform; }
.kp-frame::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0.4) 42%, transparent 70%); opacity: var(--shade, 0); }
.kp-frame--b { --shade: 1; }
.kp-dark { position: absolute; left: -160vmax; top: -160vmax; width: 320vmax; height: 320vmax; -webkit-mask-image: radial-gradient(closest-side, transparent 3.4%, #000 13.75%); mask-image: radial-gradient(closest-side, transparent 3.4%, #000 13.75%); will-change: transform; }
/* the brand's grey gradient (Figma, "Gradient 03"), held still against the stage while the mask around it moves (st-kalpnk.js); the shade at the top keeps the nav and the meta row readable */
.kp-dark__g { position: absolute; left: 50%; top: 50%; width: 100%; height: 100%; transform-origin: 0 0; background: linear-gradient(180deg, rgba(10, 10, 10, 0.62), transparent 26%), url(../media/portfolio/Branding/Kalpnk/kalpnk-gradient.webp) center / cover; will-change: transform; }
.kp-logo { --lw: min(46vw, 760px); position: absolute; left: 50%; top: 44%; width: var(--lw); aspect-ratio: 847 / 350; translate: -50% -50%; fill: #fff; pointer-events: none; }
.kp-logo svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.kp-logo--tile { --lw: 58%; position: relative; left: auto; top: auto; translate: none; fill: var(--k); }
.kp-hero { position: absolute; inset: 0; }
.kp-hero__in { display: grid; grid-template-rows: auto 1fr; height: 100%; padding-top: calc(var(--nav-h) + 28px); padding-bottom: clamp(32px, 6vh, 64px); }
.kp-hero h1 { align-self: end; margin: 0; max-width: 34em; font: 400 clamp(1.15rem, 0.9rem + 0.8vw, 1.6rem)/1.3 var(--f-display); letter-spacing: -0.015em; color: #fff; }
.kp-say { position: absolute; inset: 0; display: grid; align-content: center; gap: 16px; opacity: 0; visibility: hidden; color: #fff; }
.kp-say p { margin: 0; max-width: 32em; font-size: 19px; line-height: 1.5; color: rgba(255, 255, 255, 0.92); text-shadow: 0 1px 24px rgba(0, 0, 0, 0.45); }
.kp-say--two { gap: clamp(28px, 5vh, 56px); }
.kp-say--two > div { display: grid; gap: 14px; }

/* ---------- The tradeoff ---------- */
.kp-trade__in { display: grid; align-content: center; height: 100%; gap: clamp(36px, 6vh, 72px); color: var(--k); }
.kp-trade__say { margin: 0; max-width: 21em; font: 400 clamp(2.4rem, 1rem + 3.8vw, 4.6rem)/1.14 var(--f-display); letter-spacing: -0.035em; }
.kp-trade__say em { position: relative; font-style: normal; }
.kp-trade__say em::after { content: ""; position: absolute; left: 0; right: 0; bottom: -0.04em; height: 3px; background: var(--g); transform: scaleX(var(--u, 0)); transform-origin: 0 50%; }

/* ---------- The personality ---------- */
.kp-person__copy { position: absolute; left: 0; right: 0; top: calc(var(--nav-h) + 16px); display: grid; gap: 14px; }
.kp-person__copy p { margin: 0; max-width: 21em; font-size: 19px; line-height: 1.4; color: rgba(255, 255, 255, 0.9); }
.kp-person__after { position: absolute; right: var(--gutter); bottom: clamp(44px, 8vh, 80px); width: min(30vw, 440px); margin: 0; font-size: 18px; line-height: 1.45; color: rgba(255, 255, 255, 0.9); }

/* ---------- The work, resolving ---------- */
.kp-gen { position: relative; padding-block: 14vh; overflow: clip; background: var(--k); }
.kp-gen__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(16px, 2vw, 32px); align-items: start; }
.kp-gen__col { display: grid; gap: clamp(16px, 2vw, 32px); will-change: transform; }
.kp-gen__col:nth-child(2) { margin-top: 14vh; }
.kp-gen figure { position: relative; margin: 0; }
.kp-gen img { display: block; width: 100%; height: auto; }
.kp-gen canvas { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; }
.kp-gen figure.is-busy img { visibility: hidden; }
.kp-gen figure:not(.is-busy) canvas { display: none; }
@media (min-width: 901px) and (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    @keyframes kp-col { from { transform: translateY(calc(var(--d) * 1vh)); } to { transform: translateY(calc(var(--d) * -1vh)); } }
    .kp-gen__col { --d: 3; animation: kp-col auto linear both; animation-timeline: view(); }
    .kp-gen__col:nth-child(2) { --d: 9; }
  }
}

/* ---------- The mark ---------- */
.kp-mark__grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 12px; }
.kp-mark__grid > div:first-child { grid-column: 1 / -1; display: grid; gap: 16px; margin-bottom: clamp(24px, 3vw, 44px); }
.kp-lead { margin: 0; max-width: 44em; font-size: 20px; line-height: 1.5; color: #3b3b3b; }
.kp-tile { position: relative; display: grid; place-items: center; min-height: clamp(280px, 28vw, 420px); margin: 0; border: 1px solid #1a1a1a; }
.kp-tile figcaption { position: absolute; left: 18px; top: 14px; font-size: 14px; color: var(--k); }
.kp-tile > svg { height: 46%; width: auto; fill: var(--k); }

/* ---------- The colours and type ---------- */
.kp-cols__row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kp-cols__row button { position: relative; display: grid; grid-template-rows: 1fr auto auto auto; gap: 8px; padding-bottom: 22px; min-height: clamp(320px, 30vw, 440px); background: var(--c); color: var(--t); text-align: left; font: 400 15px/1.2 var(--f-text); cursor: pointer; overflow: hidden; }
.kp-cols__row b { grid-row: 2; margin: 14px 22px 0; font-size: 20px; font-weight: 500; }
.kp-cols__row span { grid-row: 3; margin: 0 22px; opacity: 0.74; }
.kp-cols__row em { grid-row: 4; margin: 0 22px; font-style: normal; font-size: 18px; }
.kp-type { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 12px; }
.kp-type figure { display: grid; gap: 22px; align-content: start; margin: 0; padding: clamp(24px, 3vw, 44px); min-height: clamp(280px, 26vw, 380px); }
.kp-type figcaption { font-size: 15px; }
.kp-type p { margin: 0; max-width: 28em; font-size: 16px; line-height: 1.45; }
.kp-type svg { display: block; height: clamp(54px, 6vw, 84px); width: auto; max-width: 100%; fill: currentColor; }
.kp-type__p { background: var(--g); color: #fff; }
.kp-type__s { background: #f3f3f2; color: var(--k); }

/* ---------- The contact sheet ---------- */
.kp-contact { background: var(--k); color: #e5e4e2; }

/* ---------- The end ---------- */
.kp-end__copy { position: absolute; left: var(--gutter); top: 0; bottom: 0; width: min(38vw, 560px); display: grid; align-content: center; gap: 16px; font-size: 18px; line-height: 1.5; color: #333; }
.kp-end__copy p { margin: 0; }
.kp-end__black { position: absolute; inset: 0 0 0 50%; display: grid; place-items: center; background: var(--k); fill: #fff; will-change: transform; }
.kp-end__black svg { width: 68%; height: auto; }

@media (max-width: 900px), (prefers-reduced-motion: reduce) {
  .kp-film .st-reel__stage { padding-bottom: 24px; }
  .kp-frame { position: relative; top: auto !important; height: auto; }
  .kp-frame img { height: auto; }
  .kp-frame::after { display: none; }
  .kp-hero { background: var(--k); padding: 24px 0; }
  .kp-say, .kp-person__copy, .kp-person__after, .kp-end__copy { width: auto; padding: 16px var(--gutter); position: relative !important; color: inherit; }
  .kp-person .st-reel__stage { color: #fff; }
  .kp-trade__in { padding-block: 48px; }
  .kp-gen__grid { grid-template-columns: minmax(0, 1fr); }
  .kp-gen__col:nth-child(2) { margin-top: 0; }
  .kp-mark__grid, .kp-cols__row, .kp-type { grid-template-columns: minmax(0, 1fr); }
  .kp-end__black { inset: auto; min-height: 280px; }
}

/* stacked: the statement gets room below the meta row */
@media (max-width: 900px), (prefers-reduced-motion: reduce) {
  .kp-hero__in { height: auto; }
  .kp-hero h1 { margin-top: 32px; }
}

/* scroll section heights, so they are in place before st-kalpnk.js runs (same numbers as its reel() calls) */
@media (min-width: 901px) and (prefers-reduced-motion: no-preference) {
  .kp-film { height: 620vh; } .kp-trade { height: 290vh; } .kp-person { height: 360vh; } .kp-site { height: 300vh; } .kp-end { height: 240vh; }
}
