/* Perspective tunnel hero. tunnel.js adds .is-on and drives the stage. Without it,
   the hero is a still title over the tunnel backdrop. Stacking inside the stage:
   canvas 0, glow 1, guides and grid 2, still cards 3, scrim 4, title 5,
   moving cards 12-20, details 30, ending 35, HUD 40. */
.tunnel {
  --bar-h: 82px;
  --travel: 240vh;
  --card-w: 400px;
  position: relative;
  isolation: isolate;
  background: var(--bg);
}
.tunnel.is-live {
  height: calc(100vh - var(--bar-h) + var(--travel));
  height: calc(100svh - var(--bar-h) + var(--travel));
}
.tunnel-stage {
  position: sticky;
  top: var(--bar-h);
  height: calc(100vh - var(--bar-h));
  height: calc(100svh - var(--bar-h));
  min-height: 380px;
  overflow: hidden;
  background:
    radial-gradient(
      ellipse 70% 60% at 50% 50%,
      rgb(22 27 33 / 70%),
      transparent 72%
    ),
    var(--bg);
}
.tunnel-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
}
.tunnel:not(.is-on) .tunnel-canvas {
  display: none;
}
.tunnel-glow,
.tunnel-guides {
  position: absolute;
  left: 50%;
  top: 50%;
  border-radius: 50%;
  pointer-events: none;
  will-change: transform, opacity;
}
.tunnel-glow {
  z-index: 1;
  width: 84vmin;
  height: 84vmin;
  margin: -42vmin 0 0 -42vmin;
  background: radial-gradient(
    closest-side,
    rgb(132 196 255 / 26%),
    rgb(66 139 203 / 10%) 45%,
    transparent
  );
  opacity: 0.7;
}
.tunnel-glow::after {
  content: "";
  position: absolute;
  inset: 45%;
  border-radius: 50%;
  background: radial-gradient(
    closest-side,
    rgb(214 236 255 / 55%),
    transparent
  );
}
.tunnel-guides {
  z-index: 2;
  width: 76vmin;
  height: 76vmin;
  margin: -38vmin 0 0 -38vmin;
  border: 1px dashed rgb(226 221 211 / 11%);
}
.tunnel-guides::before {
  content: "";
  position: absolute;
  inset: 18.4%;
  border: 1px solid rgb(111 184 251 / 16%);
  border-radius: 50%;
}
.tunnel-grid {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background-image: radial-gradient(
    rgb(226 221 211 / 32%) 1px,
    transparent 1.2px
  );
  background-position: center;
  background-size: 28px 28px;
  opacity: 0.32;
  mask-image: radial-gradient(
    ellipse 70% 70% at 50% 50%,
    #000 55%,
    transparent 100%
  );
}
.tunnel-scrim {
  position: absolute;
  z-index: 4;
  left: 50%;
  top: 47%;
  width: min(1500px, 140vw);
  height: min(760px, 92%);
  transform: translate(-50%, -50%);
  background: radial-gradient(
    closest-side,
    rgb(11 11 10 / 80%),
    rgb(11 11 10 / 50%) 55%,
    transparent
  );
  pointer-events: none;
  will-change: opacity;
}

/* Copy: the title sits under the moving cards, the details above them. */
.tunnel-copy {
  position: absolute;
  inset: 0 0 6vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  text-align: center;
  pointer-events: none;
}
.tunnel-copy > * {
  position: relative;
  z-index: 30;
  pointer-events: auto;
  will-change: transform, opacity;
}
.tunnel-copy > .tunnel-title {
  z-index: 5;
}
.tunnel-copy[data-faded] > * {
  pointer-events: none;
}
.tunnel-copy > :not(.tunnel-title):focus-within {
  opacity: 1 !important;
  transform: none !important;
  pointer-events: auto;
}
.tunnel-eyebrow {
  justify-content: center;
  margin-bottom: 26px;
}
.tunnel-title {
  font-size: clamp(42px, 8.2vw, 124px);
  font-size: clamp(42px, min(8.2vw, 15svh), 124px);
  line-height: 0.98;
  white-space: nowrap;
  transform-origin: 50% 55%;
}
.tunnel-title > .hero-line:first-child {
  color: var(--ink);
}
.tunnel-lead {
  max-width: 520px;
  margin-top: 28px;
  font-size: 17px;
  line-height: 1.7;
  letter-spacing: -0.01em;
  color: var(--muted);
  text-wrap: pretty;
}
.tunnel-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 32px;
}

