/* Wikify.io: лабораторный журнал. Светлая схема по умолчанию, тёмная по системной настройке.
   Жёлтый только как заливка-маркер под тёмным текстом. Без картинок и движения. */

@font-face {
  font-family: "Plex Mono";
  font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/plex-mono-cyrillic-400.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Plex Mono";
  font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/plex-mono-latin-400.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Plex Mono";
  font-style: normal; font-weight: 600; font-display: swap;
  src: url("fonts/plex-mono-cyrillic-600.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Plex Mono";
  font-style: normal; font-weight: 600; font-display: swap;
  src: url("fonts/plex-mono-latin-600.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #fbfaf6;
  --text: #161614;
  --muted: #6b6a64;
  --rule: #d9d7cf;
  --link: #161614;
  --mark: #ffe94d;      /* плашка знака */
  --hl: #fff6b0;        /* выделения */
  --hl-text: #161614;
  --measure: 44rem;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131316;
    --text: #e6e3da;
    --muted: #8f8c84;
    --rule: #2e2e33;
    --link: #ffe94d;
    --hl: #ffe94d;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 0.9375rem/1.7 "Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.top, main, .bottom {
  width: 100%;
  max-width: calc(var(--measure) + 2rem);
  margin: 0 auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

/* Шапка */
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding-top: 2rem;
}
.mark {
  display: inline-flex;
  align-items: center;
  gap: 0.5ch;
  background: var(--mark);
  color: #161614;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 0.1em 0.5ch;
  text-decoration: none;
}
.cursor {
  display: inline-block;
  width: 0.62em;
  height: 1.05em;
  background: currentColor;
}
.lang { letter-spacing: 0.08em; white-space: nowrap; }
.lang a, .lang [aria-current] { padding: 0.1em 0.3ch; }
.lang [aria-current] { background: var(--hl); color: var(--hl-text); font-weight: 600; }

.rule { color: var(--muted); letter-spacing: 0.1em; margin: 1.5rem 0; user-select: none; }

main { flex: 1; padding-bottom: 2rem; }

/* Главная фраза */
h1 {
  font-size: clamp(1.25rem, 3.6vw, 1.625rem);
  line-height: 1.45;
  font-weight: 600;
  margin: 2.5rem 0 1.25rem;
}
.sub { margin-bottom: 0; }
h1 > .hl {
  background: var(--hl);
  color: var(--hl-text);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  padding: 0 0.2ch;
}

section { margin-top: 2.5rem; }
main .rule:not(:first-child) { margin: 2rem 0 0; }
.sub + section { margin-top: 1.5rem; }
.rule + section { margin-top: 1.5rem; }

h2 {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin: 0 0 0.75rem;
}
h2::before { content: "+ "; color: var(--muted); }
h2::after  { content: " +"; color: var(--muted); }

p { margin: 0 0 1rem; }
p:last-child { margin-bottom: 0; }

a { color: var(--link); text-decoration: underline; text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { background: var(--hl); color: var(--hl-text); }
a:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.mark:hover { background: var(--mark); color: #161614; }

.label { letter-spacing: 0.08em; color: var(--muted); }

.bottom {
  padding-top: 0;
  padding-bottom: 2rem;
  color: var(--muted);
  font-size: 0.8125rem;
}
.bottom .rule { margin-top: 0; }

/* Эффект «правка» (assets/fx.js). Без JS и при reduced-motion ничего из этого не включается. */

strong { font-weight: 600; }
.fx-on h1 > .hl { visibility: hidden; animation: fx-show 0s 2.5s forwards; }
.fx-on h1 > .hl.fx { visibility: visible; animation: none; }
@keyframes fx-show { to { visibility: visible; } }
h1 > .hl.fx { background: none; }
.fx-typed {
  background: var(--hl);
  color: var(--hl-text);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.fx-cur { background: var(--text); color: var(--bg); }
.fx-rest { color: transparent; }

.cursor-blink {
  width: 0.6em;
  height: 1.1em;
  margin-left: 0.6ch;
  vertical-align: -0.2em;
  animation: blink 1.1s steps(1, end) infinite;
}
@keyframes blink { 50% { visibility: hidden; } }
@media (prefers-reduced-motion: reduce) {
  .cursor-blink { animation: none; }
}
