/* Two tones of ink and ground, set like an engineering manual: one monospace
   face throughout, with weight carrying the hierarchy, 1px boxes with hard
   offset shadows, dotted rules, and no other colour. */

@font-face { font-family: "Helix Mono"; src: url("/fonts/HelixMono-Light.woff2") format("woff2"); font-weight: 300; font-style: normal; font-display: swap; }
@font-face { font-family: "Helix Mono"; src: url("/fonts/HelixMono-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Helix Mono"; src: url("/fonts/HelixMono-Italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Helix Mono"; src: url("/fonts/HelixMono-Medium.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Helix Mono"; src: url("/fonts/HelixMono-SemiBold.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Helix Mono"; src: url("/fonts/HelixMono-Bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }

/* The colours are Flexoki's. The page follows the system's light or dark
   setting: dark is the default, and a light system setting swaps in the
   light palette. */
:root {
  color-scheme: dark light;
  --background: #100f0f;
  --foreground: #cecdc3;
  /* The tone of offset shadows and thin dividers, closer to the background
     than to the foreground so that it stays quiet. */
  --shadow: #575653;
  --mono: "Helix Mono", monospace;
  --text: var(--mono);
}

@media (prefers-color-scheme: light) {
  :root {
    --background: #fffcf0;
    --foreground: #100f0f;
    --shadow: #b7b5ac;
  }
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  background: var(--background);
  color: var(--foreground);
  font-family: var(--text);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.6;
}

body {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}

::selection {
  background: var(--foreground);
  color: var(--background);
}

a {
  color: inherit;
  text-underline-offset: 3px;
}

strong {
  font-weight: 700;
}

/* The header is set like a letterhead: the mark and the name on the left,
   and the navigation as a row of boxed buttons on the right. */
.site-header {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 32px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 64px;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  font-size: 1.4rem;
  font-weight: 700;
  text-decoration: none;
}

/* The mark is drawn in the text colour, so it follows the light and dark
   palettes. */
.mark {
  width: 38px;
  height: 38px;
}

/* Hovering the mark turns it by one spoke, with the same overshoot as the
   homepage figure. The wheel looks the same after a turn of 45°, so the
   animation can end back at its starting angle without a visible jump. */
@media (prefers-reduced-motion: no-preference) {
  .brand:hover .mark {
    animation: turn-one-spoke 0.9s cubic-bezier(0.34, 1.56, 0.64, 1);
  }
}

@keyframes turn-one-spoke {
  to {
    rotate: 45deg;
  }
}

nav {
  display: flex;
  gap: 16px;
  font-size: 0.85rem;
  font-weight: 500;
}

/* A hard shadow, offset without blur, makes each button look raised. A
   pressed button moves onto its shadow. */
nav a {
  min-width: 110px;
  padding: 4px 16px;
  border: 1px solid var(--foreground);
  box-shadow: 3px 3px 0 var(--shadow);
  text-align: center;
  text-decoration: none;
}

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

nav a:active {
  box-shadow: none;
  translate: 3px 3px;
}

/* Small labels head each section instead of large headings. A strip of 1px
   dots, one in every 2×2 square, runs underneath each label. */
.label {
  margin: 0 0 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.label::after {
  content: "";
  display: block;
  height: 10px;
  margin-top: 8px;
  background-image: conic-gradient(var(--foreground) 25%, transparent 0);
  background-size: 2px 2px;
}

/* The homepage introduction sits beside the dithered figure. It is large
   but light, so that it reads as a quiet statement rather than a heading. */
.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 480px;
  gap: 48px;
  align-items: center;
  margin-bottom: 64px;
}

.intro-text p {
  max-width: 34ch;
  font-size: 1.5rem;
  font-weight: 300;
  line-height: 1.4;
}

/* The canvas holds one third as many pixels as it shows, and the browser
   scales it up without smoothing, so each dot is a 3px square. */
.figure {
  width: 480px;
  aspect-ratio: 2 / 1;
  image-rendering: pixelated;
}

@media (max-width: 700px) {
  .intro {
    grid-template-columns: 1fr;
  }

  .figure {
    width: 100%;
    max-width: 480px;
  }
}

/* The post list is a dense table in a box, with a thick left edge like a
   tab in a binder. */
.post-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--foreground);
  border-left-width: 4px;
  box-shadow: 3px 3px 0 var(--shadow);
}

.post-list li {
  display: flex;
  gap: 32px;
  align-items: baseline;
  padding: 8px 16px;
}

.post-list li + li {
  border-top: 1px solid var(--shadow);
}

/* Dates are metadata, so they are set lighter and smaller than titles. */
.post-list time,
.post-heading time {
  flex-shrink: 0;
  font-size: 0.85rem;
  font-weight: 300;
  white-space: nowrap;
}

.post-list a {
  text-decoration: none;
}

.post-list a:hover {
  text-decoration: underline;
}

/* Articles share the left edge of the page, with the text kept to a
   readable line length. */
.post-heading {
  margin-bottom: 40px;
  padding-bottom: 24px;
  border-bottom: 1px dashed var(--foreground);
}

.post-heading h1 {
  max-width: 32ch;
  margin: 0 0 12px;
  font-size: 2.1rem;
  font-weight: 600;
  line-height: 1.2;
}

.post > :not(.post-heading, pre) {
  max-width: 72ch;
}

.post a {
  font-style: italic;
}

blockquote {
  margin-left: 0;
  padding-left: 20px;
  border-left: 1px solid var(--foreground);
  font-style: italic;
}

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

/* Running text is in the same face as code, so inline code gets a thin box
   to set it apart. */
:not(pre) > code {
  padding: 0 4px;
  border: 1px solid var(--shadow);
}

/* Code blocks are framed in a 1px box with an offset shadow. Without
   colour, keywords are bold and comments are italic. */
pre {
  max-width: 90ch;
  margin: 24px 0;
  padding: 20px;
  overflow-x: auto;
  border: 1px solid var(--foreground);
  box-shadow: 3px 3px 0 var(--shadow);
  line-height: 1.5;
}

pre code {
  font-size: 0.85rem;
}

.hljs-keyword,
.hljs-built_in,
.hljs-type,
.hljs-meta {
  font-weight: 700;
}

.hljs-comment {
  font-style: italic;
}
