/* Double Space Project: the proofreader's desk.
   Paper, ink and one red pen. No double spaces were harmed. */

@font-face { font-family: "Newsreader"; src: url("/static/fonts/newsreader-var.woff2") format("woff2");
  font-weight: 200 800; font-style: normal; font-display: swap; }
@font-face { font-family: "Newsreader"; src: url("/static/fonts/newsreader-var-italic.woff2") format("woff2");
  font-weight: 200 800; font-style: italic; font-display: swap; }
@font-face { font-family: "Space Mono"; src: url("/static/fonts/space-mono-400.woff2") format("woff2");
  font-weight: 400; font-display: swap; }
@font-face { font-family: "Space Mono"; src: url("/static/fonts/space-mono-700.woff2") format("woff2");
  font-weight: 700; font-display: swap; }

:root {
  --paper: #f8f5f0;
  --paper-2: #efe9df;
  --card: #fffdf9;
  --ink: #1d1b19;
  --ink-2: #3a3632;
  --muted: #6b645c;
  --rule: #d9d1c4;
  --red: #c0392b;
  --red-ink: #a5281c;
  --red-wash: rgba(192, 57, 43, 0.09);
  --green: #2f7d4f;
  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --mono: "Space Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --wrap: 72rem;
  --radius: 4px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.125rem/1.6 var(--serif);
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1 0 auto; }
[hidden] { display: none !important; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--red-ink); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--red); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; border-radius: 2px; }
h1, h2, h3 { font-weight: 600; line-height: 1.15; letter-spacing: -0.01em; text-wrap: balance; margin: 0 0 0.5em; }
h1 { font-size: clamp(2.1rem, 4.5vw, 3.2rem); }
h2 { font-size: 1.6rem; }
p { margin: 0 0 1em; text-wrap: pretty; }

.wrap { width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto; }
.sr-only, .hp { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0.5rem; background: var(--ink); color: var(--paper); padding: 0.5rem 1rem; z-index: 10; }
.skip:focus { left: 0.5rem; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 0.9em; }

.kicker {
  font: 700 0.75rem/1.4 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--red);
  margin: 0 0 0.9rem;
}

/* --- masthead ------------------------------------------------------------ */
.masthead { border-bottom: 1px solid var(--ink); background: var(--paper); position: sticky; top: 0; z-index: 5; }
.masthead__inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 4rem; }
.brand { display: inline-flex; align-items: center; gap: 0.7rem; color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--ink); }
.brand__logo {
  /* Wouter's own MS Paint logo, used as a mask so it can wear the red pen. */
  width: 48px; height: 24px; background: var(--red);
  -webkit-mask: url("/static/img/logo.png") center / contain no-repeat;
  mask: url("/static/img/logo.png") center / contain no-repeat;
}
.brand__name { font: 700 1.05rem/1 var(--mono); letter-spacing: -0.02em; }
.nav { display: flex; gap: 0.25rem; flex-wrap: wrap; }
.nav a {
  font: 400 0.85rem/1 var(--mono); color: var(--ink); text-decoration: none;
  padding: 0.85rem 0.7rem; border-bottom: 2px solid transparent;
}
.nav a:hover { color: var(--red); }
.nav a[aria-current="page"] { border-bottom-color: var(--red); }

