/*
 * Shared base of every document of the site: the landing, the pages of
 * /app/ and the static pages. Colours, sizes, fonts and motion come from
 * tokens.css (generated from app_theme.dart), the font files from fonts.css.
 * Page and component styles live in their own files and in the landing code.
 */

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

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  background: var(--color-background);
}

body {
  margin: 0;
  background: var(--color-background);
  color: var(--color-text);
  font-family: var(--font-body-family);
  font-size: var(--font-body-size);
  font-weight: var(--font-body-weight);
  line-height: var(--font-body-line-height);
}

h1, h2, h3, p {
  margin: 0;
}

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

a {
  color: inherit;
  text-decoration: none;
}

:focus-visible {
  outline: var(--border-standard) solid var(--color-brand-color);
  outline-offset: var(--space-xxsmall);
}

[hidden] {
  display: none !important;
}

/* For a screen reader only: text the screen shows with a picture or an effect. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  font-weight: inherit;
  border: 0;
}

/* Type roles of the app (AppFonts): Inter for text and headings of the
   content, mono for section headings, labels, meta and text actions. */
.title1 {
  font: var(--font-title1-weight) var(--font-title1-size)/var(--font-title1-line-height) var(--font-title1-family);
  letter-spacing: var(--font-title1-letter-spacing);
}
.title2 {
  font: var(--font-title2-weight) var(--font-title2-size)/var(--font-title2-line-height) var(--font-title2-family);
  letter-spacing: var(--font-title2-letter-spacing);
}
.title3 {
  font: var(--font-title3-weight) var(--font-title3-size)/var(--font-title3-line-height) var(--font-title3-family);
  letter-spacing: var(--font-title3-letter-spacing);
}
.title4 {
  font: var(--font-title4-weight) var(--font-title4-size)/var(--font-title4-line-height) var(--font-title4-family);
  letter-spacing: var(--font-title4-letter-spacing);
}
.body-semibold {
  font: var(--font-body-semibold-weight) var(--font-body-semibold-size)/var(--font-body-semibold-line-height) var(--font-body-semibold-family);
  letter-spacing: var(--font-body-semibold-letter-spacing);
}
.body {
  font: var(--font-body-weight) var(--font-body-size)/var(--font-body-line-height) var(--font-body-family);
  letter-spacing: var(--font-body-letter-spacing);
}
.body-small {
  font: var(--font-body-small-weight) var(--font-body-small-size)/var(--font-body-small-line-height) var(--font-body-small-family);
  letter-spacing: var(--font-body-small-letter-spacing);
}
.caption {
  font: var(--font-caption-weight) var(--font-caption-size)/var(--font-caption-line-height) var(--font-caption-family);
  letter-spacing: var(--font-caption-letter-spacing);
}
.caption2 {
  font: var(--font-caption2-weight) var(--font-caption2-size)/var(--font-caption2-line-height) var(--font-caption2-family);
  letter-spacing: var(--font-caption2-letter-spacing);
}
.body-mono {
  font: var(--font-body-mono-weight) var(--font-body-mono-size)/var(--font-body-mono-line-height) var(--font-body-mono-family);
  letter-spacing: var(--font-body-mono-letter-spacing);
}
.big-button-text {
  font: var(--font-big-button-text-weight) var(--font-big-button-text-size)/var(--font-big-button-text-line-height) var(--font-big-button-text-family);
  letter-spacing: var(--font-big-button-text-letter-spacing);
}
.input-number {
  font: var(--font-input-number-weight) var(--font-input-number-size)/var(--font-input-number-line-height) var(--font-input-number-family);
  letter-spacing: var(--font-input-number-letter-spacing);
}
.input-text {
  font: var(--font-input-text-weight) var(--font-input-text-size)/var(--font-input-text-line-height) var(--font-input-text-family);
  letter-spacing: var(--font-input-text-letter-spacing);
}

