/* ═══════════════════════════════════════════════════════════════
   Ржавь · Бланк Ф-47/Р · Управление Утилизации Бетонника-7
   Концепт: канцелярский бланк палача-бюрократа на пожелтевшей
   бумаге, с жёлтым туманом на фоне и красными штампами как CTA.
   ═══════════════════════════════════════════════════════════════ */

/* ── Self-hosted fonts ─────────────────────────────────────── */

/* PT Mono — машинопись (советский типографский стиль, есть кириллица) */
@font-face {
  font-family: 'PT Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/pt-mono-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'PT Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/pt-mono-cyrillic-ext.woff2') format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
@font-face {
  font-family: 'PT Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/pt-mono-latin.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: 'PT Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/pt-mono-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Caveat — рукопись на полях (variable font, 400-700) */
@font-face {
  font-family: 'Caveat';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('fonts/caveat-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Caveat';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('fonts/caveat-cyrillic-ext.woff2') format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
@font-face {
  font-family: 'Caveat';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('fonts/caveat-latin.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: 'Caveat';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('fonts/caveat-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Russo One — штампы и заголовки */
@font-face {
  font-family: 'Russo One';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/russo-one-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Russo One';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/russo-one-latin.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: 'Russo One';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/russo-one-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

/* ── Палитра и переменные ──────────────────────────────────── */
:root {
  /* Бумага — выцветшая канцелярская */
  --paper:         #e8d9a8;
  --paper-edge:    #c4a267;
  --paper-stain:   #b58f4a;
  --paper-shadow:  rgba(0, 0, 0, 0.45);

  /* Чернила и карандаши */
  --ink-type:      #2a2a28;   /* машинопись, тёплый тёмно-серый */
  --ink-type-soft: #4a3e2c;
  --ink-blue:      #1e3a6a;   /* синие чернила резолюций */
  --ink-pencil:    #5a2010;   /* копотский карандаш */
  --ink-handwrite: #3a2a4a;   /* рукопись карандашом */

  /* Штампы */
  --stamp-red:     #8b2e1f;
  --stamp-red-deep:#6a1e12;
  --stamp-blue:    #2a3e6a;

  /* Фон за бумагой: битум → ржавчина */
  --bg-bitumen:    #1a1512;
  --bg-rust-deep:  #3a1e12;
  --bg-rust:       #5a2a18;

  /* Жёлтый Туман — акцентный оверлей */
  --fog:           #d9b84a;
  --fog-deep:      #b8932c;

  /* Типографика — все self-hosted, полная кириллица */
  --font-type:     'PT Mono', 'Courier New', Courier, monospace;
  --font-elite:    'PT Mono', 'Courier New', Courier, monospace;
  --font-hand:     'Caveat', 'Marker Felt', cursive;
  --font-stamp:    'Russo One', 'Impact', 'Arial Black', sans-serif;

  /* Геометрия */
  --paper-max:     860px;
  --paper-pad-x:   clamp(1.4rem, 4vw, 4rem);
  --paper-pad-y:   clamp(2rem, 5vw, 4.5rem);
}

/* ── Фон: битумная шахта + ржавчина ────────────────────────── */
body {
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 50% 0%, var(--bg-rust) 0%, var(--bg-rust-deep) 35%, var(--bg-bitumen) 80%);
  color: var(--ink-type);
  font-family: var(--font-type);
  font-size: 16px;
  line-height: 1.55;
  padding: clamp(1rem, 3vw, 3rem) 0.8rem clamp(3rem, 5vw, 5rem);
  overflow-x: hidden;
}

/* ── Жёлтый туман: дышащий фоновый слой ────────────────────── */
.fog-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(circle at 20% 15%, rgba(217, 184, 74, 0.22), transparent 45%),
    radial-gradient(circle at 80% 80%, rgba(184, 147, 44, 0.16), transparent 55%),
    radial-gradient(circle at 50% 50%, rgba(217, 184, 74, 0.08), transparent 70%);
  mix-blend-mode: screen;
  animation: fog-breathe 18s ease-in-out infinite;
}

@keyframes fog-breathe {
  0%, 100% { opacity: 0.75; transform: scale(1); }
  50%      { opacity: 1;    transform: scale(1.04); }
}

/* ── Grain overlay: шум поверх всего ───────────────────────── */
.grain-layer {
  position: fixed;
  inset: -10%;
  pointer-events: none;
  z-index: 1;
  background-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.45 0'/></filter><rect width='200' height='200' filter='url(%23n)' opacity='0.55'/></svg>");
  opacity: 0.18;
  mix-blend-mode: multiply;
}

/* ═══════════════════════════════════════════════════════════════
   БУМАГА БЛАНКА
   ═══════════════════════════════════════════════════════════════ */

.paper {
  position: relative;
  z-index: 2;
  max-width: var(--paper-max);
  margin: 0 auto;
  padding: var(--paper-pad-y) var(--paper-pad-x);

  background:
    /* Пятно бумаги по краям */
    radial-gradient(ellipse at 50% 0%,   rgba(196, 162, 103, 0.35) 0%, transparent 45%),
    radial-gradient(ellipse at 50% 100%, rgba(181, 143, 74, 0.30) 0%, transparent 45%),
    radial-gradient(ellipse at 0% 50%,   rgba(180, 140, 60, 0.25) 0%, transparent 40%),
    radial-gradient(ellipse at 100% 50%, rgba(180, 140, 60, 0.25) 0%, transparent 40%),
    /* Текстура бумаги: полосы старого волокна */
    repeating-linear-gradient(
      0deg,
      transparent 0, transparent 2px,
      rgba(0, 0, 0, 0.015) 2px, rgba(0, 0, 0, 0.015) 3px
    ),
    var(--paper);

  box-shadow:
    0 0 1px rgba(0, 0, 0, 0.4),
    0 25px 60px -10px var(--paper-shadow),
    0 45px 120px -30px rgba(0, 0, 0, 0.7),
    inset 0 0 120px rgba(140, 95, 40, 0.12);

  /* Неровные обожжённые края */
  clip-path: polygon(
    0.3% 0.5%,    99.6% 0.2%,   100% 2%,     99.8% 15%,
    99.5% 35%,    99.9% 55%,    99.4% 80%,   99.7% 98.5%,
    98% 100%,     75% 99.6%,    40% 100%,    5% 99.8%,
    0.2% 98%,     0.5% 70%,     0% 40%,      0.4% 12%,
    0% 4%
  );
}

/* Дырка скоросшивателя — слева по центру */
.paper-hole {
  position: absolute;
  left: 18px;
  top: 50%;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--bg-bitumen) 0%, var(--bg-bitumen) 55%, var(--paper-edge) 65%, var(--paper) 100%);
  box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.5), 0 0 2px rgba(0, 0, 0, 0.3);
  z-index: 5;
  pointer-events: none;
}

/* Пятна от кружки/чая */
.paper-stain {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  z-index: 3;
  background: radial-gradient(circle, transparent 52%, rgba(140, 90, 30, 0.28) 58%, rgba(140, 90, 30, 0.12) 68%, transparent 78%);
  mix-blend-mode: multiply;
}

.paper-stain--coffee {
  width: 120px;
  height: 120px;
  right: 8%;
  top: 42%;
  transform: rotate(-18deg);
}

.paper-stain--small {
  width: 52px;
  height: 52px;
  left: 22%;
  bottom: 12%;
  transform: rotate(23deg);
  opacity: 0.75;
}

/* ═══════════════════════════════════════════════════════════════
   ШАПКА БЛАНКА
   ═══════════════════════════════════════════════════════════════ */

.form-header {
  position: relative;
  display: grid;
  grid-template-columns: 100px 1fr auto;
  gap: 1.5rem;
  align-items: start;
  padding-bottom: 1.2rem;
  border-bottom: 2px solid var(--ink-type);
  margin-bottom: 1.8rem;
}

.stamp-round {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.85;
}

.stamp-round img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  mix-blend-mode: multiply;
  transform: rotate(-7deg);
  filter: sepia(0.2) contrast(1.1);
}

.form-meta {
  font-family: var(--font-type);
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--ink-type);
}

