@layer kft-studio {
  body.kft-entry-active { opacity: 1 !important; }
  .kft-entry-loader {
    --kft-fill-ms: 1600ms;
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
    padding: 24px;
    background: #111313;
    color: #f0f1ed;
    pointer-events: none;
    contain: layout paint;
    /* Already its own layer when the fade starts, so leaving costs no fresh drawing. */
    will-change: opacity;
    animation: kft-entry-failsafe 0s 7.5s forwards;
  }
  .kft-entry-scene { display: grid; justify-items: center; gap: 8px; text-align: center; will-change: transform; }
  .kft-entry-seal { position: relative; width: 160px; height: 160px; margin-bottom: 20px; perspective: 600px; }
  .kft-entry-trace { position: absolute; inset: 0; width: 100%; height: 100%; }
  .kft-entry-track { stroke: #313736; stroke-width: 1; }
  /* A red arc sweeps the ring. It turns by transform, so it stays smooth while the page is busy. */
  .kft-entry-orbit {
    position: absolute;
    inset: 15px;
    border: 1.4px solid transparent;
    border-top-color: #e36169;
    border-radius: 50%;
    animation: kft-entry-spin 1.4s linear infinite;
  }
  .kft-entry-marks { stroke: #adb3af; stroke-width: 1; opacity: .5; }
  .kft-entry-badge {
    position: absolute;
    inset: 26px;
    border-radius: 50%;
    overflow: hidden;
    background: #191c1c;
    box-shadow: 0 12px 24px #0006;
    isolation: isolate;
    animation: kft-entry-badge 620ms cubic-bezier(.16,1,.3,1) both;
  }
  .kft-entry-badge img { display: block; width: 100% !important; height: 100% !important; border-radius: 0 !important; object-fit: cover; }
  /* The empty glass: the crest in shadow, waiting to be filled. */
  .kft-entry-empty { filter: grayscale(1) brightness(.38) contrast(1.1); }

  /*
   * Coloured water pours in from the bottom. Every moving part is a transform,
   * so the pour stays smooth while the page behind it is busy preparing data.
   * The rising layer and the crest inside it move in opposite directions on the
   * same curve, so the crest stays still while the waterline climbs. The wave
   * edge is a fixed mask on a layer that slides sideways, with the crest sliding
   * back the same amount, so the surface rolls while the picture stays put. A
   * fainter back wave runs the other way for depth.
   */
  .kft-entry-rise {
    position: absolute;
    inset: 0;
    transform: translateY(100%);
    animation: kft-entry-rise var(--kft-fill-ms) cubic-bezier(.42,.12,.48,.92) forwards;
  }
  .kft-entry-surface { position: absolute; inset: -9px 0 0; overflow: hidden; }
  .kft-entry-surface-back { opacity: .45; transform: translateY(-4px); }
  .kft-entry-slide {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: calc(100% + 60px);
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 10' preserveAspectRatio='none'%3E%3Cpath d='M0 5Q15 0 30 5T60 5V10H0Z'/%3E%3C/svg%3E"), linear-gradient(#000, #000);
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 10' preserveAspectRatio='none'%3E%3Cpath d='M0 5Q15 0 30 5T60 5V10H0Z'/%3E%3C/svg%3E"), linear-gradient(#000, #000);
    -webkit-mask-size: 60px 10px, 100% calc(100% - 8px);
    mask-size: 60px 10px, 100% calc(100% - 8px);
    -webkit-mask-repeat: repeat-x, no-repeat;
    mask-repeat: repeat-x, no-repeat;
    -webkit-mask-position: 0 0, 0 100%;
    mask-position: 0 0, 0 100%;
    animation: kft-entry-slide 1.1s linear infinite;
  }
  .kft-entry-still { position: absolute; inset: 0; animation: kft-entry-unslide 1.1s linear infinite; }
  .kft-entry-surface-back :is(.kft-entry-slide, .kft-entry-still) { animation-duration: 1.7s; animation-direction: reverse; }
  .kft-entry-still img {
    position: absolute;
    top: 9px;
    left: 0;
    width: calc(100% - 60px) !important;
    height: calc(100% - 9px) !important;
    transform: translateY(-100%);
    animation: kft-entry-hold var(--kft-fill-ms) cubic-bezier(.42,.12,.48,.92) forwards;
  }
  .kft-entry-surface-back .kft-entry-still img { top: 13px; }
  /* A bright waterline so the surface reads as liquid against the dark crest. */
  .kft-entry-slide::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(#ffd6d9 0, #ffd6d900 14px);
    opacity: .5;
  }

  .kft-entry-name { margin: 0 !important; font: 600 20px/1.4 "Manrope", "Segoe UI", sans-serif !important; letter-spacing: -.02em; }
  .kft-entry-label { margin: 0 !important; color: #adb3af; font: 450 13px/1.5 "Manrope", "Segoe UI", sans-serif !important; }
  .kft-entry-loader.is-leaving { opacity: 0; transition: opacity 260ms ease; }
  .kft-entry-loader.is-leaving .kft-entry-scene { transform: scale(1.025); transition: transform 260ms ease; }
  @keyframes kft-entry-badge {
    from { transform: rotateY(-72deg) rotateZ(-8deg) scale(.88); opacity: .6; }
    to { transform: rotateY(0) rotateZ(0) scale(1); opacity: 1; }
  }
  @keyframes kft-entry-spin { to { transform: rotate(360deg); } }
  @keyframes kft-entry-rise { to { transform: translateY(0); } }
  @keyframes kft-entry-hold { to { transform: translateY(0); } }
  @keyframes kft-entry-slide { to { transform: translateX(-60px); } }
  @keyframes kft-entry-unslide { to { transform: translateX(60px); } }
  @keyframes kft-entry-failsafe { to { visibility: hidden; } }
  @media (prefers-reduced-motion: reduce) {
    .kft-entry-badge, .kft-entry-slide, .kft-entry-still { animation: none; }
    .kft-entry-orbit { animation: none; border-color: #e36169; }
    .kft-entry-rise, .kft-entry-still img { animation: none; transform: none; }
    .kft-entry-surface-back, .kft-entry-slide::after { display: none; }
    .kft-entry-loader.is-leaving { transition-duration: 80ms; }
    .kft-entry-loader.is-leaving .kft-entry-scene { transform: none; transition: none; }
  }
}
