/* Shared look of the viewer and the admin. Neutral by design: to fit a project, change the tokens below. */
@font-face {
  font-family: "Onest";
  src: url("fonts/onest.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root,
html[data-mode="light"] {
  color-scheme: light;
  --page: #f4f4f2;
  --surface: #ffffff;
  --raised: #ffffff;
  --sunken: #ebebe8;
  --ink: #131417;
  --ink-2: #464a52;
  --muted: #6e727a;
  --line: #1314171a;
  --line-strong: #1314172e;
  --primary: #131417;
  --primary-ink: #ffffff;
  --primary-hover: #2c2e33;
  --hover: #13141709;
  --danger: #b42318;
  --success: #1f7a4d;
  --shadow: 0 1px 2px #1314170d, 0 10px 30px #13141712;
  --stage-shadow: 0 2px 4px #13141714, 0 24px 60px #13141724;
  --ambient: .38;
}

html[data-mode="dark"] {
  color-scheme: dark;
  --page: #0b0c0e;
  --surface: #131417;
  --raised: #1a1b1f;
  --sunken: #08090a;
  --ink: #f0f1f3;
  --ink-2: #c3c6cc;
  --muted: #8b9099;
  --line: #ffffff14;
  --line-strong: #ffffff26;
  --primary: #f0f1f3;
  --primary-ink: #0b0c0e;
  --primary-hover: #ffffff;
  --hover: #ffffff0d;
  --danger: #ff8f84;
  --success: #6fd3a0;
  --shadow: 0 1px 2px #0008, 0 16px 40px #000a;
  --stage-shadow: 0 0 0 1px #ffffff0f, 0 30px 80px #000c;
  --ambient: .45;
}

* { box-sizing: border-box; }
html { background: var(--page); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font: 400 15px/1.55 "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 0;
}
h1, h2, h3, p { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* Controls */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px;
  border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--surface); color: var(--ink);
  font-size: 14px; font-weight: 500; line-height: 1; white-space: nowrap;
  cursor: pointer; text-decoration: none;
  transition: background-color .15s, border-color .15s, color .15s;
}
.button:hover:not(:disabled) { background: var(--hover); border-color: var(--line-strong); }
.button svg { width: 18px; height: 18px; flex: none; }
.button-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.button-primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); }
.button-icon { width: 40px; padding: 0; border-color: transparent; background: transparent; color: var(--muted); }
.button-icon:hover:not(:disabled) { color: var(--ink); border-color: transparent; }
.button-quiet { border-color: transparent; background: transparent; color: var(--ink-2); }
.button-quiet:hover:not(:disabled) { color: var(--ink); border-color: transparent; }
.button:disabled { opacity: .45; cursor: default; }

.field {
  display: block; width: 100%; min-height: 40px; padding: 9px 12px;
  border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--page); color: var(--ink);
  font-size: 14px;
}
.field:focus { outline: 2px solid var(--ink); outline-offset: -1px; border-color: transparent; }
.field[readonly] { color: var(--ink-2); }

.check { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--primary); }
.check span { font-variant-numeric: tabular-nums; color: var(--ink); }

/* Viewer page */
.watch { max-width: 1280px; margin: 0 auto; padding: 32px 40px 72px; }
.stage { position: relative; }
/* Ambient light: the poster first, then a tiny live copy of the frame (player.js), both heavily blurred. */
.stage::before, .ambient {
  position: absolute; left: -3%; top: -4%; width: 106%; height: 104%;
  filter: blur(64px) saturate(1.5);
  opacity: 0; pointer-events: none; transition: opacity .5s;
}
.ambient-on .stage::before, .ambient-on .ambient { opacity: var(--ambient); }
.stage::before { content: ""; background: var(--poster, none) center / cover; }
.stage .vp { border-radius: 14px; box-shadow: var(--stage-shadow); }

.details {
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  gap: 0 32px; align-items: start;
  max-width: 1200px; padding: 28px 4px 0;
}
.details h1 {
  font-size: clamp(22px, 2.3vw, 30px); line-height: 1.2; font-weight: 600; letter-spacing: -.02em;
  overflow-wrap: anywhere; text-wrap: balance;
}
.meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.meta:empty, .meta span:empty { display: none; }
.meta span + span::before { content: "·"; margin-right: 14px; }
.details-actions { position: relative; display: flex; gap: 6px; align-items: center; }
.description {
  grid-column: 1 / -1; max-width: 72ch;
  margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--line);
  color: var(--ink-2); font-size: 15px; line-height: 1.7;
  white-space: pre-wrap; overflow-wrap: anywhere;
}

/* Loading: quiet placeholders instead of "Загрузка…" text */
.loading .details h1, .loading .meta {
  min-height: 1.2em; width: min(420px, 70%); border-radius: 8px;
  background: var(--sunken); color: transparent;
}
.loading .meta { width: 90px; min-height: 18px; }
.failed .meta { display: none; }

.share {
  position: absolute; z-index: 5; top: calc(100% + 10px); right: 0; width: min(420px, calc(100vw - 32px));
  padding: 16px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--raised); box-shadow: var(--shadow);
}
.share-title { font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 10px; }
.share-row { display: flex; gap: 8px; margin-bottom: 14px; }
.share-row .field { flex: 1; min-width: 0; text-overflow: ellipsis; }
.share-feedback { min-height: 0; font-size: 13px; color: var(--success); }
.share-feedback:not(:empty) { margin-top: 10px; }

.noscript { padding: 24px 0; color: var(--muted); }

@media (max-width: 720px) {
  .watch { padding: 0 0 48px; }
  .stage .vp { border-radius: 0; box-shadow: none; }
  .stage::before, .ambient, .vp-ambient-toggle { display: none !important; }
  .details { grid-template-columns: 1fr; padding: 20px 16px 0; }
  .details-actions { margin-top: 18px; }
  .details-actions #share-toggle { flex: 1; }
  .share { left: 0; right: 0; width: auto; }
  .description { margin-top: 20px; padding-top: 20px; }
}
.failed #share-toggle { display: none; }

/* Root page: nothing to show without a link */
.home { display: grid; place-content: center; justify-items: center; gap: 10px; min-height: 100vh; padding: 24px; text-align: center; }
.home h1 { font-size: 28px; font-weight: 600; letter-spacing: -.02em; }
.home p { color: var(--muted); }
.home .button { margin-top: 10px; color: var(--muted); }
