/* Фенологический дневник — Ольховка. Только системные шрифты. */

:root {
  --bg:      #d3d9d0;
  --paper:   #e9ece4;
  --ink:     #20272a;
  --muted:   #545f59;
  --rule:    #b0b9ad;
  --rule-2:  #c6cdc2;
  --accent:  #1b4854;

  --serif: Georgia, "Noto Serif", "Liberation Serif", "Times New Roman", "PT Serif", serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "DejaVu Sans Mono", "Liberation Mono", monospace;

  --measure: 36rem;
  --pad: 2.25rem;
}

* { box-sizing: border-box; }

html {
  font-size: 106.25%;          /* 17px, но масштабируется настройками читателя */
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background-color: var(--bg);
  /* графление стола: чистый CSS, без файлов и запросов */
  background-image:
    repeating-linear-gradient(to bottom, rgba(32,39,42,.05) 0 1px, transparent 1px 27px),
    repeating-linear-gradient(to right,  rgba(32,39,42,.04) 0 1px, transparent 1px 27px);
  color: var(--ink);
  font-family: var(--serif);
  line-height: 1.6;
  text-wrap: pretty;
}

/* лист бумаги поверх стола */
.sheet {
  max-width: 44rem;
  margin: 0 auto;
  padding: 2.75rem var(--pad) 3.5rem;
  background: var(--paper);
  border-left: 1px solid var(--rule);
  border-right: 1px solid var(--rule);
  min-height: 100vh;
}

/* ── шапка ─────────────────────────────── */

.site { margin-bottom: 2.75rem; }

.site-kicker {
  font-family: var(--mono);
  font-size: .706rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 .6rem;
}

.site-name {
  font-family: var(--serif);
  font-size: clamp(1.75rem, 5.5vw, 2.4rem);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -.01em;
  margin: 0;
}

.site-name a { color: inherit; text-decoration: none; border: 0; }
.site-name a:hover { color: var(--accent); }

.site-sub {
  font-family: var(--mono);
  font-size: .735rem;
  color: var(--muted);
  margin: .55rem 0 0;
}

nav.nav {
  margin-top: 1.5rem;
  padding-top: .85rem;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  gap: .35rem 1.4rem;
  font-family: var(--mono);
  font-size: .765rem;
}

nav.nav a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 1px;
  transition: color .15s ease, border-color .15s ease;
}
nav.nav a:hover { color: var(--ink); border-bottom-color: var(--accent); }
nav.nav [aria-current="page"] { color: var(--accent); border-bottom-color: var(--rule); }

/* ── текст ─────────────────────────────── */

h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.3rem, 3.6vw, 1.55rem);
  line-height: 1.25;
  margin: 2.75rem 0 1rem;
}

main > h2:first-child { margin-top: 0; }

h3 {
  font-family: var(--mono);
  font-weight: 400;
  font-size: .735rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 2.1rem 0 .7rem;
}

p { margin: 0 0 1rem; }

/* длина строки: ~70 знаков, иначе глазу тяжело возвращаться к началу */
main > p,
main > dl,
main > ul,
main > h2,
main > h3 { max-width: var(--measure); }

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  transition: border-color .15s ease, background-color .15s ease;
}
a:hover { border-bottom-color: var(--accent); background-color: rgba(27,72,84,.07); }

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

em, i { font-style: italic; }
.lat { font-family: var(--mono); font-style: italic; font-size: .92em; }
.val { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.lede {
  font-size: 1.08rem;
  color: var(--ink);
  margin-bottom: 1.5rem;
}

dl.defs { margin: 0 0 1rem; }
dl.defs dt {
  font-family: var(--mono);
  font-size: .794rem;
  color: var(--ink);
  margin-top: 1.15rem;
}
dl.defs dt:first-child { margin-top: 0; }
dl.defs dd {
  margin: .3rem 0 0;
  padding-left: .9rem;
  border-left: 1px solid var(--rule-2);
  color: var(--ink);
}

ul.plain { list-style: none; padding-left: 0; margin: 0 0 1rem; }
ul.plain li {
  margin-bottom: .55rem;
  padding-left: .9rem;
  border-left: 1px solid var(--rule-2);
}
ul.plain b { font-weight: 700; }

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

.rec {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 0 1.6rem;
  padding: 1.7rem 0;
  border-top: 1px solid var(--rule);
}

.rec:first-of-type { border-top: 0; padding-top: 0; }

.rail {
  border-right: 1px dashed var(--rule);
  padding-right: 1.6rem;
  margin-right: -1.6rem;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: .765rem;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: .3rem;
  align-self: start;
}

.rail .r-num  { letter-spacing: .06em; }
.rail .r-date { font-size: 1rem; color: var(--ink); letter-spacing: .01em; }

.rec .body { max-width: 34rem; }
.rec .body > :first-child { margin-top: 0; }
.rec .body > :last-child  { margin-bottom: 0; }

.note {
  font-family: var(--mono);
  font-size: .735rem;
  color: var(--muted);
  margin-top: .9rem;
  padding-left: .9rem;
  border-left: 1px solid var(--rule-2);
}

/* ── таблица ───────────────────────────── */

.tablewrap {
  overflow-x: auto;
  margin: 1.4rem calc(var(--pad) * -1) 1.2rem;
  padding: 0 var(--pad);
}

table.svod {
  border-collapse: separate;    /* нужно для липкой первой колонки */
  border-spacing: 0;
  width: 100%;
  min-width: 33rem;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: .765rem;
}

table.svod caption {
  text-align: left;
  font-family: var(--mono);
  font-size: .735rem;
  color: var(--muted);
  padding-bottom: .8rem;
}

table.svod th,
table.svod td {
  padding: .5rem .45rem;
  text-align: left;             /* по дню, а не по хвосту месяца */
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
}

table.svod thead th {
  font-weight: 400;
  color: var(--muted);
  border-bottom: 1px solid var(--ink);
}
table.svod thead th.y26 { color: var(--accent); }

/* название явления не уезжает при горизонтальной прокрутке */
table.svod tbody th,
table.svod thead th:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--paper);
  border-right: 1px dashed var(--rule);
}

