:root {
  --bg: #0a0a0a;
  --ink: #f4f4f4;
  --muted: #7d7d7d;
  --faint: #2a2a2a;
  --hair: rgba(244, 244, 244, 0.12);
  --ascii: #d0d0d0;
  --ascii-dim: rgba(244, 244, 244, 0.08);
  --accent: #ff6a1f;
  --accent-soft: rgba(255, 106, 31, 0.16);
  --header-height: 3.75rem;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font-grotesk: "Non Natural Grotesk", "Helvetica Neue", sans-serif;
  --font-mono: "Non Natural Mono", "Roboto Mono", monospace;
  --font-display: "Mondwest", Georgia, serif;
}

@font-face {
  font-family: "Non Natural Grotesk";
  src: url("https://writing.dragonfly.xyz/fonts/Non%20Natural%20Grotesk%20-%20Regular/NON%20Natural%20Grotesk-Regular.woff2")
    format("woff2");
  font-display: swap;
  font-weight: 500;
  font-style: normal;
}

@font-face {
  font-family: "Non Natural Grotesk";
  src: url("https://writing.dragonfly.xyz/fonts/Non%20Natural%20Grotesk%20-%20Bold/NON%20Natural%20Grotesk-Bold.woff2")
    format("woff2");
  font-display: swap;
  font-weight: 700;
  font-style: normal;
}

@font-face {
  font-family: "Non Natural Mono";
  src: url("https://writing.dragonfly.xyz/fonts/Non%20Natural%20Mono%20-%20Light/NON%20Natural%20Mono-Light.woff2")
    format("woff2");
  font-display: swap;
  font-weight: 400;
  font-style: normal;
}

@font-face {
  font-family: "Mondwest";
  src: url("https://writing.dragonfly.xyz/fonts/Mondwest%20-%20Regular/Mondwest-Regular.woff2")
    format("woff2");
  font-display: swap;
  font-weight: 400;
  font-style: normal;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  height: 100%;
  max-width: 100%;
  overflow-x: clip;
}

body {
  height: 100%;
  max-width: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-grotesk);
  font-weight: 500;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: radial-gradient(
    120% 120% at 50% 40%,
    transparent 60%,
    rgba(0, 0, 0, 0.55) 100%
  );
  mix-blend-mode: multiply;
}

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 4;
  padding: clamp(1.25rem, 3vw, 2rem) clamp(1.5rem, 6vw, 8rem);
  opacity: 0;
  animation: rise 1s var(--ease) forwards;
  animation-delay: 0.35s;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(0.5rem, 1.5vw, 1rem);
}

.site-nav__link {
  position: relative;
  font-family: var(--font-mono);
  font-size: clamp(0.8rem, 1.4vw, 0.95rem);
  letter-spacing: 0.02em;
  text-transform: lowercase;
  text-decoration: none;
  color: var(--muted);
  padding: 0.25rem 0.55rem;
  border-radius: 4px;
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}

/* Orange tag-style highlight on hover */
.site-nav__link:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

.site-nav__link.is-disabled {
  color: var(--faint);
  cursor: default;
  pointer-events: none;
}

.site-nav__link.is-active {
  color: var(--accent);
}

.site-nav__link.is-active::after {
  content: "";
  position: absolute;
  left: 0.55rem;
  right: 0.55rem;
  bottom: 0;
  height: 1.5px;
  background: var(--accent);
}

.site-nav__link--external {
  display: inline-flex;
  align-items: center;
  gap: 0.28em;
}

.site-nav__arrow {
  font-size: 0.72em;
  line-height: 1;
  transition: transform 0.2s var(--ease);
}

.site-nav__link--external:hover .site-nav__arrow {
  transform: translate(1px, -1px);
}

.stage {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 35rem);
  align-items: center;
  gap: clamp(1.25rem, 2.5vw, 2.25rem);
  width: 100%;
  max-width: 1220px;
  margin: 0 auto;
  padding: clamp(1.5rem, 6vw, 8rem);
  padding-top: calc(var(--header-height) + clamp(1rem, 3vw, 2rem));
  box-sizing: border-box;
}

.intro {
  min-width: 0;
  max-width: 46rem;
  width: 100%;
}

/* ASCII cladogenesis panel — right */
.clado-art {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  min-width: 0;
  max-width: 100%;
  width: 100%;
  opacity: 0;
  animation: artIn 0.85s var(--ease) forwards;
  animation-delay: 0.15s;
}

@keyframes artIn {
  from {
    opacity: 0;
    transform: translateX(1.5rem);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.clado-art__frame {
  position: relative;
  width: 100%;
  max-width: 40rem;
  min-width: 0;
  padding: clamp(1.25rem, 2.5vw, 2rem);
  background: transparent;
  overflow: hidden;
}

/* Soft, natural edge that fades the stream into the page rather than a hard box */
.clado-art__frame::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    120% 100% at 60% 40%,
    transparent 55%,
    var(--bg) 100%
  );
}

.clado-art__canvas {
  position: relative;
  z-index: 1;
  display: block;
  width: max-content;
  max-width: none;
  margin-inline: auto;
  font-family: var(--font-mono);
  font-size: clamp(0.6rem, 1.15vw, 0.82rem);
  font-weight: 400;
  line-height: 1.22;
  letter-spacing: 0.05em;
  color: var(--ascii);
  white-space: pre;
  user-select: none;
  text-align: center;
}

/* Binary token layers — monochrome, orange marks the live/tagged events */
.b-rain {
  color: rgba(244, 244, 244, 0.1);
}

.b-rain-head {
  color: rgba(244, 244, 244, 0.42);
}