/* A link inside running text: link colour, always underlined. */
.inline-link {
  color: var(--color-link);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------------------------------------------------------------- public shell
   The header of the landing is the header of every public page: content width
   1296 with a field of 24 (8 on a phone, the logo then 16 further in), the logo
   40 high from 768 and 32 on a phone, the pill 48. The logo lands on the same
   pixels on every public page, so it stands still when the page changes; the
   pages of signing in put it over the middle of the form, on the same line. */
:root {
  --site-max: 1296px;
  --site-edge: var(--space-xsmall);
  --site-inset: var(--space-small);
  --site-header-top: var(--space-small);
  --site-logo-height: 32px;
  --site-logo-ratio: 1375 / 233;
  --site-pill-height: 48px;
  --site-auth-button-height: 50px;
  --site-big-button-height: 52px;
  --site-field-height: 48px;
  --site-row-height: 52px;
}
@media (min-width: 768px) {
  :root {
    --site-edge: var(--space-medium);
    --site-inset: 0px;
    --site-header-top: var(--space-medium);
    --site-logo-height: 40px;
  }
}
@media (min-width: 1080px) {
  :root {
    --site-header-top: 40px;
  }
}

.site-header {
  width: min(100%, var(--site-max));
  margin-inline: auto;
  padding-inline: var(--site-edge);
}
.site-header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-small);
  padding-top: var(--site-header-top);
}
/* From 768 the pill shares the row with the logo: the row keeps the pill's
   height on pages without it, so the logo is centred on the same line. */
@media (min-width: 768px) {
  .site-header-row {
    min-height: calc(var(--site-header-top) + var(--site-pill-height));
  }
}

/* A text action on the right ("Назад") keeps the height of the logo in the
   layout too, so a phone row is as high as on the landing. */
.site-header-row > .text-action {
  margin-block: calc((var(--site-logo-height) - var(--button-height)) / 2);
  margin-right: var(--site-inset);
}

/* The pages of signing in (SiteHeader.centerLogo): the logo over the middle of
   the form column, as _LogoSection of the app, on the line of the landing logo. */
.site-header-centered .site-header-row {
  justify-content: center;
}
.site-header-centered .site-logo {
  margin-left: 0;
}

/* The link is at least 44 high, the mark keeps the height of the logo in the
   layout (the negative margins give the difference back). */
.site-logo {
  display: flex;
  align-items: center;
  min-height: var(--button-height);
  margin-block: calc((var(--site-logo-height) - var(--button-height)) / 2);
  margin-left: var(--site-inset);
  color: var(--color-text);
}
.site-logo-mark {
  display: block;
  flex: none;
  height: var(--site-logo-height);
  aspect-ratio: var(--site-logo-ratio);
  background-color: currentColor;
  -webkit-mask: url('/images/logo_text.png') center / contain no-repeat;
  mask: url('/images/logo_text.png') center / contain no-repeat;
}

/* The main area of a public page of the app: a column of the sign-in form,
   24 from the screen edge on a phone, as the logo and the text of the landing. */
.site-main {
  width: min(100%, calc(var(--layout-max-auth-form-width) + 2 * var(--space-medium)));
  margin: var(--space-xlarge) auto 0;
  padding: 0 max(var(--space-medium), env(safe-area-inset-right, 0px)) max(var(--space-large), env(safe-area-inset-bottom, 0px)) max(var(--space-medium), env(safe-area-inset-left, 0px));
}
.site-main h1 {
  font: var(--font-title2-weight) var(--font-title2-size)/var(--font-title2-line-height) var(--font-title2-family);
  margin-bottom: var(--space-medium);
}
@media (max-width: 767px) {
  .site-main {
    margin-top: var(--space-medium);
  }
}

