/* The drawing sheet, shared by every page that is not the takeoff itself.
 *
 * The app is laid out like a drawing: a title block, condensed uppercase
 * labels, tabular figures, red markup for anything that needs a decision. The
 * sign-in, account and administration pages were built to a different house
 * style and looked like a different product bolted on the front. These are the
 * same tokens the takeoff page uses, so the front door is the cover sheet of
 * the same set.
 *
 * Light and dark both, because the takeoff page already does and a person who
 * has their machine in dark mode should not be flashbanged on the way in.
 */
:root {
  --paper:#EFF0F2; --sheet:#FFFFFF; --sunk:#E7E9EC;
  --ink:#12161C; --muted:#5A6472; --faint:#8B95A2;
  --rule:#D2D6DC; --rule-strong:#AAB2BC;
  --markup:#BE3428; --markup-soft:#F3DCD9;
  --blueprint:#2C5D8F; --blueprint-soft:#DCE6F1;
  --ok:#2E7350; --ok-soft:#DCEBE2; --warn:#9A6412; --warn-soft:#F5E9D6;
  --field:#FFFFFF; --field-line:#C3C9D1;
  --shadow:0 1px 2px rgba(18,22,28,.06),0 4px 14px rgba(18,22,28,.05);
  --sans:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  --cond:"Arial Narrow","Helvetica Neue Condensed","Liberation Sans Narrow","Roboto Condensed",var(--sans);
  --mono:ui-monospace,"SF Mono",SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace;
  /* Softened corners. Kept modest -- a drawing sheet with a 24px radius stops
   * reading as a sheet -- and shared with the takeoff page so one change moves
   * the whole site. */
  --r-sheet:12px; --r-field:7px; --r-btn:7px;
  --grid:24px;
}
@media (prefers-color-scheme:dark){
  :root:not([data-theme="light"]){
    --paper:#101318; --sheet:#171B21; --sunk:#1D222A;
    --ink:#E6E9ED; --muted:#939CA8; --faint:#6E7885;
    --rule:#2A303A; --rule-strong:#3B4350;
    --markup:#E1584B; --markup-soft:#3A2320;
    --blueprint:#74A6DC; --blueprint-soft:#1C2A3A;
    --ok:#5CB98A; --ok-soft:#17291F; --warn:#D3A050; --warn-soft:#2E2415;
    --field:#12161C; --field-line:#39414D;
    --shadow:0 1px 2px rgba(0,0,0,.4),0 4px 14px rgba(0,0,0,.3);
  }
}
:root[data-theme="dark"]{
  --paper:#101318; --sheet:#171B21; --sunk:#1D222A;
  --ink:#E6E9ED; --muted:#939CA8; --faint:#6E7885;
  --rule:#2A303A; --rule-strong:#3B4350;
  --markup:#E1584B; --markup-soft:#3A2320;
  --blueprint:#74A6DC; --blueprint-soft:#1C2A3A;
  --ok:#5CB98A; --ok-soft:#17291F; --warn:#D3A050; --warn-soft:#2E2415;
  --field:#12161C; --field-line:#39414D;
  --shadow:0 1px 2px rgba(0,0,0,.4),0 4px 14px rgba(0,0,0,.3);
}

*{box-sizing:border-box}
html,body{margin:0}
body{
  background:var(--paper);color:var(--ink);font-family:var(--sans);
  font-size:15px;line-height:1.5;-webkit-font-smoothing:antialiased;
  min-height:100vh;
  /* Graph paper. Faint enough to read over, present enough to be a drawing. */
  background-image:
    linear-gradient(var(--rule) 1px, transparent 1px),
    linear-gradient(90deg, var(--rule) 1px, transparent 1px);
  background-size:var(--grid) var(--grid), var(--grid) var(--grid);
  background-position:-1px -1px, -1px -1px;
}
@media (prefers-color-scheme:dark){body{background-blend-mode:soft-light}}
button,input,select{font:inherit}
button{cursor:pointer}

