:root {
  --project-page-gutter: clamp(12px, 4.2vw, 80px);
}

/* Shared project-page viewport. Project cards already inherit the gutter from
   `.project`; standalone case-study boards use the same token explicitly. */
.project {
  padding-inline: var(--project-page-gutter);
}

main > :is(
  .kapi-detail-picture,
  .kapi-detail-picture-group,
  .progressive-image-sequence,
  .robot-project-page
) {
  width: calc(100% - (var(--project-page-gutter) * 2));
  margin-inline: var(--project-page-gutter);
}

main > .kapi-detail-picture-group > :is(.kapi-detail-picture, .progressive-image-sequence) {
  width: 100%;
  margin-inline: 0;
}

@media (max-width: 700px) {
  body .project {
    padding-inline: var(--project-page-gutter);
  }

  .project .project-card {
    padding-inline: 0;
  }
}

.portrait-picture,
.kapi-cover-picture {
  display: block;
  width: 100%;
  height: 100%;
}

.portrait-picture img,
.kapi-cover-picture img {
  display: block;
}

.kapi-index .index-art picture {
  display: contents;
}

.kapi-detail-sequence {
  display: block;
  width: 100%;
  margin-top: 24px;
  line-height: 0;
}

.kapi-detail-picture {
  display: block;
  width: 100%;
  /* Progressive images already defer network loading. Keep their layout
     measurable so top-tab anchor targets never collapse to 0px off screen. */
  content-visibility: visible;
}

.dashboard-primary-video-stage {
  position: relative;
  overflow: hidden;
}

.dashboard-primary-demo-video {
  position: absolute;
  z-index: 2;
  top: 23.08%;
  left: 3.33%;
  width: 93.34%;
  height: 48.72%;
  display: block;
  border: 0;
  border-radius: clamp(4px, .62vw, 18px);
  background: #0b0f14;
  object-fit: contain;
  object-position: center;
  pointer-events: none;
}

.dashboard-carbon-video-stage {
  position: relative;
  overflow: hidden;
}

.dashboard-carbon-demo-video {
  position: absolute;
  z-index: 2;
  top: 20.18%;
  left: 22.08%;
  width: 73.52%;
  height: 73.65%;
  display: block;
  border: 0;
  border-radius: clamp(4px, .56vw, 16px);
  background: #0b0f14;
  object-fit: contain;
  object-position: center;
  pointer-events: none;
}

.robot-hmi-design {
  position: relative;
  overflow: hidden;
  line-height: 0;
}

.robot-hmi-design__background {
  display: block;
  width: 100%;
  height: auto;
}

.robot-hmi-design .robot-hmi-design__product {
  position: absolute;
  z-index: 1;
  left: 30%;
  bottom: -20px;
  width: 70%;
  height: auto;
  object-fit: contain;
  opacity: 0;
  transform: translate(0, 130px);
  transition: opacity 1.5s ease, transform 1.9s cubic-bezier(.16, 1, .3, 1);
  will-change: opacity, transform;
}

.robot-hmi-design .robot-hmi-design__title {
  position: absolute;
  z-index: 3;
  left: 2.05%;
  bottom: 3.6%;
  width: 35.19%;
  height: auto;
  object-fit: contain;
  opacity: 0;
  transform: translateY(48px);
  transition: opacity 1.3s ease .9s, transform 1.6s cubic-bezier(.16, 1, .3, 1) .9s;
  will-change: opacity, transform;
}

.robot-hmi-design.is-visible .robot-hmi-design__product {
  opacity: 1;
  transform: translate(0, 70px);
}

.robot-hmi-design.is-visible .robot-hmi-design__title {
  opacity: 1;
  transform: translateY(0);
}

.robot-hmi-design .robot-hmi-design__bottom-mask {
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  bottom: 0;
  display: block;
  width: 100%;
  height: auto;
}

.robot-project-page,
.robot-project-page img {
  display: block;
  width: 100%;
}

.robot-project-page {
  position: relative;
  line-height: 0;
}

.robot-project-page img {
  height: auto;
}

.robot-project-awards__highlights {
  position: absolute;
  z-index: 1;
  top: 8.9%;
  left: 4.3%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 14.1%;
  height: 59%;
  transform: translateY(60px);
}

.robot-project-awards .robot-project-awards__highlights img {
  display: block;
  width: 100%;
  height: auto;
  opacity: 0;
  transform: translateY(32px);
  transition: opacity .75s ease, transform 1s cubic-bezier(.16, 1, .3, 1);
  will-change: opacity, transform;
}

