/* Unasked Clock. A reference desk enquiry sheet: ink on cream, ruled, square, still. */

:root {
  --size: clamp(1.5rem, 5.2vw, 4rem);
  --pad-x: calc(var(--cell-w) * 2);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: var(--fw-medium);
  -webkit-text-size-adjust: 100%;
}

[hidden] { display: none !important; }

.num { font-variant-numeric: tabular-nums; }

/* The blank view. */

html:not(.is-log), html:not(.is-log) body { height: 100%; overflow: hidden; }

.blank {
  position: fixed;
  inset: 0;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.first {
  position: absolute;
  top: var(--cell-h);
  left: var(--pad-x);
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--ink-soft);
}

.answer {
  margin: 0;
  padding: calc(var(--cell-h) * 7) 0 0 var(--pad-x);
  max-width: calc(var(--cell-w) * 26 + var(--pad-x));
  font-size: var(--size);
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  text-wrap: balance;
}

.foot {
  position: fixed;
  left: var(--pad-x);
  bottom: calc(var(--cell-h) * 2);
  font-size: var(--size);
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  outline: none;
}

.foot:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
}

/* The log. */

.log {
  max-width: calc(40rem + var(--pad-x) * 2);
  padding: calc(var(--cell-h) * 1.5) var(--pad-x) calc(var(--cell-h) * 2);
  font-size: 1rem;
  line-height: 1.5;
}

.log h1, .log h2 { margin: 0; }

.head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--ink);
}

.head h1 { font-size: 1.5rem; font-weight: var(--fw-bold); }

.log h2 {
  font-size: 0.875rem;
  font-weight: var(--fw-medium);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 1.75rem 0 0.25rem;
  border-bottom: 1px solid var(--ink-soft);
}

.summary { margin: 0; padding-top: 0.75rem; }

.row { display: flex; align-items: baseline; gap: 0.5rem; }
.row dt, .row dd { margin: 0; }
.row dd { font-variant-numeric: tabular-nums; text-align: right; }
.leader { flex: 1; min-width: 1rem; border-bottom: 1px dotted var(--ink-soft); transform: translateY(-0.3em); }

.empty { margin: 1.25rem 0 0; }

.hour {
  display: grid;
  grid-template-columns: 3.5rem 1fr 2.5rem;
  align-items: center;
  min-height: 2rem;
  border-bottom: 1px solid var(--ink-soft);
}

.tally { display: flex; flex-wrap: wrap; gap: 2px 8px; padding: 4px 0; }
.tally svg { display: block; stroke: var(--ink); stroke-width: 1.25; stroke-linecap: square; fill: none; }
.tally line:not(.slash) { shape-rendering: crispEdges; stroke-width: 1; }
.count { text-align: right; }

.item {
  display: grid;
  grid-template-columns: 3.5rem 6rem 1fr;
  align-items: baseline;
  min-height: 2rem;
  padding-top: 0.25rem;
  border-bottom: 1px solid var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.item.th, .earlier th {
  font-size: 0.875rem;
  color: var(--ink);
  font-weight: var(--fw-medium);
}

.earlier table { width: 100%; border-collapse: collapse; }
.earlier th, .earlier td {
  text-align: left;
  vertical-align: baseline;
  padding: 0.3rem 0.75rem 0.3rem 0;
  border-bottom: 1px solid var(--ink-soft);
}
.earlier th:not(:first-child), .earlier td:not(:first-child) { text-align: right; padding-right: 0; }

.removals p { margin: 0; padding: 0.3rem 0; border-bottom: 1px solid var(--ink-soft); }

.note {
  margin: 1.75rem 0 0;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--ink-soft);
}
.note + .note { margin-top: 0.75rem; }

.buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.5rem; }

.buttons button {
  font: inherit;
  font-size: 0.875rem;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--ink);
  border-radius: 0;
  padding: 0.45rem 0.8rem;
  cursor: pointer;
}
.buttons button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.buttons button:active { background: var(--ink); color: var(--bg); }

.colophon { margin: 2.5rem 0 0; }
.colophon img { display: block; width: 140px; height: auto; }

@media (prefers-color-scheme: dark) {
  /* the earth colour of the wordmark disappears on the dark ground; it is printed in ink instead */
  :root:not([data-theme="light"]) .colophon img { filter: brightness(0) invert(0.92) sepia(0.15); }
}

/* Print: today's sheet only. */

@page { size: A4; margin: 18mm; }

@media print {
  :root, :root:not([data-theme="light"]) { --bg: #fff; --ink: #000; --ink-soft: #555; color-scheme: light; }
  html, body { background: #fff; }
  .blank, .earlier, .removals, .buttons, #storage { display: none !important; }
  .log { max-width: none; padding: 0; font-size: 9pt; line-height: 5mm; }
  .head h1 { font-size: 13pt; }
  .head { padding-bottom: 1mm; }
  .log h2 { font-size: 8pt; padding: 4mm 0 0.5mm; }
  .summary { padding-top: 1mm; }
  .row, .item, .hour { min-height: 5mm; height: 5mm; padding: 0; }
  .tally { padding: 0; gap: 0 4px; flex-wrap: nowrap; }
  .tally svg { height: 4mm; width: auto; }
  .list { column-count: 3; column-gap: 8mm; }
  .item { break-inside: avoid; grid-template-columns: 9mm 18mm 1fr; }
  .item.th { font-size: 8pt; }
  .empty { margin-top: 3mm; }
  .note { font-size: 8pt; line-height: 4mm; margin-top: 4mm; }
  .colophon { margin-top: 5mm; }
  .colophon img { filter: none !important; width: 32mm; }
}
.earlier td:first-child { white-space: nowrap; }
