/* Alt Labs design language. One stylesheet for every Alt Labs page.
   Rules and reasons: DESIGN.md. Typeface: IBM Plex Mono, copyright IBM Corp., SIL Open Font License (fonts/OFL.txt).
   Screens are dark. Paper (data-theme="light" on <html>) is for documents; printing uses it on white. */
@font-face{font-family:"IBM Plex Mono";src:url("fonts/IBMPlexMono-Regular.woff2") format("woff2");font-weight:400;font-style:normal;font-display:swap}
@font-face{font-family:"IBM Plex Mono";src:url("fonts/IBMPlexMono-Medium.woff2") format("woff2");font-weight:500;font-style:normal;font-display:swap}

/* Tokens */
:root{color-scheme:dark;
  --bg:#000000;
  --ink:#eff0f2;
  --strong:#ffffff;
  --muted:#8f9097;
  --rule:#272732;
  --logo-blue:#92ebff;
  --logo-indigo:#8b98ff;
  --logo-green:#67fe9b;
  --row-quarter:0.375rem;
  --row-half:0.75rem;
  --row:1.5rem;
  --row-2:3rem;
  --row-3:4.5rem;
  --gutter:1.25rem;
  --logo-height:1.5rem;
  --radius-0:0;
  --col-section:12ch;
  --col-label:12ch;
  --measure:60ch;
  --sheet:84ch;
  --hairline:1px;
  --focus:2px;
  --font-mono:"IBM Plex Mono", ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace}
