/* Публичный вход (/, /catalog, /event/{id}, /afisha): общая база стилей тонких HTML+JS страниц.
   Публичные страницы подключают: css/theme.css (основа стиля) → /pub/pub.css → /afisha/afisha.css (только афиша).
   app.css подключает этот файл первым (@import), чтобы общие классы публичного входа и SPA были одни и те же. */

/* ===== Каркас страницы ===== */
/* Сброс — как в app.css (публичные страницы не грузят app.css) */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
body { margin: 0; }
/* Контейнер — как в app.css (публичные страницы не грузят app.css) */
.container { max-width: 1320px; margin: 0 auto; padding: 0 14px; }
.pub-app { display: flex; flex-direction: column; height: 100vh; }
.pub-app > main { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pub-app > main > .container { min-height: 0; display: flex; flex-direction: column; width: 100%; }
/* Внутри main обычно ДВА .container: первый — hero (поиск), второй — прокручиваемая лента.
   Растягивается только последний, иначе hero занимает половину экрана и оставляет пустоту. */
.pub-app > main > .container:last-child { flex: 1; }
.pub-embed .topbar { display: none; }

/* .page-scroll: система */
.page-scroll {
    flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden;
    padding: 14px 16px 44px; scrollbar-gutter: stable;
}

/* Сетка карточек: размер, отличный от афишного .af-grid */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 12px; }

