/* drop.mbnt.se — same "keycap" theme as send.mbnt.se and the password generator:
   square edges, brand cyan #27add4 from the logo, static grid background. */

/* Archivo for the interface; JetBrains Mono for file names and text.
   Both self-hosted (CSP is default-src 'self'), SIL OFL — see /fonts/*-OFL.txt */
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url("/fonts/archivo-latin-wdth-normal.woff2") format("woff2-variations");
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("/fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2-variations");
}

:root {
  --brand: #27add4;
  --brand-bright: #5bc7e8;
  --brand-deep: #13708c;
  --navy: #061c28;
  --abyss: #010b11;
  --panel: #0a2837;
  --paper: #eaf6fb;
  --text: var(--paper);
  --muted: #9cc4d6;
  --faint: #5b7f8f;
  --ok: #7fe0a8;
  --danger: #ff8a8a;
  --warning-bg: #3a2a0c;
  --warning-fg: #ffd992;
  --warning-border: rgba(255, 200, 110, 0.35);
  --danger-bg: #3d1216;
  --danger-border: rgba(255, 138, 138, 0.45);
  --line: rgba(91, 199, 232, 0.2);
  --input-bg: #04141c;
  --input-border: rgba(91, 199, 232, 0.3);
  --alt-face: #103a4e;
  --alt-face-hover: #16475e;
  --alt-edge: #051620;
  --font-ui: "Archivo", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --wide: 112%;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { min-height: 100%; }

body {
  margin: 0;
  font-family: var(--font-ui);
  color: var(--text);
  background: var(--navy);
}

/* Background: static two-scale grid (24px fine, 120px major), fading out
   toward the edges. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(91, 199, 232, 0.075) 1px, transparent 1px),
    linear-gradient(90deg, rgba(91, 199, 232, 0.075) 1px, transparent 1px),
    linear-gradient(rgba(91, 199, 232, 0.14) 1px, transparent 1px),
    linear-gradient(90deg, rgba(91, 199, 232, 0.14) 1px, transparent 1px);
  background-size: 24px 24px, 24px 24px, 120px 120px, 120px 120px;
  -webkit-mask-image: radial-gradient(90% 70% at 50% 35%, #000 30%, transparent 100%);
  mask-image: radial-gradient(90% 70% at 50% 35%, #000 30%, transparent 100%);
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 59px;
  padding: 0 22px;
}

.logo { align-self: stretch; }

.logo img {
  display: block;
  height: 100%;
  width: auto;
}

main { max-width: 640px; margin: 44px auto; padding: 0 20px; }

section {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 24px;
  box-shadow: 0 1px 0 rgba(91, 199, 232, 0.08), 0 14px 0 -8px rgba(1, 11, 17, 0.55);
  animation: wipe 0.42s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

section > :first-child { margin-top: 0; }

@keyframes wipe {
  from { clip-path: inset(0 0 100% 0); }
  to   { clip-path: inset(-24px -24px -24px -24px); }
}

h1 { margin: 0 0 18px; font-size: 1.35rem; font-weight: 700; font-stretch: var(--wide); letter-spacing: -0.01em; }

textarea, input[type="text"], input[type="password"] {
  width: 100%;
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--input-border);
  border-radius: 0;
  padding: 10px 12px;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

textarea:focus, input[type="text"]:focus, input[type="password"]:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: inset 0 0 0 1px var(--brand);
}

input.invalid, input.invalid:focus {
  border-color: var(--danger);
  box-shadow: inset 0 0 0 1px var(--danger);
}

.shake { animation: shake 0.32s steps(6) both; }

@keyframes shake {
  0%   { transform: translateX(0); }
  20%  { transform: translateX(-6px); }
  40%  { transform: translateX(6px); }
  60%  { transform: translateX(-4px); }
  80%  { transform: translateX(3px); }
  100% { transform: translateX(0); }
}

textarea { resize: vertical; }
textarea:disabled { opacity: 0.45; }

/* No ligatures: JetBrains Mono would otherwise merge "//", "->", "!=" etc.,
   and file names and text must show exactly the characters they contain. */
textarea, .mono, .file-name, .text-box pre {
  font-family: var(--font-mono);
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "calt" 0;
}

.row { display: flex; align-items: center; gap: 12px; margin: 14px 0; }
.row label { color: var(--muted); }

/* Upload left, Create right */
.action-row { justify-content: space-between; }

/* Buttons: keycaps — cyan face on a deep-cyan edge; pressing pushes the face down. */
button,
.button-link {
  display: inline-block;
  background: var(--brand);
  color: #04202c;
  border: none;
  border-radius: 0;
  padding: 11px 18px;
  margin-bottom: 4px;
  font-size: 0.95rem;
  font-weight: 650;
  font-stretch: var(--wide);
  font-family: inherit;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--brand-deep), 0 4px 0 1px rgba(1, 11, 17, 0.5);
  transition: background-color 0.12s ease, transform 0.07s ease-out, box-shadow 0.07s ease-out;
}

