/* =========================================================
   agora — выборы школьного президента
   Светлая тема: тетрадь в клетку, синяя ручка, красная ручка учителя.
   Тёмная тема: школьная доска и мел.
   ========================================================= */

/* ---------- Переменные: светлая тема (тетрадь) ---------- */
:root {
  --paper: #ffffff;          /* лист тетради */
  --ink: #1d2f6f;            /* синяя шариковая ручка: основной текст */
  --muted: #56648f;          /* второстепенный текст */
  --red: #da2c37;            /* красная ручка учителя, цвет логотипа */
  --red-text: #c41f2a;       /* красный для мелкого текста, контрастнее */
  --on-red: #ffffff;         /* текст на красной кнопке */
  --grid: #e4ebf6;           /* клетка */
  --rule: rgba(29, 47, 111, 0.2);   /* линии-разделители */
  --margin: #f0959a;         /* красная линия полей */
  --overlay: rgba(16, 24, 56, 0.62);
  --toggle-sun: none;        /* какая иконка видна на кнопке темы */
  --toggle-moon: block;
  color-scheme: light;

  --cell: 22px;              /* размер клетки */
  --gutter: 20px;            /* отступ от края экрана */
  --maxw: 1600px;            /* максимальная ширина содержимого */
  --header-h: 64px;
  --font: "Golos Text", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --hand: "Bad Script", "Segoe Print", "Comic Sans MS", cursive;
}

/* ---------- Тёмная тема (доска и мел) ----------
   Включается кнопкой (data-theme="dark") или по настройке системы,
   если кнопку ещё не нажимали. Блоки одинаковые, меняй оба. */
:root[data-theme="dark"] {
  --paper: #22302a;
  --ink: #f2f0e6;
  --muted: #aab7ae;
  --red: #ff8b7e;
  --red-text: #ff9b8f;
  --on-red: #22302a;
  --grid: rgba(242, 240, 230, 0.045);
  --rule: rgba(242, 240, 230, 0.22);
  --margin: rgba(255, 139, 126, 0.45);
  --overlay: rgba(8, 14, 11, 0.72);
  --toggle-sun: block;
  --toggle-moon: none;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #22302a;
    --ink: #f2f0e6;
    --muted: #aab7ae;
    --red: #ff8b7e;
    --red-text: #ff9b8f;
    --on-red: #22302a;
    --grid: rgba(242, 240, 230, 0.045);
    --rule: rgba(242, 240, 230, 0.22);
    --margin: rgba(255, 139, 126, 0.45);
    --overlay: rgba(8, 14, 11, 0.72);
    --toggle-sun: block;
    --toggle-moon: none;
    color-scheme: dark;
  }
}

/* ---------- Основа ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  /* клетка */
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: var(--cell) var(--cell);
}

/* Красная линия полей. Идёт через всю страницу слева от текста */
body::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: max(calc(var(--gutter) - 24px), calc((100% - var(--maxw)) / 2 + var(--gutter) - 24px));
  width: 2px;
  background: var(--margin);
  pointer-events: none;
  display: none;
}

/* повёрнутые листы и печати не дают странице ездить вбок на телефоне */
main { overflow-x: clip; }

a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; margin: 0; padding: 0; }
h1, h2, h3 { margin: 0; }

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

/* ---------- Кнопки ---------- */
.btn, .cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 22px;
  border: 2px solid transparent;
  border-radius: 6px;
  font-weight: 700;
  font-size: 16px;
  line-height: 1.2;
  transition: background-color .15s ease, color .15s ease, filter .15s ease;
}
.btn--red, .cta { background: var(--red); color: var(--on-red); }
.btn--red:hover, .cta:hover { filter: brightness(.9); }
.btn--line { border-color: var(--ink); color: var(--ink); }
.btn--line:hover { background: var(--ink); color: var(--paper); }

