/* AkademTranslit -- one stylesheet, light and dark.

   Fonts, served from this site (tools/make-fonts.py), cut to the site's
   alphabets and renamed as the SIL OFL 1.1 asks of a modified font with a
   Reserved Font Name (the OFL.txt in each folder of assets/fonts):
   AkademTranslit Sans -- IBM
   Plex Sans 400 and 600 -- for the interface, with ʻ and ʼ (U+02BB,
   U+02BC) from the marks face (below); AkademTranslit Serif -- Gentium
   Book Plus 400, with its own ʻ and ʼ -- for the text being converted and
   the text of the pages. Colours: .audit/W1b/design-plan.md,
   measured against WCAG 2.2 (text 4.5:1; control borders, marks and the
   focus ring 3:1). Sizes: a 1.2 scale on 16 px -- 13.33, 16, 19.2, 23.04,
   27.65, 33.18 px. Spacing: multiples of 4 px. No shadow, no gradient; one
   motion only (the letters strip), and none when motion is reduced. */

@font-face {
  font-family: "AkademTranslit Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/sans/AkademTranslitSans-Regular.woff2") format("woff2");
}

@font-face {
  font-family: "AkademTranslit Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/sans/AkademTranslitSans-SemiBold.woff2") format("woff2");
}

/* Gentium Book Plus: every letter of the five interface languages' texts and
   the converter's three scripts (Ҳ ҳ too), and a ʻ that sits with its letter
   like its own ‘: at 16, 18, 19.2 and 22 px on a Mac the gaps differ from
   its ‘ ’ by 0.11-0.15 px on average, the mark is 0.22 em wide (.audit/W1d). */
@font-face {
  font-family: "AkademTranslit Serif";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/serif/AkademTranslitSerif-Regular.woff2") format("woff2");
}

/* ʻ and ʼ only; the sans subset leaves them out (Plex draws them 0.6 em wide,
   with a third of an em of air on each side: "O ʻzbek"). This site's own file
   first, the same marks on every device: Noto Sans cut to these two glyphs,
   about 1 KB. On a Mac at 14, 16, 20 and 40 px the gaps beside its marks
   differ from Plex's own ‘ ’ by 0.82 px on average at 400, 0.58 px at 600
   (.audit/W1d). Only if the file does not load, a font of the device: Arial
   (0.46 and 0.71 px; the Windows copy of Arial that comes with Office has the
   same metrics for these two glyphs), Helvetica Neue (0.60 and 0.97 px) --
   both measured on a Mac (.audit/W1c) -- then Segoe UI, Roboto (not
   measured). */
@font-face {
  font-family: "AkademTranslit Marks";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/marks/NotoSans-Regular-marks.woff2") format("woff2"),
    local("Arial"), local("ArialMT"), local("Helvetica Neue"), local("HelveticaNeue"),
    local("Segoe UI"), local("SegoeUI"), local("Roboto"), local("Roboto-Regular");
  unicode-range: U+02BB-02BC;
}

@font-face {
  font-family: "AkademTranslit Marks";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/marks/NotoSans-SemiBold-marks.woff2") format("woff2"),
    local("Arial Bold"), local("Arial-BoldMT"), local("Helvetica Neue Medium"), local("HelveticaNeue-Medium"),
    local("Segoe UI Semibold"), local("SegoeUI-Semibold"), local("Roboto Medium"), local("Roboto-Medium");
  unicode-range: U+02BB-02BC;
}

/* Light and dark. The device decides (prefers-color-scheme) until the switch
   in the header is used; the choice is then data-theme="light" or "dark" on
   <html>, put there before the first paint by assets/theme.js.

   Each colour is written once, as a pair: var(--when-light, A) var(--when-dark, B).
   --when-light and --when-dark are two switches. The one that is on holds
   initial -- a custom property that is never valid, so var() takes its
   fallback -- and the other one holds a space, so its var() gives nothing:
   the pair is A in the light scheme and B in the dark one. The two rules after
   this one only turn the switches and color-scheme: the device's dark unless
   light was chosen, and dark when it was chosen. */