button:hover:not(:disabled),
.button-link:hover { background: var(--brand-bright); }

button:active:not(:disabled),
.button-link:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--brand-deep), 0 1px 0 1px rgba(1, 11, 17, 0.5);
}

button:focus-visible,
.button-link:focus-visible { outline: 2px solid var(--paper); outline-offset: 3px; }

button:disabled { opacity: 0.4; cursor: not-allowed; }

button.secondary {
  background: var(--alt-face);
  color: var(--text);
  box-shadow: 0 4px 0 var(--alt-edge), inset 0 0 0 1px var(--input-border);
}

button.secondary:hover:not(:disabled) { background: var(--alt-face-hover); }

button.secondary:active:not(:disabled) {
  box-shadow: 0 1px 0 var(--alt-edge), inset 0 0 0 1px var(--input-border);
}

/* Working: diagonal stripes run across the button face. */
button.busy,
button.busy:disabled {
  opacity: 1;
  cursor: progress;
  background-image: repeating-linear-gradient(-45deg, rgba(1, 11, 17, 0.22) 0 7px, transparent 7px 14px);
  background-size: 19.8px 19.8px;
  animation: stripes 0.45s linear infinite;
}

@keyframes stripes { to { background-position: 19.8px 0; } }

.copy-box { position: relative; }

.copy-inline {
  position: absolute;
  top: 0;
  right: 5px;
  bottom: 0;
  width: 32px;
  height: 30px;
  margin: auto;
  display: grid;
  place-items: center;
  background: none;
  padding: 0;
  color: var(--brand-bright);
  box-shadow: none;
}

.copy-inline svg { width: 16px; height: 16px; }
.copy-inline .i-ok { display: none; }
.copy-inline:hover:not(:disabled) { background: rgba(91, 199, 232, 0.12); }
.copy-inline:active:not(:disabled) { transform: translateY(2px); box-shadow: none; }
.copy-inline:focus-visible { outline-offset: 0; outline-color: var(--brand); }
.text-box .copy-inline { top: 8px; bottom: auto; margin: 0; }

