/* =====================================================================
   Sun Tracker — тема. Все цвета, отступы, радиусы, шрифты и тени — здесь.
   Чтобы перекрасить сайт, достаточно поменять --accent (и при желании
   --accent-2 / --accent-3 / --ok): остальные оттенки выводятся из них.
   ===================================================================== */

/* ---------- Шрифты (self-host, OFL; см. static/fonts/OFL-*.txt) ---------- */
@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url("../fonts/nunito-cyrillic.fd4986b86093.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url("../fonts/nunito-latin.166202cc391c.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: "Comfortaa";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("../fonts/comfortaa-cyrillic.9174b187f57e.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Comfortaa";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("../fonts/comfortaa-latin.efa8f37b35f8.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 {
  color-scheme: light;

  /* Исходные цвета — меняйте только их */
  --accent: #ff7aa8;          /* розовый */
  --accent-2: #ff9f85;        /* персиково-коралловый */
  --accent-3: #c9a8f5;        /* нежно-сиреневый */
  --ok: #86d6b6;              /* мятный */
  --text: #4a2c3a;            /* тёмная слива */
  --muted: #7a5266;           /* приглушённый (AA на фоне страницы) */
  --surface: #ffffff;
  /* Фон и оттенки поверхностей тоже от акцента (при #ff7aa8: #fff5f8 → #ffe9f0, #fff9fb) */
  --bg-top: color-mix(in srgb, var(--accent) 8%, #ffffff);
  --bg-bottom: color-mix(in srgb, var(--accent) 17%, #ffffff);
  --surface-tint: color-mix(in srgb, var(--accent) 4.5%, #ffffff);

  /* Производные — пересчитываются из исходных */
  --accent-ink: color-mix(in oklab, var(--accent) 48%, var(--text));   /* акцентный текст */
  --on-accent: var(--text);                                            /* текст на розовом */
  --surface-2: color-mix(in oklab, var(--accent) 9%, var(--surface));  /* мягкая заливка */
  --accent-soft: color-mix(in oklab, var(--accent) 20%, var(--surface));
  --border: color-mix(in oklab, var(--accent) 24%, var(--surface));
  --rail: color-mix(in oklab, var(--accent) 17%, var(--surface));
  --accent-glow: color-mix(in srgb, var(--accent) 45%, transparent);
  --ring: color-mix(in srgb, var(--accent) 38%, transparent);
  --shadow-color: color-mix(in srgb, var(--accent) 18%, transparent);
  --error: color-mix(in oklab, var(--accent) 35%, #8c1f47);
  --error-soft: color-mix(in oklab, var(--accent-2) 16%, var(--surface));
  --ok-soft: color-mix(in oklab, var(--ok) 40%, var(--surface));
  --lilac-soft: color-mix(in oklab, var(--accent-3) 32%, var(--surface));
  --neutral-soft: color-mix(in oklab, var(--text) 7%, var(--surface));
  --gradient-accent: linear-gradient(120deg, var(--accent), var(--accent-2));
  --decor-opacity: 0.1;
  --backdrop: color-mix(in srgb, #4a2c3a 45%, transparent);

  /* Тени — цветные, без чёрного */
  --shadow-sm: 0 2px 8px var(--shadow-color);
  --shadow: 0 8px 24px var(--shadow-color);
  --shadow-lg: 0 16px 40px color-mix(in srgb, var(--accent) 26%, transparent);

  /* Шкала отступов */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;

  /* Скругления */
  --r-card: 22px;
  --r-md: 16px;
  --r-sm: 12px;
  --r-pill: 999px;

  /* Типографика */
  --font-body: "Nunito", ui-rounded, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-head: "Comfortaa", var(--font-body);
  --fs-body: 1.0625rem; /* 17px */
  --fs-small: 0.9375rem;
  --fs-xs: 0.8125rem;
  --lh: 1.5;

  /* Движение */
  --t-fast: 150ms;
  --t: 220ms;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Совместимость со старыми именами (используются компонентами) */
  --accent-strong: var(--accent-ink);
  --radius: var(--r-card);
  --radius-sm: var(--r-sm);
  --shadow-card: var(--shadow);
}

/* ---------- Токены: тёмная тема ---------- */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --accent: #f08cb2;
    --accent-2: #f2a58f;
    --accent-3: #b89be3;
    --ok: #74c4a4;
    --text: #fbe9f0;
    --muted: #d6b1c2;
    /* при #f08cb2: #2a1820 → #221219, карточки #3c232f / #422734 */
    --bg-top: color-mix(in srgb, var(--accent) 7%, #1c0e15);
    --bg-bottom: color-mix(in srgb, var(--accent) 5%, #1b0c13);
    --surface: color-mix(in srgb, var(--accent) 8%, #2c1a24);
    --surface-tint: color-mix(in srgb, var(--accent) 11%, #2c1a24);

    --accent-ink: color-mix(in oklab, var(--accent) 80%, white);
    --on-accent: #3a1d2a;
    --error: color-mix(in oklab, var(--accent) 60%, #ffc2c9);
    --shadow-color: rgb(20 5 12 / 45%);
    --shadow-lg: 0 16px 40px rgb(20 5 12 / 55%);
    --decor-opacity: 0.07;
    --backdrop: rgb(15 5 10 / 70%);
  }
}

/* ---------- База ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  min-height: 100%;
  background: linear-gradient(180deg, var(--bg-top), var(--bg-bottom)) fixed;
  background-color: var(--bg-bottom);
}

body {
  position: relative;
  min-height: 100vh;
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

/* Декоративный фон: сердечки/звёздочки/облачка, цвет — из --accent. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-color: var(--accent);
  opacity: var(--decor-opacity);
  -webkit-mask: url("../img/pattern.b873cc4ec789.svg") 0 0 / 220px 220px repeat;
  mask: url("../img/pattern.b873cc4ec789.svg") 0 0 / 220px 220px repeat;
}

h1, h2, h3 {
  font-family: var(--font-head);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
}
h1 { font-size: 1.75rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }

a {
  color: var(--accent-ink);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}
img { max-width: 100%; }
.icon { display: block; width: 100%; height: 100%; }

:focus-visible {
  outline: 3px solid var(--accent-ink);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.muted { color: var(--muted); }
.error { color: var(--error); }

/* ---------- Каркас ---------- */
.container {
  max-width: 760px;
  margin: 0 auto;
  padding: var(--s-4) var(--s-4) var(--s-6);
}

.card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-card);
  padding: var(--s-5) var(--s-4);
  box-shadow: var(--shadow);
  margin-bottom: var(--s-5);
}
.card h1 { margin-top: 0; }

.section-title {
  margin: 0 0 var(--s-3);
  font-family: var(--font-head);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}

/* ---------- Шапка ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  max-width: 760px;
  margin: 0 auto;
  padding: var(--s-4) var(--s-4) var(--s-2);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  min-width: 0;
  min-height: 44px;
  color: var(--text);
  text-decoration: none;
}
.brand-mark {
  flex: none;
  width: 36px;
  height: 36px;
  padding: 7px;
  color: var(--accent);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
}
.brand-text {
  display: -webkit-box;
  overflow: hidden;
  font-family: var(--font-head);
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.25;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.nav { display: flex; align-items: center; gap: var(--s-2); flex: none; }
.inline { display: inline; margin: 0; }

@media (max-width: 420px) {
  .nav-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .btn--icon-sm { width: 44px; padding: 0; }
}

/* ---------- Кнопки ---------- */
.btn,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: 44px;
  padding: 0 var(--s-5);
  font: inherit;
  font-weight: 800;
  line-height: 1.2;
  color: var(--on-accent);
  text-decoration: none;
  background: var(--gradient-accent);
  border: 0;
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform var(--t) var(--ease-spring), box-shadow var(--t) var(--ease),
    background-color var(--t-fast);
}
.btn:hover,
button:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.btn:active,
button:active { transform: translateY(0) scale(0.97); }

.btn--ghost {
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--border);
}
.btn--ghost:hover { background: var(--surface-2); }
.btn--sm { min-height: 44px; padding: 0 var(--s-4); font-size: var(--fs-small); }
.btn .icon { width: 18px; height: 18px; flex: none; }

/* ---------- Поля ---------- */
.field { display: block; margin-bottom: var(--s-4); }
.field-label {
  display: block;
  margin-bottom: var(--s-1);
  padding-left: var(--s-1);
  font-size: var(--fs-small);
  font-weight: 700;
  color: var(--muted);
}
input[type="text"],
input[type="password"] {
  display: block;
  width: 100%;
  min-height: 52px;
  padding: var(--s-3) var(--s-4);
  font: inherit;
  color: var(--text);
  background: var(--surface-tint);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background-color var(--t-fast);
}
input[type="text"]:hover,
input[type="password"]:hover { border-color: var(--accent); }
input[type="text"]:focus,
input[type="password"]:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--ring);
}

/* ---------- Сообщения ---------- */
.messages { list-style: none; padding: 0; margin: 0 0 var(--s-4); }
.messages li {
  padding: var(--s-3) var(--s-4);
  margin-bottom: var(--s-2);
  background: var(--accent-soft);
  border-radius: var(--r-md);
}

.alert {
  display: flex;
  gap: var(--s-2);
  align-items: flex-start;
  padding: var(--s-3) var(--s-4);
  margin: 0 0 var(--s-4);
  font-size: var(--fs-small);
  color: var(--error);
  background: var(--error-soft);
  border: 1.5px solid color-mix(in oklab, var(--accent-2) 35%, var(--surface));
  border-radius: var(--r-md);
}

/* ---------- Появление карточек ---------- */
.reveal { animation: reveal 250ms var(--ease) both; }
.reveal:nth-child(2) { animation-delay: 50ms; }
.reveal:nth-child(3) { animation-delay: 100ms; }
.reveal:nth-child(n + 4) { animation-delay: 150ms; }

/* Не с нуля: элементы с opacity 0 браузер не считает кандидатами LCP. */
@keyframes reveal {
  from { opacity: 0.3; transform: translateY(10px); }
}

@media (min-width: 640px) {
  .container { padding: var(--s-5) var(--s-5) var(--s-6); }
  .topbar { padding: var(--s-5) var(--s-5) var(--s-2); }
  .card { padding: var(--s-5); }
}

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

/* ---------- Центрированные страницы (вход, 403, 404) ---------- */
.page-center .container {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 96px);
  padding-top: var(--s-2);
}

.card--center {
  position: relative;
  width: 100%;
  max-width: 400px;
  margin: 0;
  padding: var(--s-6) var(--s-5) var(--s-5);
  text-align: center;
  background: linear-gradient(180deg, var(--surface), var(--surface-tint));
  border-radius: 28px;
  box-shadow: var(--shadow-lg);
}
.card--center form { text-align: left; }

.emblem {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin: calc(-1 * var(--s-6) - 36px) auto var(--s-3);
  padding: 18px;
  color: var(--accent);
  background: var(--surface);
  border: 4px solid var(--accent-soft);
  border-radius: 50%;
  box-shadow: var(--shadow);
}
.emblem--emoji { padding: 0; font-size: 2rem; line-height: 1; }

.eyebrow {
  display: inline-block;
  margin: 0 0 var(--s-1);
  padding: 2px var(--s-3);
  font-size: var(--fs-xs);
  font-weight: 800;
  color: var(--accent-ink);
  background: var(--accent-soft);
  border-radius: var(--r-pill);
}
.center-title { margin: var(--s-1) 0 var(--s-1); font-size: 1.9rem; }
.center-sub { margin: 0 0 var(--s-5); color: var(--muted); }

.btn--block { width: 100%; min-height: 52px; margin-top: var(--s-2); font-size: 1.05rem; }

/* Плавающие сердечки и звёздочки вокруг карточки */
.float-decor { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.fd {
  position: absolute;
  display: block;
  color: var(--accent);
  opacity: 0.35;
  animation: float 6s ease-in-out infinite;
}
.fd--1 { top: 16%; left: 8%; width: 34px; height: 34px; }
.fd--2 { top: 12%; right: 12%; width: 26px; height: 26px; color: var(--accent-2); animation-delay: -2s; }
.fd--3 { bottom: 14%; right: 9%; width: 44px; height: 44px; animation-delay: -4s; }
.fd--4 { bottom: 20%; left: 12%; width: 22px; height: 22px; color: var(--accent-3); animation-delay: -1s; }
.fd--5 { top: 48%; right: 4%; width: 18px; height: 18px; color: var(--accent-2); animation-delay: -3s; }

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0); }
  50% { transform: translateY(-10px) rotate(6deg); }
}
