/* Layout and print-like styling. Colours come from tokens.css; the two scheme
   variables below change with the scheme because the brand colours do not. */
:root {
  --head: var(--c-earth);
  --pin-rule: var(--c-copper);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --head: var(--ink);
    --pin-rule: var(--c-brick);
  }
}
[data-theme="dark"] {
  --head: var(--ink);
  --pin-rule: var(--c-brick);
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
}

.page {
  width: min(46rem, 100% - 32px);
  margin: 0 auto;
  padding: 2rem 0 2.5rem;
}

[hidden] { display: none !important; }

/* Top row */
.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--c-brick);
}
h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: var(--fw-bold);
  line-height: 1.3;
  color: var(--head);
}
.lede { margin: .125rem 0 0; }
.counts {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  white-space: nowrap;
}
.counts a,
.counts a:visited {
  color: var(--ink);
  text-decoration: underline 1px;
  text-decoration-color: var(--ink);
  text-underline-offset: 2px;
}
.line-note { margin: .5rem 0 0; }

/* Form */
.add {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 4.5rem auto;
  gap: .5rem;
  align-items: end;
  margin: 1.25rem 0 0;
}
.field span {
  display: block;
  margin-bottom: .25rem;
  font-size: .875rem;
  font-weight: var(--fw-medium);
  color: var(--ink-soft);
}
input[type="text"],
input[type="number"] {
  display: block;
  width: 100%;
  height: 2.75rem;
  margin: 0;
  padding: .5rem .625rem;
  font: inherit;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--ink);
  appearance: none;
}
input[type="number"] { appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { appearance: none; margin: 0; }

button {
  margin: 0;
  padding: .3125rem .75rem;
  font: inherit;
  line-height: 1.3;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--ink);
  cursor: pointer;
  appearance: none;
}
button:active { background: var(--accent); color: var(--accent-fg); }
.add button { height: 2.75rem; padding: 0 1.25rem; }

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

/* Lists */
h2 {
  margin: 1.75rem 0 .5rem;
  font-size: 1.125rem;
  font-weight: var(--fw-bold);
  line-height: 1.3;
  color: var(--head);
}
section { scroll-margin-top: 1rem; }
.list { list-style: none; margin: 0; padding: 0; }
.item {
  display: grid;
  grid-template-columns: 11rem minmax(0, 1fr) auto;
  column-gap: 1rem;
  align-items: baseline;
  padding: .5rem 0;
  border-top: 1px solid var(--ink-soft);
}
.item:last-child { border-bottom: 1px solid var(--ink-soft); }
.margin {
  font-size: .875rem;
  font-weight: var(--fw-medium);
  line-height: 1.4;
  color: var(--ink-soft);
}
.margin > span { display: block; }
.margin .d { white-space: nowrap; }
.margin .warn { color: var(--warn); }
.text { overflow-wrap: anywhere; }
.actions { display: flex; gap: .375rem; }
.actions button { font-size: .875rem; padding: .125rem .5rem; }
.pinned {
  margin-left: -12px;
  padding-left: 9px;
  border-left: 3px solid var(--pin-rule);
}
.pinned .hist { color: var(--head); font-weight: var(--fw-bold); }
.empty { margin: .25rem 0 0; }
.more { margin-top: .625rem; font-size: .875rem; }

details { margin-top: 1.75rem; }
summary { cursor: pointer; font-weight: var(--fw-bold); }
details .list { margin-top: .5rem; }

@media (max-width: 639.98px) {
  .item { grid-template-columns: minmax(0, 1fr) auto; }
  .margin { grid-column: 1 / -1; margin-bottom: .125rem; }
}

/* Footer */
.foot {
  margin-top: 2.5rem;
  padding-top: .75rem;
  border-top: 1px solid var(--ink-soft);
  font-size: .875rem;
  color: var(--ink-soft);
}
.tools { display: flex; flex-wrap: wrap; gap: .5rem; }
.tools button { font-size: .875rem; }
#import-result { color: var(--ink); }
#import-result.refused { color: var(--error); }
.small { margin: .75rem 0 0; }
.colophon {
  display: flex;
  align-items: center;
  gap: .625rem;
  margin: 1.5rem 0 0;
  font-size: .75rem;
}
/* The wordmark keeps its own cream stock, so it reads on the dark ground too. */
.colophon img {
  display: block;
  box-sizing: content-box;
  height: 18px;
  width: auto;
  padding: 2px 4px;
  background: var(--c-cream);
}