/* Copied: filled check, a light sweep across the field, a "Copied" tag. */
.copy-sweep {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.copy-sweep::before {
  content: "";
  position: absolute;
  inset: 0;
  width: 45%;
  background: linear-gradient(90deg, transparent, rgba(91, 199, 232, 0.38), transparent);
  transform: translateX(-110%);
}

.copied .copy-sweep::before { animation: sweep 0.55s cubic-bezier(0.3, 0.7, 0.3, 1); }
.copied input, .copied pre { border-color: var(--brand); }
.copied .copy-inline, .copied .copy-inline:hover:not(:disabled) { background: var(--brand); color: var(--navy); }
.copied .copy-inline .i-copy { display: none; }
.copied .copy-inline .i-ok { display: block; }

@keyframes sweep {
  from { transform: translateX(-110%); }
  to   { transform: translateX(260%); }
}

.copy-tag {
  position: absolute;
  right: 0;
  bottom: calc(100% + 7px);
  padding: 4px 7px;
  background: var(--brand);
  color: var(--navy);
  font: 700 10px/1 var(--font-ui);
  font-stretch: var(--wide);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.12s ease, transform 0.16s cubic-bezier(0.2, 0.9, 0.3, 1.4);
  pointer-events: none;
}

.copy-tag::after {
  content: "";
  position: absolute;
  right: 11px;
  top: 100%;
  border: 5px solid transparent;
  border-top-color: var(--brand);
  border-bottom: 0;
}

.copied .copy-tag { opacity: 1; transform: none; }

a { color: var(--brand-bright); }

.warning {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 10px;
  align-items: start;
  background: var(--warning-bg);
  color: var(--warning-fg);
  border: 1px solid var(--warning-border);
  padding: 12px 14px;
  font-size: 0.92rem;
}

.warning::before {
  content: "!";
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  background: var(--warning-fg);
  color: var(--warning-bg);
  font-weight: 800;
  font-size: 0.8rem;
}

.warning.danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger-border);
  margin-bottom: 0;
}

.warning.danger::before {
  background: var(--danger);
  color: var(--danger-bg);
}

.warning strong { font-variant-numeric: tabular-nums; }

.error { color: var(--danger); }
.note { color: var(--muted); font-size: 0.9rem; }

.text-box pre {
  margin: 0;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  padding: 14px 48px 14px 14px;
  white-space: pre-wrap;
  word-break: break-word;
}


.mono { font-size: 0.92em; }

button.small,
.button-link.small {
  padding: 7px 11px;
  margin-bottom: 3px;
  font-size: 0.82rem;
  box-shadow: 0 3px 0 var(--brand-deep), 0 3px 0 1px rgba(1, 11, 17, 0.5);
}

button.secondary.small { box-shadow: 0 3px 0 var(--alt-edge), inset 0 0 0 1px var(--input-border); }
button.small:active:not(:disabled) { transform: translateY(2px); }
button.wide { width: 100%; }

.button-link.secondary {
  background: var(--alt-face);
  color: var(--text);
  box-shadow: 0 4px 0 var(--alt-edge), inset 0 0 0 1px var(--input-border);
}

.button-link.secondary:hover { background: var(--alt-face-hover); }

/* ---------- connection status (header, right) ---------- */

.conn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  font-stretch: var(--wide);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.conn i { width: 8px; height: 8px; background: var(--ok); }
.conn[data-state="down"] i { background: var(--warning-fg); animation: blink 1s steps(2, jump-none) infinite; }

@keyframes blink { 50% { opacity: 0.2; } }

/* ---------- you ---------- */

.avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  font-size: 24px;
  line-height: 1;
}

.me {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  margin: 0 0 20px;
  padding: 12px;
  border: 1px solid var(--line);
  background: rgba(4, 20, 28, 0.45);
}

.me-text { min-width: 0; }

.me-label {
  display: block;
  color: var(--faint);
  font-size: 0.68rem;
  font-weight: 700;
  font-stretch: var(--wide);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.me-text strong {
  display: block;
  font-size: 1.05rem;
  font-weight: 650;
  font-stretch: var(--wide);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#rename-btn { display: inline-flex; align-items: center; gap: 7px; }
#rename-btn svg { width: 14px; height: 14px; }

/* ---------- nearby devices: each one a keycap ---------- */

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

.peer {
  --p: 0%;
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  margin-bottom: 4px;
  background: var(--alt-face);
  box-shadow: 0 4px 0 var(--alt-edge), inset 0 0 0 1px var(--input-border);
  transition: background-color 0.12s ease, transform 0.07s ease-out, box-shadow 0.07s ease-out;
  animation: pop 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.3) both;
}

@keyframes pop {
  from { opacity: 0; transform: translateY(-6px) scale(0.97); }
}

.peer:hover:not(.gone) { background: var(--alt-face-hover); }

.peer:has(.peer-main:active:not(:disabled)) {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--alt-edge), inset 0 0 0 1px var(--input-border);
}

