/* Samma formspråk och färger som vilkendag.se. */
:root {
  --bg: #f6f5f1;
  --card: #ffffff;
  --text: #1d1f23;
  --muted: #6b6f76;
  --line: #e4e2dc;
  --accent: #1f5fbf;
  --accent-soft: #e3ecfa;
  --yellow: #f2c100;
  --track: #ecebe6;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171b;
    --card: #1e2127;
    --text: #eceef1;
    --muted: #9aa0a8;
    --line: #2e323a;
    --accent: #6ea3ff;
    --accent-soft: #23324d;
    --track: #2b2f37;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
main { max-width: 960px; margin: 0 auto; padding: 24px 16px 48px; }

header { text-align: center; margin-bottom: 24px; }
/* Logotypen (ikon och ordmärke) i sidans övre vänstra hörn. */
.brand { display: block; width: fit-content; margin: 0 0 18px; }
.brand img { display: block; height: 44px; width: auto; }
.relation { font-size: 1rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 600; }
h1 { font-size: clamp(2rem, 7vw, 3.4rem); margin: 4px 0 2px; line-height: 1.1; letter-spacing: -.02em; }
.date { font-size: clamp(1.1rem, 3.5vw, 1.4rem); font-weight: 600; }

.search { position: relative; max-width: 520px; margin: 18px auto 0; text-align: left; }
.search input {
  width: 100%; font: inherit; font-size: 17px; color: var(--text); background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px;
}
.search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.search ul {
  position: absolute; z-index: 10; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px; list-style: none;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgb(0 0 0 / .12);
}
.search ul[hidden] { display: none; }
.search li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 10px; border-radius: 7px; cursor: pointer; }
.search li[aria-selected="true"], .search li:hover { background: var(--accent-soft); }
.search li .d { color: var(--muted); font-size: .9rem; }
.search li.none { cursor: default; color: var(--muted); font-style: italic; background: none; }

.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; }
.card h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 0 0 12px; }
.card h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 16px 0 8px; }
.wide { grid-column: 1 / -1; }

dl { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; margin: 0; }
dt { color: var(--muted); }
dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.chips a, .chips li {
  font: inherit; font-size: .92rem; color: var(--text); background: var(--accent-soft);
  border: 0; border-radius: 999px; padding: 3px 12px;
}
.chips a { text-decoration: none; }
.chips .n { color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
.chips a:hover, .chips a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.empty { color: var(--muted); font-style: italic; margin: 0; }

.also { margin: -6px 0 12px; font-size: .92rem; color: var(--muted); }
.also a, .more a { color: var(--accent); text-decoration: none; }
.also a:hover, .more a:hover { text-decoration: underline; }
.more { margin: 14px 0 0; font-weight: 600; }
/* Kortrubrik med knapp till höger och knappar i samma stil som vilkendag.se. */
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px 12px; margin-bottom: 12px; }
.card-head h2 { margin: 0; min-width: 0; } /* en lång rubrik bryts hellre än att knapparna flyttas ner */
.card-head > :last-child:not(h2) { flex-shrink: 0; }
.tool-btn { font: inherit; font-size: .88rem; color: var(--text); background: var(--card);
  border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; cursor: pointer; }
.tool-btn:hover { color: var(--accent); }
.tool-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.name-title { font-size: 2rem; font-weight: 800; letter-spacing: -.02em; margin: 0 0 4px; }
.name-sub { color: var(--muted); margin: 0 0 12px; }
.spark { display: block; width: 100%; height: 64px; margin-top: 6px; }
.spark.big { height: 140px; }
.spark polyline { fill: none; stroke: var(--accent); stroke-width: 2; }
.spark-legend { display: flex; justify-content: space-between; color: var(--muted); font-size: .85rem; }

.week-days { list-style: none; margin: 0; padding: 0; }
.week-days li { display: grid; grid-template-columns: 6.5rem 1fr; gap: 4px 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.week-days li:first-child { border-top: 0; padding-top: 0; }
.week-days .day { font-weight: 600; white-space: nowrap; padding-top: 5px; }
.week-days .today .day::after { content: " •"; color: var(--accent); }
/* Ett litet kort per namn med antal kvinnor och män. */
.wk-names { display: grid; grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr)); gap: 6px; }
.wk-name { display: flex; flex-direction: column; min-width: 0; padding: 5px 10px 6px; border-radius: 10px;
  background: var(--accent-soft); color: var(--text); text-decoration: none; line-height: 1.3; }
