/* Picmu: removes the background of an image or a video, and upscales them, in the browser, with WebGPU. */
.hidden { display: none !important; }
.visually-hidden { position: absolute; width: 0; height: 0; opacity: 0; pointer-events: none; }
.spacer { flex: 1; }

/* Icon: SVG files from assets/js/icons.js are used as masks so they follow the text colour */

/* Buttons */
button.active { background: var(--fg); color: var(--bg); border-color: var(--fg); }

/* Page */
/* The page is the header, the main, and the footer, directly in the body. The padding and the gap are the ones of the body. */
.main { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr) auto; }

.header { height: var(--height); }
.logo-mark { background-image: url("favicon.png"); }   /* the logo of the app: its favicon (the rest is in assets/css/style.css) */
.header-tools { height: 100%; }

.model-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap-small); }
.model-field { display: flex; align-items: center; gap: var(--gap-small); flex: none; }
.model-field-main { flex: 1; min-width: 0; }
.model-label { font-size: var(--font-size-extra-small); font-weight: 700; text-transform: uppercase; color: var(--fg-1); white-space: nowrap; }
.model-field select { min-width: 0; }
.model-field-main select { flex: 1; }

.workspace { position: relative; min-height: 0; display: flex; flex-direction: column; }

/* Where an image is dropped */
.drop-zone {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--gap-medium); padding: var(--padding-extra-large);
  text-align: center; border: var(--border-width) solid var(--border); border-radius: var(--border-radius-large); transition: border-color 0.2s, background 0.2s;
}
.drop-zone.over { border-color: var(--brand); background: var(--bg-1); }
.drop-illustration { display: flex; align-items: center; justify-content: center; width: calc(var(--unit) * 40); height: calc(var(--unit) * 40); background: var(--bg-1); border-radius: var(--border-radius-large); }
.drop-illustration .icon { width: var(--icon-size-extra-large); height: var(--icon-size-extra-large); color: var(--fg-1); }
.drop-title { font-size: var(--font-size-large); font-weight: 700; }
.drop-text { max-width: calc(var(--unit) * 160); color: var(--fg-1); }
.drop-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--gap-small); }

/* Choosing an image from the Drive */
.drive-dialog { width: min(calc(var(--unit) * 200), calc(var(--vw) * 94)); height: min(calc(var(--vh) * 80), calc(var(--unit) * 300)); }
.drive-dialog[open] { display: flex; flex-direction: column; gap: var(--gap-small); padding: var(--padding-medium); }
.drive-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--gap-small); height: var(--height); }
.drive-title { font-size: var(--font-size-large); font-weight: 700; }
.drive-list { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; border: var(--border-width) solid var(--border); border-radius: var(--border-radius-medium); }
.drive-file {
  display: grid; grid-template-columns: var(--icon-size-small) minmax(0, 1fr) minmax(0, 40%) calc(var(--unit) * 20); align-items: center; gap: var(--gap-small);
  flex: none; padding: 0 var(--padding-medium); border: 0; border-bottom: var(--border-width) solid var(--border); border-radius: 0; text-align: start; text-transform: none; font-weight: 400;
}
.drive-file:last-child { border-bottom: 0; }
.drive-file > span:not(.icon) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drive-file-folder, .drive-file-size { color: var(--fg-1); font-size: var(--font-size-small); }
.drive-file-size { text-align: end; }
.drive-message { padding: var(--padding-medium); color: var(--fg-1); text-align: center; }

/* The original and the result, side by side */
.result-area { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: var(--gap-small); }
.result-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap-small); }
.panes { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap-small); }
.pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: var(--gap-small); }
.pane-title { font-size: var(--font-size-extra-small); font-weight: 700; text-transform: uppercase; color: var(--fg-1); }
.image {
  flex: 1; min-height: calc(var(--unit) * 40); border: var(--border-width) solid var(--border); border-radius: var(--border-radius-large);
  background: var(--image, none) center / contain no-repeat, var(--bg-1);
}
/* A video and the frames of its result fill the image */
.image video, .image canvas { display: block; width: 100%; height: 100%; object-fit: contain; border-radius: inherit; }
/* A transparent result shows a chessboard behind it, so the empty parts can be seen */
.image.background-transparent {
  background: var(--image, none) center / contain no-repeat,
    conic-gradient(var(--bg-1) 25%, var(--bg) 0 50%, var(--bg-1) 0 75%, var(--bg) 0) 0 0 / calc(var(--unit) * 6) calc(var(--unit) * 6);
}
.image.background-white { background: var(--image, none) center / contain no-repeat, var(--white); }
.image.background-custom { background: var(--image, none) center / contain no-repeat, var(--custom-colour); }
.swatch { width: var(--icon-size-small); height: var(--icon-size-small); flex: none; background: var(--custom-colour); border: var(--border-width) solid currentColor; border-radius: var(--border-radius-small); }
.image.background-black { background: var(--image, none) center / contain no-repeat, var(--black); }


/* Settings */
dialog { color: var(--fg); background: var(--bg); border: var(--border-width) solid var(--border); padding: 0; }
dialog::backdrop { background: color-mix(in srgb, var(--black) 70%, transparent); }

@media (max-width: 48rem) {
  #background-switch button { padding-inline: var(--padding-small); }
  .panes { grid-template-columns: 1fr; overflow: auto; }
  .image { min-height: calc(var(--unit) * 70); }
}

/* Controls that keep their size have a set width: a multiple of the height (RULES.md, Control Width) */
#choose-button { width: calc(var(--height) * 4); }
#drive-button { width: calc(var(--height) * 4); }
#stop-button { width: calc(var(--height) * 3); }
#another-button { width: calc(var(--height) * 5); }
#save-button { width: calc(var(--height) * 5); }
#zip-button { width: calc(var(--height) * 5); }
#frame-rate-select { width: calc(var(--height) * 2); }
#format-select { width: calc(var(--height) * 6); }
