/*
 * send layout, skinned with the 2222 theme pack (/theme/theme.css, copied from
 * apps/2222/app/static/theme). Burnt-orange grain, cream ink, Crimson Pro.
 * Buttons, fields, hairline lists, the action bar, dialogs and the QR code follow apps/when and
 * apps/groupchat, so the apps read as siblings.
 */

* { box-sizing: border-box; }
body {
  margin: 0;
  font-size: 16px;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
html { touch-action: manipulation; }
.hidden { display: none !important; }

header, main { width: min(560px, calc(100% - 32px)); margin: 0 auto; }
header { height: 60px; display: flex; align-items: center; border-bottom: 1px solid var(--veil-2); }
.wordmark { color: var(--ink); text-decoration: none; font-size: 18px; font-weight: 600; letter-spacing: -.3px; font-style: italic; }
main { min-height: 60vh; padding-top: 20px; padding-bottom: 40px; }

h1 { font-size: 30px; line-height: 1.15; font-weight: 400; letter-spacing: -.5px; margin: 0 0 6px; overflow-wrap: anywhere; }
h2 { font-size: 22px; line-height: 1.3; font-weight: 500; letter-spacing: -.3px; margin: 0 0 8px; }
p { margin: 0 0 12px; }

/* ---------- buttons ---------- */
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: var(--r-sm); background: var(--cream); color: var(--ground-1);
  padding: 11px 16px; font-weight: 500; cursor: pointer; text-decoration: none; line-height: 1.2;
}
button:hover, .button:hover { background: var(--cream-bright); }
button:disabled { opacity: .45; cursor: default; }
.quiet { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--veil-3); font-weight: 400; }
.quiet:hover { background: var(--veil-2); }
.linkbtn { background: transparent; box-shadow: none; color: var(--muted); font-size: 16px; font-weight: 300; padding: 6px 2px; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--veil-3); }
.linkbtn:hover { background: transparent; color: var(--ink); }
.linkbtn:disabled { opacity: .4; text-decoration: none; }
.close { background: transparent !important; box-shadow: none !important; color: var(--muted); font-size: 28px; line-height: 1; padding: 0 4px; font-weight: 300; }
button.block { margin-top: 18px; width: 100%; min-height: 56px; padding: 14px 16px; font-size: 20px; }

/* ---------- text ---------- */
.muted { color: var(--muted); font-size: 18px; line-height: 1.4; }
.fine { color: var(--ink-3); font-size: 14px; font-style: italic; margin: 0; }
.error { color: var(--danger); font-size: 16px; margin: 10px 0 0; }
.error:empty { display: none; }
.eyebrow { font-size: 16px; font-style: italic; color: var(--accent); margin: 0 0 6px; }
.keep { margin: 14px 0 0; font-size: 17px; font-style: italic; color: var(--ink-2); text-align: center; }
.drop-hint { margin-top: 18px; }
@media (hover: none), (pointer: coarse) { .drop-hint { display: none; } }

/* ---------- fields ---------- */
input {
  width: 100%; padding: 14px 15px; font-size: 19px; /* ≥16px stops iOS zooming on focus */
  background: var(--veil-2); border: 1px solid var(--veil-3); border-radius: var(--r-sm); color: var(--ink);
}
input::placeholder { color: var(--ink-4); }
input:focus { outline: none; border-color: var(--veil-4); }
.profile { display: grid; gap: 6px; margin-top: 14px; }
dialog .profile { margin-top: 6px; }
dialog .profile .linkbtn { justify-self: center; margin-top: 4px; }

