/* FISH — a quiet, text-first stylesheet.
   Three faces, one accent per object, four named greys.
   Tokens are fixed: do not add a fifth grey or a seventh size. */

:root {
  /* three faces, three jobs */
  --times: 'Times New Roman', Times, serif;      /* voice     */
  --courier: Courier, 'Courier New', monospace;  /* record    */
  --default: Arial, Helvetica, sans-serif;       /* furniture */

  /* paper and ink */
  --bg: #fff;
  --ink: #000;
  --ink-soft: #1f1f1f;
  --link: #004de5;
  --link-quiet: #143ac4;
  --surface: #e6e6e6;
  --paper: rgb(255, 252, 239);
  --note-ink: #000065;

  /* four greys, named for what they separate */
  --rule: #d6d6d6;
  --border: #c5c5c5;
  --rule-faint: #f0f0f0;
  --meta: #8b8b8b;
  --meta-readable: #6b6b6b;

  /* the scale */
  --lead-fs: 22px;      --lead-lh: 32px;
  --display-fs: 30px;   --display-lh: 40px;
  --body-fs: 17px;      --body-lh: 27px;
  --furniture-fs: 15px; --furniture-lh: 22px;
  --caption-fs: 13px;   --caption-lh: 18px;
  --record-fs: 16px;    --record-lh: 21px;
  --compact-fs: 14px;   --compact-lh: 16px;   /* indoors only */

  /* measure and rhythm */
  --max-page: 700px;
  --max-prose: 600px;
  --pad: 10px;
  --radius: 30px;

  --gap-tight: 10px;
  --gap: 20px;
  --gap-loose: 60px;

  color-scheme: light;
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #001020; --ink: #c9c6bd; --ink-soft: #c9c6bd;
  --link: #6ea8ff; --link-quiet: #a9c8ff;
  --rule: #34322b; --border: #34322b; --rule-faint: #1a2430;
  --meta: rgba(255, 255, 255, .4); --meta-readable: rgba(255, 255, 255, .62);
  --surface: #16202c; --paper: #16202c; --note-ink: #c9c6bd;
}

* { box-sizing: border-box; }

html {
  font-family: var(--times);
  font-size: var(--body-fs);
  background: var(--bg);
}

body {
  margin: 0;
  padding-top: 80px;          /* the page begins with air */
  color: var(--ink);
  line-height: var(--body-lh);
}

/* Reset: spacing is supplied by the containers below. */
h1, h2, h3, h4, p, ul, ol, figure, pre, table, dl, fieldset { margin: 0; padding: 0; }

h1, h2 {
  font-size: var(--display-fs);
  line-height: var(--display-lh);
  font-weight: bold;
  margin-bottom: .5em;
}

h3, h4 {
  font-size: var(--body-fs);
  line-height: var(--body-lh);
  font-weight: bold;
  margin: 2em 0 .5em;
}

p, ul, ol, pre, table, dl { margin-bottom: 1em; }

hr { border: 0; border-bottom: 1px solid var(--rule); }

code {
  font-family: var(--courier);
  font-size: var(--record-fs);
  line-height: inherit;
}

main {
  max-width: var(--max-page);
  margin: 0 auto;
  padding: 0 15px;
}

.prose { max-width: var(--max-prose); }

.lead {
  font-size: var(--lead-fs);
  line-height: var(--lead-lh);
  margin-bottom: 1.2em;
}

/* 5. Links are printed: 1px, 2px offset, in their own colour. */
a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 1px !important;
  text-underline-offset: 2px;
  text-decoration-color: var(--link);
  word-break: break-word;
}
a:hover { text-decoration-color: var(--link); }

.wrap {
  max-width: var(--max-page);
  margin: 0 auto;
  padding-left: 15px;
  padding-right: 15px;
}

/* 8.1 Nav — a bar of nouns. */
.masthead { background: var(--surface); }

.masthead-inner {
  display: flex;
  flex-flow: row wrap;
  align-items: baseline;
  gap: 10px 20px;
  padding-top: 4px;
  padding-bottom: 6px;
}

.wordmark {
  font-family: var(--times);
  font-size: var(--body-fs);
  line-height: var(--body-lh);
  font-weight: bold;
  color: var(--ink);
  text-decoration: none;
  width: max-content;
}

.masthead nav {
  display: flex;
  flex-flow: row wrap;
  gap: 10px;
  font-family: var(--default);
  font-size: var(--furniture-fs);
  line-height: var(--furniture-lh);
}

.masthead nav a {
  color: var(--ink);
  text-decoration: none;
  width: max-content;
}
.masthead nav a:hover { text-decoration: underline; }