.ministry {
  font-family: var(--font-stamp);
  font-size: 1.1rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-type);
  margin-bottom: 0.15rem;
}

.department {
  font-size: 0.82rem;
  color: var(--ink-type-soft);
  font-style: italic;
  margin-bottom: 0.7rem;
}

.form-number,
.form-date {
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}

.form-number {
  color: var(--ink-type);
}

.form-date {
  color: var(--ink-type-soft);
  margin-top: 0.2rem;
}

/* Гриф "ДСП" в правом верхнем */
.gryph-dsp {
  border: 2.5px solid var(--stamp-red);
  padding: 0.5rem 0.9rem 0.4rem;
  text-align: center;
  transform: rotate(6deg);
  color: var(--stamp-red);
  font-family: var(--font-stamp);
  line-height: 1;
  align-self: start;
  margin-top: 0.3rem;
  opacity: 0.88;
}

.gryph-dsp span {
  display: block;
  font-size: 1.6rem;
  letter-spacing: 0.12em;
}

.gryph-dsp small {
  display: block;
  font-size: 0.55rem;
  letter-spacing: 0.08em;
  margin-top: 0.2rem;
  font-family: var(--font-type);
  font-weight: normal;
  text-transform: uppercase;
}

/* ═══════════════════════════════════════════════════════════════
   СТИКИ-РЕЗОЛЮЦИЯ (CTA в шапку сайта)
   ═══════════════════════════════════════════════════════════════ */