/* ---------- the sheet ---------- */
.sheetwrap{max-width:1180px;margin:0 auto;padding:26px 20px 60px}
.sheetwrap.narrow{max-width:720px}
.sheet{
  background:var(--sheet);border:1.5px solid var(--rule-strong);
  box-shadow:var(--shadow);margin-bottom:18px;
  border-radius:var(--r-sheet);
  /* The header rule and the cell dividers run to the edge; without this they
   * cut across the rounded corner. */
  overflow:hidden;
}
.sheet-top{
  display:flex;justify-content:space-between;align-items:flex-end;gap:20px;
  padding:16px 18px 12px;border-bottom:1px solid var(--rule);flex-wrap:wrap;
}
.sheet-name{
  font-family:var(--cond);font-size:30px;font-weight:700;letter-spacing:.02em;
  line-height:1.05;margin:0;
}
.sheet-sub{color:var(--muted);font-size:13px;margin-top:3px}
.sheetno{font-family:var(--cond);text-align:right;line-height:1.15}
.sheetno b{display:block;font-size:26px;letter-spacing:.06em}
.sheetno .lab{font-family:var(--cond);font-size:10.5px;font-weight:700;
  letter-spacing:.14em;text-transform:uppercase;color:var(--faint);display:block}
.sheet-body{padding:18px}
.sheet-cells{display:grid;grid-template-columns:repeat(auto-fit,minmax(122px,1fr));
  border-top:1px solid var(--rule)}
.sheet-cells .cell{padding:9px 14px;border-right:1px solid var(--rule)}
.sheet-cells .cell:last-child{border-right:0}
.lab{font-family:var(--cond);font-size:10.5px;font-weight:700;letter-spacing:.14em;
  text-transform:uppercase;color:var(--faint);display:block;margin-bottom:2px}
.val{font-family:var(--mono);font-size:13px;font-variant-numeric:tabular-nums}

/* ---------- headings ---------- */
.ptitle{font-family:var(--cond);font-size:14px;font-weight:700;letter-spacing:.15em;
  text-transform:uppercase;margin:0}
.phead{display:flex;align-items:baseline;justify-content:space-between;gap:14px;
  padding:11px 16px;border-bottom:1px solid var(--rule);flex-wrap:wrap}
h2.card-title{font-family:var(--cond);font-size:23px;font-weight:700;
  letter-spacing:.03em;margin:0 0 5px;text-transform:uppercase}
.card-sub{color:var(--muted);font-size:13.5px;line-height:1.55;margin:0 0 16px;
  max-width:62ch}

/* ---------- fields ---------- */
.field-label{font-family:var(--cond);font-size:10.5px;font-weight:700;
  letter-spacing:.14em;text-transform:uppercase;color:var(--faint);
  display:block;margin:14px 0 5px}
.tinput{
  width:100%;font:inherit;font-size:14px;padding:9px 11px;
  background:var(--field);color:var(--ink);
  border:1px solid var(--field-line);border-radius:var(--r-field);
}
.tinput:focus{outline:2px solid var(--ink);outline-offset:-1px}
.tinput::placeholder{color:var(--faint)}
select.tinput{cursor:pointer}
.hint{font-size:11.5px;color:var(--faint);margin-top:5px;line-height:1.45}