/* Cards: tunnel.js sets each card's transform, opacity and stacking. */
.tunnel-cards {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  pointer-events: none;
}
.tunnel-card {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--card-w);
  aspect-ratio: 4 / 5;
  margin: calc(var(--card-w) * -0.625) 0 0 calc(var(--card-w) * -0.5);
  opacity: 0;
  visibility: hidden;
  pointer-events: auto;
  will-change: transform, opacity;
  backface-visibility: hidden;
}
.tunnel.is-on .tunnel-card {
  visibility: visible;
}
.tunnel-card-link {
  position: absolute;
  inset: 0;
  display: block;
  overflow: hidden;
  border-radius: calc(var(--card-w) * 0.05);
  background: #121212;
  box-shadow:
    0 0 0 1px rgb(226 221 211 / 15%),
    0 calc(var(--card-w) * 0.08) calc(var(--card-w) * 0.2)
      calc(var(--card-w) * -0.06) rgb(0 0 0 / 85%);
  transition:
    transform 0.5s var(--ease),
    box-shadow 0.4s var(--ease);
}
.tunnel-card-link::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(155deg, rgb(255 255 255 / 10%), transparent 30%);
  pointer-events: none;
}
.tunnel-card-link:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 4px;
}
.tunnel-card-media {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    120% 90% at 30% 15%,
    #252a30,
    #121212 58%,
    #0c0c0b
  );
}
/* The numeral shows while the image decodes, and stays if the image fails. */
.tunnel-card-media::before {
  content: attr(data-index);
  position: absolute;
  left: 8%;
  bottom: 22%;
  font-family: var(--mono);
  font-size: calc(var(--card-w) * 0.34);
  line-height: 1;
  letter-spacing: -0.04em;
  color: rgb(111 184 251 / 10%);
}
.tunnel-card-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgb(6 6 6 / 88%),
    rgb(6 6 6 / 30%) 38%,
    transparent 62%
  );
}
.tunnel-card-media img {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--pos, 50% 50%);
  transform: scale(var(--zoom, 1));
  transform-origin: var(--pos, 50% 50%);
  opacity: 0;
  transition:
    opacity 0.7s var(--ease),
    transform 0.8s var(--ease);
}
.tunnel-card.is-ready .tunnel-card-media img {
  opacity: 1;
}
.tunnel-card.is-ready .tunnel-card-media::before {
  opacity: 0;
}
.tunnel-card.is-broken .tunnel-card-media img {
  display: none;
}
.tunnel-card-title {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 7%;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  font-size: calc(var(--card-w) * 0.075);
  font-weight: 520;
  line-height: 1.08;
  letter-spacing: -0.035em;
  color: var(--ink);
}
.tunnel-card-title .ico {
  width: 0.62em;
  height: 0.62em;
  margin-bottom: 0.15em;
  color: var(--blue);
  transition: transform 0.4s var(--ease);
}
.tunnel-card-meta {
  position: absolute;
  left: 8%;
  right: 8%;
  top: 7%;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-family: var(--mono);
  font-size: calc(var(--card-w) * 0.034);
  line-height: 1.4;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--blue);
  text-shadow: 0 1px 8px rgb(0 0 0 / 70%);
}
.tunnel-card-meta > span:last-child {
  color: rgb(246 243 237 / 72%);
}
@media (hover: hover) {
  .tunnel-card-link:hover {
    transform: translateY(-2%) scale(1.04);
    box-shadow:
      0 0 0 1px rgb(111 184 251 / 70%),
      0 calc(var(--card-w) * 0.1) calc(var(--card-w) * 0.24)
        calc(var(--card-w) * -0.06) rgb(0 0 0 / 90%),
      0 0 calc(var(--card-w) * 0.16) rgb(111 184 251 / 22%);
  }
  .tunnel-card-link:hover img {
    transform: scale(calc(var(--zoom, 1) * 1.08));
  }
  .tunnel-card-link:hover .tunnel-card-title .ico {
    transform: translate(8%, -8%);
  }
}