/* 8.2 Button — a pill that never fills. */
.button {
  font-family: var(--default);
  font-size: var(--furniture-fs);
  line-height: var(--furniture-lh);
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 12px;
  display: inline-block;
  text-decoration: none;
  cursor: pointer;
}
.button:hover { border-color: #9c9c9c; }

/* 8.3 Tag and stamp — a cut corner, not a pill. */
.tag, .stamp {
  display: inline-block;
  font-family: var(--courier);
  font-size: var(--caption-fs);
  line-height: var(--caption-lh);
  border: 1px solid #bababa;
  border-top: 0;
  border-left: 0;
  padding: 0 2px 2px 0;
}

.tag {
  color: var(--ink);
  text-decoration: none;
}
.tag:hover { text-decoration: underline; }
.stamp { color: var(--meta); }

/* 8.4 Metadata — small, monospace, last. */
.meta {
  font-family: var(--courier);
  font-size: var(--caption-fs);
  line-height: var(--caption-lh);
  color: var(--meta-readable);
  margin: 6px 0 0;
}
.meta a { color: var(--link-quiet); }

/* 8.13 (identity marks) — 10px dot, 1em chip, 1px rule. */
.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 8px;
  vertical-align: middle;
  background: var(--accent, var(--meta));
}

.chip {
  display: inline-block;
  width: 1em;
  height: 1em;
  margin-right: .5em;
  vertical-align: middle;
  background: var(--accent, var(--meta));
}

/* Entries — a list of rows with hairline dividers, no cards. */
.entries {
  display: flex;
  flex-flow: column nowrap;
  gap: var(--gap);
  margin-top: var(--gap);
}

.entry {
  border-bottom: 1px solid var(--rule-faint);
  padding-bottom: var(--gap);
}
.entry:last-child { border-bottom: 0; padding-bottom: 0; }

.entry-title {
  font-size: var(--body-fs);
  line-height: var(--body-lh);
  font-weight: bold;
  margin: 0 0 4px;
}

.entry .summary { margin-bottom: 6px; }

.tags {
  display: flex;
  flex-flow: row wrap;
  gap: 6px;
  margin: 6px 0 0;
}

.tag-list {
  display: flex;
  flex-flow: row wrap;
  gap: 10px 16px;
  margin-top: var(--gap);
}

/* Filters — furniture, kept behind a word. */
.filters { margin: 0 0 var(--gap); }

.filters > summary {
  font-family: var(--default);
  font-size: var(--furniture-fs);
  line-height: var(--furniture-lh);
  cursor: pointer;
  width: max-content;
}

.filters form {
  display: flex;
  flex-flow: column nowrap;
  gap: var(--gap);
  margin-top: var(--gap-tight);
  padding: 10px;
  border: 1px solid var(--border);
}

fieldset { border: 0; min-width: 0; }

legend {
  font-family: var(--default);
  font-size: var(--furniture-fs);
  line-height: var(--furniture-lh);
  color: var(--meta-readable);
  margin-bottom: 6px;
  padding: 0;
}

.picks {
  display: flex;
  flex-flow: row wrap;
  gap: 6px 20px;
}

.pick {
  display: inline-flex;
  align-items: center;
  font-family: var(--default);
  font-size: var(--furniture-fs);
  line-height: var(--furniture-lh);
  cursor: pointer;
}
.pick input { margin: 0 6px 0 0; }
.pick .dot { margin-right: 6px; }

.fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--gap);
}

.field {
  display: flex;
  flex-flow: column nowrap;
  gap: 4px;
  font-family: var(--default);
  font-size: var(--furniture-fs);
  line-height: var(--furniture-lh);
}

.field input,
.field select,
.search-form input {
  font-family: var(--default);
  font-size: var(--furniture-fs);
  line-height: var(--furniture-lh);
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 4px 6px;
  width: 100%;
}

.actions {
  display: flex;
  flex-flow: row wrap;
  align-items: center;
  gap: var(--gap);
}

.actions .quiet-link {
  font-family: var(--default);
  font-size: var(--furniture-fs);
  line-height: var(--furniture-lh);
  color: var(--ink);
  text-decoration: none;
}
.actions .quiet-link:hover { text-decoration: underline; }

.search-form {
  display: flex;
  flex-flow: column nowrap;
  gap: var(--gap-tight);
  max-width: 500px;
  margin-bottom: var(--gap-loose);
}
.search-form .button { width: max-content; }

/* 8.9 Notices — a slip of paper and a sentence. */
.notice {
  background: #fffc57;
  color: #000;
  padding: 8px;
  max-width: 489px;
  margin: 20px auto;
}
.notice.quiet {
  background: var(--paper);
  border: 1px solid rgb(211, 211, 198);
  color: var(--note-ink);
}

