/* Тема zuko: журнал маршрутов в эстетике топокарты. Хвойная шапка с горизонталями
 * рельефа, оранжевый — цвет маркировки тропы. Админка — в общем static/admin.css,
 * на переменных отсюда. Горизонтали (contours.svg) генерирует tools/topo.py. */

@font-face {
  font-family: "Onest"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(fonts/onest-cyrillic.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Onest"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(fonts/onest-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;
}

:root {
  --bg: #f2f5f0;
  --surface: #ffffff;
  --ink: #14231b;
  --ink-2: #3a4b41;
  --muted: #6b7b71;
  --line: #dde5dc;
  --line-2: #c8d4c7;
  --accent: #c9511b;
  --accent-ink: #ffffff;
  --accent-soft: #fbe7dc;
  --forest: #16291f;
  --forest-2: #1f3a2b;
  --on-forest: #eef4ef;
  --code: #e7ede5;
  --ok: #2f7a4d;
  --ok-soft: #e0efe5;
  --danger: #b3261e;
  --danger-soft: #f8e1de;
  --shadow: 0 1px 2px rgb(20 35 27 / 6%), 0 14px 34px -18px rgb(20 35 27 / 30%);
  --shadow-lift: 0 2px 4px rgb(20 35 27 / 8%), 0 22px 44px -20px rgb(20 35 27 / 42%);

  --sans: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --display: var(--sans);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --radius: 16px;
  --wrap: 1080px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1612;
    --surface: #15201a;
    --ink: #e4ece6;
    --ink-2: #c1cdc4;
    --muted: #8a998f;
    --line: #223028;
    --line-2: #304137;
    --accent: #f08a55;
    --accent-ink: #1b0f08;
    --accent-soft: #3a2418;
    --forest: #13241b;
    --forest-2: #1a2f23;
    --code: #1c2821;
    --ok: #7fc59c;
    --ok-soft: #1c2c21;
    --danger: #f08b80;
    --danger-soft: #3a1e1b;
    --shadow: 0 1px 2px rgb(0 0 0 / 35%), 0 14px 34px -18px rgb(0 0 0 / 75%);
    --shadow-lift: 0 2px 4px rgb(0 0 0 / 40%), 0 22px 44px -20px rgb(0 0 0 / 85%);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img { max-width: 100%; height: auto; }
a { color: inherit; }
::selection { background: var(--accent-soft); color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 28px; }
body:not(.admin) { min-height: 100vh; display: flex; flex-direction: column; }
body:not(.admin) > main { flex: 1; width: 100%; }

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

.hero {
  background: var(--forest) url(contours.svg) center / cover;
  color: var(--on-forest);
}
.hero-inner { max-width: var(--wrap); margin: 0 auto; padding: 26px 28px 118px; }
.hero-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.logo {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
}
.logo-mark { width: 34px; height: 34px; flex: none; }
.logo-mark rect { fill: #d4561f; }
.logo-mark path { fill: #fff; }
.logo-name { font-size: 23px; font-weight: 800; letter-spacing: .01em; }
.hero-admin {
  padding: 6px 14px;
  border: 1px solid rgb(255 255 255 / 28%);
  border-radius: 999px;
  color: inherit;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background .2s, border-color .2s;
}
.hero-admin:hover { background: rgb(255 255 255 / 10%); border-color: rgb(255 255 255 / 55%); }
.hero-title {
  max-width: 15ch;
  margin: 64px 0 0;
  font-size: clamp(36px, 6vw, 60px);
  line-height: 1.04;
  font-weight: 800;
  letter-spacing: -.028em;
  text-wrap: balance;
}
.hero-title::after {
  content: "";
  display: block;
  width: 64px;
  height: 5px;
  margin-top: 26px;
  border-radius: 3px;
  background: repeating-linear-gradient(90deg, #f08a55 0 14px, transparent 14px 22px);
}
.hero.is-compact .hero-inner { padding-top: 18px; padding-bottom: 18px; }
.hero.is-compact .logo-mark { width: 30px; height: 30px; }
.hero.is-compact .logo-name { font-size: 20px; }

/* ---------------- Лента ---------------- */

.tiles {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px;
  margin: -64px 0 0;
  padding: 0;
  list-style: none;
}
.tiles > li { display: flex; min-width: 0; }
.tiles > li:has(.is-lead) { grid-column: 1 / -1; }

.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform .25s ease, box-shadow .25s ease;
}
.tile:hover { transform: translateY(-4px); box-shadow: var(--shadow-lift); }
.tile-cover {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--code);
}
.tile-cover img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .6s ease; }
.tile-cover.is-svg img { object-fit: contain; }
.tile:hover .tile-cover img { transform: scale(1.035); }
.tile-cover.is-empty { background: var(--forest-2) url(contours.svg) center / cover; }
.tile-cover.is-empty::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, transparent 40%, rgb(0 0 0 / 25%));
}