.sticky-resolution {
  position: fixed;
  top: 2rem;
  right: 2rem;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.55rem 1.1rem 0.5rem;
  border: 2.5px solid var(--stamp-red);
  background: rgba(232, 217, 168, 0.92);
  color: var(--stamp-red);
  text-decoration: none;
  font-family: var(--font-stamp);
  letter-spacing: 0.08em;
  transform: rotate(-4deg);
  transition: transform 0.25s cubic-bezier(0.2, 1.5, 0.4, 1), box-shadow 0.25s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.sticky-resolution::before {
  content: "◆";
  position: absolute;
  top: -0.3rem;
  left: -0.3rem;
  font-size: 0.5rem;
  color: var(--stamp-red);
}

.sticky-resolution:hover,
.sticky-resolution:focus-visible {
  transform: rotate(0deg) scale(1.05);
  box-shadow: 0 6px 22px rgba(139, 46, 31, 0.5);
  outline: none;
}

.resolution-line {
  font-size: 1.05rem;
  line-height: 1;
}

.resolution-sub {
  font-family: var(--font-type);
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  margin-top: 0.2rem;
  opacity: 0.8;
  text-transform: lowercase;
}

/* ═══════════════════════════════════════════════════════════════
   НАИМЕНОВАНИЕ ПАРТИИ
   ═══════════════════════════════════════════════════════════════ */

.form-title {
  text-align: center;
  padding: 0.8rem 0 1.6rem;
  position: relative;
}

.field-label {
  display: inline-block;
  font-family: var(--font-type);
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  color: var(--ink-type-soft);
  text-transform: uppercase;
  border-bottom: 1px solid var(--ink-type-soft);
  padding-bottom: 2px;
  margin-bottom: 0.9rem;
}

.title-main {
  font-family: var(--font-elite);
  font-size: clamp(2.6rem, 11vw, 6.5rem);
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--ink-type);
  line-height: 1;
  margin: 0.3rem 0 1.1rem;
  word-break: break-word;
  overflow-wrap: break-word;
  text-shadow:
    1px 0 0 rgba(42, 42, 40, 0.4),
    -1px 0 0 rgba(42, 42, 40, 0.3);
  /* Лёгкая пропечатка — неровность машинописи */
  transform: rotate(-0.2deg);
}

/* Эффект пропуска отдельных букв */
.title-main::first-letter {
  color: var(--ink-type);
  opacity: 0.92;
}

.subtitle {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem 0.6rem;
  font-family: var(--font-type);
  font-size: 0.88rem;
  letter-spacing: 0.06em;
  color: var(--ink-type);
  font-style: italic;
}

.subtitle .sep {
  color: var(--ink-type-soft);
  opacity: 0.5;
}

