
/* Layout: left-aligned masthead, then a single stage where the closed party booklet opens into the open ticket; emblem and stamp follow as two plain reference sections. */
:root {
  --bg: #ECE8E9;
  --surface: #F7F4F5;
  --ink: #2B141B;
  --muted: #6A565D;
  --rule: #CFC4C8;
  --burgundy: #7A1F3D;
  --gold: #A87820;
  --teal: #14505A;
  --shadow: rgba(43, 20, 27, .35);
  --font-display: "Old Standard TT", "Times New Roman", Georgia, serif;
  --font-body: "Literata", Georgia, "Times New Roman", serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #170C10;
    --surface: #221318;
    --ink: #F0E4E7;
    --muted: #A8929A;
    --rule: #3C2A31;
    --burgundy: #D4577F;
    --gold: #D9A94A;
    --teal: #6FB2BC;
    --shadow: rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #170C10;
  --surface: #221318;
  --ink: #F0E4E7;
  --muted: #A8929A;
  --rule: #3C2A31;
  --burgundy: #D4577F;
  --gold: #D9A94A;
  --teal: #6FB2BC;
  --shadow: rgba(0, 0, 0, .7);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  padding-block: 24px 48px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.wrap { max-width: 1040px; margin: 0 auto; display: flex; flex-direction: column; gap: 72px; }

/* Masthead */
.mast { display: flex; flex-direction: column; gap: 14px; max-width: 46rem; }
.kicker {
  font-size: .78rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--teal); font-weight: 600;
}
h1 { margin: 0; font-family: var(--font-display); font-weight: 700; line-height: .98; text-wrap: balance; }
h1 .pre { display: block; font-size: clamp(1rem, 2.6vw, 1.5rem); letter-spacing: .12em; text-transform: uppercase; color: var(--teal); margin-bottom: 6px; }
h1 .name { display: block; font-size: clamp(2rem, 10.5vw, 5.6rem); letter-spacing: .01em; text-transform: uppercase; color: var(--burgundy); }
.motto { margin: 0; font-family: var(--font-display); font-size: 1.25rem; color: var(--gold); letter-spacing: .04em; }
.lede { margin: 0; color: var(--muted); max-width: 40rem; }

/* Stage */
.stage-block { display: flex; flex-direction: column; align-items: center; gap: 20px; }
.stage { --s: 1; width: 100%; display: flex; justify-content: center; padding-block: calc(36% * (var(--s) - 1)); }
.stage.open { padding-block: 0; transition: padding-block 1.6s cubic-bezier(.45, .05, .25, 1); }

.book {
  --ease: cubic-bezier(.45, .05, .25, 1);
  position: relative; width: min(960px, 100%); aspect-ratio: 2062 / 1455;
  perspective: 2400px;
  transform: translateX(calc(-25% * var(--s))) scale(var(--s));
  transition: transform 1.6s var(--ease);
  filter: drop-shadow(0 20px 24px var(--shadow));
}
.stage.open .book { transform: none; }

.pg { position: absolute; top: 0; height: 100%; width: 50%; }
.pg img { display: block; width: 100%; height: 100%; }
.pg.right { left: 50%; opacity: 0; transition: opacity 0s linear 1.6s; }
.stage.open .pg.right { opacity: 1; transition-delay: 0s; }
.pg.right::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: linear-gradient(90deg, rgba(20, 6, 10, .6), transparent 60%);
}
.stage.open .pg.right::after { animation: cast 1.6s ease forwards; }
@keyframes cast { 0% { opacity: .9; } 50% { opacity: .5; } 100% { opacity: 0; } }