.tile-body { display: flex; flex: 1; flex-direction: column; padding: 22px 26px 26px; }
.tile-date, .post-meta {
  font: 600 12px/1 var(--mono);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent);
}
.tile-title {
  margin: 12px 0 10px;
  font-size: 23px;
  line-height: 1.22;
  font-weight: 750;
  letter-spacing: -.015em;
  text-wrap: balance;
}
.tile-title a { text-decoration: none; }
/* вся карточка кликабельна: ссылка заголовка растянута на неё */
.tile-title a::after { content: ""; position: absolute; inset: 0; border-radius: 20px; }
.tile:hover .tile-title a { color: var(--accent); }
.tile-excerpt {
  display: -webkit-box;
  margin: 0 0 18px;
  overflow: hidden;
  color: var(--ink-2);
  font-size: 16px;
  line-height: 1.6;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  text-wrap: pretty;
}
.tile-more {
  margin-top: auto;
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
}
.tile-more::after { content: "→"; display: inline-block; margin-left: 7px; transition: transform .2s; }
.tile:hover .tile-more::after { transform: translateX(5px); }

/* Свежая запись на первой странице — крупно, во всю ширину */
.tile.is-lead { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }
.tile.is-lead .tile-cover { aspect-ratio: auto; min-height: 360px; }
.tile.is-lead .tile-body { justify-content: center; padding: 40px 42px; }
.tile.is-lead .tile-title { font-size: clamp(26px, 3vw, 34px); line-height: 1.12; letter-spacing: -.022em; }
.tile.is-lead .tile-excerpt { -webkit-line-clamp: 5; font-size: 17px; }
.tile.is-lead .tile-more {
  align-self: flex-start;
  margin-top: 8px;
  padding: 10px 20px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
}

.empty {
  position: relative;
  margin-top: -64px;
  padding: 72px 24px;
  border: 1px dashed var(--line-2);
  border-radius: 20px;
  background: var(--surface);
  color: var(--muted);
  text-align: center;
}
.empty p { margin: 0; }