/* ---------- buttons ---------- */
button, .btn{
  font-family:var(--cond);font-size:12px;font-weight:700;letter-spacing:.11em;
  text-transform:uppercase;padding:8px 15px;cursor:pointer;border-radius:var(--r-btn);
  background:var(--sheet);color:var(--ink);border:1px solid var(--rule-strong);
  text-decoration:none;display:inline-block;
}
button:hover, .btn:hover{background:var(--sunk)}
button.pri, .btn.pri{background:var(--markup);border-color:var(--markup);color:#fff}
button.pri:hover{filter:brightness(1.08)}
button.danger{color:var(--markup);border-color:var(--markup)}
button:disabled{opacity:.5;cursor:not-allowed}
.btnrow{display:flex;gap:9px;flex-wrap:wrap;align-items:center}
.wide{width:100%;margin-top:16px;padding:11px 15px;font-size:13px}
a:focus-visible,button:focus-visible,input:focus-visible{
  outline:2px solid var(--markup);outline-offset:1px}

/* ---------- banners ---------- */
.banner{padding:11px 14px;border-radius:var(--r-field);font-size:13.5px;line-height:1.5;
  margin-bottom:14px;border:1px solid}
.banner.err{background:var(--markup-soft);border-color:var(--markup);color:var(--markup);
  font-weight:600}
.banner.ok{background:var(--ok-soft);border-color:var(--ok);color:var(--ok);font-weight:600}
.banner.warn{background:var(--warn-soft);border-color:var(--warn);color:var(--warn);
  font-weight:600}
.note{
  margin-top:16px;padding:12px 14px;background:var(--sunk);
  border-left:3px solid var(--blueprint);border-radius:var(--r-field);
  font-size:12.5px;line-height:1.55;
  color:var(--muted);
}
.note strong{color:var(--ink)}

/* ---------- tabs, drawn as sheet tabs ---------- */
.tabs{display:flex;gap:0;border-bottom:1px solid var(--rule-strong);margin-bottom:4px}
.tabs button{
  border:1px solid transparent;border-bottom:0;margin-bottom:-1px;
  border-radius:var(--r-field) var(--r-field) 0 0;
  background:transparent;color:var(--muted);padding:9px 16px;
}
.tabs button:hover{background:var(--sunk)}
.tabs button.on{
  background:var(--sheet);border-color:var(--rule-strong);color:var(--ink);
  border-bottom:1px solid var(--sheet);
}

/* ---------- top bar ---------- */
.topbar{display:flex;align-items:center;gap:14px;flex-wrap:wrap;margin-bottom:16px}
.wordmark{font-family:var(--cond);font-size:19px;font-weight:700;letter-spacing:.1em;
  text-transform:uppercase}
.wordmark span{color:var(--markup)}
.topbar .spacer{margin-left:auto}
.who{font-family:var(--cond);font-size:11px;letter-spacing:.1em;text-transform:uppercase;
  color:var(--faint)}
.topbar .btn, .topbar button{padding:6px 12px;font-size:11px}

/* ---------- tables ---------- */
table{border-collapse:collapse;width:100%;font-size:13.5px}
th{font-family:var(--cond);font-size:10.5px;font-weight:700;letter-spacing:.13em;
  text-transform:uppercase;color:var(--faint);text-align:left;padding:8px 10px;
  border-bottom:1px solid var(--rule-strong);white-space:nowrap}
td{padding:8px 10px;border-bottom:1px solid var(--rule);text-align:left}
tbody tr:last-child td{border-bottom:0}
tbody tr:hover{background:var(--sunk)}
.pill{font-family:var(--cond);font-size:10px;font-weight:700;letter-spacing:.1em;
  text-transform:uppercase;padding:2px 7px;border-radius:999px;white-space:nowrap;
  background:var(--sunk);color:var(--faint);display:inline-block}
.pill.admin{background:var(--blueprint-soft);color:var(--blueprint)}
.pill.suspended{background:var(--markup-soft);color:var(--markup)}
.pill.you{background:var(--ok-soft);color:var(--ok)}
.mono{font-family:var(--mono);font-size:12.5px}

.grid2{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:0 18px}
@media (max-width:720px){.grid2{grid-template-columns:minmax(0,1fr)}}
.hidden{display:none !important}
code{font-family:var(--mono);font-size:12.5px;background:var(--sunk);
  padding:3px 7px;border-radius:var(--r-field);word-break:break-all;display:inline-block;
  border:1px solid var(--rule)}



/* ---------- the crew on the graph paper ----------
 *
 * A facade scaffold going up against a building behind the page, slowly, and
 * coming down again. Meant to be noticed once and then ignored, so everything
 * here is tuned toward "texture" and away from "animation": low contrast,
 * long durations, no motion fast enough to catch the eye while somebody is
 * reading a number off a quote.
 *
 * z-index -1 is the whole clipping strategy. The .sheet cards are opaque, so
 * they cover this completely and it survives only in the gutters -- the grid
 * area. Nothing here needs to know where the content is.
 *
 * The weight hierarchy is doing as much work as the geometry. The building is
 * faintest, the inner row of standards sits behind the outer, and the crew is
 * the darkest thing on the layer -- which is how depth reads at this opacity
 * without a single gradient.
 *
 * The split between `sw-raise` and `sw-fade` is not cosmetic. A CSS transform
 * animation overrides an element's SVG transform attribute, so anything that
 * has been *placed* -- every worker, the load on the rope -- may only be
 * animated on opacity, and gets a nested group when it needs to move. Members
 * are bare lines with no placement of their own, so they can also settle into
 * position. Mixing the two drops the crew to the origin, silently.
 */
#sitework{
  position:fixed;
  inset:0;
  z-index:-1;
  width:100%;
  height:100%;
  pointer-events:none;
  /* Has to lose to body text at every size. The same alpha reads much
   * stronger on the dark theme, so it is dialled back there. */
  opacity:.52;
  color:var(--ink-3);
}
@media (prefers-color-scheme:dark){
  :root:not([data-theme="light"]) #sitework{opacity:.34}
}
:root[data-theme="dark"] #sitework{opacity:.34}

#sitework line,#sitework circle,#sitework rect,#sitework path{
  stroke:currentColor;
  fill:none;
  stroke-linecap:round;
  vector-effect:non-scaling-stroke;
}
/* A hard hat is a filled dome; a ponytail is an open curve and must stay
 * stroked, or it renders as a blob beside the head. */