/* A document (the offer, the privacy policy): a wider column of text. */
.site-doc {
  width: min(100%, calc(var(--layout-max-content-width) + 2 * var(--space-medium)));
  overflow-wrap: anywhere;
}
.site-doc h1 {
  font: var(--font-title1-weight) var(--font-title1-size)/var(--font-title1-line-height) var(--font-title1-family);
  margin: var(--space-large) 0 var(--space-medium);
}
.site-doc h2 {
  font: var(--font-title2-weight) var(--font-title2-size)/var(--font-title2-line-height) var(--font-title2-family);
  margin: var(--space-large) 0 var(--space-small);
}
.site-doc h3 {
  font: var(--font-title3-weight) var(--font-title3-size)/var(--font-title3-line-height) var(--font-title3-family);
  margin: var(--space-medium) 0 var(--space-small);
}
.site-doc h4 {
  font: var(--font-body-semibold-weight) var(--font-body-semibold-size)/var(--font-body-semibold-line-height) var(--font-body-semibold-family);
  margin: var(--space-medium) 0 var(--space-xsmall);
}
.site-doc :is(h1, h2, h3, h4):first-child {
  margin-top: 0;
}
.site-doc p,
.site-doc ul,
.site-doc ol {
  margin: var(--space-small) 0;
}
.site-doc ul,
.site-doc ol {
  padding-left: var(--space-medium);
}
.site-doc li + li {
  margin-top: var(--space-xsmall);
}
.site-doc a:not([class]) {
  color: var(--color-link);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.site-doc hr {
  border: 0;
  border-top: var(--border-divider) solid var(--color-border);
  margin: var(--space-large) 0;
}

/* Links to the parts of a document (the languages of the policy). */
.site-doc-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-medium);
  margin-bottom: var(--space-medium);
}

/* Small print under a block of text: mono caption, second text colour. */
.site-note {
  font: var(--font-caption2-weight) var(--font-caption2-size)/var(--font-caption2-line-height) var(--font-caption2-family);
  color: var(--color-text-second);
}

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

/* ActionPill and the pill of the landing: only on public pages. */
.button-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xsmall);
  min-height: var(--site-pill-height);
  padding: 0 var(--space-small);
  border: var(--border-pill) solid var(--color-pill-border);
  border-radius: var(--radius-chip);
  background: var(--color-background-subelevated);
  color: var(--color-text);
  font: var(--font-title4-weight) var(--font-body-mono-size)/var(--font-body-mono-line-height) var(--font-body-mono-family);
  white-space: nowrap;
  transition: background-color var(--motion-short) var(--motion-curve);
}
/* Pressed: on touch, and held after the click until the next page shows. */
.button-pill:active,
.button-pill.is-pressed {
  background: var(--color-background-input);
}
@media (hover: hover) and (pointer: fine) {
  .button-pill:hover:not(.is-pressed) {
    background: var(--color-background-elevated);
  }
}

/* _AuthButton of the app: "Войти" and the steps of registration and recovery. */
.button-auth {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xsmall);
  width: 100%;
  min-height: var(--site-auth-button-height);
  padding: var(--space-xsmall) var(--space-medium);
  overflow-wrap: anywhere;
  border: 0;
  border-radius: var(--radius-medium);
  background: var(--color-calc-ok);
  color: var(--color-button-text);
  font: var(--font-big-button-text-weight) var(--font-big-button-text-size)/var(--font-big-button-text-line-height) var(--font-big-button-text-family);
  text-align: center;
}
.button-auth:disabled {
  background: color-mix(in srgb, var(--color-border) 50%, transparent);
}

/* The main button of a dialog or a page (AppDialog, FormActionButton): the brand
   colour, 52 high. In a column of a page it takes the whole width. */
.button-primary,
.button-subscribe {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xsmall);
  min-height: var(--site-big-button-height);
  padding: 0 var(--space-medium);
  border: 0;
  border-radius: var(--radius-medium);
  color: var(--color-button-text);
  text-align: center;
}
.button-primary {
  background: var(--color-brand-color);
  font: var(--font-big-button-text-weight) var(--font-big-button-text-size)/var(--font-big-button-text-line-height) var(--font-big-button-text-family);
}
/* "Оформить подписку" and the choice of a tariff (the button of the paywall). */
.button-subscribe {
  background: linear-gradient(90deg, var(--color-brand-color), var(--color-second-color));
  font: var(--font-button-text-weight) var(--font-button-text-size)/var(--font-button-text-line-height) var(--font-button-text-family);
}
.button-primary:disabled,
.button-subscribe:disabled {
  opacity: var(--button-disabled-opacity);
  cursor: default;
}
.page-column .button-primary,
.page-column .button-subscribe,
.notice-dialog .button-primary {
  display: flex;
  width: 100%;
}