:root {
  color-scheme: light;
  --when-light: initial;
  --when-dark: ;
  /* Paper, sheet and ink; Rishton cobalt for what is chosen; Samarqand
     turquoise only for a state (ready, copied). */
  --paper: var(--when-light, #f5f7fb) var(--when-dark, #0d1230);
  --surface: var(--when-light, #ffffff) var(--when-dark, #141a3d);
  --sunken: var(--when-light, #eef2f8) var(--when-dark, #10163a);
  --ink: var(--when-light, #121a2e) var(--when-dark, #e7eaf6);
  --muted: var(--when-light, #4a5570) var(--when-dark, #a9b0d1);
  --line: var(--when-light, #7d879c) var(--when-dark, #6f78a6);
  --rule: var(--when-light, #d6dce7) var(--when-dark, #2a3263);
  --accent: var(--when-light, #1f4ba0) var(--when-dark, #93b4ff);
  --accent-strong: var(--when-light, #173a7d) var(--when-dark, #b6ccff);
  --on-accent: var(--when-light, #ffffff) var(--when-dark, #0d1230);
  --focus: var(--when-light, #1f4ba0) var(--when-dark, #b9cdff);
  --ok: var(--when-light, #0b6f6b) var(--when-dark, #5fd6ca);
  --ok-mark: var(--when-light, #0e8c87) var(--when-dark, #4fd1c5);
  --danger: var(--when-light, #b42318) var(--when-dark, #ff9b91);
  --warn: var(--when-light, #7a4300) var(--when-dark, #ffd08a);
  --warn-bg: var(--when-light, #fff4e0) var(--when-dark, #36280f);
  --mark: var(--when-light, #fde7a9) var(--when-dark, #4a3d14);
  --mark-line: var(--when-light, #9a5b00) var(--when-dark, #e8b84a);

  --sans: "AkademTranslit Marks", "AkademTranslit Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --serif: "AkademTranslit Serif", "Iowan Old Style", "Palatino Linotype", Palatino, "Noto Serif", Georgia, serif;
  /* The serif's small letters as tall as the sans's: Gentium's x-height is
     0.454 em, Plex's 0.516 em (OS/2 sxHeight), so at one font-size the
     serif's were 11 % lower (.audit/W1e, xheight.mjs). Every rule that sets
     --serif sets this font-size-adjust too: it scales Gentium, and a
     fallback serif while Gentium loads, to Plex's x-height. */
  --serif-adjust: 0.516;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Noto Sans Mono", monospace;

  --step--1: 0.8333rem;
  --step-0: 1rem;
  --step-1: 1.2rem;
  --step-2: 1.44rem;
  --step-3: 1.728rem;
  --step-4: 2.0736rem;

  --radius: 0.375rem;
  --gutter: 1rem;
  /* The height of a card's toolbar and of its foot: a segmented group (2.75rem)
     and 0.375rem above and below, the same in every tab -- the panes stay level. */
  --bar: 3.625rem;
  --text-size: var(--step-0);
  /* The text fields: as tall as the first screen allows, the whole converter in view. */
  --text-h: 12rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --when-light: ;
    --when-dark: initial;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --when-light: ;
  --when-dark: initial;
}

@media (min-width: 48rem) {
  :root {
    --gutter: 1.5rem;
    --text-size: var(--step-1);
  }
}

@media (min-width: 60rem) {
  :root {
    --text-h: clamp(13rem, 100vh - 27rem, 27rem);
  }
}

@supports (height: 100svh) {
  @media (min-width: 60rem) {
    :root {
      --text-h: clamp(13rem, 100svh - 27rem, 27rem);
    }
  }
}

/* --- base ------------------------------------------------------------------------- */

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

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

body {
  margin: 0;
  min-width: 20rem;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--step-0) / 1.5 var(--sans);
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-thickness: 2px;
}

h1,
h2,
h3,
p,
dd,
label {
  overflow-wrap: break-word;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

::placeholder {
  color: var(--muted);
  opacity: 1;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* A saved language other than the page's own: not laid out at all until its
   words are in (assets/app.js). With display: none there is no earlier layout
   for the page to move from -- visibility: hidden still counted as a shift in
   Chrome (measured: 0.034 on the About page at 390 px, English). */
html[data-i18n="pending"] body {
  display: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: 0.5rem;
  top: -3rem;
  z-index: 10;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--on-accent);
}

.skip:focus {
  top: 0.5rem;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: var(--step--1);
}

.header-inner,
.converter,
.prose,
.footer-inner {
  max-width: 72rem;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* --- header ----------------------------------------------------------------------- */

.site-header {
  border-bottom: 1px solid var(--rule);
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 2rem;
  min-height: 4rem;
  padding-block: 0.75rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  color: var(--ink);
  font-size: var(--step-1);
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand-mark {
  flex: none;
}

.brand-mark-bg {
  fill: var(--accent);
}

.brand-mark-fg {
  fill: var(--on-accent);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
}

.site-nav a {
  padding-block: 0.25rem;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--ink);
}

.site-nav a[aria-current="page"] {
  border-bottom-color: var(--accent);
  color: var(--ink);
}

/* The language and the day and night switch, at the end of the header. */
.header-tools {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.lang {
  position: relative;
}

.lang select {
  appearance: none;
  min-height: 2.25rem;
  padding: 0.25rem 2rem 0.25rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: var(--step--1);
  cursor: pointer;
}

.lang::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 0.875rem;
  width: 0.375rem;
  height: 0.375rem;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

/* The day and night switch: the box of the language select beside it, 36 px
   drawn and 44 px to press -- its ::before reaches 5 px past each side of the
   padding box (34 px: inside the 1 px border), 4 px past the border. */
.theme-switch {
  position: relative;
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--accent);
}

.theme-switch::before {
  content: "";
  position: absolute;
  inset: -0.3125rem;
}

.theme-switch:hover {
  border-color: var(--accent);
  background: var(--sunken);
}

/* The icon says what a press does, as the label does: the moon in the light
   scheme, the sun in the dark one -- by the same two switches as the
   colours, so it is right from the first paint, before any module runs. */
.theme-icon {
  fill: currentColor;
}

.theme-icon-moon {
  display: var(--when-light, block) var(--when-dark, none);
}

.theme-icon-sun {
  display: var(--when-light, none) var(--when-dark, block);
}

/* --- the converter: the strip of the four letters, the mode ------------------------- */

.converter {
  padding-block: 1.5rem 2.5rem;
}

.intro {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
  margin-bottom: 1.5rem;
}

.letters {
  margin: 0;
}

.letters-list {
  display: flex;
  gap: 0 clamp(1.5rem, 2.4vw, 2.25rem);
  margin: 0;
  padding: 0;
  list-style: none;
}

.triplet {
  display: flex;
  align-items: baseline;
  gap: 0.375em;
  font-size: clamp(var(--step-3), 2.3vw, var(--step-4));
  font-weight: 600;
  line-height: 1.15;
}

/* The script a glyph belongs to: the result's in cobalt, the source's in ink,
   the third one quiet. The only motion of the site. */
.glyph {
  color: var(--muted);
  transition: color 150ms ease;
}

.letters[data-source="cyrillic"] [data-script="cyrillic"],
.letters[data-source="latin_1995"] [data-script="latin_1995"],
.letters[data-source="latin_2026"] [data-script="latin_2026"] {
  color: var(--ink);
}

.letters[data-target="cyrillic"] [data-script="cyrillic"],
.letters[data-target="latin_1995"] [data-script="latin_1995"],
.letters[data-target="latin_2026"] [data-script="latin_2026"] {
  color: var(--accent);
}

@media (prefers-reduced-motion: reduce) {
  .glyph {
    transition: none;
  }
}

.mode {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 0.125rem 0.75rem;
}

.mode .segmented {
  grid-row: span 2;
}

.mode-note,
.mode-later {
  margin: 0;
  font-size: var(--step--1);
}

.mode-later {
  color: var(--muted);
}

/* --- segmented buttons -------------------------------------------------------------- */

.segmented {
  display: inline-flex;
  gap: 0.125rem;
  padding: 0.1875rem;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 0.1875rem);
  background: var(--surface);
}

.segmented [role="radio"] {
  position: relative;
  min-height: 2.25rem;
  padding: 0.25rem 0.75rem;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font-size: 0.9375rem;
  white-space: nowrap;
}

.segmented [role="radio"]:hover {
  background: var(--sunken);
}

.segmented [role="radio"][aria-checked="true"] {
  background: var(--accent);
  color: var(--on-accent);
}

.segmented [role="radio"][aria-disabled="true"] {
  color: var(--muted);
  cursor: not-allowed;
}

.segmented [role="radio"][aria-disabled="true"]:hover {
  background: transparent;
}

.segmented-small [role="radio"] {
  min-height: 2rem;
  padding-inline: 0.625rem;
  font-size: var(--step--1);
}

/* --- the two panes --------------------------------------------------------------------- */

.workspace {
  display: grid;
  gap: 1rem;
}

@media (min-width: 60rem) {
  .workspace {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: start;
    gap: 0 0.75rem;
  }
}

.pane {
  min-width: 0;
}

.pane-head {
  display: flex;
  align-items: flex-end;
  min-height: 2.5rem;
  margin-bottom: 0.5rem;
}

/* On the tabs' baseline: they have 0.25rem and a 2px line under the text. */
.pane-title {
  padding-bottom: calc(0.25rem + 2px);
  font-weight: 600;
}

.card {
  container: card / inline-size;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  min-height: var(--bar);
  padding: 0.375rem 0.75rem;
  border-bottom: 1px solid var(--rule);
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--sunken);
}

.toolbar-label {
  color: var(--muted);
  font-size: var(--step--1);
}

/* A narrow card (a phone, the two panes at 1024 px): the years without the
   word "Lotin" -- the buttons keep it in their names for screen readers. In
   every language: Russian "Латиница 1995" needs the room most. */
@container card (max-width: 28rem) {
  .seg-word {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}

/* A text field: the textarea over its mirror (the found places are marked
   in the mirror, under the text). Both have the same box and type. */
.field {
  display: grid;
}

.field > .text {
  grid-area: 1 / 1;
}

.text {
  display: block;
  width: 100%;
  height: var(--text-h);
  margin: 0;
  padding: 0.875rem 1rem;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--serif);
  font-size-adjust: var(--serif-adjust);
  font-size: var(--text-size);
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: normal;
  overflow-wrap: break-word;
  white-space: pre-wrap;
  tab-size: 4;
  overflow-y: auto;
  scrollbar-gutter: stable;
  resize: none;
}

textarea.text {
  position: relative;
  z-index: 1;
}

textarea.text:focus-visible {
  outline-offset: -2px;
}

/* As tall as the textarea (the .text height), so that it scrolls with it. */
.mirror {
  overflow: hidden;
  color: transparent;
  pointer-events: none;
  user-select: none;
}

/* A found place: a tint under the letters and a line below them (the line
   carries the 3:1 contrast, the tint alone would not). Borders below and
   outlines take no room: the mirror wraps exactly like the textarea. */
.mirror mark {
  border-bottom: 2px solid var(--mark-line);
  border-radius: 2px;
  background: var(--mark);
  color: transparent;
}

.mirror mark.is-active {
  outline: 2px solid var(--mark-line);
  outline-offset: 1px;
}

.card-foot {
  display: flex;
  align-items: center;
  gap: 0.5rem 1rem;
  min-height: var(--bar);
  padding: 0.5rem 0.75rem;
  border-top: 1px solid var(--rule);
}

.foot-info {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  gap: 0 1rem;
  min-width: 0;
  margin: 0;
  color: var(--muted);
  font-size: var(--step--1);
}

.count {
  font-variant-numeric: tabular-nums;
}

.foot-actions {
  display: flex;
  gap: 0.5rem;
}

/* Namuna for an empty field, Tozalash for a full one: the same place, nothing moves. */
#input-card .foot-actions {
  display: grid;
}

#input-card .foot-actions > * {
  grid-area: 1 / 1;
}

#input-card[data-empty="true"] #clear,
#input-card[data-empty="false"] #sample {
  visibility: hidden;
}

.status[data-state="ok"] {
  color: var(--ok);
}

.status[data-state="error"] {
  color: var(--danger);
}

.status[data-state="ok"]::before {
  content: "";
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  margin-right: 0.5rem;
  border-radius: 50%;
  background: var(--ok-mark);
  vertical-align: 0.05em;
}

.alert {
  margin: 0;
  padding: 0.625rem 0.75rem;
  border-top: 1px solid var(--rule);
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--warn-bg);
  color: var(--warn);
  font-size: var(--step--1);
}

.button {
  min-height: 2.25rem;
  padding: 0.25rem 0.875rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.9375rem;
  font-weight: 600;
  white-space: nowrap;
}

.button:hover {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
}

.button-quiet {
  border-color: var(--line);
  background: var(--surface);
  color: var(--accent);
}

.button-quiet:hover {
  border-color: var(--accent);
  background: var(--sunken);
}

.option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.125rem 0.5rem;
  margin-top: 0.75rem;
  padding-inline: 0.25rem;
}

.option input {
  width: 1.125rem;
  height: 1.125rem;
  margin: 0.1875rem 0 0;
  accent-color: var(--accent);
}

.option .hint {
  grid-column: 2;
}

/* The swap button: between the panes, at the height of their toolbars. */
.swap-cell {
  display: flex;
  justify-content: center;
}

.swap {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.5rem;
  padding: 0.25rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--accent);
  font-weight: 600;
}

.swap:hover {
  border-color: var(--accent);
}

.swap-icon {
  font-size: var(--step-1);
  line-height: 1;
}

@media (min-width: 60rem) {
  .swap-cell {
    padding-top: calc(2.5rem + 0.5rem + (var(--bar) - 2.5rem) / 2);
  }

  .swap {
    width: 2.5rem;
    padding: 0;
    justify-content: center;
  }

  .swap-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}

/* --- the tabs and their panels ------------------------------------------------------- */

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.25rem;
}

.tabs [role="tab"] {
  padding: 0.375rem 0 0.25rem;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--muted);
}

.tabs [role="tab"]:hover {
  color: var(--ink);
}

.tabs [role="tab"][aria-selected="true"] {
  border-bottom-color: var(--accent);
  color: var(--ink);
}

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

.panel[hidden] {
  display: none;
}

.panel-body {
  height: var(--text-h);
  overflow-y: auto;
  padding: 0.25rem 1rem 0.75rem;
}

/* Side by side, the result card is exactly as tall as the text card: when a
   toolbar or a foot takes two lines (a long label in Russian or Cyrillic),
   the panel's body gives up the room, not the page. */
@media (min-width: 60rem) {
  .card-output {
    height: calc(2 * var(--bar) + var(--text-h) + 2px);
  }

  .card-output .panel:not([hidden]) {
    flex: 1;
    min-height: 0;
  }

  .card-output .panel-body {
    flex: 1;
    min-height: 0;
    height: auto;
  }
}

.panel-heading {
  display: block;
  margin: 1rem 0 0.25rem;
  color: var(--muted);
  font-size: var(--step--1);
  font-weight: 600;
}

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

.findings li + li {
  border-top: 1px solid var(--rule);
}

.finding {
  display: grid;
  grid-template-columns: minmax(5rem, auto) 1fr;
  gap: 0 1rem;
  width: 100%;
  padding: 0.625rem 0.25rem;
  border: 0;
  background: transparent;
  text-align: left;
}

.finding:hover {
  background: var(--sunken);
}

.finding-piece {
  grid-row: span 3;
  color: var(--ink);
  font-family: var(--serif);
  font-size-adjust: var(--serif-adjust);
  font-size: var(--step-1);
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.finding-code {
  color: var(--ink);
  font-size: 0.9375rem;
}

.finding-where,
.finding-suggestion {
  color: var(--muted);
  font-size: var(--step--1);
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.125rem 1.5rem;
  margin: 0;
}

.stats div {
  display: flex;
  align-items: baseline;
  gap: 0.375rem;
}

.stats dt {
  color: var(--muted);
  font-size: var(--step--1);
}

.stats dd {
  min-width: 2ch;
  margin: 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* What changes (a count) at the end of the line: the fixed text before it stays put. */
.foot-end {
  margin-left: auto;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.roundtrip-label {
  font-weight: 600;
}

/* One line kept for the rules' version: when it comes, nothing below moves. */
.report-rules {
  min-height: calc(var(--step--1) * 1.5);
  margin-top: 0.25rem;
}

.text-result {
  height: 9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--sunken);
}

/* --- notice, footer ------------------------------------------------------------------ */

.update {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  left: 1rem;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  max-width: 26rem;
  margin-left: auto;
  padding: 0.75rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.update[hidden] {
  display: none;
}

.site-footer {
  border-top: 1px solid var(--rule);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  padding-block: 1.25rem 2rem;
  color: var(--muted);
  font-size: var(--step--1);
}

.version {
  min-height: 1.5em;
  margin: 0;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-links a {
  color: var(--muted);
}

.footer-links a:hover {
  color: var(--ink);
}

/* --- the text pages ------------------------------------------------------------------ */

.prose {
  padding-block: 2.5rem 3rem;
}

.prose > * {
  max-width: 34rem;
}

.prose h1 {
  margin: 0 0 1.5rem;
  font-size: var(--step-3);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.prose h2 {
  margin: 2rem 0 0.5rem;
  font-size: var(--step-1);
  font-weight: 600;
  line-height: 1.25;
}

.prose p {
  margin: 0 0 1rem;
  font-family: var(--serif);
  font-size-adjust: var(--serif-adjust);
  font-size: var(--step-1);
  line-height: 1.65;
  text-wrap: pretty;
}

.prose .revised {
  margin-top: 2.5rem;
  color: var(--muted);
  font-family: var(--sans);
  font-size-adjust: none;
  font-size: var(--step--1);
}

/* --- narrow screens ------------------------------------------------------------------- */

@media (max-width: 59.99rem) {
  .pane-head {
    min-height: 0;
  }

  /* One column: the panels grow with what they hold; the page scrolls, not the panel. */
  .panel-body {
    height: auto;
    overflow: visible;
  }
}

@media (max-width: 30rem) {
  /* 8 px between the rows (the menu's links reach 7 px over theirs), 6 px between neighbours. */
  .header-inner {
    gap: 0.5rem 0.375rem;
  }

  /* The header in two rows (QARORLAR #92; .audit/W3 measured 320-414 px in the
     five languages): the name and the language, then the menu. Every control
     is 44 px to press: the name's link and the language select 44 px tall,
     the switch 44 px drawn, the menu's links 44 px by their ::before. */
  .brand {
    gap: 0.5rem;
    min-height: 2.75rem;
    font-size: 0.9375rem;
  }

  /* As wide as the chosen language's name, not the longest one, in every
     browser: assets/ui/lang-width.js measures the name and sets --lang-name
     (em); the padding (0.375 + 1.25rem) and the border (2 x 1px) are added
     here. Before the script runs: the default language's name -- the pages
     are written in it -- as measured in Chrome, so the first paint is already
     as wide as the script makes it. */
  .lang select {
    width: calc(var(--lang-name, 9.67em) + 1.625rem + 2px);
    min-height: 2.75rem;
    padding: 0.25rem 1.25rem 0.25rem 0.375rem;
  }

  /* The arrow 7-15 px from the right edge: 5 px clear of the name. */
  .lang::after {
    right: 0.5rem;
  }

  /* The language stays beside the name. The language and the switch leave
     their group and are placed one by one; in the tab order the switch still
     comes after the language. */
  .header-tools {
    display: contents;
  }

  .lang {
    margin-left: auto;
  }

  /* The menu's row: its links a little smaller and closer (as the tabs below),
     with room at its end for the switch (6 + 44 px). */
  .site-nav {
    order: 3;
    flex: 1 0 calc(100% - 3.125rem);
    gap: 0.875rem 0.625rem;
    font-size: 0.9375rem;
  }

  /* 44 px to press (the link is 32.5 px): 7 px over and under each link, 5 px
     to each side -- half the space between two links, so that two never
     overlap, also when the menu takes two rows (14 px between them). */
  .site-nav a {
    position: relative;
  }

  .site-nav a::before {
    content: "";
    position: absolute;
    inset: -0.4375rem -0.3125rem;
  }

  /* After the three Uzbek names (long) there is no room for the switch beside
     the language: it ends the menu's row. 44 px drawn, as tall as the select. */
  .theme-switch {
    order: 4;
    width: 2.75rem;
    height: 2.75rem;
  }

  /* Over the 1 px border too: the whole 44 px square is the target, its rounded
     corners included (measured: inset 0 left the corners to the header). */
  .theme-switch::before {
    inset: -0.0625rem;
  }

  /* After "Русский" and "English" (short) it stays beside the language, as on
     a wide screen, and the menu has its row to itself: the Russian menu is the
     longest. */
  .theme-switch:lang(ru),
  .theme-switch:lang(en) {
    order: 2;
  }

  .site-nav:lang(ru),
  .site-nav:lang(en) {
    flex-basis: 100%;
  }

  .intro {
    gap: 0.75rem;
    margin-bottom: 1.25rem;
  }

  /* The notes under the switch, the full width: beside it they were a narrow column. */
  .mode {
    grid-template-columns: 1fr;
  }

  .mode .segmented {
    grid-row: auto;
    justify-self: start;
    margin-bottom: 0.25rem;
  }

  .tabs {
    flex-wrap: nowrap;
    gap: 0 0.875rem;
  }

  .tabs [role="tab"] {
    font-size: 0.9375rem;
    white-space: nowrap;
  }

  .letters {
    width: 100%;
  }

  .letters-list {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
  }

  .triplet {
    justify-content: center;
    gap: 0.25em;
    font-size: clamp(1.125rem, 5.2vw + 0.1rem, var(--step-3));
  }

  .segmented [role="radio"] {
    padding-inline: 0.625rem;
  }

  .finding {
    grid-template-columns: 1fr;
  }

  .finding-piece {
    grid-row: auto;
  }
}

/* Below 360 px the name's letters give way and the mark stays (decided 19-11-2026):
   in the two Uzbek Latin languages the name and the language no longer fit side
   by side (.audit/W4 measured every px 320-414: two rows with the name from 339 px
   in 2026, from 348 px in 1995). The words stay in the link for a screen reader --
   its name is still "AkademTranslit" -- and the link is 44 px wide to press, the
   mark at its start, in line with the page below. */
@media (max-width: 22.49rem) {
  .brand {
    min-width: 2.75rem;
  }

  .brand-name {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }
}

@media (max-width: 22.5rem) {
  /* Russian "Кириллица" is the longest segment: at 320 px it needs this room. */
  .toolbar {
    padding-inline: 0.5rem;
  }

  .segmented [role="radio"] {
    padding-inline: 0.5rem;
    font-size: 0.875rem;
  }

  .tabs {
    gap: 0 0.75rem;
  }

  .tabs [role="tab"] {
    font-size: var(--step--1);
  }
}
