/* The Weigh House: shared components (Task A1 creates the names with empty rules; C2 and C3 fill them).
 * Loaded after tokens.css and before app.css on every page. Parallel tasks edit only their own region. */

/* ==== parts: C2 ==== */
/* Focus: one ring for everything, drawn with a 2 px offset onto ground, iron or wall (never on brass). */
:root :focus-visible { outline: var(--wh-line-3) solid var(--wh-focus); outline-offset: 2px; }

/* Header: the runway girder with the title plate and the brass day oval (C2's component; the girder
   dress from B1). An iron plate girder across the page column, 40 px with its padding: a light flange
   top and bottom, each with a row of rivets (on the flanges, clear of the lettering), an ink edge under
   it. Gradients only (no blur, no image). The crane's crab rides its bottom edge (scene.metrics().topY). */
body:has(> header.wh-header) { padding-top: 0; }
.wh-header {
  position: relative; box-sizing: border-box; height: 40px; min-height: 40px;
  margin: 0 calc(-1 * var(--wh-gutter)); padding: 4px var(--wh-gutter) 5px;
  display: flex; justify-content: space-between; align-items: center;
  background:
    radial-gradient(circle, var(--wh-edge) 0 1px, transparent 1.3px) 3px 0 / 9px 4px repeat-x,
    radial-gradient(circle, var(--wh-edge) 0 1px, transparent 1.3px) 3px calc(100% - 1px) / 9px 4px repeat-x,
    linear-gradient(var(--wh-iron-lt), var(--wh-iron-lt)) top / 100% 4px no-repeat,
    linear-gradient(var(--wh-iron-lt), var(--wh-iron-lt)) bottom 1px left 0 / 100% 4px no-repeat,
    linear-gradient(var(--wh-ink), var(--wh-ink)) bottom / 100% 1px no-repeat,
    var(--wh-web);
  color: var(--wh-text);
}
.wh-header h1 { font: 700 18px/1 var(--wh-font-plate); letter-spacing: .1em; text-transform: uppercase; color: var(--wh-brass-lt); }
.wh-header .pill { background: var(--wh-brass); color: var(--wh-ink); font: 700 15px/1.2 var(--wh-font-plate); letter-spacing: .06em; border: var(--wh-line-2) solid var(--wh-ink); }

/* Riveted iron plate: four rivet heads are hard-stop radial gradients. */
.wh-plate {
  --rivet: radial-gradient(circle, var(--wh-edge) 0 2px, var(--wh-ink) 2.5px 3px, transparent 3.5px);
  position: relative; background-color: var(--wh-iron); color: var(--wh-text);
  background-image: var(--rivet), var(--rivet), var(--rivet), var(--rivet);
  background-size: 8px 8px; background-repeat: no-repeat;
  background-position: 5px 5px, calc(100% - 5px) 5px, 5px calc(100% - 5px), calc(100% - 5px) calc(100% - 5px);
  border: var(--wh-line-2) solid var(--wh-ink); border-radius: var(--wh-r-plate);
  box-shadow: inset 0 var(--wh-line-1) 0 var(--wh-iron-lt);
}
/* Enamel plate: dark ink on enamel, a thin ink rim inside the edge. */
.wh-enamel {
  background-color: var(--wh-enamel); color: var(--wh-enamel-ink);
  border: var(--wh-line-2) solid var(--wh-ink); border-radius: var(--wh-r-plate);
  box-shadow: inset 0 0 0 var(--wh-line-2) var(--wh-enamel), inset 0 0 0 3px var(--wh-enamel-mute);
}
/* Brass strip: ink lettering (5.91:1). */
.wh-brass {
  background-color: var(--wh-brass); color: var(--wh-ink);
  font-family: var(--wh-font-plate); font-weight: 700; letter-spacing: .04em;
  border: var(--wh-line-2) solid var(--wh-ink); border-radius: var(--wh-r-plate);
  box-shadow: inset 0 var(--wh-line-1) 0 var(--wh-brass-lt);
}
/* Inspection tag: enamel with a dashed border and a string hole. Shown, not scored: no brass, no rivets. */
.wh-tag {
  position: relative; background-color: var(--wh-enamel); color: var(--wh-enamel-ink);
  border: var(--wh-line-2) dashed var(--wh-edge); border-radius: var(--wh-r-plate);
  background-image: radial-gradient(circle, var(--wh-ground) 0 3px, var(--wh-enamel-mute) 3.5px 5px, transparent 5.5px);
  background-size: 14px 14px; background-repeat: no-repeat; background-position: calc(100% - 8px) 8px;
}

