/* nox — общий слой: токены, типографика, кнопки, поля, модалки, тосты */

:root {
  /* одна нейтральная шкала с лёгким холодным оттенком — ночь и свет монитора.
     Кабинет берёт ту же шкалу без оттенка, см. начало dashboard.css. */
  --bg: #0b0d14;
  --bg-2: #07080d;
  --surface: #11141c;
  --raised: #1a1e28;
  --line: rgba(238, 240, 245, 0.08);
  --line-2: rgba(238, 240, 245, 0.14);
  --text: #eef0f5;
  --muted: #a3a9b8;
  --dim: #7a8296;

  /* один акцент на весь сайт: главное действие, выбранное, имя в адресе */
  --acc: #f06595;
  --acc-rgb: 240, 101, 149;
  --acc-fill: #c2255c;
  --acc-hi: #d6336c;
  --acc-lo: #8f1a43;
  --acc-ink: #ffffff;
  --ok: #4cc38a;
  --bad: #ec5d62;
  --warn: #e2a84a;

  --font: 'Onest', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Unbounded', 'Onest', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;

  /* одна кривая на всё; --spring оставлена именем для старых правил, без отскока */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --spring: cubic-bezier(0.22, 1, 0.36, 1);
  --wrap: 1180px;
}

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

html {
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

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

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

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

button {
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
}

img,
svg,
canvas {
  display: block;
  max-width: 100%;
}

::selection {
  background: rgba(var(--acc-rgb), 0.3);
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--acc);
  outline-offset: 2px;
  border-radius: 6px;
}

[hidden] {
  display: none !important;
}

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

.wrap {
  width: min(100% - 48px, var(--wrap));
  margin-inline: auto;
}

.mono {
  font-family: var(--mono);
  font-feature-settings: 'zero', 'ss01';
  font-variant-numeric: tabular-nums;
}

.svg {
  width: 1em;
  height: 1em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* иконки площадок: один svg-файл, цвет берётся из текста */
.ico {
  display: inline-block;
  width: 1em;
  height: 1em;
  flex: none;
  background: currentColor;
  -webkit-mask: var(--i) center / contain no-repeat;
  mask: var(--i) center / contain no-repeat;
}

/* ---------------------------------------------------------------- логотип */

.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: 500 17px/1 var(--display);
  letter-spacing: -0.02em;
}

/* полумесяц одним цветом: круг с вырезанным кругом поменьше */
.logo__mark {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--acc);
  -webkit-mask: radial-gradient(circle at 68% 34%, transparent 0 42%, #000 43%);
  mask: radial-gradient(circle at 68% 34%, transparent 0 42%, #000 43%);
}

/* ---------------------------------------------------------------- кнопки */

.btn {
  --h: 40px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--h);
  padding: 0 16px;
  border-radius: 10px;
  font: 500 14px/1 var(--font);
  white-space: nowrap;
  user-select: none;
  transition: background-color 0.14s var(--ease), color 0.14s var(--ease), box-shadow 0.14s var(--ease), transform 0.14s var(--ease);
}

.btn:active {
  transform: scale(0.98);
}

.btn .svg {
  font-size: 16px;
}

/* главное действие на экране — единственное место, где кнопка берёт акцент */
.btn--primary {
  color: var(--acc-ink);
  background: var(--acc-fill);
}

.btn--primary:hover {
  background: var(--acc-hi);
}

/* заметная, но без акцента: светлая с тёмным текстом */
.btn--light {
  color: var(--bg);
  background: var(--text);
}

.btn--light:hover {
  background: #fff;
}

.btn--ghost {
  background: var(--raised);
  box-shadow: inset 0 0 0 1px var(--line);
}

.btn--ghost:hover {
  background: color-mix(in srgb, var(--raised) 86%, var(--text));
  box-shadow: inset 0 0 0 1px var(--line-2);
}

.btn--quiet {
  color: var(--muted);
  padding: 0 12px;
}

.btn--quiet:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.btn--danger:hover {
  color: var(--bad);
}

.btn--sm {
  --h: 32px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 13px;
}

.btn--lg {
  --h: 48px;
  padding: 0 20px;
  font-size: 15px;
}

.btn--block {
  width: 100%;
}

.btn[disabled],
.btn[aria-busy='true'] {
  pointer-events: none;
  opacity: 0.55;
}

.btn--icon {
  width: var(--h);
  padding: 0;
}

/* ---------------------------------------------------------------- поля */

