/* New Monsoon: title-card world. One cobalt field, ink, paper, and shapes that look cut.
   Yellow is reserved for the single active thing; vermilion only for destructive/blocked. */

@font-face {
  font-family: "Monsoon Display";
  src: url("/fonts/big-shoulders-display-latin-800-normal.woff2") format("woff2");
  font-weight: 800;
  font-display: swap;
}
@font-face {
  font-family: "Monsoon Display";
  src: url("/fonts/big-shoulders-display-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

:root {
  color-scheme: light;
  --field: #1d35c9;
  --field-deep: #13258f;
  --on-field: #ffffff;
  --on-field-soft: #d3daff;
  --paper: #eef0f4;
  --sheet: #ffffff;
  --ink: #0f1115;
  --muted: #4b5266;
  --line: rgb(15 17 21 / .13);
  --line-strong: rgb(15 17 21 / .32);
  --tint: rgb(29 53 201 / .06);
  --active: #ffd21a;
  --on-active: #0f1115;
  --danger: #c3311b;
  --on-danger: #ffffff;
  --focus: var(--field);
  --lift: 0 22px 44px -22px rgb(15 17 21 / .42), 0 3px 10px -4px rgb(15 17 21 / .16);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --display: "Monsoon Display", "Arial Narrow", sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --field: #2742e0;
    --field-deep: #1a2fa8;
    --on-field-soft: #d9dfff;
    --paper: #0c0e13;
    --sheet: #151922;
    --ink: #eceff6;
    --muted: #a5adc0;
    --line: rgb(236 239 246 / .12);
    --line-strong: rgb(236 239 246 / .3);
    --tint: rgb(120 140 255 / .08);
    --danger: #c3311b;
    --focus: #8fa2ff;
    --lift: 0 26px 50px -24px rgb(0 0 0 / .8), 0 3px 10px -4px rgb(0 0 0 / .5);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--paper); color: var(--ink);
  font: 16px/1.5 var(--body); caret-color: var(--field);
  scrollbar-color: var(--line-strong) transparent;
}
::selection { background: var(--active); color: var(--on-active); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.on-field { --focus: var(--active); }

h1, h2, .display {
  font-family: var(--display); font-weight: 800; text-transform: uppercase;
  letter-spacing: .01em; line-height: .9; margin: 0; text-wrap: balance;
}

/* ---------- controls ---------- */
button {
  font: 600 .95rem/1.2 var(--body); letter-spacing: .01em; cursor: pointer;
  border: 0; border-radius: 0; padding: 11px 18px;
  background: var(--ink); color: var(--paper);
  transition: background-color .18s var(--ease-out), color .18s var(--ease-out), transform .18s var(--ease-out);
}
button:hover { background: var(--field); color: var(--on-field); }
button:active { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
button.secondary { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line-strong); }
button.secondary:hover { background: var(--ink); color: var(--paper); box-shadow: none; }
button.danger { background: var(--danger); color: var(--on-danger); }
button.danger:hover { background: var(--ink); color: var(--paper); }

input:not([type="checkbox"]), select, textarea {
  display: block; width: 100%; margin-top: 6px; padding: 11px 12px;
  font: inherit; color: var(--ink); background: var(--sheet);
  border: 0; border-radius: 0; box-shadow: inset 0 0 0 1.5px var(--line-strong);
}
input:not([type="checkbox"]):hover, select:hover, textarea:hover { box-shadow: inset 0 0 0 1.5px var(--ink); }
input:not([type="checkbox"]):focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none; box-shadow: inset 0 0 0 2.5px var(--field);
}
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--field); }
::placeholder { color: var(--muted); opacity: 1; }