:root[data-theme="light"]{color-scheme:light;--bg:#eff0f2;--ink:#000000;--strong:#000000;--muted:#5b5c66;--rule:#b3b4b9}
@media print{
  :root{color-scheme:light;--bg:#ffffff;--ink:#000000;--strong:#000000;--muted:#5b5c66;--rule:#b3b4b9}
  .sheet{min-height:0;max-width:none;padding:0}
}

/* Type styles */
.statement{font-family:var(--font-mono);font-size:1.25rem;line-height:1.3;font-weight:500}
.body{font-family:var(--font-mono);font-size:1rem;line-height:1.5;font-weight:400}
.name{font-family:var(--font-mono);font-size:1rem;line-height:1.5;font-weight:500}
.small{font-family:var(--font-mono);font-size:0.875rem;line-height:1.5;font-weight:400}

/* Base: one face, one size, one ground. */
*,*::before,*::after{box-sizing:border-box}
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
body{margin:0;background:var(--bg);color:var(--ink);font:400 1rem/1.5 var(--font-mono);font-variant-numeric:lining-nums tabular-nums;font-synthesis:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}
h1,h2,h3,h4,p,ul,ol,dl,dd,figure,table,form,fieldset{margin:0}
h1,h2,h3,h4{font:inherit}
ul,ol{padding:0;list-style:none}
fieldset{padding:0;border:0;min-width:0}
strong,b{font-weight:500;color:var(--strong)}
.nb{white-space:nowrap}

/* Link: the text colour, a hairline underline that brightens. */
a{color:inherit;text-decoration-line:underline;text-decoration-thickness:var(--hairline);text-underline-offset:.25em;text-decoration-color:var(--muted)}
a:hover,a:focus-visible{text-decoration-color:currentColor}
:focus-visible{outline:var(--focus) solid var(--strong);outline-offset:3px}
::selection{background:var(--ink);color:var(--bg)}

/* Sheet: the page. A centred column of 84 characters, the sign above, one quiet line below. */
.sheet{min-height:100vh;min-height:100svh;max-width:calc(var(--sheet) + 2*var(--gutter));margin-inline:auto;padding-block:var(--row-3) var(--row);padding-left:max(var(--gutter),env(safe-area-inset-left,0px));padding-right:max(var(--gutter),env(safe-area-inset-right,0px));display:flex;flex-direction:column}
.sheet-head{margin-bottom:var(--row-2)}
.logo{display:block;width:fit-content;color:var(--strong);text-decoration:none}
.logo svg,.logo img{display:block;height:var(--logo-height);width:auto}
/* On Paper and in print the sign is ink: its gradient is too pale for a light ground. */
[data-theme="light"] .logo path{fill:currentColor}
@media print{.logo path{fill:currentColor}}
.sheet-foot{margin-top:auto;padding-top:var(--row-2);display:flex;flex-wrap:wrap;justify-content:space-between;gap:0 2ch;color:var(--muted)}
.sheet-foot>*{min-width:0}

/* Section: a label in the first column, content in the rest, a hairline above. */
.section{display:grid;grid-template-columns:var(--col-section) minmax(0,1fr);align-items:baseline;padding-block:var(--row);border-top:var(--hairline) solid var(--rule)}
.section:last-of-type{border-bottom:var(--hairline) solid var(--rule)}
.section>*{min-width:0}
.section-label{color:var(--muted)}

/* Statement: the one sentence a page exists to say. Size and weight come from the type style. */
.statement{color:var(--strong);text-wrap:balance}

/* Record: a name, a kind, a description, then fields. */
.record+.record{margin-top:var(--row);padding-top:var(--row);border-top:var(--hairline) solid var(--rule)}
.record-head,.field{display:grid;grid-template-columns:var(--col-label) minmax(0,1fr)}
.record-head>*,.field>*{min-width:0}
.name{color:var(--strong)}
.kind{color:var(--muted)}
.desc{grid-column:2}
.record-head+.fields{margin-top:var(--row-half)}

/* Fields: label and value, the value always on the same vertical line. */
.field>dt{color:var(--muted)}
.field>dd,.desc{overflow-wrap:anywhere;text-wrap:pretty}

/* Prose: paragraphs at the measure. */
.prose{max-width:var(--measure)}
.prose>*+*{margin-top:var(--row)}
.prose h2,.prose h3{font-weight:500;color:var(--strong)}
.prose ul,.prose ol{padding-left:3ch}
.prose li{position:relative}
.prose ul>li::before{content:"\2013";position:absolute;left:-3ch;color:var(--muted)}
.prose ol{counter-reset:item}
.prose ol>li{counter-increment:item}
.prose ol>li::before{content:counter(item) ".";position:absolute;left:-3ch;color:var(--muted)}

/* Table: rows between hairlines, numbers to the right. */
.table-wrap{overflow-x:auto}
.table{width:100%;border-collapse:collapse;font:inherit}
.table th,.table td{padding:var(--row-quarter) 2ch var(--row-quarter) 0;text-align:left;vertical-align:baseline;font-weight:normal;border-bottom:var(--hairline) solid var(--rule)}
.table th{color:var(--muted)}
.table tr>:last-child{padding-right:0}
.table .num{text-align:right}
.table caption{caption-side:top;text-align:left;color:var(--muted);padding-bottom:var(--row-half)}

/* Note: small print, on the left edge of what it follows. */
.note{color:var(--muted)}
.fields+.note,.table-wrap+.note,.prose+.note,.records+.note{margin-top:var(--row-half)}

/* Form: a label and a line to write on. One outlined button. */
.form{display:grid;row-gap:var(--row-half);max-width:calc(var(--col-label) + var(--measure))}
.form-row{display:grid;grid-template-columns:var(--col-label) minmax(0,1fr);align-items:baseline}
.form-row>*{min-width:0}
.form-row>label{color:var(--muted)}
.input{width:100%;font:inherit;color:var(--ink);background:transparent;border:0;border-bottom:var(--hairline) solid var(--muted);border-radius:var(--radius-0);padding:0 0 var(--row-quarter);appearance:none}
.input::placeholder{color:var(--muted);opacity:1}
.input:focus-visible{outline:0;border-bottom:var(--focus) solid var(--strong);padding-bottom:calc(var(--row-quarter) - var(--focus) + var(--hairline))}
.button{justify-self:start;font:inherit;font-weight:500;color:var(--strong);background:transparent;border:var(--hairline) solid var(--strong);border-radius:var(--radius-0);padding:var(--row-quarter) 2ch;cursor:pointer;appearance:none}
.button:hover{background:var(--strong);color:var(--bg)}
.button:disabled{color:var(--muted);border-color:var(--muted);background:transparent;cursor:default}
.form-row>.button{grid-column:2}

/* Narrow screens: the section label moves above its content. Everything else keeps its line. */
@media (max-width:45rem){
  .sheet{padding-block:var(--row-2) var(--row)}
  .section{grid-template-columns:minmax(0,1fr);row-gap:var(--row-half)}
  .record+.record{padding-top:0;border-top:0}
}
