:root {
    --ink: #14182b;
    --paper: #f3f4f8;
    --card: #ffffff;
    --cobalt: #2d45e8;
    --flag: #ffd23f;
    --ok: #12805c;
    --line: #d5d9e6;
    --muted: #5d6380;
    --font-display: "Unbounded", "Onest", system-ui, sans-serif;
    --font-body: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-code: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

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

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font: 16px/1.55 var(--font-body);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--cobalt); text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible {
    outline: 3px solid var(--cobalt);
    outline-offset: 2px;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 700; line-height: 1.2; margin: 0; }
h1 { font-size: clamp(1.6rem, 3.2vw + .6rem, 2.6rem); letter-spacing: -.01em; }
h2 { font-size: 1.25rem; margin-bottom: 18px; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.section { padding-top: 36px; padding-bottom: 12px; }
.section__head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.section__head h2 { margin-bottom: 18px; }
.muted { color: var(--muted); margin: 6px 0 0; }
.lead { font-size: 1.1rem; color: var(--muted); max-width: 60ch; margin: 14px 0 0; }
.empty { color: var(--muted); padding: 24px 0; }

/* ---------- header ---------- */
.site-header { background: var(--ink); color: #fff; }
.site-header__row { display: flex; align-items: center; gap: 24px; min-height: 64px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
.brand { font: 700 1.2rem var(--font-display); color: #fff; text-decoration: none; }
.brand span { color: var(--flag); }
.nav a { color: #dfe2f5; text-decoration: none; font-weight: 500; }
.nav a:hover { color: #fff; text-decoration: underline; }
.search { margin-left: auto; display: flex; gap: 8px; flex: 0 1 360px; min-width: 220px; }
.search input {
    flex: 1; min-width: 0; height: 40px; padding: 0 14px; border-radius: 6px; border: 0;
    font: inherit; background: #fff; color: var(--ink);
}
.search button {
    height: 40px; padding: 0 16px; border-radius: 6px; border: 0; cursor: pointer;
    background: var(--flag); color: var(--ink); font: 600 .95rem var(--font-body);
}

/* ---------- hero ---------- */
.hero { background: var(--ink); color: #fff; padding: 36px 0 44px; }
.hero .lead { color: #c9cdea; }

/* ---------- tickets ---------- */
.tickets { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 500px), 1fr)); gap: 18px; }
.tickets--single { grid-template-columns: 1fr; max-width: 820px; }

.ticket {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 232px;
    background: var(--card);
    border-radius: 8px;
    border: 1px solid var(--line);
}
.ticket__main { padding: 18px 20px; min-width: 0; }
.ticket__store { font-weight: 600; font-size: .9rem; text-decoration: none; color: var(--muted); }
.ticket__store:hover { color: var(--cobalt); text-decoration: underline; }
.ticket__title { font-family: var(--font-body); font-weight: 600; font-size: 1.1rem; line-height: 1.35; margin: 4px 0 10px; }
.ticket__meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0; font-size: .85rem; color: var(--muted); }
.ticket__descr { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0 0 10px 0; font-size: .85rem; }
.badge--ok { color: var(--ok); font-weight: 600; }

.ticket__stub {
    position: relative;
    display: flex; flex-direction: column; justify-content: center; gap: 8px;
    padding: 18px 20px;
    border-left: 2px dashed var(--line);
}
/* вырезы перфорации */
.ticket__stub::before, .ticket__stub::after {
    content: ""; position: absolute; left: -11px;
    width: 20px; height: 20px; border-radius: 50%;
    background: var(--paper); border: 1px solid var(--line);
    clip-path: inset(0 0 0 0);
}
.ticket__stub::before { top: -10px; }
.ticket__stub::after  { bottom: -10px; }

.reveal {
    position: relative; display: block; width: 100%; height: 46px; padding: 0;
    border: 2px dashed var(--ink); border-radius: 6px; background: #fff;
    overflow: hidden; cursor: pointer; color: var(--ink);
    font: 600 .95rem var(--font-body); text-decoration: none;
}
.reveal__code {
    position: absolute; inset: 0; display: grid; place-items: center;
    font: 600 1.1rem var(--font-code); letter-spacing: .12em;
}
.reveal__flap {
    position: absolute; inset: 0 auto 0 0; width: calc(100% - 34px);
    display: grid; place-items: center; background: var(--flag);
    transition: transform .28s ease;
}
.reveal:hover .reveal__flap { transform: translateX(-6px); }
.reveal.is-open .reveal__flap { transform: translateX(-102%); }
.reveal.is-open { border-style: solid; }
.reveal--link { display: block; }
.reveal--link .reveal__flap { position: static; width: 100%; height: 100%; }
.reveal--link:hover .reveal__flap { transform: none; background: #ffc400; }

.stub__note { min-height: 1.2em; color: var(--ok); font-size: .8rem; }
.stub__expired { color: var(--muted); font-size: .9rem; }
.ticket.is-expired { opacity: .6; }

/* ---------- stores ---------- */
.store-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.store-tile {
    display: flex; align-items: center; gap: 12px; padding: 14px 16px;
    background: var(--card); border: 1px solid var(--line); border-radius: 8px;
    color: var(--ink); text-decoration: none; font-weight: 600;
}
.store-tile:hover { border-color: var(--cobalt); }
.store-tile__name { overflow-wrap: anywhere; }

.logo {
    flex: none; display: grid; place-items: center; width: 44px; height: 44px; overflow: hidden;
    border-radius: 10px; background: #e5e8fb; color: var(--cobalt); font: 700 1.1rem var(--font-display);
}
.logo img { width: 100%; height: 100%; object-fit: contain; background: #fff; }

.store-head { display: flex; align-items: center; gap: 16px; margin: 14px 0 18px; }
.store-head .logo { width: 64px; height: 64px; border-radius: 14px; font-size: 1.6rem; }
.store-desc { max-width: 70ch; margin: 0 0 14px; }
.crumbs { font-size: .9rem; color: var(--muted); }
.crumbs a { color: var(--muted); }

.chips, .chips-inline { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips a, .chips-inline a {
    display: inline-flex; gap: 8px; align-items: baseline; padding: 7px 14px;
    background: var(--card); border: 1px solid var(--line); border-radius: 999px;
    color: var(--ink); text-decoration: none; font-size: .95rem;
}
.chips a:hover, .chips-inline a:hover { border-color: var(--cobalt); }
.chips a.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }
.chips small { color: var(--muted); }
.chips a.is-active small { color: #c9cdea; }
.chips--filter { margin: 18px 0 24px; }
.chips-inline { margin: 0 0 22px; }

.expired { margin-top: 28px; }
.expired summary { cursor: pointer; font-weight: 600; margin-bottom: 14px; }

.pager { display: flex; align-items: center; justify-content: center; gap: 18px; padding: 28px 0; }

/* ---------- footer ---------- */
.site-footer { margin-top: 56px; padding: 28px 0 40px; background: var(--ink); color: #aeb3d6; font-size: .85rem; }
.site-footer p { margin: 0 0 8px; max-width: 80ch; }

/* ---------- mobile ---------- */
@media (max-width: 640px) {
    .ticket { grid-template-columns: 1fr; }
    .ticket__stub { border-left: 0; border-top: 2px dashed var(--line); }
    .ticket__stub::before, .ticket__stub::after { top: -10px; bottom: auto; }
    .ticket__stub::before { left: -11px; }
    .ticket__stub::after { left: auto; right: -11px; }
    .search { flex-basis: 100%; margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .reveal__flap { transition: none; }
}
