/* Terminal Page */
.terminal-screen {
  font-size: var(--content-zoom);
  transition: font-size 0.3s ease;
}

.terminal-view {
  justify-content: center;
  position: relative;
}

.terminal-window {
  position: relative;
  z-index: 10;
}

.terminal-window > .gtk-headerbar {
  box-shadow: var(--header-shadow);
}

.terminal-screen {
  flex: 1;
  min-height: 0;
  padding: clamp(1rem, 3vw, 2rem);
  overflow-y: auto;
  background: #141414;
  color: #d6f5df;
  font-family: 'JetBrainsMono Nerd Font', ui-monospace, SFMono-Regular, Consolas, monospace;
  line-height: 1.32;
  user-select: text;
  -webkit-user-select: text;
}

body.light-mode .terminal-screen {
  background: #f4f7f4;
  color: #14301f;
}

.terminal-output {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.terminal-line {
  margin: 0 0 0.12rem;
  min-height: 1.32em;
}

.terminal-command {
  color: #8ff0a4;
  margin-top: 0.9rem;
  margin-bottom: 0.35rem;
}

body.light-mode .terminal-command {
  color: #1a6b35;
}

.terminal-muted {
  color: rgba(214, 245, 223, 0.68);
}

body.light-mode .terminal-muted {
  color: rgba(20, 48, 31, 0.65);
}

.terminal-error {
  color: #ff7b72;
}

.terminal-formatted-line a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

body.light-mode .terminal-formatted-line a {
  color: inherit;
}

.terminal-formatted-line .katex {
  font-size: 1.05em;
}

.terminal-heading,
.terminal-quote {
  font-weight: 700;
}

.terminal-inline-code {
  color: #6f7f76;
  font: inherit;
}

body.light-mode .terminal-inline-code {
  color: #6b756f;
}

.terminal-code-separator {
  display: block;
  width: 100%;
  height: 1.32em;
  min-height: 1.32em;
  margin: 0.45rem 0;
  white-space: nowrap;
  opacity: 0.75;
  overflow: hidden;
}

.terminal-code-separator::before {
  content: "----------------------------------------------------------------------------------------------------";
}

.terminal-highlight .highlight {
  margin: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  overflow: visible;
}

.terminal-highlight .highlight pre,
.terminal-highlight .chroma,
.terminal-plain-code {
  margin: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  overflow: visible;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.terminal-highlight code,
.terminal-plain-code code {
  font: inherit;
  white-space: pre-wrap;
}

.terminal-highlight .line,
.terminal-highlight .cl {
  display: inline;
  white-space: pre-wrap;
}

.terminal-image-frame {
  margin: 0.45rem auto 0.75rem;
  max-width: min(100%, 760px);
}

.terminal-image-frame img {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  max-height: 52vh;
  height: auto;
  border: 1px solid rgba(214, 245, 223, 0.25);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.25);
}

body.light-mode .terminal-image-frame img {
  border-color: rgba(20, 48, 31, 0.2);
  background: rgba(255, 255, 255, 0.45);
}

.terminal-input-row {
  display: flex;
  gap: 0.65rem;
  align-items: baseline;
  margin-top: 0.9rem;
  margin-bottom: 0.35rem;
}

.terminal-prompt {
  flex: 0 0 auto;
  color: #57e389;
  font-weight: 700;
}

body.light-mode .terminal-prompt {
  color: #207442;
}

.terminal-input {
  flex: 1;
  min-width: 4rem;
  border: 0;
  outline: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  padding: 0;
}

/* Code Block Copy Button */

.highlight {
  position: relative;
}

.copy-code-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  width: 32px;
  height: 32px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s, background-color 0.2s;
  z-index: 10;
}

.highlight:hover .copy-code-btn,
.copy-code-btn.copied {
  opacity: 1;
}

.copy-code-btn:hover {
  background: var(--bg-alpha-10);
}

.copy-code-btn img {
  width: 16px;
  height: 16px;
  filter: invert(1);
  box-shadow: none;
  border-radius: 0;
  margin: 0;
}

body.light-mode .copy-code-btn img {
  filter: invert(0);
}
