/* ==========================================================================
   Экран киоска: список мероприятий, карточка мероприятия, расписание, слайдер.
   Макет разработан для 1920×1080 (1rem = 16px), на остальных экранах всё
   масштабируется пропорционально — на 4K (3840×2160) 1rem = 32px.
   ========================================================================== */

html {
    /* Альбомный экран: вписываем макет 16:9 в окно */
    font-size: max(11px, min(calc(100vw / 120), calc(100vh / 67.5)));
}
@media (orientation: portrait) {
    /* Книжный экран (например, 2160×3840): масштабируем по ширине */
    html { font-size: max(11px, calc(100vw / 68)); }
}

:root {
    --header-h: 7rem;
    --footer-h: 8.5rem;
    --gutter: 8rem;
}
@media (orientation: portrait) { :root { --gutter: 4rem; } }

body {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;           /* скролл включается скриптом (scroll-enabled) */
    font-size: 1rem;
}
body.scroll-enabled { overflow-x: hidden; overflow-y: auto; }
body.demo-mode,
body.no-scroll { overflow: hidden !important; }

.kiosk-container {
    width: min(100rem, 100% - var(--gutter));
    margin-inline: auto;
}

/* ---------- Шапка ---------- */
.kiosk-header {
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    height: var(--header-h);
    background: var(--green);
    color: #fff;
    z-index: 100;
}
.kiosk-header .kiosk-container {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 3rem;
}
.kiosk-brand { display: flex; align-items: center; gap: 1.6rem; min-width: 0; }
.kiosk-brand .brand-mark { width: 3.2rem; height: 3.2rem; }
.kiosk-brand-name { font-size: 1.45rem; line-height: 1.35; font-weight: 400; }
.kiosk-date { font-size: 1.6rem; white-space: nowrap; }

/* ---------- Основная область ---------- */
.main-content {
    flex: 1 0 auto;
    width: 100%;
    margin-top: var(--header-h);
    padding: 3.4rem 0 calc(var(--footer-h) + 2.6rem);
    transition: var(--transition);
    -webkit-overflow-scrolling: touch;
}
.demo-mode .main-content {
    opacity: .3;
    filter: blur(2px);
    pointer-events: none;
}

.page-title { font-size: 3.9rem; letter-spacing: -.005em; }
.page-subtitle { margin-top: .9rem; font-size: 1.65rem; color: var(--ink-soft); }
.page-head {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 2rem; flex-wrap: wrap; margin-bottom: 2.2rem;
}

