/* Web sender styles.
   Token values mirror prototype/css/tokens.css, which is the design source of
   truth. They are copied rather than linked so this directory stays
   independently deployable (§4: static files on any HTTPS host) — the prototype
   is design, and a shipping page should not depend on it. CSS token drift is
   cosmetic, unlike the interop contract, so it is not machine-enforced.

   The layout follows the iOS app's File action and Sending screens rather than
   a desktop dashboard: one column, one decision per section, one button at the
   bottom. A person arrives here to send a file, not to read a readout. */

:root {
  --c-bg: #050C16;
  --c-bg-deep: #02060D;
  --c-surface: #0A0F18;
  --c-surface-2: #0E131D;
  --c-surface-3: #171C25;
  --c-hairline: rgba(255, 255, 255, .085);
  --c-hairline-2: rgba(255, 255, 255, .16);
  --c-text: #F5F7FA;
  --c-text-2: #A7B0C0;
  --c-text-3: #8B95A6;
  --c-text-disabled: #6E7889;
  --c-primary: #4432C7;
  --c-primary-hover: #5140D6;
  --c-primary-text: #9C8CF5;
  --c-primary-ring: rgba(91, 73, 224, .38);
  --c-primary-tint: rgba(68, 50, 199, .20);
  --c-success: #55C85A;
  --c-success-tint: rgba(85, 200, 90, .14);
  --c-danger: #F0484D;
  --c-danger-tint: rgba(240, 72, 77, .14);
  --c-warning: #F0A24A;
  --c-warning-tint: rgba(240, 162, 74, .14);
  --g-brand: linear-gradient(100deg, #66A8F0, #B47EF0);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --r-sm: 10px; --r-md: 14px; --r-lg: 18px; --r-xl: 24px; --r-pill: 999px;
}

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

body {
  margin: 0;
  padding: 44px 20px 72px;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--c-text);
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(68, 50, 199, .16), transparent 60%),
    var(--c-bg-deep);
  -webkit-font-smoothing: antialiased;
}

/* Two widths, and the difference is who is reading. Choosing a file is a phone
   screen's worth of decisions, so that column stays narrow whatever the monitor
   does. A QR frame is read by a camera across a desk, so the sending stage takes
   the room it can get: at 900 px each tile is 445, which is three whole device
   pixels per module on a 117-module symbol. */
.page { max-width: 900px; margin: 0 auto; }
.topbar, .masthead, #picker, #details, #info, #problems, .getapp, .foot {
  max-width: 560px; margin-left: auto; margin-right: auto;
}

h1, h2, p, dl, dd, dt { margin: 0; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--c-primary-ring); outline-offset: 2px; border-radius: 6px; }

/* ---------- Masthead ---------- */

.masthead { text-align: center; }
.masthead h1 { font-size: 23px; font-weight: 700; letter-spacing: -.01em; }
/* The four initials spell what the thing does. Colouring them is the whole
   explanation, so nothing has to say "SEND stands for". */
.masthead h1 b { color: var(--c-primary-text); font-weight: 700; }
.masthead p {
  max-width: 44ch; margin: 10px auto 0;
  font-size: 13.5px; color: var(--c-text-3);
}

.masthead-receive { margin-top: 6px; color: var(--c-text-2); }

/* ---------- Language ---------- */

/* The site's one navigation row: where you are on the left, what language you
   are reading on the right. It is the only chrome either page has. */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  flex-wrap: wrap; margin-bottom: 22px;
}
.topbar-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
/* The lab this app comes from, kept quieter than the page links beside it: it
   is where you go when you are done here, not while you are working. */
.topbar-parent {
  color: var(--c-text-3); font-size: 12.5px; font-weight: 700;
  letter-spacing: .06em; text-decoration: none;
}
.topbar-parent::after { content: " ↗"; font-weight: 400; }
.topbar-parent:hover { color: var(--c-primary-text); }
.topbar-sep { color: var(--c-hairline-2); font-size: 12.5px; }

