/* The paper house: the design system for The Spare Room's public pages.
   Paper and ink, a typewriter for the record, a book face for places and prose, and one blue
   for the house's own acts. Pages opt in by linking this file. */

:root {
  --paper: #f3efe4;
  --paper-2: #ebe5d6;
  --paper-3: #e2dbc9;
  --ink: #1c1a17;
  --pencil: #57524a;
  --margin: #8a8477;
  --rule: #b9b2a3;
  --house: #2b44c6;
  --house-wash: #2b44c61a;
  --struck: #a8231b;
  --graphite: #4f5560;
  --night: #1f1e1b;
  --night-2: #282723;
  --night-ink: #d6d0c2;
  --night-pencil: #a59e8f;
  --night-house: #8fa2ff;

  --record: "Courier Prime", "Courier New", Courier, monospace;
  --book: "EB Garamond", Garamond, "Times New Roman", serif;
  --hand: "Caveat", "Bradley Hand", cursive;

  --size: 16px;
  --small: 14px;
  --lead: 1.55;

  color-scheme: light;
}

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

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

body.paper {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--size)/var(--lead) var(--record);
  font-variant-numeric: tabular-nums;
  text-rendering: optimizeLegibility;
  /* a faint, still paper grain: two offset dot fields, no motion */
  background-image:
    radial-gradient(#1c1a1706 1px, transparent 1.2px),
    radial-gradient(#1c1a1704 1px, transparent 1.2px);
  background-size: 7px 7px, 11px 11px;
  background-position: 0 0, 3px 5px;
}

::selection { background: var(--ink); color: var(--paper); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.night :focus-visible, .night-room :focus-visible { outline-color: var(--night-ink); }
.paper ::-webkit-scrollbar { width: 10px; height: 10px; }
.paper ::-webkit-scrollbar-track { background: transparent; }
.paper ::-webkit-scrollbar-thumb { background: var(--rule); border: 3px solid var(--paper); }
.paper { scrollbar-color: var(--rule) transparent; scrollbar-width: thin; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip { position: absolute; left: -9999px; top: 8px; background: var(--ink); color: var(--paper); padding: 6px 10px; z-index: 10; }
.skip:focus { left: 8px; }

/* ---- the house's own acts are written in its blue (calls, its lines, what it inserts) */

/* ---- links are ink with an underline; nothing is a pill */
a, .link {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: var(--margin);
}
a:hover, .link:hover { text-decoration-color: currentColor; }
button.link { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }

/* ---- the one stamp: solid ink, square, a single primary action per screen */
.stamp {
  display: inline-block;
  white-space: nowrap;
  background: var(--ink);
  color: var(--paper);
  font: 700 var(--small)/1 var(--record);
  letter-spacing: 0.08em;
  text-transform: lowercase;
  text-decoration: none;
  padding: 9px 14px 8px;
  border: 0;
  cursor: pointer;
}
.stamp::before { content: "[ "; }
.stamp::after { content: " ]"; }
@media (hover: hover) { .stamp:hover { background: var(--pencil); color: var(--paper); } }

/* ---- the quiet controls: bracketed words */
.bracket {
  background: none; border: 0; padding: 2px 0; font: inherit; color: var(--pencil); cursor: pointer;
}
.bracket::before { content: "["; }
.bracket::after { content: "]"; }
.bracket:hover { color: var(--ink); }
.bracket[aria-pressed="true"] { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

/* ---- headings: the book hand */
.chapter {
  font: 400 clamp(34px, 4.2vw, 54px)/1.05 var(--book);
  letter-spacing: -0.01em;
  margin: 0;
  text-wrap: balance;
}
.chapter small { display: block; font: italic 400 0.42em/1.3 var(--book); color: var(--pencil); letter-spacing: 0; margin-top: 0.35em; }
.section-head {
  font: 500 15px/1.2 var(--book);
  font-variant: small-caps;
  letter-spacing: 0.12em;
  color: var(--pencil);
  margin: 0 0 10px;
  display: flex; align-items: baseline; gap: 12px;
}
.section-head::after { content: ""; flex: 1; border-top: 1px solid var(--rule); transform: translateY(-4px); }

.prose { font: 400 19px/1.55 var(--book); max-width: 62ch; hyphens: auto; }
.prose p { margin: 0 0 0.7em; }

/* ---- footnotes: a superscript mark and the note it points to */
.mark {
  font: 700 0.72em/0 var(--record);
  vertical-align: super;
  color: var(--pencil);
  margin-left: 1px;
}
.mark.house { color: var(--house); }
.note { font-size: var(--small); color: var(--pencil); }
.note .mark { margin: 0 6px 0 0; font-size: 0.85em; }

/* ---- struck and inserted: what was written, and what the house would rather */
s, .struck { text-decoration: line-through; text-decoration-color: var(--struck); text-decoration-thickness: 1.5px; color: inherit; }
.inserted { color: var(--house); position: relative; }
.inserted::before { content: "‸"; position: absolute; left: -0.3em; bottom: -0.55em; font-size: 0.8em; color: var(--house); }

/* ---- meters: a row of cells, inked or empty, like boxes ticked on a form */
.meter { white-space: nowrap; }
.meter .cells { display: inline-flex; gap: 2px; vertical-align: -1px; }
.meter i { display: block; width: 7px; height: 11px; border: 1px solid var(--ink); }
.meter i.on { background: var(--ink); }
.meter i.off { border-color: var(--rule); }
.meter.low i.on { background: var(--struck); border-color: var(--struck); }
.night .meter i { border-color: var(--night-ink); }
.night .meter i.on { background: var(--night-ink); }
.night .meter i.off { border-color: #55524a; }

/* ---- time and measures in the margin */
.when { font-size: var(--small); color: var(--pencil); white-space: nowrap; }
.measure { font: 400 var(--small)/1 var(--record); color: var(--pencil); }

/* ---- visitors' marks: pencil in someone else's hand */
.visitor-mark { font: 400 21px/1 var(--hand); color: var(--graphite); }

/* ---- night paper: the leaf of someone who cannot see */
.night { background: var(--night); color: var(--night-ink); }
.night .when, .night .note, .night .section-head, .night .chapter small { color: var(--night-pencil); }
.night .section-head::after { border-color: #44413a; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
