/* The term view of an issue page: the issue as a Python session in a terminal
   window (_issue_term.html.j2). Loaded after style.css, whose tone colours
   (--good, --warn, --bad, --info, --neutral, --version) colour the values. */

.term {
  --t-bg: #fdfcf8;
  --t-bar: #efede6;
  --t-border: #dedbd2;
  --t-text: #24292f;
  --t-dim: #6e7781;
  --t-ps: #2456c7;
  --t-str: #0a6b44;
  --t-kw: #8250df;
  --t-fn: #b35900;
  --t-select: rgb(36 86 199 / 14%);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .term {
    --t-bg: #0b0e14;
    --t-bar: #161b22;
    --t-border: #2a303c;
    --t-text: #e6edf3;
    --t-dim: #8b949e;
    --t-ps: #ffd43b;
    --t-str: #7ee787;
    --t-kw: #d2a8ff;
    --t-fn: #ffa657;
    --t-select: rgb(255 212 59 / 16%);
  }
}

:root[data-theme="dark"] .term {
  --t-bg: #0b0e14;
  --t-bar: #161b22;
  --t-border: #2a303c;
  --t-text: #e6edf3;
  --t-dim: #8b949e;
  --t-ps: #ffd43b;
  --t-str: #7ee787;
  --t-kw: #d2a8ff;
  --t-fn: #ffa657;
  --t-select: rgb(255 212 59 / 16%);
}

/* The window: a title bar with three dots, then the session. */
.views .term {
  max-width: var(--page-width);
  margin: 8px auto 0;
  overflow: hidden;
  background: var(--t-bg);
  border: 1px solid var(--t-border);
  border-radius: 12px;
  box-shadow: 0 12px 40px -16px rgb(0 0 0 / 25%);
  color: var(--t-text);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.65;
}

.term ::selection {
  background: var(--t-select);
}

/* The dots on the left, the title centred in the window. */
.term-bar {
  display: grid;
  grid-template-columns: 1fr minmax(0, auto) 1fr;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--t-bar);
  border-bottom: 1px solid var(--t-border);
}

.term-dots {
  display: flex;
  gap: 7px;
}

/* Each dot has a ring a shade darker, so it keeps its edge on the light bar. */
.term-dots i {
  width: 12px;
  height: 12px;
  border: 1px solid #e0443e;
  border-radius: 50%;
  background: #ff5f57;
}

.term-dots i:nth-child(2) {
  border-color: #dea123;
  background: #febc2e;
}

.term-dots i:nth-child(3) {
  border-color: #1aab29;
  background: #28c840;
}