/* ---------- the link: QR code and address ---------- */
.share-head { margin-bottom: 2px; }
.share-head .muted { margin: 0; }
.qr-box { text-align: center; margin: 16px 0 4px; }
.qr { display: flex; justify-content: center; align-items: center; padding: 6px 0 2px; min-height: 200px; }
.qr svg { width: min(280px, 72vw); height: auto; background: #fff; border-radius: 12px; padding: 10px; box-shadow: 0 2px 12px #0006; }
.making { font-style: italic; }
.scan-note { margin: 12px 0 2px; font-size: 19px; font-style: italic; color: var(--ink); }
.link-line { display: flex; justify-content: center; align-items: baseline; gap: 10px; margin: 0; font-size: 16px; color: var(--ink-2); }
.link-text { overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.notice { margin: 16px 0 6px; padding: 16px; border-radius: var(--r-md); background: var(--accent-soft); display: grid; gap: 12px; }
.notice p { margin: 0; color: var(--cream); font-size: 18px; }
.notice .quiet { min-height: 50px; font-size: 17px; box-shadow: inset 0 0 0 1px var(--veil-4); }
.host-links { display: flex; flex-wrap: wrap; gap: 4px 20px; margin: 10px 0 6px; }

/* ---------- lists ---------- */
.list-label { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 24px 0 8px; margin: 0; font-size: 15px; color: var(--muted); font-style: italic; }
.list-label b { font-weight: 500; color: var(--ink-2); font-size: 17px; }
.list { border-top: 1px solid var(--veil-2); }
.empty { color: var(--ink-3); font-style: italic; font-size: 16px; padding: 14px 2px; margin: 0; border-bottom: 1px solid var(--veil-2); }
.card {
  display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 14px; row-gap: 6px;
  padding: 13px 2px; border-bottom: 1px solid var(--veil-2); color: inherit; text-decoration: none;
}
button.card { width: 100%; text-align: left; background: transparent; border-radius: 0; font-weight: 400; justify-content: stretch; color: var(--ink); }
button.card:hover { background: var(--veil-1); }
button.card:active { background: var(--veil-2); }
.x { background: transparent; color: var(--ink-3); font-size: 24px; font-weight: 300; padding: 0 6px; min-height: 36px; }
.x:hover { background: transparent; color: var(--ink); }

.file { grid-template-columns: 1fr auto auto; font-size: 17px; }
.file .fname { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file .fsize { color: var(--ink-3); font-size: 15px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.file.done .fsize { color: var(--positive); }
.file.now .fname { color: var(--accent); }
.file.with-thumb { grid-template-columns: auto 1fr auto; }
.thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; background: var(--veil-2); }

.person { grid-template-columns: auto 1fr; font-size: 18px; }
.person .who { color: var(--ink); }
.person .status { justify-self: end; color: var(--ink-2); font-style: italic; font-size: 16px; text-align: right; }
.person.done .status { color: var(--positive); }
.person.sending .status { color: var(--accent); }
.person.failed .status, .person.error .status, .person.wrong .status { color: var(--danger); }
.person.left .who, .person.left .status { color: var(--ink-4); }
.person .meter { grid-column: 1 / -1; }

/* Progress: a filled bar, scaled from JavaScript (the CSP allows no inline styles). */
.meter { height: 4px; border-radius: 2px; background: var(--veil-2); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent); transform-origin: left; transform: scaleX(0); transition: transform .2s linear; }
.meter.big { height: 10px; border-radius: 5px; margin: 18px 0 10px; }
.got { font-size: 18px; color: var(--ink); font-variant-numeric: tabular-nums; margin: 0; }

/* ---------- pinned action bar ---------- */
.actionbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  padding: 12px 16px calc(10px + env(safe-area-inset-bottom));
  background: var(--grain), linear-gradient(180deg, var(--ground-2), var(--ground-1));
  border-top: 1px solid var(--veil-3); box-shadow: 0 -10px 30px #0006;
  animation: barIn .25s ease-out;
}
.bar-inner { width: min(560px, 100%); margin: 0 auto; display: flex; gap: 8px; }
.actionbar .primary { flex: 1; background: var(--accent); color: var(--ground-0); border-radius: var(--r-pill); font-size: 19px; min-height: 56px; padding: 14px 16px; }
.actionbar .primary:hover { background: var(--accent); filter: brightness(1.07); }
.actionbar .primary:disabled { filter: none; }
.actionbar .quiet { border-radius: var(--r-pill); min-height: 56px; padding: 14px 18px; font-size: 17px; white-space: nowrap; color: var(--ink); }
.actionbar .quiet.wide { flex: 1; font-size: 18px; }
.bar-note { width: min(560px, 100%); margin: 0 auto 10px; text-align: center; font-size: 16px; font-style: italic; color: var(--cream); }
.bar-note:empty, .actionbar .fine:empty { display: none; }
.actionbar .fine { width: min(560px, 100%); margin: 8px auto 0; text-align: center; }
.actionbar .fine a { color: var(--ink-2); }
body.with-bar main { padding-bottom: 170px; }
@keyframes barIn { from { transform: translateY(100%); } }

/* ---------- dialogs (raised grain surfaces) ---------- */
dialog {
  color: var(--ink); width: min(440px, calc(100% - 24px)); max-height: 90dvh; overflow: auto; padding: 22px;
  background: var(--ground-2); background-image: var(--grain), linear-gradient(180deg, var(--ground-3), var(--ground-2));
  border: 1px solid var(--veil-3); border-radius: var(--r-lg); box-shadow: 0 24px 80px #0007;
}
dialog::backdrop { background: #000a; }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 4px; }
.dialog-head h2 { margin: 0; }

/* ---------- dropping files on a computer ---------- */
.dropzone {
  position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; pointer-events: none;
  background: #000b; border: 3px dashed var(--accent); border-radius: var(--r-lg); margin: 12px;
}
.dropzone p { font-size: 30px; font-style: italic; color: var(--cream); margin: 0; }

/* ---------- privacy ---------- */
.policy h2 { margin-top: 28px; }
.policy p { font-size: 17px; color: var(--ink-2); }
.policy .back { margin-top: 28px; }

@media (max-width: 400px) {
  h1 { font-size: 27px; }
  .actionbar .quiet { padding: 13px 14px; }
}
@media (prefers-reduced-motion: reduce) { .actionbar { animation: none; } .meter i { transition: none; } }