/* Ending */
.tunnel-end {
  position: absolute;
  inset: 0 0 6vh;
  z-index: 35;
  display: grid;
  place-items: center;
  padding: 0 20px;
  text-align: center;
  pointer-events: none;
}
.tunnel:not(.is-live) .tunnel-end {
  display: none;
}
.tunnel-end-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  opacity: 0;
  will-change: transform, opacity;
}
.tunnel-end[data-shown] .tunnel-end-inner,
.tunnel-end-inner:focus-within {
  pointer-events: auto;
}
.tunnel-end-inner:focus-within {
  opacity: 1 !important;
  transform: none !important;
}
.tunnel-mark {
  width: clamp(52px, 6vw, 80px);
  height: auto;
  aspect-ratio: 1;
  --logo-ink: var(--ink);
  --logo-accent: var(--blue);
  filter: drop-shadow(0 0 22px rgb(111 184 251 / 45%));
}
.tunnel-end-line {
  font-size: clamp(30px, 4.6vw, 64px);
  font-weight: 480;
  line-height: 1.02;
  letter-spacing: -0.055em;
}
.tunnel-end-line span {
  display: block;
  color: var(--blue);
}
.tunnel-end-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: rgb(11 11 10 / 55%);
  font-size: 13px;
  font-weight: 550;
  transition:
    background-color 0.2s,
    border-color 0.2s;
}
.tunnel-end-link:hover {
  background: var(--panel);
  border-color: var(--blue);
}

/* HUD: position, scroll hint, skip link and travel meter. */
.tunnel-hud {
  position: absolute;
  z-index: 40;
  left: 0;
  right: 0;
  bottom: 0;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 clamp(16px, 3.4vw, 48px);
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.6;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--soft);
  pointer-events: none;
}
.tunnel:not(.is-live) .tunnel-hud {
  display: none;
}
.tunnel-status {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}
.tunnel-status [data-tunnel-index] {
  color: var(--blue);
}
.tunnel-label {
  overflow: hidden;
  color: var(--muted);
  white-space: nowrap;
  text-overflow: ellipsis;
}
.tunnel-hint {
  position: absolute;
  left: 50%;
  top: 50%;
  display: flex;
  align-items: center;
  gap: 12px;
  transform: translate(-50%, -50%);
  transition: opacity 0.4s;
}
.tunnel-hint[data-hidden] {
  opacity: 0;
}
.tunnel-hint-line {
  position: relative;
  width: 1px;
  height: 26px;
  overflow: hidden;
  background: rgb(226 221 211 / 14%);
}
.tunnel-hint-line::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 45%;
  background: var(--blue);
  animation: tunnel-hint 1.8s var(--ease) infinite;
}
.tunnel-hint[data-hidden] .tunnel-hint-line::after {
  animation-play-state: paused;
}
@keyframes tunnel-hint {
  from {
    transform: translateY(-110%);
  }
  to {
    transform: translateY(240%);
  }
}
.tunnel-skip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: var(--muted);
  pointer-events: auto;
  transition: color 0.2s;
}
.tunnel-skip:hover {
  color: var(--ink);
}
.tunnel-meter {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: rgb(226 221 211 / 8%);
}
.tunnel-meter > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, rgb(111 184 251 / 25%), var(--blue));
  transform: scaleX(0);
  transform-origin: 0 50%;
  will-change: transform;
}

.tunnel.is-lite .tunnel-card-link {
  box-shadow: 0 0 0 1px rgb(226 221 211 / 15%);
}
.tunnel.is-lite .tunnel-grid {
  display: none;
}
@media (max-width: 820px) {
  .tunnel {
    --bar-h: 72px;
    --travel: 220vh;
  }
  .tunnel-lead {
    max-width: 440px;
    font-size: 16px;
  }
}
@media (max-width: 640px) {
  .tunnel {
    --bar-h: 66px;
    --travel: 200vh;
  }
  .tunnel-eyebrow {
    margin-bottom: 20px;
  }
  .tunnel-lead {
    margin-top: 20px;
    font-size: 15px;
    line-height: 1.65;
  }
  .tunnel-actions {
    margin-top: 26px;
    gap: 6px 10px;
  }
  .tunnel-hint,
  .tunnel-label {
    display: none;
  }
}
@media (max-height: 560px) {
  .tunnel-eyebrow {
    margin-bottom: 12px;
  }
  .tunnel-lead {
    margin-top: 12px;
    font-size: 14px;
    line-height: 1.5;
  }
  .tunnel-actions {
    margin-top: 16px;
  }
  .tunnel-hint {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .tunnel-card-link,
  .tunnel-card-media img,
  .tunnel-card-title .ico {
    transition: none;
  }
  .tunnel-hint-line::after {
    animation: none;
  }
}
