/* hilde-lang.org.  Colours come only from tokens.css (the brand's
   tokens.json); scripts/check.py holds the pairs below to brand.md.

   Pairs in use (foreground on background):
     light  text on hintergrund, text on hintergrund-2 (code), fell for lines
     dark   text-dunkel on hintergrund-dunkel, linie-dunkel for lines
   fell is a colour for lines only, never for running text (brand.md). */

/* The brand's fonts, served from this site (licences in assets/fonts/). */
@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/assets/fonts/bricolage-grotesque-latin-700-normal.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/assets/fonts/ibm-plex-mono-latin-700-normal.woff2") format("woff2");
}

:root {
  color-scheme: light dark;
  --bg: var(--hintergrund);
  --bg-code: var(--hintergrund-2);
  --fg: var(--text);
  --line: var(--fell);
  --err: #8f1711;
}

/* Dark follows the system unless the reader picked light, or stands when
   the reader picked dark (assets/js/theme.js sets data-theme on <html>).
   The two dark blocks hold the same values; scripts/check.py compares them. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: var(--hintergrund-dunkel);
    --bg-code: var(--hintergrund-dunkel);
    --fg: var(--text-dunkel);
    --line: var(--linie-dunkel);
    --err: #ff8a80;
  }
  :root:not([data-theme="light"]) .brand .mark-light { display: none; }
  :root:not([data-theme="light"]) .brand .mark-dark { display: block; }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: var(--hintergrund-dunkel);
  --bg-code: var(--hintergrund-dunkel);
  --fg: var(--text-dunkel);
  --line: var(--linie-dunkel);
  --err: #ff8a80;
}
:root[data-theme="dark"] .brand .mark-light { display: none; }
:root[data-theme="dark"] .brand .mark-dark { display: block; }
:root[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; }

html { background: var(--bg); color: var(--fg); }

body {
  margin: 0 auto;
  max-width: 54rem;
  padding: 0 1.25rem;
  font: 1.0625rem/1.6 system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--fg);
}

a { color: var(--fg); text-decoration: underline; text-underline-offset: 0.15em; }
a:hover, a:focus { text-decoration-thickness: 2px; }
a:focus-visible { outline: 2px solid var(--line); outline-offset: 2px; }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--bg); padding: 0.5rem; }

h1, h2, h3, h4 {
  font-family: var(--font-logo);
  font-weight: var(--font-logo-weight);
  line-height: 1.2;
  margin: 2rem 0 0.75rem;
}
h1 { font-size: 2.2rem; letter-spacing: -0.02em; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }

code, pre, samp { font-family: var(--font-code); font-size: 0.92em; font-variant-ligatures: none; }
pre {
  background: var(--bg-code);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.75rem 1rem;
  overflow-x: auto;
  line-height: 1.45;
}
pre.output { border-style: dashed; }
pre.message, pre:has(> code.language-sh) { white-space: pre-wrap; overflow-wrap: anywhere; }
.to-top { text-align: right; font-size: 0.85rem; margin: 0.5rem 0 0; }

/* The field that jumps to a code on /errors/: it stays in sight, and an entry
   reached through it, or through any link, lights up for a moment. */
.jump {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem 0 1rem;
  padding: 0.5rem 0;
  background: var(--bg);
  font-size: 0.9rem;
}
.jump[hidden] { display: none; }
.jump input {
  flex: 1 1 12rem;
  max-width: 24rem;
  min-width: 0;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg-code);
  color: var(--fg);
  font: inherit;
  font-family: var(--font-code);
}
#jump ~ h2, #jump ~ h3 { scroll-margin-top: 3.5rem; }
@keyframes jumped { from { background: var(--bg-code); outline-color: var(--line); } to { background: transparent; outline-color: transparent; } }
#jump ~ h3:target { outline: 2px solid transparent; outline-offset: 4px; animation: jumped 2s ease-out; }
@media (prefers-reduced-motion: reduce) {
  #jump ~ h3:target { animation: none; outline-color: var(--line); }
}

/* The place of an error on /errors/: bold red text, and words a screen reader says
   that a copy leaves out. */
mark.err {
  background: transparent;
  color: var(--err);
  font-weight: 700;
}
mark.err::before {
  content: "error location: ";
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(100%);
  white-space: nowrap;
}
mark.err:lang(de)::before { content: "Fehlerstelle: "; }

table { border-collapse: collapse; width: 100%; margin: 1rem 0; display: block; overflow-x: auto; }
th, td { text-align: left; vertical-align: top; padding: 0.35rem 0.6rem; border-bottom: 1px solid var(--line); }

blockquote { margin: 1rem 0; padding-left: 1rem; border-left: 3px solid var(--line); }

img { max-width: 100%; height: auto; }

.site-header {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.5rem;
  padding: 1rem 0; border-bottom: 1px solid var(--line);
}
.brand img { display: block; width: 186px; height: auto; }
.brand .mark-dark { display: none; }
.tagline { margin: 0; font-size: 0.95rem; color: var(--fg); }
/* tokens.json defines no breakpoint; below 30rem the tagline takes its
   own row and stands under the wordmark instead of beside it. */
@media (max-width: 30rem) {
  .tagline { flex-basis: 100%; }
}
.nav { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem 0.9rem; }
.nav a[aria-current="page"] { text-decoration-thickness: 3px; }
.lang { margin: 0 0 0 auto; display: flex; align-items: center; gap: 0.75rem; }
/* The sun button: the colour and size of the language link, no button chrome. */
.theme { margin: 0; padding: 0; border: 0; background: none; color: var(--fg); font: inherit; line-height: 0; cursor: pointer; }
.theme[hidden] { display: none; }
.theme svg { width: 1.25em; height: 1.25em; }
.theme:focus-visible { outline: 2px solid var(--line); outline-offset: 2px; }

main { padding: 0.5rem 0 2rem; }

.example { margin: 1.25rem 0; }
.example .file { margin: 0.75rem 0 0.25rem; font-size: 0.95rem; }
.example figcaption { font-size: 0.9rem; }

/* The photo on the about page: a block under its paragraph, left with the text. */
.photo { width: 400px; max-width: 100%; margin: 1rem 0; }
.photo img { display: block; width: 100%; }

.site-footer { border-top: 1px solid var(--line); padding: 1.5rem 0 2rem; font-size: 0.95rem; }
.footer-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 1rem; }
.site-footer h2 { font-size: 1rem; margin: 0 0 0.4rem; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.repo-links a { white-space: nowrap; }
.note { margin-top: 1.5rem; font-size: 0.85rem; }
.hy { letter-spacing: 0.15em; }