/* A big button on the subelevated background ("Написать в поддержку"). */
.button-subtle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: var(--site-big-button-height);
  padding: 0 var(--space-medium);
  border-radius: var(--radius-medium);
  background: var(--color-background-subelevated);
  color: var(--color-text);
  font: var(--font-button-text-weight) var(--font-button-text-size)/var(--font-button-text-line-height) var(--font-button-text-family);
}

/* A text action (not inside running text): mono, coloured by its role. */
.text-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--button-height);
  min-height: var(--button-height);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--color-brand-color);
  font: var(--font-body-mono-weight) var(--font-body-mono-size)/var(--font-body-mono-line-height) var(--font-body-mono-family);
  text-align: center;
}
.text-action-danger {
  color: var(--color-calc-not-ok);
}
.text-action-quiet {
  color: var(--color-text-second);
}
/* Text actions under a button, in the middle of the column. */
.action-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: var(--space-small);
}
/* "Забыли пароль?" and "Зарегистрироваться" of the sign-in form: caption in the brand colour. */
.caption-link {
  display: inline-flex;
  align-items: center;
  min-width: var(--button-height);
  min-height: var(--button-height);
  color: var(--color-brand-color);
  font: var(--font-caption-weight) var(--font-caption-size)/var(--font-caption-line-height) var(--font-caption-family);
}

/* The pages that end access (SuspendedView) and the error pages: text in the
   middle of the column, as in the app. */
.site-message {
  text-align: center;
}
.site-message h1 {
  margin-bottom: var(--space-small);
}
.site-message p + p {
  margin-top: var(--space-xsmall);
}
.site-message .button-subtle {
  margin-top: var(--space-large);
}
.site-message .site-note {
  margin-top: var(--space-xsmall);
}
.site-message .text-action,
.site-message .button-pill {
  margin-top: var(--space-medium);
}
.site-error {
  color: var(--color-calc-not-ok);
}
.site-result {
  margin-top: var(--space-medium);
}

/* A form and its fields (CalcInputField of the app: the label above the field, a line under it). The
   line shows the state: empty - the border colour, right - green, wrong - red. The focus is the outline. */
.site-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-small);
  margin-top: var(--space-large);
  text-align: left;
}
.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-field-gap);
  min-width: 0;
}
.field > label {
  font: var(--font-caption-weight) var(--font-caption-size)/var(--font-caption-line-height) var(--font-caption-family);
}
.field input {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  min-width: 0;
  min-height: var(--site-field-height);
  margin: 0;
  padding: 0 var(--space-small);
  border: 0;
  border-bottom: var(--border-standard) solid var(--color-border);
  border-radius: var(--radius-input) var(--radius-input) 0 0;
  background: var(--color-background-input);
  font: var(--font-input-text-weight) var(--font-input-text-size)/var(--font-input-text-line-height) var(--font-input-text-family);
}
.field input::-webkit-datetime-edit {
  padding: 0;
}
.field input:user-valid {
  border-bottom-color: var(--color-calc-ok);
}
.field input:user-invalid,
.field input[aria-invalid=true] {
  border-bottom-color: var(--color-calc-not-ok);
}
/* The profile form: a required field that is empty (or an incomplete date) has the red line from the start,
   a filled one the green, as the fields of the calculators and ProfileForm of the app do. */
.profile-form .field input:required:invalid {
  border-bottom-color: var(--color-calc-not-ok);
}
.profile-form .field input:required:valid {
  border-bottom-color: var(--color-calc-ok);
}
/* The field of a password: the button that shows it stands in the field at the right end (the server draws it hidden, the
   script shows it: without the script nothing of the field changes). The zone is 44 wide and as high as the field above its
   line; the icon is 20, its right edge 16 from the edge of the field, as the text of the field. */
