/* Färgerna är hämtade ur byns bilder: Hjälmarens blå, den gula färjan, vass och solnedgång. */
:root {
  --bg: #f5f2ea;
  --card: #ffffff;
  --ink: #17283a;
  --muted: #5f6b74;
  --line: #e2ddd0;
  --brand: #1d4466;
  --brand-ink: #ffffff;
  --brand-soft: #e4edf4;
  --accent: #f2b630;
  --accent-ink: #2a1d00;
  --reed: #3f7a3a;
  --danger: #b3412f;
  --fel: #fdecd8;
  --onskemal: #e2f0fb;
  --klagomal: #f6e2ef;
  --radius: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1820;
    --card: #182531;
    --ink: #e8edf1;
    --muted: #9aa8b4;
    --line: #283746;
    --brand: #7fb2dc;
    --brand-ink: #0b1620;
    --brand-soft: #1d3346;
    --reed: #8fc98a;
    --fel: #3a2d1d;
    --onskemal: #1d2f3c;
    --klagomal: #36222f;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--brand); }
img { max-width: 100%; }
h1 { font-size: 1.7rem; line-height: 1.2; margin: .2em 0 .4em; }
h2 { font-size: 1.3rem; margin: 1.8em 0 .7em; }
h3 { font-size: 1.1rem; margin: .2em 0; }

.top { background: #1d4466; color: #fff; border-bottom: 4px solid var(--accent); }
/* Sidhuvudet följer samma bredd som innehållet, så att logga och meny linjerar med sidan under. */
.top-inner {
  max-width: 760px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap;
}
body.admin .top-inner { max-width: none; }
.top a { color: #fff; text-decoration: none; }
.brand { font-size: 1.15rem; display: flex; align-items: center; gap: 8px; }
.brand .logo { border-radius: 50%; }
.brand small { font-size: .7rem; background: rgba(255,255,255,.2); padding: 2px 6px; border-radius: 6px; vertical-align: middle; }
.top nav { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .95rem; }
.top nav a { opacity: .9; }
.nav-btn { background: none; border: 0; color: #fff; font: inherit; padding: 0; cursor: pointer; opacity: .9; }
.center { text-align: center; }

main { max-width: 760px; margin: 0 auto; padding: 16px 16px 40px; }
.foot { max-width: 760px; margin: 0 auto; padding: 14px 16px 40px; color: var(--muted); font-size: .85rem; text-align: center; }

/* Startsidans huvuddel: bilden överst med rubriken på, texten och knapparna under – ett sammanhållet kort. */
.hero { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-top: 8px; box-shadow: 0 6px 24px rgba(20,40,60,.08); }
.hero-media { position: relative; }
.hero-media img { display: block; width: 100%; height: 300px; object-fit: cover; object-position: center 62%; }
.hero-media::after { content: ''; position: absolute; inset: 0; background: linear-gradient(transparent 40%, rgba(10,25,40,.72)); }
.hero-title { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; padding: 0 24px 20px; color: #fff; }
.hero-title h1 { font-size: 2.1rem; margin: 0; text-shadow: 0 2px 10px rgba(0,0,0,.35); }
.hero-title .eyebrow { color: #ffd77a; }
.hero-body { padding: 20px 24px 22px; }
.hero-body .lead { margin: 0 0 18px; }
.hero-body > p:last-child { margin: 14px 0 0; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .8rem !important; font-weight: 700; color: var(--reed); margin: 0 0 4px !important; }
@media (max-width: 640px) {
  .hero-media img { height: 220px; }
  .hero-title { padding: 0 16px 14px; }
  .hero-title h1 { font-size: 1.55rem; }
  .hero-body { padding: 16px; }
}
.btn.cta { background: var(--accent); color: var(--accent-ink); box-shadow: 0 3px 0 #c9901a; }

.quick-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.quick-item {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 4px 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; text-decoration: none; color: var(--ink); font-size: .85rem; text-align: center;
  transition: transform .12s, box-shadow .12s;
}
.quick-item:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.08); }
@media (max-width: 560px) { .quick-grid { grid-template-columns: repeat(3, 1fr); } }

.card-head { display: flex; gap: 14px; align-items: center; margin-bottom: 8px; }
.card-head h1 { margin: .1em 0; }
.card-head p { margin: 0; }
.cat-icon { flex: none; }

.photo-head {
  height: 170px; border-radius: var(--radius); background-size: cover; background-position: center;
  display: flex; align-items: flex-end; padding: 18px; margin-bottom: 16px; position: relative; overflow: hidden;
}
.photo-head::before { content: ''; position: absolute; inset: 0; background: linear-gradient(transparent 30%, rgba(10,25,40,.7)); }
.photo-head h1 { position: relative; color: #fff; margin: 0; text-shadow: 0 2px 8px rgba(0,0,0,.4); }
.lead { font-size: 1.1rem; }

.banner {
  display: block; margin: 36px 0 14px; border-radius: var(--radius); background-size: cover; background-position: center 60%;
  position: relative; overflow: hidden; color: #fff; text-decoration: none; min-height: 120px;
}
.banner span { position: relative; display: block; padding: 50px 20px 18px; background: linear-gradient(transparent, rgba(10,25,40,.8)); font-size: 1.05rem; }

.empty { text-align: center; color: var(--muted); }
.empty img { max-width: 260px; width: 70%; height: auto; opacity: .9; }
.thanks-art { max-width: 280px; width: 80%; height: auto; }

.horizon { height: 70px; max-width: 760px; margin: 20px auto 0; background: url('/assets/img/horisont.svg') center bottom / contain no-repeat; }
@media (prefers-color-scheme: dark) { .horizon { opacity: .55; } }
.map-pin { border-radius: 50%; box-shadow: 0 2px 6px rgba(0,0,0,.35); }

.btn {
  display: inline-block; border: 0; cursor: pointer; text-decoration: none; text-align: center;
  background: var(--brand); color: var(--brand-ink); font: inherit; font-weight: 600;
  padding: 11px 20px; border-radius: 12px;
}
.btn:hover { filter: brightness(1.08); }
.btn.big { font-size: 1.15rem; padding: 16px 28px; border-radius: 14px; }
.btn.small { font-size: .9rem; padding: 7px 12px; border-radius: 10px; }
.btn.full { width: 100%; }
.btn.ghost { background: transparent; color: var(--brand); box-shadow: inset 0 0 0 2px var(--brand); }
.btn.danger { background: var(--danger); color: #fff; }
.link { background: none; border: 0; color: var(--brand); font: inherit; padding: 4px 0; cursor: pointer; text-decoration: underline; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 0 0 16px; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.card.narrow { max-width: 420px; margin: 20px auto; }
.card.center { text-align: center; }
.card.notice { border: 2px solid var(--accent); }
.emoji { font-size: 3rem; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

.flash { padding: 12px 16px; border-radius: 12px; margin: 0 0 16px; background: var(--brand-soft); }
.flash.error { background: #f8dcd6; color: #5c1d12; }
.flash.info { background: #fff3d6; color: #4a3a10; }
@media (prefers-color-scheme: dark) {
  .flash.error { background: #4a211a; color: #f8dcd6; }
  .flash.info { background: #3b3120; color: #fff3d6; }
}

.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 4px; }
.form label > span { font-weight: 600; }
input, textarea, select {
  font: inherit; color: inherit; background: var(--bg); width: 100%;
  border: 2px solid var(--line); border-radius: 12px; padding: 11px 13px;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--brand); }
textarea { resize: vertical; }
.letter-edit { font-family: Georgia, "Times New Roman", serif; line-height: 1.6; }
fieldset { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px 14px; display: grid; gap: 12px; margin: 0; }
legend { font-weight: 700; padding: 0 6px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.check { display: flex !important; align-items: center; gap: 8px; }
.check input { width: auto; }
.hp { position: absolute; left: -9999px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.inline { display: inline; }

.photo { display: grid; gap: 8px; }
.photo-btn { display: block !important; cursor: pointer; }
.photo-btn input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.photo-label {
  display: block; text-align: center; padding: 22px; border: 2px dashed var(--brand);
  border-radius: 14px; color: var(--brand); font-weight: 600; background: var(--brand-soft);
}
.photo-preview, .attached { border-radius: 12px; max-height: 340px; object-fit: contain; display: block; }

.badge { display: inline-block; font-size: .78rem; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: var(--brand-soft); }
.k-fel { background: var(--fel); }
.k-onskemal { background: var(--onskemal); }
.k-klagomal { background: var(--klagomal); }
.status { font-size: .8rem; color: var(--muted); margin-left: 6px; }
.s-atgardad { color: var(--brand); font-weight: 700; }

.list { display: grid; gap: 12px; }
.item { display: flex; gap: 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; color: inherit; text-decoration: none; }
.item-media { position: relative; flex: none; width: 92px; height: 92px; border-radius: 10px; background: var(--brand-soft); display: grid; place-items: center; }
.item-media img:not(.item-icon) { width: 92px; height: 92px; object-fit: cover; border-radius: 10px; }
.item-media img:not(.item-icon) + .item-icon { position: absolute; right: -6px; bottom: -6px; border: 2px solid var(--card); border-radius: 50%; }
.link-item > img { width: 92px; height: 92px; object-fit: cover; border-radius: 10px; flex: none; }
.item-body { flex: 1; min-width: 0; }
.item h3 a { color: inherit; text-decoration: none; }
.item p { margin: 2px 0; }
.item-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.voices { font-size: .9rem; color: var(--muted); }
.link-item:hover { outline: 2px solid var(--brand); }
.done { padding-left: 1.2em; }
.count { background: var(--accent); color: #2a1a00; border-radius: 99px; padding: 0 10px; font-size: 1rem; vertical-align: middle; }

.voices-box { text-align: center; background: var(--brand-soft); border-radius: 14px; padding: 18px; margin: 18px 0; }
.voices-box p { margin: 4px 0; }
.big-number { font-size: 2rem; font-weight: 800; }
.timeline { padding-left: 1.2em; color: var(--muted); }
.letter { font-family: Georgia, serif; white-space: normal; background: var(--bg); padding: 14px; border-radius: 12px; }
blockquote { margin: 0; padding: 10px 14px; background: var(--bg); border-left: 4px solid var(--brand); border-radius: 0 10px 10px 0; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-bottom: 16px; }
.reject { margin-top: 14px; }
.reject summary { cursor: pointer; color: var(--danger); }
.reject[open] { display: grid; gap: 10px; }
.prose li { margin-bottom: 8px; }

.map { height: 300px; border-radius: var(--radius); border: 1px solid var(--line); margin: 0 0 18px; z-index: 0; }
.where { display: grid; gap: 8px; }
.where-label { font-weight: 600; }
.pick-map { height: 280px; margin: 0; cursor: crosshair; border: 2px dashed var(--brand); }
.pick-map.has-point { border-style: solid; }
.where-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.map-pin.faded { filter: grayscale(.4); }
.small-map { height: 220px; }

.table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--radius); overflow: hidden; font-size: .92rem; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table select { padding: 6px 8px; width: auto; }
@media (max-width: 560px) {
  .table { display: block; overflow-x: auto; }
  .hero h1 { font-size: 1.6rem; }
}

/* Bidrag */
.small-hero { padding-top: 10px; }
.small-hero h1 { font-size: 1.8rem; }
.grants { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-bottom: 16px; }
.grant { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.grant h3 { margin: 0; }
.grant p { margin: 0; }
.grant-giver { font-size: .85rem; color: var(--muted); }
.grant-reason { background: var(--brand-soft); padding: 8px 10px; border-radius: 10px; font-size: .95rem; }
.grant dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: .85rem; margin: 4px 0; }
.grant dt { color: var(--muted); }
.grant dd { margin: 0; }
.grant .actions { margin-top: auto; padding-top: 6px; }
.lvl-eu { background: #dfe7fb; }
.lvl-stat { background: #e6f2e2; }
.lvl-kommun { background: var(--fel); }
.lvl-stiftelse { background: var(--klagomal); }
@media (prefers-color-scheme: dark) {
  .lvl-eu { background: #1f2a44; }
  .lvl-stat { background: #22351f; }
}
.pre { white-space: pre-wrap; }

/* Nyheter */
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 4px 10px; flex-wrap: wrap; margin: 1.8em 0 .7em; }
.section-head h2 { margin: 0; }
.section-head a { font-size: .9rem; text-decoration: none; font-weight: 600; }
.section-head a:hover { text-decoration: underline; }
.latest-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.latest-list > a { text-decoration: none; color: inherit; }
.latest-list > a:hover .news { box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.news { display: flex; gap: 12px; align-items: flex-start; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; height: 100%; }
.news-meta time { white-space: nowrap; }
/* Etikett och datum på var sin rad i de små korten, så att alla kort ser likadana ut. */
.news.compact .news-meta { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; margin: 0 0 4px; }
.news h3 { margin: 2px 0 4px; font-size: 1.05rem; }
.news p { margin: 0 0 6px; }
.news.compact h3 { font-size: .95rem; margin-bottom: 0; }
.news-meta { font-size: .8rem; color: var(--muted); }
.news-list { display: grid; gap: 10px; }
.news:target { outline: 3px solid var(--accent); }
.year { color: var(--muted); font-size: 1rem; border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.nk-beslut { background: #f8e3c3; }
.nk-nyhet { background: var(--brand-soft); }
.nk-trafik { background: #fde0da; }
.nk-evenemang { background: #e8def5; }
@media (prefers-color-scheme: dark) {
  .nk-beslut { background: #4a3a1e; } .nk-trafik { background: #4a2622; } .nk-evenemang { background: #3a2b52; }
}
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 6px; }
.filters a { padding: 6px 14px; border-radius: 99px; background: var(--card); text-decoration: none; color: var(--ink); font-size: .9rem; }
.filters a.active { background: var(--brand); color: var(--brand-ink); }

.suggestion { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.suggestion .news { padding: 0; }
.idea h2 { margin-top: 0; }
.proposal-link { text-decoration: none; color: inherit; display: block; }
.proposal:hover { box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.proposal .card-head { margin-bottom: 4px; }
.proposal h3 { font-size: 1rem; }
.badge.sent { background: #dcefd8; color: #1f5a28; font-weight: 700; letter-spacing: .02em; }
@media (prefers-color-scheme: dark) { .badge.sent { background: #1f3a22; color: #b9e3b2; } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex !important; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px; background: var(--bg); border: 2px solid var(--line); cursor: pointer; font-size: .9rem; }
.chip input { width: auto; margin: 0; }
.chip:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.paths { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin: 10px 0 24px; }
.path { display: block; background: var(--card); border-radius: var(--radius); padding: 18px; text-decoration: none; color: var(--ink); border: 2px solid transparent; }
.path:hover { border-color: var(--brand); }
.path .emoji { font-size: 2rem; }
.path h3 { margin: 6px 0; }
.path p { margin: 0; color: var(--muted); font-size: .92rem; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 14px 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
@media (max-width: 560px) { .facts { grid-template-columns: 1fr; } .facts dd { margin-bottom: 6px; } }
.flow { list-style: none; padding: 0; margin: 0 0 18px; display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.flow li { position: relative; }
.flow a { display: grid; gap: 4px; height: 100%; box-sizing: border-box; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); color: inherit; text-decoration: none; font-size: .88rem; }
.flow a span { color: var(--muted); }
.flow a:hover { border-color: var(--brand); }
.flow li.on a { border: 2px solid var(--brand); background: color-mix(in srgb, var(--brand) 8%, transparent); }
.flow li:not(:last-child)::after { content: "→"; position: absolute; right: -7px; top: 50%; transform: translate(50%, -50%); color: var(--muted); font-size: .8rem; }
@media (max-width: 760px) { .flow li::after { display: none; } }
.btn.ghost.liked { background: color-mix(in srgb, #d6455a 12%, transparent); box-shadow: inset 0 0 0 2px #d6455a; color: #b3263b; }
@media (prefers-color-scheme: dark) { .btn.ghost.liked { color: #ff9aa8; } }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.hero-actions .btn { flex: 1 1 200px; text-align: center; }
.assoc-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.assoc { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.assoc h3 { font-size: 1rem; margin: 0 0 4px; }
.assoc p { margin: 4px 0; }
.toc { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 6px; }
.toc a { display: block; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; }
[hidden] { display: none !important; }
.village-map { height: 560px; }
@media (max-width: 640px) { .village-map { height: 420px; } }
.place-pin span { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #fff; border: 2px solid #1d4466; box-shadow: 0 1px 4px rgba(0,0,0,.35); font-size: 16px; }
.place-pin.approx span { border-style: dashed; border-color: #d4881a; opacity: .85; }
.place-pin.inactive span { opacity: .4; }
.fact { border-top: 1px solid var(--line); padding: 8px 0; }
.fact summary { cursor: pointer; }
.fact.off summary { opacity: .55; }
.fact-form { margin-top: 8px; }
.likes-admin { border-bottom: 1px solid var(--line); margin-bottom: 12px; padding-bottom: 6px; }
.likes-admin .actions { align-items: center; }
.likes-input { width: 5em !important; padding: 6px 8px; }
.job { border-top: 1px solid var(--line); padding: 14px 0 4px; }
.job.off .job-head { opacity: .6; }
.job h3 { margin: 0 0 4px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.job-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin: 8px 0; }
.job-form label { display: grid; gap: 2px; }
.job-form select { width: auto; padding: 7px 9px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; text-align: center; }
.stats p { margin: 0; }
.meter { height: 12px; background: var(--brand-soft); border-radius: 99px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--reed); border-radius: 99px; }
.meter span.warn { background: var(--accent); }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 120px; padding: 6px 0 22px; }
.bar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; }
.bar span { width: 100%; max-width: 28px; background: var(--brand); border-radius: 4px 4px 0 0; }
.bar small { position: absolute; bottom: -18px; font-size: .7rem; color: var(--muted); }
.idea-grants { padding-left: 1.1em; display: grid; gap: 8px; }
.idea-grants .btn { margin-left: 6px; }

/* Admin: vägar */
.road-list { display: grid; gap: 8px; }
.road-row { display: grid; grid-template-columns: 2fr 70px 2fr 3fr auto; gap: 8px; align-items: center; background: var(--card); padding: 8px; border-radius: 12px; }
.road-row input, .road-row select { padding: 7px 9px; }
@media (max-width: 760px) { .road-row { grid-template-columns: 1fr 1fr; } }

/* Väntläge medan brevet skrivs */
.busy {
  position: fixed; inset: 0; background: rgba(20,30,25,.75); color: #fff; z-index: 1000;
  display: grid; place-items: center; text-align: center; padding: 16px; font-size: 1.2rem;
}
.busy .pen { font-size: 3rem; animation: write 1s ease-in-out infinite alternate; }
@keyframes write { from { transform: translateX(-12px) rotate(-8deg); } to { transform: translateX(12px) rotate(8deg); } }
