/* blacklist — ink on paper */

:root {
  --paper: #f1f0ec;
  --ink: #0d0d0d;
  --ink-2: rgba(13, 13, 13, .64);
  --ink-3: rgba(13, 13, 13, .40);
  --rule: rgba(13, 13, 13, .16);
  --rule-2: rgba(13, 13, 13, .07);
  --gut: clamp(16px, 3.4vw, 48px);
  --mono: "Courier Prime", "Courier New", Courier, monospace;
  --fs: 15px;
  --ease: cubic-bezier(.2, .7, .1, 1);
  color-scheme: light;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--fs)/1.5 var(--mono);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* paper grain */
body::before {
  content: "";
  position: fixed; inset: -50%;
  pointer-events: none; z-index: 100;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  opacity: .16;
  mix-blend-mode: multiply;
}

::selection { background: var(--ink); color: var(--paper); }

a { color: inherit; text-decoration: none; }
s { text-decoration-thickness: .09em; text-decoration-color: currentColor; }

.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

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

/* ——— top bar ——— */

.bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 18px var(--gut);
  font-size: 13px; letter-spacing: .02em;
  pointer-events: none;
  transition: background .3s;
}
.bar > * { pointer-events: auto; }
body.past-hero .bar, body.page .bar { background: var(--paper); }
.bar nav { display: flex; gap: 22px; }
.bar nav a { color: var(--ink-3); transition: color .2s; }
.bar nav a:hover, .bar nav a.is-here { color: var(--ink); }
.bar .mark { opacity: 0; transform: translateY(-4px); transition: opacity .5s, transform .5s var(--ease); }
body.past-hero .bar .mark, body.page .bar .mark { opacity: 1; transform: none; }

/* ——— hero ——— */

.hero {
  position: relative;
  height: 100vh; height: 100svh;
  min-height: 460px;
  display: grid;
  align-content: center;
  padding: 0 var(--gut);
}

.type {
  margin: 0;
  font-weight: 400;
  font-size: min(calc((100vw - var(--gut) - 8px) / 5.62), 52vh);
  line-height: 1;
  letter-spacing: -.035em;
  white-space: nowrap;
  position: relative;
  transform: translateY(-4%);
  text-shadow: 0 0 1px rgba(13, 13, 13, .45);
  min-height: 1em;
}
.type .ch {
  position: relative;
  display: inline-block;
  opacity: 0;
}
.type .ch.on { animation: strike-key .16s steps(2, end) forwards; }
@keyframes strike-key {
  0% { opacity: 0; transform: translateY(var(--dy, 0)) scale(1.06); }
  100% { opacity: var(--ink-a, 1); transform: translateY(var(--dy, 0)) rotate(var(--rot, 0deg)); }
}
/* typewriter ink: a fixed speckle mask, cheaper than a live svg filter */
.type, .prose h1 {
  -webkit-mask-image: url("/assets/ink.png");
  mask-image: url("/assets/ink.png");
  -webkit-mask-size: 300px 300px;
  mask-size: 300px 300px;
}
/* overstrike bar, one per character, like hyphens typed over the word */
.type .ch::after {
  content: "";
  position: absolute;
  left: -.03em; right: -.03em;
  top: calc(.5em + var(--sy, 0em));
  height: .085em;
  background: currentColor;
  transform: scaleX(0) rotate(var(--sr, 0deg));
  transform-origin: left center;
}
.type .ch.x::after { transform: scaleX(1) rotate(var(--sr, 0deg)); transition: transform .07s linear; }

.caret {
  position: absolute;
  left: 0; top: 0;
  margin-top: .8em;
  width: .5em; height: .075em;
  background: currentColor;
  animation: blink 1.05s steps(1) infinite;
}
.caret.return { transition: left .38s cubic-bezier(.5, 0, .2, 1), top .38s cubic-bezier(.5, 0, .2, 1); }
.type .brk { display: none; }
.caret.typing { animation: none; }
@keyframes blink { 50% { opacity: 0; } }

