/* Noto Sans is the fallback for systems without Segoe UI. */
@font-face {
  font-family: "Play";
  src: url("../assets/fonts/Play/Play-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Play";
  src: url("../assets/fonts/Play/Play-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "Noto Sans";
  src: url("../assets/fonts/noto-sans-cyrillic-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Noto Sans";
  src: url("../assets/fonts/noto-sans-cyrillic-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: dark;

  --bg-start: #060f1c;
  --bg-middle: #091626;
  --bg-end: #06101f;
  --text: #f7fafc;
  --muted: #91a3b8;
  --subtle: #7a8b9d;
  --accent: #75c6e7;
  --icon: var(--accent);
  --ink-ring: rgba(255, 255, 255, 0.55);
  --ink: #06121f;
  --line: rgba(130, 180, 210, 0.16);
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

/* The page behind any open window stays still. */
html:has(dialog[open]) {
  overflow: hidden;
}

/* Keeps room for the scrollbar, so the page doesn't jump sideways when a window opens. */
html:has(.catalog-page) {
  scrollbar-gutter: stable;
}

body {
  background: var(--bg-start);
  color: var(--text);
  font-family: "Segoe UI", "Noto Sans", system-ui, sans-serif;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.icon {
  flex: none;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Backdrop. Shape positions are offsets from the centre of the screen. */
.backdrop {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: linear-gradient(to bottom right, var(--bg-start), var(--bg-middle) 50%, var(--bg-end));
}

.shape {
  position: absolute;
  left: calc(50% + var(--x));
  top: calc(50% + var(--y));
  width: var(--d);
  aspect-ratio: 1;
  border-radius: 50%;
  translate: -50% -50%;
}

.ring {
  --x: 0px;
  --y: -421px;
}

.ring--outer {
  --d: 1542px;
  background: rgba(120, 170, 210, 0.012);
}

.ring--middle {
  --d: 1298px;
  background: rgba(110, 170, 190, 0.035);
}

.ring--inner {
  --d: 1054px;
  background: rgba(6, 16, 32, 0.45);
  border: 1px solid rgba(120, 165, 195, 0.1);
}

.disc::before {
  content: "";
  position: absolute;
  inset: -150px;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--halo) 45%, transparent);
}

.disc--teal {
  --x: -29.6vw;
  --y: -137px;
  --d: 290px;
  --halo: rgba(50, 110, 130, 0.035);
  background: rgba(40, 130, 125, 0.03);
}

.disc--violet {
  --x: 32vw;
  --y: 168px;
  --d: 360px;
  --halo: rgba(80, 80, 150, 0.025);
  background: rgba(80, 90, 160, 0.025);
}

.glow {
  --x: 0px;
  --y: -30px;
  --d: 760px;
  background: radial-gradient(closest-side, rgba(35, 100, 150, 0.1), rgba(35, 100, 150, 0.05) 50%, transparent);
}

/* Landing header: the same light blue as the main button. */
.site-top {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px 24px;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 24px 12px;
  background: linear-gradient(135deg, #a8dff2, #6fbbdc);
  box-shadow: 0 6px 24px rgba(90, 170, 220, 0.18);
  color: var(--ink);
}

.brand {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
}

.brand__mark {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.brand__dot {
  fill: currentColor;
  stroke: none;
}

.brand__name {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1;
}

.site-top__meaning {
  margin: 0 0 0 auto;
  font-size: 15px;
  letter-spacing: 0.01em;
  text-align: right;
}

.brand:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
  border-radius: 4px;
}

.build-note {
  position: absolute;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  left: 24px;
  margin: 0;
  color: var(--subtle);
  font-size: 13px;
}

@media (max-width: 640px) {
  .site-top {
    flex-wrap: wrap;
    padding-inline: 16px;
  }

  .site-top__meaning {
    margin-left: 0;
    font-size: 13px;
    text-align: left;
  }

  .build-note {
    left: 16px;
  }
}

/* Landing */
.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: 32px 16px;
  text-align: center;
  transition: opacity 0.2s ease;
  animation: hero-in 0.8s ease-out backwards;
}

body:has(.login[open]) .hero {
  opacity: 0;
}

@keyframes hero-in {
  from {
    opacity: 0;
    scale: 0.89;
  }
}

.beacon {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border: 1px solid #2a4559;
  border-radius: 50%;
  background: #12293c;
}

.beacon::after,
.login__mark::after {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
}

.logo {
  margin: 20px 0 0;
  font-size: clamp(104px, 12.4vw, 159px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.07em;
  text-shadow: 0 0 48px rgba(120, 190, 230, 0.15);
}

.tagline {
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 22px;
  line-height: 1.4;
  letter-spacing: 0.105em;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #a8dff2, #6fbbdc);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    0 10px 36px rgba(90, 170, 220, 0.2);
  color: var(--ink);
  font: inherit;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.15s ease;
}

.btn:hover {
  filter: brightness(1.06);
}

.btn:focus-visible,
.icon-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.btn--hero {
  gap: 24px;
  width: 220px;
  height: 66px;
  margin-top: 65px;
}

.icon--arrow {
  width: 20px;
  height: 20px;
  stroke-width: 1.75;
}

/* Login window */
.login {
  width: min(486px, 100vw - 32px);
  max-width: none;
  max-height: calc(100dvh - 32px);
  padding: clamp(24px, 8vw, 50px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(135deg, #132538, #091626);
  box-shadow:
    0 26px 36px -28px rgba(120, 190, 230, 0.3),
    0 30px 80px rgba(0, 0, 0, 0.5);
  color: var(--text);
}

.login[open] {
  animation: login-in 0.2s ease-out;
}

.login::backdrop {
  background: rgba(0, 2, 6, 0.55);
  backdrop-filter: blur(12px);
}

@keyframes login-in {
  from {
    opacity: 0;
    scale: 0.96;
  }
}

.login__close {
  position: absolute;
  top: 24px;
  right: 23px;
}

.login__close .icon {
  width: 20px;
  height: 20px;
  stroke-width: 1.75;
}

.field__toggle .icon {
  width: 19px;
  height: 19px;
  stroke-width: 1.75;
}

.login__header {
  display: flex;
  align-items: center;
  gap: 17px;
  padding-right: 24px;
}

.login__mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid #2a4559;
  border-radius: 12px;
  background: #172d41;
}

.login__mark::after {
  width: 8px;
  height: 8px;
}

.login__title {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.login__form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 36px;
}

.field {
  position: relative;
  display: block;
}

.field__icon {
  position: absolute;
  top: 50%;
  left: 20px;
  translate: 0 -50%;
  color: var(--subtle);
  pointer-events: none;
}

.field__input {
  display: block;
  width: 100%;
  height: 65px;
  padding: 0 56px 0 53px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: 0;
  background: #081524;
  color: var(--text);
  font: inherit;
  font-size: 17px;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.field__input::placeholder {
  color: var(--subtle);
  opacity: 1;
}

.field__input:focus {
  border-color: var(--accent);
  background: #06121f;
  box-shadow: 0 0 0 1px var(--accent);
}

/* Keep browser autofill from painting the field in its own colours. */
.field__input:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  box-shadow: 0 0 0 100px #081524 inset;
  caret-color: var(--text);
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--subtle);
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.icon-btn:hover {
  background: rgba(130, 180, 210, 0.1);
  color: var(--text);
}

.field__toggle {
  position: absolute;
  top: 50%;
  right: 20px;
  translate: 0 -50%;
}

.icon--eye-off,
.field__toggle[aria-pressed="true"] .icon--eye {
  display: none;
}

.field__toggle[aria-pressed="true"] .icon--eye-off {
  display: block;
}

.login__error {
  margin: 0;
  color: #ff9d9d;
  font-size: 15px;
}

.btn:disabled {
  cursor: progress;
  opacity: 0.7;
}

.btn--submit {
  width: 100%;
  height: 66px;
  margin-top: 10px;
}

@media (prefers-reduced-motion: reduce) {
  .hero,
  .login[open] {
    animation: none;
  }

  .hero,
  .btn,
  .icon-btn,
  .field__input {
    transition: none;
  }
}
