/* markbabad.com — base styles */

:root {
  --ink: #1a1a1a;
  --paper: #f6f3ec;
  --rule: #d8d2c4;
  --quiet: #6e6a5f;
  --link: #5a3a1a;
  --link-hover: #8a4a1a;
  --accent: #7d3a2c;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  padding: 0 24px;
}

/* Site header / nav */
header.site {
  max-width: 1080px;
  margin: 32px auto 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--rule);
}
header.site .title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
header.site .title a {
  color: var(--ink);
  text-decoration: none;
}
header.site .sub {
  color: var(--quiet);
  font-style: italic;
  font-size: 15px;
  margin-top: 2px;
}
header.site nav {
  margin-top: 12px;
  font-size: 15px;
}
header.site nav a {
  color: var(--link);
  text-decoration: none;
  margin-right: 14px;
  border-bottom: 1px solid transparent;
  padding-bottom: 1px;
}
header.site nav a:hover { border-bottom-color: var(--link); }
header.site nav a.active {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

/* Single-column reading layout */
main {
  max-width: 720px;
  margin: 0 auto 80px;
}
main.wide { max-width: 1080px; }

h1 {
  font-size: 34px;
  line-height: 1.15;
  margin: 28px 0 12px;
  font-weight: 600;
  letter-spacing: -0.005em;
}
h2 {
  font-size: 24px;
  line-height: 1.25;
  margin: 36px 0 10px;
  font-weight: 600;
}
h3 {
  font-size: 19px;
  line-height: 1.35;
  margin: 28px 0 6px;
  font-weight: 600;
}
.dek {
  color: var(--quiet);
  font-style: italic;
  font-size: 18px;
  margin-bottom: 24px;
}

p { margin: 0 0 16px; }

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

ul, ol { padding-left: 22px; }
li { margin-bottom: 8px; }

blockquote {
  margin: 18px 0 18px 0;
  padding-left: 16px;
  border-left: 2px solid var(--rule);
  color: var(--ink);
  font-style: italic;
}

hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 36px 0;
}

.byline {
  font-size: 14px;
  color: var(--quiet);
  margin-top: 8px;
}

/* Bilingual side-by-side */
.bilingual {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin: 18px 0;
  font-size: 15.5px;
  line-height: 1.55;
}
.bilingual .ru, .bilingual .en {
  padding: 12px 14px;
  background: rgba(216, 210, 196, 0.18);
  border-left: 2px solid var(--rule);
}
.bilingual .ru { font-style: normal; }
.bilingual .en { color: var(--ink); }
@media (max-width: 600px) {
  .bilingual { grid-template-columns: 1fr; gap: 12px; }
}

/* Footer */
footer.site {
  max-width: 720px;
  margin: 60px auto 60px;
  padding-top: 18px;
  border-top: 1px solid var(--rule);
  font-size: 14px;
  color: var(--quiet);
}
footer.site a { color: var(--quiet); }

/* Tables */
table {
  border-collapse: collapse;
  font-size: 15px;
  margin: 16px 0;
  width: 100%;
}
table th, table td {
  text-align: left;
  vertical-align: top;
  padding: 8px 12px;
  border-bottom: 1px solid var(--rule);
}
table th { font-weight: 600; color: var(--quiet); font-size: 13.5px; text-transform: uppercase; letter-spacing: 0.04em; }

/* Notes — small italic asides */
.note {
  font-size: 14.5px;
  color: var(--quiet);
  font-style: italic;
  margin: 18px 0;
  padding: 12px 14px;
  background: rgba(216, 210, 196, 0.18);
  border-left: 2px solid var(--rule);
}

/* People grid (flashcards) */
.people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  margin-top: 16px;
}
.card {
  background: rgba(216, 210, 196, 0.18);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 14px 16px;
  cursor: pointer;
  transition: background 120ms;
  font-size: 15.5px;
  line-height: 1.5;
}
.card:hover { background: rgba(216, 210, 196, 0.32); }
.card .name {
  font-weight: 600;
  font-size: 17px;
  display: block;
  margin-bottom: 4px;
}
.card .dates {
  color: var(--quiet);
  font-size: 13.5px;
  display: block;
  margin-bottom: 8px;
}
.card .role { font-size: 14.5px; color: var(--ink); }
.card .more { display: none; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--rule); font-size: 14.5px; }
.card.open .more { display: block; }
.card .relations { font-size: 13.5px; color: var(--quiet); margin-top: 8px; }

