/* The file drop zone: a dashed frame with three sheets on a black page, and under it the files being uploaded.
   Violet is the accent; each kind of file has its own colour on its little sheet. */
:root {
  --page: #000000;          /* the page */
  --ink: #f4f4f6;           /* text */
  --muted: #8a8a94;
  --zone: #0d0d10;          /* inside the frame */
  --dash: #3b3b43;          /* the frame's dashes */
  --row: #121216;           /* a file's row */
  --track: #26262c;         /* an upload bar, empty */
  --accent: #8f7dff;        /* the frame when files are over it, the bars, the front sheet */
  --done: #45d483;          /* uploaded */
  --error: #ff5c5c;         /* too big */
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Figtree Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

/* held from the top: rows coming in grow the page downwards, the frame does not move */
.stage {
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  align-content: start;
  padding: clamp(40px, 16vh, 170px) 16px 48px;
}

.drop {
  width: min(480px, 100%);
}

/* ---------------------------------------------------------------- the zone */
.drop__zone {
  position: relative;
  display: grid;
  justify-items: center;
  padding: 34px 22px 30px;
  border-radius: 24px;
  background: var(--zone);
  text-align: center;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.drop__zone:focus-visible {
  box-shadow: 0 0 0 2px var(--page), 0 0 0 4px var(--ink);
}

/* the dashes: an SVG rectangle the script sizes to the zone */
.drop__frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.drop__dash {
  fill: none;
  stroke: var(--dash);
  stroke-width: 2;
  stroke-dasharray: 9 8;
  stroke-linecap: round;
  transition: stroke 0.3s ease;
}

.drop.is-near .drop__dash,
.drop.is-over .drop__dash {
  stroke: var(--accent);
}

/* ---------------------------------------------------------------- the three sheets */
.drop__art {
  position: relative;
  width: 120px;
  height: 78px;
  margin-bottom: 18px;
}

.sheet {
  position: absolute;
  left: calc(50% - 25px);
  bottom: 0;
  width: 50px;
  height: 64px;
  border-radius: 9px;
  background: #2a2a31;
  transform-origin: 50% 100%;
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 0 100%);
}

/* the folded corner */
.sheet::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 14px;
  height: 14px;
  border-bottom-left-radius: 4px;
  background: rgba(255, 255, 255, 0.18);
}

.sheet--mid {
  background: #3a3a43;
}

.sheet--front {
  display: grid;
  place-items: center;
  background: var(--accent);
}

.sheet--front svg {
  width: 24px;
  height: 24px;
  margin-top: 4px;
  fill: none;
  stroke: #fff;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------------------------------------------------------------- the words */
.drop__title {
  height: 26px;
  margin: 0;
  overflow: hidden;
  font-size: 18px;
  font-weight: 620;
  line-height: 26px;
  letter-spacing: -0.01em;
}

.drop__title > span {
  display: block;
}

.drop__browse {
  color: var(--accent);
}

.drop__hint {
  margin: 6px 0 0;
  font-size: 14px;
  color: var(--muted);
}

/* the real file field: out of sight, the zone opens it */
.drop__input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* ---------------------------------------------------------------- the files */
/* each row keeps its own room below (and the list gives it back), so a row can close up to nothing smoothly */
.drop__list {
  margin: 14px 0 -10px;
  padding: 0;
  list-style: none;
}

.file {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
  padding: 12px 10px 12px 14px;
  overflow: hidden;
  border-radius: 18px;
  background: var(--row);
}

/* the little sheet with the kind of file */
.file__type {
  position: relative;
  display: grid;
  place-items: end center;
  width: 34px;
  height: 42px;
  padding-bottom: 6px;
  border-radius: 7px;
  background: var(--kind, #9a9aa3);
  color: #0b0b0d;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 0 100%);
}

.file__type::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 10px;
  height: 10px;
  border-bottom-left-radius: 3px;
  background: rgba(255, 255, 255, 0.4);
}

.file__body {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.file__name {
  overflow: hidden;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.file__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  height: 19px;
  overflow: hidden;
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.file__state {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.file__state svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.file.is-done .file__state {
  color: var(--done);
}

.file.is-error .file__state {
  color: var(--error);
}

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

.file__fill {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: var(--accent);
  transform-origin: 0 50%;
  transform: scaleX(0);
}

.file.is-error .file__fill {
  background: var(--error);
}

.file__x {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.file__x svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
}

@media (hover: hover) and (pointer: fine) {
  .file__x:hover {
    background: #222228;
    color: var(--ink);
  }
}

.file__x:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

/* the copy of the front sheet flying into a row */
.drop__ghost {
  position: fixed;
  z-index: 5;
  border-radius: 9px;
  background: var(--accent);
  transform-origin: 0 0;
  pointer-events: none;
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 0 100%);
}