.field {
  display: grid;
  /* не auto: иначе поле с приклеенным адресом сайта на узком экране шире своей колонки */
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.field__label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.field__label small {
  font: 400 12px var(--mono);
  color: var(--dim);
}

.input,
.textarea {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: var(--raised);
  box-shadow: inset 0 0 0 1px var(--line);
  outline: none;
  transition: box-shadow 0.14s var(--ease), background-color 0.14s var(--ease);
}

.textarea {
  height: auto;
  min-height: 96px;
  padding: 12px;
  resize: vertical;
  line-height: 1.5;
}

.input::placeholder,
.textarea::placeholder {
  color: var(--dim);
}

.input:hover,
.textarea:hover {
  box-shadow: inset 0 0 0 1px var(--line-2);
}

.input:focus,
.textarea:focus {
  box-shadow: inset 0 0 0 1.5px var(--acc);
}

.field--bad .input,
.field--bad .inbox {
  box-shadow: inset 0 0 0 1.5px var(--bad);
}

.field__msg {
  min-height: 16px;
  font-size: 13px;
  line-height: 16px;
  color: var(--dim);
}

.field--bad .field__msg {
  color: var(--bad);
}

.field--ok .field__msg {
  color: var(--ok);
}

/* поле с приклеенным префиксом (nox.bio/…) или кнопкой внутри */
.inbox {
  display: flex;
  align-items: center;
  height: 44px;
  padding: 0 4px 0 12px;
  border-radius: 10px;
  background: var(--raised);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: box-shadow 0.14s var(--ease), background-color 0.14s var(--ease);
  cursor: text;
}

.inbox:focus-within {
  box-shadow: inset 0 0 0 1.5px var(--acc);
}

.inbox__prefix {
  color: var(--dim);
  font-family: var(--mono);
  font-size: 14px;
  white-space: nowrap;
}

.inbox input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: none;
  padding: 0 8px 0 1px;
}

.inbox input::placeholder {
  color: var(--dim);
}

.inbox__btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 16px;
}

.inbox__btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

/* ---------------------------------------------------------------- сегменты и переключатели */

.seg {
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 2px;
  padding: 2px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 0 0 1px var(--line);
}

.seg button {
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  transition: color 0.14s var(--ease), background-color 0.14s var(--ease), box-shadow 0.14s var(--ease);
}

.seg button:hover {
  color: var(--text);
}

.seg button[aria-pressed='true'],
.seg button[aria-selected='true'] {
  color: var(--text);
  background: var(--raised);
  box-shadow: inset 0 0 0 1px var(--line-2), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.switch {
  position: relative;
  flex: none;
  width: 40px;
  height: 24px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: background-color 0.16s var(--ease);
}

.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.16s var(--ease), background-color 0.16s var(--ease);
}

.switch[aria-checked='true'] {
  background: var(--acc-fill);
  box-shadow: none;
}

.switch[aria-checked='true']::after {
  transform: translateX(16px);
  background: var(--acc-ink);
}

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

.swatch {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--c);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.swatch[aria-pressed='true'] {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------- модалки */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  visibility: hidden;
  transition: visibility 0s 0.2s;
}

.modal[data-open] {
  visibility: visible;
  transition-delay: 0s;
}

.modal__scrim {
  position: absolute;
  inset: 0;
  background: rgba(4, 5, 8, 0.72);
  opacity: 0;
  transition: opacity 0.2s var(--ease);
}

.modal__panel {
  position: relative;
  width: min(100%, var(--w, 440px));
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 24px;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line-2), 0 24px 64px -16px rgba(0, 0, 0, 0.7);
  opacity: 0;
  transform: translateY(8px);
  transition: transform 0.2s var(--ease), opacity 0.2s var(--ease);
}

.modal[data-open] .modal__scrim {
  opacity: 1;
}

.modal[data-open] .modal__panel {
  opacity: 1;
  transform: none;
}

.modal__x {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 18px;
}

.modal__x:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.modal__title {
  font: 500 18px/1.3 var(--font);
  padding-right: 36px;
}

.modal__sub {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
}

.modal__body {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.modal__foot {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 24px;
}

@media (max-width: 560px) {
  .modal {
    padding: 0;
    place-items: end center;
  }

  .modal__panel {
    width: 100%;
    max-height: 92dvh;
    padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
    border-radius: 16px 16px 0 0;
    transform: translateY(24px);
  }
}

/* ---------------------------------------------------------------- тосты */

.toasts {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 150;
  display: grid;
  gap: 8px;
  justify-items: center;
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px 12px 16px;
  border-radius: 10px;
  background: var(--raised);
  box-shadow: inset 0 0 0 1px var(--line-2), 0 16px 32px -12px rgba(0, 0, 0, 0.7);
  font-size: 14px;
  pointer-events: auto;
  animation: toast-in 0.2s var(--ease);
}

.toast[data-out] {
  animation: toast-out 0.16s var(--ease) forwards;
}

.toast--bad {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--bad) 55%, transparent), 0 16px 32px -12px rgba(0, 0, 0, 0.7);
}

.toast button {
  color: var(--acc);
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 6px;
}

.toast button:hover {
  background: rgba(var(--acc-rgb), 0.12);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(8px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------------------------------------------------------------- переключатель языка */

/* кнопка, которая выглядит как соседние ссылки в подвале */
.langlink {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: color 0.14s var(--ease);
}

.langlink:hover {
  color: var(--text);
}