/* Пагинация */
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 48px;
  font-size: 15px;
}
.pager-step {
  padding: 9px 18px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color .2s, color .2s;
}
.pager-step:hover { border-color: var(--accent); color: var(--accent); }
.pager-step.is-off { visibility: hidden; }
.pager-nums { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
.num {
  display: inline-grid;
  place-items: center;
  min-width: 38px;
  height: 38px;
  padding: 0 6px;
  border-radius: 12px;
  color: var(--muted);
  font: 600 14px var(--mono);
  text-decoration: none;
}
a.num:hover { background: var(--accent-soft); color: var(--accent); }
.num.is-current { background: var(--forest); color: var(--on-forest); }
.gap { align-self: center; color: var(--muted); }

/* ---------------- Запись ---------------- */

.post { max-width: 720px; margin: 0 auto; padding: 56px 0 8px; }
.post-head { margin-bottom: 40px; }
.post-meta { display: flex; align-items: center; gap: 12px; }
.badge {
  padding: 5px 9px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font: 700 11px/1 var(--sans);
  letter-spacing: .06em;
}
.post-title {
  margin: 16px 0 0;
  font-size: clamp(32px, 5.2vw, 52px);
  line-height: 1.06;
  font-weight: 800;
  letter-spacing: -.028em;
  text-wrap: balance;
}
.post-title::after {
  content: "";
  display: block;
  width: 56px;
  height: 5px;
  margin-top: 26px;
  border-radius: 3px;
  background: repeating-linear-gradient(90deg, var(--accent) 0 12px, transparent 12px 19px);
}

.prose { font-size: 18px; line-height: 1.75; overflow-wrap: break-word; }
.prose > *, .prose p { margin: 0 0 1.1em; }
.prose > :last-child { margin-bottom: 0; }
.prose h1, .prose h2, .prose h3, .prose h4 { line-height: 1.25; font-weight: 750; letter-spacing: -.015em; text-wrap: balance; }
.prose h1 { font-size: 1.55em; margin: 1.8em 0 .6em; }
.prose h2 { font-size: 1.35em; margin: 1.8em 0 .6em; }
.prose h2::before {
  content: "";
  display: inline-block;
  width: 11px;
  height: 11px;
  margin-right: 12px;
  border-radius: 3px;
  background: var(--accent);
  vertical-align: .12em;
}
.prose h3 { font-size: 1.15em; margin: 1.6em 0 .5em; }
.prose h4, .prose h5, .prose h6 { font-size: 1em; margin: 1.4em 0 .4em; }
.prose a { color: var(--accent); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.prose a:hover { text-decoration-thickness: 2.5px; }
.prose strong { font-weight: 700; }
.prose img { display: block; margin: 1.8em auto; border-radius: 14px; box-shadow: var(--shadow); }
.prose p > img:only-child { margin: 0 auto; }
/* цитата — как полевая заметка на полях */
.prose blockquote {
  margin: 1.8em 0;
  padding: 16px 22px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 6px 14px 14px 6px;
  background: var(--surface);
  color: var(--ink-2);
}
.prose blockquote > :last-child, .prose li > :last-child { margin-bottom: 0; }
.prose code { font: .84em/1.5 var(--mono); background: var(--code); padding: .15em .4em; border-radius: 6px; }
.prose pre {
  padding: 18px 20px;
  overflow-x: auto;
  border-radius: 14px;
  background: var(--code);
  font-size: 15px;
  line-height: 1.6;
}
.prose pre code { padding: 0; background: none; font-size: inherit; }
/* разделитель — пунктир тропы */
.prose hr {
  height: 3px;
  margin: 2.6em 0;
  border: 0;
  border-radius: 2px;
  background: repeating-linear-gradient(90deg, var(--line-2) 0 10px, transparent 10px 18px);
}
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin: .35em 0; }
.prose li::marker { color: var(--accent); font-weight: 700; }
.prose table { display: block; width: 100%; overflow-x: auto; border-collapse: collapse; font-size: .9em; }
.prose th, .prose td { padding: .55em .9em; border-bottom: 1px solid var(--line); text-align: left; }
.prose th { color: var(--muted); font: 600 .78em var(--mono); letter-spacing: .04em; text-transform: uppercase; }

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 40px;
}
.gallery > :only-child { grid-column: 1 / -1; }
.gallery figure { margin: 0; }
.gallery a {
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.gallery img { display: block; width: 100%; transition: transform .5s ease; }
.gallery a:hover img { transform: scale(1.03); }
.gallery a.is-svg img { padding: 0; }

.post-edit { margin: 32px 0 0; font-size: 14px; }
.post-edit a { color: var(--accent); font-weight: 600; }

.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  max-width: 720px;
  margin: 64px auto 0;
}
.post-nav a {
  display: block;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.35;
  text-decoration: none;
  transition: transform .2s, box-shadow .2s, color .2s;
}
.post-nav a:hover { color: var(--accent); transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.post-nav small {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font: 600 11px var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.post-nav-older { grid-column: 2; text-align: right; }

/* ---------------- 404 ---------------- */

.notfound { max-width: 560px; margin: 0 auto; padding: 72px 0 24px; text-align: center; }
.notfound-trail { width: 240px; height: 60px; }
.notfound-trail path { fill: none; stroke: var(--accent); stroke-width: 4; stroke-linecap: round; stroke-dasharray: 2 11; }
.notfound-trail circle { fill: var(--surface); stroke: var(--accent); stroke-width: 4; }
.notfound .notfound-code { margin: 8px 0 0; font-size: 112px; line-height: 1; font-weight: 800; letter-spacing: -.05em; color: var(--forest-2); }
.notfound h1 { margin: 14px 0 8px; font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.notfound p { color: var(--muted); }
.btn-back {
  display: inline-block;
  margin-top: 10px;
  padding: 11px 22px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  text-decoration: none;
}
@media (prefers-color-scheme: dark) { .notfound .notfound-code { color: var(--ink); } }

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

.foot {
  margin-top: 96px;
  background: var(--forest);
  color: rgb(238 244 239 / 72%);
  font-size: 14px;
}
.foot-inner { display: flex; justify-content: space-between; gap: 16px; padding-top: 28px; padding-bottom: 32px; }
.foot a { color: inherit; font-weight: 600; text-decoration: none; }
.foot a:hover { color: #fff; }

/* ---------------- Узкие экраны ---------------- */

@media (max-width: 760px) {
  body { font-size: 16px; }
  .wrap { padding: 0 18px; }
  .hero-inner { padding: 18px 18px 96px; }
  .hero-title { margin-top: 44px; }
  .hero.is-compact .hero-inner { padding-top: 14px; padding-bottom: 14px; }
  .tiles { grid-template-columns: minmax(0, 1fr); gap: 20px; margin-top: -56px; }
  .tile.is-lead { display: flex; }
  .tile.is-lead .tile-cover { aspect-ratio: 16 / 10; min-height: 0; }
  .tile.is-lead .tile-body { padding: 22px 22px 26px; }
  .tile-body { padding: 20px 22px 24px; }
  .tile-title { font-size: 21px; }
  .empty { margin-top: -56px; }
  .post { padding-top: 36px; }
  .prose { font-size: 17px; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav-older { grid-column: auto; }
  .pager-label { display: none; }
  .foot { margin-top: 64px; }
}

/* ---------------- Поправки к общей админке ---------------- */

/* В admin.css логотип курсивный — это под засечки zv; у гротеска курсив лишний */
.brand-mark, .login-mark { font-style: normal; font-weight: 800; letter-spacing: -.01em; }
