/* The capture page. Self-contained: it is a static file on GitHub Pages and
 * cannot reach the app's stylesheet, so the tokens are declared here. Same
 * scale and palette as the app, kept deliberately in step by eye -- there is
 * no build step to share them, and inventing one for two pages would cost
 * more than it saves.
 *
 * Sized for a thumb. This is opened on a phone, standing in a shop, and is
 * judged on the seconds between opening it and having recorded something --
 * so every control that gets tapped is at least 44px. */

:root {
  --bg: #12141a;
  --panel: #1a1d26;
  --panel-2: #21252f;
  --line: #2c313d;
  --ink: #e8eaf0;
  --ink-dim: #9aa2b4;
  --ink-faint: #6b7387;

  --accent: #6ea8fe;
  --good: #4bbd8a;
  --warn: #e8b04b;
  --bad: #e8695d;

  --text: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;

  --t-small: 11.5px;
  --t-body: 13px;
  --t-mid: 15px;
  --t-big: 26px;
  --t-h1: 20px;
  --t-icon: 17px;

  --tap: 44px;
  --radius: 10px;
  --gap: 12px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }

/* Any rule in this file that sets `display` beats the browser's own
   `[hidden] { display: none }`, because an author rule always beats a user
   agent one. `.progress` did exactly that: the empty progress track was
   drawn under the drop zone before any image was chosen, and setting
   `progress.hidden = true` after a read did nothing at all. This makes the
   attribute mean what it says whatever is declared below. */
[hidden] { display: none !important; }

body {
  background: var(--bg); color: var(--ink);
  font: 400 var(--t-body)/1.5 var(--text);
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}

.top {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: var(--gap); padding: 18px 16px 12px;
  border-bottom: 1px solid var(--line);
}
h1 { margin: 0; font-size: var(--t-h1); font-weight: 600; letter-spacing: -0.2px; }
.sub { margin: 2px 0 0; color: var(--ink-dim); font-size: var(--t-small); font-family: var(--mono); }
.acts { display: flex; gap: 8px; }

.totals {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px; background: var(--line); border-bottom: 1px solid var(--line);
}
.total { background: var(--panel); padding: 11px 16px; }
.total .label {
  display: block; color: var(--ink-dim); font-size: var(--t-small);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.figure {
  display: block; margin-top: 2px;
  font: 500 var(--t-big)/1.2 var(--mono); font-variant-numeric: tabular-nums;
}
.figure.small { font-size: var(--t-mid); color: var(--ink-dim); }

main { padding: var(--gap) 16px 28px; display: grid; gap: var(--gap); }

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px;
}
.card h2 { margin: 0 0 8px; font-size: var(--t-mid); font-weight: 600; }
.cardHead { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.cardHead h2 { margin: 0; }
.hint { margin: 8px 0 0; color: var(--ink-faint); font-size: var(--t-small); }

/* ------------------------------------------------------------ the target */
/* Large on purpose: it is the one action on the page, so it should not look
 * like a form field. */
.drop {
  display: grid; place-items: center; gap: 4px;
  margin-top: 12px; padding: 34px 20px; cursor: pointer; text-align: center;
  background: var(--panel-2); border: 1px dashed var(--line);
  border-radius: var(--radius);
}
.drop:hover, .drop.over { border-color: var(--accent); }
.drop input[type="file"] {
  /* Hidden but reachable: the label wraps it, so a tap or a keyboard
   * activation still opens the picker and it stays in the tab order. */
  position: absolute; width: 1px; height: 1px; opacity: 0;
}
.dropBig { font-size: var(--t-mid); color: var(--ink); }
.dropSmall { color: var(--ink-faint); font-size: var(--t-small); }

.progress { display: grid; gap: 5px; margin-top: 12px; }
.progress .bar { display: block; height: 5px; background: var(--panel-2); border-radius: 3px; overflow: hidden; }
.progress .bar > span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }

/* ----------------------------------------------------------- the reading */
.readingTop { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: start; margin-top: 14px; }
.fields { min-width: 0; }
@media (max-width: 700px) { .readingTop { grid-template-columns: 1fr; } }

.shot { display: block; max-width: 190px; max-height: 260px; border: 1px solid var(--line); border-radius: 8px; }

.needs {
  margin: 0 0 12px; padding: 9px 12px;
  background: #2a2118; border: 1px solid var(--line); border-radius: 7px;
  color: var(--warn); font-size: var(--t-small);
}
.needs p { margin: 0 0 4px; }
.needs p:last-child { margin-bottom: 0; }

.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 10px; }
.row.actions { margin-bottom: 0; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 120px; }
.field.grow { flex: 1 1 200px; }
.field > span {
  color: var(--ink-dim); font-size: var(--t-small);
  text-transform: uppercase; letter-spacing: 0.05em;
}
input {
  min-height: var(--tap); font: 400 var(--t-body) var(--text);
  background: var(--panel-2); color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
}
input[type="date"] { font-family: var(--mono); font-variant-numeric: tabular-nums; }
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

button {
  min-height: var(--tap); padding: 10px 16px; cursor: pointer;
  background: var(--accent); border: 1px solid var(--accent); color: #0d1017;
  border-radius: 8px; font: 600 var(--t-body) var(--text);
}
button.ghost { background: var(--panel-2); border-color: var(--line); color: var(--ink); font-weight: 400; }
button:hover { filter: brightness(1.08); }

.linky {
  min-height: 0; padding: 0; background: none; border: none;
  color: var(--accent); font: inherit; font-weight: 400;
  text-decoration: underline; cursor: pointer;
}

/* ----------------------------------------------------------- the entries */
.entries { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.entries li {
  display: grid; grid-template-columns: 1fr auto auto; gap: 10px;
  align-items: center; padding: 9px 11px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
}
.what { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.when { color: var(--ink-faint); font-size: 10.5px; font-family: var(--mono); }
.much { font: 500 var(--t-body) var(--mono); font-variant-numeric: tabular-nums; }
.iconButton {
  min-height: 34px; min-width: 34px; padding: 0;
  background: none; border: none; color: var(--ink-faint); font-size: var(--t-icon);
}
.iconButton:hover { color: var(--bad); filter: none; }
.empty { color: var(--ink-faint); font-size: var(--t-small); }

/* ----------------------------------------------------------- the notice */
.notice {
  margin: 0; padding: 9px 16px; font-size: var(--t-small);
  background: #2a2118; color: var(--warn); border-bottom: 1px solid var(--line);
}
.notice.good { background: #16281f; color: var(--good); }
.notice.bad { background: #2b1a18; color: var(--bad); }
.notice.warn { background: #2a2118; color: var(--warn); }

.foot {
  display: flex; justify-content: space-between; gap: var(--gap);
  flex-wrap: wrap; padding: 12px 16px 22px; border-top: 1px solid var(--line);
  color: var(--ink-faint); font: 400 var(--t-small) var(--mono);
}
.foot a { color: var(--ink-dim); text-decoration: none; }
.foot a:hover { color: var(--ink); text-decoration: underline; }
