/* Заметки на полях
   Один файл стилей на весь блог. Светлая и тёмная тема — по настройке системы. */

:root {
  --bg: #faf7f1;
  --text: #2b2824;
  --muted: #776f65;
  --rule: #e2dacb;
  --link: #a04726;
  --link-hover: #7a3317;
  --mark: #c8694a;
  --serif: "PT Serif", Charter, Georgia, Cambria, "Noto Serif", "DejaVu Serif", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif;
  --measure: 680px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1b19;
    --text: #e5e0d6;
    --muted: #a0988d;
    --rule: #393530;
    --link: #e3a37d;
    --link-hover: #f1c4a6;
    --mark: #b8634b;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: 1.1875rem;
  line-height: 1.62;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
}

::selection {
  background: #ead6b4;
  color: #2b2824;
}

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--link-hover);
}

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

img {
  max-width: 100%;
  height: auto;
}

.wrap {
  max-width: calc(var(--measure) + 2.5rem);
  margin: 0 auto;
  padding: 0 1.25rem;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0.5rem;
  z-index: 10;
  padding: 0.45rem 0.9rem;
  background: var(--bg);
  border: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.875rem;
}

.skip:focus {
  left: 0.5rem;
}

/* ---------- шапка ---------- */

.site-header {
  border-bottom: 1px solid var(--rule);
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem 1.5rem;
  padding-top: 1.35rem;
  padding-bottom: 1.15rem;
}

.site-title {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  font-size: 1.4rem;
  font-style: italic;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
}

.site-title:hover {
  color: var(--text);
}

.site-title img {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 6px;
}

.site-nav {
  display: flex;
  gap: 1.3rem;
  font-family: var(--sans);
  font-size: 0.875rem;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--text);
}

.site-nav a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-color: var(--mark);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.4em;
}

/* ---------- общие мелочи ---------- */

h1,
h2,
h3 {
  font-weight: 700;
  line-height: 1.22;
  text-wrap: balance;
}

h1 {
  font-size: 2.05rem;
  letter-spacing: -0.005em;
  margin: 0.45rem 0 0;
}

h2 {
  font-size: 1.4rem;
  margin: 2.4rem 0 0.8rem;
}

p {
  margin: 0 0 1.15em;
}

.meta {
  margin: 0;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.8125rem;
  letter-spacing: 0.01em;
}

.meta .sep {
  margin: 0 0.3em;
  opacity: 0.6;
}

.lead {
  font-size: 1.1em;
  line-height: 1.55;
}

/* ---------- главная ---------- */

.intro {
  margin: 2.6rem 0 2.4rem;
  padding-left: 1.15rem;
  border-left: 2px solid var(--mark);
}

.intro h1 {
  font-size: 1.75rem;
  margin: 0 0 0.7rem;
}

.intro p {
  margin: 0 0 0.6em;
}

.intro p:last-child {
  margin-bottom: 0;
}

.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.post-item {
  display: grid;
  grid-template-columns: 184px 1fr;
  gap: 0 1.5rem;
  align-items: start;
  padding: 1.75rem 0;
  border-top: 1px solid var(--rule);
}

.post-item > div {
  min-width: 0;
}

.thumb {
  display: block;
  margin-top: 0.3rem;
}

.thumb img,
figure img {
  display: block;
  width: 100%;
  background: #f0e7d6;
}

.thumb img {
  border-radius: 4px;
}

.post-item h2 {
  font-size: 1.32rem;
  line-height: 1.25;
  margin: 0.2rem 0 0.4rem;
}

.post-item h2 a {
  color: var(--text);
  text-decoration: none;
}

.post-item h2 a:hover {
  color: var(--link);
}

.teaser {
  margin: 0;
  font-size: 0.95em;
  line-height: 1.55;
}

.more {
  margin: 2rem 0 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.875rem;
  color: var(--muted);
}

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

.post-header {
  margin: 2.8rem 0 1.5rem;
}

.post ul,
.post ol,
.page ul,
.page ol {
  margin: 0 0 1.25em;
  padding-left: 1.35em;
}

.post li,
.page li {
  margin-bottom: 0.4em;
}

.post li::marker,
.page li::marker {
  color: var(--muted);
}

figure {
  margin: 2rem 0;
}

figure img {
  border-radius: 6px;
}

figcaption {
  margin-top: 0.6rem;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.8125rem;
  line-height: 1.45;
}

blockquote {
  margin: 1.5em 0;
  padding: 0.1em 0 0.1em 1.15rem;
  border-left: 2px solid var(--mark);
  font-style: italic;
}

blockquote p:last-child {
  margin-bottom: 0;
}

.update {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--rule);
  color: var(--muted);
  font-size: 0.92em;
}