/* Filter bar */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 6px;
  font-size: 14px;
}
.filter-bar button {
  font-family: var(--serif);
  font-size: 14px;
  background: rgba(216, 210, 196, 0.32);
  border: 1px solid var(--rule);
  color: var(--ink);
  padding: 4px 12px;
  border-radius: 14px;
  cursor: pointer;
}
.filter-bar button.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* Timeline (chronology page) */
.tl {
  list-style: none;
  padding: 0;
  margin: 0;
  border-left: 2px solid var(--rule);
  margin-left: 80px;
}
.tl li {
  position: relative;
  padding: 8px 0 18px 22px;
  margin: 0;
}
.tl li::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 14px;
  width: 12px;
  height: 12px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 50%;
}
.tl li .date {
  position: absolute;
  left: -150px;
  top: 8px;
  width: 110px;
  text-align: right;
  font-size: 14px;
  color: var(--quiet);
  font-variant-numeric: tabular-nums;
}
.tl li .what { font-size: 16.5px; line-height: 1.5; }
.tl li .what strong { font-weight: 600; }
.tl li .what em { color: var(--quiet); font-size: 14.5px; display: block; margin-top: 2px; }
@media (max-width: 700px) {
  .tl { margin-left: 8px; }
  .tl li .date { position: static; width: auto; text-align: left; display: block; margin-bottom: 2px; }
}

/* Map page */
#map {
  width: 100%;
  height: 600px;
  border: 1px solid var(--rule);
  border-radius: 4px;
}

/* Documents grid */
.doc-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 16px;
}
.doc {
  display: grid;
  grid-template-columns: 100px 1fr auto;
  gap: 14px;
  align-items: baseline;
  padding: 14px 16px;
  background: rgba(216, 210, 196, 0.14);
  border: 1px solid var(--rule);
  border-radius: 4px;
  font-size: 15px;
  line-height: 1.5;
}
.doc .kind { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--quiet); }
.doc .name { font-weight: 600; }
.doc .desc { color: var(--ink); margin-top: 2px; font-size: 14.5px; }
.doc .open { font-size: 13.5px; }
@media (max-width: 600px) {
  .doc { grid-template-columns: 1fr; }
}

/* Privacy banner */
.private-banner {
  max-width: 1080px;
  margin: 0 auto 0;
  padding: 8px 14px;
  background: #2c2520;
  color: #f1ebd9;
  font-size: 13px;
  text-align: center;
  border-radius: 0 0 4px 4px;
  letter-spacing: 0.02em;
}

/* Photographs / figures */
figure {
  margin: 28px 0;
  padding: 0;
}
figure img {
  display: block;
  max-width: 100%;
  height: auto;
}
figure figcaption {
  font-size: 14px;
  font-style: italic;
  color: var(--quiet);
  margin-top: 8px;
  line-height: 1.45;
}

/* Hero portrait — top of page */
.hero {
  margin: 24px 0 0;
  text-align: center;
}
.hero img {
  display: inline-block;
  max-width: 320px;
  width: 100%;
  height: auto;
  background: #f0ebe0;
  padding: 8px;
  border: 1px solid var(--rule);
}
.hero figcaption {
  text-align: center;
  margin-top: 12px;
}

/* Wide / full-bleed photo blocks */
.full-photo {
  max-width: 1080px;
  margin: 36px auto;
}
.full-photo img {
  width: 100%;
  height: auto;
  background: #f0ebe0;
  padding: 4px;
  border: 1px solid var(--rule);
}
.full-photo figcaption {
  max-width: 720px;
  margin: 12px auto 0;
  text-align: left;
}

/* Two-column inline figure (small portrait next to text) */
.inline-portrait {
  float: right;
  width: 220px;
  margin: 8px 0 18px 24px;
  max-width: 40%;
}
.inline-portrait img {
  width: 100%;
  height: auto;
  background: #f0ebe0;
  padding: 6px;
  border: 1px solid var(--rule);
}
.inline-portrait figcaption {
  font-size: 13px;
  line-height: 1.4;
  margin-top: 6px;
}
@media (max-width: 600px) {
  .inline-portrait { float: none; width: 100%; max-width: 320px; margin: 18px auto; }
}

/* Letter-scan grid for the family page */
.letter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
  margin: 24px 0;
}
.letter-grid figure {
  margin: 0;
}
.letter-grid img {
  width: 100%;
  height: auto;
  background: #f0ebe0;
  padding: 4px;
  border: 1px solid var(--rule);
}
.letter-grid figcaption {
  font-size: 13px;
  margin-top: 6px;
  line-height: 1.4;
}
