/* Site-wide touches: mobile menu, scroll progress keycap, availability status, typed headline, keycap confetti. */

/* Mobile menu */
.nav-toggle {
  display: none;
}

@media (max-width: 860px) {
  .nav-toggle {
    position: relative;
    z-index: 61;
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    margin-left: auto;
    border: 1px solid var(--line-strong);
    border-radius: 14px;
    background: transparent;
    cursor: pointer;
  }

  .nav-toggle span {
    position: absolute;
    width: 20px;
    height: 2px;
    border-radius: 2px;
    background: var(--text);
    transition: transform 0.3s ease, opacity 0.2s;
  }

  .nav-toggle span:first-child { transform: translateY(-4px); }
  .nav-toggle span:last-child { transform: translateY(4px); }
  .nav-toggle[aria-expanded='true'] span:first-child { transform: rotate(45deg); }
  .nav-toggle[aria-expanded='true'] span:last-child { transform: rotate(-45deg); }

  .site-nav {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    padding: calc(var(--header-h) + 24px) 24px 40px;
    background: rgba(14, 13, 20, 0.97);
    clip-path: circle(0 at calc(100% - 44px) 38px);
    visibility: hidden;
    transition: clip-path 0.55s cubic-bezier(0.7, 0, 0.2, 1), visibility 0s linear 0.55s;
  }

  .site-nav.is-open {
    clip-path: circle(150% at calc(100% - 44px) 38px);
    visibility: visible;
    transition: clip-path 0.55s cubic-bezier(0.7, 0, 0.2, 1), visibility 0s;
  }

  .site-nav ul {
    flex-direction: column;
    align-items: flex-start;
    gap: 24px;
    width: 100%;
  }

  .site-nav li:not(:last-child) {
    display: block;
  }

  .site-nav a:not(.btn) {
    font-size: 36px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text);
  }

  .site-nav li {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.4s ease, transform 0.4s ease;
  }

  .site-nav.is-open li {
    opacity: 1;
    transform: none;
  }

  .site-nav.is-open li:nth-child(2) { transition-delay: 0.06s; }
  .site-nav.is-open li:nth-child(3) { transition-delay: 0.12s; }
  .site-nav.is-open li:nth-child(4) { transition-delay: 0.18s; }
  .site-nav.is-open li:nth-child(5) { transition-delay: 0.24s; }

  .site-nav .btn {
    min-height: 56px;
    padding: 0 28px;
    font-size: 18px;
  }
}

@media (max-width: 860px) {
  .pill-extra {
    display: none;
  }
}

/* Scroll progress with a keycap that types while you scroll */
.scroll-progress {
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  z-index: 49;
  height: 3px;
  pointer-events: none;
  --p: 0;
}

.scroll-progress-bar {
  height: 100%;
  width: calc(var(--p) * 100%);
  background: var(--accent);
}

.scroll-progress-key {
  position: absolute;
  top: -8px;
  left: calc(var(--p) * 100%);
  width: 18px;
  height: 18px;
  margin-left: -9px;
  border-radius: 5px;
  background: var(--accent);
  box-shadow: 0 3px 0 var(--accent-side);
  transition: transform 0.08s, box-shadow 0.08s;
}

.scroll-progress.is-typing .scroll-progress-key {
  animation: key-press 0.22s steps(1) infinite;
}

@keyframes key-press {
  50% {
    transform: translateY(2px);
    box-shadow: 0 1px 0 var(--accent-side);
  }
}

/* Availability status */
.status-dot {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-radius: 50%;
  background: #4BE0A0;
  box-shadow: 0 0 0 0 rgba(75, 224, 160, 0.5);
  animation: status-pulse 2s infinite;
}

.status-dot.is-away {
  background: var(--faint);
  animation: none;
}

@keyframes status-pulse {
  70% { box-shadow: 0 0 0 8px rgba(75, 224, 160, 0); }
  100% { box-shadow: 0 0 0 0 rgba(75, 224, 160, 0); }
}

/* Headline typed on screen */
.type-host {
  position: relative;
}

.type-ghost {
  visibility: hidden;
}

.type-live {
  position: absolute;
  top: 0;
  left: 0;
}

.type-live::after {
  content: '';
  display: inline-block;
  width: 0.07em;
  height: 0.8em;
  margin-left: 0.05em;
  vertical-align: baseline;
  background: var(--accent);
  animation: caret 1s steps(1) infinite;
}

@keyframes caret {
  50% { opacity: 0; }
}

/* Keycap confetti */
.confetti-key {
  position: fixed;
  z-index: 100;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--key);
  box-shadow: 0 3px 0 var(--key-edge);
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  pointer-events: none;
}

.confetti-key.is-blue {
  background: var(--accent-fill);
  box-shadow: 0 3px 0 var(--accent-side);
  color: #fff;
}

@media (prefers-reduced-motion: reduce) {
  .scroll-progress-key,
  .status-dot,
  .type-live::after {
    animation: none !important;
  }
}