/* ---------- Подвал с навигацией ---------- */
.kiosk-footer {
    position: fixed;
    bottom: 0; left: 0;
    width: 100%;
    height: var(--footer-h);
    background: var(--green);
    z-index: 99;
}
.footer-inner { position: relative; height: 100%; display: flex; align-items: center; justify-content: center; }
.footer-nav { display: flex; align-items: center; justify-content: center; gap: 1.1rem; }
.footer-timer {
    position: absolute; right: 0; top: 50%; transform: translateY(-50%);
    display: flex; align-items: center; gap: 1.1rem;
    color: #fff; font-size: 1.5rem; white-space: nowrap;
}
.timer-ring { width: 3.5rem; height: 3.5rem; transform: rotate(-90deg); flex: none; }
.timer-ring-bg { fill: none; stroke: rgba(242,194,48,.28); stroke-width: 2.6; }
.timer-ring-fg { fill: none; stroke: var(--yellow); stroke-width: 2.6; stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
@media (orientation: portrait) {
    :root { --footer-h: 11.5rem; }
    .footer-inner { flex-direction: column; gap: 1rem; }
    .footer-timer { position: static; transform: none; font-size: 1.3rem; }
}

.nav-pill {
    min-width: 19rem;
    height: 4.9rem;
    padding: 0 2.6rem;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 999px;
    border: .12rem solid rgba(255,255,255,.5);
    background: transparent;
    color: #fff;
    font: 700 1.8rem/1 var(--font-sans);
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.nav-pill:active { transform: scale(.97); }
.nav-pill.is-active {
    background: var(--yellow);
    border-color: var(--yellow);
    color: var(--green);
}

/* ---------- Кнопки ---------- */
.details-button,
.back-pill,
.back-button {
    font-family: var(--font-sans);
    font-weight: 700;
    border-radius: 999px;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.details-button {
    display: inline-flex; align-items: center; justify-content: center;
    height: 4.2rem;
    padding: 0 2.4rem;
    border: 0;
    background: var(--green);
    color: #fff;
    font-size: 1.5rem;
    white-space: nowrap;
}
.details-button:active { transform: scale(.96); background: var(--green-hover); }

.back-pill,
.back-button {
    display: inline-flex; align-items: center; justify-content: center;
    padding: .95rem 2.2rem;
    border: .12rem solid var(--green);
    background: transparent;
    color: var(--green);
    font-size: 1.6rem;
    line-height: 1.2;
}
.back-pill:active,
.back-button:active { background: var(--mint); transform: scale(.97); }

/* ---------- Список мероприятий ---------- */
.events-list { margin-top: 2.4rem; display: flex; flex-direction: column; gap: 1.6rem; }

.event-row {
    display: grid;
    grid-template-columns: 10.4rem minmax(0, 1fr) auto;
    align-items: stretch;
    min-height: 8.4rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 1.3rem;
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
}
.event-row:active { background: #f8faf6; }

.event-date {
    background: var(--mint);
    color: var(--green);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: .8rem;
}
.event-day { font-family: var(--font-serif); font-weight: 700; font-size: 3.6rem; line-height: 1; }
.event-month { margin-top: .35rem; font-size: 1.45rem; letter-spacing: .14em; text-transform: uppercase; }

.event-body { padding: 1.4rem 2.6rem; display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.event-title { font-family: var(--font-serif); font-weight: 700; font-size: 2.3rem; line-height: 1.2; color: var(--ink); }
.event-meta { margin-top: .5rem; font-size: 1.6rem; color: var(--ink-soft); }

.event-action { display: flex; align-items: center; padding: 0 2.1rem; }

.no-events {
    margin-top: 2.4rem;
    padding: 4rem 3rem;
    text-align: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 1.3rem;
}
.no-events h3 { font-size: 2.4rem; margin-bottom: .8rem; }
.no-events p { font-size: 1.6rem; color: var(--ink-soft); }

/* ---------- Страница мероприятия ---------- */
.event-page .back-pill { margin-bottom: 2.1rem; }

.event-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 3rem; align-items: stretch; }
.event-layout.has-media { grid-template-columns: minmax(0, 1.77fr) minmax(0, 1fr); }

.event-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 1.8rem;
    padding: 3.2rem 3.2rem 3.4rem;
}
.event-card-title { font-size: 4rem; line-height: 1.17; letter-spacing: -.005em; }

.facts {
    margin: 2.2rem 0 2.2rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    gap: 1rem;
}
.fact { background: var(--mint); border-radius: 1.3rem; padding: 1.5rem 1.6rem 1.7rem; min-width: 0; }
.fact-label { font-size: 1.3rem; letter-spacing: .14em; text-transform: uppercase; color: var(--green); }
.fact-value { margin-top: .55rem; font-size: 2.1rem; line-height: 1.3; font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }

.event-text { font-size: 1.85rem; line-height: 1.65; color: var(--ink); }
.event-text.is-empty { color: var(--ink-soft); }

.event-media {
    position: relative;
    min-height: 28rem;
    border-radius: 1.8rem;
    overflow: hidden;
    background: #e9ede6;
}
.event-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

@media (orientation: portrait) {
    .event-layout.has-media { grid-template-columns: minmax(0, 1fr); }
    .event-media { min-height: 0; aspect-ratio: 4 / 3; }
    .event-card-title { font-size: 3.4rem; }
    .facts { grid-template-columns: minmax(0, 1fr); }
    .event-row { grid-template-columns: 8rem minmax(0, 1fr) auto; }
    .event-title { font-size: 2rem; }
}

/* ---------- Расписание ---------- */
.schedule-page .main-content { padding-top: 2.8rem; }

.schedule-page .page-head { align-items: center; margin-bottom: 2.1rem; }
.search-form { display: flex; gap: 1.1rem; align-items: center; }
.search-field { position: relative; display: block; }
.search-icon { position: absolute; left: 1.5rem; top: 50%; transform: translateY(-50%); width: 1.9rem; height: 1.9rem; color: var(--ink); pointer-events: none; }
.search-input {
    width: 31rem; height: 4.1rem; padding: 0 1.6rem 0 4.4rem;
    border: .1rem solid var(--line-strong); border-radius: 999px;
    background: var(--surface); color: var(--ink);
    font: 400 1.55rem var(--font-sans);
}
.search-input::placeholder { color: #6f7b73; }
.search-input:focus { outline: .2rem solid var(--yellow); outline-offset: .1rem; border-color: var(--green); }
.search-input:disabled { opacity: .5; }
.search-button {
    height: 4.1rem; padding: 0 2.4rem;
    border: 0; border-radius: 999px;
    background: var(--green); color: #fff;
    font: 700 1.55rem var(--font-sans);
    cursor: pointer;
}
.search-button:active { transform: scale(.97); }
.search-button:disabled { opacity: .5; }

.section-title { font-size: 2.3rem; margin-bottom: 1.5rem; }

.btn-icon, .chip-icon { width: 1.8rem; height: 1.8rem; flex: none; }

/* Недели (карточки) */
.weeks-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(32rem, 36rem)); gap: 1.5rem; margin-bottom: 2.1rem; }
.week-card {
    display: flex; align-items: stretch; min-height: 8.5rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 1.3rem;
    overflow: hidden;
    color: inherit; text-decoration: none;
    transition: var(--transition);
}
.week-card:active { background: #f8faf6; transform: scale(.99); }
.week-icon { flex: none; width: 8.5rem; display: flex; align-items: center; justify-content: center; background: var(--mint); color: var(--green); }
.week-icon svg { width: 2.9rem; height: 2.9rem; }
.week-body { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: .55rem; padding: 1rem 1.2rem 1rem 2rem; }
.week-title { font-family: var(--font-serif); font-weight: 700; font-size: 2.3rem; line-height: 1.15; color: var(--ink); }
.week-badge { padding: .25rem 1rem; border-radius: 999px; font-size: 1.3rem; font-weight: 700; background: #ececea; color: #4a544d; }
.week-badge.is-now { background: var(--mint); color: var(--green); }
.week-go { flex: none; align-self: center; margin-right: 1.1rem; width: 3.5rem; height: 3.5rem; border-radius: 50%; background: var(--green); color: #fff; display: flex; align-items: center; justify-content: center; }
.week-go svg { width: 1.7rem; height: 1.7rem; }

/* Пустое состояние */
.empty-state {
    display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
    min-height: 25rem; padding: 3rem 2rem;
    border-radius: 1.8rem;
    background: var(--surface); border: 1px solid var(--line);
}
.empty-state.is-dashed { background: transparent; border: .15rem dashed #c3cac4; }
.empty-icon { width: 5.5rem; height: 5.5rem; border-radius: 50%; background: var(--mint); color: var(--green); display: flex; align-items: center; justify-content: center; margin-bottom: 1.4rem; }
.empty-icon svg { width: 2.4rem; height: 2.4rem; }
.empty-state h3 { font-size: 2.2rem; margin-bottom: .9rem; }
.empty-state p { font-size: 1.55rem; color: var(--ink-soft); max-width: 60rem; }
.empty-state .back-button { margin-top: 1.8rem; }

/* Выбор недели (чипы) */
.week-bar {
    display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap;
    padding: .8rem 1.1rem .8rem 2rem; margin-bottom: 2.3rem;
    background: var(--surface); border: 1px solid var(--line); border-radius: 1.5rem;
}
.week-bar-label { font-size: 1.6rem; color: var(--ink-soft); }
.week-chips { display: flex; gap: .9rem; flex-wrap: wrap; flex: 1; }
.week-chip, .reset-chip {
    display: inline-flex; align-items: center; gap: .7rem;
    height: 3.2rem; padding: 0 1.6rem;
    border-radius: 999px; border: .1rem solid var(--line-strong);
    background: transparent; color: var(--green);
    font: 700 1.6rem var(--font-sans); text-decoration: none; white-space: nowrap;
    transition: var(--transition);
}
.week-chip:active, .reset-chip:active { background: var(--mint); }
.week-chip.is-selected { background: var(--green); border-color: var(--green); color: #fff; }
.reset-chip { height: 3.4rem; border-color: var(--green); }

/* Группы на неделю */
.groups-header { display: flex; justify-content: space-between; align-items: baseline; gap: 2rem; flex-wrap: wrap; margin-bottom: 1.3rem; }
.groups-title { display: flex; align-items: baseline; gap: 1.5rem; flex-wrap: wrap; }
.groups-title h2 { font-size: 2.3rem; }
.groups-sub { font-size: 1.6rem; color: var(--ink-soft); }
.legend { display: flex; gap: 2.2rem; font-size: 1.45rem; color: var(--ink-soft); }
.legend-item { display: inline-flex; align-items: center; gap: .7rem; }
.dot { width: 1.1rem; height: 1.1rem; border-radius: 50%; display: inline-block; }
.dot-on { background: var(--green); }
.dot-off { border: .15rem solid #8b958e; }

.groups-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.3rem; }
@media (orientation: portrait) { .groups-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.group-card {
    display: flex; flex-direction: column; gap: .8rem;
    min-height: 9.2rem; padding: 1.3rem 1.5rem 1.5rem;
    border-radius: 1.3rem;
    color: inherit; text-decoration: none;
    transition: var(--transition);
}
.group-card.has-schedule { background: var(--surface); border: .2rem solid var(--green); cursor: pointer; }
.group-card.has-schedule:active { background: var(--mint); transform: scale(.985); }
.group-card.no-schedule { background: #fafbf8; border: .1rem solid var(--line); }
.group-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.group-icon { width: 2.1rem; height: 2.1rem; color: var(--green); }
.no-schedule .group-icon { color: #7d8981; }
.group-badge { padding: .25rem 1.1rem; border-radius: 999px; font-size: 1.3rem; font-weight: 700; background: var(--mint); color: var(--green); }
.no-schedule .group-badge { background: #ececea; color: #4f5a53; }
.group-name { font-family: var(--font-serif); font-weight: 700; font-size: 1.7rem; line-height: 1.28; color: var(--ink); }
.no-schedule .group-name { color: #68736c; }

/* Подсказка о прокрутке */
.scroll-fade {
    position: fixed; left: 0; right: 0; bottom: var(--footer-h); height: 10rem; z-index: 90;
    background: linear-gradient(to bottom, rgba(244,245,241,0), var(--bg) 85%);
    pointer-events: none;
}
.scroll-hint {
    position: fixed; left: 50%; bottom: calc(var(--footer-h) + 1.1rem); transform: translateX(-50%); z-index: 91;
    display: inline-flex; align-items: center; gap: .9rem;
    height: 3.9rem; padding: 0 2rem;
    background: var(--surface); color: var(--green);
    border: .12rem solid var(--green); border-radius: 999px;
    font: 700 1.55rem var(--font-sans); white-space: nowrap; cursor: pointer;
}
.scroll-hint[hidden], .scroll-fade[hidden] { display: none; }

/* Страница расписания группы (PDF) */
.back-button .btn-icon { transform: scaleX(-1); margin-right: .5rem; }
.pdf-container { background: var(--surface); border: 1px solid var(--line); border-radius: 1.8rem; padding: 2.2rem 2.6rem 2.6rem; }
.pdf-header {
    display: flex; justify-content: space-between; align-items: center; gap: 1.5rem; flex-wrap: wrap;
    padding-bottom: 1.6rem; margin-bottom: 1.8rem; border-bottom: 1px solid var(--line);
}
.pdf-title { font-size: 2.6rem; }
.pdf-info { display: flex; flex-direction: column; gap: .3rem; margin-top: .6rem; color: var(--ink-soft); font-size: 1.5rem; }
.pdf-viewer {
    display: block; width: 100%;
    height: calc(100vh - var(--header-h) - var(--footer-h) - 24rem);
    min-height: 40rem;
    border: 1px solid var(--line); border-radius: 1.2rem;
}
.loading-indicator { text-align: center; padding: 3rem; }
.spinner {
    width: 3.6rem; height: 3.6rem; margin: 0 auto 1.2rem;
    border: .4rem solid var(--mint); border-top-color: var(--green); border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.error-message { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger-line); padding: 2rem; border-radius: 1.2rem; text-align: center; margin: 1.5rem 0; }
.refresh-button { margin-top: 1.2rem; padding: .8rem 1.8rem; border: 0; border-radius: 999px; background: var(--green); color: #fff; font: 700 1.4rem var(--font-sans); cursor: pointer; }

/* ---------- Слайдер демо-режима ---------- */
.slider-mode {
    position: fixed; inset: 0;
    background: var(--green);
    display: none;
    justify-content: center; align-items: center;
    z-index: 1000;
    animation: fadeIn .5s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.slider-container { width: 100%; height: 100%; background: #fff; position: relative; overflow: hidden; }
.slider-slide {
    position: absolute; inset: 0;
    display: none; justify-content: center; align-items: center; text-align: center;
    opacity: 0;
    transition: opacity .8s ease-in-out, transform .8s ease-in-out;
}
.slider-slide.active { display: flex; opacity: 1; z-index: 1; }
.slider-slide.leaving { animation: slideOutLeft .8s ease-in-out forwards; }
.slider-slide.entering { animation: slideInRight .8s ease-in-out forwards; }
@keyframes slideInRight  { from { opacity: 0; transform: translateX(100%); }  to { opacity: 1; transform: translateX(0); } }
@keyframes slideOutLeft  { from { opacity: 1; transform: translateX(0); }     to { opacity: 0; transform: translateX(-100%); } }
@keyframes slideInLeft   { from { opacity: 0; transform: translateX(-100%); } to { opacity: 1; transform: translateX(0); } }
@keyframes slideOutRight { from { opacity: 1; transform: translateX(0); }     to { opacity: 0; transform: translateX(100%); } }

.slide-content { width: 100%; height: 100%; position: relative; display: flex; justify-content: center; align-items: center; overflow: hidden; background: #000; }
.image-container { position: relative; width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; }
.slide-image { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.slide-overlay {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
    padding: 3rem 4rem;
    background: linear-gradient(to top, rgba(0,0,0,.72), transparent);
    color: #fff; text-align: left;
}
.slide-title { font-family: var(--font-serif); font-size: 3.4rem; color: #fff; margin-bottom: 1rem; text-shadow: 0 .1rem .4rem rgba(0,0,0,.5); }
.slide-description { font-size: 1.9rem; max-width: 70%; line-height: 1.5; text-shadow: 0 .1rem .3rem rgba(0,0,0,.5); }
@media (orientation: portrait) { .slide-description { max-width: 100%; } }

.slide-image:not([src]),
.slide-image[src=""],
.slide-image[src*="svg"] { background: linear-gradient(135deg, var(--green), #146a3a); }

/* Анимация загрузки изображений */
.loading { position: relative; overflow: hidden; }
.loading::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.4), transparent);
    animation: loading 1.5s infinite;
}
@keyframes loading { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