.field-control {
  position: relative;
}
.field-control:has(.field-reveal:not([hidden])) input {
  padding-inline-end: var(--button-height);
}
/* Edge draws its own eye in a password field: one button is enough. */
.field-control input::-ms-reveal {
  display: none;
}
.field-reveal {
  position: absolute;
  inset: 0 0 var(--border-standard) auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: var(--button-height);
  padding: 0 var(--space-small) 0 var(--space-xsmall);
  border: 0;
  background: transparent;
  color: var(--color-text-second);
  cursor: pointer;
}
.field-reveal .icon {
  width: calc(var(--space-small) + var(--space-xxsmall));
  height: calc(var(--space-small) + var(--space-xxsmall));
}
.field-reveal[aria-pressed=true] .icon-visibility_off,
.field-reveal[aria-pressed=false] .icon-visibility {
  display: none;
}
@media (hover: hover) and (pointer: fine) {
  .field-reveal:hover {
    color: var(--color-text);
  }
}
/* The error of one field, under it; the box above the form is for errors of no single field. */
.field-error {
  color: var(--color-calc-not-ok);
  font: var(--font-caption2-weight) var(--font-caption2-size)/var(--font-caption2-line-height) var(--font-caption2-family);
  overflow-wrap: anywhere;
}
/* The choice of two (SexSegment): a frame, the chosen half in the brand colour. The radio inputs
   cover their half and are not drawn. */
.segment {
  display: flex;
  border: var(--border-standard) solid var(--color-border);
  border-radius: var(--radius-medium);
  overflow: hidden;
}
.segment > label {
  position: relative;
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(var(--site-field-height) - 2 * var(--border-standard));
  cursor: pointer;
}
.segment input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.segment > label:has(input:checked) {
  background: var(--color-brand-color);
  color: var(--color-button-text);
}
.segment > label:has(input:focus-visible) {
  outline: var(--border-standard) solid var(--color-brand-color);
  outline-offset: calc(-1 * var(--border-standard));
}
.segment[aria-invalid=true] {
  border-color: var(--color-calc-not-ok);
}

/* ---------------------------------------------------------------- surfaces */

/* A card (the surface of the app): the subelevated background, no frame. */
.card {
  padding: var(--space-card-padding);
  border-radius: var(--radius-card);
  background: var(--color-background-subelevated);
  overflow-wrap: anywhere;
}
.card-heading {
  font: var(--font-body-semibold-weight) var(--font-body-semibold-size)/var(--font-body-semibold-line-height) var(--font-body-semibold-family);
}

/* ModePicker: a row of segments, the chosen one in the brand colour. */
/* The segments wrap at a large browser font: the picker clips them to its own corners, as the rounding of
   :first-child and :last-child no longer lands on the corners of the group. The focus ring is inside the segment. */
.mode-picker {
  display: flex;
  flex-wrap: wrap;
  overflow: hidden;
  border-radius: var(--radius-medium);
  background: var(--color-background-elevated);
}
.mode-picker > * {
  flex: 1 1 4.5rem;
  min-width: 0;
  min-height: var(--button-height);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xsmall) var(--space-xxsmall);
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--color-text-second);
  font: var(--font-body-small-weight) var(--font-body-small-size)/var(--font-body-small-line-height) var(--font-body-small-family);
  text-align: center;
}
.mode-picker > :first-child {
  border-radius: var(--radius-medium) 0 0 var(--radius-medium);
}
.mode-picker > :last-child {
  border-radius: 0 var(--radius-medium) var(--radius-medium) 0;
}
.mode-picker > :only-child {
  border-radius: var(--radius-medium);
}
.mode-picker > [aria-pressed=true],
.mode-picker > [aria-current=page] {
  background: var(--color-brand-color);
  color: var(--color-button-text);
}
.mode-picker > :focus-visible {
  outline-offset: calc(-1 * var(--border-standard));
}
/* The chosen option is filled with the brand: its ring inside is in the ink of the buttons, a brand ring would not show. */
.mode-picker > :is([aria-pressed=true], [aria-current=page]):focus-visible {
  outline-color: var(--color-button-text);
}
@media (hover: hover) and (pointer: fine) {
  .mode-picker > :not([aria-pressed=true], [aria-current=page]):hover {
    background: var(--color-background-layered);
  }
}
/* Inside a row of a group the picker is on the layered surface. */
.grouped-row .mode-picker {
  background: var(--color-background-layered);
}

