/* ASSET HOUSE - cream paper, black ink, engraved rules.
   The page is a bound ledger: a tabbed spine on the left, folios that turn on the right. */

:root {
  /* This register is LIGHT. The palette is declared once and there is no second one: a dark
     variant nobody looked at is how a broken site ships. `only light` also stops Chrome's
     auto-darkening from inverting engraved black-on-cream plates into grey mush. */
  color-scheme: only light;

  /* MEASURED, not chosen. Sampled in the browser from the engraved plates: their paper sits at
     rgb(232,222,200). The page is set to exactly that (or marginally darker) so that the plates,
     composited with `mix-blend-mode: darken`, have their own paper disappear into the page
     instead of showing as a pale rectangle around every engraving. */
  --paper: #e8dec8;
  --paper-deep: #e0d5bc;
  --paper-edge: #d8ccae;
  --ink: #14110e;
  --ink-soft: #4d4436;
  --ink-faint: #8b7f6a;
  --rule: #c7b899;
  --rule-strong: #a39273;
  --stamp: #8a2b20;
  --green: #2f5d3a;

  --serif: "Cormorant Garamond", "EB Garamond", Georgia, "Times New Roman", serif;
  --body: "EB Garamond", Georgia, "Times New Roman", serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;

  --rail: 292px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--paper);
  color: var(--ink);
}

body {
  font-family: var(--body);
  /* minmax(0, 1fr), never 1fr: a 1fr track's minimum is min-content, and the horizontally
     scrolling index inside the spine would blow the whole page past the viewport. Measured at
     390 px: the document was 620 px wide with a 1fr track. */
  font-size: 17px;
  line-height: 1.62;
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  height: 100dvh;
  overflow: hidden;
  /* The paper itself is the generated laid-paper plate, fixed and covering, so the grain does not
     slide under the text as the folio scrolls. No gradient wash: a lightened patch under a plate
     would bring the plate's own rectangle back. */
  background-image: url("/img/paper.webp?v=1");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
}

/* ------------------------------------------------------------------ the spine */

.spine {
  border-right: 1px solid var(--rule-strong);
  background: linear-gradient(90deg, rgba(216, 204, 174, 0.55) 0%, rgba(232, 222, 200, 0.25) 78%, rgba(216, 204, 174, 0.6) 100%);
  display: flex;
  flex-direction: column;
  padding: 26px 0 18px;
  overflow-y: auto;
  min-height: 0;
  min-width: 0;
}

.plate {
  width: 96px;
  height: 96px;
  margin: 0 auto 18px;
  object-fit: contain;
  mix-blend-mode: darken;
}

.plate.fallback {
  border: 1px solid var(--rule);
  border-radius: 50%;
}

.wordmark {
  font-family: var(--serif);
  font-weight: 300;
  text-align: center;
  line-height: 1.05;
  margin: 0 18px 4px;
}
.wordmark span {
  display: block;
  font-size: 23px;
  letter-spacing: 0.42em;
  text-indent: 0.42em;
}
.wordmark .two { font-size: 23px; }

.spine .tagline {
  text-align: center;
  font-size: 12.5px;
  letter-spacing: 0.07em;
  color: var(--ink-faint);
  margin: 6px 20px 22px;
  font-variant: small-caps;
}

nav.index {
  border-top: 1px solid var(--rule);
  margin: 0 0 auto;
  min-width: 0;
}

nav.index a {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: baseline;
  gap: 10px;
  padding: 11px 20px 10px;
  border-bottom: 1px solid var(--rule);
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 15.5px;
  letter-spacing: 0.02em;
  transition: background 120ms ease, color 120ms ease;
}
nav.index a .num {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
}
nav.index a:hover { background: rgba(163, 146, 115, 0.13); color: var(--ink); }
nav.index a[aria-current="page"] {
  color: var(--ink);
  background: rgba(163, 146, 115, 0.2);
  box-shadow: inset 3px 0 0 var(--ink);
}
nav.index a[aria-current="page"] .num { color: var(--ink); }

