.entrance[hidden] { display: none; }

@media (prefers-reduced-motion: no-preference) {
  .entrance {
    --intro-release: 3.65s;
    --intro-ease: cubic-bezier(.23,.75,.24,1);
    --intro-ink: #f1f0ed;
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: grid;
    place-items: center;
    overflow: hidden;
    color: var(--intro-ink);
    background: #080808;
    pointer-events: none;
    animation: intro-release 1.35s var(--intro-ease) var(--intro-release) forwards;
  }
  .entrance__field,
  .entrance__scan {
    position: absolute;
    inset: 0;
  }
  .entrance__field {
    background:
      radial-gradient(circle, #deded5 0 1px, transparent 1px) 0 0 / 6px 6px,
      linear-gradient(90deg, transparent calc(100% - 1px), #989892 0) center / clamp(42px, 8vw, 100px) 100%,
      linear-gradient(transparent calc(100% - 1px), #989892 0) center / 100% clamp(42px, 8vw, 100px);
    mask-image: radial-gradient(ellipse at center, #000 4%, #0007 46%, transparent 80%);
    animation: intro-field 3.8s ease both;
  }
  .entrance__frame {
    position: absolute;
    inset: max(22px, env(safe-area-inset-top)) clamp(18px, 4vw, 60px) max(22px, env(safe-area-inset-bottom));
    color: #73736d;
  }
  .entrance__frame i {
    position: absolute;
    width: clamp(12px, 1.5vw, 22px);
    aspect-ratio: 1;
    border: solid currentColor;
    animation: intro-corner 2.35s var(--intro-ease) .35s both;
  }
  .entrance__frame i:nth-child(1) { inset: 0 auto auto 0; border-width: 1px 0 0 1px; }
  .entrance__frame i:nth-child(2) { inset: 0 0 auto auto; border-width: 1px 1px 0 0; }
  .entrance__frame i:nth-child(3) { inset: auto auto 0 0; border-width: 0 0 1px 1px; }
  .entrance__frame i:nth-child(4) { inset: auto 0 0 auto; border-width: 0 1px 1px 0; }

  .entrance__scan {
    inset: 14% -18% 14% auto;
    width: 24%;
    background: repeating-linear-gradient(90deg, transparent 0 5px, #f1f0ed 5px 6px);
    mask-image: radial-gradient(ellipse at center, #000, transparent 68%);
    animation: intro-scan 2.9s ease-in-out .32s both;
  }
  .entrance__pixels {
    position: absolute;
    width: min(72vw, 800px);
    height: min(36svh, 310px);
  }
  .entrance__pixels i {
    position: absolute;
    width: 5px;
    aspect-ratio: 1;
    background: #ddd;
    animation: intro-pixel 2.6s var(--intro-ease) var(--delay, .4s) both;
  }
  .entrance__pixels i:nth-child(1) { top: 6%; left: 18%; --dx: -26px; --dy: -13px; }
  .entrance__pixels i:nth-child(2) { top: 17%; right: 13%; --dx: 24px; --dy: -16px; --delay: .62s; }
  .entrance__pixels i:nth-child(3) { top: 43%; left: 2%; --dx: -19px; --dy: 9px; --delay: .8s; }
  .entrance__pixels i:nth-child(4) { bottom: 12%; right: 26%; --dx: 16px; --dy: 18px; --delay: .97s; }
  .entrance__pixels i:nth-child(5) { bottom: 9%; left: 19%; --dx: -18px; --dy: 16px; --delay: 1.1s; }
  .entrance__pixels i:nth-child(6) { bottom: 37%; right: 0; --dx: 22px; --dy: 10px; --delay: 1.24s; background: #9dd881; }

  .entrance__identity {
    position: relative;
    display: flex;
    align-items: center;
    gap: clamp(12px, 2vw, 27px);
    animation: intro-identity-out 1.1s var(--intro-ease) 3.45s both;
  }
  .entrance__mark {
    position: relative;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    width: clamp(30px, 5vw, 66px);
    aspect-ratio: 1;
  }
  .entrance__mark i {
    background: currentColor;
    animation: intro-assemble 1.65s var(--intro-ease) var(--tile-delay, .35s) both;
  }
  .entrance__mark i:nth-child(1) { --dx: -14px; --dy: -13px; clip-path: polygon(0 0,100% 0,100% 67%,67% 67%,67% 100%,0 100%); }
  .entrance__mark i:nth-child(2) { --dx: 14px; --dy: -13px; --tile-delay: .44s; clip-path: polygon(0 0,100% 0,100% 100%,33% 100%,33% 67%,0 67%); }
  .entrance__mark i:nth-child(3) { --dx: -14px; --dy: 13px; --tile-delay: .53s; clip-path: polygon(0 0,67% 0,67% 33%,100% 33%,100% 100%,0 100%); }
  .entrance__mark i:nth-child(4) { --dx: 14px; --dy: 13px; --tile-delay: .62s; clip-path: polygon(33% 0,100% 0,100% 100%,0 100%,0 33%,33% 33%); }
  .entrance__name {
    font: 700 clamp(28px, 8.1vw, 100px)/1 Arial, sans-serif;
    letter-spacing: -.07em;
    animation: intro-name 1.8s var(--intro-ease) .75s both;
  }
  .entrance__trace {
    position: absolute;
    inset: auto 0 -21px;
    height: 1px;
    color: #99d67c;
    background: linear-gradient(90deg, currentColor, #8c8c83 24%, transparent);
    transform-origin: left;
    animation: intro-trace 2.15s var(--intro-ease) 1.28s both;
  }
  .entrance__trace::before {
    content: "";
    position: absolute;
    inset: -2px auto auto 0;
    width: 5px;
    height: 5px;
    background: currentColor;
  }

  .entrance:not([hidden]) ~ .header .logo .brand-mark {
    animation: intro-header-mark 1.3s ease 4.03s;
  }
}

@media (prefers-reduced-motion: reduce) {
  .entrance { display: none; }
}

@keyframes intro-release { to { opacity: 0; visibility: hidden; } }
@keyframes intro-field {
  0% { opacity: 0; transform: scale(1.12); }
  55% { opacity: .105; }
  100% { opacity: .055; transform: scale(1); }
}
@keyframes intro-corner {
  from { opacity: 0; transform: scale(.68); }
  to { opacity: .6; transform: scale(1); }
}
@keyframes intro-scan {
  0% { opacity: 0; transform: translateX(0); }
  32% { opacity: .13; }
  100% { opacity: 0; transform: translateX(-120vw); }
}
@keyframes intro-pixel {
  0% { opacity: 0; transform: translate(var(--dx), var(--dy)); }
  48% { opacity: .59; }
  100% { opacity: 0; transform: translate(0, 0); }
}
@keyframes intro-assemble {
  from { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(.76); }
  to { opacity: 1; transform: translate(0, 0) scale(1); }
}
@keyframes intro-name {
  from { opacity: 0; clip-path: inset(-12% 100% -12% -4%); transform: translateX(-10px); }
  40% { opacity: 1; }
  to { opacity: 1; clip-path: inset(-12% -4%); transform: translateX(0); }
}
@keyframes intro-trace {
  0% { opacity: 0; transform: scaleX(.04); }
  45% { opacity: .68; transform: scaleX(1); }
  100% { opacity: .3; transform: scaleX(.73); }
}
@keyframes intro-identity-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(-13px) scale(1.035); }
}
@keyframes intro-header-mark {
  0%, 100% { color: inherit; }
  35% { color: #9dd881; }
}

.entrance__mosaic {
  display: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

@media (prefers-reduced-motion: no-preference) {
  .entrance.is-pixel-release {
    background: transparent;
    animation: intro-cutoff 0s 3s forwards;
  }
  .entrance.is-pixel-release .entrance__mosaic { display: block; }
  .entrance.is-pixel-release :is(.entrance__field, .entrance__frame, .entrance__pixels) {
    transition: opacity .65s ease;
  }
  .entrance.is-pixel-release .entrance__frame { opacity: 0; }
  .entrance.is-pixel-release .entrance__field {
    animation: intro-field-release .6s ease both;
  }
}
@keyframes intro-field-release { from { opacity: .07; } to { opacity: 0; } }
@keyframes intro-cutoff { to { visibility: hidden; } }
