/* Bayardelle & Co. — typographic system
   One typeface (Source Code Pro 300/400/500). Two colours, black and white.
   One size. Every horizontal measure is a whole number of characters (ch);
   every vertical measure is a whole number of lines (--lh). */

@font-face {
  font-family: "Source Code Pro";
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url("/fonts/scp-300.woff2") format("woff2");
}
@font-face {
  font-family: "Source Code Pro";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/scp-400.woff2") format("woff2");
}
@font-face {
  font-family: "Source Code Pro";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/scp-500.woff2") format("woff2");
}
/* Metric-matched fallback: Courier New shares the 0.6em advance width,
   so swapping to Source Code Pro does not reflow lines. */
@font-face {
  font-family: "SCP Fallback";
  src: local("Courier New"), local("CourierNewPSMT"), local("Liberation Mono"), local("Cousine");
  ascent-override: 98.4%;
  descent-override: 27.3%;
  line-gap-override: 0%;
  size-adjust: 100%;
}

:root {
  --ink: #000000;
  --paper: #ffffff;
  --lh: 1.75em;              /* one line */
  --gutter: 6ch;             /* page margin */
  --label: 18ch;             /* section label column */
  --gap: 6ch;                /* label → content */
  --measure: 64ch;           /* content column */
  --key: 20ch;               /* record key column */
  --space: calc(var(--lh) * 5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  background: var(--paper);
  font-family: "Source Code Pro", "SCP Fallback", ui-monospace, monospace;
  font-size: clamp(13px, 0.78rem + 0.22vw, 15px);
  line-height: 1.75;
  letter-spacing: 0;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  background: var(--paper);
  color: var(--ink);
  font-weight: 400;
  font-variant-ligatures: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* one size everywhere: hierarchy comes from weight, case and position */
h1, h2, h3, p, dl, dt, dd, ul, li, address, nav, footer { font-size: 1rem; font-weight: inherit; }

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

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.28em;
}
a:hover { text-decoration: none; background: var(--ink); color: var(--paper); }
:focus-visible {
  outline: 1px solid currentColor;
  outline-offset: 0.5ch;
}
a:focus-visible { background: transparent; color: inherit; }

.skip {
  position: absolute;
  left: var(--gutter);
  top: -10rem;
  background: var(--paper);
}
.skip:focus { top: var(--lh); }

/* ── navigation ─────────────────────────────── */
/* A bar with the mark at left and one control at right. The control opens
   a full-page index of the record. Without script the index stays inline. */

.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 10;
  background: var(--paper);
  color: var(--ink);
  padding: var(--lh) var(--gutter) calc(var(--lh) / 2);
  display: flex;
  align-items: baseline;
  column-gap: 3ch;
}
.nav a { text-decoration: none; }
.nav a:hover { background: var(--ink); color: var(--paper); }
.mark { font-weight: 500; letter-spacing: 0.1ch; position: relative; z-index: 2; }
.clock { font-weight: 300; white-space: nowrap; font-variant-numeric: tabular-nums; letter-spacing: 0.05ch; margin-right: auto; position: relative; z-index: 2; }
html:not(.mjs) .clock { visibility: hidden; }
.foot-time { display: block; font-weight: 400; font-variant-numeric: tabular-nums; letter-spacing: 0.05ch; }
.foot .copy { display: block; font-weight: 300; }
.foot .nw { white-space: nowrap; }
html:not(.mjs) .foot-time, html:not(.mjs) .menu-foot { display: none; }

/* the control: a word and three rules, drawn on the character grid */
.burger {
  display: none;
  align-items: baseline;
  column-gap: 1.5ch;
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  position: relative;
  z-index: 2;
}
.burger-label { font-weight: 300; }
.nav .aux { font-weight: 300; text-decoration: none; position: relative; z-index: 2; }
.nav .aux[aria-current="page"] { font-weight: 500; text-decoration: none; }
.burger:hover .burger-label { background: var(--ink); color: var(--paper); }
.burger:focus-visible { outline: 1px solid currentColor; outline-offset: 0.5ch; }
.burger-icon {
  position: relative;
  display: inline-block;
  width: 2ch;
  height: 0.6em;
  align-self: center;
}
.burger-icon i {
  position: absolute;
  left: 0; right: 0;
  height: 1px;
  background: currentColor;
  transition: transform 160ms linear, opacity 160ms linear, top 160ms linear;
}
.burger-icon i:nth-child(1) { top: 0; }
.burger-icon i:nth-child(2) { top: calc(50% - 0.5px); }
.burger-icon i:nth-child(3) { top: calc(100% - 1px); }
html.menu-open .burger-icon i:nth-child(1) { top: calc(50% - 0.5px); transform: rotate(45deg); }
html.menu-open .burger-icon i:nth-child(2) { opacity: 0; }
html.menu-open .burger-icon i:nth-child(3) { top: calc(50% - 0.5px); transform: rotate(-45deg); }