.error { color: var(--danger); min-height: 1.5em; margin: 10px 0 0; font-weight: 600; }
@media (prefers-color-scheme: dark) { .error { color: #ff7a63; } }
.hint { color: var(--muted); font-size: .9rem; }

/* ---------- shared pieces ---------- */
.wordmark {
  font-family: var(--display); font-weight: 800; font-size: 1.15rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--on-field); line-height: 1; white-space: nowrap;
}
.wordmark i { font-style: normal; color: var(--on-field-soft); }

/* The cobalt plane: a cut sheet of colour with a diagonal edge. */
.field-plane {
  position: relative; background: var(--field); color: var(--on-field);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 7vw), 0 100%);
  animation: cut-in .9s var(--ease-out) both;
}
@keyframes cut-in {
  from { clip-path: polygon(0 0, 100% 0, 100% 0, 0 0); }
  to { clip-path: polygon(0 0, 100% 0, 100% calc(100% - 7vw), 0 100%); }
}
.sheet {
  position: relative; background: var(--sheet); box-shadow: var(--lift);
  animation: wipe-down .8s var(--ease-out) .15s both;
}
/* The title-card wipe: a sheet is revealed top to bottom, like a card sliding into frame. */
@keyframes wipe-down { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(-80px); } }
@media (prefers-reduced-motion: reduce) {
  .field-plane, .sheet { animation: none; }
  button { transition: none; }
}

/* ---------- upload page ---------- */
.page-upload .field-plane { padding: 28px clamp(16px, 5vw, 64px) calc(9vw + 120px); }
.page-upload .hero-copy { max-width: 728px; margin: 0 auto; }
.page-upload .field-plane h1 { font-size: clamp(3.6rem, 11vw, 7.2rem); margin-top: clamp(28px, 6vh, 64px); }
.page-upload .lede { max-width: 34ch; margin: 18px 0 0; color: var(--on-field-soft); font-size: 1.05rem; }
.page-upload main { max-width: 760px; margin: -150px auto 64px; padding: 0 16px; position: relative; }

#gate.sheet, #uploader.sheet { padding: clamp(20px, 4vw, 36px); }
#gate p { margin: 0 0 14px; }
#gate button { margin-top: 14px; width: 100%; padding: 14px; }

#drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 220px; padding: 28px; text-align: center; cursor: pointer;
  background: var(--tint); box-shadow: inset 0 0 0 2px var(--line-strong);
  transition: background-color .2s var(--ease-out), box-shadow .2s var(--ease-out);
}
#drop svg { width: 46px; height: 46px; color: var(--field); margin-bottom: 6px; }
#drop strong { font-family: var(--display); font-weight: 800; font-size: 2rem; text-transform: uppercase; line-height: 1; }
#drop span { color: var(--muted); }
#drop:hover { box-shadow: inset 0 0 0 2px var(--ink); }
#drop.over { background: var(--field); color: var(--on-field); box-shadow: none; }
#drop.over svg, #drop.over span { color: var(--on-field); }
#drop:focus-within { box-shadow: inset 0 0 0 3px var(--field); }
#picker, #folder-picker { position: absolute; width: 1px; height: 1px; opacity: 0; }
#choose-folder { margin-top: 10px; width: 100%; }

#summary { margin: 22px 0 10px; font-weight: 700; min-height: 1.5em; font-variant-numeric: tabular-nums; }
#files { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; background: var(--line); box-shadow: 0 0 0 1px var(--line); }
#files li { background: var(--sheet); padding: 12px 14px; }
.row { display: flex; gap: 12px; align-items: baseline; justify-content: space-between; }
.name { overflow-wrap: anywhere; }
.state { color: var(--muted); white-space: nowrap; font-size: .88rem; font-weight: 600; font-variant-numeric: tabular-nums; }
li.done .state { color: var(--ink); font-weight: 700; }
li.failed .state { color: var(--danger); }
@media (prefers-color-scheme: dark) { li.failed .state { color: #ff7a63; } }

/* Progress: a solid yellow bar with a cut end, on an ink track. */
progress {
  display: block; width: 100%; height: 8px; margin-top: 10px; border: 0; border-radius: 0;
  appearance: none; -webkit-appearance: none; background: var(--line); color: var(--active);
}
progress::-webkit-progress-bar { background: var(--line); }
progress::-webkit-progress-value { background: var(--active); clip-path: polygon(0 0, 100% 0, calc(100% - 6px) 100%, 0 100%); }
progress::-moz-progress-bar { background: var(--active); }
li.done progress::-webkit-progress-value { background: var(--ink); clip-path: none; }
li.done progress::-moz-progress-bar { background: var(--ink); }
.actions { margin-top: 10px; display: flex; gap: 8px; }
.actions button { padding: 6px 12px; font-size: .85rem; }
#files .actions button { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line-strong); }
#files .actions button:hover { background: var(--ink); color: var(--paper); box-shadow: none; }
.page-upload .hint { margin: 18px 0 0; }