.spine footer {
  margin-top: 18px;
  padding: 16px 20px 0;
  border-top: 1px solid var(--rule);
  font-size: 13px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 1px solid var(--rule-strong);
  padding: 4px 9px;
  color: var(--ink-soft);
  background: rgba(255, 253, 246, 0.5);
}
.chip .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-faint);
}
.chip.live .dot { background: var(--green); }
.chip.closed .dot { background: var(--stamp); }

button.ink {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: transparent;
  border: 1px solid var(--ink);
  color: var(--ink);
  padding: 9px 14px;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
button.ink:hover { background: var(--ink); color: var(--paper); }
button.ink:disabled { opacity: 0.4; cursor: not-allowed; }
button.ink:disabled:hover { background: transparent; color: var(--ink); }

/* ------------------------------------------------------------------ the folios */

main {
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  min-width: 0;
  scroll-behavior: smooth;
}

.folio {
  max-width: 880px;
  margin: 0 auto;
  padding: 54px 56px 120px;
}

.folio-head {
  border-bottom: 3px double var(--ink);
  padding-bottom: 12px;
  margin-bottom: 30px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
}
.folio-head h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 40px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 0;
  line-height: 1.1;
}
.folio-no {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  color: var(--ink-faint);
  white-space: nowrap;
  text-transform: uppercase;
}

.lede {
  font-family: var(--serif);
  font-size: 24px;
  line-height: 1.42;
  margin: 0 0 30px;
  max-width: 34em;
}

h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 15px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin: 44px 0 14px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--rule-strong);
}

p { margin: 0 0 15px; max-width: 40em; }
a { color: var(--ink); text-underline-offset: 3px; }

.note {
  font-size: 15px;
  color: var(--ink-soft);
  border-left: 2px solid var(--rule-strong);
  padding-left: 14px;
  margin: 18px 0;
  max-width: 40em;
}

/* the ruled ledger rows: label, leader, figure */
.rows { margin: 8px 0 22px; }
.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 14px;
  padding: 9px 2px 7px;
  border-bottom: 1px solid var(--rule);
}
.row:first-child { border-top: 1px solid var(--rule-strong); }
.row .k { font-size: 16px; color: var(--ink-soft); min-width: 0; }
.row .k b { color: var(--ink); font-weight: 600; }
.row .k small { display: block; font-size: 12.5px; color: var(--ink-faint); letter-spacing: 0.02em; }
.row .v {
  font-family: var(--mono);
  font-size: 14px;
  text-align: right;
  white-space: nowrap;
  letter-spacing: -0.01em;
}
.row .v.dim { color: var(--ink-faint); }

.stamp-line {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--stamp);
}

.banner {
  border: 1px solid var(--ink);
  border-left-width: 5px;
  padding: 16px 20px;
  margin: 0 0 30px;
  background: rgba(255, 253, 246, 0.55);
}
.banner strong {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.banner p { margin: 0; font-size: 16px; }

.plate-wide {
  width: 100%;
  max-width: 430px;
  display: block;
  margin: 24px auto 30px;
  mix-blend-mode: darken;
}

/* the quiet mark that fills the spine between the index and the footer */
.spine .mark {
  width: 118px;
  margin: 26px auto;
  opacity: 0.5;
  mix-blend-mode: darken;
  display: block;
}
@media (max-width: 900px) { .spine .mark { display: none; } }

figure.schematic {
  margin: 26px 0 30px;
  border: 1px solid var(--rule-strong);
  padding: 22px 20px 12px;
  background: rgba(255, 253, 246, 0.45);
}
figure.schematic figcaption {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-top: 12px;
  text-align: right;
}
figure.schematic svg { display: block; width: 100%; height: auto; }

/* the checker */
.checker { margin: 6px 0 10px; }
.checker .field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}
.checker input {
  font-family: var(--mono);
  font-size: 14px;
  padding: 13px 14px;
  border: 1px solid var(--ink);
  background: rgba(255, 253, 246, 0.75);
  color: var(--ink);
  min-width: 0;
}
.checker input::placeholder { color: var(--ink-faint); }
.alt { margin-top: 10px; font-size: 14px; color: var(--ink-soft); }