/* Горизонтальные разделители — двойная бюрократическая линейка */
.form-rule {
  border: none;
  border-top: 1px solid var(--ink-type);
  margin: 1.8rem 0;
  opacity: 0.55;
}

.form-rule--double {
  border-top: 3px double var(--ink-type);
  opacity: 0.75;
  margin: 2.4rem 0 1.8rem;
}

/* ═══════════════════════════════════════════════════════════════
   ПОЛЯ БЛАНКА (1–6)
   ═══════════════════════════════════════════════════════════════ */

.field {
  padding: 1.5rem 0 1.7rem;
  position: relative;
}

.field + .field::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background:
    repeating-linear-gradient(to right, var(--ink-type-soft) 0, var(--ink-type-soft) 3px, transparent 3px, transparent 7px);
  opacity: 0.4;
}

.field h2.field-label {
  display: block;
  border: none;
  padding: 0;
  font-family: var(--font-stamp);
  font-size: 0.95rem;
  letter-spacing: 0.16em;
  color: var(--ink-type);
  margin-bottom: 1rem;
  text-transform: uppercase;
}

.field-body {
  padding-left: 1.2rem;
  border-left: 2px solid var(--ink-type);
  border-left-style: dashed;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.field[data-reveal].is-visible .field-body,
.form-title[data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
}

.typed {
  font-family: var(--font-type);
  font-size: 1rem;
  line-height: 1.75;
  color: var(--ink-type);
  margin-bottom: 0.6rem;
  letter-spacing: 0.01em;
  /* Намёк на пропечатку — чуть съехавшая буква */
  text-shadow: 0.3px 0 0 currentColor;
}

.typed strong {
  font-weight: 700;
  color: var(--ink-type);
  letter-spacing: 0.04em;
}

.typed em {
  font-style: italic;
  color: var(--ink-type-soft);
}

.typed sup {
  color: var(--stamp-red);
  font-weight: 700;
}

/* ═══════════════════════════════════════════════════════════════
   РУКОПИСЬ — резолюции на полях
   ═══════════════════════════════════════════════════════════════ */

.handwritten {
  font-family: var(--font-hand);
  font-size: 1.35rem;
  line-height: 1.35;
  color: var(--ink-handwrite);
  margin-top: 0.7rem;
  transform: rotate(-1deg);
  opacity: 0.92;
}

.handwritten em {
  color: var(--ink-blue);
  font-style: italic;
}

.handwritten--margin {
  margin-left: -0.6rem;
  padding-left: 0.3rem;
  border-left: 2px solid var(--ink-blue);
  border-left-style: dotted;
  color: var(--ink-blue);
}

/* ═══════════════════════════════════════════════════════════════
   ПОЛЕ 3 — таблица состава
   ═══════════════════════════════════════════════════════════════ */

.contents-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-type);
  font-size: 0.92rem;
  line-height: 1.55;
  margin-bottom: 0.6rem;
}

.contents-table td {
  padding: 0.55rem 0.5rem;
  border-bottom: 1px dashed var(--ink-type-soft);
  vertical-align: top;
  color: var(--ink-type);
}

.contents-table tr:last-child td {
  border-bottom: none;
}

.row-num {
  width: 4.5rem;
  color: var(--ink-type-soft);
  font-size: 0.82rem;
  letter-spacing: 0.05em;
}

.row-name {
  width: 11rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.row-desc {
  color: var(--ink-type);
}

.row-desc em {
  color: var(--ink-pencil);
  font-style: italic;
}

/* ═══════════════════════════════════════════════════════════════
   ПОЛЕ 4 — маршрут
   ═══════════════════════════════════════════════════════════════ */

.route-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0.8rem;
  display: grid;
  gap: 0.45rem;
}

.route-list li {
  display: grid;
  grid-template-columns: 4.2rem 10rem 1fr;
  gap: 0.7rem;
  align-items: baseline;
  font-size: 0.92rem;
  padding: 0.15rem 0;
  border-bottom: 1px dotted rgba(42, 42, 40, 0.25);
}

.route-list .day {
  color: var(--ink-type-soft);
  font-size: 0.82rem;
  letter-spacing: 0.05em;
}

