/* The free checker, on the Casient design system.
 *
 * The tokens, the type scale and the three faces below are the same ones the
 * Casient site uses (sentia-web/src/styles/global.css). Not a resemblance —
 * the same values. This is the first surface a KNX integrator meets, and the
 * work of making them feel they are already inside something considered is
 * mostly the work of not looking like a different product.
 *
 * Two plates, both from that system:
 *
 *   BRASS on warm near-black, everywhere a person is being spoken to.
 *   INSTRUMENT (teal on cold near-black) for readings — the site reserves it
 *     for evidence pages, and a report about someone's project IS an evidence
 *     page. Keeping the two apart is what stops every number on the page
 *     shouting at the same volume as the headline.
 *
 * The faces are self-hosted. The Casient site's own note says a
 * privacy-positioned brand should not phone Google on every page load, and of
 * every page we serve, this is the one that promises to delete your file.
 *
 * Dark is the art direction, not a preference: it is the brand's own commitment
 * and the reason there is no prefers-color-scheme block here. The one light
 * surface in the whole tool is the handover document, which is a sheet of paper
 * that happens to be on screen, and which carries its own light tokens.
 */

/* SHARED TYPE, SPLIT GROUND.
 *
 * The site and this tool now set the same two faces. The GROUND stays
 * different on purpose: the site is a document and sits on a drawing print;
 * this is an instrument and sits on near-black. Sharing the type makes the
 * handoff at the upload read as a transition -- you have left the document and
 * entered the machine -- rather than as two unrelated products.
 *
 * osifont is the open implementation of ISO 3098, "Technical product
 * documentation -- Lettering": the standard an engineering drawing is required
 * to use. It is 12.5 KB subset, and it replaces Cormorant Garamond, which was
 * a light display serif selling aspiration to an audience that is lost
 * instantly by marketing language.
 *
 * It is a LETTERING STANDARD, not a text face: monolinear, one weight. So
 * hierarchy comes from size, spacing and rules, never from weight, which would
 * be synthesised and would look it. Literata carries running prose.
 */
@font-face {
  font-family: "osifont";
  font-style: normal; font-weight: 400; font-display: swap;
  src: url("/fonts/osifont.woff2") format("woff2");
}
@font-face {
  font-family: "Literata Variable";
  font-style: normal; font-weight: 200 900; font-display: swap;
  src: url("/fonts/literata.woff2") format("woff2");
}

:root {
  color-scheme: dark;

  /* Ground. Warm near-black, never pure black. */
  --ink:        #0A0907;
  --raised:     #12100D;
  --card:       #17140F;
  --line:       #241F18;
  --line-2:     #322A20;

  /* Type on ground. */
  --bone:       #F3EDE2;
  --bone-2:     #CFC6B6;
  --bone-3:     #9A9082;
  --bone-4:     #8A8173;

  /* Brass. The one accent. */
  --brass:      #E4553F;
  --brass-lit:  #F07A66;
  --brass-deep: #A82A1E;

  /* Instrument. Readings only. */
  --signal:     #4FD1C0;
  --hold:       #C9A227;
  --alarm:      #CF6A5F;
  --instr-bg:   #080B0D;
  --instr-bg-2: #0A0F12;
  --instr-line: #16242B;
  --instr-text: #A8BDC4;
  --instr-dim:  #6B8792;

  --display: "osifont", "Isonorm", ui-monospace, monospace;
  --sans: "Literata Variable", "Iowan Old Style", Georgia, serif;
  --mono: "osifont", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding-block: 40px 64px;
  padding-inline: 20px;
  background: var(--ink);
  color: var(--bone);
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--brass); color: var(--ink); }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; border-radius: 1px; }

/* `hidden` is only a default display:none, so any rule that sets display beats
   it. Every page here toggles visibility with the attribute, so it has to win. */
[hidden] { display: none !important; }

.wrap { max-width: 860px; margin: 0 auto; }
.wrap.wide { max-width: 1000px; }

/* ── navigation ────────────────────────────────────────────────────────────
   A wordmark and four places. The tool is small enough that hiding any of them
   behind a menu would be affectation. */

