/* roadto — bilingual editorial theme
   Literata (text) + Manrope (UI). Accents belong to the active section only. */

@font-face {
  font-family: "Manrope Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url("../fonts/manrope-cyrillic-wght-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Manrope Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url("../fonts/manrope-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Manrope Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url("../fonts/manrope-latin-wght-normal.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+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Literata Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 200 900;
  src: url("../fonts/literata-cyrillic-wght-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Literata Variable";
  font-style: italic;
  font-display: swap;
  font-weight: 200 900;
  src: url("../fonts/literata-cyrillic-wght-italic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Literata Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 200 900;
  src: url("../fonts/literata-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Literata Variable";
  font-style: italic;
  font-display: swap;
  font-weight: 200 900;
  src: url("../fonts/literata-latin-ext-wght-italic.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Literata Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 200 900;
  src: url("../fonts/literata-latin-wght-normal.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+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Literata Variable";
  font-style: italic;
  font-display: swap;
  font-weight: 200 900;
  src: url("../fonts/literata-latin-wght-italic.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+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #f3f0e8;
  --bg-elev: #faf8f3;
  --ink: #1a1814;
  --muted: #5c574f;
  --faint: #847e74;
  --line: #e2dcd0;
  --accent: #1a1814;
  --fire: #146b3a;
  --infosec: #184882;
  --smarthome: #a84e0e;
  --selfhost: #4e3b78;
  --about: #4a4742;
  --code-bg: #17191a;
  --code-fg: #ece7dc;
  --serif: "Literata Variable", "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  --sans: "Manrope Variable", "Segoe UI", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Code", Menlo, Consolas, monospace;
  --wrap: 72rem;
  --measure: 40.5rem;
  --header: 4.25rem;
  --pad: 1.25rem;
  color-scheme: light;
  --show: block;
}

html[data-theme="dark"] {
  --bg: #111311;
  --bg-elev: #191c19;
  --ink: #ece7dc;
  --muted: #b1ab9f;
  --faint: #8d877c;
  --line: #2c312c;
  --accent: #ece7dc;
  --fire: #8dceab;
  --infosec: #9dc0ea;
  --smarthome: #f0b27a;
  --selfhost: #cbbfe8;
  --about: #c8c2b6;
  --code-bg: #0c0e0d;
  --code-fg: #ece7dc;
  color-scheme: dark;
}

html[data-section="fire"],
.tag-fire,
.section-fire { --accent: var(--fire); }
html[data-section="infosec"],
.tag-infosec,
.section-infosec { --accent: var(--infosec); }
html[data-section="smarthome"],
.tag-smarthome,
.section-smarthome { --accent: var(--smarthome); }
html[data-section="self-host"],
.tag-self-host,
.section-self-host { --accent: var(--selfhost); }
html[data-section="about"],
.section-about { --accent: var(--about); }

/* Language packs. Default (no JS / before script) is Russian. */
.lang-en { display: none; }
span.lang-ru,
span.lang-en,
a.lang-ru,
a.lang-en,
em.lang-ru,
em.lang-en { --show: inline; }
html[data-lang="en"] .lang-ru { display: none; }
html[data-lang="en"] .lang-en { display: var(--show, block); }

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.5;
  font-weight: 460;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; display: block; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.skip {
  position: absolute;
  left: var(--pad);
  top: -4rem;
  background: var(--ink);
  color: var(--bg);
  padding: 0.5rem 0.8rem;
  z-index: 50;
}
.skip:focus { top: 0.5rem; }

.wrap {
  width: min(var(--wrap), calc(100% - var(--pad) * 2));
  margin-inline: auto;
}

.progress {
  position: fixed;
  inset: 0 auto auto 0;
  height: 2px;
  width: 0;
  background: var(--accent);
  z-index: 40;
  pointer-events: none;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--header);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}
.brand {
  font-family: var(--serif);
  font-weight: 560;
  font-size: 1.55rem;
  letter-spacing: -0.035em;
  text-decoration: none;
  line-height: 1;
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
}
.brand i {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  transform: translateY(-0.15rem);
}
.nav {
  display: flex;
  align-items: center;
  gap: 0.15rem 1.05rem;
  flex-wrap: wrap;
}
.nav a {
  text-decoration: none;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 620;
  letter-spacing: -0.01em;
  padding: 0.35rem 0;
  border-bottom: 2px solid transparent;
}
.nav a:hover { color: var(--ink); }
.nav a.is-active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}
.tools {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.icon-btn,
.lang-switch a {
  appearance: none;
  background: transparent;
  border: 0;
  min-width: 2.75rem;
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  text-decoration: none;
  padding: 0;
}
.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.1rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.lang-switch a {
  min-width: 2.1rem;
  color: var(--faint);
}
.lang-switch a.is-active { color: var(--ink); }
.lang-switch .sep { color: var(--line); }
.menu-btn { display: none; }
.icon-btn svg { width: 1.15rem; height: 1.15rem; }

/* Gate */
.gate {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: calc(100dvh - var(--header) - 7rem);
  border-bottom: 1px solid var(--line);
}
.gate a {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 2rem;
  min-height: 22rem;
  padding: clamp(1.5rem, 4vw, 3rem);
  text-decoration: none;
  background: transparent;
}
.gate a + a { border-left: 1px solid var(--line); }
.gate a:hover { background: var(--bg-elev); }
.gate .eyebrow {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}
.gate strong {
  font-family: var(--serif);
  font-weight: 520;
  font-size: clamp(3.2rem, 8vw, 6.4rem);
  letter-spacing: -0.045em;
  line-height: 0.9;
}
.gate small {
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 18rem;
}

.home-intro { padding: 2.75rem 0 1.5rem; }
.display {
  font-family: var(--serif);
  font-weight: 540;
  font-size: clamp(2.6rem, 6vw, 4.8rem);
  letter-spacing: -0.038em;
  line-height: 0.98;
  margin: 0.45rem 0 0.9rem;
}
.lede {
  max-width: 38rem;
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1.45;
  margin: 0;
}
.kicker {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 730;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
.meta {
  color: var(--faint);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.feature {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 2rem;
  align-items: end;
  padding: 1.25rem 0 2rem;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}
.feature h2 {
  font-family: var(--serif);
  font-weight: 540;
  font-size: clamp(2rem, 4vw, 3.15rem);
  letter-spacing: -0.03em;
  line-height: 1.04;
  margin: 0.45rem 0 0.7rem;
}
.feature p { margin: 0 0 1rem; color: var(--muted); max-width: 36rem; }
.feature .cover { aspect-ratio: 3/2; object-fit: cover; width: 100%; background: var(--line); }

.post-row {
  display: grid;
  grid-template-columns: 7.25rem 1fr;
  gap: 1.15rem;
  align-items: center;
  padding: 1.15rem 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}
.post-row .cover {
  aspect-ratio: 3/2;
  object-fit: cover;
  width: 100%;
  background: var(--line);
}
.post-row h3 {
  font-family: var(--serif);
  font-weight: 560;
  font-size: clamp(1.25rem, 2vw, 1.65rem);
  letter-spacing: -0.025em;
  line-height: 1.15;
  margin: 0.25rem 0 0.35rem;
}
.post-row p {
  margin: 0 0 0.45rem;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.row-kicker {
  display: flex;
  gap: 0.7rem;
  align-items: baseline;
  justify-content: space-between;
}

.rails { padding-top: 0.5rem; }
.rail-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding-top: 1.4rem;
  text-decoration: none;
}
.rail-label strong {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 560;
  letter-spacing: -0.02em;
}

.section-hero { padding: 2.4rem 0 1.3rem; border-bottom: 1px solid var(--line); }
.index-no {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--faint);
  letter-spacing: 0.04em;
}
.section-hero h1 {
  font-family: var(--serif);
  font-weight: 540;
  font-size: clamp(2.8rem, 7vw, 5rem);
  letter-spacing: -0.04em;
  line-height: 0.95;
  margin: 0.35rem 0 0.85rem;
}
.rule { width: 2.75rem; height: 2px; background: var(--accent); border: 0; margin: 0 0 0.9rem; }
.section-hero .lede { max-width: 34rem; }

/* Article */
.article { padding: 2.2rem 0 1rem; }
.article-head { max-width: var(--measure); margin: 0 auto 1.4rem; }
.article-head h1 {
  font-family: var(--serif);
  font-weight: 540;
  font-size: clamp(2.15rem, 5vw, 3.5rem);
  letter-spacing: -0.035em;
  line-height: 1.04;
  margin: 0.4rem 0 0.8rem;
}
.article-head .dek {
  font-family: var(--serif);
  font-size: 1.25rem;
  line-height: 1.4;
  color: var(--muted);
  margin: 0 0 1rem;
}
.byline { display: flex; flex-wrap: wrap; gap: 0.35rem 0.8rem; align-items: center; }
.byline a { text-decoration: none; border-bottom: 1px solid var(--line); }
.figure { margin: 0 auto 1.6rem; max-width: 52rem; }
.figure img { width: 100%; aspect-ratio: 3/2; object-fit: cover; background: var(--line); }
.figure figcaption { color: var(--faint); font-size: 0.82rem; margin-top: 0.45rem; }

.prose {
  max-width: var(--measure);
  margin: 0 auto;
  font-family: var(--serif);
  font-size: 1.14rem;
  line-height: 1.65;
  font-weight: 430;
}
.prose h2 {
  font-family: var(--sans);
  font-weight: 680;
  font-size: 1.12rem;
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin: 2rem 0 0.55rem;
}
.prose p { margin: 0 0 1rem; }
.prose ul, .prose ol { margin: 0 0 1rem; padding-left: 1.2rem; }
.prose li { margin: 0.25rem 0; }
.prose a { color: var(--accent); text-underline-offset: 0.15em; }
.prose blockquote {
  margin: 1.2rem 0;
  padding-left: 1rem;
  border-left: 2px solid var(--accent);
  color: var(--muted);
  font-style: italic;
}
.prose code {
  font-family: var(--mono);
  font-size: 0.84em;
  background: color-mix(in srgb, var(--ink) 7%, transparent);
  padding: 0.08em 0.32em;
}
.prose pre {
  background: var(--code-bg);
  color: var(--code-fg);
  padding: 1rem 1.05rem;
  overflow: auto;
  font-family: var(--mono);
  font-size: 0.84rem;
  line-height: 1.55;
  margin: 0 0 1.2rem;
}
.prose pre code { background: transparent; padding: 0; color: inherit; font-size: inherit; }
.tok-cm { color: #9a9488; }
.tok-str { color: #e2c09a; }
.tok-kw { color: #8dceab; }
.tok-num { color: #f0b27a; }
.tok-fn { color: #9dc0ea; }

.translation {
  margin-top: 0.8rem;
  font-family: var(--sans);
  font-size: 0.92rem;
}
.translation a { color: var(--accent); font-weight: 650; }

.related { margin-top: 2.5rem; }
.related h2, .block-title {
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 730;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 0;
}

/* About */
.about-grid {
  display: grid;
  grid-template-columns: 16rem 1fr;
  gap: 2.5rem;
  padding: 2.5rem 0 1rem;
}
.avatar {
  width: 4.5rem;
  height: 4.5rem;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--serif);
  font-size: 1.4rem;
  letter-spacing: -0.03em;
}
.about-grid h1 {
  font-family: var(--serif);
  font-weight: 540;
  font-size: clamp(2.4rem, 5vw, 3.8rem);
  letter-spacing: -0.035em;
  line-height: 1;
  margin: 0.3rem 0 0.8rem;
}

/* Subscribe */
.subscribe {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1.5rem;
  padding: 2rem 0;
  margin-top: 1rem;
  border-top: 1px solid var(--line);
}
.subscribe h2 {
  font-family: var(--serif);
  font-weight: 540;
  font-size: 1.8rem;
  letter-spacing: -0.03em;
  margin: 0.3rem 0;
}
.subscribe p { margin: 0; color: var(--muted); max-width: 28rem; }
.subscribe form, .search-form { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.subscribe input, .search-form input, .field {
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--ink);
  padding: 0.65rem 0;
  min-width: min(18rem, 100%);
  border-radius: 0;
}
.btn {
  appearance: none;
  background: var(--ink);
  color: var(--bg);
  border: 0;
  min-height: 2.75rem;
  padding: 0.55rem 0.95rem;
  font-weight: 680;
  letter-spacing: -0.01em;
}
.btn:hover { background: var(--accent); color: var(--bg); }
.form-note { color: var(--accent); font-size: 0.9rem; min-height: 1.2em; margin: 0.4rem 0 0; }

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.2rem 0;
}
.pagination a {
  text-decoration: none;
  font-weight: 680;
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
}
.pagination .disabled { color: var(--faint); }

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 2rem 0 2.5rem;
  margin-top: 1rem;
  color: var(--muted);
  font-size: 0.92rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 1.5rem;
}
.site-footer a { text-decoration: none; }
.site-footer a:hover { color: var(--ink); }
.footer-brand {
  font-family: var(--serif);
  color: var(--ink);
  font-size: 1.4rem;
  letter-spacing: -0.03em;
}
.foot-links { display: flex; flex-direction: column; gap: 0.3rem; align-items: flex-start; }
.legal { margin: 1.4rem 0 0; color: var(--faint); font-size: 0.8rem; }

/* Search */
dialog.search {
  width: min(38rem, calc(100vw - 1.5rem));
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--ink);
  padding: 1rem 1rem 0.4rem;
  margin: 12vh auto auto;
}
dialog.search::backdrop { background: color-mix(in srgb, #141210 45%, transparent); }
dialog.search input[type="search"] {
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 0.7rem 0;
  font-family: var(--serif);
  font-size: 1.45rem;
}
.search-hits { list-style: none; margin: 0.6rem 0; padding: 0; max-height: 50vh; overflow: auto; }
.search-hits a {
  display: block;
  text-decoration: none;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--line);
}
.search-hits strong { display: block; font-family: var(--serif); font-weight: 560; font-size: 1.15rem; }
.search-empty, .search-hint { color: var(--muted); font-size: 0.92rem; }

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

.strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.strip a {
  text-decoration: none;
  padding: 0.95rem 0.75rem 0.95rem 0;
  border-top: 2px solid var(--accent);
  font-weight: 680;
  letter-spacing: -0.01em;
}
.strip a span {
  display: block;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--faint);
  letter-spacing: 0.06em;
  margin-bottom: 0.25rem;
}
.cover-fallback { background: color-mix(in srgb, var(--accent) 16%, var(--bg-elev)); }
.badge {
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  border: 1px solid var(--line);
  padding: 0.08rem 0.3rem;
  color: var(--muted);
}

.error-page { padding: 4rem 0 3rem; }
.error-page h1 {
  font-family: var(--serif);
  font-size: clamp(3rem, 8vw, 6rem);
  letter-spacing: -0.04em;
  margin: 0;
  line-height: 0.9;
}

.filter-row { display: flex; gap: 0.4rem; padding: 1rem 0; }
.filter-row button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.filter-row button {
  background: transparent;
  border: 1px solid var(--line);
  min-height: 2.75rem;
  padding: 0 0.8rem;
}

@media (max-width: 860px) {
  .menu-btn { display: inline-flex; }
  .nav {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: var(--header);
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    flex-direction: column;
    align-items: stretch;
    padding: 0.4rem var(--pad) 1rem;
    gap: 0;
  }
  .nav.is-open { display: flex; }
  .nav a {
    font-family: var(--serif);
    font-size: 1.8rem;
    font-weight: 520;
    letter-spacing: -0.03em;
    padding: 0.35rem 0;
    border-bottom: 0;
  }
  .feature, .about-grid, .footer-grid, .gate, .subscribe {
    grid-template-columns: 1fr;
    display: grid;
  }
  .gate a + a { border-left: 0; border-top: 1px solid var(--line); }
  .subscribe { align-items: start; }
  .post-row { grid-template-columns: 5.2rem 1fr; gap: 0.8rem; }
  .strip { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