.topbar-home {
  padding: 5px 0; color: var(--c-text-2); font-size: 12.5px;
  font-weight: 600; text-decoration: none;
}
.topbar-home::before { content: "← "; color: var(--c-text-3); }
.topbar-home:hover { color: var(--c-text); }
/* The home page's version of the same link points the other way, because it
   does: it goes on to the sender rather than back to what explains it. */
.topbar-home--forward::before { content: none; }
.topbar-home--forward::after { content: " →"; color: var(--c-text-3); }

.langbar {
  display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 4px;
}
.langbar a {
  padding: 5px 11px; border-radius: var(--r-pill);
  color: var(--c-text-3); font-size: 12.5px; text-decoration: none;
}
.langbar a:hover { color: var(--c-text); background: var(--c-surface-2); }
.langbar a[aria-current="true"] {
  color: var(--c-primary-text); background: var(--c-primary-tint); font-weight: 600;
}

/* ---------- Get the app ---------- */

.getapp { margin-top: 40px; text-align: center; }
.getapp-lead { color: var(--c-text-2); font-size: 14px; }
/* Apple's own badge artwork belongs here; this is the same shape so the layout
   is right in the meantime. Black plate, white mark, two lines of type. */
.store {
  display: inline-flex; align-items: center; gap: 10px;
  margin-top: 12px; padding: 9px 18px 9px 16px;
  border: 1px solid var(--c-hairline-2); border-radius: var(--r-md);
  background: #000; color: #fff; text-decoration: none;
}
.store:hover { border-color: var(--c-hairline); background: #0B0B0D; }
.store svg { width: 24px; height: 28px; flex: 0 0 auto; }
.store span { display: block; text-align: left; line-height: 1.15; }
.store small { display: block; font-size: 11px; letter-spacing: .01em; }
.store b { display: block; font-size: 19px; font-weight: 600; letter-spacing: -.01em; }
.getapp-meta { margin-top: 10px; color: var(--c-text-3); font-size: 12px; }

/* ---------- Drop zone ---------- */

.drop {
  margin-top: 30px;
  padding: 40px 24px 32px;
  border: 2px dashed var(--c-hairline-2);
  border-radius: var(--r-xl);
  background: var(--c-surface-2);
  text-align: center;
  transition: border-color .15s, background .15s;
}
.drop.is-over { border-color: var(--c-primary-text); background: var(--c-primary-tint); }
.drop svg { width: 34px; height: 34px; color: var(--c-primary-text); margin: 0 auto; display: block; }
.drop h2 { margin-top: 14px; font-size: 18px; font-weight: 600; }
.drop-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.drop-limits { margin-top: 16px; font-size: 12px; color: var(--c-text-3); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px; margin-top: 16px;
  border-radius: var(--r-md); background: var(--c-primary); color: #fff; font-weight: 600;
  box-shadow: 0 8px 22px rgba(68, 50, 199, .4);
}
.btn:hover { background: var(--c-primary-hover); }
.btn:disabled { background: var(--c-surface-2); color: var(--c-text-disabled); box-shadow: none; cursor: not-allowed; }
.btn--wide { width: 100%; }
.btn--tall { min-height: 56px; font-size: 17px; }
.btn--tiny { min-height: 32px; margin-top: 0; padding: 0 14px; font-size: 13px; }
/* The app's secondary button: a tinted plate rather than a filled one, so the
   one thing worth pressing on a screen stays obvious. */
.btn--ghost {
  background: var(--c-primary-tint); color: var(--c-primary-text); box-shadow: none;
}
.btn--ghost:hover { background: rgba(68, 50, 199, .32); }
.btn--danger { background: var(--c-danger-tint); color: var(--c-danger); box-shadow: none; }
.btn--danger:hover { background: rgba(240, 72, 77, .22); }
input[type=file] { display: none; }

/* ---------- File detail ---------- */

.card {
  margin-top: 26px; padding: 18px 20px 20px;
  border: 1px solid var(--c-hairline); border-radius: var(--r-lg); background: var(--c-surface-2);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--c-text-3);
}
.card-label--loose { margin: 26px 0 10px 2px; }
.card h2 { margin-top: 10px; font-size: 21px; font-weight: 700; word-break: break-word; }
.file-meta { margin-top: 4px; color: var(--c-text-2); font-size: 14px; font-variant-numeric: tabular-nums; }
.file-type { margin-top: 6px; color: var(--c-text-3); font-family: var(--font-mono); font-size: 12.5px; }

