/* One stylesheet for both sites: site/en/style.css and site/de/style.css
   are the same file, and a test holds them to that.

   Dark alone: warm grey-black with one orange accent. A serif for the
   headings, a sans for the rest. */

/* The two fonts are the site's own files, under fonts/ beside this sheet,
   so a visit still asks no other server. Both are under the SIL Open Font
   License; its text lies in the same folder. */
@font-face {
  font-family: "Newsreader";
  src: url("/fonts/newsreader.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "DM Sans";
  src: url("/fonts/dm-sans.woff2") format("woff2");
  font-weight: 100 1000;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --page: #141413;
  --surface: #1c1b1a;
  --line: #33322f;
  --text: #e9e6dc;
  --strong: #faf9f5;
  --muted: #a8a59b;
  --accent: #d97757;
  --accent-bright: #e8926f;
  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  /* A faint warm glow behind the top right corner. */
  background:
    radial-gradient(ellipse 60rem 26rem at 88% -9rem, rgb(217 119 87 / 0.16), transparent 70%)
    no-repeat var(--page);
}

body {
  /* A column as tall as the window, so the foot of a short page stands at
     the bottom of the window and not in the middle of it. */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0 auto;
  max-width: 62rem;
  padding: 0 1.5rem;
  color: var(--text);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent); color: var(--page); }

a {
  color: var(--accent);
  text-decoration-color: rgb(217 119 87 / 0.45);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color 0.15s, background-color 0.15s, border-color 0.15s;
}

a:hover { color: var(--accent-bright); text-decoration-color: currentColor; }

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* The head of every page: the name, then the way around. */

header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  padding: 1.75rem 0;
}

header .name {
  color: var(--strong);
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-decoration: none;
}

/* The name is one word in lowercase. Its second half, "labs", is orange:
   that is the mark. */
header .name span,
h1 span { color: var(--accent); }

nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.75rem;
  font-size: 0.9375rem;
}

nav a { padding: 0.25rem 0; color: var(--muted); text-decoration: none; }

nav a:hover { color: var(--strong); }

/* The page one is on. */
nav a[aria-current] {
  color: var(--strong);
  box-shadow: 0 2px 0 var(--accent);
}

/* Where the system replaces the page's colours with its own (Windows'
   high-contrast mode), the line above is dropped: underline instead. */
@media (forced-colors: active) {
  nav a[aria-current] { text-decoration: underline; }
}

/* The way to the other language's site. */
nav a.lang {
  padding: 0.25rem 0.875rem;
  border: 1px solid var(--line);
  border-radius: 999px;
}

nav a.lang:hover { border-color: var(--accent); }

/* The body of a page. */

main { flex: 1; padding: 4.5rem 0 5rem; }

h1 {
  margin: 0 0 1.5rem;
  max-width: 18ch;
  color: var(--strong);
  font-family: var(--serif);
  font-size: clamp(2.75rem, 8vw, 4.75rem);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.025em;
}

/* "pretty" keeps a single word from standing alone on a last line. */
p { margin: 0 0 1rem; max-width: 38rem; text-wrap: pretty; }

.lead {
  margin-bottom: 0;
  max-width: 34rem;
  /* Lines of about equal length, so that no line ends on a stray word or
     two: the browser picks the breaks. */
  text-wrap: balance;
  color: var(--muted);
  font-size: 1.3125rem;
  line-height: 1.5;
}

/* A small orange word above a heading. */
.eyebrow {
  margin-bottom: 1rem;
  color: var(--accent);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.12em;
}

/* A section: its heading as a label on the left, what it holds on the
   right. On a narrow screen the label stands above. */
section {
  display: grid;
  grid-template-columns: 14rem minmax(0, 1fr);
  column-gap: 2rem;
  margin-top: 4.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
}

section + section { margin-top: 3rem; }

section > * { grid-column: 2; }

section > :last-child { margin-bottom: 0; }

h2 {
  grid-column: 1;
  margin: 0.3rem 0 1rem;
  color: var(--accent);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

address {
  margin: 0 0 1rem;
  color: var(--strong);
  font-size: 1.125rem;
  font-style: normal;
}

/* Something still to come: a quiet box with a broken edge. */
.note {
  padding: 1.5rem 1.75rem;
  border: 1px dashed var(--line);
  border-radius: 0.75rem;
  background: var(--surface);
  color: var(--muted);
}

/* The one link a page wants followed. */
a.button {
  display: inline-block;
  padding: 0.7rem 1.5rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--page);
  font-weight: 500;
  text-decoration: none;
}

a.button:hover { background: var(--accent-bright); color: var(--page); }

/* The foot of every page. */

footer {
  padding: 1.5rem 0 2.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.875rem;
}

footer p { margin: 0; max-width: none; }

footer a { color: var(--muted); text-decoration-color: var(--line); }

footer a:hover { color: var(--strong); }

@media (max-width: 44rem) {
  body { padding: 0 1.25rem; }
  header { padding: 1.25rem 0; }
  nav { gap: 0.5rem 1.25rem; }
  main { padding: 3rem 0 3.5rem; }
  .lead { font-size: 1.1875rem; }
  section { display: block; margin-top: 3.5rem; }
  section + section { margin-top: 2.5rem; }
  h2 { margin-top: 0; }
}

/* On paper: black on white, without the way around. */
@media print {
  :root {
    color-scheme: light;
    --page: #ffffff;
    --surface: #ffffff;
    --line: #999999;
    --text: #000000;
    --strong: #000000;
    --muted: #333333;
    --accent: #000000;
  }
  html { background: #ffffff; }
  nav { display: none; }
  /* A print leaves backgrounds out unless asked: the button as plain
     black text, or its light text would stand on white paper. */
  a.button { padding: 0; background: none; color: #000000; }
}
