/* metrics.su — фирменный стиль: монохром, Raleway, белый фон. */

@font-face {
  font-family: "Raleway";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/raleway-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "Raleway";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/raleway-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+2122, U+2191, U+2193, U+2212, U+2215;
}

:root {
  --font-sans: "Raleway", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", SFMono-Regular, Consolas, Menlo, monospace;

  /* Everything is derived from three colours so the dark theme is a
     three-line override below. */
  --rgb-bg: 255, 255, 255;
  --rgb-ink: 34, 34, 34;
  --rgb-accent: 80, 80, 80;

  --bg: rgb(var(--rgb-bg));
  --ink: rgb(var(--rgb-ink));
  --ink-soft: rgba(var(--rgb-ink), 0.66);
  --accent: rgb(var(--rgb-accent));
  --line: rgba(var(--rgb-ink), 0.15);
  --surface: rgba(var(--rgb-ink), 0.05);

  --measure: 40rem;   /* reading column */
  --measure-wide: 52rem;  /* the intro sentence gets more room */

  --s1: 0.5rem;
  --s2: 1rem;
  --s3: 1.5rem;
  --s4: 2rem;
  --s5: 3rem;
  --s6: 4.5rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --rgb-bg: 26, 26, 26;
    --rgb-ink: 232, 232, 232;
    --rgb-accent: 160, 160, 160;
  }
}

html {
  color-scheme: light dark;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: var(--s6) var(--s4);
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 18px;
  line-height: 1.65;
}

header,
article,
footer {
  max-width: var(--measure);
  margin-inline: auto;
}

/* Header */

header {
  margin-bottom: var(--s5);
  text-align: center;
}

body.home header {
  max-width: var(--measure-wide);
}

header p {
  color: var(--ink-soft);
  text-wrap: balance;
}

/* The intro doubles as a table of contents, so its links stay quiet next to
   the real outbound ones in the body. */
header a,
header a:visited {
  color: var(--ink-soft);
  text-decoration-color: var(--line);
}

@media (hover: hover) {
  header a:hover { color: var(--accent); }
}

img.logo {
  display: block;
  width: 132px;
  height: auto;
  margin: 0 auto var(--s3);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Type */

h1, h2, h3 {
  line-height: 1.15;
  text-wrap: balance;
}

h1 {
  margin: 0 0 var(--s2);
  font-size: clamp(1.9rem, 5.5vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.015em;
}

/* The name is set in caps on the front page, so it needs air, not tightening. */
body.home h1 {
  font-size: clamp(1.5rem, 4.5vw, 1.9rem);
  letter-spacing: 0.02em;
}

h1 .initial { color: var(--accent); }

h2 {
  margin: var(--s5) 0 var(--s1);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

h3 {
  margin: var(--s4) 0 var(--s1);
  font-size: 1.1rem;
  font-weight: 700;
}

p { margin: 0 0 var(--s2); }

ul, ol {
  margin: 0 0 var(--s2);
  padding-left: var(--s3);
}

li { margin-bottom: var(--s1); }

blockquote {
  margin: var(--s2) 0;
  padding-left: var(--s2);
  border-left: 2px solid var(--line);
  color: var(--ink-soft);
}

small {
  font-size: 0.85rem;
  color: var(--ink-soft);
}

/* Links */

a {
  color: var(--accent);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.15em;
  transition: color 0.15s cubic-bezier(0.33, 1, 0.68, 1);
}

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

@media (hover: hover) {
  a:hover { color: var(--ink); }
}

/* Code */

pre, code {
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

code {
  padding: 0.1em 0.3em;
  border-radius: 4px;
  background-color: var(--surface);
}

pre {
  margin: var(--s2) 0;
  padding: var(--s2);
  border-radius: 8px;
  background-color: var(--surface);
  line-height: 1.5;
  overflow: auto;
}

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

/* Images */

article img {
  display: block;
  width: 100%;
  height: auto;
  margin-block: var(--s1);
  border-radius: 8px;
}

/* Footer */

footer {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--s2);
  margin-top: var(--s6);
  padding-top: var(--s4);
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--ink-soft);
}

footer p { margin: 0; }

.langs {
  display: flex;
  gap: var(--s2);
}

.langs .active {
  color: var(--ink);
  font-weight: 700;
}

@media screen and (max-width: 40rem) {
  body {
    padding: var(--s4) var(--s3);
    font-size: 17px;
    word-wrap: break-word;
  }

  img.logo {
    width: 108px;
  }

  /* Centred text reads fine for a line or two, badly for a wrapped paragraph. */
  header p { text-align: left; }

  h2 { margin-top: var(--s4); }
}
