/* Isolated ASCII wordmark. Master canvas is the traced reference: 1024×768.
   Cropped to the letterforms and scaled as a cutout — no panel, no field. */

.ascii-logo-fit {
  position: relative;
  z-index: 2;
  flex: 0 1 auto;
  align-self: center;
  width: min(76%, calc((100svh - 13rem) * 854 / 640));
  max-height: calc(100svh - 13rem);
  min-height: 0;
  aspect-ratio: 854 / 640;
  margin: 1vh auto 6vh;
  grid-column: 1 / -1;
  grid-row: 1;
  justify-self: center;
  align-self: center;
  overflow: hidden;
  background: transparent;
  pointer-events: none;
}

.ascii-logo-stage {
  position: absolute;
  top: 0;
  left: 0;
  width: 1024px;
  height: 768px;
  margin: 0;
  padding: 0;
  overflow: visible;
  background: transparent;
  transform-origin: 0 0;
  border: 0;
  box-shadow: none;
}

.ascii-logo {
  position: absolute;
  top: 3px;
  left: 0;
  z-index: 1;
  margin: 0;
  padding: 0;
  color: #14120f;
  font-family: Consolas, "Courier New", Courier, "Liberation Mono", monospace;
  font-size: 10px;
  font-weight: 400;
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "calt" 0;
  font-kerning: none;
  letter-spacing: calc(8px - 1ch);
  line-height: 8px;
  white-space: pre;
  tab-size: 8;
  overflow: visible;
  background: transparent;
  transform: translate(-1px, -2px);
  text-shadow: none;
}

.ascii-logo-ref {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 1024px;
  height: 768px;
  object-fit: fill;
  pointer-events: none;
  opacity: 0;
}

.ascii-logo-stage[data-mode="ref"] .ascii-logo {
  opacity: 0;
}

.ascii-logo-stage[data-mode="ref"] .ascii-logo-ref,
.ascii-logo-stage[data-mode="overlay"] .ascii-logo-ref {
  opacity: 1;
}

.ascii-logo-stage[data-mode="overlay"] .ascii-logo-ref {
  opacity: 0.5;
  mix-blend-mode: multiply;
}

.ascii-logo-stage[data-mode="blink"] .ascii-logo-ref {
  opacity: 0;
}

.ascii-logo-stage[data-mode="blink"].is-ref .ascii-logo-ref {
  opacity: 1;
}

.ascii-logo-stage[data-mode="blink"].is-ref .ascii-logo {
  opacity: 0;
}

/* ---- intro: a full-viewport field of spinning glyphs. It holds, then
   speckles away in place. html.is-ascii-intro is on from first paint. */

/* ---- intro: a full-viewport field of spinning glyphs. It holds, then
   speckles away in place. html.is-ascii-intro is on from first paint.
   Do not hide overflow on html — that removes the scrollbar for one
   second, then it returns and shoves the page sideways. Lock the body
   instead; html keeps overflow-y: scroll so the gutter never changes. */

