:root {
  --bg: #f6f3ee;
  --fg: #1f1d1a;
  --muted: #7a746b;
  --line: #e2dcd2;
  --accent: #1f1d1a;
  --error: #a33a2a;
  --field: #fffdf9;
  --font: ui-serif, Georgia, "Times New Roman", serif;
  --ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1a18;
    --fg: #e6e1d8;
    --muted: #8f897f;
    --line: #2e2c28;
    --accent: #e6e1d8;
    --error: #e07a6a;
    --field: #22201d;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 19px;
  line-height: 1.55;
}
main {
  max-width: 620px;
  margin: 0 auto;
  padding: 28px 16px 80px;
}
a { color: inherit; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

/* шапка */
header.site { margin-bottom: 40px; }
header.site h1 {
  font-size: 22px;
  font-weight: normal;
  letter-spacing: 0.02em;
  margin: 0;
}
header.site h1 a { text-decoration: none; }
header.site .tagline { margin: 4px 0 0; color: var(--muted); font-size: 16px; }
header.site nav { margin-top: 10px; font-family: var(--ui); font-size: 14px; color: var(--muted); }
header.site nav a { color: var(--muted); }

/* записи */
article {
  padding: 0 0 36px;
  margin: 0 0 36px;
  border-bottom: 1px solid var(--line);
}
article:last-of-type { border-bottom: 0; }
article header {
  display: flex;
  align-items: baseline;
  gap: 14px;
  font-family: var(--ui);
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 10px;
}
article header a { color: var(--muted); }
article header a.date { text-decoration: none; }
article header a.date:hover { text-decoration: underline; }
article h2 { font-size: 24px; font-weight: normal; margin: 0 0 12px; line-height: 1.3; }
article p { margin: 0 0 1em; overflow-wrap: anywhere; }
article p:last-child { margin-bottom: 0; }

.empty, .back, .muted { color: var(--muted); font-family: var(--ui); font-size: 15px; }
.error { color: var(--error); font-family: var(--ui); font-size: 15px; }
nav.pages { display: flex; justify-content: space-between; font-family: var(--ui); font-size: 15px; margin-top: 10px; }
nav.pages a { color: var(--muted); }

/* форма записи */
body.write h1 { font-size: 22px; font-weight: normal; }
form.narrow { display: flex; flex-direction: column; gap: 10px; max-width: 320px; }
input[type="password"], textarea {
  width: 100%;
  font: inherit;
  font-size: 18px;      /* от 16px — чтобы айфон не зумил поле */
  color: var(--fg);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px 14px;
  outline: none;
}
input[type="password"]:focus, textarea:focus { border-color: var(--muted); }
textarea {
  display: block;
  min-height: 55vh;
  resize: vertical;
  line-height: 1.55;
}
textarea::placeholder { color: var(--muted); opacity: 0.8; }
.bar { display: flex; align-items: center; gap: 16px; margin-top: 12px; }
button {
  font-family: var(--ui);
  font-size: 16px;
  padding: 12px 20px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: var(--bg);
  cursor: pointer;
}
button:active { opacity: 0.85; }
form.danger { margin-top: 36px; }
button.link {
  background: none;
  color: var(--muted);
  padding: 0;
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
button.link:hover { color: var(--error); }