.flip {
  position: absolute; left: 50%; top: 0; width: 50%; height: 100%;
  transform-origin: left center; transform-style: preserve-3d;
  transition: transform 1.6s var(--ease);
}
.stage.open .flip { transform: rotateY(-180deg); }
.hit:hover + .flip { transform: rotateY(-9deg); }
.face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.face.front {
  --img: url("../img/cover.webp");
  background-image: var(--img); background-size: 100% 100%; border-radius: 4px;
}
.face.front::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  -webkit-mask-image: var(--img); mask-image: var(--img);
  -webkit-mask-size: 100% 100%; mask-size: 100% 100%;
  background: linear-gradient(105deg, transparent 38%, rgba(255, 236, 178, .5) 50%, transparent 62%);
  background-size: 260% 100%; background-position: 130% 0;
  animation: shine 6s ease-in-out 1.2s infinite;
}
@keyframes shine { 0% { background-position: 130% 0; } 35%, 100% { background-position: -30% 0; } }
.stage.open .face.front::after { animation: none; }
.face.back { transform: rotateY(180deg); }
.book { container-type: inline-size; }
/* Номер билета: накладывается поверх чистой картинки. Координаты в % страницы. */
.ticket-no {
  position: absolute; left: 72.8%; top: 27.7%; transform: translateY(-50%);
  font-family: var(--font-display); font-weight: 700; font-size: 2.7cqw; line-height: 1;
  letter-spacing: .06em; color: #7A1F3D; white-space: nowrap; pointer-events: none;
}
.face.back img { display: block; width: 100%; height: 100%; }

.hit {
  appearance: none; border: 0; padding: 0; margin: 0; background: transparent; cursor: pointer;
  position: absolute; left: 50%; top: 0; width: 50%; height: 100%; z-index: 5;
}
.hit:focus-visible { outline: 3px solid var(--gold); outline-offset: 6px; }
.stage.open .hit { display: none; }

.noform { display: flex; flex-direction: column; gap: 6px; align-items: center; font-size: .85rem; color: var(--muted); }
.noform input { font: inherit; font-size: 1rem; width: 9rem; text-align: center; padding: 8px 10px; border: 1.5px solid var(--burgundy); border-radius: 8px; background: transparent; color: var(--ink); letter-spacing: .08em; }
.noform input:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.hint { margin: 0; font-size: .9rem; color: var(--muted); min-height: 1.5em; text-align: center; }
.btn {
  appearance: none; font: inherit; font-size: .9rem; font-weight: 600; letter-spacing: .04em;
  background: transparent; color: var(--burgundy); border: 1.5px solid var(--burgundy);
  padding: 10px 20px; border-radius: 4px; cursor: pointer; min-height: 44px;
  transition: background .2s, color .2s;
}
.btn:hover { background: var(--burgundy); color: var(--bg); }
.btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
@media (max-width: 640px) { .stage { --s: 1.7; } }

/* Sections */
h2 { margin: 0 0 6px; font-family: var(--font-display); font-size: clamp(1.6rem, 4vw, 2.2rem); line-height: 1.1; color: var(--ink); text-wrap: balance; }
.sec-note { margin: 0 0 28px; color: var(--muted); max-width: 40rem; }

.symbols { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 40px; align-items: center; }
.symbols img { width: 100%; height: auto; display: block; filter: drop-shadow(0 14px 18px var(--shadow)); }
.legend { margin: 0; display: grid; gap: 0; }
.legend > div { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: 16px; padding: 14px 0; border-top: 1px solid var(--rule); }
.legend > div:last-child { border-bottom: 1px solid var(--rule); }
.legend dt { font-family: var(--font-display); font-weight: 700; color: var(--burgundy); }
.legend dd { margin: 0; color: var(--ink); }