/* the index, inline when there is no script */
.menu ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  column-gap: 3ch;
}
.menu .n { display: none; }
.menu-foot { display: none; }
.nav a[aria-current="true"] { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.28em; }

/* with script: the control appears and the index becomes a page */
html.mjs .burger { display: inline-flex; }
html.mjs .menu {
  position: fixed;
  inset: 0;
  z-index: 1;
  background: var(--paper);
  color: var(--ink);
  padding: calc(var(--lh) * 5) var(--gutter) calc(var(--lh) * 2);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  visibility: hidden;
  opacity: 0;
  transition: opacity 160ms linear, visibility 0s linear 160ms;
}
html.mjs.menu-open .menu {
  visibility: visible;
  opacity: 1;
  transition: opacity 160ms linear;
}
html.mjs .menu ol {
  display: block;
  max-width: calc(var(--label) + var(--gap) + var(--measure));
}
html.mjs .menu a {
  display: block;
  padding: calc(var(--lh) / 4) 0;
  font-weight: 300;
}
html.mjs .menu a:hover,
html.mjs .menu a:focus-visible { background: none; color: var(--ink); font-weight: 500; }
html.mjs .menu a:focus-visible { outline: none; }
html.mjs .menu a[aria-current], html.mjs .menu a[aria-current] .t { text-decoration: none; }
html.mjs .menu a[aria-current="page"] { font-weight: 500; }
html.mjs .menu-foot {
  display: block;
  margin-top: auto;
  padding-top: calc(var(--lh) * 2);
  font-weight: 300;
}
html.menu-open { overflow: hidden; }
html.menu-open body { overflow: hidden; }

/* over the black ending, the bar inverts with it (not while the index is open) */
html.inv:not(.menu-open) .nav { background: var(--ink); color: var(--paper); }
html.inv:not(.menu-open) .nav a:hover,
html.inv:not(.menu-open) .burger:hover .burger-label { background: var(--paper); color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  .burger-icon i, html.mjs .menu, html.mjs.menu-open .menu { transition: none; }
}

/* ── layout ─────────────────────────────────── */

.wrap { padding: 0 var(--gutter); }

.section {
  display: grid;
  grid-template-columns: var(--label) minmax(0, var(--measure));
  column-gap: var(--gap);
  padding-top: var(--space);
}
.section.solo { grid-template-columns: minmax(0, calc(var(--label) + var(--gap) + var(--measure))); padding-top: calc(var(--space) + var(--lh)); }
.section > .label { font-weight: 300; }
.section > .label .n { display: block; }
.section .body > * + * { margin-top: var(--lh); }
.section > .label,
.section .body { scroll-margin-top: calc(var(--lh) * 6); }

/* opening */
.opening {
  padding: calc(var(--lh) * 2 + var(--space)) var(--gutter) 0;
}
.opening h1 {
  font-weight: 500;
  letter-spacing: 1ch;          /* one full cell between letters: stays on the grid */
}
.opening .identity p { font-weight: 300; }
.opening .timepiece {
  margin-top: var(--lh);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.05ch;
}
html:not(.js-on) .opening .timepiece,
html.tp-wait .opening .timepiece { visibility: hidden; }
.opening .identity h1 + p { margin-top: calc(var(--lh) / 2); }
.opening .statement {
  align-self: end;
  padding-bottom: var(--lh);
  font-weight: 300;
  max-width: var(--measure);
}

/* record */
.record {
  display: grid;
  grid-template-columns: var(--key) minmax(0, 1fr);
  column-gap: 0;
  row-gap: calc(var(--lh) / 2);
}
.record dt { font-weight: 300; }
.record dd { font-weight: 400; }

/* activities */
.lines { list-style: none; }
.lines li + li { margin-top: calc(var(--lh) / 2); }
.lines .k { display: block; font-weight: 500; }
.lines .v { display: block; font-weight: 300; }

/* ── the ending: black, white type ─────────── */

.dark {
  background: var(--ink);
  color: var(--paper);
}
.dark ::selection { background: var(--paper); color: var(--ink); }
.dark a:hover { background: var(--paper); color: var(--ink); }