.nav {
  display: flex; align-items: baseline; gap: 8px 18px; flex-wrap: wrap;
  margin-bottom: 40px; padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.nav .mark {
  font-family: var(--sans); font-weight: 600; font-size: 12.5px;
  letter-spacing: 0.22em; color: var(--brass); text-decoration: none;
  margin-right: 4px;
}
.nav a {
  font-size: 13px; color: var(--bone-4); text-decoration: none;
  padding-bottom: 2px; border-bottom: 1px solid transparent;
}
.nav a:hover { color: var(--bone-2); }
.nav a.here { color: var(--bone); border-bottom-color: var(--brass); }
.nav a.right { margin-left: auto; }

/* Who is signed in, and the way out.
 *
 * In the navigation on every page rather than only on the account card,
 * because "how do I sign out" is a question people ask from wherever they
 * happen to be - and until this existed the only answer was to delete the
 * whole account. */
.nav .session { margin-left: auto; display: flex; align-items: baseline; gap: 12px; font-size: 12px; }
.nav .session:empty { display: none; }
.nav .session .who { color: var(--bone-4); }
.nav .session .who b { color: var(--bone-2); font-weight: 600; }
.nav .session a, .nav .session button { color: var(--bone-4); }
.nav .session button {
  font: inherit; font-family: var(--sans); font-size: 12.5px;
  background: none; border: none; padding: 0; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px;
}
.nav .session button:hover { color: var(--brass); }
.nav a.right + .session { margin-left: 0; }

/* ── page heads ────────────────────────────────────────────────────────────
   The display face carries the question; the sans carries the answer. */

h1 {
  font-family: var(--display); font-weight: 400;
  font-size: clamp(30px, 5vw, 42px); line-height: 1.12;
  letter-spacing: -0.005em; text-wrap: balance;
  margin: 0 0 12px;
}
.lede { color: var(--bone-2); font-size: 17px; max-width: 60ch; margin: 0 0 8px; }
.lede em { color: var(--brass); font-style: normal; }
.fine { color: var(--bone-4); font-size: 13px; max-width: 66ch; margin: 10px 0 0; }

h2 {
  font-family: var(--sans); font-weight: 600;
  font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--brass-deep);
  margin: 40px 0 14px; padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
h3 { font-size: 14.5px; font-weight: 600; margin: 24px 0 6px; }
.sub { color: var(--bone-4); font-size: 13px; margin: -6px 0 14px; max-width: 68ch; }

a { color: var(--brass); }
a:hover { color: var(--brass-lit); }

/* ── surfaces ──────────────────────────────────────────────────────────────
   Border, fill and rule are spent by role rather than stamped on every block:
   .panel is a thing you act on, .plate is a thing you read. */

.panel {
  background: var(--raised); border: 1px solid var(--line);
  border-radius: 3px; padding: 24px;
}
.plate {
  background: var(--instr-bg); border: 1px solid var(--instr-line);
  border-radius: 3px; padding: 20px 22px;
  font-variant-numeric: tabular-nums;
}

/* ── controls ──────────────────────────────────────────────────────────── */

label.field {
  display: flex; flex-direction: column; gap: 5px; margin-bottom: 15px;
  font-family: var(--sans); font-size: 10px; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--bone-4);
}
input[type=text], input[type=email], input[type=password], input[type=date], textarea, select {
  font: inherit; font-size: 14.5px; font-weight: 400;
  color: var(--bone); background: var(--ink);
  border: 1px solid var(--line-2); border-radius: 2px; padding: 10px 11px;
  text-transform: none; letter-spacing: 0;
}
input:hover, textarea:hover { border-color: var(--brass-deep); }
textarea { min-height: 70px; resize: vertical; }

.go {
  font: inherit; font-family: var(--sans); font-weight: 600; font-size: 13.5px;
  letter-spacing: 0.02em;
  color: var(--ink); background: var(--brass);
  border: 1px solid var(--brass); border-radius: 2px;
  padding: 11px 20px; cursor: pointer;
}
.go:hover { background: var(--brass-lit); border-color: var(--brass-lit); }
.go:disabled { opacity: 0.45; cursor: default; }
.go.quiet { color: var(--brass); background: transparent; }
.go.quiet:hover { color: var(--ink); background: var(--brass); }
.go.block { width: 100%; }

