/* Dobri filmi. Slate-teal hall, warm projector-light text, amber only for progress and the main action. */
:root {
  --hall: #142226;
  --hall-2: #1c3036;
  --hall-3: #243c43;
  --line: #2c4349;
  --light: #f3ebdd;
  --dim: #9fb2b0;
  --amber: #f0a93b;
  --amber-ink: #241703;
  --danger: #e66a5c;
  --ok: #8cc7a1;
  --display: 'Big Shoulders Display', 'Arial Narrow', sans-serif;
  --text: 'Atkinson Hyperlegible Next', 'Atkinson Hyperlegible', system-ui, sans-serif;
  --pad: clamp(16px, 4vw, 56px);
  --radius: 6px;
  color-scheme: dark;
}

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

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

body {
  margin: 0;
  background: var(--hall);
  color: var(--light);
  font: 400 1.125rem/1.55 var(--text);
  min-height: 100vh;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

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

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 14px var(--pad);
  border-bottom: 1px solid var(--line);
}

.brand {
  font: 800 1.9rem/1 var(--display);
  text-decoration: none;
  letter-spacing: 0.01em;
}

.nav {
  display: flex;
  gap: 22px;
  flex: 1;
}

.nav a {
  color: var(--dim);
  text-decoration: none;
  padding: 6px 0;
  border-bottom: 2px solid transparent;
}

.nav a:hover {
  color: var(--light);
}

.nav a[aria-current='page'] {
  color: var(--light);
  border-bottom-color: var(--light);
}

.who {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  color: var(--dim);
  font-size: 0.95rem;
}

.who img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

.link-button {
  background: none;
  border: 0;
  padding: 0;
  color: var(--light);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

main {
  padding: 0 var(--pad) 96px;
}

/* ---------- Buttons, fields ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: transparent;
  color: var(--light);
  font: 600 1rem/1.2 var(--text);
  text-decoration: none;
  cursor: pointer;
}

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

.btn.primary {
  background: var(--amber);
  border-color: var(--amber);
  color: var(--amber-ink);
}

.btn.primary:hover {
  background: #f6b85a;
}

.btn.big {
  padding: 15px 28px;
  font-size: 1.15rem;
}

.btn.danger {
  color: var(--danger);
  border-color: rgba(230, 106, 92, 0.45);
}

.btn.quiet.danger {
  border-color: transparent;
}

.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.95rem;
  color: var(--dim);
}

.field.grow {
  flex: 1;
}

/* :where() keeps these base styles at zero specificity so component rules can override them. */
:where(input:not([type='checkbox']):not([type='radio']):not([type='file'])),
:where(select),
:where(textarea) {
  width: 100%;
  padding: 11px 13px;
  background: var(--hall-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--light);
  font: 400 1.05rem/1.4 var(--text);
}

textarea {
  resize: vertical;
}

:where(input, select, textarea):focus {
  border-color: var(--amber);
  outline: none;
}

.check {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 28px 0;
}

.check input {
  width: 20px;
  height: 20px;
  margin-top: 3px;
  accent-color: var(--amber);
}

.hint {
  color: var(--dim);
  font-size: 0.95rem;
  margin: 6px 0 14px;
}

.notice {
  padding: 12px 16px;
  border-left: 4px solid var(--ok);
  background: var(--hall-2);
  margin: 20px 0;
}

.notice.error {
  border-left-color: var(--danger);
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.bar {
  display: block;
  height: 4px;
  background: rgba(243, 235, 221, 0.16);
  border-radius: 2px;
  overflow: hidden;
}

.bar > span {
  display: block;
  height: 100%;
  background: var(--amber);
}

.bar.wide {
  height: 8px;
  border-radius: 4px;
}

/* ---------- Section titles ---------- */

.section-title {
  font: 800 2rem/1 var(--display);
  margin: 48px 0 20px;
  letter-spacing: 0.01em;
}

.page-title {
  font: 800 clamp(2.6rem, 5vw, 3.8rem)/0.95 var(--display);
  margin: 40px 0 12px;
}

.count {
  color: var(--dim);
  font-weight: 700;
  margin-left: 6px;
}

/* ---------- Login ---------- */

.login-body main {
  min-height: 100vh;
  display: flex;
  align-items: center;
}

.login {
  max-width: 1100px;
  padding: 64px 0;
}

.marquee {
  font: 800 clamp(4.5rem, 15vw, 13rem)/0.85 var(--display);
  margin: 0 0 32px;
  letter-spacing: -0.005em;
  animation: lights 1.4s ease-out both;
}

@keyframes lights {
  from {
    color: var(--line);
  }
  to {
    color: var(--light);
  }
}

.login-lede {
  font-size: 1.3rem;
  max-width: 34ch;
  margin: 0 0 32px;
}

.login-help {
  color: var(--dim);
  margin-top: 24px;
  font-size: 0.95rem;
}

.dev-login {
  margin-top: 40px;
  display: flex;
  gap: 12px;
  align-items: flex-end;
  max-width: 520px;
}

.dev-login label {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--dim);
  font-size: 0.9rem;
}

/* ---------- Catalog ---------- */

.resume-row {
  list-style: none;
  margin: 0;
  padding: 0 0 8px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(260px, 340px);
  gap: 20px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.still {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  text-decoration: none;
}

.still-img {
  grid-column: 1 / -1;
  aspect-ratio: 16 / 9;
  border-radius: 4px;
  overflow: hidden;
  background: var(--hall-2);
}

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

.still-title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.still-left {
  color: var(--dim);
  font-size: 0.9rem;
  white-space: nowrap;
}

.still .bar {
  grid-column: 1 / -1;
  grid-row: 2;
  margin-top: -2px;
}

.still:hover .still-img img {
  filter: brightness(1.1);
}

.library-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 32px;
  margin: 48px 0 24px;
}

.library-head .section-title {
  margin: 0;
}

.library-tools {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.library-tools input {
  width: min(360px, 70vw);
}

.library-tools select {
  width: auto;
}

.posters {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(156px, 1fr));
  gap: 32px 22px;
}

.poster-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-decoration: none;
}