.seal-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 300px); gap: 40px; align-items: center; }
.paper {
  position: relative; background: var(--surface); border: 1px solid var(--rule);
  padding: 32px clamp(20px, 4vw, 40px) 40px; border-radius: 3px;
  box-shadow: 0 10px 24px -14px var(--shadow);
  min-height: 340px;
}
.paper .org { font-size: .74rem; letter-spacing: .14em; text-transform: uppercase; color: var(--teal); font-weight: 600; margin: 0 0 4px; }
.paper h3 { margin: 0 0 20px; font-family: var(--font-display); font-size: 1.35rem; line-height: 1.2; }
.paper p { margin: 0 0 14px; max-width: 34rem; }
.blank { display: inline-block; min-width: 9rem; border-bottom: 1px solid var(--ink); }
.sign { margin-top: 28px; display: flex; gap: 12px; align-items: baseline; font-size: .92rem; color: var(--muted); }
.sign .blank { min-width: 8rem; }
.stamp {
  position: absolute; right: clamp(8px, 4vw, 36px); bottom: 10px; width: clamp(130px, 28vw, 190px); height: auto;
  transform: rotate(-9deg); opacity: .92; mix-blend-mode: multiply; pointer-events: none;
}
:root[data-theme="dark"] .stamp { mix-blend-mode: normal; opacity: .85; filter: brightness(1.7) saturate(.9); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .stamp { mix-blend-mode: normal; opacity: .85; filter: brightness(1.7) saturate(.9); } }
.stamp.hit { animation: hit .55s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes hit { 0% { transform: rotate(-9deg) scale(1.7); opacity: 0; } 70% { transform: rotate(-9deg) scale(.96); opacity: 1; } 100% { transform: rotate(-9deg) scale(1); } }
.seal-side { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.seal-side p { margin: 0; color: var(--muted); }

footer { border-top: 1px solid var(--rule); padding-top: 18px; font-size: .85rem; color: var(--muted); }

@media (max-width: 760px) {
  .symbols, .seal-grid { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .symbols img { max-width: 300px; }
  .paper { padding-bottom: 150px; }
  .legend > div { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .wrap { gap: 56px; }
}
@media (prefers-reduced-motion: reduce) {
  .book, .flip, .stage.open, .pg.right, .stamp { transition: none !important; animation: none !important; }
  .face.front::after, .pg.right::after { animation: none !important; }
  .hit:hover + .flip { transform: none; }
}

/* Сайт: шапка, формы, кабинет, админка */
body { padding-top: 0; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 50; background: var(--burgundy); color: var(--bg); padding: 8px 14px; border-radius: 4px; }
.skip:focus { left: 16px; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  margin: 0 -16px 36px; padding: 10px 16px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
.topbar-in { max-width: 1040px; margin: 0 auto; display: flex; align-items: center; gap: 12px 24px; }
.brand { display: inline-flex; align-items: center; gap: 10px; flex: none; font-family: var(--font-display); font-weight: 700; color: var(--burgundy); text-transform: uppercase; letter-spacing: .05em; font-size: 1.15rem; }
.brand img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.mainnav { display: flex; gap: 2px; align-items: center; flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.mainnav::-webkit-scrollbar { display: none; }
.mainnav a { flex: none; padding: 7px 12px; border-radius: 999px; color: var(--ink); font-size: .93rem; white-space: nowrap; transition: background .15s, color .15s; }
.mainnav a:hover { background: color-mix(in srgb, var(--burgundy) 9%, transparent); color: var(--burgundy); }
.mainnav a[aria-current="page"] { background: var(--burgundy); color: var(--bg); }
.mainnav a.lead { color: var(--gold); font-weight: 600; }
.mainnav a.lead::before { content: "★"; margin-right: 6px; font-size: .8em; }
.mainnav a.lead[aria-current="page"] { background: var(--gold); color: var(--bg); }
.account { display: flex; align-items: center; gap: 10px; flex: none; }
.account .who { color: var(--muted); font-size: .88rem; max-width: 10rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar form { margin: 0; }
.btn.small { min-height: 36px; padding: 6px 14px; font-size: .85rem; }
.linkbtn { appearance: none; border: 0; background: none; padding: 0; font: inherit; font-size: .88rem; color: var(--teal); cursor: pointer; min-height: 0; }
.linkbtn:hover { color: var(--burgundy); }
@media (max-width: 980px) {
  .topbar-in { flex-wrap: wrap; }
  .account { margin-left: auto; }
  .account .who { display: none; }
  .mainnav { order: 3; flex-basis: 100%; margin: 0 -4px; mask-image: linear-gradient(90deg, #000 88%, transparent); -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); }
}
.page { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 24px; }
.page.wide { max-width: 1040px; }
a.btn { display: inline-flex; align-items: center; text-decoration: none; }
.btn.solid { background: var(--burgundy); color: var(--bg); }
.flash { background: var(--surface); border-left: 4px solid var(--gold); padding: 10px 14px; margin: 0 0 16px; max-width: 1040px; margin-inline: auto; }
.errors { background: var(--surface); border-left: 4px solid var(--burgundy); padding: 10px 14px 10px 32px; margin: 0; }
.form { display: grid; gap: 16px; }
.form label { display: grid; gap: 4px; font-weight: 500; }
.form input[type=text], .form input[type=date], .form input[type=file], .form textarea, .form select, .cell-form select, .cell-form input {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; padding: 9px 10px; width: 100%; min-width: 0;
}
.form label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.form label.check input { margin-top: .35em; flex: none; }
.note { color: var(--muted); font-size: .9rem; margin: 0; }
.card { background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; padding: 18px 20px; }
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }
.status { font-family: var(--font-display); font-weight: 700; color: var(--burgundy); }
.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-family: var(--font-display); color: var(--teal); }
tr.overdue td { background: color-mix(in srgb, var(--burgundy) 14%, transparent); }
.cell-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0; }
.cell-form select, .cell-form input { width: auto; padding: 6px 8px; }
.photo { width: 180px; aspect-ratio: 3 / 4; object-fit: cover; border: 1px solid var(--rule); }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.verify-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: center; }
.verify-form input { font: inherit; width: 9rem; text-align: center; padding: 9px 10px; border: 1.5px solid var(--burgundy); border-radius: 8px; background: transparent; color: var(--ink); letter-spacing: .08em; }
.w6 { min-width: 6rem !important; }
.spread { display: block; width: 200%; max-width: none; height: 100%; }
.pg.right .spread { margin-left: -100%; }
.pg img.spread, .face.back img.spread { width: 200%; height: 100%; }
.pg.right, .face.back { overflow: hidden; }

/* Главная: о партии, шаги, устав */
a { color: var(--teal); text-decoration: none; }
#main a:not(.btn):not([aria-current]):hover { color: var(--burgundy); }
a:focus-visible, .linkbtn:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 3px; }
a.btn { color: var(--burgundy); }
a.btn.solid { color: var(--bg); }
.mast .btn-row { margin-top: 8px; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 640px) { .facts { grid-template-columns: minmax(0, 1fr); } }
.facts article { background: var(--surface); border: 1px solid var(--rule); border-top: 3px solid var(--gold); border-radius: 4px; padding: 16px 18px; }
.facts h3 { margin: 0 0 6px; font-family: var(--font-display); font-size: 1.2rem; color: var(--burgundy); }
.facts p { margin: 0; }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; display: grid; gap: 14px; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 2.6rem minmax(0, 1fr); gap: 2px 14px; align-items: baseline; padding-bottom: 14px; border-bottom: 1px solid var(--rule); }
.steps li::before { content: counter(step); grid-row: span 2; font-family: var(--font-display); font-weight: 700; font-size: 2rem; line-height: 1; color: var(--gold); }
.steps strong { display: block; }
.sec-head { align-self: stretch; }
.sec-head .sec-note { margin-bottom: 8px; }
.ustav { border-top: 1px solid var(--rule); }
.ustav details { border-bottom: 1px solid var(--rule); }
.ustav summary { cursor: pointer; padding: 12px 4px; font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; }
.ustav summary:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.ustav summary span { display: inline-block; min-width: 2rem; color: var(--gold); }
.ustav p { margin: 0 0 14px; padding-inline: 4px; max-width: 46rem; }
section[id] { scroll-margin-top: 84px; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* Общие элементы страниц */
.kicker { display: block; }
.page-head { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: flex-end; justify-content: space-between; }
.page-head h2 { margin-bottom: 2px; }
.back { display: inline-block; margin-bottom: 8px; font-size: .9rem; color: var(--muted); }
.card h3 { margin: 0 0 6px; font-family: var(--font-display); font-size: 1.25rem; color: var(--burgundy); }
.card.accent { border-left: 4px solid var(--gold); }
.card.empty { text-align: center; color: var(--muted); padding: 32px 20px; }
.btn-row.center { justify-content: center; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 560px) { .grid2 { grid-template-columns: minmax(0, 1fr); } }
.form label .note { font-weight: 400; }
.flash { border-radius: 4px; }
.muted { color: var(--muted); }
.num { font-family: var(--font-display); font-weight: 700; letter-spacing: .06em; color: var(--burgundy); white-space: nowrap; }
.tag { display: inline-block; margin-left: 6px; padding: 0 8px; border-radius: 999px; font-size: .75rem; background: color-mix(in srgb, var(--gold) 18%, transparent); color: var(--gold); white-space: nowrap; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .82rem; font-weight: 600; white-space: nowrap; background: color-mix(in srgb, var(--muted) 16%, transparent); color: var(--muted); }
.pill.active { background: color-mix(in srgb, var(--teal) 16%, transparent); color: var(--teal); }
.pill.suspended { background: color-mix(in srgb, var(--gold) 18%, transparent); color: var(--gold); }
.pill.expelled { background: color-mix(in srgb, var(--burgundy) 14%, transparent); color: var(--burgundy); }
.badge { display: inline-grid; place-items: center; min-width: 1.4em; height: 1.4em; padding: 0 5px; margin-left: 4px; border-radius: 999px; font-size: .75rem; font-weight: 700; background: var(--gold); color: var(--bg); }
tr:hover td { background: color-mix(in srgb, var(--surface) 70%, transparent); }

.num-input { font-family: var(--font-display) !important; font-weight: 700; letter-spacing: .14em; max-width: 12rem; }
.photo-row { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; }
.photo-row label { flex: 1 1 16rem; }
.photo.small { width: 96px; border-radius: 3px; }
td .btn.small { margin-bottom: 8px; }

/* Фото в кабинете */
.photo-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 12px; }
.photo-form .file { flex: 1 1 16rem; display: grid; gap: 4px; font-size: .85rem; color: var(--muted); }
.photo-form input[type=file] { font: inherit; color: var(--ink); background: var(--bg); border: 1px dashed var(--rule); border-radius: 4px; padding: 9px 10px; width: 100%; }
input[type=file]::file-selector-button { font: inherit; font-size: .85rem; margin-right: 10px; padding: 6px 12px; border: 1px solid var(--burgundy); border-radius: 4px; background: transparent; color: var(--burgundy); cursor: pointer; }

/* Руководство */
.lead-shell { max-width: 1040px; margin: 0 auto; display: flex; flex-direction: column; gap: 24px; }
.lead-head { display: flex; flex-direction: column; gap: 10px; padding-bottom: 14px; border-bottom: 1px solid var(--rule); }
.lead-head .kicker { color: var(--gold); }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs a { flex: none; padding: 8px 16px; border-radius: 4px; border: 1px solid var(--rule); background: var(--surface); color: var(--ink); font-size: .92rem; white-space: nowrap; }
.tabs a:hover { border-color: var(--burgundy); color: var(--burgundy); }
.tabs a[aria-current="page"] { background: var(--burgundy); border-color: var(--burgundy); color: var(--bg); }
.lead-shell .page { margin: 0; }
.lead-shell .page:not(.wide) { max-width: 760px; }

/* Проверка билета */
.page.verify { max-width: 560px; }
.page.verify h2 { margin-bottom: 8px; }
.verify-box { background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; padding: 20px; display: grid; gap: 10px; }
.verify-box label { font-weight: 600; }
.verify-row { display: flex; flex-wrap: wrap; gap: 10px; }
.verify-row input { flex: 1 1 11rem; min-width: 0; font-family: var(--font-display); font-weight: 700; font-size: 1.6rem; letter-spacing: .14em; text-align: center; padding: 8px 10px; color: var(--ink); background: var(--bg); border: 1.5px solid var(--rule); border-radius: 4px; }
.verify-row input::placeholder { color: var(--muted); opacity: .5; }
.verify-row input:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.verify-row .btn { flex: 0 0 auto; }
.verify-result { --state: var(--muted); border: 1px solid var(--rule); border-left: 6px solid var(--state); border-radius: 4px; background: var(--surface); padding: 16px 20px; }
.verify-result.valid { --state: var(--teal); }
.verify-result.revoked { --state: var(--burgundy); }
.verify-status { margin: 0 0 4px; font-family: var(--font-display); font-weight: 700; font-size: 1.5rem; color: var(--state); }
.verify-result dl { margin: 8px 0 0; }
.verify-result dl div { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; border-top: 1px solid var(--rule); }
.verify-result dt { color: var(--muted); }
.verify-result dd { margin: 0; font-weight: 600; }