/* ---------- Шапка (телефон) ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}

.header-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gutter);
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0 8px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-right: auto;
  font-weight: 800;
  font-size: 21px;
  letter-spacing: -0.02em;
}
.brand-logo { display: block; height: 24px; width: auto; }

.theme-toggle {
  flex: none;
  width: 44px;
  height: 44px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.theme-toggle:hover { border-color: var(--ink); }
.theme-toggle svg { grid-area: 1 / 1; }
.theme-toggle .icon-sun  { display: var(--toggle-sun); }
.theme-toggle .icon-moon { display: var(--toggle-moon); }

.burger {
  width: 44px;
  height: 44px;
  margin-right: -8px;
  border: 0;
  background: transparent;
  display: grid;
  place-content: center;
  gap: 5px;
  cursor: pointer;
}
.burger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--ink);
  transition: transform .2s ease, opacity .2s ease;
}
.burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.header-menu {
  display: none;
  width: 100%;
  padding: 4px 0 24px;
  flex-direction: column;
  gap: 22px;
}
.header-menu.is-open { display: flex; animation: menu-in .25s cubic-bezier(.2, .7, .2, 1); }
@keyframes menu-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* короткая кнопка опроса в шапке телефона */
.cta-mini {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 14px;
  border-radius: 6px;
  background: var(--red);
  color: var(--on-red);
  font-weight: 700;
  font-size: 15px;
}
.cta-mini:active, .cta:active, .btn:active { transform: scale(.97); }

.nav { display: flex; flex-direction: column; }
.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 54px;
  border-bottom: 1px solid var(--rule);
  font-weight: 600;
  font-size: 20px;
}
/* активный пункт подчёркнут красной ручкой; черта «прорисовывается» слева направо */
.nav-link::after {
  content: "";
  position: absolute;
  left: -2px;
  bottom: 9px;
  width: 7.2em;
  max-width: 100%;
  height: 9px;
  background: var(--red);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 10' preserveAspectRatio='none'%3E%3Cpath d='M2 6.5C20 3 38 8.5 56 5S86 2.5 98 5' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center / 100% 100%;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 10' preserveAspectRatio='none'%3E%3Cpath d='M2 6.5C20 3 38 8.5 56 5S86 2.5 98 5' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center / 100% 100%;
  clip-path: inset(0 100% 0 0);
  transition: clip-path .45s cubic-bezier(.55, 0, .25, 1);
}
.nav-link.is-active::after { clip-path: inset(0 0 0 0); }

.cta-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}
/* приписка от руки под кнопкой опроса */
.cta-note {
  margin: 0;
  max-width: 260px;
  font-family: var(--hand);
  font-size: 19px;
  line-height: 1.2;
  color: var(--red-text);
  transform: rotate(-2deg);
  transform-origin: left center;
}

/* ---------- Вступление ---------- */
.intro {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 36px var(--gutter) 8px;
  display: grid;
  gap: 24px;
}
.intro h1 {
  font-weight: 900;
  font-size: clamp(44px, 7.4vw, 112px);
  line-height: .94;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}
.intro-side { display: grid; gap: 18px; }
.intro-lead { margin: 0; max-width: 44ch; font-size: 18px; line-height: 1.6; }
.intro-when {
  margin: 0;
  max-width: 30ch;
  font-size: 23px;
  line-height: 1.5;
  font-weight: 600;
}

/* дата, обведённая красной ручкой; обводка рисуется один раз при загрузке */
.date-mark {
  position: relative;
  display: inline-block;
  white-space: nowrap;
  margin: 0 .2em 0 .3em;
  color: var(--red-text);
  font-weight: 800;
}
.date-ring {
  position: absolute;
  left: -9%;
  top: -40%;
  width: 118%;
  height: 180%;
  overflow: visible;
  pointer-events: none;
}
.date-ring path {
  fill: none;
  stroke: var(--red);
  stroke-width: 2.2px;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: draw 1.1s .4s cubic-bezier(.55, 0, .25, 1) forwards;
}
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ---------- Кандидаты ---------- */
.candidates {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 56px var(--gutter) 72px;
}
.candidates-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 4px 40px;
  margin-bottom: 30px;
}
.candidates h2,
.events h2 {
  font-weight: 800;
  font-size: clamp(36px, 5vw, 64px);
  line-height: 1;
  letter-spacing: -0.035em;
}

/* подсказка красной ручкой со стрелкой к карточкам */
.hand-note {
  position: relative;
  margin: 6px 0 0;
  padding-right: 58px;
  font-family: var(--hand);
  font-size: 22px;
  line-height: 1.15;
  color: var(--red-text);
  transform: rotate(-3deg);
}
.hand-arrow {
  position: absolute;
  right: 0;
  top: 40%;
  width: 52px;
  height: 52px;
  overflow: visible;
}
.hand-arrow path {
  fill: none;
  stroke: var(--red);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px 24px;
}