.ending {
  margin-top: var(--space);
  padding-bottom: calc(var(--lh) * 4);
}
.coda { padding-top: calc(var(--lh) * 6); }
.coda .stamp { font-weight: 300; }
.coda .stamp + .stamp { margin-top: 0; }
.coda .digest { overflow-wrap: anywhere; }
.lines .sn { font-weight: 300; margin-right: 2ch; }

.foot {
  padding: var(--space) var(--gutter) var(--lh);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: end;
  gap: var(--lh) 6ch;
  font-weight: 300;
}
.foot ul { list-style: none; display: flex; gap: 3ch; }
.foot a { text-decoration: none; }
.foot a:hover { background: var(--ink); color: var(--paper); }

/* the homepage: one compact block, one gap (--g) throughout.
   The masthead (name and stance) sits top left where the mark was,
   the clock top right where the menu was; then registry, then footer. */
body.one { --g: calc(var(--lh) * 2.5); }
body.one .nav { position: relative; align-items: flex-start; }
body.one .masthead h1 { font-weight: 500; letter-spacing: 1ch; }
body.one .masthead p { font-weight: 300; margin-top: calc(var(--lh) / 2); }
body.one .clock { margin-right: 0; margin-left: auto; }
body.one .section.solo { padding-top: calc(var(--g) - var(--lh) / 2); }
body.one .record dd:last-of-type { margin-bottom: 0; }
body.one .foot { padding-top: var(--g); }
@media (max-width: 560px) {
  body.one { --g: calc(var(--lh) * 2); }
  body.one .nav { column-gap: 2ch; }
  body.one .masthead h1 { letter-spacing: 0.5ch; }
}
@media (max-width: 560px) and (max-height: 700px) {
  body.one { --g: calc(var(--lh) * 1.75); }
  body.one .foot { padding-bottom: calc(var(--lh) / 2); }
}
@media (max-width: 560px) and (max-height: 640px) {
  body.one { --g: calc(var(--lh) * 1.5); }
  body.one .record dd { margin-bottom: 0; }
}

@media (max-width: 860px) {
  :root { --gutter: 3ch; --key: 18ch; --space: calc(var(--lh) * 4); }
  .section {
    grid-template-columns: minmax(0, 1fr);
    row-gap: var(--lh);
  }
  .section > .label .n { display: inline; margin-right: 2ch; }
}
@media (max-width: 560px) {
  :root { --gutter: 2ch; }
  .record { grid-template-columns: minmax(0, 1fr); row-gap: 0; }
  .record dd { margin-bottom: calc(var(--lh) / 2); }
  .foot { flex-direction: column; align-items: flex-start; }
}

/* ── document pages (privacy, 404) ─────────── */

.doc {
  padding: calc(var(--lh) * 5) var(--gutter) calc(var(--lh) * 6);
  max-width: calc(var(--measure) + var(--gutter) * 2);
}
.doc h1 { font-weight: 500; }
.doc .meta { font-weight: 300; }
.doc h2 { font-weight: 500; margin-top: calc(var(--lh) * 2); }
.doc p, .doc ul, .doc address { margin-top: var(--lh); }
.doc .meta { margin-top: 0; }
.doc ul { list-style: none; }
.doc ul li { padding-left: 2ch; text-indent: -2ch; }
.doc ul li::before { content: "– "; }
.doc ul li + li { margin-top: calc(var(--lh) / 2); }
.doc address { font-style: normal; }
.doc strong { font-weight: 500; }

/* ── signal ─────────────────────────────────── */
/* Text is complete in the HTML. Script splits it into cells; a cell is
   hidden, shown, or decoding. A decoding cell keeps its real character
   (transparent, still read and copied) and draws a shifting glyph over it. */

html.tp [data-type], html.tp .section > .label { opacity: 0; }
.c { opacity: 0; position: relative; }
.c.on { opacity: 1; }
.c.g { opacity: 1; color: transparent; }
.c.g::after {
  content: attr(data-g);
  position: absolute;
  left: 0; top: 0;
  width: 1ch;
  line-height: normal;
  text-align: center;
  overflow: hidden;
  color: var(--ink);
  font-weight: 300;
  opacity: 0.5;
}
.dark .c.g::after { color: var(--paper); }

@media (prefers-reduced-motion: reduce) {
  html.tp [data-type], html.tp .section > .label, .c { opacity: 1; }
  .c.g { color: inherit; }
  .c.g::after { content: none; }
}

@media print {
  .nav, .skip, .menu { display: none !important; }
  .c, html.tp [data-type], html.tp .section > .label { opacity: 1 !important; }
  .c.g { color: inherit !important; }
  .c.g::after { content: none !important; }
  .clock { display: none; }
  .dark { background: none; color: #000; }
  .opening { min-height: 0; }
}