/* GroupedSection: a label and rows joined in one block, round at the ends only. */
.grouped {
  margin-top: var(--space-section-gap);
}
.grouped > h2 {
  margin-bottom: var(--space-xsmall);
  font: var(--font-body-semibold-weight) var(--font-body-semibold-size)/var(--font-body-semibold-line-height) var(--font-body-semibold-family);
}
.grouped-rows {
  display: flex;
  flex-direction: column;
  gap: var(--space-xxxsmall);
}
.grouped-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-small);
  min-height: var(--site-row-height);
  padding: var(--space-xsmall) var(--space-small);
  background: var(--color-background-subelevated);
  color: var(--color-text);
  overflow-wrap: anywhere;
}
.grouped-rows > :first-child {
  border-top-left-radius: var(--radius-card);
  border-top-right-radius: var(--radius-card);
}
.grouped-rows > :last-child {
  border-bottom-left-radius: var(--radius-card);
  border-bottom-right-radius: var(--radius-card);
}
.grouped-row-block {
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-xsmall);
  padding-block: var(--space-small);
}
.grouped-row-text {
  min-width: 0;
}
.grouped-row-trailing {
  flex: none;
  color: var(--color-text-second);
}
.grouped-row-action {
  flex: none;
  color: var(--color-brand-color);
  font: var(--font-caption-weight) var(--font-caption-size)/var(--font-caption-line-height) var(--font-caption-family);
}
.grouped-row-mono {
  font: var(--font-caption2-weight) var(--font-caption2-size)/var(--font-caption2-line-height) var(--font-caption2-family);
}
/* The chevron of a row that opens a screen. */
.grouped-row-next::after {
  content: '';
  flex: none;
  width: var(--space-medium);
  height: var(--space-medium);
  background-color: var(--color-text-second);
  -webkit-mask: url('/app/assets/icons/expand_more.svg') center / contain no-repeat;
  mask: url('/app/assets/icons/expand_more.svg') center / contain no-repeat;
  transform: rotate(-90deg);
}
/* A row with an icon before its title (GroupedTile with leading of the app): the icon, 8, the title, 8, the chevron (the
   app has 10 after the icon; the site keeps its spacing on the grid of 8). */
.grouped-row-lead {
  justify-content: flex-start;
  gap: var(--space-xsmall);
}
.grouped-row-lead .grouped-row-text {
  flex: 1;
}
/* Signing in and up: «Попробуйте калькуляторы» at the bottom of the screen when there is room, at least 48 under
   the form (the Column of the app: minHeight of the screen, spaceBetween). */
.site-page:has(> .site-main-split) {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}
.site-main-split {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
}
.auth-demo {
  margin-top: auto;
  padding-top: var(--space-xlarge);
}
.grouped-row:is(a, button):active {
  background: var(--color-background-elevated);
}
.grouped-row-danger {
  color: var(--color-calc-not-ok);
}
.grouped-row-title.tone-ok { color: var(--color-calc-ok); }
.grouped-row-title.tone-mild { color: var(--color-calc-mild); }
.grouped-row-title.tone-bad { color: var(--color-calc-not-ok); }
/* The meta line under a title: mono caption in the second colour. */
.meta {
  color: var(--color-text-second);
  font: var(--font-caption2-weight) var(--font-caption2-size)/var(--font-caption2-line-height) var(--font-caption2-family);
  overflow-wrap: anywhere;
}

/* ---------------------------------------------------------------- the field of the Thalamus
   ChatComposer of the app, one component (lib/components/thalamus_composer.dart) for the plate of the
   landing and the page of the Thalamus: a card on the input background without a frame, the field
   (padding 16/16/16/8, one line of 48; the app has 14 and 10), the row (L16 R4 B4, 48 high) with the scope blob and the slot
   of the button that sends. The plate places the card and keeps it at rest (thalamus_plate.dart), the page
   adds the sheet of the scopes and the send button (app.css). */