#sitework .sw-hat{fill:currentColor;stroke:none}
#sitework .sw-hair{fill:none;stroke:currentColor}

/* -- the building. Faintest thing here, and it never animates: a building
 *    does not get built while you watch. -------------------------------- */
.sw-site{opacity:.42}
.sw-wall{stroke-width:1}
.sw-parapet{stroke-width:1.6}
.sw-window{stroke-width:.9;opacity:.7}
.sw-ground{stroke-width:1.2;opacity:.8}

/* -- the scaffold ------------------------------------------------------- */
.sw-standard{stroke-width:1.7}
.sw-ledger{stroke-width:1.3}
.sw-transom{stroke-width:1;opacity:.75}
/* The inner row is behind the outer one. Lightening it is the whole depth
 * cue -- there is no perspective here, only weight. */
.sw-inner{opacity:.45;stroke-width:1.1}
.sw-deck{stroke-width:2.8;opacity:.68}
.sw-toeboard{stroke-width:1.8;opacity:.55}
.sw-guardrail{stroke-width:1.1;opacity:.7}
.sw-midrail{opacity:.5}
.sw-post{stroke-width:1.1;opacity:.6}
.sw-brace{stroke-width:.95;opacity:.5}
.sw-tie{stroke-width:1.2;opacity:.65}
.sw-tieplate{stroke-width:.9;opacity:.55}
.sw-baseplate{stroke-width:2.2;opacity:.7}
.sw-soleboard{stroke-width:1.6;opacity:.45}
.sw-stile{stroke-width:1.3;opacity:.7}
.sw-rung{stroke-width:1;opacity:.6}
.sw-jib{stroke-width:1.6}
.sw-wheel{stroke-width:1.3}
.sw-rope{stroke-width:.8;opacity:.55}
.sw-bundle{stroke-width:2.4;opacity:.8}
.sw-sling{stroke-width:.8;opacity:.6}
.sw-tube{stroke-width:1.6;opacity:.75}

/* -- the crew. Darkest on the layer, so they read in front of the steel. -- */
.sw-crew,.sw-walk-1,.sw-walk-2{opacity:1}
#sitework .sw-body line,#sitework .sw-body circle{stroke-width:1.9}
#sitework .sw-vest{stroke-width:1.2;opacity:.55}

/* One long cycle: the structure goes up, stands a while, comes down. The
 * per-member delay is derived in app.js from the actual member count, so
 * adding detail can never push the last piece past the end of the loop. */
#sitework .sw-member{
  animation:sw-raise 108s cubic-bezier(.22,.61,.36,1) infinite both;
}
@keyframes sw-raise{
  0%  {opacity:0; transform:translateY(10px)}
  5%  {opacity:1; transform:translateY(0)}
  78% {opacity:1; transform:translateY(0)}
  90% {opacity:0; transform:translateY(10px)}
  100%{opacity:0; transform:translateY(10px)}
}

/* Placed elements. Opacity only -- see the note at the top. */
#sitework .sw-worker{animation:sw-fade 108s ease-in-out infinite both}
@keyframes sw-fade{
  0%{opacity:0} 6%{opacity:1} 76%{opacity:1} 88%{opacity:0} 100%{opacity:0}
}

/* Material coming up on the gin wheel: rises, hangs at the top lift while it
 * is landed, then the rope goes back down empty. */
#sitework .sw-load{
  transform-box:fill-box;
  animation:sw-hoist 34s cubic-bezier(.4,0,.5,1) infinite both;
}
@keyframes sw-hoist{
  0%  {transform:translateY(0);    opacity:0}
  6%  {transform:translateY(0);    opacity:1}
  46% {transform:translateY(-470px); opacity:1}
  62% {transform:translateY(-470px); opacity:1}
  70% {transform:translateY(-470px); opacity:0}
  100%{transform:translateY(0);    opacity:0}
}

/* Arms. Small, slow, and out of phase between crew members so they never move
 * in unison -- four people nodding together reads as a machine. */
#sitework .sw-arms{
  transform-box:fill-box;
  transform-origin:0 0;
  animation:sw-work 5.4s ease-in-out infinite alternate;
}
@keyframes sw-work{
  from{transform:rotate(-7deg)} to{transform:rotate(6deg)}
}
/* Walking arms swing further and faster, against the legs. */
#sitework .sw-arms-walk{animation:sw-swing 1.15s ease-in-out infinite alternate}
@keyframes sw-swing{
  from{transform:rotate(-13deg)} to{transform:rotate(13deg)}
}