table.svod tbody th {
  text-align: left;
  font-weight: 400;
  font-family: var(--serif);
  font-size: .853rem;
  white-space: normal;
  min-width: 9.5rem;
  padding-left: 0;
}

table.svod td.gap   { color: var(--muted); font-style: italic; }
table.svod td.early { color: var(--accent); font-weight: 700; }

table.svod tbody tr:hover td,
table.svod tbody tr:hover th { background: #dfe4da; }

/* ── график разброса дат ───────────────── */

.spread { margin: 1.5rem 0 .6rem; }

.spread-row {
  display: grid;
  grid-template-columns: 12rem 1fr;
  align-items: center;
  gap: 0 1.2rem;
  padding: .3rem 0;
}

.spread-row .s-name { font-size: .882rem; }

.spread-row .track {
  position: relative;
  height: 1rem;
  border-bottom: 1px dotted var(--rule-2);
}

.spread-row .bar {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: .3rem;
  background: var(--muted);
  opacity: .45;
}

.spread-row .tick {
  position: absolute;
  top: .05rem;
  bottom: .1rem;
  width: 2px;
  background: var(--accent);
}

.spread-axis {
  display: grid;
  grid-template-columns: 12rem 1fr;
  gap: 0 1.2rem;
  margin-top: .15rem;
  font-family: var(--mono);
  font-size: .706rem;
  color: var(--muted);
}

.spread-axis .months {
  position: relative;
  height: 1.15rem;
  border-top: 1px solid var(--rule);
}

/* засечка стоит ровно на границе месяца, подпись — справа от неё */
.spread-axis .months span {
  position: absolute;
  top: 0;
  padding: .2rem 0 0 .28rem;
  border-left: 1px solid var(--rule);
  line-height: 1;
}

.legend {
  font-family: var(--mono);
  font-size: .735rem;
  line-height: 1.5;
  color: var(--muted);
  margin: 0 0 2rem;
}

/* ── 404 ───────────────────────────────── */

.nf { padding: 3rem 0 4.5rem; }

.nf-code {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: .765rem;
  letter-spacing: .3em;
  color: var(--accent);
  margin: 0 0 1rem;
  padding-bottom: .9rem;
  border-bottom: 1px dashed var(--rule);
  max-width: 4.5rem;
}

.nf h2 { margin: 0 0 1.5rem; font-size: clamp(1.45rem, 4.5vw, 1.9rem); }
.nf p:last-child { margin: 0; font-family: var(--mono); font-size: .824rem; }

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

footer.site-foot {
  margin-top: 3.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: .706rem;
  color: var(--muted);
}
footer.site-foot p { margin: 0 0 .3rem; }
footer.site-foot p:last-child { margin-bottom: 0; }

/* ── узкие экраны ──────────────────────── */

@media (max-width: 42rem) {
  :root { --pad: 1.15rem; }

  .sheet { border-left: 0; border-right: 0; padding-top: 2rem; }

  .rec { grid-template-columns: 1fr; gap: .7rem; }
  .rail {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .2rem 1rem;
    border-right: 0;
    border-bottom: 1px dashed var(--rule);
    padding: 0 0 .55rem;
    margin: 0;
  }
  .rail .r-date { font-size: .882rem; }

  .spread-row, .spread-axis { grid-template-columns: 1fr; gap: .2rem; }
  .spread-row { padding: .5rem 0; }
  .spread-axis > span:first-child { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