.poster {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: 4px;
  overflow: hidden;
  background: var(--hall-2);
  margin-bottom: 8px;
}

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

.poster-link:hover .poster img {
  filter: brightness(1.1);
}

/* Films without a TMDB poster get a type-only card in the marquee face. */
.poster-type {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  padding: 14px;
  background: linear-gradient(180deg, var(--hall-3), var(--hall-2));
  font: 800 1.8rem/0.95 var(--display);
  overflow-wrap: anywhere;
}

.poster-title {
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.poster-year {
  color: var(--dim);
  font-size: 0.95rem;
}

.badge {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  padding: 6px 9px;
  border-radius: 4px;
  background: rgba(20, 34, 38, 0.9);
  font-size: 0.85rem;
  line-height: 1.3;
}

.badge-failed {
  color: var(--danger);
}

.empty {
  padding: 48px 0;
}

.empty p {
  font-size: 1.3rem;
}

.empty-search {
  color: var(--dim);
}

/* ---------- Film page ---------- */

.film-body main {
  padding: 0 0 96px;
}

.stage {
  background: #000;
  display: flex;
  justify-content: center;
}

.stage video {
  display: block;
  width: 100%;
  max-height: calc(100vh - 140px);
  aspect-ratio: 16 / 9;
  background: #000;
}

video::cue {
  font-family: var(--text);
  background-color: rgba(0, 0, 0, 0.62);
  color: #fff;
  line-height: 1.35;
}

.stage-status {
  width: 100%;
  min-height: 40vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px var(--pad);
  max-width: 900px;
}

.stage-status-title {
  font: 800 2.4rem/1 var(--display);
  margin: 0 0 12px;
}

.stage-status-detail {
  color: var(--dim);
  margin: 0 0 20px;
}

.film-info {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
  gap: 32px 64px;
  padding: 40px var(--pad) 0;
  max-width: 1440px;
}

.film-title {
  font: 800 clamp(3.2rem, 7.5vw, 7.5rem)/0.88 var(--display);
  margin: 0 0 14px;
  letter-spacing: -0.005em;
  overflow-wrap: break-word;
}

.film-original {
  color: var(--dim);
  font-size: 1.25rem;
  margin: 0 0 10px;
}

.film-meta {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 28px;
  padding: 0;
  margin: 0 0 24px;
  color: var(--dim);
}

.resume-note {
  margin: 0 0 24px;
}

.tagline {
  font-size: 1.25rem;
  margin: 0 0 12px;
  max-width: 50ch;
}

.overview {
  max-width: 64ch;
  line-height: 1.65;
  margin: 0 0 28px;
}

.credits {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 24px;
  margin: 0 0 32px;
  max-width: 70ch;
}

.credits dt {
  color: var(--dim);
}

.credits dd {
  margin: 0;
}

.film-side {
  border-left: 1px solid var(--line);
  padding-left: 32px;
  align-self: start;
}

.side-title {
  font: 800 1.6rem/1 var(--display);
  margin: 6px 0 16px;
}

.sub-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.chip {
  padding: 8px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: transparent;
  color: var(--light);
  font: 600 0.95rem/1.2 var(--text);
  cursor: pointer;
}

.chip:hover {
  background: var(--hall-2);
}

.chip[aria-checked='true'] {
  background: var(--light);
  border-color: var(--light);
  color: var(--hall);
}

.sync {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--dim);
  font-size: 0.95rem;
}

.sync-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sync output {
  min-width: 4.5em;
  text-align: center;
  color: var(--light);
  font-variant-numeric: tabular-nums;
}