.composer-card {
  display: block;
  margin: 0;
  border-radius: var(--radius-large);
  background: var(--color-background-input);
  color: var(--color-text);
}
.composer-field {
  display: grid;
  padding: var(--space-small) var(--space-small) var(--space-xsmall);
  color: var(--color-text-second);
  font: var(--font-body-weight) var(--font-body-size)/var(--font-body-line-height) var(--font-body-family);
}
.composer-field > * {
  grid-area: 1 / 1;
}
.composer-row {
  display: flex;
  align-items: center;
  gap: var(--space-xsmall);
  height: var(--space-xlarge);
  padding: 0 var(--space-xxsmall) var(--space-xxsmall) var(--space-small);
  box-sizing: content-box;
}
/* A blob (the pill of the app): the button is the tap area of 44, the face in it is the pill of 34 that
   shows (radius chip, padding 8, mono 12). */
.blob {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  min-height: var(--button-height);
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--color-text);
  font: var(--font-button-label-weight) var(--font-button-label-size)/var(--font-button-label-line-height) var(--font-button-label-family);
  letter-spacing: var(--font-button-label-letter-spacing);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}
.blob-face {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xxsmall);
  min-width: 0;
  padding: var(--space-xsmall);
  border: var(--border-pill) solid transparent;
  border-radius: var(--radius-chip);
  transition: background-color var(--motion-short) var(--motion-curve), color var(--motion-short) var(--motion-curve), border-color var(--motion-short) var(--motion-curve);
}
.blob:focus-visible {
  outline: none;
}
.blob:focus-visible .blob-face {
  outline: var(--border-standard) solid var(--color-brand-color);
  outline-offset: var(--space-xxxsmall);
}
/* The chosen scope: backgroundCalc and the pill border, no brand fill (owner 21.09). */
.blob-scope .blob-face {
  background: var(--color-background-calc);
  border-color: var(--color-pill-border);
}
@media (hover: hover) and (pointer: fine) {
  .blob-scope:hover .blob-face {
    background: var(--color-background);
  }
}
.blob-scope:active .blob-face {
  background: var(--color-background-input);
}
.blob .chev {
  flex: none;
  width: var(--space-small);
  height: var(--space-small);
  opacity: 0.7;
}
/* A blob that is not chosen (ECG at rest): the page background, the label in the second colour. */
.blob-ecg .blob-face {
  background: var(--color-background);
  color: var(--color-text-second);
}

/* ---------------------------------------------------------------- page transition
   From the landing to the sign-in form and on through the site: the logo
   glides along its line to the middle of the form (and stands still between
   pages that have it at the same place), the pill "Вход или регистрация" flows
   into "Войти", the rest fades out and the new page fades in rising 8 px. Durations and the curve are
   AppMotion. With reduced motion nothing moves: the old page fades out, the new
   one fades in. */
@view-transition {
  navigation: auto;
}

/* The public pages the landing leads to keep the place of a classic scroll bar (macOS with a mouse, Windows), as the
   long landing always has one. Without it the form was 15 px wider than the landing at the change: everything centred
   moved by half of that and the logo, which stood still then, slid by 7 px (the jerk of 21.11). Overlay scroll bars take
   no place, so nothing changes with them. */
:root:has(> body > .site-page) {
  scrollbar-gutter: stable;
}

.site-logo-mark {
  view-transition-name: site-logo;
}
.auth-entry {
  view-transition-name: auth-entry;
}

::view-transition-group(*) {
  animation-duration: var(--motion-nav);
  animation-timing-function: var(--motion-curve);
}

/* Button into button: the label is not stretched, the new button opens from the pill. */
::view-transition-group(auth-entry) {
  overflow: clip;
  border-radius: var(--radius-medium);
}
::view-transition-old(auth-entry),
::view-transition-new(auth-entry) {
  height: 100%;
  width: 100%;
  object-fit: none;
}

@keyframes site-fade-out {
  to {
    opacity: 0;
  }
}
@keyframes site-fade-in {
  from {
    opacity: 0;
  }
}
@keyframes site-rise-in {
  from {
    opacity: 0;
    transform: translateY(var(--space-xsmall));
  }
}

