/* upload.meyershumrick.com: the client upload page.
   The tokens, type and rules follow the firm site (msl-website: docs/design-spec.md and
   src/app.css), so a client who knows the site recognises this as the firm's own page:
   one accent for everything interactive, Bebas display, Inter body, DM Mono labels, zero radius,
   hairline rules and the 2px line frame. No other hues except --error. */

@font-face {
  font-family: "Bebas Neue";
  src: url("/fonts/bebas-neue-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter Variable";
  src: url("/fonts/inter-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "DM Mono";
  src: url("/fonts/dm-mono-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "DM Mono";
  src: url("/fonts/dm-mono-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;

  --navy-900: #0d1d35;
  --navy-700: #132848;
  --steel: #5c6b84;          /* secondary text on paper, 4.97:1 */
  --steel-bright: #8ea9c9;   /* secondary text on navy */
  --paper: #f4f6f3;
  --ink: #12151b;
  --accent: #2a5ce0;         /* the ONLY interactive/active colour: links, focus, progress */
  --accent-bright: #6e93f3;  /* the accent on navy grounds */
  --error: #a3302b;          /* 6.4:1 on paper; used for words and one thin rule, never a fill */
  --rule: rgb(19 40 72 / 0.2);   /* hairlines on paper */
  --track: rgb(19 40 72 / 0.1);  /* empty part of a progress bar */

  --nav-w: 58px;             /* the frame keys off this, exactly like the site */
  --line-w: 2px;
  --gutter: max(20px, calc(var(--nav-w) / 2));

  --font-display: "Bebas Neue", Impact, "Arial Narrow", Arial, sans-serif;
  --font-body: "Inter Variable", "Inter", "Segoe UI", Arial, sans-serif;
  --font-mono: "DM Mono", Consolas, Menlo, monospace;

  /* The site's scale. The 16px floor is load-bearing: iOS zooms the page when a focused control
     computes below 16px. */
  --text-body: max(1rem, calc(clamp(1rem, 0.95rem + 0.2vw, 1.125rem) * 0.98));
  --text-sm: calc(0.875rem * 0.98);
  --text-mono: calc(0.75rem * 1.04);
  --text-h1: calc(clamp(2.25rem, 1.6rem + 3.4vw, 3.75rem) * 1.08);
}

@media screen and (min-width: 768px) {
  :root {
    --nav-w: 88px;
  }
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border-radius: 0;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  scrollbar-gutter: stable;   /* the frame doesn't shift when a long list adds a scrollbar */
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

h1,
h2 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.05;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--navy-700);
}

h1 {
  font-size: var(--text-h1);
}

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

::selection {
  background: var(--accent);
  color: var(--paper);
}

.mono-label {
  font-family: var(--font-mono);
  font-size: var(--text-mono);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  line-height: 1.5;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- The frame ----------
   As on the site's interior pages: a 2px rule under the header and a fixed 2px rule at x = --nav-w
   down the left. The site stops its header rule --nav-w short of the right edge, where its menu
   button sits; this page has no menu, so the rule runs the full width (a gap read as a cut-off
   line on phones). Under 576px the left rule goes, as on the site. */
@media screen and (min-width: 576px) {
  body::before {
    content: "";
    position: fixed;
    top: 0;
    bottom: 0;
    left: var(--nav-w);
    width: var(--line-w);
    background: var(--navy-700);
    z-index: 4;
    pointer-events: none;
  }
}

.masthead {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(var(--nav-w) * 1.25);
  padding: 0.9rem var(--gutter);
  color: var(--navy-700);
}

.masthead::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--line-w);
  background: var(--navy-700);
}

.logo {
  display: block;
  height: clamp(42px, 3rem + 1vw, 60px);
  width: auto;
}

.link-title {
  margin-top: 0.5rem;
  color: var(--steel);
  text-align: center;
}

/* ---------- The sheet ---------- */
.sheet {
  flex: 1;
  width: 100%;
  max-width: calc(50rem + var(--gutter) * 2);
  margin: 0 auto;
  padding: 1.25rem var(--gutter) 4rem;
}

@media screen and (min-width: 576px) {
  .sheet {
    /* The page box starts at the left rule, so the content sits --nav-w inside it on both sides
       (the site's left-gutter rule). */
    max-width: calc(50rem + var(--nav-w) * 3);
    padding: 1.5rem var(--nav-w) 5rem calc(var(--nav-w) * 2);
  }
}

/* The title block: one mono label in the drawing register, top right. */
.spec {
  text-align: right;
  color: var(--steel);
  margin-bottom: clamp(1.5rem, 4vw, 2.75rem);
}

.view h1 {
  max-width: 14em;
}

.lede {
  max-width: 34rem;
  margin-top: 0.9rem;
  font-size: calc(var(--text-body) * 1.06);
  color: var(--ink);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}

/* "Opening your link" waits a beat before it shows, so a fast answer never flashes it. */
.loading {
  color: var(--steel);
  animation: appear 0.2s ease 0.5s both;
}

@keyframes appear {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ---------- Buttons ----------
   The site's boxed CTA: Bebas in a 2px box that fills with the accent on hover and focus.
   The primary action is the same box filled navy, so it reads first without a new treatment. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0.72em 1.6em;
  border: var(--line-w) solid var(--navy-700);
  background: transparent;
  color: var(--navy-700);
  font-family: var(--font-display);
  font-size: calc(1.0625rem * 1.12);
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.btn-primary {
  background: var(--navy-700);
  color: var(--paper);
}

.btn:hover,
.btn:focus-visible {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--paper);
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: transparent;
  border-color: var(--navy-700);
  color: var(--navy-700);
}

.btn-large {
  min-height: 3.5rem;
  font-size: 1.4rem;
  padding-inline: 1.8em;
}

/* ---------- The drop zone ----------
   A hairline box with 2px corner marks, like the crop marks on a drawing sheet. The marks turn
   accent on hover; the whole window takes drops (see .drop-overlay). */
.zone {
  --mark: var(--navy-700);
  --mark-len: 22px;
  position: relative;
  margin-top: clamp(1.75rem, 4vw, 2.5rem);
  padding: clamp(1.75rem, 5vw, 3.25rem) clamp(1.25rem, 4vw, 3rem);
  border: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-height: clamp(15rem, 34vh, 21rem);
  justify-content: center;
  cursor: pointer;
}

.zone::before {
  content: "";
  position: absolute;
  inset: -1px;
  pointer-events: none;
  background:
    linear-gradient(var(--mark), var(--mark)) top left / var(--mark-len) var(--line-w),
    linear-gradient(var(--mark), var(--mark)) top left / var(--line-w) var(--mark-len),
    linear-gradient(var(--mark), var(--mark)) top right / var(--mark-len) var(--line-w),
    linear-gradient(var(--mark), var(--mark)) top right / var(--line-w) var(--mark-len),
    linear-gradient(var(--mark), var(--mark)) bottom left / var(--mark-len) var(--line-w),
    linear-gradient(var(--mark), var(--mark)) bottom left / var(--line-w) var(--mark-len),
    linear-gradient(var(--mark), var(--mark)) bottom right / var(--mark-len) var(--line-w),
    linear-gradient(var(--mark), var(--mark)) bottom right / var(--line-w) var(--mark-len);
  background-repeat: no-repeat;
  transition: opacity 0.18s ease;
}

/* Hover only where there is a real pointer: on touch screens :hover sticks after a tap. */
@media (hover: hover) {
  .zone:hover {
    --mark: var(--accent);
  }

  .file-remove:hover {
    color: var(--accent);
  }
}

.zone.is-closed {
  cursor: default;
  --mark: var(--rule);
}

.zone-icon,
.drop-icon {
  width: 2.75rem;
  height: 2.75rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: square;
  color: var(--navy-700);
}

.zone-title {
  margin-top: 1rem;
  font-family: var(--font-display);
  font-size: calc(clamp(1.75rem, 1.2rem + 1.8vw, 2.5rem) * 1.08);
  line-height: 1.05;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--navy-700);
}

.zone-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.zone-note {
  max-width: 30rem;
  margin-top: 1.25rem;
  font-size: var(--text-sm);
  color: var(--steel);
}

/* Once files are listed the zone folds to one line, so the progress below it stays in view on a
   laptop screen. It is still a drop target, and so is the whole window. */
.zone.is-compact {
  min-height: 0;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem 1.75rem;
  padding-block: 1.25rem;
}

.zone.is-compact .zone-icon,
.zone.is-compact .zone-note {
  display: none;
}

.zone.is-compact .zone-title {
  margin: 0;
  font-size: calc(clamp(1.375rem, 1.1rem + 0.8vw, 1.75rem) * 1.08);
}

.zone.is-compact .zone-actions {
  margin: 0;
}

.zone.is-compact .btn-large {
  min-height: 3rem;
  font-size: 1.2rem;
}

/* Phones and tablets can't drop files: the zone becomes one big button. */
@media (hover: none) and (pointer: coarse) {
  .zone {
    min-height: 0;
    cursor: default;
  }

  .zone-title {
    display: none;
  }

  .zone-actions {
    align-self: stretch;
  }

  .zone-actions .btn {
    flex: 1 1 100%;
  }

  .zone.is-compact .zone-actions {
    flex: 1 1 100%;
  }
}

.picker {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  clip-path: inset(50%);
}

.notice {
  margin-top: 1rem;
  font-size: var(--text-sm);
  color: var(--steel);
}

/* ---------- Overall status ----------
   While files are moving it sticks to the top as the client scrolls a long list, so the overall
   line and the "keep this page open" note never leave the screen. Once done it scrolls away. */
.status {
  position: relative;
  z-index: 3;
  margin-top: 2.25rem;
  padding: 1rem 0 1.1rem;
  background: var(--paper);
  border-top: var(--line-w) solid var(--navy-700);
  border-bottom: 1px solid var(--rule);
}

.status[data-phase="sending"],
.status[data-phase="offline"] {
  position: sticky;
  top: 0;
}

.status-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.status-label {
  display: flex;
  align-items: center;
  gap: 0.6em;
  color: var(--navy-700);
}

/* A small square in the phase's colour: accent while sending, steel while paused, navy when
   done, the error colour when stopped. */
.status-label::before {
  content: "";
  width: 0.6em;
  height: 0.6em;
  background: var(--accent);
  flex: none;
}

.status[data-phase="offline"] .status-label::before {
  background: var(--steel);
}

.status[data-phase="done"] .status-label::before {
  background: var(--navy-700);
}

.status[data-phase="stopped"] .status-label::before,
.status[data-phase="closed"] .status-label::before {
  background: var(--error);
}

.status-pct {
  color: var(--steel);
  font-variant-numeric: tabular-nums;
}

.status-title {
  margin-top: 0.35rem;
  font-size: calc(clamp(2rem, 1.5rem + 2vw, 3rem) * 1.08);
}

.status-line {
  margin-top: 0.3rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.status-note {
  margin-top: 0.6rem;
  font-size: var(--text-sm);
  color: var(--steel);
}

.status[data-phase="stopped"] .status-note,
.status[data-phase="closed"] .status-note {
  color: var(--error);
}

.status-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.status-actions:has(> :not([hidden])) {
  margin-top: 1rem;
}

/* ---------- Progress bars ----------
   Flat, square, the accent while moving and navy once received. The fill scales rather than
   resizing, so updates never cause layout. */
.bar {
  position: relative;
  height: 3px;
  background: var(--track);
  overflow: hidden;
}

.bar-fill {
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.3s linear;
}

.bar-overall {
  height: 6px;
  margin-top: 0.75rem;
}

.status[data-phase="done"] .bar-fill {
  background: var(--navy-700);
}

.status[data-phase="offline"] .bar-fill,
.status[data-phase="stopped"] .bar-fill,
.status[data-phase="closed"] .bar-fill {
  background: var(--steel);
}

/* A scale under the overall bar, ticks every tenth: the drawing register, kept faint. */
.scale {
  height: 5px;
  border-right: 1px solid var(--rule);
  background: repeating-linear-gradient(to right, var(--rule) 0 1px, transparent 1px 10%);
}

/* ---------- The file list ---------- */
.files {
  list-style: none;
  margin-top: 0.25rem;
}

.file {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr) auto 2.75rem;
  column-gap: 0.75rem;
  align-items: start;
  padding: 0.7rem 0 0.65rem;
  border-bottom: 1px solid var(--rule);
}

.file-index {
  grid-column: 1;
  padding-top: 0.2rem;
  color: var(--steel);
  font-variant-numeric: tabular-nums;
}

.file-main {
  grid-column: 2;
  min-width: 0;
}

.file-name {
  font-weight: 500;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.file-path {
  margin-top: 0.15rem;
  color: var(--steel);
  overflow-wrap: anywhere;
  text-transform: none;
  letter-spacing: 0.02em;
}

.file-path:empty {
  display: none;
}

.file-meta {
  grid-column: 3;
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  padding-top: 0.1rem;
  text-align: right;
  white-space: nowrap;
}

.file-status {
  min-width: 5.5em;   /* "64%" and "RECEIVED" end on the same edge without the size jumping */
  justify-content: flex-end;
}

.file-size {
  font-size: var(--text-sm);
  color: var(--steel);
  font-variant-numeric: tabular-nums;
}

.file-status {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  color: var(--navy-700);
  font-variant-numeric: tabular-nums;
}

.file-remove {
  grid-column: 4;
  width: 2.75rem;
  height: 2.75rem;
  margin-top: -0.6rem;
  margin-bottom: -0.6rem;
  display: grid;
  place-items: center;
  color: var(--steel);
  transition: color 0.18s ease;
}

.file-remove svg {
  width: 1.1rem;
  height: 1.1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
}

.file-bar {
  grid-column: 2 / 4;
  margin-top: 0.55rem;
}

.file-message {
  grid-column: 2 / -1;
  margin-top: 0.4rem;
  font-size: var(--text-sm);
  color: var(--error);
}

.file-message:empty {
  display: none;
}

/* States */
.file[data-state="queued"] .file-status,
.file[data-state="starting"] .file-status {
  color: var(--steel);
}

.file[data-state="done"] .file-status::before {
  /* a check mark drawn with two borders */
  content: "";
  width: 0.75em;
  height: 0.4em;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-0.12em) rotate(-45deg);
}

.file[data-state="done"] .bar-fill {
  background: var(--navy-700);
}

.file[data-state="failed"] .file-status,
.file[data-state="refused"] .file-status {
  color: var(--error);
}

.file[data-state="failed"] .bar-fill {
  background: var(--steel);
}

.file[data-state="refused"] .file-bar {
  display: none;
}

.file[data-state="refused"] .file-name {
  color: var(--steel);
}

/* ---------- Whole-window drop overlay ---------- */
.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--paper);
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.12s ease, visibility 0s linear 0.12s;
}

