/*
 * still unknown — стили сайта.
 * Обычный CSS без сборки: правьте и загружайте.
 * Цвета тем — в переменных ниже.
 */

/* ---------- Шрифты (локальные, только нужные наборы символов) ---------- */

@font-face {
  font-family: "Source Serif 4"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url(../fonts/source-serif-4-latin.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: "Source Serif 4"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url(../fonts/source-serif-4-latin-ext.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: "Source Serif 4"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url(../fonts/source-serif-4-cyrillic.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Source Serif 4"; font-style: italic; font-weight: 400 600; font-display: swap;
  src: url(../fonts/source-serif-4-italic-latin.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: "Source Serif 4"; font-style: italic; font-weight: 400 600; font-display: swap;
  src: url(../fonts/source-serif-4-italic-latin-ext.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: "Source Serif 4"; font-style: italic; font-weight: 400 600; font-display: swap;
  src: url(../fonts/source-serif-4-italic-cyrillic.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url(../fonts/inter-latin.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: "Inter"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url(../fonts/inter-latin-ext.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: "Inter"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url(../fonts/inter-cyrillic.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

/* ---------- Темы ---------- */

:root {
  --bg: #0b0e17;
  --bg-raised: #10141f;
  --edge-bg: #141a2a;
  --text: #e6e3dc;
  --muted: #9a978f;
  --accent: #d8b56a;
  --line: #262b3a;
  --underline: rgba(216, 181, 106, .45);
  --serif: "Source Serif 4", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: dark;
}

/* Светлая тема: по настройке системы, если пользователь не выбрал тёмную вручную… */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f6f3ec;
    --bg-raised: #efeadf;
    --edge-bg: #fdfbf7;
    --text: #1c1e24;
    --muted: #5f5c55;
    --accent: #8a6a1f;
    --line: #dcd5c6;
    --underline: rgba(138, 106, 31, .4);
    color-scheme: light;
  }
}
/* …или по переключателю. */
:root[data-theme="light"] {
  --bg: #f6f3ec;
  --bg-raised: #efeadf;
  --edge-bg: #fdfbf7;
  --text: #1c1e24;
  --muted: #5f5c55;
  --accent: #8a6a1f;
  --line: #dcd5c6;
  --underline: rgba(138, 106, 31, .4);
  color-scheme: light;
}

/* ---------- Основа ---------- */

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

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

main { flex: 1 0 auto; }

a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-color: var(--underline);
  text-decoration-thickness: 1px;
  text-underline-offset: .2em;
  transition: color .2s, text-decoration-color .2s, border-color .2s;
}
a:hover { color: var(--accent); text-decoration-color: currentColor; }

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

[hidden] { display: none !important; }

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

.skip {
  position: absolute; left: 1rem; top: -4rem; z-index: 20;
  padding: .5rem .9rem;
  background: var(--bg-raised); color: var(--text);
  border: 1px solid var(--line); border-radius: 6px;
}
.skip:focus { top: 1rem; }

.wrap { width: 100%; max-width: 72rem; margin: 0 auto; padding: 0 1rem; }
@media (min-width: 40em) { .wrap { padding: 0 2rem; } }

/* ---------- Шапка ---------- */

.topbar { background: var(--bg); }

.site-header {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  width: 100%;
  max-width: 72rem;
  height: 3.75rem;
  margin: 0 auto;
  padding: 0 1rem;
}
@media (min-width: 40em) { .site-header { padding: 0 2rem; } }

.logo {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  margin-right: auto;
  color: var(--text);
  font: 500 1.3125rem/1 var(--serif);
  letter-spacing: .005em;
  text-decoration: none;
  white-space: nowrap;
}
.logo:hover { color: var(--text); }
.logo-star { width: .8rem; height: .8rem; fill: var(--accent); transition: transform .6s; }
.logo:hover .logo-star { transform: rotate(45deg); }
.logo-dim { color: var(--muted); }

.nav { display: flex; align-items: center; gap: 1.5rem; font-size: .875rem; }
.nav a { color: var(--muted); text-decoration: none; }
.nav a:hover, .nav a[aria-current] { color: var(--text); }

.theme-toggle {
  display: inline-flex;
  padding: .4rem;
  margin: 0 -.4rem 0 0;
  background: none;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  cursor: pointer;
}
.theme-toggle:hover { color: var(--text); }
.theme-toggle svg { width: 1.125rem; height: 1.125rem; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.theme-toggle[data-state="dark"] .icon-moon,
.theme-toggle[data-state="light"] .icon-sun { display: none; }

.menu { display: none; position: relative; }
.menu summary {
  list-style: none;
  padding: .4rem 0;
  color: var(--muted);
  font-size: .9375rem;
  cursor: pointer;
}
.menu summary::-webkit-details-marker { display: none; }
.menu[open] summary, .menu summary:hover { color: var(--text); }
.menu nav {
  position: absolute;
  top: calc(100% + .5rem);
  right: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  min-width: 13rem;
  padding: .4rem 0;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .3);
}
.menu nav a { padding: .6rem 1.1rem; color: var(--text); text-decoration: none; font-size: .9375rem; }
.menu nav a:hover, .menu nav a[aria-current] { color: var(--accent); }

@media (max-width: 40em) {
  .nav { display: none; }
  .menu { display: block; }
}

/* На главной шапка — часть ночного неба в любой теме. */
.page-home .topbar {
  --bg: #0b0e17;
  --bg-raised: #10141f;
  --text: #e6e3dc;
  --muted: #9a978f;
  --accent: #d8b56a;
  --line: #262b3a;
  color-scheme: dark;
  color: var(--text);
}

/* ---------- Небо на главной ---------- */

.sky {
  position: relative;
  height: calc(100vh - 3.75rem);
  height: calc(100svh - 3.75rem);
  min-height: 26rem;
  max-height: 64rem;
  overflow: hidden;
  color: #e6e3dc;
  background:
    radial-gradient(ellipse 70% 55% at 50% 45%, rgba(40, 52, 96, .38), rgba(11, 14, 23, 0) 72%),
    url(../img/sky-dust.svg) 0 0 / 640px 640px,
    url(../img/sky-dust.svg) 211px 347px / 960px 960px,
    #0b0e17;
}
@media (max-width: 40em) {
  .sky { height: 70vh; height: 70svh; min-height: 22rem; }
}

.sky-svg { display: block; width: 100%; height: 100%; overflow: visible; }

.links line {
  stroke: #3a4462;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  transition: opacity .4s, stroke .4s;
}

.star { cursor: pointer; transition: opacity .4s; }
.star:focus { outline: none; }
.star .core {
  opacity: var(--o);
  animation: twinkle var(--p) ease-in-out var(--d) infinite;
}
.star .glow { transform-box: fill-box; transform-origin: center; transition: transform .4s; }
.star .ring { fill: none; stroke: #9a978f; stroke-width: .9; stroke-dasharray: 2 2.6; opacity: .75; }
.star .hit { fill: transparent; }
.star:hover .glow, .star:focus-visible .glow, .star.on .glow { transform: scale(1.6); }
.star:focus-visible .core { stroke: #d8b56a; stroke-width: 1.5; }

@keyframes twinkle {
  0%, 100% { opacity: var(--o); }
  50% { opacity: calc(var(--o) * .5); }
}

.sky.is-focus .star { opacity: .25; }
.sky.is-focus .star.on { opacity: 1; }
.sky.is-focus .links line { opacity: .12; }
.sky.is-focus .links line.on { opacity: 1; stroke: #d8b56a; }

.sky-tip {
  position: absolute;
  z-index: 2;
  width: max-content;
  max-width: min(20rem, calc(100% - 1.5rem));
  padding: .7rem .9rem .75rem;
  background: rgba(14, 18, 30, .94);
  border: 1px solid #2c3246;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
  color: #e6e3dc;
  pointer-events: none;
}
.sky-tip-title { margin: 0 0 .25rem; font: 500 1.0625rem/1.3 var(--serif); }
.sky-tip-short { margin: 0; color: #a9a69e; font: .8125rem/1.45 var(--sans); }
.sky-tip-note { margin: .45rem 0 0; color: #d8b56a; font: .75rem/1.4 var(--sans); }

@media (prefers-reduced-motion: reduce) {
  .star .core { animation: none; }
  .star, .star .glow, .links line, .logo-star { transition: none; }
}

/* ---------- Главная под небом ---------- */

.home-intro { padding-top: 2.75rem; padding-bottom: .5rem; text-align: center; }
.intro { margin: 0 0 .9rem; font: 400 1.375rem/1.45 var(--serif); text-wrap: balance; }
.home-links { margin: 0; color: var(--muted); font-size: .9375rem; }
.home-links a { color: var(--muted); white-space: nowrap; }
.home-links a:hover { color: var(--accent); }

.home-list { padding-top: 3rem; padding-bottom: 4.5rem; }
.list-heading { margin: 0 0 1.5rem; color: var(--muted); font: 500 .875rem/1.4 var(--sans); }

/* ---------- Списки вопросов ---------- */

.qlist { display: grid; gap: 1.6rem 3rem; margin: 0; padding: 0; list-style: none; }
@media (min-width: 52em) { .qlist-columns { grid-template-columns: 1fr 1fr; } }

.qitem-link { text-decoration: none; }
.qitem-title { font: 500 1.25rem/1.35 var(--serif); }
.qitem-link:hover .qitem-title { color: var(--accent); }
.qitem-short { margin: .3rem 0 .35rem; color: var(--text); font: 400 1.0625rem/1.5 var(--serif); opacity: .82; }
.qitem-meta { margin: 0; color: var(--muted); font-size: .8125rem; }
.qitem.is-draft .qitem-title, .qitem.is-draft .qitem-short { color: var(--muted); opacity: 1; }

.empty { color: var(--muted); }

/* ---------- Обычные страницы ---------- */

.page { padding-top: 2.75rem; padding-bottom: 4.5rem; }
.page-head { margin-bottom: 2.25rem; }
.page-head h1, .q-head h1 {
  margin: 0 0 .6rem;
  font: 500 clamp(2rem, 1.35rem + 2.6vw, 3rem)/1.15 var(--serif);
  letter-spacing: -.01em;
  text-wrap: balance;
}
.page-sub { margin: 0; color: var(--muted); font-size: .9375rem; }
.page-lede { max-width: 40rem; margin: 0; color: var(--muted); font: 400 1.1875rem/1.55 var(--serif); }
.kicker { margin: 0 0 .75rem; color: var(--muted); font-size: .875rem; }
.kicker a { color: var(--muted); }

.filters { display: grid; gap: .7rem; margin: 0 0 2.75rem; font-size: .875rem; }
.filter-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: .45rem; }
.filter-label { min-width: 4.75rem; color: var(--muted); }
.filter-row a {
  padding: .2rem .7rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  color: var(--muted);
  text-decoration: none;
}
.filter-row a:hover { color: var(--text); border-color: var(--muted); }
.filter-row a[aria-current] { color: var(--text); border-color: var(--accent); }
.filter-count { margin-left: .4em; opacity: .65; font-variant-numeric: tabular-nums; }

/* ---------- Страница вопроса ---------- */

.article { width: 100%; max-width: 46rem; margin: 0 auto; padding: 2.75rem 1rem 4.5rem; }

.q-head { margin-bottom: 2.75rem; }
.tags { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 1.4rem; font-size: .8125rem; }
.tag {
  padding: .15rem .75rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  color: var(--muted);
  text-decoration: none;
}
.tag:hover { color: var(--text); border-color: var(--muted); }
.lede { margin: 0 0 1rem; font: italic 400 1.3125rem/1.5 var(--serif); opacity: .9; }
.q-meta { margin: 0 0 1.9rem; color: var(--muted); font-size: .875rem; }

/* Индикатор близости: тонкая линия и звезда, без процентов. */
.prox { max-width: 27rem; color: var(--muted); font-size: .75rem; line-height: 1.4; }
.prox-cap { margin: 0 0 .55rem; }
.prox-row { display: flex; align-items: center; gap: .8rem; }
.prox-track { position: relative; flex: 1; height: 1px; background: var(--line); }
.prox-track::before {
  content: "";
  position: absolute;
  left: 0; top: 0;
  width: calc(var(--x) * 100%);
  height: 1px;
  background: linear-gradient(to right, transparent, var(--accent));
}
.prox-star {
  position: absolute;
  left: calc(var(--x) * 100%);
  top: 50%;
  width: 22px; height: 22px;
  transform: translate(-50%, -50%);
}
.prox-star::before, .prox-star::after { content: ""; position: absolute; inset: 0; }
.prox-star::before { background: radial-gradient(circle, var(--accent) 0, transparent 65%); opacity: .35; }
.prox-star::after {
  inset: 5px;
  background: var(--accent);
  clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
}

.notice {
  margin: 0 0 2.25rem;
  padding: .15rem 0 .15rem .9rem;
  border-left: 2px solid var(--accent);
  color: var(--muted);
  font-size: .875rem;
}

.draft-note {
  max-width: 40rem;
  margin: 0 0 1rem;
  padding: 1.3rem 1.5rem;
  border: 1px dashed var(--line);
  border-radius: 8px;
}
.draft-note-title { margin: 0 0 .35rem; font: 500 1.3125rem/1.3 var(--serif); }
.draft-note p:last-child { margin: 0; color: var(--muted); }

/* Текст статьи: serif 19–20px, интервал 1.65, колонка до 68 знаков. */
.prose { max-width: 68ch; font: 400 1.1875rem/1.65 var(--serif); }
@media (min-width: 48em) { .prose { font-size: 1.25rem; } }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose dl, .prose table { margin: 0 0 1.1em; }
.prose h2 { margin: 2.1em 0 .65em; font: 500 1.4em/1.3 var(--serif); letter-spacing: -.005em; }
.prose h3 { margin: 1.7em 0 .4em; font: 600 1.075em/1.4 var(--serif); }
.prose > :first-child, .prose section:first-child > h2 { margin-top: 0; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin: .35em 0; }
.prose li::marker { color: var(--muted); }
.prose strong { font-weight: 600; }
.prose blockquote { padding-left: 1em; border-left: 2px solid var(--line); color: var(--muted); font-style: italic; }
.prose hr { margin: 2em 0; border: 0; border-top: 1px solid var(--line); }
.prose code { font-size: .85em; }
.prose table { border-collapse: collapse; font-size: .9em; }
.prose th, .prose td { padding: .4em .8em; border-bottom: 1px solid var(--line); text-align: left; }
.prose sup { line-height: 0; }

/* Где заканчивается понимание: линия слева растворяется книзу, фон чуть светлее. */
.edge {
  position: relative;
  margin: 2.6em 0;
  padding: 1.5em 1.4em 1.9em 1.6em;
  background: linear-gradient(to bottom, var(--edge-bg) 0%, var(--edge-bg) 50%, transparent 100%);
  border-radius: 0 6px 0 0;
}
.edge::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--accent) 0%, var(--accent) 25%, transparent 100%);
}
.edge > h2 { margin-top: 0; }
.edge > :last-child { margin-bottom: 0; }
@media (max-width: 40em) {
  .edge { margin-left: -.5rem; margin-right: -.5rem; padding-left: 1.1rem; padding-right: .9rem; }
}

/* Связанные вопросы и источники. */
.block-title { margin: 0 0 1.25rem; font: 500 1.4375rem/1.3 var(--serif); }

.related { margin-top: 3.75rem; padding-top: 2.25rem; border-top: 1px solid var(--line); }
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13.5rem, 1fr));
  gap: 1rem;
  margin: 0; padding: 0;
  list-style: none;
}
.card a {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  height: 100%;
  padding: 1rem 1.1rem 1.1rem;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 8px;
  text-decoration: none;
}
.card a:hover { border-color: var(--accent); color: inherit; }
.card-meta { color: var(--muted); font-size: .75rem; line-height: 1.4; }
.card-title { font: 500 1.125rem/1.35 var(--serif); }
.card a:hover .card-title { color: var(--accent); }
.card-short { color: var(--muted); font-size: .8125rem; line-height: 1.5; }
.card.is-draft .card-title { color: var(--muted); }

.sources { margin-top: 3.25rem; padding-top: 2.25rem; border-top: 1px solid var(--line); }
.sources ul, .sources ol { margin: 0; padding-left: 1.1em; font: 400 1rem/1.6 var(--serif); }
.sources li { margin: 0 0 .7em; overflow-wrap: anywhere; }
.sources li::marker { color: var(--muted); }
.sources p { font: 400 1rem/1.6 var(--serif); }

/* ---------- Поиск ---------- */

.search-form { display: flex; gap: .5rem; max-width: 40rem; margin: 0 0 1.25rem; }
.search-form input {
  flex: 1;
  min-width: 0;
  padding: .65rem .95rem;
  background: var(--bg-raised);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  font: 400 1.125rem/1.4 var(--serif);
}
.search-form input::placeholder { color: var(--muted); opacity: .8; }
.search-form input:focus { border-color: var(--accent); outline: none; }
.search-form input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.search-form button {
  padding: .6rem 1.15rem;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  font: 500 .9375rem var(--sans);
  cursor: pointer;
}
.search-form button:hover { border-color: var(--accent); }
.search-status { min-height: 1.5em; margin: 0 0 1.75rem; color: var(--muted); font-size: .875rem; }

/* ---------- Подвал ---------- */

.site-footer { border-top: 1px solid var(--line); }
.site-footer p {
  max-width: 72rem;
  margin: 0 auto;
  padding: 1.75rem 1rem 2.25rem;
  color: var(--muted);
  font-size: .8125rem;
  line-height: 1.6;
}
@media (min-width: 40em) { .site-footer p { padding-left: 2rem; padding-right: 2rem; } }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--accent); }

@media print {
  .topbar, .site-footer, .related, .theme-toggle { display: none; }
  body { background: #fff; color: #000; }
  .edge { background: none; }
}
