/* The bot's words are the content here, so they are set as a script: a cue in
   the left gutter, the line itself, and a stage direction underneath.

   Two faces, with one job each. PT Serif carries what the bot says; PT Sans
   carries what this tool says. Both are designed for Cyrillic and come from the
   system, so nothing is fetched over the network. */

:root {
  --paper:  #eceff1;
  --sheet:  #f7f9fa;
  --ink:    #16263a;
  --slate:  #5c6e80;
  --rule:   #ccd6dd;
  --ochre:  #b07503;
  --danger: #9b2c2c;

  --serif: "PT Serif", "Noto Serif", "Liberation Serif", Georgia, serif;
  --sans:  "PT Sans", "Noto Sans", "Liberation Sans", "Segoe UI", system-ui, sans-serif;
  --mono:  "DejaVu Sans Mono", "Liberation Mono", ui-monospace, monospace;

  --measure: 66ch;
  --gutter: 2.75rem;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.5;
}

a { color: inherit; }
a:focus-visible,
[href]:focus-visible { outline: 2px solid var(--ochre); outline-offset: 3px; }

code { font-family: var(--mono); font-size: 0.78em; }

/* ---------------------------------------------------------------- top bar -- */

.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1.25rem;
  padding: 0.9rem 1.5rem;
  border-bottom: 1px solid var(--rule);
  background: var(--sheet);
}

.bar__home {
  font-weight: 700;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.bar__nav { display: flex; gap: 1rem; margin-right: auto; }
.bar__nav a { color: var(--slate); text-decoration: none; }
.bar__nav a:hover { color: var(--ink); }
.bar__nav a[aria-current="page"] {
  color: var(--ink);
  box-shadow: inset 0 -2px 0 var(--ochre);
}

.bar__who { color: var(--slate); }
.bar__out { color: var(--slate); text-decoration: underline; text-underline-offset: 2px; }

/* ------------------------------------------------------------------ page -- */

.page {
  max-width: calc(var(--measure) + var(--gutter) + 3rem);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 6rem;
}

/* The bot's greeting, as a student meets it. */
.opening { margin-bottom: 3rem; }

.opening__cue {
  margin: 0 0 0.6rem;
  color: var(--slate);
  font-size: 0.9rem;
}

.opening__line {
  padding: 1.4rem 1.6rem;
  border-left: 3px solid var(--ochre);
  background: var(--sheet);
  font-family: var(--serif);
  font-size: 1.2rem;
  line-height: 1.7;
  white-space: pre-wrap;
}

.notice {
  margin: 0 0 2.5rem;
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--ochre);
  color: #7a5102;
  background: #fdf6e7;
}

.jump {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.1rem;
  margin-bottom: 3.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--rule);
}

.jump a { color: var(--slate); font-size: 0.95rem; text-decoration: none; }
.jump a:hover { color: var(--ink); box-shadow: inset 0 -1px 0 currentColor; }

/* ----------------------------------------------------------------- group -- */

.group { margin-bottom: 4rem; }

.group__title {
  margin: 0 0 0.35rem;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.group__help {
  max-width: var(--measure);
  margin: 0 0 2rem;
  color: var(--slate);
}

.group--retired .group__title { color: var(--slate); }

/* ------------------------------------------------------------------ line -- */

.lines { display: flex; flex-direction: column; }

.line {
  display: grid;
  grid-template-columns: var(--gutter) minmax(0, 1fr);
  padding: 1.5rem 0;
  border-top: 1px solid var(--rule);
}

.line:last-child { border-bottom: 1px solid var(--rule); }

.line__cue {
  font-family: var(--serif);
  font-size: 1.1rem;
  color: var(--ochre);
  font-variant-numeric: tabular-nums;
}

.line__body { min-width: 0; max-width: var(--measure); }

.line__label {
  margin: 0 0 0.6rem;
  font-size: 1rem;
  font-weight: 700;
}

.line__key {
  margin-left: 0.5rem;
  color: var(--slate);
  font-weight: 400;
}

.tag {
  margin-left: 0.5rem;
  padding: 0.1rem 0.4rem;
  border: 1px solid var(--rule);
  color: var(--slate);
  font-size: 0.75rem;
  font-weight: 400;
}

.line__text {
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.line__text--short { font-size: 1.125rem; }

.line__empty { margin: 0; color: var(--danger); font-style: italic; }

.line__note {
  margin: 0.7rem 0 0;
  color: var(--slate);
  font-size: 0.9rem;
}

.line__note--rule { color: #7a5102; }
.line__note code { background: #fdf6e7; padding: 0 0.2em; }

.line__count { margin: 0.7rem 0 0; color: var(--slate); font-size: 0.85rem; }

/* The option list, drawn as the keyboard the bot will actually show. */
.keys { display: flex; flex-direction: column; gap: 0.35rem; }
.keys__row { display: flex; gap: 0.35rem; }

.keys__key {
  flex: 1 1 0;
  min-width: 0;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--sheet);
  font-size: 0.95rem;
  text-align: center;
  overflow-wrap: anywhere;
}

/* The rendered message, and its markup underneath for whoever needs it. */
.line__text a { color: #0a558c; text-underline-offset: 2px; }

.source { margin-top: 0.7rem; }

.source summary {
  color: var(--slate);
  cursor: pointer;
  font-size: 0.85rem;
  width: fit-content;
}

.source summary:focus-visible { outline: 2px solid var(--ochre); outline-offset: 3px; }

.source__raw {
  margin: 0.5rem 0 0;
  padding: 0.7rem 0.9rem;
  border-left: 2px solid var(--rule);
  background: var(--sheet);
  color: var(--slate);
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ---------------------------------------------------------------- changes -- */

.changes { margin: 0; padding: 0; list-style: none; }

.change { padding: 1.4rem 0; border-top: 1px solid var(--rule); }
.change:last-child { border-bottom: 1px solid var(--rule); }

.change__meta {
  display: flex;
  gap: 1rem;
  margin: 0 0 0.4rem;
  color: var(--slate);
  font-size: 0.85rem;
}

.change__who { font-weight: 700; color: var(--ink); }
.change__what { margin: 0 0 0.6rem; font-size: 1rem; font-weight: 700; }

.change__was,
.change__now {
  max-width: var(--measure);
  margin: 0;
  padding-left: 0.9rem;
  font-family: var(--serif);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.change__was {
  border-left: 2px solid var(--rule);
  color: var(--slate);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.change__now { border-left: 2px solid var(--ochre); margin-top: 0.4rem; }

/* ------------------------------------------------------------------- gate -- */

.gate {
  max-width: 34rem;
  margin: 18vh auto 0;
  padding: 0 1.5rem;
  text-align: left;
}

.gate__title {
  margin: 0 0 0.9rem;
  font-family: var(--serif);
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.gate__lede { margin: 0 0 2rem; color: var(--slate); }

.gate__error {
  margin: 0 0 1.5rem;
  padding: 0.8rem 1rem;
  border-left: 3px solid var(--danger);
  background: #fbeeee;
  color: #6f1f1f;
}

.gate__widget { min-height: 3rem; }

/* ------------------------------------------------------------------- misc -- */

@media (max-width: 34rem) {
  :root { --gutter: 1.5rem; }
  .page { padding: 1.75rem 1rem 4rem; }
  .bar { padding: 0.75rem 1rem; }
  .keys__row { flex-direction: column; }
  .opening__line { padding: 1.1rem 1.2rem; font-size: 1.1rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