html.is-ascii-intro,
html.is-ascii-intro body {
  background: var(--field, #f6f6f4);
}

html.is-ascii-intro body {
  overflow: hidden;
  width: 100%;
}

.menu-btn,
.scroll-meter {
  transition: opacity 820ms 60ms cubic-bezier(0.16, 1, 0.3, 1);
}

html.is-ascii-intro .ascii-logo-fit,
html.is-ascii-intro .title__glitch,
html.is-ascii-intro .menu-btn,
html.is-ascii-intro .site-menu,
html.is-ascii-intro .scroll-meter,
html.is-ascii-intro .title__practices,
html.is-ascii-intro .title__record li {
  opacity: 0;
  pointer-events: none;
  transition: none;
}

html.is-ascii-intro .ascii-logo-fit,
html.is-ascii-ready .ascii-logo-fit {
  transition: none;
}

html.is-ascii-intro .ascii-logo-fit,
html.is-ascii-intro .title .ascii-logo-fit {
  opacity: 0 !important;
  visibility: visible;
  pointer-events: none;
  transition: none;
}

html.is-ascii-handoff .ascii-logo-fit {
  opacity: 1 !important;
  visibility: visible !important;
}

html.is-ascii-handoff .ascii-intro {
  background: transparent;
  pointer-events: none;
}

html.is-ascii-handoff .title__glitch,
html.is-ascii-handoff .menu-btn,
html.is-ascii-handoff .site-menu,
html.is-ascii-handoff .scroll-meter {
  opacity: 0;
  pointer-events: none;
  transition: none;
}

.ascii-intro {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  height: 100svh;
  min-height: -webkit-fill-available;
  z-index: 120;
  overflow: hidden;
  background: var(--field, #f6f6f4);
  color: #14120f;
  pointer-events: auto;
  touch-action: none;
  overscroll-behavior: none;
}

.ascii-intro.is-done {
  display: none;
}

.ascii-intro.is-clearing {
  background: transparent;
  transition: background-color 420ms cubic-bezier(0.22, 0.72, 0.18, 1);
}

.ascii-intro.is-exiting {
  pointer-events: none;
  background: transparent;
  animation: ascii-wall-fade 560ms cubic-bezier(0.22, 0.72, 0.18, 1) forwards;
}

@keyframes ascii-wall-fade {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

.ascii-intro__grid {
  position: absolute;
  margin: 0;
  padding: 0;
  color: #14120f;
  font-family: Consolas, "Courier New", Courier, "Liberation Mono", monospace;
  font-size: 10px;
  font-weight: 400;
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "calt" 0;
  font-kerning: none;
  letter-spacing: calc(8px - 1ch);
  line-height: 8px;
  white-space: pre;
  tab-size: 8;
  background: transparent;
  transform: scale(var(--intro-s, 1));
  transform-origin: 0 0;
  will-change: transform;
  -webkit-font-smoothing: none;
  -webkit-text-size-adjust: 100%;
}

/* ---- after the intro: the mark stays live --------------------------------
   Each line is its own row so a tear can slide in pixel space without
   scrambling the drawing. Echoes are a brief channel split, not a wash. */

.ascii-logo-row {
  display: block;
  height: 8px;
  margin: 0;
  padding: 0;
  overflow: visible;
  line-height: 8px;
  white-space: pre;
}

.ascii-logo--echo {
  z-index: 2;
  opacity: 0;
  pointer-events: none;
  text-shadow: none;
}

.ascii-logo--echo-a {
  color: #39548f;
  mix-blend-mode: multiply;
  transform: translate(calc(-1px + var(--echo-ax, 0px)), -2px);
}

.ascii-logo--echo-b {
  color: #3d5a6e;
  mix-blend-mode: multiply;
  transform: translate(calc(-1px + var(--echo-bx, 0px)), -2px);
}

html.is-ascii-ready .ascii-logo-fit.is-alive .ascii-logo {
  animation: none;
}

html.is-ascii-ready .ascii-logo-fit {
  z-index: 8;
  pointer-events: auto;
  cursor: crosshair;
  opacity: 1;
}

@media (max-width: 720px) {
  .ascii-logo-fit {
    flex: 0 0 auto;
    align-self: center;
    width: min(96vw, calc((100svh - 8.5rem) * 854 / 640));
    max-height: min(48svh, calc(100svh - 8.5rem));
    min-width: 0;
    margin: -5.45rem 0 0;
  }

  .ascii-intro {
    width: 100%;
    left: 0;
    right: 0;
  }
}

.ascii-debris {
  display: none !important;
  position: fixed;
  left: 0;
  top: 0;
  /* Under .chapters (7) and the footer — over the title, so knock-off
     glyphs stay visible on the opening screen, then slide behind the
     paper and the dark foot as those blocks come up. */
  z-index: 4;
  margin: 0;
  padding: 0;
  color: #14120f;
  font-family: Consolas, "Courier New", Courier, "Liberation Mono", monospace;
  font-weight: 400;
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "calt" 0;
  font-kerning: none;
  white-space: pre;
  pointer-events: none;
  will-change: transform;
  opacity: calc(1 - var(--title-exit, 0));
}