/* Push plate: brass, ink lettering, at least 48 px tall. */
.wh-btn {
  display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 6px 16px;
  background-color: var(--wh-brass); color: var(--wh-ink);
  font-family: var(--wh-font-plate); font-weight: 700; font-size: 20px; line-height: 1.1; letter-spacing: .06em; text-transform: uppercase; text-decoration: none;
  border: var(--wh-line-2) solid var(--wh-ink); border-radius: var(--wh-r-btn); cursor: pointer;
  box-shadow: inset 0 var(--wh-line-2) 0 var(--wh-brass-lt), 0 var(--wh-line-3) 0 var(--wh-ink);
}
.wh-btn:active:not(:disabled) { transform: translateY(2px); box-shadow: inset 0 var(--wh-line-2) 0 var(--wh-brass-lt), 0 1px 0 var(--wh-ink); }
.wh-btn:disabled { background-color: var(--wh-iron); color: var(--wh-mute); box-shadow: 0 var(--wh-line-3) 0 var(--wh-ink); cursor: default; }
.wh-btn[aria-busy="true"] { cursor: progress; background-image: repeating-linear-gradient(135deg, transparent 0 8px, #0000001f 8px 16px); }
.wh-btn--iron { background-color: var(--wh-iron); color: var(--wh-brass-lt); border-color: var(--wh-brass); box-shadow: inset 0 var(--wh-line-1) 0 var(--wh-iron-lt), 0 var(--wh-line-3) 0 var(--wh-ink); }
.wh-btn--iron:disabled { color: var(--wh-mute); border-color: var(--wh-edge); }

/* Counter wheels: one digit per drum window, drawn by the background of one tabular number. The text is
 * the number. Cell = 1ch + the letter-spacing; the first glyph is indented half a spacing so each digit
 * sits centred in its window. */
.wh-wheels {
  --ls: .14em; --cell: calc(1ch + var(--ls));
  display: inline-block; padding: 2px 0; color: var(--wh-text);
  font-family: var(--wh-font-plate); font-weight: 700; font-variant-numeric: tabular-nums;
  letter-spacing: var(--ls); text-indent: calc(var(--ls) / 2); line-height: 1.05; white-space: nowrap;
  background-image:
    repeating-linear-gradient(90deg, transparent 0 calc(var(--cell) - 2px), var(--wh-ink) calc(var(--cell) - 2px) var(--cell)),
    linear-gradient(180deg, var(--wh-ink) 0, var(--wh-seam) 22%, var(--wh-iron) 50%, var(--wh-seam) 78%, var(--wh-ink) 100%);
  border: var(--wh-line-2) solid var(--wh-ink); border-radius: 3px;
  box-shadow: 0 0 0 var(--wh-line-2) var(--wh-brass);
}
@keyframes wh-roll { from { transform: translateY(-110%); } to { transform: none; } }

/* Status plate for role="status" texts. */
.wh-notice {
  margin: 6px 0; padding: 8px 12px; background-color: var(--wh-wall); color: var(--wh-text);
  border: var(--wh-line-1) solid var(--wh-seam); border-left: 6px solid var(--wh-brass); border-radius: var(--wh-r-plate);
  font: 15px/1.35 var(--wh-font-body); text-align: left; overflow-wrap: anywhere;
}

/* A notice on enamel (the boot-failure plate): same shape, enamel face, brass bar. */
.wh-notice.wh-enamel { background-color: var(--wh-enamel); color: var(--wh-enamel-ink); border: var(--wh-line-2) solid var(--wh-ink); border-left: 6px solid var(--wh-brass); box-shadow: none; }

/* Text field on an enamel plate. */
.wh-input {
  display: block; width: 100%; min-height: 48px; padding: 6px 12px; font: 18px/1.2 var(--wh-font-body);
  background-color: var(--wh-enamel); color: var(--wh-enamel-ink); border: var(--wh-line-2) solid var(--wh-ink); border-radius: var(--wh-r-plate);
  box-shadow: inset 0 var(--wh-line-2) 0 var(--wh-edge);
}
.wh-input::placeholder { color: var(--wh-enamel-mute); opacity: 1; }

/* Ledger table; it scrolls sideways inside its wrap, never the page. */
.wh-table-wrap { overflow-x: auto; max-width: 100%; border: var(--wh-line-2) solid var(--wh-ink); border-radius: var(--wh-r-plate); background-color: var(--wh-iron); }
.wh-table { width: 100%; border-collapse: collapse; color: var(--wh-text); font-variant-numeric: tabular-nums; }
.wh-table th { font-family: var(--wh-font-plate); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; text-align: left; color: var(--wh-brass-lt); background-color: var(--wh-web); }
.wh-table th, .wh-table td { padding: 8px 10px; border-bottom: var(--wh-line-1) solid var(--wh-seam); }
.wh-table tr:last-child td { border-bottom: 0; }

/* ==== parts: C3 doc ==== */
/* Long-text page (privacy now, leaderboard pages later): a reading column of at most 68ch on the ground,
   body text on dark, headings engraved in the plate face. Plain flat surfaces; no effects. */
.wh-doc { max-width: 68ch; margin: 0 auto; padding: 8px 0 8px; color: var(--wh-text); font: 16px/1.5 var(--wh-font-body); overflow-wrap: break-word; }
.wh-doc h2 {
  margin: 28px 0 8px; padding-bottom: 4px; border-bottom: var(--wh-line-2) solid var(--wh-seam);
  font: 700 19px/1.2 var(--wh-font-plate); letter-spacing: .12em; text-transform: uppercase; color: var(--wh-brass-lt);
}
.wh-doc h2.doc-title { margin-top: 14px; font-size: 28px; letter-spacing: .1em; }
.wh-doc p { margin: 8px 0; }
.wh-doc ul { margin: 8px 0; padding-left: 22px; }
.wh-doc li { margin: 6px 0; }
.wh-doc strong { color: var(--wh-text); font-weight: 700; }
.wh-doc a { color: var(--wh-brass-lt); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: var(--wh-line-2); }
.wh-doc code { font: .88em/1.3 ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; background-color: var(--wh-wall); color: var(--wh-brass-lt); border: var(--wh-line-1) solid var(--wh-seam); border-radius: 3px; padding: 0 4px; overflow-wrap: anywhere; }
.wh-doc .updated { margin: 4px 0 14px; font-size: 14px; color: var(--wh-mute); }
.wh-doc .wh-table-wrap { margin: 10px 0; }
.wh-doc .wh-table { font-size: 15px; line-height: 1.4; }
.wh-doc .wh-table th, .wh-doc .wh-table td { vertical-align: top; text-align: left; }
.wh-doc .wh-table th { font-size: 15px; }
.wh-doc .wh-table { table-layout: fixed; }
.wh-doc .wh-table th:first-child, .wh-doc .wh-table td:first-child { width: 34%; }
.wh-doc .wh-table td:first-child code { font-size: .8em; }
.wh-doc .wh-table code { background-color: var(--wh-ground); }
/* A placeholder the owner still has to fill in: an enamel tag, so it cannot pass for text. */
.wh-doc .todo { background-color: var(--wh-enamel); color: var(--wh-enamel-ink); border: var(--wh-line-1) dashed var(--wh-enamel-mute); border-radius: 3px; padding: 0 5px; font-weight: 700; }
.wh-doc .doc-back { margin-top: 28px; padding-top: 12px; border-top: var(--wh-line-2) solid var(--wh-seam); }
/* The "Delete my results" control (delete.js) sits on an iron plate when the page mounts it. */
.wh-doc #delete-results-slot { margin: 12px 0; }
.wh-doc #delete-status:empty { display: none; }
/* The title in the header is a link back to the game, without the link look. */
.wh-header h1 a { color: inherit; text-decoration: none; }
