/* A real terminal layout, not decorative monitor chrome. Shared type and paper
   tokens come from /site.css. The terminal UI stays monochrome like the site. */
.niri-guide {
  margin: 2rem 0 0;
  min-width: 0;
}

.niri-guide [hidden] {
  display: none !important;
}

.niri-guide button {
  appearance: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
}

.niri-guide button:hover {
  color: var(--ink);
}

.niri-guide button:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.niri-guide button:disabled {
  opacity: 0.4;
  cursor: default;
}

.niri-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  font-size: 0.78rem;
}

.niri-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
}

.niri-modes button {
  min-height: 44px;
  padding: 0.5rem 0;
  border-bottom: 1px solid transparent;
}

.niri-modes button[aria-pressed="true"] {
  color: var(--ink);
  border-color: var(--ink);
}

.niri-guide .niri-playback {
  flex: 0 0 4.5em;
  min-height: 44px;
  padding: 0.5rem 0;
  color: var(--muted);
  font-size: 0.72rem;
  text-align: right;
  white-space: nowrap;
}

.niri-playback::before {
  display: inline-block;
  width: 1.1em;
  margin-right: 0.3em;
  content: "Ⅱ";
}

.niri-guide[data-playing="false"] .niri-playback::before {
  content: "▷";
}

.niri-viewport {
  position: relative;
  height: clamp(280px, 36vw, 420px);
  overflow: hidden;
  contain: layout paint;
  background: #000;
  /* This is the actual six-pixel window geometry, not a monitor bezel. */
  border: 0;
  border-radius: var(--niri-window-radius, 6px);
  outline: none;
  box-shadow: none;
  color: #d5d5d5;
  font-size: clamp(9px, 0.88vw, 12px);
  line-height: 1.7;
  text-align: left;
  touch-action: pan-y;
}

.niri-viewport:focus,
.niri-viewport:focus-visible {
  outline: none;
  box-shadow: none;
}