/* --- buttons ----------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 2.75rem; padding: 0.6rem 1.15rem;
  font: 700 0.85rem/1.2 var(--mono); letter-spacing: 0.01em;
  border-radius: var(--radius); border: 1.5px solid var(--ink);
  text-decoration: none; cursor: pointer; transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn--ink { background: var(--ink); color: var(--paper); }
.btn--ink:hover { background: var(--red); border-color: var(--red); color: #fff; }
.btn--line { background: transparent; color: var(--ink); }
.btn--line:hover { border-color: var(--red); color: var(--red); }
.btn--big { min-height: 3.2rem; padding-inline: 1.6rem; font-size: 0.95rem; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* --- the specimen: a red proof mark on every double space ------------------- */
.ds {
  white-space: pre;
  background: var(--red-wash);
  border-radius: 2px;
  padding: 0 0.06em;
  box-shadow: inset 0 -0.08em 0 var(--red-wash);
}
.ds .sp {
  display: inline-block;
  width: 0.48em;
  height: 0.34em;
  margin: 0 0.035em;
  border: 0.085em solid var(--red);
  border-top: 0;
  vertical-align: -0.02em;
  overflow: hidden;
  color: transparent;
}
.quote {
  font-family: var(--serif);
  white-space: pre-line;
  overflow-wrap: anywhere;
  margin: 0;
}
.quote--big { font-size: clamp(1.45rem, 2.6vw, 1.9rem); line-height: 1.45; font-weight: 420; }
.quote--small { font-size: 1.15rem; line-height: 1.5; color: var(--ink-2); }

/* --- hero ---------------------------------------------------------------------- */
.hero { padding: clamp(2.5rem, 7vw, 5.5rem) 0 2.5rem; }
.hero__title {
  font-size: clamp(2.6rem, 7.4vw, 5.6rem);
  font-weight: 500; line-height: 1.02; letter-spacing: -0.025em;
  max-width: 13ch; margin-bottom: 2rem;
}
.hero__cols { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 3rem; align-items: end;
  border-top: 1px solid var(--ink); padding-top: 1.5rem; }
.hero__lede { font-size: 1.3rem; line-height: 1.5; color: var(--ink-2); max-width: 38ch; margin: 0; }
.hero__actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 2rem; }
.tally { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.tally__num { font: 700 clamp(3rem, 6vw, 4.5rem)/1 var(--mono); color: var(--red); letter-spacing: -0.04em; }
.tally__label { font: 400 0.8rem/1.4 var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }

/* --- sections ------------------------------------------------------------------ */
.section { padding: 2.5rem 0; }
.section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  border-bottom: 1px solid var(--ink); padding-bottom: 0.6rem; margin-bottom: 0; }
.section__head h2 { margin: 0; font-size: 1.35rem; }
.more { font: 400 0.85rem var(--mono); }
.page-head { margin-bottom: 2rem; max-width: 46rem; }
.page-head h1 { margin-bottom: 0.4em; }
.lede { font-size: 1.25rem; color: var(--ink-2); line-height: 1.5; }
.center-block { text-align: center; max-width: 40rem; padding-block: 5rem; }
.center-block .hero__actions { justify-content: center; }
.note { max-width: 46rem; margin-left: max(1.25rem, (100% - var(--wrap)) / 2); }
.note h2 { font-size: 1.35rem; }
.note p { color: var(--ink-2); }
.note__aside { font-style: italic; color: var(--muted); }

/* --- entry rows (the ledger) ---------------------------------------------------- */
.rows { display: flex; flex-direction: column; }
.row {
  display: grid;
  grid-template-columns: 9.5rem minmax(0, 1fr) 11rem;
  gap: 1.75rem;
  padding: 1.6rem 0;
  border-bottom: 1px solid var(--rule);
  align-items: start;
}
.row__meta { display: flex; flex-direction: column; gap: 0.2rem; font: 400 0.78rem/1.4 var(--mono); color: var(--muted); padding-top: 0.25rem; }
.row__exhibit { color: var(--red); font-weight: 700; letter-spacing: 0.02em; }
.row__title { font-size: 1.35rem; margin: 0 0 0.5rem; }
.row__title a { color: var(--ink); text-decoration: none; }
.row__title a:hover { color: var(--red); text-decoration: underline; }
.row__desc { color: var(--ink-2); margin: 0; }
.row__foot { display: flex; flex-wrap: wrap; gap: 0.35rem 1.1rem; margin: 0.7rem 0 0; font: 400 0.78rem/1.4 var(--mono); color: var(--muted); }
.row__thumb { display: block; border: 1px solid var(--rule); background: var(--card); padding: 4px; border-radius: 2px; }
.row__thumb img { width: 100%; height: auto; max-height: 9rem; object-fit: contain; object-position: left center; }
.row:not(:has(.row__thumb)) { grid-template-columns: 9.5rem minmax(0, 1fr); }
.empty { border: 1px dashed var(--rule); padding: 3rem 1.5rem; text-align: center; color: var(--muted); margin-top: 1.5rem; }