/* ---------- Transport choice ---------- */

.choices {
  border: 1px solid var(--c-hairline); border-radius: var(--r-lg);
  background: var(--c-surface-2); overflow: hidden;
}
.choice {
  width: 100%; display: flex; align-items: flex-start; gap: 14px;
  padding: 16px 18px; text-align: left;
  border-bottom: 1px solid var(--c-hairline);
}
.choice:last-child { border-bottom: 0; }
.choice:hover { background: var(--c-surface-3); }
.choice[aria-checked="true"] { background: rgba(68, 50, 199, .10); }
.choice-icon { width: 22px; height: 22px; margin-top: 2px; flex: 0 0 auto; color: var(--c-text-2); }
.choice[aria-checked="true"] .choice-icon { color: var(--c-primary-text); }
.choice-body { flex: 1 1 auto; min-width: 0; }
.choice-body b { display: block; font-size: 16px; font-weight: 600; }
.choice-body small { display: block; margin-top: 4px; color: var(--c-text-3); font-size: 13px; }
.choice-tick {
  flex: 0 0 auto; width: 22px; height: 22px; margin-top: 2px; border-radius: 50%;
  border: 1px solid var(--c-hairline-2);
}
.choice[aria-checked="true"] .choice-tick {
  border-color: var(--c-primary); background: var(--c-primary);
}
/* The tick itself, drawn rather than shipped as an asset. */
.choice[aria-checked="true"] .choice-tick::after {
  content: ""; display: block; width: 6px; height: 11px; margin: 3px auto 0;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.badge {
  display: inline-block; margin-left: 6px; padding: 1px 7px; vertical-align: 1px;
  border: 1px solid var(--c-warning); border-radius: var(--r-pill);
  color: var(--c-warning); font-size: 10px; font-weight: 700; letter-spacing: .06em;
}

.field {
  display: block; margin: 18px 0 6px 2px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--c-text-3);
}
#audioProfile {
  width: 100%; min-height: 46px; padding: 0 12px;
  border: 1px solid var(--c-hairline-2); border-radius: var(--r-md);
  background: var(--c-surface-3); color: var(--c-text);
  font-family: var(--font); font-size: 14px;
}

.hint { margin-top: 14px; color: var(--c-text-3); font-size: 13px; }
.hint--centre { text-align: center; max-width: 52ch; margin-left: auto; margin-right: auto; }

#start { margin-top: 18px; }

/* ---------- Notes ---------- */

.note {
  margin-top: 16px; padding: 12px 14px;
  border-radius: var(--r-md); border-left: 3px solid var(--c-primary);
  background: var(--c-surface-3); font-size: 13px; color: var(--c-text-2);
}
.note b { color: var(--c-text); }
.note--ok { border-left-color: var(--c-success); background: var(--c-success-tint); color: var(--c-text); }
.note--bad { border-left-color: var(--c-danger); background: var(--c-danger-tint); color: var(--c-text); }
.note--warn { border-left-color: var(--c-warning); background: var(--c-warning-tint); }
#problems { border-left-color: var(--c-danger); background: var(--c-danger-tint); color: var(--c-text); }

/* ---------- Sending ---------- */

.sending { margin-top: 8px; }
.sending-head {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding-bottom: 4px;
}
.sending-head h2 { font-size: 21px; font-weight: 700; }
.pill {
  padding: 5px 12px; border-radius: var(--r-pill);
  background: var(--c-primary-tint); color: var(--c-primary-text);
  font-size: 12px; font-weight: 700;
}
.sending-file {
  margin-top: 6px; text-align: center; color: var(--c-text-2); font-size: 13px;
  word-break: break-word;
}

/* `hidden` must win.
   An author rule beats the browser's `[hidden] { display: none }`, and
   `.qr-tile` sets `display: grid`. So switching to the one-code layout hid the
   three unused tiles in JavaScript and they stayed on screen anyway, still
   holding the half-width codes drawn for the 2x2 grid — one large code with
   three smaller ones stacked under it. Reported 2026-09-17; the bug is as old
   as the grid (661f190).
   `!important` is the point rather than a shortcut: nothing should be able to
   override this, and every element the page toggles is one of these. */