/* Карточка: каркас и внутренности (оформление — app.css/theme.css, подключены выше) */
.card { overflow: hidden; display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); cursor: pointer; text-decoration: none; color: inherit; transition: .12s; }
.card:hover { border-color: var(--acc); }
.card .title-row { display: flex; gap: 8px; align-items: center; padding: 8px 0 0; }
.card .emo { width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; object-fit: cover; border-radius: 8px; font-size: 17px; background: var(--surface-2); }
.card .info { flex: 1; min-width: 0; }
.card h3 { font-size: 13px; line-height: 1.3; font-weight: 600; margin: 0; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card .meta { font-size: 11px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-body { position: relative; padding: 6px 10px 10px; display: flex; flex-direction: column; flex: 1; }
.card-date { position: relative; overflow: hidden; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--acc-soft); }
.card-date .cd-day { font-size: 26px; font-weight: 700; color: var(--site-date-main, var(--acc)); line-height: 1; min-width: 30px; text-align: center; }
.card-date .cd-grid { flex: 1; min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 8px; align-items: center; }
.card-date .cd-mon { font-size: 12px; font-weight: 700; color: var(--site-date-sub, var(--ink)); }
.card-date .cd-wd { font-size: 11px; color: var(--site-date-sub, var(--muted)); }
.card-date .cd-time { font-size: 12.5px; color: var(--site-date-sub, var(--muted)); white-space: nowrap; justify-self: end; }
.card-date .cd-cat { font-size: 12px; color: var(--site-date-sub, var(--muted)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; justify-self: end; }
.p-tex { position: absolute; inset: 0; background-repeat: repeat-x; background-size: auto 100%; background-position: left center; pointer-events: none; opacity: .75; }
.p-logo { position: absolute; inset: 0; background-repeat: no-repeat; background-size: auto 100%; background-position: center; pointer-events: none; }
.card-date > :not(.p-tex):not(.p-logo), .card-body > :not(.p-tex):not(.p-logo) { position: relative; z-index: 1; }
.card-body .p-tex { opacity: .5; }
.tags { display: flex; gap: 4px; flex-wrap: wrap; }
.tag { padding: 1px 8px; }
.tags-scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; margin-bottom: 4px; }
.tags-scroll::-webkit-scrollbar { display: none; }
.progress .bar { height: 4px; overflow: hidden; }
.progress .fill { height: 100%; }
.progress .lbl { display: flex; justify-content: space-between; margin-top: 3px; }

/* Строка списка */
.row-list { overflow: hidden; }
.row-item { position: relative; display: flex; align-items: center; gap: 10px; padding: 7px 12px; border-bottom: 1px solid #f0f1f7; cursor: pointer; text-decoration: none; color: inherit; }
.row-item:last-child { border-bottom: none; }
.row-item:hover { background: var(--surface-hover); }
.row-item > :not(.p-tex):not(.p-logo) { position: relative; z-index: 1; }
.row-item .d { width: 140px; flex-shrink: 0; white-space: nowrap; }
.row-title { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.row-title b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.org-row { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; margin-top: 2px; }
.org-row span { font-size: 11px; color: var(--muted); }
.row-item .n { flex: 1; min-width: 0; }
.row-item .r { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* Шапка сайта (.topbar) — те же классы и размеры, что у SPA */
.topbar { position: relative; z-index: 50; flex-shrink: 0; }
.topbar .container { display: flex; align-items: center; gap: 12px; height: 46px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 7px; white-space: nowrap; font-weight: 700; font-size: 15px; cursor: pointer; }
.brand .dot { width: 8px; height: 8px; display: inline-block; border-radius: 3px; background: var(--nav-active); }
.topbar .nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; scrollbar-width: thin; scrollbar-color: rgba(0, 0, 0, .18) transparent; padding-bottom: 2px; }
.topbar .nav::-webkit-scrollbar { height: 5px; }
.topbar .nav::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, .18); border-radius: 3px; }
.topbar .nav button { padding: 6px 11px; border-radius: var(--radius-sm); color: var(--hdr-muted); font-weight: 600; font-size: 13px; white-space: nowrap; }
.topbar .nav button:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.topbar .nav button.active { background: var(--nav-active); color: #fff; }
.topbar .role { display: flex; padding: 3px; flex-shrink: 0; background: rgba(255, 255, 255, .08); border-radius: 8px; }
.topbar .role .rl { padding: 4px 9px; border-radius: 6px; font-size: 12px; font-weight: 600; color: var(--hdr-muted); }
.topbar .role .rl:hover { background: var(--card); color: #242a3f; }

/* Шторка — шапка страницы (.hero-search) */
.hero-search { padding: 14px 0 16px; margin: 0 -14px; flex-shrink: 0; }
.hero-search .container { padding-top: 0; padding-bottom: 0; }
.hs-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.hs-title { margin: 0; font-size: 17px; font-weight: 700; color: #fff; }
.hs-sub { font-size: 12px; color: var(--hdr-sub); }
.hs-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.hs-tools > input { flex: 1 1 200px; min-width: 160px; }
.hs-tools input, .hs-tools .btn, .hs-tools .ss-trigger, .hs-tools .drp-trigger { height: 34px; box-sizing: border-box; }

/* Страница события: шапка */
.event-head { position: relative; padding: 16px 18px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(180deg, var(--card), var(--surface-soft)); }
.event-head > :not(.p-tex):not(.p-logo) { position: relative; z-index: 1; }
.event-head .p-logo { opacity: 1; }
.event-head h1 { font-size: 20px; line-height: 1.25; margin: 0; }
.event-head .sub { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; font-size: 12px; color: var(--muted); align-items: center; }
.eh-gutter { display: flex; flex-direction: column; align-items: center; gap: 8px; flex-shrink: 0; min-width: 0; }
.eh-logo-box { width: 56px; height: 56px; overflow: hidden; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.eh-logo { width: 100%; height: 100%; object-fit: cover; object-position: center; display: block; }
.eh-inner { display: flex; gap: 14px; align-items: flex-start; }
.event-layout { display: grid; grid-template-columns: 1fr 300px; gap: 12px; margin-top: 12px; }
.panel { padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel + .panel { margin-top: 10px; }
.panel h2 { font-size: 14px; margin: 0 0 8px; }
.program { list-style: none; margin: 0; padding: 0; }
.program li { display: flex; gap: 10px; padding: 6px 0; border-bottom: 1px dashed #eceef6; font-size: 13px; }
.program li:last-child { border-bottom: none; }
.program .time { min-width: 44px; font-weight: 700; color: var(--acc); font-size: 12px; }
.series-box { padding-left: 10px; border-left: 3px solid var(--acc); }
.material { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.material:last-child { border-bottom: none; }
.material b { flex: 1; font-weight: 600; }
.material span { color: var(--muted); }
.seats { font-size: 13px; color: var(--muted); }
.seats .big { font-size: 22px; color: var(--acc); font-weight: 700; }
.event-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sub-ic { display: none; }
.row-item .past, .card.past { opacity: .55; filter: grayscale(.35); }

/* Кнопки/баннеры/формы: те же классы, что у SPA */
.btn { padding: 8px 14px; white-space: nowrap; border-radius: var(--radius-sm); font-weight: 600; font-size: 13px; transition: .12s; cursor: pointer; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-primary { background: var(--site-btn, var(--acc)); color: var(--site-btn-ink, #fff); }
.btn-light { background: var(--card); border: 1px solid var(--line); color: var(--ink); }
.btn-ghost { background: var(--acc-soft); color: var(--acc); }
.btn-red { background: var(--red-soft); color: var(--red); }
.btn:disabled { opacity: .5; cursor: default; }
.seg { display: inline-flex; padding: 2px; background: #eef0f7; border-radius: var(--radius-sm); }
.seg button { padding: 4px 12px; border-radius: 5px; font-size: 12px; font-weight: 600; color: var(--muted); }
.seg button.on, .seg button.active { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(20, 30, 60, .15); }
.seg-2row { display: inline-grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; min-width: 200px; }
.seg-2row button { font-size: 11px; white-space: nowrap; }
.seg-2row button:first-child { grid-column: 1 / -1; }
.banner-ok { padding: 9px 11px; margin-bottom: 12px; background: var(--green-soft); color: var(--green); border-radius: 8px; font-weight: 600; font-size: 13px; }
.banner-warn { padding: 9px 11px; margin-bottom: 12px; background: var(--amber-soft); color: #8a5b14; border-radius: 8px; font-size: 12px; }
.form-field { margin-bottom: 10px; }
.form-field label { display: block; margin-bottom: 3px; font-size: 11px; font-weight: 700; color: var(--muted); }
.form-field input, .form-field select { width: 100%; padding: 7px 9px; }
.check-row { display: flex; gap: 8px; align-items: center; margin: 8px 0; font-size: 12px; color: var(--ink-soft); }
.st { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.st.ok { background: var(--green-soft); color: var(--green); }
.st.wait { background: var(--amber-soft); color: var(--amber); }
.st.no { background: var(--red-soft); color: var(--red); }
.empty-c { text-align: center; padding: 36px 0; color: var(--muted); font-size: 13px; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); padding: 9px 18px; z-index: 200; pointer-events: none; background: #242a3f; color: #fff; border-radius: 9px; font-size: 13px; font-weight: 600; opacity: 0; transition: .2s; }
.toast.show { opacity: 1; }
.modal-back { position: fixed; inset: 0; display: none; align-items: flex-start; justify-content: center; padding: 36px 12px; z-index: 100; background: rgba(15, 19, 35, .45); }
.modal-back.open { display: flex; }
.modal { max-width: 560px; width: 100%; padding: 18px; max-height: 92vh; overflow: auto; background: var(--card); border-radius: 12px; box-shadow: 0 18px 50px rgba(0, 0, 0, .25); }
.modal h2 { font-size: 17px; margin: 0 0 4px; }
.modal .mhh { color: var(--muted); font-size: 13px; margin-bottom: 12px; }

/* Индикатор перехода между тонкими страницами (pub.js: переход без перезагрузки). */
.pub-progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 300; pointer-events: none;
    background: var(--site-btn, var(--acc)); opacity: 0; transition: width .18s ease, opacity .18s ease; }
.pub-progress.on { opacity: 1; }

/* Контент главной: строки/элементы из api/Home/Content */
.hc-row { margin-bottom: 14px; }
.hc-row-grid { display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); gap: 12px; }
.hc-html { font-size: 13px; line-height: 1.55; }
.hs-tile { display: block; color: inherit; text-decoration: none; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); padding: 14px 16px; cursor: pointer; transition: .12s; }
.hs-tile:hover { border-color: var(--acc); }
.hs-tile-title { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.hs-tile-text { font-size: 12px; color: var(--muted); }
.hs-tile-go { margin-top: 8px; font-size: 12px; font-weight: 600; color: var(--acc); }
.home-html { font-size: 13px; line-height: 1.55; }

/* Комбо публичных страниц (.ss) — тот же вид, что у SPA (.styled-select) */
.ss { position: relative; display: inline-block; }
.ss .ss-trigger { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 110px; max-width: 190px; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); color: var(--ink); font-size: 13px; font-weight: 600; line-height: 1.25; cursor: pointer; }
.ss .ss-trigger:hover { border-color: var(--acc); }
.ss .ss-trigger > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss .ss-arrow { flex-shrink: 0; font-size: 10px; color: var(--muted); }
.ss.open .ss-arrow { transform: rotate(180deg); }
.ss .ss-menu { display: none; position: absolute; top: calc(100% + 4px); left: 0; min-width: 100%; max-width: 320px; z-index: 80; padding: 4px; max-height: 240px; overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: 9px; box-shadow: var(--shadow-menu); }
.ss.open .ss-menu { display: block; }
.ss .ss-opt { display: block; width: 100%; text-align: left; padding: 7px 10px; border-radius: 6px; font-size: 12.5px; font-weight: 600; color: var(--ink); cursor: pointer; }
.ss .ss-opt:hover { background: var(--acc-soft); color: var(--acc); }
.ss .ss-opt.sel { background: var(--acc); color: #fff; }

/* Дропдаун дат (.drp) — раскладка 1:1 с app.css; вид — theme.css */
.drp { position: relative; display: inline-block; align-self: center; }
.drp .drp-trigger { display: flex; align-items: center; gap: 8px; padding: 6px 10px; white-space: nowrap; }
.drp .drp-txt { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.drp .drp-back { display: none; }
.drp.open .drp-back { display: block; position: fixed; inset: 0; z-index: 90; }
.drp .drp-menu { display: none; position: absolute; top: calc(100% + 4px); left: 0; z-index: 100; padding: 10px; width: 256px; }
.drp.open .drp-menu { display: block; }
.drp .drp-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.drp .drp-head b { flex: 1; text-align: center; }
.drp .drp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.drp .drp-dow { text-align: center; padding: 2px 0; }
.drp .drp-day { height: 28px; display: flex; align-items: center; justify-content: center; }

/* Календарь — раскладка 1:1 с app.css; вид — theme.css */
.cal-page { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 14px 0 0; overflow: hidden; }
.cal-layout { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 12px; margin-top: 12px; align-items: stretch; flex: 1; min-height: 0; }
.cal-panel { padding: 10px; display: flex; flex-direction: column; overflow: hidden; }
.cal-panel .cal-grid { flex: 1; min-height: 0; overflow-y: auto; }
.cal-panel h2 { margin-bottom: 8px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-grid-week { grid-template-columns: 34px repeat(7, 1fr); grid-template-rows: auto repeat(6, 1fr); }
.cal-dow { text-align: center; padding: 3px 0; }
.cal-week { display: flex; align-items: center; justify-content: center; }
.cal-day { min-height: 58px; padding: 3px 4px; position: relative; min-width: 0; display: flex; flex-direction: column; }
.cal-day .dn { display: flex; justify-content: space-between; align-items: center; }
.cal-day .evs { margin-top: 3px; display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.cal-ev { padding: 0 4px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; }
.cal-list { max-height: none; overflow-y: auto; min-height: 0; }
.cal-list > * { flex-shrink: 0; }

/* Тултип дня — раскладка из app.css (вид — theme.css) */
.cal-tip-fixed { position: fixed; z-index: 1000; transform: translateX(-50%); padding: 6px 8px; min-width: 230px; max-width: 320px; }
.cal-tip-fixed.below { transform: translateX(-50%); }
.cal-tip-fixed.above { transform: translateX(-50%) translateY(-100%); }
.cal-tip-fixed b { display: block; margin-bottom: 4px; }
.cal-tip-fixed .ct-ev { padding: 3px 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Иконки/подложки компонентов (CatIcon/PartnerIcon/PartnerBackdrop) */
.p-tex-fade { mask-image: linear-gradient(to right, #000 0%, #000 42%, transparent 62%); -webkit-mask-image: linear-gradient(to right, #000 0%, #000 42%, transparent 62%); }
.cat-ic { object-fit: cover; border-radius: 6px; flex-shrink: 0; vertical-align: middle; }
.cat-ic-empty { display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2); line-height: 1; }
.row-item .n b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Адаптив (публичный вход) */
@media (max-width: 1024px) {
    .cal-layout { grid-template-columns: 1fr; min-height: 0; }
    .cal-page { overflow-y: auto; }
    .cal-list { max-height: none; overflow: visible; }
}
@media (max-width: 900px) {
    .event-layout { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
    .hero-search { padding: 10px 0 14px; }
    .topbar .container { flex-wrap: wrap; height: auto; padding: 6px 10px; row-gap: 4px; }
    .topbar .nav { flex: 1 1 100%; order: 3; }
    .topbar .role { margin-left: auto; align-self: center; }
    .hs-head { flex-wrap: nowrap; align-items: baseline; gap: 10px; }
    .hs-tools > input { flex: 1 1 100%; min-width: 0; }
    .event-head .eh-inner { flex-direction: column; align-items: stretch; gap: 10px; }
    .event-head .sub { gap: 8px; }
    .grid-cards { gap: 8px; }
    .row-item { gap: 8px; padding: 7px 9px; }
    .row-item .d { width: 104px; }
    .row-item .org-row .tags { display: none; }
    .sub-ic { display: inline-flex; align-items: center; flex-shrink: 0; }
    .cal-tip-fixed { display: none; }
    .cal-day { min-height: 40px; padding: 2px 3px; }
    .cal-day .dn { font-size: 11px; }
    .cal-dow { font-size: 9px; padding: 1px 0; }
    .cal-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
    .cal-grid-week { grid-template-columns: 24px repeat(7, minmax(0, 1fr)); }
    .cal-ev { font-size: 8.5px; padding: 0 3px; -webkit-line-clamp: 2; }
    .cal-panel { padding: 8px; }
}
