/* Shared look for the three pages. One typeface, one accent (the logo orange),
   and square "tiles" as the recurring shape, because the mosaic is made of them. */

@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('/vendor/fonts/outfit-latin-wght-normal.woff2') format('woff2');
}

:root {
  --orange: #f08644;
  --orange-text: #a84a13; /* the orange darkened until it is readable as text */
  --ink: #1c2230;
  --ink-soft: #586074;
  --paper: #ffffff;
  --mist: #f1f3f6;
  --line: #d6dbe4;
  --leaf: #23694a; /* the leaf in the logo's D: used for "done" */
  --danger: #b3261e;
  --radius: 6px;
  --gutter: 20px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --orange-text: #f6a36f;
    --ink: #eef0f5;
    --ink-soft: #a5adbf;
    --paper: #141821;
    --mist: #1e2431;
    --line: #333c4d;
    --leaf: #74d3a4;
    --danger: #ff8f85;
  }
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Outfit', 'Avenir Next', 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  font-size: 1.0625rem;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.05;
  text-wrap: balance;
}

p {
  margin: 0;
}

a {
  color: var(--orange-text);
  text-underline-offset: 0.18em;
}

img {
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

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

/* ---- the logo, drawn as a wall of tiles ---------------------------------- */

.mark {
  aspect-ratio: 266 / 124;
  background-color: var(--orange);
  /* a repeating block of tiles in slightly different oranges, with paper-coloured grout */
  background-image:
    linear-gradient(var(--paper) 1.5px, transparent 1.5px),
    linear-gradient(90deg, var(--paper) 1.5px, transparent 1.5px),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80'%3E%3Cg fill='%23fff'%3E%3Crect x='16' width='16' height='16' opacity='.22'/%3E%3Crect x='64' y='16' width='16' height='16' opacity='.3'/%3E%3Crect y='32' width='16' height='16' opacity='.16'/%3E%3Crect x='48' y='48' width='16' height='16' opacity='.26'/%3E%3Crect x='32' y='64' width='16' height='16' opacity='.18'/%3E%3C/g%3E%3Cg fill='%23000'%3E%3Crect x='48' y='0' width='16' height='16' opacity='.1'/%3E%3Crect x='16' y='16' width='16' height='16' opacity='.07'/%3E%3Crect x='32' y='32' width='16' height='16' opacity='.12'/%3E%3Crect x='0' y='64' width='16' height='16' opacity='.08'/%3E%3Crect x='64' y='48' width='16' height='16' opacity='.1'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 16px 16px, 16px 16px, 80px 80px;
  -webkit-mask: url('/api/outline.png') center / 100% 100% no-repeat;
  mask: url('/api/outline.png') center / 100% 100% no-repeat;
}

/* ---- buttons and fields --------------------------------------------------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  min-height: 48px;
  padding: 0 1.25em;
  border: 0;
  border-radius: var(--radius);
  background: var(--orange);
  color: #1c2230;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  filter: brightness(1.05);
}

.button:disabled {
  opacity: 0.55;
  cursor: default;
  filter: none;
}

.button.quiet {
  background: transparent;
  color: var(--ink);
  box-shadow: inset 0 0 0 1.5px var(--line);
}

.button.quiet:hover {
  background: var(--mist);
}

.button.danger {
  background: transparent;
  color: var(--danger);
  box-shadow: inset 0 0 0 1.5px currentColor;
}

.button.small {
  min-height: 36px;
  padding: 0 0.8em;
  font-size: 0.9rem;
}

.field {
  display: grid;
  gap: 6px;
}

.field > label,
.field > .label {
  font-weight: 600;
}

.field .hint {
  color: var(--ink-soft);
  font-size: 0.9rem;
}

input[type='text'],
input[type='email'],
input[type='password'],
input[type='search'],
textarea,
select {
  width: 100%;
  min-height: 48px;
  padding: 11px 12px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
}

textarea {
  resize: vertical;
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline-offset: 0;
  border-color: var(--orange);
}

.check {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 12px;
  align-items: start;
  cursor: pointer;
}

.check input {
  width: 24px;
  height: 24px;
  margin: 1px 0 0;
  accent-color: var(--orange);
}

.error {
  padding: 12px 14px;
  border-left: 4px solid var(--danger);
  background: color-mix(in srgb, var(--danger) 9%, var(--paper));
  color: var(--ink);
}

.note {
  color: var(--ink-soft);
  font-size: 0.92rem;
}

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

/* ---- upload page ---------------------------------------------------------- */

.upload {
  width: min(100%, 560px);
  margin: 0 auto;
  padding: 28px var(--gutter) 64px;
  display: grid;
  gap: 28px;
}

.upload .mark {
  width: min(100%, 420px);
}

.upload h1 {
  font-size: clamp(2.3rem, 10.5vw, 3.5rem);
}

.upload .intro {
  display: grid;
  gap: 14px;
}

.upload .lede {
  font-size: 1.15rem;
  max-width: 34em;
}

.count {
  color: var(--ink-soft);
}

.count strong {
  color: var(--ink);
  font-weight: 700;
}

.upload form {
  display: grid;
  gap: 22px;
}

/* photos chosen so far, laid out like the mosaic they will join */
.tiles {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tiles li {
  position: relative;
  aspect-ratio: 1;
  border-radius: 4px;
  background: var(--mist);
  overflow: hidden;
}

.tiles img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tiles .remove {
  position: absolute;
  top: 0;
  right: 0;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-bottom-left-radius: 4px;
  background: rgba(20, 24, 33, 0.78);
  color: #fff;
  font: inherit;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.tiles .add {
  background: transparent;
  border: 2px dashed var(--orange);
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--orange-text);
  font-size: 2rem;
  font-weight: 300;
  line-height: 1;
}

.tiles .add:hover {
  background: color-mix(in srgb, var(--orange) 12%, transparent);
}

.tiles .add:focus-within {
  outline: 3px solid var(--orange);
  outline-offset: 2px;
}

.tiles .add input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.counter {
  justify-self: end;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.field .row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.progress {
  display: grid;
  gap: 8px;
}

.progress .bar {
  height: 8px;
  border-radius: 4px;
  background: var(--mist);
  overflow: hidden;
}

.progress .bar > span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--orange);
  transition: width 0.2s linear;
}

.done {
  display: grid;
  gap: 20px;
}

.done h2 {
  font-size: clamp(2rem, 9vw, 3rem);
  color: var(--leaf);
}

.codes {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.codes li {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 16px;
  align-items: center;
  padding: 8px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
}

.codes img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 4px;
  display: block;
}

.codes .code {
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

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

/* ---- mosaic viewer -------------------------------------------------------- */

.viewer-page {
  height: 100dvh;
  overflow: hidden;
}

.stage {
  position: fixed;
  inset: 0;
}

.stage .openseadragon-container:focus-visible {
  outline: none;
}

.stage.over-photo .openseadragon-canvas {
  cursor: pointer !important;
}

.mosaic-tint {
  pointer-events: none;
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  transition: opacity 0.15s linear;
}

.mosaic-covers {
  pointer-events: none;
  image-rendering: pixelated; /* each canvas pixel is one whole tile: keep its edges hard */
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}

.mosaic-highlight {
  pointer-events: none;
  box-sizing: border-box;
  outline: 4px solid #fff;
  box-shadow: 0 0 0 8px var(--orange), 0 0 0 9px rgba(0, 0, 0, 0.35);
  border-radius: 2px;
}

.mosaic-highlight.pulse {
  animation: found 0.9s ease-out 3;
}

@keyframes found {
  0% {
    box-shadow: 0 0 0 8px var(--orange), 0 0 0 9px rgba(0, 0, 0, 0.35), 0 0 0 9px color-mix(in srgb, var(--orange) 70%, transparent);
  }
  100% {
    box-shadow: 0 0 0 8px var(--orange), 0 0 0 9px rgba(0, 0, 0, 0.35), 0 0 0 46px transparent;
  }
}

/* controls float over the mosaic on small solid plates */
.plate {
  background: var(--paper);
  color: var(--ink);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
}

.topbar {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
  right: max(12px, env(safe-area-inset-right));
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
  justify-content: space-between;
  pointer-events: none;
  z-index: 5;
}

.topbar > * {
  pointer-events: auto;
}

.title {
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 50px;
}

.title strong {
  font-weight: 800;
  letter-spacing: -0.01em;
}

.title span {
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 100%;
}

.find {
  display: flex;
  padding: 3px;
  gap: 3px;
}

.find input {
  width: 9.5em;
  min-height: 38px;
  padding: 6px 10px;
  border: 0;
  background: transparent;
}

.find input:focus-visible {
  outline: none;
}

.find:focus-within {
  border-color: var(--orange);
}

.find .button {
  min-height: 38px;
  padding: 0 0.9em;
}

.show-link {
  min-height: 50px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}

.show-link:hover {
  background: var(--mist);
}

.menu {
  position: relative;
}

.menu > summary {
  list-style: none;
  cursor: pointer;
  min-height: 47px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  font-weight: 600;
}

.menu > summary::-webkit-details-marker {
  display: none;
}

.menu .choices {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 15em;
  padding: 6px;
  display: grid;
  gap: 2px;
  z-index: 6;
}

.menu .choices a {
  padding: 10px 12px;
  border-radius: 4px;
  color: var(--ink);
  text-decoration: none;
  display: grid;
}

.menu .choices a:hover {
  background: var(--mist);
}

.menu .choices small {
  color: var(--ink-soft);
}

.mine {
  position: fixed;
  top: calc(max(12px, env(safe-area-inset-top)) + 56px);
  right: max(12px, env(safe-area-inset-right));
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  max-width: min(92vw, 30em);
  padding: 8px 10px;
  align-items: center;
  font-size: 0.92rem;
}

.mine button {
  border: 0;
  border-radius: 4px;
  padding: 6px 9px;
  background: var(--mist);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.mine button:hover {
  background: var(--orange);
  color: #1c2230;
}

.toast {
  position: fixed;
  left: 50%;
  top: calc(max(12px, env(safe-area-inset-top)) + 64px);
  transform: translateX(-50%);
  z-index: 7;
  padding: 10px 16px;
  max-width: 90vw;
  border-color: var(--danger);
}

.zoom {
  position: fixed;
  right: max(12px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 4;
  display: grid;
  overflow: hidden;
}

.zoom button {
  width: 46px;
  height: 46px;
  border: 0;
  border-bottom: 1.5px solid var(--line);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 1.4rem;
  cursor: pointer;
}

.zoom button:last-child {
  border-bottom: 0;
  font-size: 0.78rem;
  font-weight: 700;
}

.zoom button:hover {
  background: var(--mist);
}

.hint-line {
  position: fixed;
  left: max(12px, env(safe-area-inset-left));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 3;
  padding: 8px 12px;
  font-size: 0.9rem;
  color: var(--ink-soft);
  max-width: calc(100vw - 90px);
}

/* the photo someone tapped */
.detail {
  position: fixed;
  z-index: 10;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 100vw);
  display: grid;
  grid-template-rows: auto 1fr auto;
  border-radius: 0;
  border-width: 0 0 0 1.5px;
  box-shadow: -18px 0 40px rgba(12, 16, 24, 0.22);
}

.detail header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 12px 12px 20px;
}

.detail .code {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.detail .close {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.detail .close:hover {
  background: var(--mist);
}

.detail .photo {
  position: relative;
  min-height: 0;
  background: var(--mist);
  overflow: hidden;
}

.detail .photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.detail footer {
  padding: 16px 20px max(20px, env(safe-area-inset-bottom));
  display: grid;
  gap: 14px;
}

.detail .description {
  font-size: 1.1rem;
  overflow-wrap: anywhere;
}

@media (max-width: 640px) {
  /* row one: name and download; row two: the search box at full width */
  .tools {
    display: contents;
  }

  .show-link {
    order: 2;
  }

  .title {
    flex: 1 1 auto;
  }

  .find {
    flex: 1 1 100%;
    order: 3;
  }

  .find input {
    flex: 1;
    width: auto;
  }

  .mine {
    top: calc(max(12px, env(safe-area-inset-top)) + 110px);
  }

  .toast {
    top: calc(max(12px, env(safe-area-inset-top)) + 116px);
  }

  .detail {
    top: auto;
    left: 0;
    width: auto;
    height: min(62dvh, 560px);
    border-width: 1.5px 0 0;
    border-radius: 14px 14px 0 0;
    box-shadow: 0 -18px 40px rgba(12, 16, 24, 0.22);
  }
}

/* with a photo open, the mosaic and its controls move aside rather than sit underneath */
@media (min-width: 641px) {
  .detail-open .stage {
    right: 420px;
  }

  .detail-open .topbar,
  .detail-open .zoom,
  .detail-open .mine {
    right: 432px;
  }
}

@media (max-width: 640px) {
  .detail-open .stage {
    bottom: min(62dvh, 560px);
  }

  .detail-open .zoom,
  .detail-open .mine,
  .detail-open .topbar {
    display: none;
  }
}

/* before the reveal */
.soon {
  min-height: 100dvh;
  display: grid;
  place-content: center;
  justify-items: start;
  gap: 18px;
  padding: 32px var(--gutter);
  width: min(100%, 560px);
  margin: 0 auto;
}

.soon .mark {
  width: min(100%, 420px);
}

.soon h1 {
  font-size: clamp(2.2rem, 10vw, 3.4rem);
}

/* ---- admin ---------------------------------------------------------------- */

.login {
  width: min(100%, 420px);
  margin: 0 auto;
  padding: 12vh var(--gutter) 48px;
  display: grid;
  gap: 24px;
}

.login .mark {
  width: 220px;
}

.login h1 {
  font-size: 2.2rem;
}

.login form {
  display: grid;
  gap: 18px;
}

.admin {
  width: min(100%, 1120px);
  margin: 0 auto;
  padding: 24px var(--gutter) 96px;
  display: grid;
  gap: 40px;
}

.admin-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.admin-head h1 {
  font-size: clamp(1.8rem, 5vw, 2.4rem);
}

.admin section {
  display: grid;
  gap: 18px;
  padding-top: 28px;
  border-top: 1.5px solid var(--line);
}

.admin h2 {
  font-size: 1.5rem;
}

.admin h3 {
  font-size: 1.1rem;
  letter-spacing: 0;
}

.states {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.states button {
  display: grid;
  gap: 2px;
  text-align: left;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.states button span {
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.states button[aria-pressed='true'] {
  border-color: var(--orange);
  background: color-mix(in srgb, var(--orange) 16%, var(--paper));
  box-shadow: inset 0 0 0 1.5px var(--orange);
}

.states button:disabled {
  cursor: default;
  opacity: 0.6;
}

.links {
  display: grid;
  gap: 8px;
  margin: 0;
}

.links div {
  display: grid;
  grid-template-columns: 8em 1fr;
  gap: 12px;
  align-items: center;
}

.links dt {
  color: var(--ink-soft);
}

.links dd {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  overflow-wrap: anywhere;
}

.banner {
  padding: 12px 14px;
  border-left: 4px solid var(--orange);
  background: color-mix(in srgb, var(--orange) 13%, var(--paper));
}

.build-row,
.row-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.settings {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  align-items: start;
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  display: grid;
  gap: 10px;
  min-width: 0;
}

legend,
.outline-box .label {
  padding: 0;
  font-weight: 600;
  margin-bottom: 4px;
}

.radio {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 10px;
  align-items: start;
  cursor: pointer;
}

.radio input {
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  accent-color: var(--orange);
}

.radio span {
  display: grid;
}

.radio small {
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.colours,
.outline-box {
  display: grid;
  gap: 12px;
}

.colour {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 600;
}

.colour input {
  width: 64px;
  height: 40px;
  padding: 2px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  cursor: pointer;
}

.mark.small {
  width: 200px;
}

.preview {
  display: grid;
  gap: 10px;
}

.preview-stage {
  position: relative;
  height: min(62vh, 560px);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.preview-stage.over-photo .openseadragon-canvas {
  cursor: pointer !important;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filters button {
  min-height: 40px;
  padding: 0 14px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.filters button[aria-pressed='true'] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.filters span {
  font-weight: 400;
  opacity: 0.75;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.card {
  display: grid;
  grid-template-rows: auto 1fr auto;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--paper);
}

.card.removed {
  opacity: 0.55;
}

.card .shot {
  background: var(--mist);
  display: grid;
  place-items: center;
  height: 170px;
}

.card .frame {
  position: relative;
  max-width: 100%;
  max-height: 170px;
  overflow: hidden; /* keeps the dimming outside the crop box inside the photo */
}

.card .frame img {
  display: block;
  width: 100%;
  height: 100%;
}

.card .face {
  position: absolute;
  border: 2px solid #fff;
  outline: 1px solid rgba(0, 0, 0, 0.5);
  border-radius: 2px;
}

.card .cropbox {
  position: absolute;
  border: 2px dashed var(--orange);
  box-shadow: 0 0 0 999px rgba(20, 24, 33, 0.38);
}

.card .body {
  padding: 10px 12px;
  display: grid;
  gap: 4px;
  align-content: start;
  min-width: 0;
}

.card .code {
  font-weight: 800;
  font-size: 1.1rem;
}

.card .meta {
  color: var(--ink-soft);
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

.card .desc {
  overflow-wrap: anywhere;
}

.card .flag {
  justify-self: start;
  padding: 1px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--orange) 22%, var(--paper));
  font-size: 0.82rem;
  font-weight: 600;
}

.card .actions {
  display: flex;
  gap: 8px;
  padding: 0 12px 12px;
  flex-wrap: wrap;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.table th,
.table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}

.table th {
  font-weight: 600;
  color: var(--ink-soft);
}

.danger-zone {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1.5px solid color-mix(in srgb, var(--danger) 45%, var(--line));
  border-radius: var(--radius);
  max-width: 520px;
}

dialog.crop {
  width: min(96vw, 860px);
  max-height: 94dvh;
  padding: 0;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
}

dialog.crop::backdrop {
  background: rgba(12, 16, 24, 0.6);
}

.crop-inner {
  display: grid;
  gap: 14px;
  padding: 18px 20px 20px;
}

.crop-inner header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.crop-inner .close {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font-size: 1.5rem;
  cursor: pointer;
}

.crop-stage {
  position: relative;
  justify-self: center;
  max-width: 100%;
  background: var(--mist);
  cursor: crosshair;
  touch-action: none;
  user-select: none;
  line-height: 0;
  overflow: hidden;
}

.crop-stage img {
  display: block;
  max-width: 100%;
  max-height: 52dvh;
}

.crop-frame {
  position: absolute;
  border: 2px solid #fff;
  outline: 2px solid var(--orange);
  box-shadow: 0 0 0 9999px rgba(20, 24, 33, 0.5);
  pointer-events: none;
}

.crop-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 20px 32px;
  align-items: end;
}

.crop-controls fieldset {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
}

.crop-controls legend {
  width: 100%;
}

.crop-controls label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.crop-controls input[type='radio'] {
  width: 20px;
  height: 20px;
  accent-color: var(--orange);
}

.slider {
  flex: 1 1 220px;
  font-weight: 600;
}

.slider input {
  flex: 1;
  accent-color: var(--orange);
}

@media (max-width: 560px) {
  .states {
    grid-template-columns: 1fr;
  }

  .links div {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

/* ---- show mode: reveal animation and slideshow, for a big screen ----------- */

.show-page {
  height: 100dvh;
  overflow: hidden;
  background: #000;
}

.show-page .mosaic-tint {
  transition: none; /* the timeline sets the tint every frame */
}

.show-page.idle,
.show-page.idle * {
  cursor: none !important;
}

.caption {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 7vh;
  z-index: 3;
  margin: 0;
  padding: 0 6vw;
  text-align: center;
  font-size: clamp(1.4rem, 3.6vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  text-wrap: balance;
  opacity: 0;
  pointer-events: none;
}

.show-bar {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 6;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  justify-content: center;
  width: max-content;
  max-width: calc(100vw - 24px);
  padding: 10px 12px;
  transition: opacity 0.4s, transform 0.4s;
}

.show-page.idle .show-bar {
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
}

.show-bar .group {
  display: flex;
  gap: 6px;
  align-items: center;
}

.show-bar .seg {
  display: flex;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.show-bar .seg button {
  min-height: 40px;
  padding: 0 14px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.show-bar .seg button[aria-pressed='true'] {
  background: var(--ink);
  color: var(--paper);
}

.show-bar label {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 0.95rem;
}

.show-bar select,
.show-bar input[type='text'] {
  min-height: 40px;
  width: auto;
  padding: 6px 10px;
}

.show-bar input[type='text'] {
  width: 15em;
  max-width: 60vw;
}

.show-bar input[type='checkbox'] {
  width: 20px;
  height: 20px;
  accent-color: var(--orange);
}

.show-bar .button {
  min-height: 40px;
}

.show-bar .play {
  min-width: 6.5em;
}

.show-message {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: grid;
  place-content: center;
  justify-items: start;
  gap: 16px;
  padding: 32px var(--gutter);
  background: var(--paper);
  color: var(--ink);
}

.show-message .inner {
  width: min(100%, 520px);
  display: grid;
  gap: 16px;
  justify-items: start;
}

.show-message h1 {
  font-size: clamp(1.9rem, 6vw, 2.8rem);
}

.show-toast {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 9;
  padding: 10px 16px;
  max-width: 90vw;
}
