:root {
  color-scheme: dark;
  --bg: #08090c;
  --site-frame: rgba(255, 255, 255, 0.16);
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background: var(--bg);
  touch-action: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 10;
  border: 1px solid var(--site-frame);
  pointer-events: none;
}

#ascii-bg {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  z-index: 0;
  opacity: 0.72;
  filter: contrast(0.96) brightness(0.9);
  pointer-events: none;
}

.bird-layer {
  position: fixed;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
}

.ascii-bird {
  position: absolute;
  left: 0;
  top: var(--bird-y);
  color: rgba(215, 215, 215, 0.26);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: var(--bird-size);
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.04);
  white-space: pre;
  transform: translate3d(var(--bird-start), 0, 0);
  animation: bird-fly var(--bird-duration) linear infinite;
  animation-delay: var(--bird-delay);
  will-change: transform;
}

.ascii-bird[data-direction="-1"] {
  animation-name: bird-fly-reverse;
}

@keyframes bird-fly {
  from { transform: translate3d(-12rem, 0, 0); }
  to { transform: translate3d(calc(100vw + 12rem), 0, 0); }
}

@keyframes bird-fly-reverse {
  from { transform: translate3d(calc(100vw + 12rem), 0, 0); }
  to { transform: translate3d(-12rem, 0, 0); }
}

.site-menu {
  position: fixed;
  top: clamp(1rem, 2.8vw, 1.65rem);
  right: clamp(1rem, 2.8vw, 1.65rem);
  z-index: 20;
  font-family: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
}

.menu-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-width: 5.35rem;
  min-height: 2.15rem;
  padding: 0.58rem 0.74rem 0.52rem;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: rgba(232, 232, 232, 0.82);
  box-shadow: none;
  cursor: pointer;
  font: inherit;
  font-size: clamp(0.82rem, 1.25vw, 1.08rem);
  font-weight: 900;
  letter-spacing: -0.075em;
  line-height: 0.9;
  text-transform: uppercase;
  -webkit-text-stroke: 1px rgba(0, 0, 0, 0.92);
  paint-order: stroke fill;
  text-shadow:
    0 1px 0 rgba(0, 0, 0, 0.95),
    0 0 2px rgba(0, 0, 0, 0.95),
    0 0 22px rgba(255, 255, 255, 0.055),
    0 12px 34px rgba(0, 0, 0, 0.82);
  transition:
    border-color 180ms ease,
    color 180ms ease,
    transform 180ms ease;
}

.menu-button:hover,
.menu-button:focus-visible,
.site-menu.is-open .menu-button {
  border-color: transparent;
  background: transparent;
  color: rgba(255, 255, 255, 0.96);
}

.menu-button:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.55);
  outline-offset: 3px;
}

.menu-button__mark {
  display: inline-block;
  font-size: 0.92rem;
  line-height: 0.7;
  transform: translateY(-0.03rem);
  transition: transform 180ms ease;
}

.site-menu.is-open .menu-button__mark {
  transform: translateY(-0.03rem) rotate(45deg);
}

.menu-panel {
  position: absolute;
  top: calc(100% + 0.55rem);
  right: 0;
  display: grid;
  min-width: 10.5rem;
  padding: 0.42rem 0.62rem;
  border: 1px solid transparent;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.menu-panel[hidden] {
  display: none;
}

.menu-panel a,
.menu-panel__message {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin: 0;
  padding: 0.52rem 0.1rem;
  border-radius: 0;
  color: rgba(255, 255, 255, 0.96);
  font-size: clamp(0.82rem, 1.25vw, 1.08rem);
  font-weight: 900;
  letter-spacing: -0.075em;
  line-height: 0.9;
  text-decoration: none;
  text-transform: uppercase;
  -webkit-text-stroke: 1px rgba(0, 0, 0, 0.92);
  paint-order: stroke fill;
  text-shadow:
    0 1px 0 rgba(0, 0, 0, 0.95),
    0 0 2px rgba(0, 0, 0, 0.95),
    0 0 22px rgba(255, 255, 255, 0.055),
    0 12px 34px rgba(0, 0, 0, 0.82);
  transition:
    color 160ms ease,
    transform 160ms ease;
}

.menu-panel a::after {
  content: none;
}

.menu-panel a:hover,
.menu-panel a:focus-visible {
  background: transparent;
  color: rgba(255, 255, 255, 0.96);
  transform: translateX(-0.08rem);
}

.menu-panel a:focus-visible {
  outline: 1px solid rgba(255, 255, 255, 0.45);
  outline-offset: 2px;
}

.site-name {
  position: fixed;
  left: 81%;
  bottom: clamp(1.35rem, 3.4vh, 2.6rem);
  z-index: 2;
  margin: 0;
  transform: translateX(-50%);
  font-family: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  font-size: clamp(0.9rem, 2.1vw, 2.05rem);
  font-weight: 700;
  line-height: 0.9;
  letter-spacing: -0.075em;
  white-space: nowrap;
  color: rgba(226, 226, 226, 0.88);
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.12),
    0 0 22px rgba(255, 255, 255, 0.055),
    0 12px 34px rgba(0, 0, 0, 0.7);
  mix-blend-mode: screen;
  pointer-events: none;
}

@media (max-width: 700px) {
  #ascii-bg {
    opacity: 0.9;
    filter: contrast(1.08) brightness(0.98);
  }

  .ascii-bird {
    color: rgba(235, 235, 235, 0.44);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.12);
  }

  .site-menu {
    top: max(0.9rem, env(safe-area-inset-top));
    right: max(0.9rem, env(safe-area-inset-right));
    left: auto;
    transform: none;
  }

  .menu-button {
    min-width: 5rem;
    min-height: 2rem;
    padding: 0.54rem 0.66rem 0.49rem;
    font-size: 0.86rem;
  }

  .menu-panel a,
  .menu-panel__message {
    font-size: 0.86rem;
  }

  .menu-panel {
    min-width: min(10rem, calc(100vw - 1.8rem));
  }

  .site-name {
    right: max(1rem, env(safe-area-inset-right));
    bottom: max(1.1rem, env(safe-area-inset-bottom));
    left: auto;
    transform: none;
    font-size: clamp(0.78rem, 3.25vw, 0.98rem);
    letter-spacing: -0.065em;
  }
}
