/* ============================================================
   Порталы голосований — дизайн-система по референсу «Дорога к дому»
   Палитра: тёплая бумага · чернильно-зелёный · бренд проекта · акцент действий
   Шрифты: Unbounded (дисплей) · Golos Text (текст) · JetBrains Mono (метки)
   Темизация: --brand-primary / --brand-deep / --brand-soft / --brand-accent
   задаёт base.html из Project.theme. Правило: в разметке НИ ОДНОГО hex — только var().
   ============================================================ */

@font-face {
  font-family: "Golos Text";
  src: url("../fonts/GolosText-cyrillic.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+2116;
}
@font-face {
  font-family: "Golos Text";
  src: url("../fonts/GolosText-latin.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+2000-206F;
}
@font-face {
  font-family: "Unbounded";
  src: url("../fonts/Unbounded-cyrillic.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+2116;
}
@font-face {
  font-family: "Unbounded";
  src: url("../fonts/Unbounded-latin.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
  unicode-range: U+0000-00FF, U+2000-206F;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/JetBrainsMono-cyrillic.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+2116;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/JetBrainsMono-latin.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
  unicode-range: U+0000-00FF, U+2000-206F;
}

:root {
  /* Бумага и чернила — общие для обоих порталов */
  --paper: #f2efe6;
  --paper-2: #e9e4d4;
  --card: #fbf9f2;
  --ink: #131f19;
  --ink-2: #2e3d34;
  --muted: #5f6f64;
  --line: rgba(19, 31, 25, 0.14);
  --line-strong: rgba(19, 31, 25, 0.32);

  /* Бренд проекта: подставляется из Project.theme (см. base.html) */
  --pine: var(--brand-primary, #1c5b3c);
  --pine-deep: var(--brand-deep, #0c2e1e);
  --leaf: var(--brand-soft, #6e9b60);
  --accent: var(--brand-accent, #ff5a2d);
  --accent-deep: color-mix(in srgb, var(--accent) 82%, #000);
  --accent-soft: color-mix(in srgb, var(--accent) 14%, transparent);
  --gold: #dfa32e;

  /* На тёмном */
  --paper-on-dark: #f2efe6;
  --muted-on-dark: rgba(242, 239, 230, 0.62);
  --line-on-dark: rgba(242, 239, 230, 0.16);

  --font-display: "Unbounded", "Golos Text", sans-serif;
  --font-body: "Golos Text", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  --container: 1240px;
  --gutter: clamp(20px, 4vw, 48px);
  --radius: 16px;
  --radius-lg: 24px;
  --header-h: 68px;

  --shadow-card: 0 2px 6px rgba(19, 31, 25, 0.05), 0 18px 44px -24px rgba(19, 31, 25, 0.38);
  --shadow-float: 0 24px 64px -20px rgba(12, 46, 30, 0.38);

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---------- База ---------- */

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Зерно печати поверх всего — фирменная фактура */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  opacity: 0.045;
  mix-blend-mode: multiply;
  pointer-events: none;
  z-index: 9990;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
[x-cloak] { display: none !important; }

::selection { background: var(--accent); color: var(--paper); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- Типографика ---------- */

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
p { margin: 0; }

.display-xl {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.9rem, 5.2vw, 4rem);
  line-height: 1.06;
}
.display-lg {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.55rem, 3.6vw, 2.7rem);
}
.display-md {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.2rem, 2.2vw, 1.7rem);
}
.lead {
  font-size: clamp(1.1rem, 1.6vw, 1.3rem);
  line-height: 1.6;
  color: var(--ink-2);
  text-wrap: pretty;
}
.eyebrow {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--pine);
}
.band-dark .eyebrow, .hero .eyebrow { color: var(--leaf); }
.mono-label {
  font-family: var(--font-mono);
  font-size: 13.5px;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.stat-num {
  font-family: var(--font-display);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

/* ---------- Раскладка ---------- */

.container {
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container-sm { max-width: 560px; margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: clamp(64px, 8vw, 112px); }
.section-sm { padding-block: clamp(44px, 6vw, 72px); }
.band-dark { background: var(--ink); color: var(--paper-on-dark); }
.band-dark .lead { color: var(--muted-on-dark); }
.section-head { margin-bottom: clamp(32px, 5vw, 52px); }
.section-head .eyebrow { display: block; margin-bottom: 14px; }

main { min-height: 60vh; }

/* ---------- Шапка ---------- */

.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-header .container {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.brand-mark {
  flex: none;
  width: 38px; height: 38px;
  border-radius: 12px;
  background: var(--pine);
  color: var(--paper);
  display: flex; align-items: center; justify-content: center;
}
.brand-mark svg { width: 20px; height: 20px; }
.brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  line-height: 1.2;
  letter-spacing: 0.01em;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.site-nav { display: flex; align-items: center; gap: 4px; }
.nav-link {
  padding: 9px 14px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink-2);
  transition: background-color 0.25s ease, color 0.25s ease;
}
.nav-link:hover { background: rgba(19, 31, 25, 0.06); color: var(--ink); }
.nav-cta { margin-left: 6px; }
.header-on-hero {
  background: transparent;
  backdrop-filter: none;
  border-bottom-color: transparent;
}
.header-on-hero .brand-name, .header-on-hero .nav-link { color: var(--paper); }
.header-on-hero .nav-link:hover { background: rgba(242, 239, 230, 0.12); }
.header-on-hero .brand-mark { background: rgba(242, 239, 230, 0.16); }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 52px;
  padding-inline: 28px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 17px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  transition: transform 0.35s var(--ease-out), box-shadow 0.35s var(--ease-out),
    background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
  will-change: transform;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn .arr { display: inline-block; transition: transform 0.35s var(--ease-out); }
.btn:hover .arr { transform: translateX(4px); }

.btn-primary {
  background: var(--accent);
  color: var(--pine-deep);
  box-shadow: 0 10px 30px -10px color-mix(in srgb, var(--accent-deep) 55%, transparent);
}
.btn-primary:hover {
  background: color-mix(in srgb, var(--accent) 86%, var(--ink));
  box-shadow: 0 16px 36px -12px color-mix(in srgb, var(--accent-deep) 60%, transparent);
}
.btn-dark { background: var(--ink); color: var(--paper); }
.btn-dark:hover { background: var(--pine-deep); }
.btn-ghost {
  background: transparent;
  border: 1.5px solid var(--line-strong);
  color: var(--ink);
}
.btn-ghost:hover { border-color: var(--ink); background: rgba(19, 31, 25, 0.04); }
.band-dark .btn-ghost, .hero .btn-ghost {
  border-color: rgba(242, 239, 230, 0.45);
  color: var(--paper);
}
.band-dark .btn-ghost:hover, .hero .btn-ghost:hover {
  border-color: var(--paper);
  background: rgba(242, 239, 230, 0.08);
}
.btn-lg { height: 62px; padding-inline: 36px; font-size: 18px; }
.btn-block { width: 100%; }

/* ---------- Чипы ---------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding-inline: 14px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--ink-2);
  white-space: nowrap;
}
.chip::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--st, var(--muted));
  flex-shrink: 0;
}
.chip.on-photo {
  background: rgba(19, 31, 25, 0.55);
  border-color: rgba(242, 239, 230, 0.25);
  color: var(--paper);
  backdrop-filter: blur(8px);
}
.st-live { --st: var(--accent); }
.st-live::before { animation: chip-pulse 1.6s ease-in-out infinite; }
.st-done { --st: var(--pine); }
.st-ahead { --st: var(--muted); }
@keyframes chip-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ---------- Фото и дуотон ---------- */

.photo { position: relative; overflow: hidden; background: var(--pine-deep); }
.photo > img {
  width: 100%; height: 100%;
  object-fit: cover;
  filter: grayscale(1) brightness(0.94) contrast(1.04);
  transform: scale(1.001);
  transition: filter 0.7s var(--ease-out), transform 1s var(--ease-out);
}
.photo::before {
  content: "";
  position: absolute; inset: 0;
  background: var(--pine);
  mix-blend-mode: color;
  opacity: 1;
  transition: opacity 0.7s var(--ease-out);
  pointer-events: none;
  z-index: 1;
}
.photo::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(185deg, rgba(12, 46, 30, 0.08) 40%, rgba(12, 46, 30, 0.55) 100%);
  mix-blend-mode: multiply;
  transition: opacity 0.7s var(--ease-out);
  pointer-events: none;
  z-index: 2;
}
.photo-live > img, .photo:hover > img, .card-hover:hover .photo > img {
  filter: grayscale(0) brightness(1) contrast(1);
  transform: scale(1.045);
}
.photo-live::before, .photo:hover::before, .card-hover:hover .photo::before { opacity: 0; }
.photo-live::after, .photo:hover::after, .card-hover:hover .photo::after { opacity: 0.65; }
.photo .photo-content { position: absolute; inset: 0; z-index: 3; }

/* ---------- Хиро ---------- */

.hero {
  position: relative;
  min-height: max(560px, 86svh);
  display: flex;
  align-items: flex-end;
  color: var(--paper-on-dark);
  background: var(--pine-deep);
  overflow: hidden;
}
.hero-photo { position: absolute; inset: 0; }
.hero-photo img {
  width: 100%; height: 100%;
  object-fit: cover;
  filter: grayscale(0.35) brightness(0.8);
}
.hero-photo::after {
  content: "";
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(12, 30, 22, 0.42) 0%, rgba(12, 30, 22, 0.18) 42%, rgba(9, 24, 17, 0.82) 100%),
    color-mix(in srgb, var(--pine-deep) 34%, transparent);
}
.hero-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  padding-top: calc(var(--header-h) + 48px);
  padding-bottom: clamp(48px, 8vw, 96px);
}
.hero-chip { margin-bottom: 22px; }
.hero-slogan { max-width: 15ch; }
.hero-slogan .accent-word { color: var(--accent); }
.hero-lead {
  max-width: 46ch;
  margin-top: 20px;
  font-size: clamp(1.15rem, 1.8vw, 1.35rem);
  line-height: 1.6;
  color: var(--muted-on-dark);
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 34px;
}

/* ---------- Карточки ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.45s var(--ease-out), box-shadow 0.45s var(--ease-out),
    border-color 0.3s ease;
}
.card-hover:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-card);
  border-color: var(--line-strong);
}
.card-pad { padding: clamp(20px, 3vw, 28px); }

/* Шаги «Как участвовать» */
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: step;
}
.step {
  counter-increment: step;
  position: relative;
  padding: 24px 22px 22px;
}
.step::before {
  content: counter(step, decimal-leading-zero);
  display: block;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.12em;
  color: var(--pine);
  margin-bottom: 14px;
}
.step h3 { font-size: 1.12rem; margin-bottom: 8px; }
.step p { font-size: 15.5px; line-height: 1.55; color: var(--ink-2); }

/* ---------- Формы ---------- */

.field-label {
  display: block;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 7px;
}
.field-input {
  width: 100%;
  height: 56px;
  padding-inline: 16px;
  border: 1.5px solid var(--line-strong);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17.5px;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
  appearance: none;
}
.field-input:focus {
  outline: none;
  border-color: var(--pine);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--pine) 14%, transparent);
}
.field-input:disabled { background: var(--paper-2); color: var(--muted); }
.field-hint { font-size: 15px; color: var(--muted); margin-top: 6px; }
.field-error { font-size: 15.5px; color: var(--accent-deep); margin-top: 6px; font-weight: 500; }

.code-input {
  width: 100%;
  height: 76px;
  text-align: center;
  font-family: var(--font-display);
  font-size: 2rem;
  letter-spacing: 0.38em;
  text-indent: 0.38em;
  border: 1.5px solid var(--line-strong);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
}
.code-input:focus {
  outline: none;
  border-color: var(--pine);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--pine) 14%, transparent);
}

.checkbox-tile {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  font-size: 15.5px;
  line-height: 1.5;
  cursor: pointer;
  transition: border-color 0.25s ease, background-color 0.25s ease;
}
.checkbox-tile:has(input:checked) {
  border-color: var(--pine);
  background: color-mix(in srgb, var(--pine) 7%, var(--card));
}
.checkbox-tile input[type="checkbox"] {
  flex: none;
  margin-top: 2px;
  width: 20px; height: 20px;
  accent-color: var(--pine);
}

.form-stack { display: flex; flex-direction: column; gap: 18px; }

/* ---------- Плашки-сообщения ---------- */

.alert { border-radius: 12px; padding: 14px 16px; font-size: 15.5px; line-height: 1.5; }
.alert-error { background: color-mix(in srgb, var(--accent-deep) 12%, var(--card)); color: var(--accent-deep); }
.alert-success { background: color-mix(in srgb, var(--pine) 11%, var(--card)); color: var(--pine-deep); }
.alert-info { background: var(--paper-2); color: var(--ink-2); }

/* ---------- Таймлайн этапов ---------- */

.timeline { position: relative; list-style: none; margin: 0; padding: 0; }
.timeline::before {
  content: "";
  position: absolute;
  left: 15px; top: 20px; bottom: 20px;
  width: 2px;
  background: var(--line);
}
.timeline-item { display: flex; gap: 18px; }
.timeline-item + .timeline-item { margin-top: 12px; }
.timeline-dot {
  position: relative;
  z-index: 1;
  flex: none;
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--card);
  border: 2px solid var(--line-strong);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
}
.timeline-dot--done { background: var(--pine); border-color: var(--pine); color: var(--paper); }
.timeline-dot--current {
  border-color: var(--accent);
  color: var(--accent-deep);
}
.timeline-dot--current::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  animation: pulse-ring 2s var(--ease-out) infinite;
}
@keyframes pulse-ring {
  0% { transform: scale(0.7); opacity: 0.8; }
  100% { transform: scale(1.7); opacity: 0; }
}
.timeline-card { flex: 1; margin-bottom: 2px; }
.timeline-card.card { border-radius: var(--radius); }
.timeline-card .card-pad { padding: 18px 20px; }
.timeline-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.timeline-dates {
  font-family: var(--font-mono);
  font-size: 14.5px;
  color: var(--muted);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

/* ---------- Футер ---------- */

.site-footer {
  background: var(--ink);
  color: var(--muted-on-dark);
  margin-top: clamp(64px, 8vw, 112px);
}
.site-footer .container {
  padding-block: clamp(40px, 5vw, 64px);
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.site-footer .brand-name { color: var(--paper-on-dark); }
.site-footer .brand-mark { background: rgba(242, 239, 230, 0.12); }
.footer-note { font-size: 15.5px; max-width: 52ch; line-height: 1.6; }
.footer-small {
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.06em;
  color: rgba(242, 239, 230, 0.4);
}

/* ---------- Статусные страницы ---------- */

.status-page { text-align: center; padding-block: clamp(56px, 10vw, 120px); }
.status-glyph {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(4rem, 12vw, 7rem);
  line-height: 1;
  color: color-mix(in srgb, var(--pine) 18%, transparent);
  user-select: none;
}
.status-page h1 { margin-top: 10px; margin-bottom: 14px; }
.status-page p { color: var(--muted); max-width: 42ch; margin-inline: auto; margin-bottom: 30px; }

/* ---------- Анимации появления ---------- */

@keyframes rise {
  from { opacity: 0; transform: translateY(26px); }
  to { opacity: 1; transform: translateY(0); }
}
.anim-rise { animation: rise 0.9s var(--ease-out) both; }
.d1 { animation-delay: 0.08s; }
.d2 { animation-delay: 0.18s; }
.d3 { animation-delay: 0.3s; }
.d4 { animation-delay: 0.44s; }
.d5 { animation-delay: 0.6s; }

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

/* ---------- Адаптив ---------- */

@media (max-width: 680px) {
  .hero { min-height: max(520px, 92svh); }
  .hero-actions .btn { width: 100%; }
  .nav-link-secondary { display: none; }
  .brand-name { font-size: 14px; max-width: 38vw; }
  .section { padding-block: 56px; }
}

@media (max-width: 480px) {
  /* имя не влезает рядом с кнопками — остаётся эмблема, название есть в хиро */
  .brand-name { display: none; }
  .brand-mark { width: 42px; height: 42px; }
}

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