.link {
  font: inherit; font-size: 13px; color: var(--brass);
  background: none; border: none; padding: 0; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px;
}
.del {
  font: inherit; font-family: var(--sans); font-size: 12.5px; font-weight: 600;
  color: var(--alarm); background: none;
  border: 1px solid color-mix(in srgb, var(--alarm) 55%, transparent);
  border-radius: 2px; padding: 7px 13px; cursor: pointer;
}
.del:hover { color: var(--ink); background: var(--alarm); border-color: var(--alarm); }

/* ── messages ──────────────────────────────────────────────────────────── */

.err { color: var(--alarm); font-size: 13.5px; margin-top: 12px; }
.ok  { color: var(--signal); font-size: 13.5px; margin-top: 12px; }
.state { font-size: 13.5px; color: var(--bone-3); margin: 14px 0; min-height: 20px; }
.state.err { color: var(--alarm); }

/* ── readings ──────────────────────────────────────────────────────────────
   Instrument plate. Mono digits, teal, on the colder ground — so a number is
   visibly a measurement and not a headline. */

.cells { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 1px; background: var(--instr-line); border: 1px solid var(--instr-line); border-radius: 3px; overflow: hidden; }
.cell { background: var(--instr-bg); padding: 14px 15px; }
.cell b {
  display: block; font-family: var(--mono); font-weight: 400;
  font-size: 23px; line-height: 1.1; color: var(--instr-text);
  font-variant-numeric: tabular-nums;
}
.cell span {
  display: block; margin-top: 5px;
  font-size: 9.5px; font-weight: 600; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--instr-dim);
}
.cell.lit b { color: var(--signal); }
.cell.warn b { color: var(--hold); }

/* ── tables ────────────────────────────────────────────────────────────── */

.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; font-size: 9.5px; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--bone-4);
  padding: 8px 10px; border-bottom: 1px solid var(--line-2); white-space: nowrap;
}
td { padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: none; }
td.mono, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
td.mono { color: var(--brass); white-space: nowrap; }
td.num { font-family: var(--mono); text-align: right; font-variant-numeric: tabular-nums; }

/* ── the sales pitch ───────────────────────────────────────────────────────
   Deliberately the only place on the page that uses the display face at body
   size. It has to read as us talking, not as another finding. */

.pitch {
  margin-top: 44px; padding: 28px 30px;
  background: linear-gradient(160deg, var(--card), var(--raised));
  border: 1px solid var(--line-2); border-left: 2px solid var(--brass);
  border-radius: 3px;
}
.pitch h2 { margin-top: 0; border: none; padding: 0; color: var(--brass); }
.pitch .say {
  font-family: var(--display); font-weight: 300;
  font-size: 22px; line-height: 1.34; color: var(--bone);
  margin: 0 0 16px; max-width: 42ch; text-wrap: balance;
}
.pitch p { color: var(--bone-3); font-size: 14px; max-width: 64ch; margin: 0 0 12px; }
.pitch ul { margin: 0 0 18px; padding: 0; list-style: none; }
.pitch li {
  position: relative; padding-left: 20px; margin-bottom: 9px;
  color: var(--bone-2); font-size: 14px; max-width: 62ch;
}
.pitch li::before {
  content: ""; position: absolute; left: 2px; top: 9px;
  width: 6px; height: 6px; border: 1px solid var(--brass); border-radius: 50%;
}
.pitch li b { color: var(--bone); font-weight: 600; }
.pitch .cta { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 4px; }

/* A link that acts as a button. Lives here rather than on the page that first
   used it: the pitch module emits one, and a class the shared module depends on
   belongs in the shared sheet or it renders unstyled wherever it is reused. */
.doclink {
  display: inline-block; text-decoration: none;
  font-family: var(--sans); font-weight: 600; font-size: 13.5px;
  color: var(--ink); background: var(--brass);
  border: 1px solid var(--brass); border-radius: 2px; padding: 11px 18px;
}
.doclink:hover { background: var(--brass-lit); color: var(--ink); }
.pitch .aside { color: var(--bone-4); font-size: 12.5px; }

/* ── footer ────────────────────────────────────────────────────────────── */

footer.site {
  margin-top: 56px; padding-top: 16px; border-top: 1px solid var(--line);
  color: var(--bone-4); font-size: 12.5px;
}