.verdict {
  margin: 24px 0 8px;
  border: 1px solid var(--ink);
  padding: 22px 24px;
  display: none;
}
.verdict.show { display: block; }
.verdict .mark {
  font-family: var(--serif);
  font-size: 30px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin: 0 0 8px;
  line-height: 1.1;
}
.verdict.in { border-color: var(--green); }
.verdict.in .mark { color: var(--green); }
.verdict.out { border-color: var(--stamp); }
.verdict.out .mark { color: var(--stamp); }
.verdict p { font-size: 15px; margin: 0 0 8px; }
.verdict .who { font-family: var(--mono); font-size: 12.5px; color: var(--ink-soft); word-break: break-all; }

/* documentation: a chapter rail that stays put */
.doc-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 218px;
  gap: 40px;
  align-items: start;
}
.toc {
  position: sticky;
  top: 54px;
  border-left: 1px solid var(--rule-strong);
  padding-left: 16px;
  font-size: 14px;
}
.toc h3 {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 10px;
}
.toc a {
  display: block;
  padding: 5px 0;
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px dotted var(--rule);
}
.toc a:hover { color: var(--ink); }
.toc a.here { color: var(--ink); font-weight: 600; }

pre.code {
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.6;
  background: rgba(255, 253, 246, 0.7);
  border: 1px solid var(--rule-strong);
  padding: 14px 16px;
  overflow-x: auto;
  margin: 16px 0 22px;
}
code { font-family: var(--mono); font-size: 0.88em; }

.addr { font-family: var(--mono); font-size: 12.5px; word-break: break-all; }

.fine {
  font-size: 13.5px;
  color: var(--ink-faint);
  border-top: 1px solid var(--rule);
  padding-top: 14px;
  margin-top: 40px;
}

/* ------------------------------------------------------------------ narrow */

@media (max-width: 900px) {
  body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
  }
  .spine {
    border-right: none;
    border-bottom: 1px solid var(--rule-strong);
    padding: 16px 0 10px;
    overflow: visible;
  }
  .plate { width: 54px; height: 54px; margin-bottom: 8px; }
  .wordmark span { font-size: 18px; letter-spacing: 0.34em; text-indent: 0.34em; }
  .wordmark { margin-left: 12px; margin-right: 12px; }
  .spine .tagline { display: none; }
  nav.index {
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
    /* The strip scrolls, so it has to LOOK like it does: without this fade the last two
       folios (the register and the docs) are invisible on a phone and nobody swipes. */
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent 100%);
    mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent 100%);
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
    margin: 10px 0 0;
    -webkit-overflow-scrolling: touch;
  }
  nav.index a {
    border-bottom: none;
    border-right: 1px solid var(--rule);
    grid-template-columns: auto;
    padding: 10px 16px;
    white-space: nowrap;
    font-size: 14px;
  }
  nav.index a .num { display: none; }
  nav.index a[aria-current="page"] { box-shadow: inset 0 -3px 0 var(--ink); }
  .spine footer {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 16px 2px;
    margin-top: 0;
    flex-wrap: wrap;
  }
  .folio { padding: 28px 16px 90px; }
  .folio-head { flex-direction: column; gap: 6px; }
  .folio-head h1 { font-size: 27px; letter-spacing: 0.09em; }
  .lede { font-size: 19px; }
  .doc-wrap { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .toc {
    position: static;
    border-left: none;
    border-bottom: 1px solid var(--rule-strong);
    padding: 0 0 12px;
    margin-bottom: 22px;
  }
  .toc a { display: inline-block; margin-right: 14px; border-bottom: none; }
  .row { grid-template-columns: 1fr; gap: 2px; }
  .row .v { text-align: left; white-space: normal; word-break: break-all; }
  .checker .field { grid-template-columns: 1fr; }
}