/* The walk. Legs are drawn as plain verticals and get their stride entirely
 * from this rotation, which is the only way the pivot stays at the hip -- a
 * leg drawn already-angled rotates about the wrong point and skates. The
 * negative delay on the second leg puts it half a stride out. */
#sitework .sw-leg{
  transform-box:fill-box;
  transform-origin:0 0;
  animation:sw-step 1.15s ease-in-out infinite alternate;
}
#sitework .sw-leg-b{animation-delay:-1.15s}
@keyframes sw-step{
  from{transform:rotate(-19deg)} to{transform:rotate(19deg)}
}
/* And the body rises and falls twice per stride, which is what stops a
 * walking figure looking like it is on rails. */
#sitework .sw-walk-1 .sw-body,
#sitework .sw-walk-2 .sw-body{
  animation:sw-bob .575s ease-in-out infinite alternate;
}
@keyframes sw-bob{
  from{transform:translateY(0)} to{transform:translateY(-1.6px)}
}

/* Two crossing the site with tube. Slow enough to be scenery: a full crossing
 * takes over two minutes. Both animations are declared together so the
 * pairing of name to duration cannot drift -- `sw-cross` is last, so it owns
 * `transform` while `sw-fade` owns `opacity`. */
.sw-walk-1{
  animation:sw-fade 108s ease-in-out infinite both,
            sw-cross-1 146s linear infinite both;
}
.sw-walk-2{
  animation:sw-fade 108s ease-in-out infinite both,
            sw-cross-2 168s linear infinite both;
  animation-delay:0s,-58s;
}
@keyframes sw-cross-1{
  from{transform:translateX(-170px)} to{transform:translateX(1780px)}
}
@keyframes sw-cross-2{
  from{transform:translateX(1780px)} to{transform:translateX(-170px)}
}

/* Ambient movement behind text is exactly what this setting is for. The
 * scaffold still stands -- it is part of the page's furniture -- it simply
 * stops being built. */
@media (prefers-reduced-motion:reduce){
  #sitework .sw-member,
  #sitework .sw-worker,
  #sitework .sw-arms,
  #sitework .sw-leg,
  #sitework .sw-body,
  #sitework .sw-load,
  #sitework .sw-walk-1,
  #sitework .sw-walk-2{
    animation:none !important;
    opacity:1;
    transform:none;
  }
  #sitework .sw-walk-2{transform:translateX(1180px)}
  #sitework .sw-load{transform:translateY(-470px)}
  #sitework .sw-inner{opacity:.45}
  #sitework .sw-brace{opacity:.5}
  #sitework .sw-deck{opacity:.68}
}

/* Below this the sheet fills the viewport, so there is no grid left to draw
 * on and the layer is a cost with no benefit. */
@media (max-width:900px){#sitework{display:none}}

/* Printing a quote must not print scaffolding across it. */
@media print{#sitework{display:none}}

/* ---------- the logo slot ----------
 *
 * A placeholder for the customer's mark, on the graph paper beside the
 * content. Positioned against the measured left edge of the page's shell --
 * see app.js -- because that edge moves: the quote builder runs to 1400px and
 * the archive to 1320 where most pages stop at 1180, so a fixed offset that
 * cleared the gutter on one page would land on the first card of another.
 *
 * Hidden by default and revealed only when app.js has confirmed there is room.
 * That way it never appears half-width, and it never appears at all on a
 * window too narrow to carry it.
 */
.logoslot{display:none}

html.sw-room .logoslot{
  display:flex;
  align-items:center;
  justify-content:center;
  text-align:center;
  position:fixed;
  top:26px;
  /* inside the gutter, with the same 20px breathing room the shell uses */
  left:20px;
  width:calc(var(--sw-gutter, 0px) - 40px);
  max-width:206px;
  aspect-ratio:3 / 2;
  padding:10px;
  box-sizing:border-box;

  border:1.5px dashed var(--rule-strong);
  border-radius:var(--r-sheet);
  background:color-mix(in srgb, var(--sheet) 55%, transparent);

  font-family:var(--cond);
  font-size:11px;
  font-weight:700;
  letter-spacing:.13em;
  text-transform:uppercase;
  line-height:1.55;
  color:var(--faint);
  user-select:none;
  pointer-events:none;
}

/* A browser without color-mix still needs a readable panel over the grid. */
@supports not (background: color-mix(in srgb, red 50%, transparent)){
  html.sw-room .logoslot{background:var(--sheet);opacity:.82}
}

@media print{.logoslot{display:none !important}}
