:root {
  --ink: #1d2327;
  --muted: #5f6b72;
  --line: #dde3e6;
  --paper: #fbfaf7;
  --card: #ffffff;
  --accent: #1f5f8b;
  --accent-soft: #e8f0f6;
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.6 var(--sans);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 20px; }

.top { background: var(--card); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { font: 700 22px var(--serif); color: var(--ink); }
.brand span { color: var(--accent); }
.top nav a { margin-left: 22px; color: var(--ink); font-weight: 500; }

main { padding: 28px 20px 48px; }

h1, h2, h3 { font-family: var(--serif); line-height: 1.25; }
h1 { font-size: 2.2rem; margin: 0.2em 0 0.3em; }
h2 { font-size: 1.4rem; margin-top: 1.6em; }

.lede { color: var(--muted); font-size: 1.05rem; }
.crumbs { font-size: 0.9rem; color: var(--muted); }

/* Startsida */
.hero { padding: 24px 0 8px; }
.hero h1 { font-size: 2.6rem; }
.hero p { max-width: 640px; font-size: 1.15rem; color: var(--muted); }
.hero .stats { font-size: 0.95rem; }

.search { display: flex; gap: 8px; max-width: 560px; margin: 18px 0; }
.search input { flex: 1; padding: 11px 14px; font-size: 1rem; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
.search button { padding: 0 18px; border: 0; border-radius: 8px; background: var(--accent); color: #fff; font-size: 1rem; cursor: pointer; }

.cards, .teasers { list-style: none; padding: 0; display: grid; gap: 12px; }
.cards { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.teasers { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.cards a, .teasers a { display: block; height: 100%; padding: 14px 16px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; color: var(--ink); }
.cards a:hover, .teasers a:hover { border-color: var(--accent); text-decoration: none; }
.cards strong, .teasers strong { display: block; font-family: var(--serif); font-size: 1.1rem; }
.cards span, .teasers span { color: var(--muted); font-size: 0.9rem; }

.about { max-width: 720px; color: var(--muted); }

/* Artikel */
.article header { margin-bottom: 8px; }
.kicker { margin: 0; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.8rem; }
.infobox { float: right; width: 300px; margin: 6px 0 20px 28px; padding: 14px 16px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; font-size: 0.92rem; }
.infobox h2 { margin: 0 0 8px; font-size: 1.05rem; }
.infobox .map { height: 220px; margin: -4px -6px 14px; border-radius: 6px; border: 1px solid var(--line); background: var(--accent-soft); }
.infobox dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; }
.infobox dt { color: var(--muted); }
.infobox dd { margin: 0; }
.prose { max-width: 680px; }
.prose p:first-child { font-size: 1.12rem; }
.prose table { border-collapse: collapse; width: 100%; font-size: 0.9rem; margin: 12px 0; }
.prose th, .prose td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
.prose th { background: var(--accent-soft); }
/* Avsnittet Bilder: en lista med länkade tumnaglar blir ett galleri, året under bilden. */
.prose ul:has(> li > a > img) { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.prose ul:has(> li > a > img) li { font-size: 0.85rem; color: var(--muted); text-align: center; }
.prose li > a > img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: var(--accent-soft); }
.backlinks { clear: both; max-width: 680px; margin-top: 32px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 0.92rem; }
.backlinks h2 { font-size: 1.1rem; }
.backlinks h3 { margin: 14px 0 4px; font-size: 0.95rem; }
.backlinks h3 span { color: var(--muted); font-weight: normal; }
.backlinks ul { list-style: none; padding: 0; margin: 0; columns: 3; column-gap: 24px; }
.backlinks li { break-inside: avoid; padding: 1px 0; }
.updated { clear: both; color: var(--muted); font-size: 0.85rem; margin-top: 32px; }

/* Listor */
.letters { display: flex; flex-wrap: wrap; gap: 4px; margin: 12px 0; }
.letters a { padding: 2px 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); }
.list { list-style: none; padding: 0; columns: 2; column-gap: 32px; }
.list li { break-inside: avoid; padding: 5px 0; }
.list .typ { color: var(--muted); font-size: 0.8rem; }
.list .sum { color: var(--muted); font-size: 0.88rem; }

/* I närheten, utbyggnadskartan */
.nearby, .growth { clear: both; max-width: 680px; margin-top: 32px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 0.92rem; }
.nearby h2, .growth h2 { font-size: 1.1rem; }
.nearby ul { list-style: none; padding: 0; margin: 0; columns: 2; column-gap: 24px; }
.nearby li { break-inside: avoid; padding: 1px 0; }
.nearby .typ { color: var(--muted); font-size: 0.8rem; }
.growth { max-width: none; }
.growth-map { height: 420px; border: 1px solid var(--line); border-radius: 8px; background: var(--accent-soft); }
.growth-controls { display: flex; align-items: center; gap: 12px; margin: 10px 0; }
.growth-controls input { flex: 1; max-width: 420px; }
.growth-controls output { font-weight: 600; min-width: 3em; }
.growth-controls button, .filters button { padding: 6px 14px; border: 0; border-radius: 6px; background: var(--accent); color: #fff; cursor: pointer; }
.growth-legend { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 0.85rem; }
.growth-legend i, .filters i.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.growth-legend span, .filters span { color: var(--muted); }
.growth details { margin-top: 8px; }
.links { font-size: 0.95rem; }

/* Karta, tidslinje, sök: filter */
.filters { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; margin: 12px 0; font-size: 0.92rem; }
.filters label { white-space: nowrap; }
.filters select { padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); font-size: 0.92rem; }
.bigmap { height: min(72vh, 720px); border: 1px solid var(--line); border-radius: 8px; background: var(--accent-soft); }
.leaflet-popup-content .typ { color: var(--muted); font-size: 0.8rem; }
.swatch.s1 { background: #2a78d6; } .swatch.s2 { background: #008300; } .swatch.s3 { background: #eb6834; } .swatch.s4 { background: #6250d6; }
.swatch.s5 { background: #e87ba4; } .swatch.s6 { background: #eda100; } .swatch.s7 { background: #1baf7a; } .swatch.s8 { background: #52514e; }
.timeline .list { columns: 1; }
.timeline time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 0.88rem; margin-right: 4px; }
.list.compact li { padding: 2px 0; }
h3 span { color: var(--muted); font-weight: normal; font-size: 0.9em; }


@media (max-width: 760px) {
  .infobox { float: none; width: auto; margin: 12px 0; }
  .list { columns: 1; }
  .backlinks ul { columns: 2; }
  .hero h1 { font-size: 2rem; }
  .top nav a { margin-left: 12px; }
  .top .wrap { height: auto; flex-wrap: wrap; padding: 10px 20px; }
  .top nav { display: flex; flex-wrap: wrap; gap: 4px 0; }
  .nearby ul { columns: 1; }
  .growth-map { height: 320px; }
}
