/* xuranium.com — one stylesheet, hand-written, no framework, no build step, no web fonts.
   The site is set as a printed document: a margin rule, one measure, hairline-closed rows
   with right-aligned tabular figures, letter-spaced small-caps labels. The reason is not
   taste. Both of the two most developed apps have a printed page as their paid artefact
   (04-perilog's appointment pack; 05-betledger's ruled statement), and every app's
   brand.md specifies "system fonts only, no @font-face, no external fetches".

   The company deliberately has NO accent colour. Ink, paper, hairlines. Each app page
   declares its own --accent locally and nothing else on the site uses one. */

/* ---------------------------------------------------------------- tokens */

:root {
  color-scheme: light dark;

  --paper:      #fbfaf7;
  --sheet:      #ffffff;
  --ink:        #1a1712;
  --muted:      #6d665b;
  --hairline:   #d7d1c4;
  --hairline-2: #ebe6dc;

  /* No --accent here. The company has none. App pages set it themselves. */
  --accent:     var(--ink);
  --accent-ink: var(--ink);

  --measure: 36rem;   /* prose: ~66 characters */
  --gutter:  9.5rem;  /* width of the left margin, i.e. where the rule sits */
  --pad:     clamp(1.15rem, 4.5vw, 2.25rem);

  --stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
           Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:      #131210;
    --sheet:      #191713;
    --ink:        #ece7dd;
    --muted:      #9b9284;
    --hairline:   #363127;
    --hairline-2: #262218;
  }
}

/* ---------------------------------------------------------------- reset */

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--stack);
  font-size: 16.5px;
  line-height: 1.62;
  font-synthesis: none;
  hanging-punctuation: first allow-end;
  -webkit-font-smoothing: antialiased;
}

@media (min-width: 40rem) { body { font-size: 17px; } }

h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
strong, b { font-weight: 600; }
em { font-style: italic; }

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-color: var(--hairline);
}
a:hover, a:focus-visible {
  text-decoration-thickness: 2px;
  text-decoration-color: currentColor;
}
a:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

/* ---------------------------------------------------------------- shell */

.page {
  max-width: 62rem;
  margin: 0 auto;
  padding: 0 var(--pad) 0;
}

/* The margin rule. One continuous hairline down the whole document, drawn as a
   background on the body wrapper so it never breaks between sections. */
.doc {
  background:
    linear-gradient(var(--hairline), var(--hairline)) var(--gutter) 0 / 1px 100% repeat-y;
}

.sect {
  display: grid;
  grid-template-columns: var(--gutter) minmax(0, 1fr);
  padding: 2.4rem 0 0;
}
.sect > .marginalia {
  grid-column: 1;
  padding: 0.15rem 1.15rem 0 0;
  text-align: right;
}
.sect > .flow {
  grid-column: 2;
  padding-left: 1.9rem;
  min-width: 0;
}

.flow > * + * { margin-top: 0.85rem; }
.flow > * + h3 { margin-top: 2rem; }

/* section marker: folio number over a letter-spaced label, hard against the rule */
.folio {
  display: block;
  font-size: 1.6rem;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.01em;
  color: #c3bcab;
  font-variant-numeric: tabular-nums;
}
@media (prefers-color-scheme: dark) { .folio { color: #55503f; } }

.label {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.155em;
  text-transform: uppercase;
  color: var(--muted);
}

/* At narrow widths the margin collapses: the marker becomes a ruled running head. */
@media (max-width: 54rem) {
  .doc { background: none; }
  .sect { grid-template-columns: minmax(0, 1fr); padding-top: 2.1rem; }
  .sect > .marginalia {
    grid-column: 1;
    display: flex;
    align-items: baseline;
    gap: 0.7rem;
    text-align: left;
    padding: 0 0 0.5rem;
    border-bottom: 1px solid var(--hairline);
    margin-bottom: 1.1rem;
  }
  .folio { font-size: 0.85rem; color: var(--muted); }
  .label { margin-top: 0; }
  .sect > .flow { grid-column: 1; padding-left: 0; }
}

/* ---------------------------------------------------------------- masthead */

.masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.6rem 2rem;
  padding: 2.2rem 0 0.55rem;
}

.wordmark {
  font-size: 1.06rem;
  font-weight: 600;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
}
.wordmark:hover { text-decoration: none; }

.standfirst {
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--muted);
  text-align: right;
  max-width: 22rem;
}
@media (max-width: 34rem) { .standfirst { text-align: left; } }

/* double rule — printed masthead furniture */
.rule-double {
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  height: 3px;
}