.route-list .place {
  font-weight: 700;
  color: var(--ink-type);
  letter-spacing: 0.02em;
}

.route-list .note {
  color: var(--ink-type-soft);
  font-size: 0.85rem;
  font-style: italic;
}

/* ═══════════════════════════════════════════════════════════════
   ПОЛЕ 5 — цитаты как "особые отметки"
   ═══════════════════════════════════════════════════════════════ */

.typed-quote {
  font-family: var(--font-elite);
  font-size: 1.05rem;
  line-height: 1.55;
  color: var(--ink-type);
  padding: 0.6rem 0 0.6rem 1.3rem;
  margin: 0.5rem 0;
  border-left: 3px solid var(--ink-pencil);
  letter-spacing: 0.02em;
  position: relative;
}

.typed-quote::before {
  content: "↳";
  position: absolute;
  left: 0.3rem;
  top: 0.6rem;
  color: var(--ink-pencil);
  opacity: 0.6;
  font-size: 0.9rem;
}

.typed-quote + .typed-quote {
  border-top: 1px dashed rgba(90, 32, 16, 0.25);
  margin-top: 0.2rem;
}

/* ═══════════════════════════════════════════════════════════════
   ПОЛЕ 6 — приложения
   ═══════════════════════════════════════════════════════════════ */

.field--appendix .field-body {
  border-left: none;
  padding-left: 0;
}

.appendix-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 1.1rem;
  margin-top: 0.6rem;
  align-items: start;
}

.appendix-item {
  display: flex;
  flex-direction: column;
  background: rgba(255, 248, 225, 0.45);
  border: 1px solid rgba(90, 60, 25, 0.35);
  padding: 0.55rem 0.55rem 0.7rem;
  box-shadow:
    1px 1px 3px rgba(0, 0, 0, 0.15),
    3px 4px 10px rgba(0, 0, 0, 0.2);
  transform: rotate(var(--tilt, -1.2deg));
  transition: transform 0.3s cubic-bezier(0.2, 1.2, 0.3, 1), box-shadow 0.3s ease;
  text-decoration: none;
  color: inherit;
  position: relative;
}

.appendix-item:nth-child(2n) { --tilt:  1.4deg; }
.appendix-item:nth-child(3n) { --tilt: -2.1deg; }
.appendix-item:nth-child(4n) { --tilt:  0.8deg; }

