/* Кинозал. Графитовый зал, светлый «экран» и один акцент: холодный синий
   луч проектора. Тема одна (тёмная): это кинозал, свет в нём гасят.
   Скругления: кнопки — пилюли, панели 14px, кадры 8px. */
:root {
  --hall: #0c0d10;
  --night: #060709;
  --aisle: #15171c;
  --aisle-2: #1e2128;
  --line: #2a2e37;
  --velvet: #3f5bf2;
  --velvet-hi: #5470ff;
  --velvet-deep: #1e2128;
  --brass: #8ea0ff;
  --screen: #ecebe6;
  --dim: #9a9da6;
  --faint: #7a7e88;
  --danger: #ff8a7a;

  --display: 'Unbounded', 'Golos Text', system-ui, sans-serif;
  --text: 'Golos Text', system-ui, sans-serif;

  --step--1: 0.833rem;
  --step-0: 1rem;
  --step-1: 1.2rem;
  --step-2: 1.44rem;
  --step-3: 1.728rem;
  --step-4: clamp(2.2rem, 4vw + 1rem, 3.4rem);

  --radius: 10px;
  --gutter: clamp(16px, 4vw, 48px);
  --ease-out: cubic-bezier(0.2, 0.8, 0.3, 1);
  color-scheme: dark;
  accent-color: var(--brass);
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--hall);
  color: var(--screen);
  font: 400 var(--step-0) / 1.5 var(--text);
  -webkit-font-smoothing: antialiased;
}

/* Плёночное зерно для каталога и входа (не над видео — там оно мешало бы) */
.grain::after {
  content: '';
  position: fixed;
  inset: -50%;
  z-index: 100;
  pointer-events: none;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0;
  text-wrap: balance;
}

h1 {
  font-size: var(--step-4);
  font-weight: 700;
  letter-spacing: -0.035em;
}

h2 {
  font-size: var(--step-1);
}

.icon {
  display: block;
  width: 24px;
  height: 24px;
  background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}

p {
  margin: 0;
  text-wrap: pretty;
}

a {
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.muted {
  color: var(--dim);
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ——— Кнопки и поля ——— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  min-height: 44px;
  padding: 0.55em 1.25em;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--velvet);
  color: var(--screen);
  font: 500 var(--step-0) / 1.2 var(--text);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, transform 0.1s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.btn:hover {
  background: var(--velvet-hi);
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.5;
  cursor: default;
  transform: none;
}

.btn-quiet {
  background: transparent;
  border-color: var(--line);
}

.btn-quiet:hover {
  background: var(--aisle-2);
}

.btn-small {
  min-height: 36px;
  padding: 0.35em 0.95em;
  font-size: var(--step--1);
}

.btn-large {
  min-height: 54px;
  padding: 0.7em 1.8em;
  font-size: var(--step-1);
}

.btn-danger:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: transparent;
}

label {
  display: grid;
  gap: 6px;
  font-size: var(--step--1);
  color: var(--dim);
}

input[type='text'],
input[type='password'],
input[type='url'],
textarea {
  width: 100%;
  min-height: 44px;
  padding: 0.6em 0.9em;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--hall);
  color: var(--screen);
  font: 400 1rem / 1.4 var(--text); /* 16px — iOS не зумит поле */
}

input::placeholder {
  color: var(--faint);
}

input:focus-visible {
  outline: none;
  border-color: var(--brass);
  box-shadow: 0 0 0 1px var(--brass);
}

.form-error {
  color: var(--danger);
  font-size: var(--step--1);
  min-height: 1.5em;
}

/* ——— Шапка ——— */
.topbar {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px var(--gutter);
}

.topbar-over {
  position: absolute;
  inset: 0 0 auto;
  background: linear-gradient(to bottom, rgb(6 7 9 / 0.7), transparent);
}

.wordmark {
  font-family: var(--display);
  font-weight: 700;
  font-size: var(--step-0);
  letter-spacing: -0.02em;
  text-decoration: none;
  white-space: nowrap;
}

