:root {
  --ink: #1a1a1a;
  --muted: #666;
  --rule: #d8d3c8;
  --bg: #f7f3ea;
  --map-bg: #eee;
  --accent: #8a2a1f;
  --link: #1d3557;
  --max: 680px;
}

[data-theme="dark"] {
  --ink: #e8e6e0;
  --muted: #9a968b;
  --rule: #3a3833;
  --bg: #15171a;
  --map-bg: #1f2125;
  --accent: #d97a6c;
  --link: #8fb6e0;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 18px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
}

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

main, .site-header, .site-footer { max-width: var(--max); margin: 0 auto; padding: 0 20px; }

body.index main,
body.index .site-header,
body.index .site-footer { max-width: 1080px; }

.index-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 32px;
}
@media (min-width: 880px) {
  .index-grid { grid-template-columns: minmax(0, 1fr) minmax(360px, 440px); }
}
.index-posts { min-width: 0; }
.index-map-panel { min-width: 0; }
@media (min-width: 880px) {
  .index-map-panel {
    position: sticky;
    top: 20px;
    align-self: start;
  }
}
.map-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: baseline;
  margin-bottom: 12px;
  font-family: 'Helvetica Neue', Arial, sans-serif;
}
.map-controls-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: 2px;
}
.map-controls button {
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 4px 9px;
  cursor: pointer;
}
.map-controls button:hover { color: var(--ink); border-color: var(--ink); }
.map-controls button.active {
  color: var(--bg);
  background: var(--ink);
  border-color: var(--ink);
}
.map-controls-count {
  margin-left: auto;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.index-map {
  height: 600px;
  width: 100%;
  border: 1px solid var(--rule);
  border-radius: 2px;
  background: var(--map-bg);
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 13px;
}
.index-map .leaflet-popup-content { font-family: Georgia, serif; font-size: 14px; line-height: 1.4; }
[data-theme="dark"] .index-map .leaflet-tile-pane {
  filter: invert(1) hue-rotate(180deg) brightness(0.9) contrast(0.85) saturate(0.8);
}
[data-theme="dark"] .index-map .leaflet-popup-content-wrapper,
[data-theme="dark"] .index-map .leaflet-popup-tip {
  background: #2a2c30;
  color: var(--ink);
}
[data-theme="dark"] .index-map .leaflet-control-attribution {
  background: rgba(30, 32, 36, 0.85);
  color: var(--muted);
}
[data-theme="dark"] .index-map .leaflet-control-attribution a { color: var(--link); }
[data-theme="dark"] .index-map .leaflet-bar a {
  background: #2a2c30;
  color: var(--ink);
  border-bottom-color: #3a3833;
}

.site-header {
  padding-top: 32px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--ink);
  margin-bottom: 32px;
}
.site-header-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}
.site-title {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-weight: 900;
  font-size: 28px;
  text-decoration: none;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.theme-toggle {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 4px 10px;
  cursor: pointer;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--ink); }
.tagline {
  font-size: 14px;
  color: var(--muted);
  margin-top: 4px;
  font-style: italic;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 8px;
  margin-bottom: 24px;
  font-family: 'Helvetica Neue', Arial, sans-serif;
}

.post-list { list-style: none; padding: 0; margin: 0; }
.post-list-item {
  padding: 16px 0;
  border-bottom: 1px solid var(--rule);
}
.post-list-item:last-child { border-bottom: none; }
.post-list-headline {
  font-size: 20px;
  font-weight: 700;
  text-decoration: none;
  color: var(--ink);
  display: block;
  margin-bottom: 4px;
}
.post-list-headline:hover { color: var(--accent); }
.post-list-meta { font-size: 13px; color: var(--muted); }

.post h1 {
  font-size: 30px;
  line-height: 1.2;
  margin: 0 0 8px 0;
  font-weight: 700;
}
.byline {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 24px 0;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 12px;
}
.post-body p { margin: 0 0 16px 0; }
.post-body hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 24px 0;
}
.post-body ul { padding-left: 20px; }
.post-body li { margin-bottom: 4px; }
.post-body strong { font-weight: 700; }

.post-source {
  margin-top: 32px;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
  font-size: 14px;
}

.back { margin-top: 40px; font-size: 14px; }

.site-footer {
  margin-top: 60px;
  padding-top: 20px;
  padding-bottom: 32px;
  border-top: 1px solid var(--rule);
  font-size: 13px;
  color: var(--muted);
}
.site-footer p { margin: 0 0 8px 0; }
.muted { color: var(--muted); }

.post-map {
  height: 360px;
  margin: 24px 0 28px 0;
  border: 1px solid var(--rule);
  border-radius: 2px;
  background: var(--map-bg);
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 13px;
}
.post-map .leaflet-popup-content { font-family: Georgia, serif; font-size: 14px; line-height: 1.4; }
[data-theme="dark"] .post-map .leaflet-tile-pane {
  filter: invert(1) hue-rotate(180deg) brightness(0.9) contrast(0.85) saturate(0.8);
}
[data-theme="dark"] .post-map .leaflet-popup-content-wrapper,
[data-theme="dark"] .post-map .leaflet-popup-tip {
  background: #2a2c30;
  color: var(--ink);
}
[data-theme="dark"] .post-map .leaflet-control-attribution {
  background: rgba(30, 32, 36, 0.85);
  color: var(--muted);
}
[data-theme="dark"] .post-map .leaflet-control-attribution a { color: var(--link); }
[data-theme="dark"] .post-map .leaflet-bar a {
  background: #2a2c30;
  color: var(--ink);
  border-bottom-color: #3a3833;
}