/* Заметка на полях: на широком экране уезжает на правое поле,
   на узком остаётся под абзацем. */
.sidenote {
  display: block;
  margin: 0.8em 0 0;
  padding-left: 0.9em;
  border-left: 2px solid var(--mark);
  color: var(--muted);
  font-size: 0.84em;
  font-style: italic;
  line-height: 1.5;
}

@media (min-width: 1260px) {
  .sidenote {
    float: right;
    clear: right;
    width: 220px;
    margin: 0.3em -262px 1em 0;
  }
}

.table-wrap {
  margin: 1.8rem 0 2rem;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
}

caption {
  caption-side: top;
  padding-bottom: 0.6rem;
  color: var(--muted);
  font-size: 0.8125rem;
  text-align: left;
}

th,
td {
  padding: 0.55rem 1rem 0.55rem 0;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
}

th:last-child,
td:last-child {
  padding-right: 0;
}

thead th {
  border-bottom-color: var(--muted);
  font-weight: 600;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.num {
  text-align: right;
  white-space: nowrap;
}

thead .num {
  white-space: normal;
}

.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-size: 0.95em;
  line-height: 1.35;
}

.post-nav a {
  display: block;
  color: var(--text);
  text-decoration: none;
}

.post-nav a:hover {
  color: var(--link);
}

.post-nav .label {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.post-nav .next {
  grid-column: 2;
  text-align: right;
}

/* ---------- архив, «обо мне», 404 ---------- */

.page-header {
  margin: 2.8rem 0 1.5rem;
}

ul.archive-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
}

.archive-list li {
  display: grid;
  grid-template-columns: 7.2rem 1fr;
  gap: 0 1rem;
  align-items: baseline;
  margin: 0;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--rule);
  line-height: 1.35;
}

.archive-list time,
.archive-list .rubric {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.8125rem;
  white-space: nowrap;
}

.archive-list .rubric {
  margin-left: 0.5em;
}

.archive-list a {
  text-decoration: none;
}

.archive-list a:hover {
  text-decoration: underline;
}

.gear {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 0.5rem 1rem;
  margin: 1.2rem 0 1.6rem;
  font-size: 0.95em;
  line-height: 1.45;
}

.gear dt {
  padding-top: 0.2em;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.8125rem;
}

.gear dd {
  margin: 0;
}

.mail {
  white-space: nowrap;
  font-style: italic;
}

.notfound {
  margin: 3rem 0 1rem;
  text-align: center;
}

.notfound img {
  display: block;
  width: 100%;
  max-width: 420px;
  margin: 0 auto 1.6rem;
  border-radius: 6px;
}

.notfound h1 {
  font-size: 1.75rem;
  margin-bottom: 0.8rem;
}

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

.site-footer {
  margin-top: 4rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.8125rem;
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-top: 1.4rem;
  padding-bottom: 2.4rem;
}

.site-footer p {
  margin: 0;
}

.site-footer nav {
  display: flex;
  gap: 1.2rem;
}

.site-footer a {
  color: var(--muted);
}

.site-footer a:hover {
  color: var(--text);
}

/* ---------- тёмная тема: рисунки чуть приглушаем ---------- */

@media (prefers-color-scheme: dark) {
  .thumb img,
  figure img,
  .notfound img {
    filter: brightness(0.86) saturate(0.94);
  }

  .site-title img {
    filter: brightness(0.9);
  }

  ::selection {
    background: #5a4632;
    color: #f3ede2;
  }
}

/* ---------- телефон ---------- */

@media (max-width: 640px) {
  body {
    font-size: 1.0625rem;
    line-height: 1.6;
  }

  h1 {
    font-size: 1.65rem;
  }

  h2 {
    font-size: 1.25rem;
  }

  .intro h1 {
    font-size: 1.45rem;
  }

  .post p,
  .page p {
    hyphens: auto;
  }

  .post-item {
    grid-template-columns: 1fr;
    padding: 1.5rem 0;
  }

  .thumb {
    margin: 0 0 0.9rem;
  }

  .post-nav {
    grid-template-columns: 1fr;
    gap: 1.1rem;
  }

  .post-nav .next {
    grid-column: 1;
    text-align: left;
  }

  .archive-list li {
    grid-template-columns: 1fr;
    gap: 0.1rem;
  }

  .gear {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .gear dd {
    margin-bottom: 0.7rem;
  }

  th,
  td {
    padding-right: 0.7rem;
  }
}

/* ---------- печать ---------- */

@media print {
  body {
    background: #fff;
    color: #000;
    font-size: 11pt;
  }

  .site-nav,
  .site-footer nav,
  .post-nav,
  .skip {
    display: none;
  }

  a {
    color: inherit;
    text-decoration: none;
  }

  figure,
  table {
    break-inside: avoid;
  }
}