.robot-project-awards.is-visible .robot-project-awards__highlights img {
  opacity: 1;
  transform: translateY(0);
}

.robot-project-awards.is-visible .robot-project-awards__highlights img:nth-child(2) {
  transition-delay: .18s;
}

.robot-project-awards.is-visible .robot-project-awards__highlights img:nth-child(3) {
  transition-delay: .36s;
}

.robot-project-awards.is-visible .robot-project-awards__highlights img:nth-child(4) {
  transition-delay: .54s;
}

@media (prefers-reduced-motion: reduce) {
  .robot-hmi-design .robot-hmi-design__product,
  .robot-hmi-design .robot-hmi-design__title {
    opacity: 1;
    transition: none;
  }

  .robot-hmi-design .robot-hmi-design__product {
    transform: translate(0, 70px);
  }

  .robot-hmi-design .robot-hmi-design__title {
    transform: none;
  }

  .robot-project-awards .robot-project-awards__highlights img {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

.project-kapi .kapi-detail-picture .kapi-detail-board {
  margin-top: 0;
}

/* Keep every deferred image's final footprint in the layout while its file is
   waiting in the proximity queue. The restrained shimmer is the loading UI. */
img[data-image-state] {
  background-color: #151515;
}

img[data-image-state="queued"] {
  background-image: linear-gradient(105deg, #151515 0%, #151515 42%, #242424 50%, #151515 58%, #151515 100%);
  background-position: 100% 0;
  background-size: 220% 100%;
}

img[data-image-state="loading"] {
  background-image: linear-gradient(105deg, #151515 0%, #151515 42%, #2d2d2d 50%, #151515 58%, #151515 100%);
  background-position: 100% 0;
  background-size: 220% 100%;
  animation: image-loading-sweep 1.35s linear infinite;
}

img[data-image-state="loaded"] {
  background-color: transparent;
  background-image: none;
  animation: none;
}

img[data-image-state="error"] {
  background-color: #202020;
  background-image: repeating-linear-gradient(135deg, transparent 0 10px, rgba(255, 255, 255, 0.035) 10px 20px);
  animation: none;
}

.progressive-image-sequence picture[data-image-state] {
  position: relative;
  min-width: 0;
  overflow: hidden;
  background: #151515;
}

.progressive-image-sequence picture[data-image-state="loaded"] {
  background: transparent;
}

.kapi-ui-design-intro-picture,
.kapi-ui-design-intro-picture img,
.kapi-project-introduction-picture,
.kapi-project-introduction-picture img,
.kapi-project-overview-frame-picture,
.kapi-project-overview-frame-picture img,
.kapi-foundation-main-flow-picture,
.kapi-foundation-main-flow-picture img,
.kapi-ai-native-case-study-picture,
.kapi-ai-native-case-study-picture img {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
}

.kapi-ui-design-intro-picture {
  line-height: 0;
  background: #030713;
}

.kapi-ui-design-intro-picture img {
  height: auto;
}

.kapi-project-introduction-picture,
.kapi-foundation-main-flow-picture,
.kapi-ai-native-case-study-picture {
  margin-bottom: 18px;
  line-height: 0;
  background: #030713;
}

.kapi-project-introduction-picture img,
.kapi-project-overview-frame-picture img,
.kapi-foundation-main-flow-picture img,
.kapi-ai-native-case-study-picture img {
  height: auto;
}

.kapi-project-overview-media {
  position: relative;
  margin-bottom: 18px;
  overflow: hidden;
  background: #030713;
}

.kapi-ui-design-intro-stage {
  position: relative;
  aspect-ratio: 2880 / 1649;
  margin-bottom: 18px;
  overflow: hidden;
  background: #030713;
}

.kapi-ui-design-intro-copy {
  position: absolute;
  z-index: 2;
  top: 34%;
  left: 4.4%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  color: #fff;
  font-family: "Helvetica Neue", "PingFang SC", Arial, sans-serif;
  letter-spacing: .02em;
  text-align: left;
  pointer-events: none;
}

.kapi-ui-design-intro-copy strong {
  margin-bottom: clamp(22px, 3vw, 48px);
  font-size: clamp(34px, 5.2vw, 82px);
  font-weight: 700;
  line-height: 1.05;
}

.kapi-ui-design-intro-copy span {
  font-size: clamp(25px, 3.7vw, 58px);
  font-weight: 300;
  line-height: 1.18;
  letter-spacing: .035em;
}

.kapi-ui-design-intro-copy.reveal {
  opacity: 0;
  filter: blur(9px);
  transform: translate3d(0, 24px, 0);
  transition: opacity 1s cubic-bezier(.16, 1, .3, 1), filter 1s cubic-bezier(.16, 1, .3, 1), transform 1s cubic-bezier(.16, 1, .3, 1);
}

.kapi-ui-design-intro-copy.reveal.visible {
  opacity: 1;
  filter: blur(0);
  transform: none;
}

.kapi-ui-design-intro-icon {
  position: absolute;
  z-index: 2;
  top: 30%;
  left: 54%;
  display: block;
  width: clamp(120px, 17vw, 275px);
  height: auto;
  pointer-events: none;
}

.kapi-ui-design-intro-icon.reveal {
  opacity: 0;
  filter: blur(12px);
  transform: translate3d(0, 28px, 0) scale(.9);
  transition: opacity 1s .18s cubic-bezier(.16, 1, .3, 1), filter 1s .18s cubic-bezier(.16, 1, .3, 1), transform 1s .18s cubic-bezier(.16, 1, .3, 1);
}

.kapi-ui-design-intro-icon.reveal.visible {
  opacity: 1;
  filter: blur(0);
  transform: none;
}

.kapi-ui-design-intro-hand {
  position: absolute;
  z-index: 3;
  top: 42%;
  left: 53.7%;
  display: block;
  width: min(40.9%, 479.2px);
  height: auto;
  pointer-events: none;
}

.kapi-ui-design-intro-hand.reveal {
  opacity: 0;
  filter: blur(10px);
  transform: translate3d(0, 34px, 0) scale(.94);
  transform-origin: 58% 0;
  transition: opacity .9s .36s cubic-bezier(.16, 1, .3, 1), filter .9s .36s cubic-bezier(.16, 1, .3, 1), transform .9s .36s cubic-bezier(.16, 1, .3, 1);
}

.kapi-ui-design-intro-hand.reveal.visible {
  opacity: 1;
  filter: blur(0);
  transform: none;
}

@media (max-width: 700px) {
  .kapi-ui-design-intro-stage {
    margin-bottom: 12px;
  }

  .kapi-project-introduction-picture,
  .kapi-foundation-main-flow-picture,
  .kapi-ai-native-case-study-picture {
    margin-bottom: 12px;
  }

  .kapi-project-overview-media {
    margin-bottom: 12px;
  }

  .kapi-ui-design-intro-copy {
    top: 33%;
    left: 5%;
  }

  .kapi-ui-design-intro-copy strong {
    margin-bottom: 12px;
    font-size: clamp(20px, 6.8vw, 34px);
  }

  .kapi-ui-design-intro-copy span {
    font-size: clamp(15px, 5vw, 25px);
  }

  .kapi-ui-design-intro-icon {
    top: 34%;
    left: 62%;
    width: clamp(72px, 24vw, 120px);
  }

  .kapi-ui-design-intro-hand {
    top: 42%;
    left: 53%;
    width: clamp(105px, 34vw, 170px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .kapi-ui-design-intro-copy.reveal,
  .kapi-ui-design-intro-copy.reveal.visible,
  .kapi-ui-design-intro-icon.reveal,
  .kapi-ui-design-intro-icon.reveal.visible,
  .kapi-ui-design-intro-hand.reveal,
  .kapi-ui-design-intro-hand.reveal.visible {
    opacity: 1;
    filter: none;
    transform: none;
    transition: none;
  }
}

.design-type-intro {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 100svh;
  margin: 0;
  padding: clamp(28px, 6vw, 96px);
  overflow: hidden;
  background: #000;
  color: #fff;
  text-align: center;
  scroll-margin-top: 0;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.direction-anchor.design-type-intro {
  scroll-margin-top: 0;
}

.design-type-intro__title {
  max-width: 100%;
  margin: 0;
  font-family: Manrope, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: clamp(28px, 5.2vw, 76px);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.02em;
  text-wrap: balance;
  opacity: 0;
  transform: translate3d(0, 28px, 0) scale(.98);
  transition: opacity .72s ease, transform .9s cubic-bezier(.16, 1, .3, 1);
}

.design-type-intro.is-visible .design-type-intro__title {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
}

#project-robot-chess .design-type-intro__title,
#project-tob-core .design-type-intro__title {
  translate: 0 -6vh;
}

/* The fixed status capsule switches copy contrast from a lightweight estimate
   of the page pixels after the translucent glass brightens them. */
.status-chip .status-chip__main,
.status-chip .status-chip__sub,
.status-chip .capsule-direction > a {
  transition: color .24s ease;
}

.site-header .status-chip.status-glass.is-on-light-background .status-chip__main {
  color: rgba(16, 18, 20, .92);
  mix-blend-mode: normal;
}

.site-header .status-chip.status-glass.is-on-light-background .status-chip__sub {
  color: rgba(34, 37, 40, .68);
  border-left-color: rgba(28, 31, 34, .22);
  mix-blend-mode: normal;
}

.status-chip.is-on-light-background.has-directions .capsule-direction > a:not(.is-active) {
  color: rgba(28, 31, 34, .58);
}

/* On the landing and work-directory screens, keep the direction tabs tucked
   beneath the status capsule until the capsule is hovered or keyboard-focused. */
body:not(.is-project-detail) .status-chip.status-glass.has-directions {
  width: 294px;
  min-width: 294px;
}

body:not(.is-project-detail) .status-chip.has-directions .glass-surface-content {
  padding-inline: 20px;
}

body:not(.is-project-detail) .status-chip.has-directions .capsule-content {
  justify-content: center;
  gap: 0;
}

body:not(.is-project-detail) .status-chip.has-directions .capsule-directions {
  position: absolute;
  top: calc(100% + 14px);
  left: 50%;
  display: flex;
  gap: 6px;
  padding: 8px;
  border-left: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, -8px) scale(.98);
  transition: opacity .24s ease, transform .3s cubic-bezier(.16, 1, .3, 1), visibility 0s linear .3s;
}

body:not(.is-project-detail) .status-chip.has-directions:hover .capsule-directions,
body:not(.is-project-detail) .status-chip.has-directions:focus-within .capsule-directions {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate(-50%, 0) scale(1);
  transition-delay: 0s;
}

body:not(.is-project-detail) .status-chip.has-directions .capsule-directions::before {
  display: none;
}

body:not(.is-project-detail) .status-chip.has-directions .capsule-direction > a,
body:not(.is-project-detail) .status-chip.is-on-light-background.has-directions .capsule-direction > a:not(.is-active) {
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, .16);
  background: rgba(8, 9, 10, .72);
  color: rgba(255, 255, 255, .58);
  font-size: 9px;
  box-shadow: none;
}

body:not(.is-project-detail) .status-chip.has-directions .capsule-direction > a.is-active {
  border-color: rgba(217, 255, 54, .5);
  background: rgba(8, 9, 10, .72);
  color: #fff;
}

#contact h2 {
  letter-spacing: -0.035em;
}

/* Safari/WebKit can drop transparent image layers after a filter transition.
   Keep the three Kapi hero phones on a simple opacity/transform compositor. */
.kapi-art .kapi-phone-side,
.kapi-art .kapi-phone-record,
.kapi-art .kapi-phone-side.reveal,
.kapi-art .kapi-phone-record.reveal,
.kapi-art .kapi-phone-side.reveal.visible,
.kapi-art .kapi-phone-record.reveal.visible {
  filter: none;
  -webkit-filter: none;
  will-change: opacity, transform;
}

.kapi-art .kapi-phone-side.reveal,
.kapi-art .kapi-phone-record.reveal {
  transition-property: opacity, transform;
}

.kapi-art .kapi-phone-side > img,
.kapi-art .kapi-phone-record > img {
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

@keyframes image-loading-sweep {
  to { background-position: -120% 0; }
}

@media (prefers-reduced-motion: reduce) {
  img[data-image-state="loading"] {
    background-image: none;
    animation: none;
  }
}

@media (max-width: 700px) {
  .kapi-detail-sequence {
    margin-top: 12px;
  }

  .design-type-intro {
    min-height: 100svh;
    padding: 28px 22px;
  }

  .design-type-intro__title {
    font-size: clamp(28px, 8vw, 38px);
  }

  #project-robot-chess .design-type-intro__title,
  #project-tob-core .design-type-intro__title {
    translate: 0 -4svh;
  }

  .contact {
    position: relative;
  }

  .contact h2 {
    position: absolute;
    top: 50%;
    right: 6vw;
    left: 6vw;
    margin: 0;
    letter-spacing: .035em;
    transform: translateY(-50%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .design-type-intro__title {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
