/* blog.angelin.io — white on black, one column, nothing else. */

:root {
  --bg:      #000;
  --fg:      rgb(183, 180, 176);
  --fg-dim:  #7d7a77;
  --fg-loud: #eee;
  --link:    #3380f3;
  --visited: #94c3ca;
  --panel:   #222;
}

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

body {
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
               sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  font-size: 1.15em;
  line-height: 1.6;
  margin: 0;
  padding: 2.5em 1.5em 6em;
}

.content {
  max-width: 40em;
  margin: 0 auto;
  text-align: justify;
  hyphens: auto;
}

h1 {
  color: var(--fg-loud);
  font-size: 1.8em;
  line-height: 1.25;
  text-align: left;
  margin: 0 0 0.2em;
}

h2 {
  color: var(--fg-loud);
  font-size: 1.25em;
  margin: 2em 0 0.4em;
}

h3 {
  color: var(--fg-loud);
  font-size: 1.05em;
  margin: 1.6em 0 0.3em;
}

.article-date {
  color: var(--fg-dim);
  font-size: 0.85em;
  margin: 0 0 2.5em;
  text-align: left;
}

a           { color: var(--link); }
a:visited   { color: var(--visited); }

blockquote {
  border-left: 2px solid var(--fg-dim);
  color: var(--fg-dim);
  margin: 1.5em 0;
  padding: 0 0 0 1.2em;
}

code {
  background: var(--panel);
  border-radius: 0.25em;
  font-size: 0.85em;
  padding: 0.1em 0.35em;
}

pre {
  background: var(--panel);
  border-radius: 0.4em;
  overflow-x: auto;
  padding: 1em;
  text-align: left;
}

pre code {
  background: none;
  padding: 0;
}

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

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

/* --- the not-found page ------------------------------------------------- */

.notfound {
  text-align: center;
  padding-top: 15vh;
}

.notfound h1 {
  text-align: center;
  font-weight: 600;
}

/* --- language switch ---------------------------------------------------- */

/* The radios are the state. They are hidden, not removed: `display: none`
   would take them out of the accessibility tree and off the tab order. */
.lang-radio {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.lang-switch {
  display: flex;
  gap: 0.6em;
  justify-content: flex-end;
  max-width: 40em;
  margin: 0 auto 3em;
}

.lang-switch label {
  cursor: pointer;
  display: block;
  line-height: 0;
  opacity: 0.35;
  transition: opacity 0.15s;
}

.lang-switch label:hover {
  opacity: 0.7;
}

.lang-switch svg {
  display: block;
  width: 2em;
  height: 1.25em;
  border-radius: 0.15em;
  box-shadow: 0 0 0 1px #444;
  object-fit: cover;
}

/* Keyboard focus has to be visible even though the input itself is not. */
#lang-fr:focus-visible ~ .lang-switch label[for="lang-fr"] svg,
#lang-en:focus-visible ~ .lang-switch label[for="lang-en"] svg {
  box-shadow: 0 0 0 2px var(--link);
}

/* --- which language is shown -------------------------------------------- */

/* Without JavaScript the checked radio decides, through sibling selectors. */
html:not(.js) #lang-fr:checked ~ .content [lang="en"],
html:not(.js) #lang-en:checked ~ .content [lang="fr"] {
  display: none;
}

html:not(.js) #lang-fr:checked ~ .lang-switch label[for="lang-fr"],
html:not(.js) #lang-en:checked ~ .lang-switch label[for="lang-en"] {
  opacity: 1;
}

/* With JavaScript, `data-lang` on <html> decides — set in <head> before the
   first paint, so there is no flash of the wrong language. The two rule sets
   are scoped to `.js` / `:not(.js)` so they can never fight over specificity. */
html.js[data-lang="fr"] [lang="en"],
html.js[data-lang="en"] [lang="fr"] {
  display: none;
}

html.js[data-lang="fr"] .lang-switch label[for="lang-fr"],
html.js[data-lang="en"] .lang-switch label[for="lang-en"] {
  opacity: 1;
}