.hero-foot {
  position: absolute; left: var(--gut); right: var(--gut); bottom: 22px;
  display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: end;
  font-size: 13px; color: var(--ink-3);
  opacity: 0; transition: opacity 1.2s;
}
.hero-foot span:last-child { text-align: right; }
.hero-foot .down { color: var(--ink); font-size: 18px; line-height: 1; padding: 6px; animation: nudge 2.4s var(--ease) infinite; }
@keyframes nudge { 0%, 60%, 100% { transform: none; } 30% { transform: translateY(5px); } }
body.typed .hero-foot { opacity: 1; }
body.typed.past-hero .hero-foot { opacity: 0; transition-duration: .3s; }

/* ——— index ——— */

.index { padding: 0 var(--gut) 12vh; }

/* year spine: one bar per year, height = entries that year */
.spine {
  position: relative;
  height: 128px;
  margin: 2vh 0 0;
  display: flex; align-items: flex-end;
  gap: 0;
  border-bottom: 1px solid var(--ink);
  cursor: crosshair;
}
.spine i {
  flex: 1 1 0;
  min-width: 0;
  height: var(--h);
  background: var(--ink);
  margin: 0 .5px;
  transform-origin: bottom;
  transform: scaleY(0);
  transition: transform .9s var(--ease), opacity .2s;
}
.spine.in i { transform: scaleY(1); }
.spine i.z { background: transparent; }
.spine.picked i:not(.sel) { opacity: .18; }
.spine .yr {
  position: absolute; bottom: -24px;
  font-size: 12px; color: var(--ink-3);
  font-style: normal;
}
.spine .yr.r { right: 0; }
.spine .tip {
  position: absolute; bottom: calc(100% + 8px);
  transform: translateX(-50%);
  font-size: 12px; white-space: nowrap;
  background: var(--ink); color: var(--paper);
  padding: 2px 6px;
  pointer-events: none;
  opacity: 0;
}
.spine .tip.on { opacity: 1; }

.tools {
  position: sticky; top: 0; z-index: 40;
  background: var(--paper);
  margin: 64px calc(var(--gut) * -1) 0;
  padding: 50px var(--gut) 0;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "search search" "filters sorts" "ap ap";
  row-gap: 18px;
  border-bottom: 1px solid var(--ink);
}
.tools::after {
  content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 18px;
  background: linear-gradient(var(--paper), rgba(241, 240, 236, 0));
  pointer-events: none;
  opacity: 0; transition: opacity .2s;
}
.tools.stuck::after { opacity: 1; }
.tools.stuck { padding-top: 50px; }

.search { grid-area: search; display: flex; align-items: baseline; gap: 18px; border-bottom: 1px solid var(--rule); padding-bottom: 6px; }
.search input {
  flex: 1; min-width: 0;
  border: 0; background: transparent; outline: none;
  font: 400 clamp(30px, 3.7vw, 52px)/1.1 var(--mono);
  letter-spacing: -.02em;
  color: var(--ink);
  padding: 0;
  caret-color: var(--ink);
  border-radius: 0;
  -webkit-appearance: none; appearance: none;
}
.search input::placeholder { color: var(--ink-3); opacity: 1; }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.count { font-size: 13px; color: var(--ink-3); white-space: nowrap; font-variant-numeric: tabular-nums; }

.filters, .sorts { display: flex; flex-wrap: wrap; gap: 4px 2px; font-size: 13px; padding-bottom: 14px; }
.filters { grid-area: filters; }
.filters.ap { grid-area: ap; padding-top: 0; padding-bottom: 14px; }
.filters.ap:empty { display: none; }
.sheet .districts { list-style: none; margin: 0; padding: 0; font-size: 14px; line-height: 1.5; }
.sheet .districts li + li { margin-top: 2px; }
.sheet .districts .ct { color: var(--ink-3); font-size: 12px; margin-left: 6px; }
.sheet .teach { grid-column: 2 / -1; margin: 18px 0 0; padding-top: 12px; border-top: 1px dashed var(--rule); max-width: 34em; }
.sheet .teach-q { margin: 0 0 8px; font-size: 16px; line-height: 1.45; }
.sheet .teach-q span { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); margin-right: 6px; }
.prose .refs li { margin-bottom: 12px; }
.sorts { grid-area: sorts; justify-content: flex-end; }
.filters button, .sorts button {
  font: inherit; color: var(--ink-2);
  background: none; border: 0; cursor: pointer;
  padding: 2px 6px;
  border-radius: 0;
}
.filters button:hover, .sorts button:hover { color: var(--ink); }
.filters button.on, .sorts button.on { background: var(--ink); color: var(--paper); }
.filters button sup { font-size: 9px; margin-left: 2px; color: inherit; opacity: .55; vertical-align: 4px; }