.peer.drag {
  background: var(--alt-face-hover);
  box-shadow: 0 4px 0 var(--alt-edge), inset 0 0 0 2px var(--brand);
}

.peer.gone { opacity: 0.55; }

.peer-main,
.peer-main:hover:not(:disabled),
.peer-main:active:not(:disabled) {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 12px 10px 12px 12px;
  background: none;
  color: var(--text);
  text-align: left;
  box-shadow: none;
  transform: none;
}

.peer-main:disabled { opacity: 1; cursor: default; }
.peer-main:focus-visible { outline-offset: -2px; }

.peer-text { display: grid; min-width: 0; gap: 2px; }

.peer-name,
.peer-sub {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.peer-name { font-size: 1rem; font-weight: 650; }

.peer-sub {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 450;
  font-stretch: 100%;
  font-variant-numeric: tabular-nums;
}

.peer-side { margin: 0 12px 3px 0; }

/* The choice row slides out under the name: two keycaps, File and Message. */
.peer-choice {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 2px 12px 14px;
  animation: unfold 0.2s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.peer-choice button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.peer-choice svg { width: 14px; height: 14px; }

@keyframes unfold {
  from { clip-path: inset(0 0 100% 0); opacity: 0; }
  to   { clip-path: inset(-8px -8px -8px -8px); opacity: 1; }
}

.peer.choosing { background: var(--alt-face-hover); box-shadow: 0 4px 0 var(--alt-edge), inset 0 0 0 1px var(--brand); }

.peer[data-status="done"] .peer-sub { color: var(--ok); }
.peer[data-status="error"] .peer-sub { color: var(--danger); }
.peer[data-status="incoming"] .peer-sub { color: var(--warning-fg); }

/* Asking to send: the avatar pulses like a key waiting to be pressed. */
.peer[data-status="incoming"] .avatar { animation: ask 1s ease-in-out infinite alternate; }

@keyframes ask {
  from { border-color: var(--input-border); box-shadow: none; }
  to   { border-color: var(--warning-fg); box-shadow: 0 0 0 3px rgba(255, 217, 146, 0.18); }
}

/* Progress along the bottom edge of the key; striped while waiting. */
.peer-bar {
  position: absolute;
  left: 1px;
  right: 1px;
  bottom: 1px;
  height: 3px;
  overflow: hidden;
  pointer-events: none;
}

.peer-bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--brand);
  transition: width 0.15s linear;
}

.peer[data-status="sending"] .peer-bar i,
.peer[data-status="receiving"] .peer-bar i { width: var(--p); }

.peer[data-status="connecting"] .peer-bar i,
.peer[data-status="waiting"] .peer-bar i {
  width: 100%;
  background: repeating-linear-gradient(-45deg, var(--brand) 0 7px, transparent 7px 14px);
  background-size: 19.8px 19.8px;
  animation: stripes 0.45s linear infinite;
}

.peer[data-status="connecting"] .peer-bar i { opacity: 0.5; }

/* ---------- empty state: squares ripple out while looking ---------- */

.empty { padding: 18px 8px 8px; text-align: center; }
.empty p { margin: 18px auto 0; max-width: 34ch; color: var(--muted); font-size: 0.92rem; line-height: 1.55; }
.empty strong { display: block; color: var(--text); font-weight: 650; font-stretch: var(--wide); margin-bottom: 2px; }

.radar {
  position: relative;
  width: 84px;
  height: 84px;
  margin: 0 auto;
}

.radar::after {
  content: "";
  position: absolute;
  inset: 36px;
  background: var(--brand);
  box-shadow: 0 3px 0 var(--brand-deep);
}

.radar i {
  position: absolute;
  inset: 0;
  border: 1.5px solid var(--brand);
  opacity: 0;
  animation: ripple 2.4s cubic-bezier(0.2, 0.6, 0.3, 1) infinite;
}