[hidden] { display: none !important; }

.qr-grid {
  margin-top: 18px;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px; justify-items: center; align-items: center;
}
.qr-grid.is-one { grid-template-columns: 1fr; }
.qr-tile { width: 100%; min-width: 0; display: grid; place-items: center; }
.qr-tile canvas {
  display: block; max-width: none; background: #fff;
  image-rendering: pixelated; image-rendering: crisp-edges;
  box-shadow: 0 14px 38px rgba(0, 0, 0, .42);
}

/* Layout and zoom sit on one row: both change how the codes are presented, and
   separating them made the zoom look like a page control rather than a QR one. */
.sending-controls {
  margin-top: 16px; display: flex; flex-wrap: wrap;
  gap: 10px; align-items: center; justify-content: center;
}

.zoom {
  display: inline-flex; align-items: center; gap: 2px;
  border: 1px solid var(--c-hairline); border-radius: var(--r-lg);
  overflow: hidden; background: #02050A;
}
.zoom button {
  min-width: 44px; min-height: 44px;   /* a real touch target, not a glyph */
  border: 0; background: transparent; color: var(--c-text);
  font-size: 20px; line-height: 1; cursor: pointer;
}
.zoom button:hover:not(:disabled) { background: rgba(255, 255, 255, .07); }
.zoom button:disabled { opacity: .35; cursor: default; }
.zoom-value {
  min-width: 4.5ch; text-align: center;
  font-size: 13px; color: var(--c-text-2); font-variant-numeric: tabular-nums;
}

.audio-stage {
  margin-top: 22px; padding: 30px 22px;
  border: 1px solid var(--c-hairline); border-radius: var(--r-xl);
  background: radial-gradient(circle at 50% 50%, rgba(102, 168, 240, .08), transparent 60%), #02050A;
}

/* There is nothing to look at in an acoustic broadcast, which is exactly the
   problem: a page that shows nothing is indistinguishable from a page that has
   silently stopped. The bar is the pass position — the one honest thing to draw,
   since the sender cannot know what arrived (§4, no return channel). */
.audio-meter {
  --audio-progress: 0%;
  position: relative; height: 10px; border-radius: var(--r-pill);
  background: var(--c-surface-3); overflow: hidden;
}
.audio-meter::after {
  content: ""; position: absolute; inset: 0 auto 0 0;
  width: var(--audio-progress);
  background: var(--g-brand);
  transition: width .18s linear;
}

.sending-state {
  margin-top: 18px; text-align: center; color: var(--c-text-2);
  font-size: 15px; font-weight: 600;
}
.stats {
  margin-top: 14px; display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 8px; text-align: center;
}
.stats dd { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stats dt { margin-top: 2px; color: var(--c-text-3); font-size: 12px; }
.sending-line {
  margin-top: 10px; text-align: center; color: var(--c-text-2); font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}
.sending-line--dim { margin-top: 2px; color: var(--c-text-3); font-size: 12.5px; }

.segmented {
  width: 240px; margin: 18px auto 0;
  display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 3px;
  border: 1px solid var(--c-hairline); border-radius: var(--r-md); background: var(--c-bg-deep);
}
.segmented button {
  min-height: 36px; padding: 0 10px; border-radius: 9px;
  color: var(--c-text-3); font-size: 12px; font-weight: 700;
}
.segmented button[aria-pressed="true"] { background: var(--c-primary); color: #fff; }

.sending .btn--danger { margin-top: 20px; }

/* ---------- Foot ---------- */

.foot {
  margin-top: 44px; padding-top: 18px; border-top: 1px solid var(--c-hairline);
  text-align: center; font-size: 12px; color: var(--c-text-3);
}

@media (max-width: 620px) {
  body { padding: 30px 14px 48px; }
  .masthead h1 { font-size: 20px; }
  .qr-grid { gap: 6px; }
  .stats dd { font-size: 22px; }
  .sending-head { flex-direction: column; gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .001ms !important; }
}