.drop-overlay.is-on {
  visibility: visible;
  opacity: 1;
  transition: opacity 0.12s ease;
}

/* The children never take pointer events: see the note in index.html. */
.drop-overlay * {
  pointer-events: none;
}

.drop-frame {
  position: absolute;
  inset: calc(var(--nav-w) / 2);
  border: var(--line-w) solid var(--accent);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  text-align: center;
  color: var(--navy-700);
}

.drop-icon {
  width: 3.5rem;
  height: 3.5rem;
  color: var(--accent);
}

.drop-title {
  font-family: var(--font-display);
  font-size: calc(clamp(2.5rem, 2rem + 3vw, 4.5rem) * 1.08);
  line-height: 1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* ---------- Footer ---------- */
.foot {
  position: relative;
  z-index: 5;
  background: var(--navy-900);
  color: var(--paper);
  font-size: var(--text-sm);
}

.foot-inner {
  max-width: calc(50rem + var(--gutter) * 2);
  margin: 0 auto;
  padding: 2rem var(--gutter) calc(2rem + env(safe-area-inset-bottom));
  display: grid;
  gap: 0.25rem;
}

@media screen and (min-width: 576px) {
  .foot-inner {
    max-width: calc(50rem + var(--nav-w) * 3);
    padding-left: calc(var(--nav-w) * 2);
    padding-right: var(--nav-w);
  }
}

.foot-name {
  color: var(--steel-bright);
  margin-bottom: 0.4rem;
}

.foot a {
  color: var(--accent-bright);
}

.foot :focus-visible {
  outline-color: var(--accent-bright);
}

.foot-small {
  margin-top: 0.6rem;
  color: var(--steel-bright);
}

/* ---------- Small phones ---------- */
@media screen and (max-width: 480px) {
  .file-meta {
    flex-direction: column;
    align-items: flex-end;
    gap: 0;
  }

  .file-status {
    min-width: 0;
  }
}

@media screen and (max-width: 420px) {
  .file {
    grid-template-columns: 1.6rem minmax(0, 1fr) auto 2.5rem;
    column-gap: 0.5rem;
  }

  .file-remove {
    width: 2.5rem;
  }
}

/* ---------- Reduced motion: instant everything ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }
}