/* --- filters ------------------------------------------------------------------- */
.filters { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
  border-top: 1px solid var(--ink); border-bottom: 1px solid var(--rule); padding: 0.8rem 0; }
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip, .sorts a {
  font: 400 0.78rem/1 var(--mono); color: var(--ink); text-decoration: none;
  padding: 0.55rem 0.7rem; border: 1px solid var(--rule); border-radius: 999px; background: var(--card);
}
.chip:hover, .sorts a:hover { border-color: var(--ink); color: var(--ink); }
.chip[aria-current="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.sorts { display: flex; gap: 0.4rem; }
.sorts a[aria-current="true"] { border-color: var(--red); color: var(--red); }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1.5rem 0; font: 400 0.85rem var(--mono); }
.pager__step { flex: 0 0 auto; min-width: 5.5rem; }
.pager__step[rel="next"] { text-align: right; }
.pager__pages { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.3rem; list-style: none; margin: 0; padding: 0; }
.pager__pages a, .pager__gap button {
  display: inline-flex; align-items: center; justify-content: center; min-width: 2.2rem; height: 2.2rem; padding: 0 0.5rem;
  font: 400 0.82rem/1 var(--mono); color: var(--ink); text-decoration: none;
  border: 1px solid var(--rule); border-radius: var(--radius); background: var(--card);
}
.pager__pages a:hover, .pager__gap button:hover { border-color: var(--red); color: var(--red); }
.pager__pages a.is-current { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.pager__gap button { cursor: pointer; border-style: dashed; color: var(--muted); }

/* --- search ------------------------------------------------------------------- */
.search { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1rem; margin-bottom: 1.2rem; }
.search__input {
  flex: 1 1 18rem; min-height: 2.75rem; padding: 0.55rem 0.8rem;
  font: 400 1rem/1.3 var(--serif); color: var(--ink); background: var(--card);
  border: 1.5px solid var(--ink); border-radius: var(--radius);
}
.search__input:focus { outline: 2px solid var(--red); outline-offset: 1px; }
.search__scope { display: inline-flex; align-items: center; gap: 0.4rem; font: 400 0.8rem var(--mono); color: var(--ink-2); cursor: pointer; }
.search__scope input { accent-color: var(--red); }
.search__clear { font: 400 0.8rem var(--mono); color: var(--muted); }
.search__clear:hover { color: var(--red); }
.random-btn { width: 100%; margin-top: 0.75rem; }

/* --- exhibit (entry detail) ------------------------------------------------------ */
.exhibit { padding: 2rem 0 3rem; }
.crumbs { font: 400 0.82rem var(--mono); margin-bottom: 2rem; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--red); }
.exhibit__head { border-bottom: 1px solid var(--ink); padding-bottom: 1.25rem; margin-bottom: 2rem; max-width: 52rem; }
.exhibit__head h1 { margin-bottom: 0.25em; }
.exhibit__by { color: var(--muted); font-style: italic; font-size: 1.2rem; margin: 0; }
.exhibit__grid { display: grid; grid-template-columns: minmax(0, 1fr) 17rem; gap: 3.5rem; align-items: start; }
.exhibit__main { display: flex; flex-direction: column; gap: 2.25rem; }
.evidence { margin: 0; padding: 2rem 2rem 1.5rem; background: var(--card); border: 1px solid var(--rule);
  border-radius: var(--radius); position: relative; }