.wk-name strong { font-size: .95rem; }
.wk-meta { color: var(--muted); font-size: .76rem; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wk-meta span + span { margin-left: 8px; }
.wk-meta span { display: inline-flex; align-items: center; gap: 2px; }
.wk-meta .kon { width: 1.05em; height: 1.05em; flex: none; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.wk-name:hover, .wk-name:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.wk-name:hover strong { color: var(--accent); }
/* Smal skärm: dagen ovanför korten, så att två kort får plats bredvid varandra. */
@media (max-width: 520px) { .week-days li { grid-template-columns: 1fr; } .week-days .day { padding-top: 0; } }

.year-nav { display: flex; align-items: center; gap: 6px; }
.year-nav button:disabled { visibility: hidden; }
.year-nav select { padding-right: 6px; }
@media (max-width: 520px) { .year-nav .yr { display: none; } }
/* Trendpil: riktningen visar nivån (↑ ↗ → ↘ ↓); samma färg för alla, formen bär betydelsen. */
.trend { display: inline-grid; place-items: center; vertical-align: middle; width: 1.5em; height: 1.5em; border-radius: 50%;
  color: var(--accent); background: var(--accent-soft); text-decoration: none; }
.trend svg, .trend-value svg, .trend-mini svg { width: 70%; height: 70%; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.name-title .trend { font-size: 1.1rem; margin-left: 4px; }
/* Klickbara namn i rubriker: ser ut som rubriken, understrykning vid hovring. */
#today-names a, .name-title > a:first-child { color: inherit; text-decoration: none; }
#today-names a:hover, .name-title > a:first-child:hover { color: var(--accent); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.name-hero h1 .trend { font-size: 1.6rem; }
a.trend:hover { background: var(--accent); color: var(--card); }
a.trend:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.trend-value { display: inline-flex; align-items: center; gap: 2px; margin-left: 6px; color: var(--muted); font-size: .9rem; font-variant-numeric: tabular-nums; }
.trend-value svg { width: 1em; height: 1em; }
.toplists { display: grid; gap: 16px 32px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.toplists ol { margin: 0; padding-left: 1.6em; }
/* Topp 20, i två spalter per lista när det får plats. */
/* Flickor och pojkar sida vid sida även på mobilen: namnen är korta och får plats i två smala spalter. */
#toplists .toplists { grid-template-columns: 1fr 1fr; gap: 16px 20px; }
#toplists .toplists > div { container-type: inline-size; min-width: 0; }
@container (min-width: 380px) {
  #toplists ol { columns: 2; column-gap: 24px; }
  #toplists li { break-inside: avoid; }
}
.toplists li { padding: 2px 0; }
.toplists li a { color: var(--text); text-decoration: none; }
.toplists li a:hover { color: var(--accent); text-decoration: underline; }
.source { color: var(--muted); font-size: .85rem; margin: 12px 0 0; }
/* Kategorierna på startsidan: namn, antal och exempel, i spalter när det får plats. */
.categories { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px 32px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.categories li { padding: 6px 0; border-top: 1px solid var(--line); }
.categories li > a { display: block; color: var(--text); text-decoration: none; }
.categories li > a:hover strong { color: var(--accent); text-decoration: underline; }
.categories .n { color: var(--muted); font-size: .85rem; white-space: nowrap; }
.categories .examples { display: block; color: var(--muted); font-size: .88rem; }
.categories .examples a { color: inherit; text-decoration: none; }
.categories .examples a:hover { color: var(--accent); text-decoration: underline; }
.category-text { max-width: 40rem; margin: 10px auto 0; }
.source a, .about a { color: var(--accent); }

.site-foot { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line); text-align: center; color: var(--muted); font-size: .85rem; }
.site-foot .intro { max-width: 46rem; margin: 0 auto 14px; line-height: 1.55; }
/* Länkar till dagar på systersidan vilkendag.se: som vanlig text, understrykning visar att de går att klicka. */
.day-link { color: inherit; text-decoration: underline dotted; text-decoration-color: var(--muted); text-underline-offset: 3px; }
.day-link:hover { color: var(--accent); text-decoration-color: currentColor; }
.week-days .day-link { text-decoration: none; }
.week-days .day-link:hover { text-decoration: underline; }
.site-foot .sister { margin: 0 0 10px; }
.site-foot strong { color: var(--text); font-weight: 600; }
.site-foot a { color: var(--accent); text-decoration: none; }
.site-foot a:hover { text-decoration: underline; }
/* Rutan om företaget bakom sidan, sist bland rutorna, i samma stil som rutan Om uppgifterna på vilketklimat.se. */
.foretag p { margin: 0 0 10px; max-width: 44rem; }
.foretag p:last-child { margin-bottom: 0; }
.foretag a { color: var(--accent); }
#card-foretag h2 { margin-bottom: 2px; }
#card-foretag .orgnr { color: var(--muted); font-size: .85rem; margin: 0 0 12px; }
.foretag-grid { margin-top: 16px; }

/* Namnets egen sida */
.page-head { position: relative; margin-bottom: 8px; }
.page-head .search { margin-top: 0; }
.name-hero { text-align: center; margin: 8px 0 24px; }
.name-hero h1 { margin: 0; }
.name-hero .name-sub { font-size: 1.1rem; margin: 6px 0 0; }
.name-hero .also { margin: 6px 0 0; }
details { margin-top: 12px; }
summary { cursor: pointer; color: var(--accent); font-weight: 600; }
/* Kategorisidans namn: "Visa alla" försvinner när resten av namnen visas, som fortsätter direkt efter de första. */
.more-chips[open] { margin-top: 6px; }
.more-chips[open] > summary { display: none; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { text-align: right; padding: 5px 8px; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { text-align: left; padding-left: 0; }
th { color: var(--muted); font-weight: 600; font-size: .85rem; }
table.years { max-width: 280px; margin-top: 8px; }
.compare a { color: var(--accent); text-decoration: none; }
.compare tr.self td { font-weight: 700; }
.table-scroll { overflow-x: auto; }

/* Karta: län efter placering. En blå skala, mörkast = bäst; i mörkt läge ljusast = bäst. */
:root { --r0: #173f82; --r1: #2f62b3; --r2: #5f8ad0; --r3: #93b3e6; --r4: #c3d5f3; --rx: #ebe9e3; }
@media (prefers-color-scheme: dark) {
  :root { --r0: #b5d0ff; --r1: #82a9ee; --r2: #5a84c9; --r3: #3e639f; --r4: #2e4a78; --rx: #3a3e46; }
}
.region { display: grid; gap: 16px 28px; grid-template-columns: minmax(0, 240px) 1fr; align-items: start; }
@media (max-width: 620px) { .region { grid-template-columns: 1fr; } .map { max-width: 240px; margin: 0 auto; } }
.map { margin: 0; }
.map svg { display: block; width: 100%; height: auto; }
.map path { stroke: var(--card); stroke-width: .6; stroke-linejoin: round; }
.map path:hover { stroke: var(--text); stroke-width: 1.2; }
.r0 { fill: var(--r0); background: var(--r0); } .r1 { fill: var(--r1); background: var(--r1); }
.r2 { fill: var(--r2); background: var(--r2); } .r3 { fill: var(--r3); background: var(--r3); }
.r4 { fill: var(--r4); background: var(--r4); } .rx { fill: var(--rx); background: var(--rx); }
.map-legend { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .8rem; color: var(--muted); }
.map-legend li { display: flex; align-items: center; gap: 5px; }
.map-legend .sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.region-lead { margin: 0 0 10px; }

/* Diagram över kategoriernas andel av nyfödda (hantelldiagram): ring = första året, punkt = senaste. */
:root { --kc-to: #1f5fbf; }
@media (prefers-color-scheme: dark) { :root { --kc-to: #5a8cec; } }
#card-kategorier, .kc-card { position: relative; }
.kc { margin: 0 0 20px; }
.kc-note { margin: 0 0 8px; font-size: .92rem; line-height: 1.5; color: var(--muted); }
.kc figcaption { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; color: var(--muted); font-size: .9rem; margin-bottom: 8px; }
.kc-legend { display: inline-flex; gap: 14px; }
.kc-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.kc-legend .kc-dot { position: static; transform: none; }
.kc-rows { display: grid; }
.kc-row { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "label val" "track track"; gap: 2px 12px;
  align-items: center; padding: 5px 6px; margin: 0 -6px; border-radius: 6px; color: var(--text); text-decoration: none; }
@media (min-width: 620px) { .kc-row { grid-template-columns: 15rem 1fr 4.2rem; grid-template-areas: "label track val"; } }
a.kc-row:hover, a.kc-row:focus-visible { background: var(--accent-soft); outline: none; }
.kc-label { grid-area: label; font-size: .92rem; }
.kc-val { grid-area: val; text-align: right; white-space: nowrap; font-weight: 600; font-variant-numeric: tabular-nums; font-size: .92rem; }
.kc-track { grid-area: track; position: relative; height: 16px; margin: 0 7px; } /* marginal så att punkter vid 0 % inte klipps */
.kc-grid { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); }
/* På smala skärmar ligger stapeln under etiketten: ett tydligt spår i stället för rutnät, så att punkterna inte svävar fritt. */
.kc-track::before { content: ""; position: absolute; left: -7px; right: -7px; top: 5px; height: 6px; border-radius: 3px; background: var(--track); }
.kc-axis .kc-track::before { content: none; }
@media (max-width: 619px) {
  .kc-row { padding: 6px 6px 7px; }
  .kc-row .kc-grid { display: none; }
  .kc-axis { padding-top: 0; }
}
@media (min-width: 620px) { .kc-track::before { content: none; } }
.kc-link { position: absolute; top: 7px; height: 2px; background: var(--muted); opacity: .45; }
.kc-dot { position: absolute; top: 50%; width: 10px; height: 10px; border-radius: 50%; transform: translate(-50%, -50%);
  box-shadow: 0 0 0 2px var(--card); display: inline-block; }
.kc-from { background: var(--card); border: 2px solid var(--muted); }
.kc-to { background: var(--kc-to); }
.kc-axis .kc-track { height: 14px; }
.kc-tick { position: absolute; transform: translateX(-50%); color: var(--muted); font-size: .75rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kc-tick:first-child { transform: none; }
.kc-tick:last-child { transform: translateX(-100%); }
.kc-tip { position: absolute; z-index: 5; max-width: 320px; padding: 6px 10px; border-radius: 8px; font-size: .85rem;
  background: var(--text); color: var(--card); box-shadow: 0 4px 14px rgb(0 0 0 / .18); pointer-events: none; }
.kc-tip[hidden] { display: none; }
/* Liten trendpil efter namnet i topplistan (bara det senaste året). */
.trend-mini { display: inline-flex; width: .95em; height: .95em; vertical-align: -.1em; color: var(--muted); }
.trend-mini svg { width: 100%; height: 100%; }
/* Kartor där länen är länkar till länssidorna. */
.map a:focus-visible path { stroke: var(--text); stroke-width: 1.6; }
.map a path { cursor: pointer; }
.lan-table td:first-child a, .lan-table td a { color: var(--accent); text-decoration: none; }
.lan-table td a:hover, .compare td a:hover { text-decoration: underline; }
.lan-table tfoot td { font-weight: 700; border-bottom: 0; border-top: 2px solid var(--line); }
.lan-table td:nth-child(2) { white-space: nowrap; }
.lan-table th::first-letter { text-transform: uppercase; }
.lan-table th:nth-child(n+3), .lan-table td:nth-child(n+3) { text-align: left; }
.region > div { min-width: 0; } /* låt tabellen krympa i stället för att tränga ut kortet på smala skärmar */
@media (max-width: 520px) { .lan-table th, .lan-table td { padding: 5px 3px; font-size: .84rem; } .lan-table .lang { display: none; } }
/* Länssidan: årsval som länkar, topplistor med antal och andra län. */
.year-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 12px; }
.year-links a, .year-links span { font-size: .9rem; padding: 3px 10px; border-radius: 8px; border: 1px solid var(--line); text-decoration: none; color: var(--text); }
.year-links a:hover { color: var(--accent); }
.year-links [aria-current] { background: var(--accent); border-color: var(--accent); color: var(--card); font-weight: 600; }
/* Flickor och pojkar sida vid sida även på mobilen, som startsidans topplistor. */
.lan-toplists { grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.lan-toplists > div { min-width: 0; }
.lan-toplists ol { margin: 0; padding-left: 2em; }
@media (max-width: 520px) { .lan-toplists ol { padding-left: 1.7em; } .lan-toplists li { font-size: .94rem; } }
.lan-toplists li { padding: 2px 0; }
.lan-toplists .n, .toplists .n { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
.lan-chips { align-content: start; }
.lan-chips .self { font-size: .92rem; border-radius: 999px; padding: 3px 12px; background: var(--accent); color: var(--card); font-weight: 600; }
/* Namn i siffror: tre grupper sida vid sida när det får plats. */
.siffror-grupper { gap: 8px 32px; }
@media (min-width: 860px) { .siffror-grupper { grid-template-columns: 1.45fr 1.1fr .9fr; } }
.siffror-grupper h3 { margin-top: 0; }
/* Varje uppgift som rubrik över värdet, vänsterställt och med en linje emellan: blir lugnare än två spalter där både
   etiketter och namnlistor radbryts. Korta tal står på samma rad som etiketten när det finns plats. */
.siffror-grupper > div { min-width: 0; }
dl.siffror { display: block; }
dl.siffror > div { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0 12px;
  padding: 7px 0; border-top: 1px solid var(--line); }
dl.siffror > div:first-child { border-top: 0; padding-top: 0; }
dl.siffror dt { font-size: .88rem; }
dl.siffror dd { white-space: normal; font-weight: 400; text-align: left; }
dl.siffror .text dt { flex-basis: 100%; }
dl.siffror .tal { flex-wrap: nowrap; }
dl.siffror .tal dd { white-space: nowrap; font-weight: 600; font-variant-numeric: tabular-nums; }
dl.siffror dd a { color: var(--accent); text-decoration: none; font-weight: 600; }
dl.siffror dd a:hover { text-decoration: underline; }
dl.siffror .n { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
@media (max-width: 400px) { .lan-table th, .lan-table td { font-size: .8rem; padding: 4px 2px; } }
