/* CloudPass — web portal.
 *
 * Black and white, and nothing else: no accent colour, no gradients, no shadows, no rounded
 * corners. The whole design is type, hairlines and space, so the things that are usually
 * decoration — weight, tracking, a 1px border — have to carry the hierarchy on their own.
 *
 * The typeface is served from this origin. The page is under `default-src 'none'`, and the
 * rule the project set for itself is that nothing loads from a third party; a font CDN would
 * be exactly that, so the two subsets the interface needs live in `fonts/`.
 */

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

@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('fonts/montserrat-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;
}

:root {
  --bg: #000000;
  --fg: #ffffff;
  --muted: #9a9a9a;
  --faint: #6a6a6a;
  --line: #1c1c1c;
  --line-strong: #3a3a3a;
  --field: #080808;
  --maxw: 1120px;
  --gutter: 28px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* `hidden` has to actually hide.
 *
 * The user-agent stylesheet says `[hidden] { display: none }`, and **any** author rule that
 * sets `display` beats it — cascade origin outranks specificity, not the other way round.
 * `.view`, `.btn` and `.boot` all set `display`, so without this line every screen is painted
 * at once, `hidden` becomes a lie only the DOM believes, and the portal looks like a page
 * where clicking «Создать аккаунт» does nothing at all.
 *
 * The `!important` is deliberate. This is an invariant of the document rather than a style for
 * one component, and no component rule should be able to quietly override it. */
[hidden] {
  display: none !important;
}

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

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: 'Montserrat', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- the page column ------------------------------------------------------- */

/* One `.view` is one screen. The width constraint lives here rather than on each block, so
   a screen is either wide or narrow as a whole and nothing inside has to be re-centred. */
.view {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: var(--maxw);
  min-height: 100dvh;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.view.narrow {
  max-width: 560px;
}

.view.medium {
  max-width: 680px;
}

/* --- type ------------------------------------------------------------------ */

h1 {
  font-size: clamp(2.4rem, 7vw, 4.6rem);
  font-weight: 600;
  line-height: 1.03;
  letter-spacing: -0.035em;
}

h2 {
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.eyebrow {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--faint);
}

.lede {
  max-width: 54ch;
  font-size: clamp(1rem, 1.4vw, 1.125rem);
  font-weight: 400;
  line-height: 1.65;
  color: var(--muted);
}

.note {
  font-size: 0.8125rem;
  color: var(--faint);
}

.alt {
  font-size: 0.875rem;
  color: var(--muted);
}

.link {
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px solid var(--line-strong);
  transition: border-color 0.15s ease;
}

.link:hover {
  border-bottom-color: var(--fg);
}

/* The header's sign-in/sign-out control is a button, not a link: it changes what the page is
   doing rather than pointing at another document, and the session decides which of the two
   words it wears. It has to look exactly like `.link` while behaving like a control, so the
   button defaults — background, padding, the browser's own border — are undone here. */
.link-button {
  padding: 0;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  border-radius: 0;
  font: inherit;
  color: var(--fg);
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.link-button:hover {
  border-bottom-color: var(--fg);
}

/* --- chrome ---------------------------------------------------------------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-block: 26px;
  border-bottom: 1px solid var(--line);
}

.wordmark {
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--fg);
  text-decoration: none;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.8125rem;
}

.who {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
}

/* The language picker lives in the top bar, so it is sized like the small controls beside
   it and carries no colour of its own: the design has one accent — white — and the control
   is not it. */
.language-select {
  padding: 6px 8px;
  background: var(--field);
  color: var(--fg);
  border: 1px solid var(--line-strong);
  border-radius: 0;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.language-select:focus-visible {
  outline: 1px solid var(--fg);
  outline-offset: 2px;
  border-color: var(--fg);
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: auto;
  padding-block: 26px 34px;
  border-top: 1px solid var(--line);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 26px;
  border: 1px solid transparent;
  border-radius: 0;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn-solid {
  background: var(--fg);
  color: #000000;
  border-color: var(--fg);
}

.btn-solid:hover {
  background: #d0d0d0;
  border-color: #d0d0d0;
}

.btn-outline {
  background: transparent;
  color: var(--fg);
  border-color: var(--line-strong);
}

.btn-outline:hover {
  border-color: var(--fg);
}

/* Used inside the inverted white panel, where the usual colours would be invisible. */
.btn-inverse {
  background: #000000;
  color: var(--fg);
  border-color: #000000;
}

.btn-inverse:hover {
  background: #1a1a1a;
  border-color: #1a1a1a;
}

.btn-small {
  padding: 9px 16px;
  font-size: 0.8125rem;
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.45;
  cursor: default;
}

/* Pushes to the right edge of an action row — «Удалить» sits away from «Сохранить». */
.btn-push {
  margin-left: auto;
}

/* --- landing --------------------------------------------------------------- */

.landing {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.hero {
  display: flex;
  flex-direction: column;
  gap: 26px;
  max-width: 58rem;
  padding-block: clamp(72px, 15vh, 168px) clamp(64px, 12vh, 128px);
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
}

/* Hairline separators come from the 1px gap showing the grid's background through, which
   keeps them exactly one pixel at any zoom — unlike a border, which rounds. */
.principles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border-block: 1px solid var(--line);
}

.principle {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 42px 34px;
  background: var(--bg);
}

/* Flush with the page edges, so the panel reads as part of the column and not as a box
   floating inside it. */
.principle:first-child {
  padding-left: 0;
}

.principle:last-child {
  padding-right: 0;
}

.principle-index {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  color: var(--faint);
}

.principle p:last-child {
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--muted);
}

/* The one moment of inversion on the page: a white panel, black text. */
.callout {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 18px;
  margin-block: clamp(72px, 12vh, 120px);
  padding: clamp(40px, 6vw, 68px) clamp(28px, 5vw, 64px);
  background: var(--fg);
  color: #000000;
}

.callout h2 {
  font-size: clamp(1.75rem, 3.4vw, 2.5rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.callout p {
  max-width: 52ch;
  font-size: 0.9375rem;
  line-height: 1.7;
  color: #3d3d3d;
}

/* --- the offered builds ---------------------------------------------------- */

/* Sits after the inverted panel, so the page ends on the black half of the palette rather
   than on a white block. A hairline above keeps it from reading as a stray paragraph. The
   Android offer reuses every rule: it is the same kind of thing in the same place, and two
   blocks that had to be kept in step by hand would drift the first time one was touched. */
.desktop,
.android {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 40px;
  align-items: start;
  padding-block: 44px 8px;
  border-top: 1px solid var(--line);
}

.desktop-text,
.android-text {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 46ch;
}

.desktop-text h2,
.android-text h2 {
  font-size: clamp(1.25rem, 2.2vw, 1.6rem);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.desktop-download,
.android-download {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-end;
  text-align: right;
}

/* The hash is the one piece of real information a person can check against the file they
   downloaded, so it is shown whole rather than truncated — and monospaced and selectable, so
   it can be copied in one gesture. */
.fingerprint {
  max-width: 34ch;
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  font-size: 0.6875rem;
  line-height: 1.6;
  color: var(--faint);
  overflow-wrap: anywhere;
  user-select: all;
}

/* --- forms ----------------------------------------------------------------- */

.auth {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-block: clamp(44px, 9vh, 96px) 72px;
}

.auth-title {
  font-size: clamp(1.875rem, 4.2vw, 2.75rem);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.032em;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 8px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.field-label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--faint);
}

.field-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.field-row input {
  flex: 1;
}

input[type='text'],
input[type='password'],
textarea {
  width: 100%;
  padding: 14px 16px;
  background: var(--field);
  color: var(--fg);
  border: 1px solid var(--line-strong);
  border-radius: 0;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  transition: border-color 0.15s ease;
}

/* The project picker is a `select` and has to read as the text fields around it: same field
   colour, same hairline, same padding, and no rounding — the design has no radius to spend.
   The platform's own arrow is left alone on purpose: it is the one part of a select that
   everybody already recognises, and drawing our own would cost an image the CSP allows only
   from this origin. */
.field select,
.project-new {
  width: 100%;
  padding: 14px 16px;
  background: var(--field);
  color: var(--fg);
  border: 1px solid var(--line-strong);
  border-radius: 0;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  transition: border-color 0.15s ease;
}

.field select {
  cursor: pointer;
}

textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.6;
}

input::placeholder {
  color: #4d4d4d;
}

input:focus,
textarea:focus,
select:focus,
.btn:focus-visible,
.link:focus-visible {
  outline: none;
  border-color: var(--fg);
}

/* A select that has just been reached by keyboard looks like a button that has been: the
   border alone is too quiet next to a field the person is typing into. */
.field select:focus-visible {
  outline: 1px solid var(--fg);
  outline-offset: 2px;
}

.btn:focus-visible,
.link:focus-visible {
  outline: 1px solid var(--fg);
  outline-offset: 2px;
}

/* --- emergency kit --------------------------------------------------------- */

.kit {
  max-height: 360px;
  padding: 20px;
  overflow: auto;
  background: var(--field);
  border: 1px solid var(--line-strong);
  color: var(--fg);
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  font-size: 0.8125rem;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  user-select: all;
}

/* --- vault ----------------------------------------------------------------- */

.vault {
  flex: 1;
  padding-block: 26px 64px;
}

.statusline {
  min-height: 1.2em;
  font-size: 0.8125rem;
  color: var(--faint);
  padding-bottom: 22px;
}

/* --- the cabinet: two lists ------------------------------------------------ */

/* The hairline between the panels is the 1px grid gap showing the background through, the
   same trick as `.principles` on the landing page, so it stays exactly one pixel at any
   zoom instead of rounding the way a border does. */
.cabinet {
  display: grid;
  grid-template-columns: minmax(190px, 260px) 1fr;
  gap: 1px;
  background: var(--line);
  border-block: 1px solid var(--line);
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  padding-block: 26px;
  background: var(--bg);
}

.panel:first-child {
  padding-right: 24px;
}

.panel:last-child {
  padding-left: 24px;
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.panel-title {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--faint);
}

.panel-scope {
  font-size: 0.75rem;
  color: var(--faint);
  overflow-wrap: anywhere;
}

/* --- projects -------------------------------------------------------------- */

.projects {
  list-style: none;
  border-top: 1px solid var(--line);
}

.project {
  border-bottom: 1px solid var(--line);
}

/* A whole row is the target, not a word inside it: the name of a project is a long,
   unpredictable string, and a person aiming at «Инфраструктура» should not have to hit the
   text itself. */
.project-button {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 12px 0;
  background: none;
  border: 0;
  border-radius: 0;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
  transition: color 0.15s ease;
}

.project-button:hover {
  color: var(--fg);
}

.project-button:focus-visible {
  outline: 1px solid var(--fg);
  outline-offset: 2px;
}

/* Weight and colour carry the selection, because there is no accent colour to spend and a
   filled row would read as a button rather than as a state. */
.project-button[aria-current='true'] {
  color: var(--fg);
  font-weight: 700;
}

.project-count {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--faint);
}

.item-project {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}

.items {
  list-style: none;
  border-top: 1px solid var(--line);
}

.item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding-block: 20px;
  border-bottom: 1px solid var(--line);
}

.item-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 200px;
}

.item-title {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.item-sub {
  font-size: 0.8125rem;
  color: var(--faint);
  overflow-wrap: anywhere;
}

.item-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.empty {
  padding-block: 44px;
  color: var(--faint);
  font-size: 0.875rem;
}

/* --- messages -------------------------------------------------------------- */

/* A bar rather than a dialog: it has to be impossible to miss, and the inverted colours are
   the only way to be loud inside a palette this quiet. */
.banner {
  position: fixed;
  left: 50%;
  bottom: 32px;
  z-index: 10;
  transform: translateX(-50%);
  max-width: min(560px, calc(100vw - 48px));
  padding: 14px 20px;
  background: var(--fg);
  color: #000000;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.5;
}

/* --- boot ------------------------------------------------------------------ */

.boot {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding-inline: var(--gutter);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--faint);
  text-align: center;
}

/* --- motion ---------------------------------------------------------------- */

@media (prefers-reduced-motion: no-preference) {
  .hero > * {
    animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }

  .hero > *:nth-child(2) {
    animation-delay: 0.06s;
  }

  .hero > *:nth-child(3) {
    animation-delay: 0.12s;
  }

  .hero > *:nth-child(4) {
    animation-delay: 0.18s;
  }

  @keyframes rise {
    from {
      opacity: 0;
      transform: translateY(10px);
    }
    to {
      opacity: 1;
      transform: none;
    }
  }
}

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

@media (max-width: 880px) {
  .principles {
    grid-template-columns: 1fr;
  }

  /* Stacked, the panels share the column instead of sitting side by side, so the horizontal
     padding that separated them becomes padding that pushes them apart for no reason. */
  .cabinet {
    grid-template-columns: 1fr;
  }

  .panel:first-child,
  .panel:last-child {
    padding-inline: 0;
  }

  .principle {
    padding: 32px 0;
  }

  .principle:last-child {
    padding-bottom: 34px;
  }

  .topbar {
    padding-block: 20px;
  }

  .footer {
    flex-direction: column;
    gap: 6px;
  }

  .desktop,
  .android {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  /* Left-aligned once the button is under the text rather than beside it: a right-aligned
     block on its own line reads as a mistake. */
  .desktop-download,
  .android-download {
    align-items: flex-start;
    text-align: left;
  }
}