::view-transition-old(root) {
  animation: site-fade-out calc(var(--motion-nav) * 0.4) var(--motion-curve) both;
}
/* The old page is gone (120 ms) before the new one rises in: on the frames a later start of 0.15 of
   the nav duration still showed the form faintly over home. */
::view-transition-new(root) {
  animation: site-rise-in var(--motion-medium) var(--motion-curve) calc(var(--motion-nav) * 0.4) both;
}

/* Reduced motion: nothing moves or resizes (no group animates, the pill does not flow), the old page
   fades out and then the new one fades in, so two pages never show at once.
   The logo has three places: the left of a public header (the landing), the middle of the form (the pages of signing
   in) and the bar of the app. With one shared name and a group that does not move, the old picture sits at the NEW place
   (the group stands where the new one is), so the logo jumped from the left of the landing header to the middle of the
   form in the first frame (R2 of 22.11). So here each place has its own name: a change of place is an old picture that
   leaves alone (it fades out where it was) and a new one that comes alone (it fades in where it goes), one after the
   other like the pages; a pair at the same place (sign-in, sign-up, recovery) still shares a name, has both pictures and
   shows only the new one whole from the first frame, so nothing blinks. The durations are explicit: the group's
   `animation: none` makes the duration the pictures inherit 0. */
@media (prefers-reduced-motion: reduce) {
  .auth-entry {
    view-transition-name: none;
  }
  .site-header-centered .site-logo-mark {
    view-transition-name: site-logo-form;
  }
  .topbar .site-logo-mark {
    view-transition-name: site-logo-bar;
  }
  ::view-transition-group(*) {
    animation: none;
  }
  ::view-transition-old(site-logo):not(:only-child),
  ::view-transition-old(site-logo-form):not(:only-child),
  ::view-transition-old(site-logo-bar):not(:only-child) {
    display: none;
  }
  ::view-transition-new(site-logo):not(:only-child),
  ::view-transition-new(site-logo-form):not(:only-child),
  ::view-transition-new(site-logo-bar):not(:only-child) {
    animation: none;
  }
  ::view-transition-old(site-logo):only-child,
  ::view-transition-old(site-logo-form):only-child,
  ::view-transition-old(site-logo-bar):only-child {
    animation: site-fade-out calc(var(--motion-reduced-fade) * 0.5) var(--motion-curve) both;
  }
  ::view-transition-new(site-logo):only-child,
  ::view-transition-new(site-logo-form):only-child,
  ::view-transition-new(site-logo-bar):only-child {
    animation: site-fade-in var(--motion-reduced-fade) var(--motion-curve) calc(var(--motion-reduced-fade) * 0.5) both;
  }
  ::view-transition-old(root) {
    animation: site-fade-out calc(var(--motion-reduced-fade) * 0.5) var(--motion-curve) both;
  }
  ::view-transition-new(root) {
    animation: site-fade-in var(--motion-reduced-fade) var(--motion-curve) calc(var(--motion-reduced-fade) * 0.5) both;
  }
}

/* Forced colours (Windows contrast themes; modern web guidance: icons, colour). The marks drawn by a mask over a
   coloured background are flattened to the canvas by the mode: they keep their fill in the colour of the text. */
@media (forced-colors: active) {
  @supports (forced-color-adjust: preserve-parent-color) {
    .site-logo-mark,
    .grouped-row-next::after {
      forced-color-adjust: preserve-parent-color;
      background-color: currentColor;
    }
  }
}

/* More contrast asked (prefers-contrast: more; modern web guidance: colour, scrollbars): the weak steps of the
   page rise to the second step of the text, and the thin scrollbar thumb (the third step) and the lines of the
   frames with them. The second step is not touched, the three tokens point to it. :root three times beats the
   themes of tokens.css (the light one, the system dark one and the chosen dark one, 0,2,0 each). */
@media (prefers-contrast: more) {
  :root:root:root {
    --color-text-third: var(--color-text-second);
    --color-border: var(--color-text-second);
    --color-pill-border: var(--color-text-second);
  }
}