.keys {
  margin-top: 28px;
  font-size: 0.85rem;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  background: var(--light);
  color: var(--hall);
  padding: 12px 20px;
  border-radius: var(--radius);
  font-weight: 600;
  z-index: 10;
}

/* ---------- Admin ---------- */

.narrow {
  max-width: 860px;
}

.lede {
  font-size: 1.2rem;
  max-width: 56ch;
  margin: 0 0 28px;
}

.crumbs {
  margin: 28px 0 0;
  color: var(--dim);
}

.add-user,
.add-sub {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-top: 20px;
}

.users {
  width: 100%;
  border-collapse: collapse;
  margin-top: 28px;
}

.users th {
  text-align: left;
  font-weight: 600;
  color: var(--dim);
  font-size: 0.9rem;
  padding: 8px 12px 8px 0;
  border-bottom: 1px solid var(--line);
}

.users td {
  padding: 14px 12px 14px 0;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.users select {
  width: auto;
}

.user-cell > div {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-cell img,
.avatar-blank {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--hall-3);
  flex: none;
}

.user-name {
  display: block;
  font-weight: 600;
}

.user-email {
  display: block;
  color: var(--dim);
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

.actions {
  text-align: right;
}

.actions form {
  margin: 0;
}

.dropzone {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 56px 40px;
  border: 2px dashed var(--line);
  border-radius: 10px;
  cursor: pointer;
}

.dropzone:hover,
.dropzone.over {
  border-color: var(--amber);
  background: var(--hall-2);
}

.dropzone:focus-within {
  outline: 3px solid var(--amber);
  outline-offset: 3px;
}

.dropzone-title {
  font: 800 2.4rem/1 var(--display);
}

.dropzone-text {
  color: var(--dim);
}

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

.details,
.stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.file-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  align-items: baseline;
  margin: 8px 0 0;
}

.file-name {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.file-size {
  color: var(--dim);
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 140px;
  gap: 16px;
}

.block {
  border: 0;
  padding: 0;
  margin: 12px 0 0;
}

.block legend {
  font: 800 1.6rem/1 var(--display);
  padding: 0;
  margin-bottom: 8px;
}

.tmdb-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 14px;
}

.tmdb-hit {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px;
  border: 2px solid transparent;
  border-radius: 8px;
  background: none;
  color: var(--light);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.tmdb-hit[aria-checked='true'] {
  border-color: var(--amber);
  background: var(--hall-2);
}

.tmdb-hit img,
.tmdb-hit .tmdb-blank {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 4px;
  background: var(--hall-3);
}

.tmdb-hit .tmdb-blank {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--dim);
  font-size: 0.85rem;
  padding: 8px;
  text-align: center;
}

.tmdb-name {
  font-weight: 600;
  font-size: 0.92rem;
  line-height: 1.25;
}

.tmdb-year {
  color: var(--dim);
  font-size: 0.85rem;
}

.sub-list {
  list-style: none;
  padding: 0;
  margin: 0 0 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sub-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.sub-name {
  flex: 1;
  min-width: 200px;
  overflow-wrap: anywhere;
}

.field.inline select {
  width: auto;
}

.file-btn {
  position: relative;
  align-self: flex-start;
}

.file-btn input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.file-btn:focus-within {
  outline: 3px solid var(--amber);
  outline-offset: 3px;
}

.progress {
  margin-top: 32px;
}

.progress-line {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 24px;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}

.progress-line span:first-child {
  color: var(--light);
  font-weight: 600;
}

.progress-msg {
  font-size: 1.1rem;
}

.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 24px;
  margin: 20px 0;
}

.facts dt {
  color: var(--dim);
}

.facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.sub-admin,
.jobs {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
}

.sub-admin li,
.jobs li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 18px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.sub-admin form {
  margin: 0 0 0 auto;
}

.sub-label {
  font-weight: 600;
}

.sub-meta,
.job-time {
  color: var(--dim);
  font-size: 0.95rem;
}

.job-failed {
  color: var(--danger);
}

.job-msg {
  flex-basis: 100%;
  color: var(--dim);
  font-size: 0.92rem;
}

.tmdb-relink {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tmdb-relink .btn {
  align-self: flex-start;
}

.plain {
  padding: 48px 0;
}

/* ---------- Small screens ---------- */

@media (max-width: 860px) {
  .topbar {
    flex-wrap: wrap;
    gap: 10px 20px;
  }

  .nav {
    order: 3;
    flex-basis: 100%;
    overflow-x: auto;
  }

  .who-name {
    display: none;
  }

  .film-info {
    grid-template-columns: 1fr;
  }

  .film-side {
    border-left: 0;
    padding-left: 0;
    border-top: 1px solid var(--line);
    padding-top: 24px;
  }

  .posters {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 24px 14px;
  }

  .grid2 {
    grid-template-columns: 1fr 100px;
  }

  .dropzone {
    padding: 36px 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