.niri-workspaces,
.niri-workspace,
.niri-track {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.niri-workspace {
  overflow: hidden;
}

.niri-terminal {
  position: absolute;
  top: 0;
  bottom: 0;
  box-sizing: border-box;
  min-width: 0;
  padding: 1.6em 1.2em;
  overflow: hidden;
  border: 0;
  border-radius: var(--niri-window-radius, 6px);
  background: #000;
  /* No inactive border. Only the focused window gets the configured subtle
     half-pixel ring, simplified to a single ink density at this scale. */
  box-shadow: none;
}

.niri-terminal[data-focused="true"] {
  box-shadow: inset 0 0 0 0.5px #999;
}

.niri-terminal-heading {
  margin-bottom: 2.3em;
  color: #999;
  text-align: center;
  white-space: nowrap;
}

.niri-terminal-heading > span {
  display: block;
  overflow: hidden;
  color: #777;
  text-overflow: ellipsis;
}

.niri-terminal-body {
  max-height: calc(100% - 10em);
  overflow: hidden;
}

.niri-prompt {
  display: flex;
  gap: 0.5em;
  margin-bottom: 1.5em;
  color: #999;
}

.niri-prompt > span {
  color: #dedede;
}

.niri-tool {
  color: #c5c5c5;
}

.niri-tool > span {
  display: block;
  overflow: hidden;
  color: #999;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.niri-guide pre.niri-code {
  margin: 1em 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: none;
  color: #858585;
  font: inherit;
  line-height: inherit;
  white-space: pre;
}

.niri-output,
.niri-edit,
.niri-result {
  margin-top: 1em;
  color: #a0a0a0;
}

.niri-edit,
.niri-result {
  display: none;
}

.niri-terminal[data-phase="1"] .niri-edit,
.niri-terminal[data-phase="2"] .niri-edit,
.niri-terminal[data-phase="3"] .niri-edit,
.niri-terminal[data-phase="3"] .niri-result {
  display: block;
}

.niri-terminal[data-phase="3"] .niri-output,
.niri-terminal[data-phase="3"] .niri-code {
  display: none;
}

.niri-terminal-input {
  position: absolute;
  bottom: 3.3em;
  left: 1.2em;
  display: flex;
  align-items: center;
  gap: 0.35em;
  color: #aaa;
}

.niri-terminal-input i {
  width: 0.6em;
  height: 1.2em;
  background: #d5d5d5;
  opacity: 0;
}

.niri-terminal[data-focused="true"] .niri-terminal-input i {
  opacity: 1;
}

.niri-terminal-status {
  position: absolute;
  right: 1.2em;
  bottom: 1.2em;
  color: #858585;
}

.niri-terminal[data-phase="3"] .niri-terminal-status {
  color: #d5d5d5;
}

.niri-position {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.65rem;
  color: var(--muted);
  font-size: 0.68rem;
}

.niri-shortcuts {
  min-height: 3.75rem;
  margin-top: 1.4rem;
}

.niri-shortcuts > div {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.75rem;
}

.niri-guide .niri-shortcut {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 44px;
  padding: 0.35rem 0;
  color: var(--ink);
  font-size: 0.76rem;
}

.niri-shortcut-keys {
  display: inline-flex;
  gap: 0.2rem;
}

.niri-shortcut kbd {
  min-width: 1.7em;
  padding: 0.1em 0.35em;
  border-color: var(--rule);
  text-align: center;
}

.niri-shortcut:hover kbd,
.niri-shortcut[data-active="true"] kbd {
  border-color: var(--ink);
  background: var(--wash);
}

.niri-guide .niri-description {
  min-height: 3.3em;
  margin: 0.3rem 0 0;
  color: var(--ink);
  font-size: 0.84rem;
  line-height: 1.65;
}

.niri-guide figcaption {
  margin-top: 0.8rem;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.65;
  text-align: left;
}

.niri-announcement {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Window motion follows the configured 150ms ease-out. Workspace motion uses
   a sampled critically damped spring (damping 1, stiffness 4500), normalized
   over 180ms. No autonomous CSS animations. The controller sleeps entirely
   when paused, offscreen, or in a hidden tab. */
@media (prefers-reduced-motion: no-preference) {
  .niri-workspaces {
    transition: transform 180ms linear(0, 0.26655 8.33%, 0.5974 16.67%, 0.80369 25%, 0.9103 33.33%, 0.96068 41.67%, 0.98327 50%, 0.99305 58.33%, 0.99719 66.67%, 0.9989 75%, 0.9996 83.33%, 0.99989 91.67%, 1);
  }

  .niri-track {
    transition: transform var(--niri-column-duration, 150ms) cubic-bezier(0.16, 1, 0.3, 1);
  }

  .niri-terminal {
    transition: left var(--niri-column-duration, 150ms) cubic-bezier(0.16, 1, 0.3, 1), width var(--niri-column-duration, 150ms) cubic-bezier(0.16, 1, 0.3, 1);
  }
}

@media (max-width: 600px) {
  .niri-toolbar {
    align-items: flex-start;
    gap: 0.7rem;
    font-size: 0.72rem;
  }

  .niri-modes {
    gap: 0 1rem;
  }

  .niri-guide .niri-playback {
    font-size: 0.68rem;
  }

  .niri-viewport {
    height: 300px;
    font-size: 9px;
  }

  .niri-terminal {
    padding: 1.4em 0.65em;
  }

  .niri-terminal-input {
    left: 0.65em;
  }

  .niri-terminal-heading {
    margin-bottom: 2em;
  }

  .niri-prompt {
    display: block;
  }

  .niri-prompt > span {
    display: block;
    overflow-wrap: anywhere;
  }

  .niri-shortcuts > div {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.25rem 0.75rem;
  }

  .niri-shortcuts {
    min-height: 6.25rem;
    margin-top: 1rem;
  }

  .niri-guide .niri-description {
    min-height: 6.6em;
    font-size: 0.78rem;
  }

  .niri-position {
    font-size: 0.6rem;
  }
}