.appendix-item::after {
  /* Булавка */
  content: "";
  position: absolute;
  top: -4px;
  left: 50%;
  width: 10px;
  height: 10px;
  background: radial-gradient(circle at 35% 30%, #c43a2a, #8b2015);
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  transform: translateX(-50%);
}

.appendix-item:hover,
.appendix-item:focus-visible {
  transform: rotate(0deg) translateY(-3px);
  box-shadow:
    2px 2px 5px rgba(0, 0, 0, 0.2),
    6px 10px 22px rgba(0, 0, 0, 0.35);
  outline: none;
}

.appendix-item img {
  width: 100%;
  height: auto;          /* родной аспект каждой картинки (1:1, 3:2) */
  display: block;
  background: #d9c594;
  border: 1px solid rgba(90, 60, 25, 0.35);
  filter: sepia(0.18) contrast(1.02) saturate(0.9);
}

.appendix-item figcaption {
  margin-top: 0.5rem;
  font-family: var(--font-hand);
  font-size: 1.05rem;
  line-height: 1.25;
  color: var(--ink-handwrite);
  text-align: center;
}

/* Специальная карточка — рукопись как CTA */
.appendix-item--rukopis {
  background: linear-gradient(145deg, #f0dfa8, #d9c080);
  border-color: var(--stamp-red);
  border-width: 2px;
}

.appendix-item--rukopis figcaption {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.appendix-item--rukopis .seal {
  font-family: var(--font-stamp);
  font-size: 1rem;
  letter-spacing: 0.1em;
  color: var(--stamp-red);
  border: 2px solid var(--stamp-red);
  padding: 0.2rem 0.4rem;
  display: inline-block;
  margin: 0 auto;
  transform: rotate(-3deg);
}

.appendix-item--rukopis .count {
  font-family: var(--font-type);
  font-size: 0.82rem;
  color: var(--ink-type);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 0.25rem;
}

.appendix-item--rukopis .hint {
  font-family: var(--font-hand);
  font-size: 1.1rem;
  color: var(--stamp-red);
  font-style: italic;
}

/* ═══════════════════════════════════════════════════════════════
   ПОДВАЛ — подпись и финальный штамп
   ═══════════════════════════════════════════════════════════════ */

.form-footer {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 1.5rem 2rem;
  align-items: start;
  padding-top: 0.8rem;
}

.responsibility {
  grid-column: 1;
  grid-row: 1;
  font-family: var(--font-type);
  font-size: 0.92rem;
  line-height: 1.7;
}

.responsible-line,
.date-line,
.req-line {
  display: flex;
  gap: 0.8rem;
  align-items: baseline;
  flex-wrap: wrap;
}

.r-label {
  color: var(--ink-type-soft);
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  flex-shrink: 0;
}

.signature {
  font-family: var(--font-hand);
  font-size: 1.5rem;
  color: var(--ink-blue);
  border-bottom: 1.5px solid var(--ink-blue);
  padding: 0 0.4rem 0;
  transform: rotate(-2deg) translateY(-0.1rem);
  display: inline-block;
}

.signature-date {
  color: var(--ink-type);
  font-size: 0.92rem;
}

/* Финальный штамп "ПАРТИЯ ПРИНЯТА" */
.stamp-accepted {
  grid-column: 2;
  grid-row: 1 / span 2;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.8rem 1.6rem 1.4rem;
  text-decoration: none;
  color: var(--stamp-red);
  font-family: var(--font-stamp);
  text-transform: uppercase;
  transform: rotate(-6deg) translateY(0.5rem);
  transition: transform 0.3s cubic-bezier(0.2, 1.4, 0.3, 1.1), filter 0.3s ease;
  cursor: pointer;

  /* Двойная рамка штампа */
  border: 3.5px solid var(--stamp-red);
  border-radius: 8px;
  box-shadow:
    inset 0 0 0 1px rgba(139, 46, 31, 0.4),
    inset 0 0 0 6px transparent,
    inset 0 0 0 8px var(--stamp-red),
    0 2px 4px rgba(0, 0, 0, 0.2);

  /* Шум для "смазанности" чернил */
  background-image:
    radial-gradient(circle at 30% 40%, rgba(139, 46, 31, 0.08), transparent 40%),
    radial-gradient(circle at 70% 70%, rgba(139, 46, 31, 0.06), transparent 40%);
  background-color: rgba(232, 217, 168, 0.3);
}

.stamp-accepted img {
  display: none;
}

.stamp-accepted:hover,
.stamp-accepted:focus-visible {
  transform: rotate(0deg) translateY(0) scale(1.04);
  filter: drop-shadow(0 4px 12px rgba(139, 46, 31, 0.55));
  outline: none;
}

.stamp-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
}

.stamp-line1,
.stamp-line2 {
  font-size: clamp(1.1rem, 2vw, 1.5rem);
  letter-spacing: 0.14em;
  line-height: 1;
}

.stamp-line2 {
  font-size: clamp(1.4rem, 2.5vw, 1.9rem);
  font-weight: 700;
}

.stamp-line3 {
  font-family: var(--font-type);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  margin-top: 0.4rem;
  color: var(--stamp-red-deep);
  text-transform: none;
}

/* Реквизиты подвала */
.requisites {
  grid-column: 1;
  grid-row: 2;
  font-family: var(--font-type);
  font-size: 0.82rem;
  line-height: 1.7;
  color: var(--ink-type-soft);
}

.requisites a {
  color: var(--ink-blue);
  text-decoration: none;
  border-bottom: 1px dotted var(--ink-blue);
  transition: color 0.2s ease;
}

.requisites a:hover {
  color: var(--stamp-red);
  border-bottom-color: var(--stamp-red);
}

.req-line--copyright {
  color: var(--ink-type-soft);
  margin-top: 0.4rem;
  font-size: 0.76rem;
}

.req-line--copyright a {
  color: var(--ink-type-soft);
  border-bottom-color: var(--ink-type-soft);
}

/* ═══════════════════════════════════════════════════════════════
   АНИМАЦИИ
   ═══════════════════════════════════════════════════════════════ */

/* Эффект "допечатывания" для заголовка.
   fill-mode: both — keyframe 0% применяется во время delay,
   keyframe 100% остаётся после завершения.
   Никаких стартовых opacity:0 вне keyframes,
   чтобы при reduced-motion текст не оставался невидимым. */
[data-typewriter] {
  animation: typewriter-appear 1.2s 0.4s ease both;
}

@keyframes typewriter-appear {
  0%   { opacity: 0; filter: blur(3px);   letter-spacing: 0.4em; }
  60%  { opacity: 0.7; filter: blur(0.5px); letter-spacing: 0.22em; }
  100% { opacity: 1; filter: blur(0);     letter-spacing: 0.18em; }
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 680px) {
  .form-header {
    grid-template-columns: 70px 1fr;
    gap: 1rem;
  }

  .stamp-round {
    width: 70px;
    height: 70px;
  }

  .gryph-dsp {
    grid-column: 1 / -1;
    justify-self: end;
    transform: rotate(4deg);
  }

  .ministry {
    font-size: 0.98rem;
  }

  .contents-table {
    font-size: 0.85rem;
  }

  .contents-table td {
    padding: 0.45rem 0.3rem;
    display: block;
    border-bottom: none;
  }

  .contents-table tr {
    display: block;
    padding: 0.4rem 0;
    border-bottom: 1px dashed var(--ink-type-soft);
  }

  .row-num {
    color: var(--stamp-red);
    font-weight: 700;
    margin-bottom: 0.2rem;
  }

  .row-name {
    font-size: 1rem;
    width: auto;
  }

  .route-list li {
    grid-template-columns: 3.4rem 1fr;
    row-gap: 0;
  }

  .route-list .note {
    grid-column: 2;
    font-size: 0.8rem;
  }

  .form-footer {
    grid-template-columns: 1fr;
  }

  .stamp-accepted {
    grid-column: 1;
    grid-row: auto;
    align-self: center;
    justify-self: center;
    margin: 1rem auto;
  }

  .sticky-resolution {
    top: 0.8rem;
    right: 0.8rem;
    padding: 0.4rem 0.8rem;
  }

  .resolution-line {
    font-size: 0.85rem;
  }

  .resolution-sub {
    font-size: 0.58rem;
  }

  .paper {
    padding: clamp(2rem, 4vw, 3rem) 1rem;
  }

  .paper-hole {
    left: 8px;
    width: 12px;
    height: 12px;
  }
}

@media (max-width: 480px) {
  .title-main {
    letter-spacing: 0.12em;
  }

  .appendix-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.7rem;
  }

  .appendix-item figcaption {
    font-size: 0.95rem;
  }

  .stamp-accepted {
    transform: rotate(-4deg);
    padding: 1.4rem 1.2rem 1.1rem;
  }

  .form-number,
  .form-date {
    font-size: 0.78rem;
  }
}

@media (max-width: 360px) {
  .title-main {
    letter-spacing: 0.08em;
    font-size: clamp(2.2rem, 11vw, 3rem);
  }

  .appendix-grid {
    grid-template-columns: 1fr;
    gap: 0.8rem;
  }

  .sticky-resolution {
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.3rem 0.6rem;
    transform: rotate(-3deg) scale(0.92);
  }

  .resolution-line {
    font-size: 0.75rem;
  }

  .resolution-sub {
    display: none;
  }

  .ministry {
    font-size: 0.88rem;
  }

  .gryph-dsp span {
    font-size: 1.3rem;
  }

  .subtitle {
    font-size: 0.78rem;
  }

  .typed-quote {
    padding-left: 0.9rem;
    font-size: 0.94rem;
  }
}

/* Reduced motion — выключаем все анимации/переходы и явно
   показываем элементы, которые иначе остались бы скрыты. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .field-body,
  [data-typewriter],
  [data-reveal] .field-body {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
    letter-spacing: 0.18em;
  }
}
