/* The only place colors, fonts and sizes are written as values; every
   other sheet takes them through var(). They are teemr's own
   (teemr2/web/index.css), names and values. */

/* teemr's fonts, served by the service itself (brief 069): no font host.
   The two families share their subsets' ranges (Google's split, as in
   teemr2); the ranges are data, not logic, so jscpd skips this block. */

/* jscpd:ignore-start */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('/assets/fonts/jetbrains-mono-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('/assets/fonts/jetbrains-mono-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('/assets/fonts/jetbrains-mono-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: Onest;
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/assets/fonts/onest-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: Onest;
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/assets/fonts/onest-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: Onest;
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/assets/fonts/onest-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* jscpd:ignore-end */

:root {
  /* light-dark() picks by this; a dark system turns it to dark below. */
  color-scheme: light dark;

  --font-text: onest, ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', monospace;

  /* teemr's palette, both themes. */
  --line: light-dark(#e1e5ec, #252a35);
  --text: light-dark(#141821, #e9ecf2);
  --text-dim: light-dark(#5b6475, #8b93a3);
  --text-strong: light-dark(#000, #fff);
  --danger: light-dark(#d8353b, #f2555a);

  /*
   * No blue (the person, 13.11): the one action of a screen is graphite.
   * Light: near-black fill, white words (17:1). Dark: near-white fill,
   * dark words (17:1). Red only for the dangerous step, white words on a
   * deeper red (4.6:1).
   */
  --primary-fill: light-dark(#16181d, #f2f3f5);
  --primary-fill-hover: light-dark(#2b2e35, #dadde2);
  --primary-text: light-dark(#fff, #0b0d12);
  --danger-text: #fff;
  --danger-fill: #d8353b;
  --danger-fill-hover: #bf2c32;

  /*
   * The page's ground: near white or teemr's night, flat. Buttons and
   * fields: a white or night plate with a thin line.
   */
  --page-bg: light-dark(#fbfcfd, #07090d);
  --button: light-dark(#fff, #12151b);
  --button-hover: light-dark(#f5f7fa, #181c24);
  --button-line: light-dark(#dde2ea, #262b35);
  --focus-ring: 2px solid var(--text);

  /* Shapes. */
  --radius-control: 10px;
  --radius-round: 50%;
  --line-thin: 1px solid var(--line);
  --line-button: 1px solid var(--button-line);

  /* Type: Onest for words, JetBrains Mono for what the machine said. */
  --size-label: 0.75rem;
  --size-small: 0.8125rem;
  --size-body: 0.9375rem;
  --size-name: 1.125rem;
  --size-title: 1.5rem;
  --size-code: 3rem;
  --size-code-narrow: 2.25rem;
  --weight-text: 400;
  --weight-medium: 500;
  --weight-strong: 600;
  --leading-body: 1.5;
  --leading-tight: 1.2;
  --tracking-title: -0.01em;
  --tracking-label: 0.06em;
  --tracking-code: 0.08em;

  /* Space on a 4px step. */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2.5rem;
  --space-9: 3.5rem;

  /* The column: 360px or 512px, 24px from the window's edges on a phone; its middle at ~42% of the height. */
  --column-narrow: min(22.5rem, 100% - 3rem);
  --column-wide: min(32rem, 100% - 3rem);
  --page-rows: 42fr auto 58fr;
  --size-control: 2.75rem;
  --size-avatar: 2.5rem;
  --size-mark: 2.5rem;
  --size-icon: 1.125rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
  }
}

/* The rules of every page (brief 070): a web page, one column on a flat ground, no boxes. Values come from tokens.css only. */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-text);
  font-size: var(--size-body);
  line-height: var(--leading-body);
  color: var(--text);
  background: var(--page-bg);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
p,
ul,
dl,
dd,
form {
  margin: 0;
}

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

/*
 * The page: one column, its middle a little above the window's (~42%).
 * A long column fills the window and keeps its air at the edges.
 */
.page {
  display: grid;
  grid-template-rows: var(--page-rows);
  justify-items: center;
  min-height: 100dvh;
  padding: var(--space-9) 0;
}

.page-column {
  display: grid;
  grid-row: 2;
  gap: var(--space-6);
  align-content: start;
}

/* A message or one action: everything on the axis. */
.page-narrow {
  justify-items: center;
  width: var(--column-narrow);
  text-align: center;
}

/* Lists and facts are read from the left. */
.page-wide {
  width: var(--column-wide);
}

.page-narrow > :not(.mark) {
  width: 100%;
}

.page-title {
  margin-bottom: var(--space-2);
  font-size: var(--size-title);
  font-weight: var(--weight-strong);
  line-height: var(--leading-tight);
  color: var(--text-strong);
  letter-spacing: var(--tracking-title);
}

/* The mark: teemr's icon whole, its own ground and corners, only scaled. */
.mark {
  display: block;
  width: var(--size-mark);
  height: var(--size-mark);
}

/*
 * The body's cells overlap by 0.6 of 1024; scaled down, each edge is
 * smoothed on its own and hairline seams show between cells that the
 * source PNG does not have. Crisp edges for the cells only (the panel's
 * rounded ground and rim keep their smoothing): the drawing is the same.
 */
.mark > g > rect:not(:first-child) {
  shape-rendering: crispedges;
}

/* A form's rhythm: each field and the button 20px apart, never touching. */
.stack {
  display: grid;
  gap: var(--space-5);
}

/* A form whose button keeps its own width. */
.stack-start {
  justify-items: start;
}

/* Buttons: one look for a submit and for a link that acts like one. */
.button {
  display: inline-flex;
  gap: var(--space-3);
  align-items: center;
  justify-content: center;
  min-height: var(--size-control);
  padding: var(--space-2) var(--space-5);
  font: inherit;
  font-weight: var(--weight-medium);
  color: var(--text);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  background: var(--button);
  border: var(--line-button);
  border-radius: var(--radius-control);
}

.button:hover {
  background: var(--button-hover);
}

.button-block {
  width: 100%;
}

.button-primary {
  color: var(--primary-text);
  background: var(--primary-fill);
  border-color: var(--primary-fill);
}

.button-primary:hover {
  background: var(--primary-fill-hover);
  border-color: var(--primary-fill-hover);
}

.button-danger {
  color: var(--danger-text);
  background: var(--danger-fill);
  border-color: var(--danger-fill);
}

.button-danger:hover {
  background: var(--danger-fill-hover);
  border-color: var(--danger-fill-hover);
}

/* Quiet danger: a line of small red words, nothing that invites a click. */
.button-quiet-danger {
  min-height: 0;
  padding: 0;
  font-size: var(--size-small);
  font-weight: var(--weight-text);
  color: var(--danger);
  background: transparent;
  border: 0;
}

.button-quiet-danger:hover {
  text-decoration: underline;
  background: transparent;
}

.button-icon {
  flex: none;
  width: var(--size-icon);
  height: var(--size-icon);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.actions > * {
  flex: 1 1 0;
}

/* Field */
.field {
  display: grid;
  gap: var(--space-2);
  text-align: start;
}

.field-label {
  font-size: var(--size-small);
  font-weight: var(--weight-medium);
  color: var(--text-dim);
}

.field-input {
  min-height: var(--size-control);
  padding: var(--space-2) var(--space-3);
  font: inherit;
  color: var(--text);
  background: var(--button);
  border: var(--line-button);
  border-radius: var(--radius-control);
}

/* Notice: no plate, no red paragraph; the title says what happened. What went wrong reads in the text's colour, the rest a step quieter. */
.notice {
  overflow-wrap: anywhere;
}

.notice-info {
  color: var(--text-dim);
}

.notice-error {
  color: var(--text);
}

/* A host's code: the thing the person checks, the largest thing on the page. */
.code {
  display: grid;
  gap: var(--space-1);
}

.code-value {
  font-family: var(--font-mono);
  font-size: var(--size-code);
  font-weight: var(--weight-strong);
  line-height: var(--leading-tight);
  color: var(--text-strong);
  letter-spacing: var(--tracking-code);
  overflow-wrap: anywhere;
}

/* Label — value rows between thin lines: the label left, the value at the end. */
.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  border-block: var(--line-thin);
}

.facts dt,
.facts dd {
  padding: var(--space-3) 0;
  border-top: var(--line-thin);
}

.facts > :nth-child(-n + 2) {
  border-top: 0;
}

.facts dt {
  color: var(--text-dim);
}

.facts dd {
  min-width: 0;
  padding-left: var(--space-6);
  font-weight: var(--weight-medium);
  text-align: end;
  overflow-wrap: anywhere;
}

.facts .facts-mono {
  font-family: var(--font-mono);
  font-size: var(--size-small);
  font-weight: var(--weight-text);
  line-height: var(--leading-body);
}

/* Sections: small grey caps over a group. */
.section {
  display: grid;
  gap: var(--space-2);
}

.section-title {
  font-size: var(--size-label);
  font-weight: var(--weight-strong);
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
}

/* Rows between thin lines: the word and its time on one line, the machine's detail under them. */
.rows {
  display: grid;
  padding: 0;
  list-style: none;
  border-bottom: var(--line-thin);
}

.row {
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: var(--space-4);
  align-items: baseline;
  min-width: 0;
  padding: var(--space-3) 0;
  border-top: var(--line-thin);
}

.row-label {
  font-weight: var(--weight-medium);
}

.row-meta {
  font-family: var(--font-mono);
  font-size: var(--size-small);
  line-height: var(--leading-body);
  color: var(--text-dim);
}

.row-detail {
  grid-column: 1 / -1;
  overflow-wrap: anywhere;
}

/* Who is signed in, and «Sign out» at the line's end when there is a name; under a form, a block of its own, 40px below it. */
.who {
  display: grid;
  gap: var(--space-8);
}

.who-line {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  align-items: center;
  justify-content: space-between;
}

.person {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  min-width: 0;
}

.person-avatar {
  display: grid;
  flex: none;
  place-items: center;
  width: var(--size-avatar);
  height: var(--size-avatar);
  font-family: var(--font-mono);
  font-size: var(--size-small);
  font-weight: var(--weight-strong);
  color: var(--text-dim);
  border: var(--line-button);
  border-radius: var(--radius-round);
}

.person-name {
  display: grid;
  min-width: 0;
  font-size: var(--size-name);
  font-weight: var(--weight-strong);
  line-height: var(--leading-tight);
  overflow-wrap: anywhere;
}

.person-said {
  font-size: var(--size-small);
  font-weight: var(--weight-text);
  color: var(--text-dim);
}

.key-age {
  font-family: var(--font-mono);
  font-size: var(--size-small);
  color: var(--text-dim);
}

.key-age-due {
  color: var(--text);
}

/* The bottom of the account: closing, far below everything else, quiet. */
.far {
  display: grid;
  gap: var(--space-3);
  justify-items: start;
  margin-top: var(--space-8);
}

.link {
  color: var(--text);
  text-decoration-color: var(--text-dim);
}

@media (width <= 40rem) {
  .page {
    padding: var(--space-8) 0;
  }

  .code-value {
    font-size: var(--size-code-narrow);
  }

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

  .facts dd {
    padding-top: 0;
    padding-left: 0;
    text-align: start;
    border-top: 0;
  }

  .facts dt {
    padding-bottom: var(--space-1);
  }

  .facts > :first-child {
    border-top: 0;
  }

  .facts > dt:nth-child(3) {
    border-top: var(--line-thin);
  }
}