.radar i:nth-child(2) { animation-delay: 0.8s; }
.radar i:nth-child(3) { animation-delay: 1.6s; }

@keyframes ripple {
  from { transform: scale(0.15); opacity: 0.9; }
  to   { transform: scale(1); opacity: 0; }
}

.hint { margin: 16px 0 0; font-size: 0.84rem; text-align: center; }
.pointer-only { display: none; }

@media (hover: hover) and (pointer: fine) {
  .pointer-only { display: inline; }
}

.footnote { margin: 22px 0 0; text-align: center; font-size: 0.75rem; line-height: 1.6; color: var(--faint); }

/* ---------- dialogs ---------- */

dialog {
  width: min(520px, calc(100% - 32px));
  max-height: calc(100% - 48px);
  overflow: auto;
  padding: 24px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0;
  box-shadow: 0 1px 0 rgba(91, 199, 232, 0.08), 0 14px 0 -8px rgba(1, 11, 17, 0.55), 0 30px 80px rgba(0, 0, 0, 0.5);
}

dialog[open] { animation: wipe 0.32s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
dialog::backdrop { background: rgba(1, 11, 17, 0.72); }

dialog h2 { margin: 0 0 14px; font-size: 1.15rem; font-weight: 700; font-stretch: var(--wide); }
dialog .action-row { margin: 18px 0 0; }
dialog .action-row > * { flex: 1; text-align: center; white-space: nowrap; }

.dlg-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.dlg-head > div { min-width: 0; }
.dlg-head strong { display: block; font-size: 1.15rem; font-weight: 700; font-stretch: var(--wide); }
.dlg-head span:not(.avatar) { display: block; color: var(--muted); font-size: 0.9rem; }

.summary { margin: 0 0 10px; font-weight: 650; font-variant-numeric: tabular-nums; }

.files {
  max-height: 260px;
  overflow: auto;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
}

.files li {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
}

.files li:last-child { border-bottom: 0; }
.files .more { color: var(--muted); font-size: 0.85rem; }
.files button { flex: none; }

.file-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.85rem;
}

.file-size { flex: none; color: var(--muted); font-size: 0.8rem; font-variant-numeric: tabular-nums; }

.bar {
  --p: 0%;
  height: 10px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
}

.bar i { display: block; height: 100%; width: var(--p); background: var(--brand); transition: width 0.15s linear; }
.progress-text { margin: 8px 0 12px; font-variant-numeric: tabular-nums; }

.text-box pre { max-height: 50vh; overflow: auto; }
#text-input { min-height: 120px; }

/* Bottom toast, created by feedback.js */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  max-width: calc(100% - 32px);
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--paper);
  color: var(--navy);
  padding: 10px 14px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 4px 0 var(--brand-deep);
  transform: translate(-50%, calc(100% + 40px));
  transition: transform 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.2);
  pointer-events: none;
}

.toast::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  background: var(--brand-deep);
}

.toast.show { transform: translate(-50%, 0); }

/* Undo the browser's popover defaults (centered box with border and padding). */
.toast[popover] {
  inset: auto auto 24px 50%;
  margin: 0;
  border: 0;
  overflow: visible;
}

@media (max-width: 480px) {
  header { padding: 0 16px; }
  main { margin-top: 24px; padding: 0 16px; }
  section, dialog { padding: 18px; }
  .peers { grid-template-columns: 1fr; }
  .me { gap: 10px; padding: 10px; }
  .rename-label { display: none; }
  #rename-btn { padding: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  section,
  dialog[open],
  .radar i,
  .peer-choice,
  .peer[data-status="incoming"] .avatar,
  .peer[data-status="connecting"] .peer-bar i,
  .peer[data-status="waiting"] .peer-bar i,
  .conn[data-state="down"] i,
  .shake,
  button.busy,
  .copied .copy-sweep::before { animation: none; }
  .toast { transition: none; }
}