/* ledger rows */
.ledger { list-style: none; margin: 0; padding: 0; }

.row { border-bottom: 1px solid var(--rule); }
.row > button {
  all: unset; box-sizing: border-box;
  display: grid;
  grid-template-columns: 3.6em minmax(0, 2.3fr) 9em minmax(0, 1.5fr) minmax(0, 1fr) 6.5em;
  column-gap: 20px;
  align-items: baseline;
  width: 100%;
  padding: 15px 8px;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.row > button:hover, .row.open > button { background: var(--ink); color: var(--paper); }
.row > button:hover .n, .row.open > button .n,
.row > button:hover .who, .row.open > button .who,
.row > button:hover .where, .row.open > button .where { color: rgba(241, 240, 236, .62); }
.row > button:focus-visible { outline: 1px solid var(--ink); outline-offset: -1px; }

.row .n { color: var(--ink-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.row .t { font-weight: 700; font-size: 16px; line-height: 1.3; }
.row .t em { font-style: normal; font-weight: 400; font-size: 14px; color: var(--ink-2); }
.row > button:hover .t em, .row.open > button .t em { color: rgba(241, 240, 236, .7); }
.row .who, .row .where { color: var(--ink-2); line-height: 1.35; }
.row .y { text-align: right; font-variant-numeric: tabular-nums; }
.row .y small { font-size: 11px; margin-left: 1px; opacity: .6; }
.row .act {
  justify-self: start;
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  border: 1px solid currentColor;
  padding: 1px 6px 0;
  line-height: 1.5;
}

/* redaction: text sits under a bar until the row is read.
   a background (not a pseudo-element) so wrapped lines each get their own bar */
.rd {
  background: linear-gradient(var(--ink), var(--ink)) no-repeat right center / 100% 100%;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  padding: 0 2px; margin: 0 -2px;
}
.row.seen .rd { background-size: 0% 100%; transition: background-size .55s var(--ease) var(--d, 0s); }
.ledger.quick .row.seen .rd { transition-duration: .3s; }
.row .act.rd { margin: 0; padding: 1px 6px 0; }

mark { background: var(--ink); color: var(--paper); padding: 0 1px; }
.row > button:hover mark, .row.open mark { background: var(--paper); color: var(--ink); }

/* entry detail */
.detail {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .45s var(--ease);
}
.row.open .detail { grid-template-rows: 1fr; }
.detail > div { overflow: hidden; }
.sheet {
  display: grid;
  grid-template-columns: 3.6em minmax(0, 2.3fr) minmax(0, 2.6fr);
  column-gap: 20px;
  padding: 28px 8px 36px;
  border-top: 1px solid var(--ink);
}
.sheet .note { grid-column: 2; font-size: 19px; line-height: 1.42; margin: 0 0 22px; max-width: 34em; text-wrap: pretty; }
.sheet .quote {
  grid-column: 2; margin: 0 0 26px; padding: 0 0 0 18px;
  border-left: 3px solid var(--ink);
  font-style: italic; font-size: 16px; line-height: 1.5; max-width: 38em;
}
.sheet .quote cite { display: block; margin-top: 8px; font-style: normal; font-size: 12px; color: var(--ink-3); }
.sheet .quote cite::before { content: "— "; }
.sheet dl { grid-column: 3; grid-row: 1 / span 3; margin: 0; display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--rule); border-left: 1px solid var(--rule); align-self: start; }
.sheet dl > div { border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: 10px 12px 12px; }
.sheet dl > div.wide { grid-column: 1 / -1; }
.sheet dt { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 4px; }
.sheet dd { margin: 0; line-height: 1.4; }
.sheet .src a { border-bottom: 1px solid var(--rule); word-break: break-word; }
.sheet .src a:hover { border-color: var(--ink); }
.sheet .src li { margin: 0 0 4px; }
.sheet .src ol { margin: 0; padding: 0; list-style: none; }
.sheet .tally { grid-column: 2; margin: 0 0 22px; }
.tally .marks { font-size: 13px; line-height: 1.05; letter-spacing: .05em; word-break: break-all; color: var(--ink); max-width: 36em; }
.tally .cap { font-size: 12px; color: var(--ink-3); margin-top: 8px; }

.empty { padding: 60px 8px; color: var(--ink-3); font-size: 18px; }

/* ——— footer ——— */
.foot {
  display: flex; justify-content: space-between; gap: 20px; align-items: baseline;
  padding: 26px var(--gut) 30px;
  border-top: 1px solid var(--ink);
  font-size: 13px; color: var(--ink-3);
}
.foot a { color: var(--ink); }

/* ——— about ——— */
body.page { min-height: 100vh; display: flex; flex-direction: column; }
.prose {
  flex: 1;
  padding: 22vh var(--gut) 14vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 40em) minmax(0, 1fr);
}
.prose > * { grid-column: 2; }
.prose h1 { font-size: clamp(44px, 7vw, 96px); font-weight: 400; letter-spacing: -.03em; line-height: 1; margin: 0 0 9vh; }
.prose p { font-size: 18px; line-height: 1.6; margin: 0 0 1.2em; text-wrap: pretty; }
.prose h2 { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); font-weight: 400; margin: 7vh 0 18px; }
.prose dl { margin: 0; display: grid; grid-template-columns: 9.5em 1fr; border-top: 1px solid var(--rule); }
.prose dt, .prose dd { margin: 0; padding: 10px 0; border-bottom: 1px solid var(--rule); font-size: 15px; line-height: 1.45; }
.prose dt { text-transform: uppercase; letter-spacing: .12em; font-size: 11px; padding-top: 13px; }
.prose ul { list-style: none; padding: 0; margin: 0; columns: 2; column-gap: 32px; font-size: 14px; line-height: 1.7; }
.prose ul .ct { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.prose ul li { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--rule-2); break-inside: avoid; }
.prose ul a { border-bottom: 1px solid var(--rule); }
.prose ul a:hover { border-color: var(--ink); }
.prose p a { border-bottom: 1px solid var(--ink); }