/* карточка целиком — кнопка */
.card-link {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.photo {
  position: relative;
  aspect-ratio: var(--ratio, 4 / 5);
  overflow: hidden;
  border-radius: 4px;
  background: var(--c1, #ffd9c9);
  display: grid;
  place-items: center;
}
.photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.initials {
  font-weight: 900;
  font-size: clamp(56px, 9vw, 112px);
  letter-spacing: -0.05em;
  color: color-mix(in srgb, var(--c2, #ffb89a) 45%, #1d2f6f);
  opacity: .75;
}

.card-body { padding-top: 14px; }
.name {
  font-weight: 700;
  font-size: 21px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.grade { margin-top: 2px; color: var(--muted); font-size: 16px; }

.card-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
}
.score { display: flex; align-items: baseline; gap: 8px; }
.score-value {
  font-weight: 800;
  font-size: 40px;
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}
.score-label { color: var(--muted); font-size: 15px; }
.score.is-pending .score-value { color: var(--muted); }

.card-more {
  flex: none;
  font-weight: 600;
  font-size: 16px;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 5px;
}
@media (hover: hover) {
  .card-link:hover .card-more,
  .card-link:hover .name { color: var(--red-text); }
}

/* ---------- О мероприятии ---------- */
.events {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 24px var(--gutter) 64px;
}
.events h2 {
  padding-top: 32px;
  border-top: 2px solid var(--ink);
}

.events-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 56px;
  margin-top: 36px;
}

.events-about h3,
.events-help h3 {
  margin-bottom: 12px;
  font-weight: 700;
  font-size: 20px;
  line-height: 1.3;
}

.duties { border-top: 1px solid var(--rule); }
.duties li {
  padding: 16px 0;
  border-bottom: 1px solid var(--rule);
  font-weight: 500;
  font-size: clamp(20px, 2.2vw, 26px);
  line-height: 1.32;
}

.events-help { margin-top: 44px; max-width: 46ch; }
.events-help p { margin: 0; }
.help-links { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px !important; }

/* ---------- Бюллетень ----------
   Отдельный лист бумаги: он белый и на тетради, и на доске. */
.ballot {
  --sheet: #ffffff;
  --print: #1d2f6f;
  --print-soft: rgba(29, 47, 111, .26);
  --pen: #da2c37;
  position: relative;
  align-self: start;
  padding: 34px 22px 26px;
  background: var(--sheet);
  color: var(--print);
  box-shadow:
    0 1px 2px rgba(10, 20, 50, .14),
    0 18px 36px -18px rgba(10, 20, 50, .4);
  /* отверстия перфорации сверху */
  -webkit-mask: radial-gradient(circle 5px at 50% 0, transparent 98%, #000) top / 18px 100% repeat-x;
          mask: radial-gradient(circle 5px at 50% 0, transparent 98%, #000) top / 18px 100% repeat-x;
  transform: rotate(var(--ballot-rot, 0deg));
  transform-origin: 50% 0;
}
/* линия отрыва под перфорацией */
.ballot::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 14px;
  border-top: 1.5px dashed var(--print-soft);
}

.ballot-head {
  padding-bottom: 18px;
  border-bottom: 2px solid var(--print);
  text-align: center;
}
.ballot-kind { margin: 0; font-weight: 600; font-size: 15px; }
.ballot-head h3 {
  margin: 2px 0 12px;
  font-weight: 800;
  font-size: clamp(26px, 3vw, 32px);
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.ballot-date {
  margin: 0;
  font-weight: 900;
  font-size: clamp(38px, 5vw, 56px);
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--pen);
}
.ballot-when { margin: 8px 0 0; font-size: 17px; }

.ballot-try {
  margin: 16px 0 4px;
  font-family: var(--hand);
  font-size: 18px;
  color: var(--pen);
}

.ballot-steps { margin: 0; }
.ballot-row {
  width: 100%;
  display: grid;
  grid-template-columns: 26px 1fr 40px;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border: 0;
  border-bottom: 1px solid var(--print-soft);
  background: none;
  color: inherit;
  font: inherit;
  font-size: 17px;
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
}
.ballot-row:focus-visible { outline: 3px solid var(--pen); outline-offset: 2px; }
.ballot-num { font-weight: 800; font-size: 19px; }
.ballot-box {
  position: relative;
  width: 34px;
  height: 34px;
  border: 2px solid var(--print);
  justify-self: end;
}
.ballot-box svg {
  position: absolute;
  left: -2px;
  top: -10px;
  width: 44px;
  height: 44px;
  fill: none;
  stroke: var(--pen);
  stroke-width: 3.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  transition: stroke-dashoffset .35s cubic-bezier(.5, 0, .2, 1);
}
.ballot-row[aria-pressed="true"] .ballot-box svg { stroke-dashoffset: 0; }
.ballot-row[aria-pressed="true"] .ballot-text { color: rgba(29, 47, 111, .6); }
@media (hover: hover) {
  .ballot-row:hover .ballot-box { background: rgba(29, 47, 111, .06); }
}

.ballot-foot { margin: 18px 0 0; font-size: 16px; text-align: center; }
.ballot-foot.is-done { color: var(--pen); font-weight: 700; }

/* ---------- Финальная фраза ---------- */
.events-final { margin: 88px 0 0; }
.events-final span {
  position: relative;
  display: inline-block;
  font-weight: 900;
  font-size: clamp(46px, 8.4vw, 140px);
  line-height: .92;
  letter-spacing: -0.045em;
}
.events-final svg {
  position: absolute;
  left: 0;
  bottom: -0.2em;
  width: 100%;
  height: .2em;
  overflow: visible;
}
.events-final path {
  fill: none;
  stroke: var(--red);
  stroke-width: 4px;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

/* ---------- Подвал ---------- */
.site-footer {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 28px var(--gutter) 36px;
  color: var(--muted);
  font-size: 15px;
}
.site-footer p { margin: 0; padding-top: 20px; border-top: 1px solid var(--rule); }
.noscript { color: var(--muted); }

/* ---------- Плавная прокрутка к разделам ---------- */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
/* чтобы заголовок раздела не прятался под закреплённой шапкой */
.candidates, .events { scroll-margin-top: var(--header-h); }

/* ---------- Планшет ---------- */
@media (min-width: 600px) {
  :root { --gutter: 52px; }
  body::after { display: block; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 48px 28px; align-items: start; }
  .card { margin-top: var(--shift, 0px); }
}

/* ---------- Компьютер ---------- */
@media (min-width: 960px) {
  :root { --gutter: 72px; --header-h: 92px; }

  .burger { display: none; }

  .header-inner {
    position: relative;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding-top: 12px;
    padding-bottom: 12px;
  }
  .brand { font-size: 23px; gap: 12px; }
  .brand-logo { height: 28px; }

  .header-menu { display: contents; }

  .nav { flex-direction: row; gap: 36px; }
  .nav-link { min-height: 44px; border-bottom: 0; font-size: 17px; }
  .nav-link::after { left: -4px; bottom: 2px; width: calc(100% + 8px); }

  /* кнопка темы в правом углу, опрос левее неё */
  .theme-toggle {
    position: absolute;
    right: var(--gutter);
    top: 50%;
    transform: translateY(-50%);
  }
  .cta-wrap { justify-self: end; align-items: flex-end; margin-right: 60px; }
  .cta-note { text-align: right; max-width: 300px; font-size: 18px; transform-origin: right center; }

  .intro {
    grid-template-columns: minmax(0, 1.45fr) minmax(320px, 1fr);
    align-items: end;
    column-gap: 64px;
    padding-top: 64px;
  }
  .intro-side { padding-bottom: 10px; }

  .candidates { padding-top: 88px; }
  .candidates-head { margin-bottom: 40px; }
  .hand-note { margin-bottom: 4px; }

  .events { padding-bottom: 96px; }
  .events-body {
    grid-template-columns: minmax(0, 1fr) minmax(400px, 520px);
    gap: 80px;
    margin-top: 48px;
  }
  .ballot { padding: 44px 40px 32px; --ballot-rot: 1.4deg; }
  .events-final { margin-top: 120px; }
}

@media (min-width: 1100px) {
  .grid { grid-template-columns: repeat(4, 1fr); gap: 56px 32px; }
}

@media (min-width: 1400px) {
  :root { --gutter: 96px; }
}

/* ---------- Окно кандидата: лист из тетради ---------- */
html.modal-open { overflow: hidden; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  background: var(--overlay);
  cursor: pointer;
  animation: fade-in .2s ease;
}
.modal[hidden] { display: none; }

.modal-panel {
  position: relative;
  width: min(100%, 980px);
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
  display: grid;
  grid-template-columns: 1fr;
  outline: none;
  border-radius: 6px;
  color: var(--ink);
  /* клетка и красная линия полей, прокручиваются вместе с текстом */
  background-color: var(--paper);
  background-image:
    linear-gradient(90deg, transparent 27px, var(--margin) 27px, var(--margin) 29px, transparent 29px),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 100% 100%, var(--cell) var(--cell), var(--cell) var(--cell);
  background-repeat: no-repeat, repeat, repeat;
  background-attachment: local;
  box-shadow: 0 30px 70px -30px rgba(0, 0, 0, .55);
  animation: sheet-in .28s cubic-bezier(.2, .7, .2, 1);
}

.modal-grip { display: none; }
.modal-photo-slot { padding: 20px 20px 0 44px; min-width: 0; }
.modal-photo { aspect-ratio: 4 / 3; }

.modal-body { padding: 22px 24px 8px 44px; min-width: 0; }
.modal-body h2 {
  font-weight: 800;
  font-size: clamp(30px, 5vw, 46px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}
.modal-grade { margin: 6px 0 0; color: var(--muted); font-size: 18px; }

.modal-text h3 {
  margin: 28px 0 8px;
  font-weight: 700;
  font-size: 19px;
  color: var(--red-text);
}
.modal-text p {
  margin: 0 0 12px;
  max-width: 60ch;
  font-size: 17px;
  line-height: 1.65;
  white-space: pre-line;   /* одиночный перенос строки в данных остаётся переносом */
  overflow-wrap: anywhere;
}

/* Ссылка на видео кампании */
.video-link {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 440px;
  margin: 6px 0 16px;
  padding: 14px 16px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 4px 4px 0 var(--red);
  transform: rotate(-.6deg);
  transition: transform .2s ease, box-shadow .2s ease;
}
.video-link:hover { transform: rotate(0) translate(-1px, -1px); box-shadow: 6px 6px 0 var(--red); }
.video-link:active { transform: scale(.98); box-shadow: 2px 2px 0 var(--red); }
.video-play {
  flex: none;
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--red);
  color: var(--on-red);
}
.video-play svg { width: 22px; height: 22px; margin-left: 3px; }
.video-text { display: grid; gap: 2px; min-width: 0; }
.video-text strong { font-weight: 800; font-size: 18px; line-height: 1.2; }
.video-text small { color: var(--muted); font-size: 14px; line-height: 1.3; }
.video-arrow {
  flex: none;
  width: 24px;
  height: 24px;
  margin-left: auto;
  fill: none;
  stroke: var(--red-text);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform .2s ease;
}
.video-link:hover .video-arrow { transform: translateX(4px); }

/* Значок «видео» на карточке */
.video-badge {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px 5px 8px;
  border: 1.5px solid var(--ink);
  border-radius: 99px;
  background: var(--paper);
  color: var(--ink);
  font-weight: 700;
  font-size: 13px;
  line-height: 1;
}
.video-badge svg { width: 13px; height: 13px; color: var(--red); }

.modal-hint {
  margin: 0;
  padding: 14px 24px 20px 44px;
  color: var(--muted);
  font-size: 14px;
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes sheet-out { to { opacity: 0; transform: translateY(16px); } }
.modal.is-closing { animation: fade-out .22s ease forwards; }
.modal.is-closing .modal-panel { animation: sheet-out .22s ease forwards; }

/* На телефоне окно — лист, который выезжает снизу */
@media (max-width: 759px) {
  .modal { place-items: end stretch; padding: 0; }
  .modal-panel {
    width: 100%;
    max-height: 92vh;
    max-height: 92dvh;
    border-radius: 14px 14px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
    animation: sheet-up .34s cubic-bezier(.2, .8, .2, 1);
  }
  .modal.is-closing .modal-panel { animation: sheet-down .22s ease-in forwards; }
  .modal-grip {
    display: block;
    width: 44px;
    height: 5px;
    margin: 10px auto 0;
    border-radius: 3px;
    background: var(--rule);
  }
  .modal-photo-slot { padding-top: 12px; }
  .modal-photo { aspect-ratio: 16 / 11; }
}
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes sheet-down { to { transform: translateY(100%); } }
@keyframes sheet-in {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}

@media (min-width: 760px) {
  .modal { padding: 32px; }
  .modal-panel {
    grid-template-columns: minmax(260px, 38%) 1fr;
    max-height: calc(100vh - 64px);
    max-height: calc(100dvh - 64px);
  }
  .modal-photo-slot {
    padding: 36px 0 36px 56px;
    align-self: start;
    position: sticky;
    top: 0;
  }
  .modal-photo { aspect-ratio: 4 / 5; }
  .modal-body { padding: 44px 48px 12px 40px; }
  .modal-hint { grid-column: 1 / -1; padding-left: 56px; }
}

/* ---------- Плавная смена цветов при переключении темы ---------- */
html.theme-anim, html.theme-anim *, html.theme-anim *::before, html.theme-anim *::after {
  transition: background-color .3s ease, color .3s ease, border-color .3s ease !important;
}

/* ---------- Для тех, у кого в системе выключена анимация ---------- */
@media (prefers-reduced-motion: reduce) {
  .date-ring path { animation: none; stroke-dashoffset: 0; }
  .modal, .modal-panel, .header-menu.is-open { animation: none; }
  .ballot-box svg, .burger span, .btn, .cta, .nav-link::after, .video-link, .video-arrow { transition: none; }
}

/* =========================================================
   Движение. Всё ниже срабатывает один раз, когда блок
   доходит до экрана (класс is-in ставит app.js).
   Класс .js стоит только при включённом JavaScript, так что
   без него всё сразу видно.
   ========================================================= */

/* Карточки кандидатов ложатся на лист по очереди, как фотографии */
.js .grid .card {
  opacity: 0;
  transform: translateY(18px) rotate(-1.6deg);
  transition: opacity .5s ease, transform .7s cubic-bezier(.2, .8, .2, 1);
  transition-delay: calc(var(--i, 0) * 90ms);
}
.js .grid.is-in .card { opacity: 1; transform: none; }

/* На компьютере фото чуть приподнимается под курсором */
.photo { transition: transform .35s cubic-bezier(.2, .8, .2, 1), box-shadow .35s ease; }
@media (hover: hover) {
  .card-link:hover .photo {
    transform: translateY(-4px) rotate(-.6deg);
    box-shadow: 0 14px 24px -16px rgba(10, 20, 50, .45);
  }
}
.card-link:active .photo { transform: scale(.985); }

/* Подсказка «пишется» слева направо */
.js .candidates-head .hand-note { clip-path: inset(-10px 100% -30px -10px); transition: clip-path 1.2s cubic-bezier(.6, 0, .3, 1) .2s; }
.js .candidates-head.is-in .hand-note { clip-path: inset(-10px -70px -30px -10px); }

/* Бюллетень въезжает на стол и ложится под своим углом */
.js .ballot {
  opacity: 0;
  transform: translateY(48px) rotate(-5deg);
  transition: opacity .5s ease, transform .9s cubic-bezier(.2, .8, .2, 1);
}
.js .ballot.is-in { opacity: 1; transform: rotate(var(--ballot-rot, 0deg)); }

/* Подчёркивание финальной фразы рисуется ручкой */
.js .events-final path { stroke-dasharray: 1; stroke-dashoffset: 1; }
.js .events-final.is-in path:first-child { stroke-dashoffset: 0; transition: stroke-dashoffset .9s cubic-bezier(.55, 0, .25, 1) .2s; }
.js .events-final.is-in path:last-child { stroke-dashoffset: 0; transition: stroke-dashoffset .35s ease-out 1.05s; }

/* ---------- Телефон: кандидаты листаются вбок ---------- */
@media (max-width: 599px) {
  .grid {
    display: flex;
    gap: 16px;
    margin: 0 calc(var(--gutter) * -1);
    padding: 4px var(--gutter) 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-left: var(--gutter);
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .grid::-webkit-scrollbar { display: none; }
  .grid .card { flex: 0 0 80%; scroll-snap-align: start; }
  .candidates { padding-bottom: 48px; }
  .hand-note { font-size: 21px; }
}

@media (min-width: 960px) {
  .cta-mini { display: none; }
}

/* =========================================================
   Победитель (status: "win" в candidates.js)
   ========================================================= */
.winner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 32px var(--gutter) 40px;
  display: grid;
  gap: 28px;
  align-items: center;
}
.winner[hidden] { display: none; }
/* черта под блоком: ровно по ширине текста, как и у других разделов */
.winner::after {
  content: "";
  grid-column: 1 / -1;
  height: 2px;
  margin-top: 12px;
  background: var(--ink);
}

.winner-photo-wrap { position: relative; max-width: 420px; }
.winner-photo { aspect-ratio: 4 / 5; box-shadow: 0 20px 40px -26px rgba(10, 20, 50, .5); }

.winner-kicker {
  margin: 0 0 6px;
  font-family: var(--hand);
  font-size: 24px;
  color: var(--red-text);
  transform: rotate(-2deg);
  transform-origin: left center;
}
.winner-title { font-weight: 700; font-size: clamp(22px, 2.6vw, 32px); line-height: 1.2; }
.winner-name {
  margin: 6px 0 0;
  font-weight: 900;
  font-size: clamp(48px, 9vw, 136px);
  line-height: .92;
  letter-spacing: -0.04em;
  overflow-wrap: anywhere;
}
.winner-meta { margin: 16px 0 0; font-size: 20px; color: var(--muted); }
.winner-score { font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.winner-btn { margin-top: 24px; font-family: inherit; background: transparent; cursor: pointer; }

/* ---------- Печать ---------- */
.stamp {
  position: absolute;
  display: block;
  color: var(--red);
  pointer-events: none;
  transform: rotate(-14deg);
}
.stamp svg { display: block; width: 100%; height: auto; overflow: visible; }
/* на светлой бумаге чернила «впитываются» */
.stamp { mix-blend-mode: multiply; opacity: .92; }
:root[data-theme="dark"] .stamp { mix-blend-mode: normal; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .stamp { mix-blend-mode: normal; }
}

.stamp--big { width: 54%; right: -14%; top: -8%; }
.stamp--card { width: 46%; right: 4%; top: 4%; transform: rotate(-12deg); color: #da2c37; }
.stamp--modal { width: 42%; right: 4%; top: 4%; color: #da2c37; animation: slam .5s cubic-bezier(.2, .9, .3, 1.25) both; }

/* Удар печати: при входе на страницу */
@keyframes slam {
  0%   { opacity: 0; transform: scale(2.3) rotate(2deg); }
  55%  { opacity: 1; transform: scale(.94) rotate(-14deg); }
  100% { opacity: .92; transform: scale(1) rotate(-14deg); }
}
@keyframes thud {
  0%, 100% { transform: none; }
  35% { transform: translateY(4px) scale(.992); }
}
.js .winner .stamp--big { opacity: 0; }
.js .winner.is-in .stamp--big { animation: slam .55s cubic-bezier(.2, .9, .3, 1.25) .45s both; }
.js .winner.is-in .winner-photo { animation: thud .3s ease-out .72s; }
/* имя победителя проявляется после печати */
.js .winner .winner-name { clip-path: inset(0 100% -.2em 0); }
.js .winner.is-in .winner-name { clip-path: inset(0 0 -.2em 0); transition: clip-path .9s cubic-bezier(.6, 0, .3, 1) .9s; }

/* печать на карточке ставится, когда карточки легли */
.js .grid .stamp--card { opacity: 0; }
.js .grid.is-in .stamp--card { animation: slam .5s cubic-bezier(.2, .9, .3, 1.25) both; animation-delay: calc(var(--i, 0) * 90ms + .7s); }
.grid .stamp--card { --r: -12deg; }

.card--win .name { color: var(--red-text); }

@media (min-width: 760px) {
  .winner {
    grid-template-columns: minmax(240px, 400px) minmax(0, 1fr);
    gap: 64px;
    padding-top: 56px;
    padding-bottom: 56px;
  }
}

@media (max-width: 599px) {
  .winner-photo-wrap { max-width: 78%; }
  .stamp--big { width: 60%; right: -22%; }
}

/* ---------- Без анимации, если она выключена в системе ---------- */
@media (prefers-reduced-motion: reduce) {
  .js .grid .card, .js .ballot, .js .candidates-head .hand-note,
  .js .winner .stamp--big, .js .grid .stamp--card, .js .winner .winner-name {
    opacity: 1; transform: none; clip-path: none; transition: none; animation: none;
  }
  .js .ballot { transform: rotate(var(--ballot-rot, 0deg)); }
  .js .winner .stamp--big { transform: rotate(-14deg); opacity: .92; }
  .js .grid .stamp--card { transform: rotate(-12deg); opacity: .92; }
  .js .events-final path { stroke-dashoffset: 0; }
  .photo, .stamp--modal, .winner-photo { transition: none; animation: none; }
}