.evidence figcaption, .photo figcaption { font: 400 0.75rem/1.5 var(--mono); color: var(--muted); margin-top: 1rem; }
.photo { margin: 0; }
.photo a { display: block; border: 1px solid var(--rule); background: var(--card); padding: 6px; border-radius: 2px; cursor: zoom-in; }
.prose { max-width: 40rem; }
.prose--wide { max-width: 44rem; }
.prose h2 { font-size: 1.4rem; margin-top: 2.2rem; }
.prose ul { padding-left: 1.2rem; }
.prose li { margin-bottom: 0.35rem; }
.exhibit__side { position: sticky; top: 5.5rem; }
.facts { margin: 0 0 1.5rem; display: grid; grid-template-columns: 1fr; border-top: 1px solid var(--ink); }
.facts dt { font: 400 0.7rem/1.3 var(--mono); text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); padding-top: 0.8rem; }
.facts dd { margin: 0.15rem 0 0; padding-bottom: 0.8rem; border-bottom: 1px solid var(--rule); overflow-wrap: anywhere; }
.side-note { font-size: 0.95rem; color: var(--muted); margin-top: 1rem; }

.like {
  width: 100%; display: flex; align-items: center; gap: 0.6rem; justify-content: center;
  min-height: 3rem; padding: 0.6rem 1rem; cursor: pointer;
  font: 700 0.9rem/1 var(--mono); color: var(--red); background: transparent;
  border: 1.5px solid var(--red); border-radius: var(--radius); transition: background 0.15s, color 0.15s;
}
.like:hover:not(:disabled) { background: var(--red); color: #fff; }
.like__heart { font-size: 1.15rem; transition: transform 0.2s; }
.like:hover:not(:disabled) .like__heart { transform: scale(1.2); }
.like__count { font-weight: 400; opacity: 0.85; }
.like.is-liked { background: var(--red); color: #fff; cursor: default; opacity: 1; }

/* --- forms --------------------------------------------------------------------- */
.submit-grid { display: grid; grid-template-columns: minmax(0, 1fr) 19rem; gap: 3.5rem; align-items: start; }
.form fieldset { border: 0; border-top: 1px solid var(--ink); margin: 0 0 1.5rem; padding: 1rem 0 0; }
.form legend { font: 700 0.8rem/1 var(--mono); text-transform: uppercase; letter-spacing: 0.07em; padding: 0 0.6rem 0 0; }
.optional, .req { font: 400 0.7rem var(--mono); color: var(--muted); text-transform: none; letter-spacing: 0; margin-left: 0.4rem; }
.req { color: var(--red); }
.field { margin-bottom: 1.1rem; display: flex; flex-direction: column; gap: 0.35rem; }
.field--narrow { max-width: 16rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.field label { font: 700 0.85rem/1.3 var(--mono); }
.hint { font: 400 0.75rem/1.5 var(--mono); color: var(--muted); margin: 0; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
  font: 400 1.05rem/1.45 var(--serif); color: var(--ink);
  background: var(--card); border: 1px solid #bdb3a4; border-radius: var(--radius);
  padding: 0.65rem 0.8rem; width: 100%; min-height: 2.9rem;
}
input[type=file] { font: 400 0.85rem var(--mono); padding: 0.5rem 0; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--red); outline-offset: 0; border-color: var(--red); }
::placeholder { color: #a39a8e; }
.form-errors { border: 1.5px solid var(--red); background: var(--red-wash); padding: 1rem 1.25rem; border-radius: var(--radius); margin-bottom: 1.5rem; }
.form-errors ul { margin: 0; padding-left: 1.2rem; }
.form-errors p { margin-bottom: 0.4rem; }
.quote-preview { border-left: 3px solid var(--green); background: var(--card); padding: 0.75rem 1rem; }
.quote-preview.is-none { border-left-color: var(--rule); }
.quote-preview__status { font: 700 0.75rem/1.4 var(--mono); color: var(--green); margin: 0 0 0.4rem; }
.quote-preview.is-none .quote-preview__status { color: var(--muted); font-weight: 400; }
.image-preview { max-height: 16rem; width: auto; border: 1px solid var(--rule); padding: 4px; background: var(--card); }
.captcha { margin: 0.5rem 0 1.5rem; min-height: 78px; }
.submit-aside { position: sticky; top: 5.5rem; background: var(--paper-2); padding: 1.5rem; border-radius: var(--radius); }
.submit-aside h2 { font-size: 1.2rem; }
.checklist { padding-left: 1.3rem; margin: 0 0 1.25rem; }
.checklist li { margin-bottom: 0.8rem; font-size: 1rem; }
.checklist li::marker { font-family: var(--mono); color: var(--red); font-weight: 700; }
.submit-aside .muted { font-size: 0.95rem; margin: 0; }

/* --- lint ---------------------------------------------------------------------- */
.lint { max-width: 52rem; }
.lint__input { font-family: var(--mono) !important; font-size: 0.95rem !important; min-height: 14rem; }
.lint__bar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin: 0.9rem 0 1.25rem; }
.lint__status { margin: 0; font: 700 0.85rem var(--mono); color: var(--muted); }
.lint__status.is-bad { color: var(--red); }
.lint__status.is-good { color: var(--green); }
.lint__actions { display: flex; gap: 0.5rem; }
.lint__out { background: var(--card); border: 1px solid var(--rule); padding: 1.25rem 1.5rem; font-size: 1.1rem; min-height: 4rem; border-radius: var(--radius); }
.lint__out[hidden] { display: none; }

/* --- flashes ------------------------------------------------------------------- */
.flash { margin: 1.25rem 0 0; padding: 0.75rem 1rem; font: 400 0.85rem var(--mono); border-radius: var(--radius); background: #e6f0e8; border: 1px solid #b7d3bf; color: #1f5135; }
.flash--err { background: var(--red-wash); border-color: var(--red); color: var(--red-ink); }

/* --- footer -------------------------------------------------------------------- */
.footer { border-top: 1px solid var(--ink); margin-top: 3rem; padding: 1.6rem 0 2.2rem; font: 400 0.8rem/1.5 var(--mono); color: var(--muted); }
.footer__inner { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.footer p { margin: 0; }
.footer__links { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.footer a { color: var(--muted); }
.footer a:hover { color: var(--red); }

/* --- responsive ---------------------------------------------------------------- */
@media (max-width: 60rem) {
  .exhibit__grid, .submit-grid { grid-template-columns: 1fr; gap: 2rem; }
  .exhibit__side, .submit-aside { position: static; }
  .row { grid-template-columns: minmax(0, 1fr) 8rem; }
  .row:not(:has(.row__thumb)) { grid-template-columns: 1fr; }
  .row__meta { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; gap: 0.2rem 1rem; padding: 0; }
}
@media (max-width: 40rem) {
  body { font-size: 1.0625rem; }
  .masthead { position: static; }
  .masthead__inner { flex-direction: column; align-items: flex-start; gap: 0; padding-top: 0.8rem; }
  .nav { margin-left: -0.7rem; }
  .hero__cols { grid-template-columns: 1fr; gap: 1.5rem; }
  .pager { flex-wrap: wrap; }
  .pager__pages { order: -1; flex-basis: 100%; }
  .pager__wide { display: none; }
  .tally { align-items: flex-start; text-align: left; }
  .row { grid-template-columns: 1fr; gap: 0.9rem; }
  .row__thumb { max-width: 14rem; }
  .field-row { grid-template-columns: 1fr; gap: 0; }
  .evidence { padding: 1.5rem 1.25rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
@media print {
  .masthead, .footer, .like, .side-note, .crumbs { display: none; }
  body { background: #fff; }
}
