/* ───────── terminal ───────── */
.terminal {
  box-shadow: 0 0.0625rem 0 var(--border), 0 1.875rem 3.75rem -1.875rem rgba(0, 0, 0, 0.45);
  overflow: hidden;
}
.terminal .chrome {
  display: flex;
  align-items: center;
  gap: var(--space-s);
  padding: var(--space-s) var(--space-m);
  border-bottom: thin solid var(--term-line);
}
.terminal .chrome > span:not(.title) {
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 50%;
  background: var(--dot);
  opacity: 0.85;
}
.terminal .chrome > :nth-child(1) { --dot: #ff5f57; }
.terminal .chrome > :nth-child(2) { --dot: #febc2e; }
.terminal .chrome > :nth-child(3) { --dot: #28c840; }
.terminal .chrome .title { font-size: var(--text-label); color: var(--term-dim); white-space: nowrap; }
.terminal pre {
  overflow-x: auto;
  white-space: pre;
  font: inherit;
  tab-size: 2;
}
/* output and syntax colors; .glyph is the same marks outside a terminal */
.terminal :is(.prompt, .dim, .c) { color: var(--term-dim); }
.terminal :is(.add, .ok, .s), .glyph.add { color: var(--term-add); }
.terminal .mod, .glyph.mod { color: var(--term-mod); }
.glyph.del { color: var(--term-del); }
.terminal .k { color: #ff8a65; }
.terminal .c { font-style: italic; }
.terminal .hl { color: var(--accent); }
.caret {
  display: inline-block;
  width: 0.55em;
  height: 1.05em;
  vertical-align: -0.17em;
  background: var(--term-fg);
  animation: blink 1s steps(1) infinite;
}

/* copy-on-hover button for terminals */
.terminal .cp {
  position: absolute;
  top: 0.55rem;
  right: 0.7rem;
  background: var(--term-line);
  color: var(--term-dim);
  border-radius: var(--radius-s);
  font-size: var(--text-label);
  opacity: 0;
}
.terminal:hover .cp, .terminal .cp:focus-visible { opacity: 1; }
.terminal .cp:hover { color: var(--term-fg); }
@media (hover: none) { .terminal .cp { opacity: 1; } }

/* demo with tabs */
.demo { margin-top: clamp(2rem, 5vw, 3.5rem); }
.tabs { margin: 0 0 0.9rem; }
.tab { color: var(--muted); }
.tab:hover { color: var(--fg); border-color: var(--fg); }
.tabs .spacer { flex: 1; }
.switch {
  display: inline-flex;
  align-items: center;
  gap: var(--space-s);
  font-size: var(--text-small);
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.switch input { position: absolute; opacity: 0; }
.switch .knob {
  width: 2.2rem;
  height: 1.2rem;
  border: thin solid var(--border);
  position: relative;
}
.switch .knob::after {
  content: "";
  position: absolute;
  top: 0.125rem;
  left: 0.125rem;
  width: calc(1.2rem - 0.375rem);
  height: calc(1.2rem - 0.375rem);
  background: var(--muted);
}
.switch input:checked + .knob { background: var(--accent); border-color: var(--accent); }
.switch input:focus-visible + .knob { outline: 0.125rem solid var(--accent); outline-offset: 0.1875rem; }
.switch input:checked + .knob::after { transform: translateX(1rem); background: var(--accent-ink); }
.demo .terminal pre { min-height: 15.5rem; }
