/* 0xPage platform UI: the prelude design system as used on Sante's Place
   (templates/base.html) and the research investigation page.
   Three colors, one typeface, one divider. Nothing loads.
   Applies to every 0xPage surface except custom blogs. */

:root {
  --ground:  #ffffff;
  --ink:     #000000;
  --link:    #0000ee;
  --visited: #551a8b;
  --muted:   #555555;
  --rule:    #d6d6d6;
  --serif: "Times New Roman", Times, "Liberation Serif", serif;
  --mono:  "SF Mono", ui-monospace, Menlo, Consolas, "Liberation Mono", monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #0b0b0b; --ink: #e9e9e9; --link: #8ab4ff;
    --visited: #b8a3e0; --muted: #9b9b9b; --rule: #333333;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #0b0b0b; --ink: #e9e9e9; --link: #8ab4ff;
  --visited: #b8a3e0; --muted: #9b9b9b; --rule: #333333;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  background: var(--ground);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.1875rem;
  line-height: 1.6;
  margin: 0;
  padding-block: 0;
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Two columns, as on Sante's Place: the reading column at ~65 characters,
   and a side column that stays in view while the content scrolls. */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 38rem) 13rem;
  column-gap: 4rem;
  justify-content: center;
  padding-block: 56px 0;
}
main { min-width: 0; }

.aside { position: sticky; top: 56px; align-self: start; font-size: .9rem; line-height: 1.5; }
.aside p { margin: 0 0 .8em; hanging-punctuation: none; }

footer { grid-column: 1 / -1; padding-block: 64px 48px; font-size: .95em; }
footer hr { margin: 0; }
footer p { margin: .5em 0; font-style: italic; }

h1 { font-size: 2.6rem;  font-weight: 700; line-height: 1.08; margin: 0 0 .3em; letter-spacing: -.01em; text-wrap: balance; }
h2 { font-size: 1.55rem; font-weight: 700; line-height: 1.2;  margin: 2.2em 0 .6em; text-wrap: balance; }
h3 { font-size: 1.2rem;  font-weight: 700; line-height: 1.3;  margin: 1.8em 0 .4em; }

p { margin: 0 0 1.15em; hanging-punctuation: first; }

.site { margin: 0 0 2.5em; font-size: .95em; }
.site a { color: var(--ink); text-decoration: none; font-weight: 700; }

a          { color: var(--link); text-decoration: underline; text-underline-offset: 2px; }
a:visited  { color: var(--visited); }
a:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

ul, ol { margin: 0 0 1.15em; padding-left: 1.3em; }
li { margin-bottom: .4em; }

hr { border: 0; border-top: 1px solid var(--ink); margin: 2.4em 0; }

code { font-family: var(--mono); font-size: .8em; }

.table-wrap { overflow-x: auto; margin: 0 0 1.4em; }
table { border-collapse: collapse; width: 100%; font-size: .92em; font-variant-numeric: tabular-nums; }
th { text-align: left; font-weight: 700; border-bottom: 1px solid var(--ink); padding: .25em .8em .25em 0; }
td { padding: .25em .8em .25em 0; vertical-align: top; }

.muted { color: var(--muted); }

/* Forms: browser controls in the page's own type, a 1px ink edge, no
   rounding, no fill. A button reads as a button by its edge alone. */
form { display: flex; flex-wrap: wrap; gap: .6em; align-items: end; margin: 0 0 .8em; }
label { display: block; font-size: .9em; margin: 0 0 .25em; }
.field { flex: 1 1 16rem; min-width: 0; }
input, button { font: inherit; color: var(--ink); background: var(--ground); border: 1px solid var(--ink); border-radius: 0; }
input { width: 100%; padding: .35em .5em; }
button { padding: .35em .9em; cursor: pointer; }
input:focus-visible, button:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
/* Honeypot field: off-screen for people, still in the form for bots. */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

@media (max-width: 880px) {
  .layout { grid-template-columns: minmax(0, 38rem); }
  .aside { position: static; order: -1; margin: 0 0 2.5em; padding-bottom: 1.5em; border-bottom: 1px solid var(--rule); }
}

@media (max-width: 480px) {
  body { font-size: 1.0625rem; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  h1 { font-size: 2.1rem; }
  h2 { font-size: 1.35rem; }
  .layout { padding-block: 32px 0; }
  footer { padding-block: 48px 32px; }
}