@media (max-width: 560px) {
  body { padding-block: 28px 48px; }
  .panel { padding: 18px; }
  h2 { margin-top: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ── the paper plate ───────────────────────────────────────────────────────
 *
 * The one light surface in the tool. Two pages produce a document that gets
 * printed and handed to somebody — a handover pack and a change report — and a
 * document is a sheet of paper whether or not it is currently on a screen.
 *
 * It redefines the tokens INSIDE its own scope rather than using a separate set
 * of names, so every component above (tables, figures, rules) renders correctly
 * on paper without a second implementation. The serif here is the same display
 * face, set at body size: this is a document, not an interface.
 */

.doc {
  --ink:      #16191B;
  --raised:   #F7F8F8;
  --card:     #FFFFFF;
  --line:     #E2E5E4;
  --line-2:   #CDD2D1;
  --bone:     #16191B;
  --bone-2:   #3A4145;
  --bone-3:   #5D6669;
  --bone-4:   #767E81;
  /* Light ground, so the site's own redline rather than the lifted one used
     on the instrument. Same accent, correct contrast for white. */
  --brass:      #A82A1E;
  --brass-lit:  #8E2318;
  --brass-deep: #A82A1E;
  --signal:   #1F6F5C;
  --alarm:    #A8392E;

  background: #fff; color: var(--ink);
  border-radius: 3px; padding: 54px 58px; margin-top: 28px;
  font-family: var(--display); font-weight: 400;
  font-size: 15px; line-height: 1.62;
}
.doc:empty { display: none; }

.doc h1 {
  font-family: var(--display); font-weight: 400;
  font-size: 32px; line-height: 1.14; margin: 0 0 6px; color: var(--ink);
}
.doc h2 {
  font-family: var(--sans); font-weight: 600;
  font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--brass); margin: 34px 0 10px;
  padding-bottom: 5px; border-bottom: 1px solid var(--line);
}
.doc h3 { font-family: var(--sans); font-size: 13px; font-weight: 600; margin: 20px 0 5px; }
.doc p { margin: 0 0 11px; max-width: 74ch; }
.doc .lead { font-size: 17px; color: var(--bone-2); }
.doc .sub { font-family: var(--sans); font-size: 12px; color: var(--bone-3); }
.doc table { font-family: var(--sans); font-size: 12.5px; }
.doc td.mono, .doc .mono { font-family: var(--mono); }
.doc td.mono { color: var(--brass); }
.doc .empty { color: var(--bone-3); font-style: italic; }
.doc footer {
  margin-top: 38px; padding-top: 14px; border-top: 1px solid var(--line);
  font-family: var(--sans); font-size: 10.5px; color: var(--bone-3);
}

/* Figures on paper: outlined rather than filled, because a solid tint costs
   ink and prints as grey mud on most office printers. */
.doc .figs { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 10px; margin: 16px 0; }
.doc .fig { border: 1px solid var(--line-2); border-radius: 2px; padding: 11px 13px; }
.doc .fig b { display: block; font-family: var(--mono); font-size: 21px; font-variant-numeric: tabular-nums; }
.doc .fig span { font-family: var(--sans); font-size: 9px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--bone-3); }
.doc .fig.add b { color: var(--signal); }
.doc .fig.del b { color: var(--alarm); }
.doc .fig.warn { border-color: var(--brass); }
.doc .fig.warn b { color: var(--brass); }

.doc .note { background: var(--raised); border-left: 2px solid var(--brass); padding: 12px 15px; margin: 14px 0; font-size: 14px; }
.doc .breaking { background: #FDF3F1; border-left: 2px solid var(--alarm); padding: 12px 15px; margin: 14px 0; }
.doc .breaking b { color: var(--alarm); }
.doc .breaking ul { margin: 8px 0 0; padding-left: 18px; }
.doc .breaking.clear { background: #F1F7F3; border-left-color: var(--signal); }
.doc .breaking.clear b { color: var(--signal); }

.doc svg text { font-family: var(--sans); fill: var(--ink); }

/* ── print ─────────────────────────────────────────────────────────────────
 * A heading stranded at the foot of a page, and a table row split across two,
 * are the two things that make a generated document look generated. */

@page { size: A4; margin: 15mm; }
@media print {
  body { background: #fff; color: #16191B; padding: 0; }
  .noprint, .nav, .panel, footer.site, .pitch { display: none !important; }
  .wrap { max-width: none; }
  .doc { padding: 0; margin: 0; border-radius: 0; }
  h2 { break-after: avoid; }
  tr, .fig, .note, .breaking, svg { break-inside: avoid; }
  .page-break { break-before: page; }
}
