:root {
  --bg: #fdf8f1;
  --surface: #ffffff;
  --text: #2d2a26;
  --muted: #7a7066;
  --accent: #d96a2b;
  --accent-soft: #fbe5d6;
  --line: #efe5d8;
  --shadow: 0 6px 24px rgba(80, 50, 20, .08);
  --cover-l: 88%;
  --cover-s: 70%;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1d1a17;
    --surface: #292520;
    --text: #f3ece4;
    --muted: #b2a698;
    --accent: #f0955c;
    --accent-soft: #3d2c20;
    --line: #3a332c;
    --shadow: 0 6px 24px rgba(0, 0, 0, .3);
    --cover-l: 26%;
    --cover-s: 30%;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Nunito", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

a { color: var(--accent); }
h1, h2, h3 { line-height: 1.15; }
h2 { font-size: 1.8rem; margin: 0 0 20px; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }

/* Шапка */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.logo { font-weight: 800; font-size: 1.25rem; text-decoration: none; color: var(--text); }
nav a { margin-left: 20px; text-decoration: none; color: var(--muted); font-weight: 600; }
nav a:hover { color: var(--accent); }

/* Приветствие */
.hero {
  display: grid; grid-template-columns: auto 1fr; gap: 36px; align-items: center;
  padding: 56px 0 48px;
}
.avatar {
  width: 190px; height: 190px; border-radius: 50%;
  background: var(--accent-soft);
  display: grid; place-items: center; font-size: 100px;
  overflow: hidden; border: 6px solid var(--surface); box-shadow: var(--shadow);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.hero h1 { font-size: clamp(2.2rem, 6vw, 3.4rem); margin: 0 0 8px; }
.lead { font-size: 1.2rem; color: var(--muted); margin: 0 0 18px; }
.stats { display: flex; gap: 10px; flex-wrap: wrap; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 8px 14px; font-size: .95rem;
}
.stat b { display: block; font-size: 1.05rem; }
.stat span { color: var(--muted); font-size: .85rem; }

/* Записи */
#posts { padding-bottom: 32px; }
.tags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.tags button {
  font: inherit; font-weight: 600; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  padding: 6px 14px; border-radius: 999px;
}
.tags button.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 22px; }
.card {
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: 20px; overflow: hidden;
  text-decoration: none; color: inherit; box-shadow: var(--shadow);
  transition: transform .2s ease;
}
.card:hover { transform: translateY(-4px); }
.card h3 { margin: 6px 0 8px; font-size: 1.3rem; }
.card p { margin: 0; color: var(--muted); }
.card-body { padding: 16px 20px 22px; }

.cover {
  aspect-ratio: 16 / 10;
  display: grid; place-items: center; font-size: 70px;
  background: hsl(var(--hue, 25) var(--cover-s) var(--cover-l));
  overflow: hidden;
}
.cover img { width: 100%; height: 100%; object-fit: cover; }

.meta { color: var(--muted); font-size: .9rem; }
.chip {
  display: inline-block; background: var(--accent-soft); color: var(--accent);
  border-radius: 999px; padding: 1px 10px; font-size: .8rem; font-weight: 600; margin-left: 6px;
}

/* Обо мне */
.about { padding: 40px 0; border-top: 1px solid var(--line); }
.about-grid { display: grid; grid-template-columns: 3fr 2fr; gap: 32px; }
.about-grid p { margin: 0 0 14px; font-size: 1.1rem; }
.facts {
  margin: 0; background: var(--surface); border-radius: 20px; padding: 20px 24px;
  box-shadow: var(--shadow);
}
.facts dt { color: var(--muted); font-size: .85rem; }
.facts dd { margin: 0 0 12px; font-weight: 600; }
.facts dd:last-child { margin-bottom: 0; }

/* Отдельная запись */
.post { max-width: 720px; margin: 0 auto; padding: 36px 0 56px; }
.post .cover { border-radius: 24px; aspect-ratio: 16 / 9; font-size: 110px; box-shadow: var(--shadow); }
.post h1 { font-size: clamp(2rem, 5vw, 2.8rem); margin: 28px 0 8px; }
.post .meta { margin-bottom: 24px; }
.post .text p { font-size: 1.15rem; margin: 0 0 18px; }
.post .back { display: inline-block; margin-bottom: 18px; text-decoration: none; font-weight: 600; }
.post-nav {
  display: flex; justify-content: space-between; gap: 16px;
  margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--line);
}
.post-nav a { text-decoration: none; font-weight: 600; max-width: 48%; }
.post-nav .next { margin-left: auto; text-align: right; }

footer { text-align: center; color: var(--muted); padding: 32px 16px 48px; }

@media (max-width: 680px) {
  .hero { grid-template-columns: 1fr; text-align: center; justify-items: center; padding-top: 36px; gap: 20px; }
  .avatar { width: 150px; height: 150px; font-size: 80px; }
  .stats { justify-content: center; }
  .about-grid { grid-template-columns: 1fr; }
  nav a { margin-left: 14px; }
}