/* 8.10 Record block — for logs and machine-shaped facts. */
.record {
  white-space: pre-wrap;
  word-break: normal;
  font-family: var(--courier);
  font-size: var(--record-fs);
  line-height: var(--record-lh);
  color: var(--ink-soft);
}
.record a { color: var(--link-quiet); }

ul.record { list-style: none; }
ul.record li { margin: 0; }

/* Item page — one display title and a 1px accent rule. */
.item-head {
  border-bottom: 1px solid var(--accent, var(--rule));
  padding-bottom: .5em;
  margin-bottom: var(--gap);
}
.item-head h1 { margin-bottom: .2em; }
.item-head .tags { margin-top: 0; }

.back {
  font-family: var(--default);
  font-size: var(--furniture-fs);
  line-height: var(--furniture-lh);
  margin-bottom: var(--gap);
}
.back a { color: var(--ink); text-decoration: none; }
.back a:hover { text-decoration: underline; }

.backlinks {
  list-style: none;
  padding: 0;
  margin: 0 0 1em;
}
.backlinks li {
  padding: 4px 0;
  border-bottom: 1px solid var(--rule-faint);
}
.backlinks li:last-child { border-bottom: 0; }
.backlinks .meta { display: inline; margin: 0; }

/* Sources — one accent per site at three scales. */
.source-list {
  display: flex;
  flex-flow: column nowrap;
  gap: var(--gap);
  margin-top: var(--gap);
}

.source-entry {
  border-top: 1px solid var(--accent, var(--rule));
  padding-top: var(--gap-tight);
}

.source-name {
  font-size: var(--body-fs);
  line-height: var(--body-lh);
  font-weight: bold;
  margin: 0 0 4px;
}

.source-entry .status { margin-bottom: 0; }

.conflicts {
  display: flex;
  flex-flow: column nowrap;
  gap: var(--gap);
}

.conflict { border-bottom: 1px solid var(--rule-faint); padding-bottom: var(--gap-tight); }
.conflict:last-child { border-bottom: 0; }
.conflict .meta { margin-top: 4px; }

/* Server — facts as records, notes as prose. */
.facts {
  margin: 8px 0 0;
  border-top: 1px solid var(--rule-faint);
}

.fact {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 0 10px;
  padding: 3px 0;
  border-bottom: 1px solid var(--rule-faint);
}

.fact dt {
  font-family: var(--default);
  font-size: var(--caption-fs);
  line-height: var(--caption-lh);
  color: var(--meta-readable);
  padding-top: 1px;
}

.fact dd {
  margin: 0;
  font-family: var(--courier);
  font-size: var(--caption-fs);
  line-height: var(--caption-lh);
  color: var(--ink-soft);
}

.note-list {
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: var(--caption-fs);
  line-height: var(--caption-lh);
  color: var(--meta-readable);
}
.note-list li { margin-bottom: 4px; }

/* 8.11 Footer — three short lines. */
.site-footer {
  max-width: var(--max-page);
  margin: var(--gap-loose) auto 0;
  padding: 10px 15px 40px;
  border-top: 1px solid var(--border);
  color: var(--meta-readable);
  font-size: var(--caption-fs);
  line-height: var(--caption-lh);
}
.site-footer p { margin: 0 0 4px; }
.site-footer a { color: var(--meta-readable); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

/* 12. Accessibility amendments. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: 10px;
  top: 10px;
  z-index: 10;
  padding: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
}

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

/* 10. Responsive — two breakpoints. */
@media (max-width: 700px) {
  body { padding-top: 40px; }
  .fields { grid-template-columns: 1fr; }
}

@media (max-width: 535px) {
  .masthead-inner { flex-flow: column nowrap; gap: 6px; }
  .masthead nav {
    flex-flow: row nowrap;
    gap: 14px;
    padding-bottom: 2px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .masthead nav::-webkit-scrollbar { display: none; }
  .wrap { padding-left: 10px; padding-right: 10px; }
  main { padding: 0 10px; }
  .lead { font-size: 19px; line-height: 28px; }
  h1, h2 { font-size: 26px; line-height: 34px; }
}

/* 11. Print — chrome gone, ink on white, links still references. */
@media print {
  .masthead, .site-footer, .filters, .back, .button { display: none !important; }
  body { padding: 0; background: #fff; color: #000; }
  main { max-width: 100%; padding: 0; margin: 0; }
  .record, .prose {
    overflow: visible !important;
    max-height: none !important;
    font-size: 9pt;
    line-height: 1.4;
    border: 0 !important;
  }
  a, .record a { color: #143ac4 !important; text-decoration: underline; }
  .entry, .source-entry, figure, table, li { page-break-inside: avoid; }
  h1, h2, h3 { page-break-after: avoid; }
  .notice { background: #fff; border: 1px solid #000; }
}
