/* Проект X5 — журнал домашней метеостанции */

:root {
  --paper: #eef2f3;
  --ink: #1d2b36;
  --muted: #566a77;
  --line: #c9d3d8;
  --isobar: #2f6e8f;
  --mercury: #b8323f;
  --serif: Charter, "Bitstream Charter", "Iowan Old Style", "Sitka Text", Cambria, Georgia, serif;
  --measure: 36rem;
  --page: 62rem;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #13202a;
    --ink: #dce5ea;
    --muted: #93a6b2;
    --line: #2c3d49;
    --isobar: #8cc0da;
    --mercury: #e2676f;
  }
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.62;
  font-kerning: normal;
  hanging-punctuation: first;
}

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

a:hover {
  text-decoration-thickness: 2px;
}

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

/* Page frame: one wide track for charts, a narrower one for reading */

.site-header,
main,
.site-footer {
  width: 100%;
  max-width: var(--page);
  margin: 0 auto;
  padding-left: clamp(1rem, 4vw, 2.5rem);
  padding-right: clamp(1rem, 4vw, 2.5rem);
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  padding-top: 1.75rem;
  padding-bottom: 1.75rem;
}

.site-name {
  color: var(--ink);
  font-weight: 700;
  font-size: 1.15rem;
  text-decoration: none;
}

.site-name:hover {
  text-decoration: underline;
}

.site-header ul {
  display: flex;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.measure {
  max-width: var(--measure);
}

/* Type */

h1,
h2 {
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2rem, 1.4rem + 2.6vw, 2.85rem);
  margin: 2.25rem 0 1rem;
}

h2 {
  font-size: 1.35rem;
  margin: 2.75rem 0 0.75rem;
}

p,
ul,
table {
  margin: 0 0 1.1rem;
}

ul {
  padding-left: 1.25rem;
}

main li + li {
  margin-top: 0.35rem;
}

.lead {
  font-size: 1.17rem;
  line-height: 1.55;
}

.meta {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-top: -0.4rem;
}

/* Charts are printed on their own paper, like a recorder strip */

figure {
  margin: 0;
}

.trace img,
.chart img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.chart {
  margin: 1.5rem 0 1.75rem;
}

figcaption {
  max-width: var(--measure);
  margin-top: 0.65rem;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.5;
}

/* The log: dates on the left, entries on the right */

.log {
  margin: 0;
  padding: 0;
  list-style: none;
  border-bottom: 1px solid var(--line);
}

.log li {
  display: grid;
  grid-template-columns: 9.5rem 1fr;
  gap: 0.25rem 1.5rem;
  margin: 0;
  padding: 1.1rem 0;
  border-top: 1px solid var(--line);
}

.log time {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  padding-top: 0.1rem;
}

.log a {
  font-size: 1.12rem;
  font-weight: 700;
  line-height: 1.3;
}

.log p {
  margin: 0.3rem 0 0;
}

/* The one live element: a mercury dot beside the current status */

.now::before {
  content: "";
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  margin-right: 0.55rem;
  border-radius: 50%;
  background: var(--mercury);
  vertical-align: 0.15em;
}

/* Tables */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

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

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

.num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

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

.table-wrap table {
  margin: 0;
  min-width: 30rem;
}

/* Article navigation and footer */

.article-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.site-footer {
  margin-top: 4rem;
  padding-top: 1.5rem;
  padding-bottom: 2.5rem;
  color: var(--muted);
  font-size: 0.875rem;
}

.site-footer p {
  max-width: var(--measure);
  margin: 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

@media (max-width: 40rem) {
  html {
    font-size: 106.25%;
  }

  .log li {
    grid-template-columns: 1fr;
  }

  .site-header {
    padding-top: 1.25rem;
    padding-bottom: 1.25rem;
  }
}