.topnav {
  display: flex;
  align-items: center;
  gap: clamp(12px, 3vw, 28px);
  font-size: var(--step--1);
}

.topnav a {
  color: var(--dim);
  text-decoration: none;
}

.topnav a:hover {
  color: var(--screen);
}

.whoami {
  color: var(--screen);
}

main.page {
  width: min(1320px, 100%);
  margin: 0 auto;
  padding: clamp(28px, 6vw, 64px) var(--gutter) 96px;
}

.page-head {
  display: grid;
  gap: 12px;
  margin-bottom: clamp(28px, 5vw, 48px);
  max-width: 60ch;
}

.page-head p {
  color: var(--dim);
  font-size: var(--step-1);
}

.section-title {
  margin-bottom: 20px;
}

/* ——— Вход: луч проектора и ряды кресел ——— */
.login {
  position: relative;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px 140px;
  overflow: hidden;
  background: var(--night);
}

.login::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    conic-gradient(from 165deg at 50% -8%, transparent 0deg, rgb(142 160 255 / 0.16) 12deg, rgb(142 160 255 / 0.05) 24deg, transparent 30deg),
    radial-gradient(ellipse 60% 40% at 50% 38%, rgb(238 233 221 / 0.07), transparent 70%);
  animation: projector 1.6s var(--ease-out) both;
  pointer-events: none;
}

@keyframes projector {
  from {
    opacity: 0;
  }
}

/* Силуэты кресел внизу */
.login::after {
  content: '';
  position: absolute;
  inset: auto 0 0;
  height: 120px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='60'%3E%3Crect x='10' y='6' width='44' height='34' rx='14' fill='%232a2e37'/%3E%3Crect x='4' y='34' width='56' height='16' rx='6' fill='%231e2128'/%3E%3C/svg%3E") 0 100% / 64px 60px repeat-x,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='60'%3E%3Crect x='10' y='6' width='44' height='34' rx='14' fill='%2316181d'/%3E%3Crect x='4' y='34' width='56' height='16' rx='6' fill='%23101216'/%3E%3C/svg%3E") 32px 30px / 64px 60px repeat-x;
  pointer-events: none;
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(380px, 100%);
  display: grid;
  gap: 18px;
}

.login-card h1 {
  font-size: clamp(2.4rem, 11vw, 3.6rem);
  text-align: center;
  text-shadow: 0 0 40px rgb(238 233 221 / 0.25);
}

.login-card > p {
  text-align: center;
  color: var(--dim);
  margin-top: -10px;
  margin-bottom: 10px;
}

.login-card .btn {
  width: 100%;
  margin-top: 4px;
}

.login-card input {
  background: rgb(12 13 16 / 0.8);
}

.admin-login summary {
  width: fit-content;
  color: var(--faint);
  font-size: var(--step--1);
  cursor: pointer;
}

.admin-login summary:hover {
  color: var(--dim);
}

.admin-login[open] summary {
  margin-bottom: 12px;
}

/* ——— Каталог: афиша ——— */
.hero {
  position: relative;
  min-height: min(82vh, 760px);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  isolation: isolate;
  background: var(--night);
}

.hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -2;
  filter: brightness(0.62) saturate(0.95);
  animation: slow-zoom 24s ease-out both;
}

@keyframes slow-zoom {
  from {
    transform: scale(1.08);
  }
}

.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(to top, var(--hall) 0%, rgb(12 13 16 / 0.6) 30%, transparent 60%),
    linear-gradient(to right, rgb(6 7 9 / 0.85) 0%, rgb(6 7 9 / 0.35) 45%, transparent 75%);
}

.hero-body {
  width: min(1320px, 100%);
  margin: 0 auto;
  padding: 120px var(--gutter) clamp(40px, 7vw, 80px);
  display: grid;
  justify-items: start;
  gap: 14px;
}

.hero-kicker {
  color: var(--brass);
  font-size: var(--step-0);
  font-weight: 500;
}

