/* Archive viewer. One idea carries the look: green-bar ledger paper, the
   continuous-form stock business systems printed their listings on. */

@font-face {
  font-family: "Plex Sans";
  src: url("fonts/ibm-plex-sans-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Plex Sans";
  src: url("fonts/ibm-plex-sans-600.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Plex Condensed";
  src: url("fonts/ibm-plex-sans-condensed-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Plex Condensed";
  src: url("fonts/ibm-plex-sans-condensed-600.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

:root {
  --paper: #fbfcfa;
  --band: #e6f1ea;
  --band-deep: #d3e6da;
  --rule: #b9cdc1;
  --ink: #16241d;
  --muted: #55675d;
  --green: #1b4d3a;
  --blue: #2a41b0;
  --blue-wash: #e4e8fa;
  --red: #a1261d;
  --red-wash: #fbe9e7;
  --sans: "Plex Sans", "Segoe UI", system-ui, sans-serif;
  --condensed: "Plex Condensed", "Arial Narrow", "Plex Sans", sans-serif;
  --line: 2rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.5 var(--sans);
}

a {
  color: var(--blue);
  text-underline-offset: 0.15em;
}
a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.sr:focus-visible {
  position: static;
  width: auto;
  height: auto;
  margin: 0;
  clip-path: none;
}

/* top bar */

.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.5rem;
  padding: 0.6rem 1.5rem;
  background: var(--green);
  color: var(--paper);
}
.bar a,
.bar-button {
  color: var(--paper);
}
.bar :focus-visible {
  outline-color: var(--paper);
}
.bar-name {
  font: 600 1.25rem/1.2 var(--condensed);
  letter-spacing: 0.01em;
  text-decoration: none;
}
.bar-find {
  flex: 1 1 14rem;
  max-width: 22rem;
}
.bar-find input[type="search"] {
  width: 100%;
  padding: 0.3rem 0.6rem;
  border: 1px solid rgb(251 252 250 / 0.45);
  border-radius: 2px;
  background: rgb(251 252 250 / 0.12);
  color: var(--paper);
  font: inherit;
}
.bar-find input[type="search"]::placeholder {
  color: rgb(251 252 250 / 0.75);
}
.bar-find input[type="search"]:focus {
  background: var(--paper);
  color: var(--ink);
}
.bar-find input[type="search"]:focus::placeholder {
  color: var(--muted);
}
.home .bar-find {
  visibility: hidden;
}
.bar-end {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-left: auto;
  font-size: 0.9375rem;
}
.bar-end form {
  margin: 0;
}
.bar-langs a {
  padding: 0.1rem 0.3rem;
  text-decoration: none;
  opacity: 0.75;
}
.bar-langs a[aria-current] {
  border-bottom: 2px solid var(--paper);
  opacity: 1;
}
.bar-user {
  font-weight: 600;
}
.bar-button {
  padding: 0.25rem 0.7rem;
  border: 1px solid rgb(251 252 250 / 0.6);
  border-radius: 2px;
  background: none;
  font: inherit;
  cursor: pointer;
}
.bar-button:hover {
  background: rgb(251 252 250 / 0.14);
}

/* page frame */

main {
  flex: 1;
}
.page {
  max-width: 62rem;
  padding: 1.5rem 1.5rem 3rem;
}
.wide .page {
  max-width: none;
}
.crumb {
  margin: 0 0 0.25rem;
  font-size: 0.9375rem;
}
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  margin-bottom: 1rem;
}
h1 {
  margin: 0;
  font: 600 2rem/1.15 var(--condensed);
  letter-spacing: 0.005em;
}
.tally {
  margin-left: 0.35rem;
  color: var(--muted);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}
.tally-line {
  margin: 0;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.foot {
  padding: 0.75rem 1.5rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.875rem;
}

/* form controls */

input[type="text"],
input[type="search"],
input[type="password"] {
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--rule);
  border-radius: 2px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}
.button {
  padding: 0.4rem 1rem;
  border: 1px solid var(--green);
  border-radius: 2px;
  background: var(--green);
  color: var(--paper);
  font: 600 1rem/1.5 var(--sans);
  cursor: pointer;
}
.button:hover {
  background: #123a2b;
}
.quiet {
  font-size: 0.9375rem;
}
.alert {
  max-width: 44rem;
  margin: 0 0 1rem;
  padding: 0.6rem 0.9rem;
  border-left: 4px solid var(--red);
  background: var(--red-wash);
  color: #5d130d;
}
.notice {
  margin: 1rem 0;
  color: var(--muted);
}
.notice.inside {
  margin: 0;
  padding: 1.25rem 1rem;
}

/* ledger tables */

.ledger {
  border-collapse: separate;
  border-spacing: 0;
  font-variant-numeric: tabular-nums;
}
.ledger th,
.ledger td {
  height: var(--line);
  padding: 0 0.75rem;
  text-align: left;
  vertical-align: middle;
}
.ledger thead th {
  border-bottom: 2px solid var(--green);
  background: var(--paper);
  font: 600 0.9375rem/1.2 var(--condensed);
  white-space: nowrap;
}
.ledger thead a {
  color: var(--ink);
  text-decoration: none;
}
.ledger thead a:hover {
  text-decoration: underline;
}
.ledger th[aria-sort] a::after {
  margin-left: 0.3rem;
  color: var(--green);
  font-size: 0.7em;
}
.ledger th[aria-sort="ascending"] a::after {
  content: "\25B2";
}
.ledger th[aria-sort="descending"] a::after {
  content: "\25BC";
}
.ledger tbody tr:nth-child(odd) > * {
  background: var(--band);
}
.ledger tbody tr:nth-child(even) > * {
  background: var(--paper);
}
.ledger tbody tr:hover > * {
  background: var(--band-deep);
}
.ledger .number {
  text-align: right;
}

/* table list */

.home .page-head {
  max-width: 40rem;
}
.finder {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  color: var(--muted);
  font-size: 0.9375rem;
}
.finder input {
  width: 14rem;
}
.index {
  width: 100%;
  max-width: 40rem;
}
.index tbody th {
  font: 600 1rem/1.2 var(--condensed);
  letter-spacing: 0.02em;
}
.index tbody a {
  display: block;
  line-height: var(--line);
}
.empties {
  margin-top: 2rem;
  max-width: 62rem;
}
.empties summary,
.help summary {
  width: fit-content;
  cursor: pointer;
  font-weight: 600;
}
.empties p {
  margin: 0.5rem 0;
  color: var(--muted);
}
.empties ul {
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
  columns: 11rem;
  column-gap: 1.5rem;
  font: 400 0.9375rem/1.7 var(--condensed);
}

/* record grid */

.tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  margin-bottom: 0.75rem;
}
.tools-search,
.tools-view {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
}
.tools-search input {
  width: min(22rem, 60vw);
}
.switch {
  display: inline-flex;
  border: 1px solid var(--rule);
  border-radius: 2px;
  font-size: 0.9375rem;
}
.switch a {
  padding: 0.3rem 0.75rem;
  color: var(--ink);
  text-decoration: none;
}
.switch a + a {
  border-left: 1px solid var(--rule);
}
.switch a[aria-current] {
  background: var(--green);
  color: var(--paper);
}

.grid-wrap {
  max-width: 100%;
  max-height: calc(100vh - 18.5rem);
  min-height: 9rem;
  overflow: auto;
  border: 1px solid var(--rule);
  border-top: 0;
  background: var(--paper);
}
.grid {
  font: 400 0.9375rem/1.2 var(--condensed);
}
.grid th,
.grid td {
  max-width: 26rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.grid thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  border-top: 1px solid var(--rule);
}
.grid .filters td {
  position: sticky;
  top: var(--line);
  z-index: 2;
  height: var(--line);
  padding: 0 0.25rem;
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}
.grid .filters input {
  width: 100%;
  min-width: 4.5rem;
  height: 1.5rem;
  padding: 0 0.5rem;
  border: 0;
  border-bottom: 1px dashed var(--rule);
  border-radius: 0;
  background: transparent;
  font: inherit;
}
.grid .filters input:focus,
.grid .filters input.on {
  border-bottom: 1px solid var(--blue);
  background: var(--blue-wash);
}
.grid .open {
  position: sticky;
  left: 0;
  z-index: 1;
  border-right: 1px solid var(--rule);
}
.grid thead .open {
  z-index: 3;
}
.grid td.number,
.grid th.number {
  text-align: right;
}
.grid td.zero,
.fields td.zero {
  color: var(--muted);
}
.grid td.blob {
  color: var(--muted);
}

.help {
  margin-top: 1.25rem;
  max-width: 44rem;
  font-size: 0.9375rem;
}
.help p {
  margin: 0.4rem 0 0;
  color: var(--muted);
}

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.25rem;
  margin-top: 0.75rem;
  font-variant-numeric: tabular-nums;
}
.pager-where {
  font-weight: 600;
}
.pager-size {
  margin-left: auto;
  color: var(--muted);
}
.pager-size a {
  padding: 0 0.25rem;
}
.pager-size a[aria-current] {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}

/* one record */

.fields {
  width: 100%;
  max-width: 58rem;
}
.fields th,
.fields td {
  height: auto;
  padding-block: 0.35rem;
  vertical-align: top;
}
.fields tbody th {
  width: 18rem;
  font: 600 0.9375rem/1.5 var(--condensed);
  letter-spacing: 0.02em;
  overflow-wrap: anywhere;
}
.fields td {
  overflow-wrap: anywhere;
}
.fields td.text {
  white-space: pre-wrap;
}
.fields td.long {
  font-size: 0.9375rem;
  line-height: 1.45;
}
.fields img {
  display: block;
  max-width: min(100%, 24rem);
  max-height: 16rem;
  margin: 0.25rem 0 0.5rem;
  border: 1px solid var(--rule);
  background: #fff;
}
.fields .meta {
  margin-left: 0.5rem;
  color: var(--muted);
  font-size: 0.9375rem;
}

/* sign-in: a sheet of green-bar paper */

.sheet {
  background: repeating-linear-gradient(
    to bottom,
    var(--band) 0 calc(var(--line) * 2),
    var(--paper) calc(var(--line) * 2) calc(var(--line) * 4)
  );
}
.login {
  width: min(24rem, 100% - 3rem);
  margin: 12vh 0 0 max(1.5rem, 12vw);
  padding: 2rem 2rem 2.25rem;
  border: 1px solid var(--rule);
  border-top: 4px solid var(--green);
  background: var(--paper);
}
.login h1 {
  font-size: 2.75rem;
  letter-spacing: 0.02em;
}
.login-intro {
  margin: 0.25rem 0 1.5rem;
  color: var(--muted);
}
.login label {
  display: block;
  margin-bottom: 0.2rem;
  font-weight: 600;
}
.login input[type="text"],
.login input[type="password"] {
  width: 100%;
  margin-bottom: 1rem;
}
.login .button {
  margin-top: 0.25rem;
}

.message {
  max-width: 40rem;
  padding: 3rem 1.5rem;
}
.message h1 {
  margin-bottom: 0.75rem;
}

@media (max-width: 40rem) {
  .bar,
  .page,
  .foot {
    padding-inline: 1rem;
  }
  h1 {
    font-size: 1.625rem;
  }
  .grid-wrap {
    max-height: 70vh;
  }
  .fields tbody th {
    width: 9rem;
  }
  .login {
    margin: 2rem auto 0;
  }
  .pager-size {
    margin-left: 0;
  }
}

@media print {
  .bar,
  .tools,
  .pager,
  .help,
  .foot,
  .crumb {
    display: none;
  }
  .grid-wrap {
    max-height: none;
    overflow: visible;
  }
}
