/* Партнёрская страница — тем же дизайном, что приложение и страница врача.

   Цвета и скругления взяты из lib/core/theme/design_tokens.dart через
   web-share/styles.css: человек попадает отсюда в магазин и через минуту
   открывает приложение, и это должно быть одно место, а не два продукта.

   Шрифты лежат рядом и урезаны до латиницы с кириллицей
   (tools/subset_share_fonts.py) — ни одной внешней загрузки: страницу
   открывают по ссылке из поста, часто в мобильной сети. */

/* --- шрифты --------------------------------------------------------- */

@font-face {
  font-family: 'Nunito';
  src: url('/fonts/nunito-500.woff2') format('woff2');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'Nunito';
  src: url('/fonts/nunito-600.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'Nunito';
  src: url('/fonts/nunito-700.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: 'Comfortaa';
  src: url('/fonts/comfortaa-700.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: 'Bitter';
  src: url('/fonts/bitter-600.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'Bitter';
  src: url('/fonts/bitter-700.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

/* --- тема ------------------------------------------------------------ */

:root {
  color-scheme: light;

  --display: 'Comfortaa', Georgia, serif;
  --text: 'Nunito', 'Bitter', -apple-system, BlinkMacSystemFont, 'Segoe UI',
          Roboto, Arial, sans-serif;

  --screen: #f7f0e2;
  --card: #fffdf6;
  --chip: #e7edfa;
  --accent: #2350c8;
  --accent-deep: #16307f;
  --on-accent: #f7f0e2;
  --ink: #23262e;
  --ink-muted: #5f5d55;
  --line-card: #dce6f7;
  --chip-border: #c6d4ee;
  --ok-fg: #1d6b3f;
  --bad-fg: #a6461b;

  --r-block: 20px;
  --r-chip: 14px;
  --r-field: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --display: 'Bitter', Georgia, serif;

    --screen: #1b2b85;
    --card: #25379e;
    --chip: #2c3ea8;
    --accent: #e0c067;
    --accent-deep: #f4efdc;
    --on-accent: #16257a;
    --ink: #e9e6ff;
    --ink-muted: #a9aee0;
    --line-card: #33459e;
    --chip-border: rgba(224, 192, 103, 0.45);
    --ok-fg: #8fe0b0;
    --bad-fg: #ff9e7a;
  }
}

/* --- основа ---------------------------------------------------------- */

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--screen);
  color: var(--ink);
  font-family: var(--text);
  font-weight: 500;
  font-size: 15px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

main {
  /* Колонка приложения — 390 минус боковые 18. Страница читается на
     телефоне, и растягивать её на монитор незачем. */
  max-width: 430px;
  margin: 0 auto;
  padding: 28px 18px 48px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line-card);
  border-radius: var(--r-block);
  padding: 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.kicker {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.title {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: 26px;
  line-height: 1.2;
}

.subtitle {
  margin: 6px 0 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: 18px;
}

.body {
  margin: 0;
  color: var(--ink-muted);
}

.trial {
  margin: 0;
  align-self: flex-start;
  background: var(--chip);
  border: 1px solid var(--chip-border);
  border-radius: var(--r-chip);
  padding: 8px 12px;
  font-weight: 700;
  color: var(--accent);
}

.header {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.button {
  display: block;
  width: 100%;
  /* 48 — минимальная цель касания продукта (OutMetrics.tapTarget). */
  min-height: 48px;
  padding: 13px 16px;
  border: 0;
  border-radius: var(--r-field);
  font-family: var(--text);
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.button.primary {
  background: var(--accent);
  color: var(--on-accent);
}

.button.secondary {
  background: transparent;
  border: 1px solid var(--chip-border);
  color: var(--accent);
}

.button:disabled { opacity: 0.6; cursor: default; }

/* --- код ------------------------------------------------------------- */

.code-box {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
  background: var(--chip);
  border: 1px dashed var(--chip-border);
  border-radius: var(--r-chip);
  padding: 12px;
}

.code-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.code-value {
  font-family: var(--display);
  font-size: 24px;
  letter-spacing: 0.12em;
  color: var(--accent);
  /* Код диктуют голосом и переписывают руками: выделение по двойному
     касанию должно брать его целиком. */
  user-select: all;
}

/* --- форма ----------------------------------------------------------- */

.email-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.field {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  background: var(--screen);
  border: 1px solid var(--chip-border);
  border-radius: var(--r-field);
  color: var(--ink);
  font-family: var(--text);
  /* 16px, а не меньше: Safari на iOS приближает страницу к любому полю с
     мелким шрифтом, и человек оказывается в увеличенной вёрстке. */
  font-size: 16px;
}

.field:disabled { opacity: 0.6; }

.note {
  margin: 0;
  font-size: 13px;
  color: var(--ink-muted);
}

.note.ok { color: var(--ok-fg); font-weight: 700; }
.note.bad { color: var(--bad-fg); font-weight: 700; }
.note.quiet { font-size: 12px; }

/* --- низ ------------------------------------------------------------- */

.footer {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  text-align: center;
}

.quiet-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.disclaimer {
  margin: 0;
  font-size: 12px;
  color: var(--ink-muted);
}

/* --- загрузка -------------------------------------------------------- */

.state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 60px 0;
  color: var(--ink-muted);
}

.spinner {
  width: 22px;
  height: 22px;
  border: 2px solid var(--chip-border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; }
}