/* ——— small screens ——— */
@media (max-width: 860px) {
  :root { --fs: 14px; }
  .bar { padding-top: 14px; }
  .type { font-size: min(calc((100vw - 2 * var(--gut)) / 2.92), 30vh); line-height: .96; transform: translateY(-6%); }
  .type .brk { display: inline; }
  .tools { padding-top: 46px; margin-top: 40px; grid-template-columns: 1fr; grid-template-areas: "search" "filters" "ap" "sorts"; row-gap: 10px; }
  .sorts { justify-content: flex-start; padding-bottom: 12px; }
  .filters { padding-bottom: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 calc(var(--gut) * -1); padding: 0 var(--gut); }
  .filters::-webkit-scrollbar { display: none; }
  .filters button { white-space: nowrap; }
  .spine { height: 84px; }
  .row > button {
    grid-template-columns: 2.6em auto minmax(0, 1fr) auto;
    grid-template-areas: "n t t y" ". act where where";
    row-gap: 8px; column-gap: 10px; padding: 14px 4px;
  }
  .row .n { grid-area: n; }
  .row .t { grid-area: t; }
  .row .y { grid-area: y; }
  .row .act { grid-area: act; }
  .row .where { grid-area: where; font-size: 13px; }
  .row .who { display: none; }
  .sheet { grid-template-columns: 2.6em minmax(0, 1fr); column-gap: 12px; padding: 20px 4px 28px; }
  .sheet .note, .sheet .quote, .sheet .tally, .sheet dl { grid-column: 2; grid-row: auto; }
  .sheet .note { font-size: 17px; }
  .sheet dl { grid-template-columns: 1fr; margin-top: 4px; }
  .prose { padding-top: 16vh; grid-template-columns: 1fr; }
  .prose > * { grid-column: 1; }
  .prose dl { grid-template-columns: 1fr; }
  .prose dt { border-bottom: 0; padding-bottom: 0; }
  .prose ul { columns: 1; }
  .foot { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  .rd::after { display: none; }
  .spine i { transform: none; transition: none; }
  .hero-foot .down { animation: none; }
}