.contents {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 1.15rem;
  padding: 0.55rem 0 0;
  font-size: 0.67rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.contents a { text-decoration-color: transparent; }
.contents a:hover, .contents a:focus-visible { text-decoration-color: currentColor; }
.contents [aria-current="page"] { color: var(--muted); text-decoration: none; }

/* ---------------------------------------------------------------- opening */

.lede { padding: 2.6rem 0 0; }

h1 {
  font-size: clamp(1.95rem, 5.4vw, 3.05rem);
  line-height: 1.055;
  letter-spacing: -0.023em;
  font-weight: 600;
  max-width: 32rem;
  text-wrap: balance;
}

.lede p {
  max-width: var(--measure);
  margin-top: 1.4rem;
}
.lede p.first {
  font-size: 1.12em;
  line-height: 1.55;
}

/* ---------------------------------------------------------------- prose */

.flow p, .flow li { max-width: var(--measure); }
/* ...but a ruled row is a row: it spans the measure of the RULE, not of prose. Without
   this, a statement row's closing hairline is narrower than the rule above it. */
.flow li.row { max-width: none; }

h2 {
  font-size: 1.32rem;
  line-height: 1.2;
  letter-spacing: -0.012em;
  font-weight: 600;
  max-width: var(--measure);
}
h3 {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0;
}

/* Engine names are set in mono because they are identifiers, not adjectives. */
code {
  font-family: var(--mono);
  font-size: 0.88em;
  letter-spacing: -0.01em;
  word-break: break-word;
}

.note { font-size: 0.86rem; color: var(--muted); }
.note a { text-decoration-color: var(--hairline); }

/* ---------------------------------------------------------------- ruled rows */

/* 05-betledger/marketing/brand.md: "In lists, money is right-aligned and every row is
   closed by a hairline. This is the whole typographic idea." */

.stmt { margin-top: 1.5rem; border-top: 1px solid var(--ink); }

.row {
  display: grid;
  grid-template-columns: minmax(7.5rem, 12rem) minmax(0, 1fr) max-content;
  gap: 0 1.4rem;
  align-items: baseline;
  padding: 0.72rem 0 0.66rem;
  border-bottom: 1px solid var(--hairline);
  position: relative;
}
/* the 3pt margin tick from BetLedger's StatementRow */
.row::before {
  content: "";
  position: absolute;
  left: -0.7rem;
  top: 0.95rem;
  width: 3px;
  height: 1px;
  background: var(--hairline);
}
.row > .k { font-weight: 600; }
.row > .v { color: var(--muted); font-size: 0.92rem; min-width: 0; }
.row > .f {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-size: 0.95rem;
}
.row .sub { display: block; color: var(--muted); font-weight: 400; font-size: 0.85rem; }

@media (max-width: 40rem) {
  .row { grid-template-columns: minmax(0, 1fr) max-content; }
  .row > .v { grid-column: 1 / -1; }
  .row::before { display: none; }
}

/* two-column ruled rows: a claim on the left, its own limit on the right */
.pairs { margin-top: 1.4rem; border-top: 1px solid var(--ink); }
.pair {
  display: grid;
  grid-template-columns: minmax(9rem, 15rem) minmax(0, 1fr);
  gap: 0.15rem 1.6rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--hairline);
}
.pair > dt { font-weight: 600; }
.pair > dd { color: var(--ink); max-width: 30rem; }
@media (max-width: 44rem) {
  .pair { grid-template-columns: minmax(0, 1fr); }
}

/* ---------------------------------------------------------------- entries */

.entry { padding-top: 2.3rem; }
.entry + .entry { padding-top: 2.6rem; }

.entry-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 0 1.4rem;
  align-items: baseline;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 0.4rem;
}
.entry-head h3 {
  font-size: 1.2rem;
  letter-spacing: -0.01em;
}
.entry-head .price {
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
  white-space: nowrap;
}
.entry-sub {
  padding: 0.45rem 0 0;
  font-size: 0.86rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.entry p { max-width: var(--measure); margin-top: 0.9rem; }

/* ---------------------------------------------------------------- figures */

.big {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  font-weight: 600;
  line-height: 1;
}

.tabular { font-variant-numeric: tabular-nums; }

/* a small ruled table; used for the legal matrix and for app-page schedules */
table.grid {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1.4rem;
  font-size: 0.9rem;
}
table.grid caption {
  text-align: left;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.155em;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 0.5rem;
}
table.grid th, table.grid td {
  text-align: left;
  padding: 0.5rem 0.7rem 0.46rem 0;
  border-bottom: 1px solid var(--hairline);
  vertical-align: baseline;
}
table.grid thead th {
  border-bottom: 1px solid var(--ink);
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
table.grid td:last-child, table.grid th:last-child { padding-right: 0; }
table.grid .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.scroll-x { overflow-x: auto; }

/* ---------------------------------------------------------------- colophon */

.colophon {
  margin: 3.6rem 0 0;
  border-top: 2px solid var(--ink);
  padding: 1.1rem 0 3.4rem;
  font-size: 0.8rem;
  color: var(--muted);
  display: grid;
  gap: 1.4rem 2.5rem;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
}
.colophon h4 {
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.155em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.4rem;
}
.colophon p { max-width: 26rem; }
.colophon li + li { margin-top: 0.2rem; }

.backlink {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.67rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* ---------------------------------------------------------------- print */

/* The site claims to be a printed document. It should behave like one on paper. */
@media print {
  :root {
    --paper: #fff; --sheet: #fff; --ink: #000;
    --muted: #444; --hairline: #999; --hairline-2: #ccc;
  }
  body { font-size: 10.5pt; line-height: 1.45; }
  .doc { background: none; }
  .contents, .backlink { display: none; }
  .sect { break-inside: avoid; }
  .entry, .row, .pair { break-inside: avoid; }
  h1 { font-size: 22pt; }
  a { text-decoration: none; }
  .flow a[href^="/"]::after { content: " (xuranium.com" attr(href) ")"; font-size: 8.5pt; color: #444; }
}