.term-title {
  overflow: hidden;
  color: var(--t-dim);
  font-size: 12px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.term-body {
  padding: 20px 28px 28px;
}

/* No specificity, so the margins below need none either. */
:where(.term) :where(p, h1, ul, pre) {
  margin: 0;
}

.term a {
  color: inherit;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
}

.term a:hover {
  color: var(--t-ps);
  text-decoration-color: currentColor;
}

/* The session */

.t-banner {
  margin-bottom: 18px;
  color: var(--t-dim);
}

.t-cmd {
  margin-top: 22px;
  font-weight: 650;
}

.t-cmd .t-comment-mark {
  font-weight: 400;
}

/* The prompts stay out of a copied selection. */
.t-ps {
  color: var(--t-ps);
  font-weight: 700;
  user-select: none;
}

.t-out {
  color: var(--t-text);
}

.t-issue {
  font-size: inherit;
  font-weight: 400;
  letter-spacing: 0;
}

.t-intro {
  max-width: 62ch;
  font-size: 17px;
  line-height: 1.55;
}

.t-dir a {
  text-decoration: none;
}

.t-dir a:hover .t-str {
  text-decoration: underline;
}

/* Values in the style of Python's syntax colouring */

.t-str {
  color: var(--t-str);
}

.t-kw {
  color: var(--t-kw);
}

.t-fn {
  color: var(--t-fn);
}

.t-const {
  color: var(--t-fn);
}

.t-op {
  color: var(--t-dim);
}

.t-good {
  color: var(--good);
}

.t-warn {
  color: var(--warn);
}

.t-bad {
  color: var(--bad);
}

.t-info {
  color: var(--info);
}

.t-neutral {
  color: var(--neutral);
}

.t-version {
  color: var(--version);
}

.t-was {
  opacity: 0.6;
}

.t-comment,
.t-comment-mark {
  color: var(--t-dim);
}

/* One PEP or release: [n], its number and title, its repr, then the note.
   The [n] hangs in the margin, so everything else lines up after it. */
.t-entry {
  padding: 16px 0 0 4ch;
}

.t-entry > .t-head {
  text-indent: -4ch;
}

.t-index {
  display: inline-block;
  width: 4ch;
  color: var(--t-dim);
  text-indent: 0;
}

.t-num {
  color: var(--t-dim);
}

.t-head .t-title {
  font-weight: 700;
  text-decoration: none;
}

.t-head a.t-title:hover {
  text-decoration: underline;
}

.t-repr {
  overflow-wrap: anywhere;
  color: var(--t-dim);
  font-size: 14px;
}

.t-text {
  margin-top: 8px;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
}

.t-entry-short .t-repr + .t-comment {
  margin-top: 0;
}

.t-code {
  margin-top: 10px;
  padding: 10px 14px;
  overflow-x: auto;
  background: var(--t-bar);
  border: 1px solid var(--t-border);
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.6;
}

/* Line numbers, for an example that defines a function or a class
   (render.code_gutter). Like the prompts, a copy leaves them out. */
.t-ln {
  color: var(--t-dim);
  user-select: none;
}

/* Code tokens (render.CODE_TOKENS), in the session's colours. */
.t-code .tok-kw {
  color: var(--t-kw);
}

.t-code .tok-str {
  color: var(--t-str);
}

.t-code .tok-const {
  color: var(--info);
}

.t-code .tok-fn {
  color: var(--t-fn);
}

.t-code .tok-cls {
  color: var(--version);
}

.t-code .tok-com {
  color: var(--t-dim);
  font-style: italic;
}

.t-scenario {
  margin-top: 10px;
  padding-left: 14px;
  border-left: 2px solid var(--t-border);
  font-family: var(--sans);
  font-size: 15px;
  white-space: pre-line;
}

.t-scenario .t-comment-mark {
  display: block;
  font-family: var(--mono);
  font-size: 13px;
}

.t-list {
  margin-top: 8px;
  padding-left: 0;
  font-family: var(--sans);
  font-size: 15px;
  list-style: none;
}

.t-list li {
  padding-left: 2ch;
  text-indent: -2ch;
}

.t-list li::before {
  content: "- ";
  color: var(--t-dim);
  font-family: var(--mono);
}

.t-entry > .t-comment {
  margin-top: 8px;
  font-size: 14px;
}

.t-link {
  white-space: nowrap;
}

/* subscribe(email='…'): the signup form as a call. */
.t-subscribe .t-cmd {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 0.6ch;
}

.t-subscribe .t-cmd > .t-ps {
  margin-right: 0;
}

.t-subscribe label {
  font-weight: 650;
  cursor: text;
}

.t-input {
  width: 22ch;
  min-width: 0;
  padding: 0 2px;
  border: 0;
  border-bottom: 1px dashed var(--t-dim);
  background: transparent;
  color: var(--t-str);
  font: inherit;
  font-weight: 400;
}

.t-input::placeholder {
  color: var(--t-dim);
  opacity: 0.7;
}

.t-input:focus {
  outline: none;
  border-bottom: 1px solid var(--t-ps);
}

.t-enter {
  margin-left: 1ch;
  padding: 1px 10px;
  border: 1px solid var(--t-border);
  border-radius: 6px;
  background: transparent;
  color: var(--t-text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.t-enter:hover {
  border-color: var(--t-ps);
  color: var(--t-ps);
}

.t-subscribe .t-comment {
  font-size: 14px;
}

.t-nav .t-cmd {
  margin-top: 8px;
}

.t-nav a {
  color: var(--t-fn);
}

.t-last {
  margin-top: 22px;
}

/* The cursor at the last prompt, blinking unless motion is reduced. */
.t-cursor {
  display: inline-block;
  width: 0.6em;
  height: 1.1em;
  vertical-align: text-bottom;
  background: var(--t-text);
}

@media (prefers-reduced-motion: no-preference) {
  .t-cursor {
    animation: t-blink 1.1s steps(1) infinite;
  }
}

@keyframes t-blink {
  50% {
    opacity: 0;
  }
}

@media (max-width: 600px) {
  .views .term {
    margin-right: -8px;
    margin-left: -8px;
    font-size: 14px;
  }

  .term-body {
    padding: 16px 14px 22px;
  }

  .term-title {
    display: none;
  }

  .t-entry {
    padding-left: 0;
  }

  .t-entry > .t-head {
    text-indent: 0;
  }

  .t-index {
    width: auto;
    margin-right: 0.6ch;
  }

  .t-intro,
  .t-text {
    font-size: 15px;
  }
}