.b-line {
  color: rgba(244, 244, 244, 0.68);
}

.b-node {
  color: var(--accent);
  text-shadow:
    0 0 10px rgba(255, 106, 31, 0.65),
    0 0 20px rgba(255, 106, 31, 0.3);
}

.b-tip {
  color: #ffffff;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.45);
}

.b-dead {
  color: rgba(244, 244, 244, 0.18);
}

.b-word {
  color: rgba(244, 244, 244, 0.28);
}

.title {
  font-family: var(--font-grotesk);
  font-style: normal;
  font-weight: 700;
  line-height: 0.9;
  font-size: clamp(1.6rem, 6.5vw, 5rem);
  letter-spacing: -0.02em;
  text-transform: uppercase;
  margin-bottom: clamp(1rem, 3vw, 1.6rem);
}

.title__word {
  display: inline-block;
  position: relative;
  color: var(--ink);
  opacity: 0;
  transform: translateY(0.35em);
  filter: blur(14px);
  animation: titleIn 1.6s var(--ease) forwards;
  animation-delay: 0.9s;
}

@keyframes titleIn {
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

.tagline {
  font-family: var(--font-grotesk);
  font-weight: 500;
  font-size: clamp(0.72rem, 1vw, 0.85rem);
  line-height: 1.2;
  letter-spacing: 0;
  position: relative;
  padding-left: 0.1rem;
  color: var(--muted);
}

.definition__head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: clamp(1.5rem, 3vw, 2rem);
}

.intro-rise {
  opacity: 0;
  animation: rise 0.85s var(--ease) forwards;
}

.tagline.intro-rise {
  animation-delay: 0.15s;
}

.definition__lemma.intro-rise {
  animation-delay: 0.35s;
}

.definition__pos.intro-rise {
  animation-delay: 0.55s;
}

.definition__body-part.intro-rise {
  animation-delay: 0.75s;
}

.definition__body-part.intro-rise + .definition__divider + .definition__body-part {
  animation-delay: 1.05s;
}

.definition__divider.intro-rise {
  transform: scaleX(0);
  transform-origin: left;
  animation: lineReveal 0.7s var(--ease) forwards;
  animation-delay: 0.92s;
}

.definition__lemma {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 1rem;
}

.definition__word {
  font-family: var(--font-display);
  font-style: normal;
  font-size: clamp(2rem, 5.5vw, 3.75rem);
  line-height: 1;
  color: var(--ink);
  text-transform: lowercase;
  cursor: default;
  transition: color 0.08s ease-out;
}

.definition__word:hover {
  color: var(--accent);
}

.definition__pron {
  font-family: var(--font-mono);
  font-size: clamp(0.78rem, 1.6vw, 1.05rem);
  color: var(--muted);
  letter-spacing: 0;
  text-transform: uppercase;
}

.definition__pos {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--hair);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}

.definition__body {
  max-width: 40rem;
}

.definition__body-part {
  font-family: var(--font-grotesk);
  font-weight: 500;
  font-size: clamp(0.75rem, 1.2vw, 1rem);
  line-height: 1.5;
  letter-spacing: 0;
  color: #cfcfcf;
}

.definition__term {
  cursor: default;
  transition: color 0.05s linear;
}

.definition__term:hover {
  color: var(--accent);
}

.definition__divider {
  display: block;
  width: 100%;
  max-width: 12rem;
  height: 1px;
  margin: 1.1rem 0;
  background: var(--hair);
}

.footer {
  position: fixed;
  left: clamp(1.5rem, 6vw, 8rem);
  bottom: clamp(1.25rem, 3vw, 2.25rem);
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-family: var(--font-mono);
  font-size: clamp(0.62rem, 1vw, 0.72rem);
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0;
  animation: rise 1.2s var(--ease) forwards;
  animation-delay: 2.3s;
}

.footer__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(1.4rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes lineReveal {
  from {
    opacity: 0;
    transform: scaleX(0);
  }
  to {
    opacity: 1;
    transform: scaleX(1);
  }
}

@keyframes lineGrowFull {
  to {
    width: 100%;
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.3;
    transform: scale(0.85);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

@media (max-width: 900px) {
  :root {
    --header-height: 4.25rem;
  }

  .site-header {
    padding: 1.1rem 1.25rem;
  }

  .stage {
    grid-template-columns: minmax(0, 1fr);
    padding: 1.25rem;
    padding-top: calc(var(--header-height) + 1rem);
    padding-bottom: 4.5rem;
    gap: 0;
  }

  .definition__lemma {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.45rem;
  }

  .definition__word {
    font-size: clamp(1.85rem, 9.5vw, 2.75rem);
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .definition__pron {
    font-size: clamp(0.72rem, 3vw, 0.88rem);
  }

  .definition__body-part {
    font-size: clamp(0.9rem, 3.8vw, 1rem);
  }

  .tagline {
    font-size: clamp(0.78rem, 3.2vw, 0.88rem);
  }

  .clado-art {
    justify-content: center;
    order: 1;
    max-width: 100%;
    margin-top: clamp(1.75rem, 6vw, 2.75rem);
  }

  .clado-art__frame {
    max-width: 100%;
    padding: 0.35rem 0;
  }

  .clado-art__canvas {
    font-size: 0.52rem;
    letter-spacing: 0.03em;
  }

  .footer {
    left: 1.25rem;
    right: 1.25rem;
    bottom: 1.1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-delay: 0ms !important;
  }

  .intro-rise {
    opacity: 1;
    transform: none;
  }

  .clado-art {
    opacity: 1;
    transform: none;
  }
}