.hero h1 {
  font-size: clamp(2.2rem, 5.6vw, 5rem);
  line-height: 1.04;
  max-width: 13ch;
  text-shadow: 0 4px 40px rgb(0 0 0 / 0.5);
}

.hero-meta {
  color: var(--dim);
  font-size: var(--step-1);
}

.hero .btn {
  margin-top: 14px;
}

.catalog-empty {
  padding-top: clamp(100px, 18vw, 180px);
}

.now-showing {
  margin-bottom: clamp(40px, 6vw, 64px);
}

.tickets {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

/* Билет: корешок отделён перфорацией, по бокам вырезы */
.ticket {
  display: flex;
  align-items: stretch;
  min-width: min(100%, 420px);
  max-width: 100%;
  background: var(--screen);
  color: #0c0d10;
  border-radius: 8px;
  text-decoration: none;
  -webkit-mask: radial-gradient(circle 9px at 0 50%, transparent 98%, #000) left / 51% 100% no-repeat,
    radial-gradient(circle 9px at 100% 50%, transparent 98%, #000) right / 51% 100% no-repeat;
  mask: radial-gradient(circle 9px at 0 50%, transparent 98%, #000) left / 51% 100% no-repeat,
    radial-gradient(circle 9px at 100% 50%, transparent 98%, #000) right / 51% 100% no-repeat;
  transition: transform 0.15s;
}

.ticket:hover {
  transform: translateY(-2px);
}

.ticket-main {
  flex: 1;
  min-width: 0;
  padding: 14px 18px 14px 24px;
}

.ticket-title {
  font-family: var(--display);
  font-size: var(--step-1);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* На телефоне название зала переносится, а не обрезается до «Фильм ещ…» */
@media (max-width: 600px) {
  .ticket-title {
    font-size: var(--step-0);
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .ticket-stub {
    padding: 0 14px;
  }
}

.ticket-who {
  font-size: var(--step--1);
  opacity: 0.8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ticket-stub {
  display: grid;
  place-items: center;
  padding: 0 22px 0 18px;
  border-left: 2px dashed rgb(12 13 16 / 0.3);
  font-weight: 600;
  font-size: var(--step--1);
  white-space: nowrap;
}

.films {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: clamp(32px, 4vw, 48px) clamp(16px, 2.5vw, 28px);
}

.film {
  display: grid;
  gap: 14px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.film:focus-visible {
  outline: none;
}

.film-still {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  overflow: hidden;
  background: var(--aisle);
  box-shadow: 0 18px 40px -24px rgb(0 0 0 / 0.8);
}

.film-still img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s var(--ease-out), filter 0.3s;
  filter: saturate(0.85) brightness(0.85);
}

/* Свет экрана «включается» на карточке под курсором */
.film-still::after {
  content: '';
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 1px rgb(238 233 221 / 0.08);
  border-radius: inherit;
  pointer-events: none;
}

.film-still-empty {
  display: grid;
  place-items: center;
  height: 100%;
  font-family: var(--display);
  font-size: 3rem;
  color: var(--line);
}

.film-play {
  position: absolute;
  inset: auto 12px 12px auto;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}

.film:hover .film-still img,
.film:focus-visible .film-still img {
  transform: scale(1.04);
  filter: none;
}

.film:hover .film-play,
.film:focus-visible .film-play {
  opacity: 1;
  transform: none;
}

.film:focus-visible .film-still {
  outline: 2px solid var(--brass);
  outline-offset: 3px;
}

.film-title {
  font-family: var(--display);
  font-size: var(--step-2);
  line-height: 1.15;
}

.film-meta {
  color: var(--dim);
  font-size: var(--step--1);
  margin-top: 4px;
}

.empty {
  max-width: 46ch;
  padding: 24px 0;
  color: var(--dim);
  font-size: var(--step-1);
}

.empty a {
  color: var(--brass);
}

@media (hover: none) {
  .film-play {
    opacity: 1;
    transform: none;
  }
}

/* ——— Загрузка (админ) ——— */
.intake {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: 20px;
  margin-bottom: clamp(40px, 6vw, 64px);
}

.panel {
  display: grid;
  align-content: start;
  gap: 16px;
  padding: clamp(18px, 3vw, 28px);
  border-radius: 14px;
  background: var(--aisle);
}

.panel p {
  color: var(--dim);
  font-size: var(--step--1);
}

.dropzone {
  position: relative;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  min-height: 150px;
  padding: 20px;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  text-align: center;
  color: var(--dim);
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}

.dropzone strong {
  color: var(--screen);
  font-weight: 500;
  font-size: var(--step-0);
}

.dropzone:hover,
.dropzone.is-over,
.dropzone:focus-within {
  border-color: var(--brass);
  background: rgb(142 160 255 / 0.05);
}

.dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.notice {
  padding: 10px 14px;
  border-left: 3px solid var(--brass);
  background: rgb(142 160 255 / 0.08);
  color: var(--screen) !important;
}

.library h2 {
  margin-bottom: 8px;
}

.rows {
  list-style: none;
  margin: 0;
  padding: 0;
}

.row {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.row-thumb {
  aspect-ratio: 16 / 9;
  border-radius: 4px;
  overflow: hidden;
  background: var(--aisle);
}

.row-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.row-title {
  font-weight: 500;
  overflow-wrap: anywhere;
}

.row-status {
  font-size: var(--step--1);
  color: var(--dim);
  overflow-wrap: anywhere;
}

.row-status.is-error {
  color: var(--danger);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.bar {
  height: 4px;
  margin-top: 8px;
  border-radius: 2px;
  background: var(--aisle-2);
  overflow: hidden;
}

.bar > i {
  display: block;
  height: 100%;
  width: calc(var(--p, 0) * 100%);
  background: var(--brass);
  transition: width 0.4s;
}

@media (max-width: 640px) {
  .row {
    grid-template-columns: 80px minmax(0, 1fr);
  }

  .row-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

/* Диалоги */
dialog {
  width: min(480px, calc(100% - 32px));
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--aisle);
  color: var(--screen);
}

dialog::backdrop {
  background: rgb(6 7 9 / 0.75);
}

dialog h2 {
  margin-bottom: 16px;
}

.dialog-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

/* Всплывающее уведомление */
.toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  translate: -50% 0;
  z-index: 200;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--screen);
  color: var(--hall);
  font-weight: 500;
  font-size: var(--step--1);
  box-shadow: 0 10px 30px rgb(0 0 0 / 0.35);
  animation: toast-in 0.25s ease-out;
}

@keyframes toast-in {
  from {
    opacity: 0;
    translate: -50% 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ——— Каталог: асимметричная сетка. Первый фильм крупнее, остальные в ряд ——— */
.film-title {
  font-size: var(--step-0);
  font-weight: 500;
  letter-spacing: -0.01em;
}

@media (min-width: 900px) {
  .films {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .films .film:first-child {
    grid-column: span 2;
    grid-row: span 2;
  }

  .films .film:first-child .film-still {
    aspect-ratio: auto;
    flex: 1;
    min-height: 360px;
  }

  .films .film:first-child {
    display: flex;
    flex-direction: column;
  }

  .films .film:first-child .film-title {
    font-size: var(--step-2);
  }
}

/* ——— Движение: одна сцена на загрузке и проявление карточек при прокрутке ——— */
@media (prefers-reduced-motion: no-preference) {
  .hero-body > * {
    animation: rise 0.9s var(--ease-out) both;
  }

  .hero-body > :nth-child(2) { animation-delay: 0.08s; }
  .hero-body > :nth-child(3) { animation-delay: 0.16s; }
  .hero-body > :nth-child(4) { animation-delay: 0.24s; }

  @supports (animation-timeline: view()) {
    .film {
      animation: rise linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 40%;
    }
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
}

@media (prefers-reduced-transparency: reduce) {
  .bubble,
  .menu,
  .screen-notice,
  .quick-chat input {
    background: var(--aisle) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
}
/* Пак стикеров в админке */
.sticker-thumb {
  display: grid;
  place-items: center;
  font-size: 2rem;
}
