/* gruvkartor.se · Registret design system.
   Tokens and components per design_handoff_registret/README.md. */

/* ── Fonts (self-hosted, EU-served via popcorn/Bunny) ──────────────── */
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal; font-weight: 400; font-display: swap;
  src: url("/static/fonts/IBMPlexSans-Regular.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal; font-weight: 500; font-display: swap;
  src: url("/static/fonts/IBMPlexSans-Medium.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal; font-weight: 600; font-display: swap;
  src: url("/static/fonts/IBMPlexSans-SemiBold.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal; font-weight: 700; font-display: swap;
  src: url("/static/fonts/IBMPlexSans-Bold.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal; font-weight: 400; font-display: swap;
  src: url("/static/fonts/IBMPlexMono-Regular.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal; font-weight: 500; font-display: swap;
  src: url("/static/fonts/IBMPlexMono-Medium.woff2") format("woff2");
}

/* ── Reset ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, h5, h6, p { margin: 0; }

/* ── Tokens ────────────────────────────────────────────────────────── */
:root {
  --paper:     #f7f4ee;
  --paper-2:   #efebe1;
  --ink:       #1a1a1a;
  --ink-2:     #3a3a37;
  --muted:     #7a7468;
  --rule:      #1a1a1a;
  --rule-soft: #d0c9bd;
  --rule-fine: #e2dccf;
  --rust:      #ba421d;
  --rust-deep: #6e230d;
  --neighbour: #8a8378;
  --green:     #4f6b3a;

  --display: "IBM Plex Sans", system-ui, sans-serif;
  --body: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ── Utility bar ───────────────────────────────────────────────────── */
.utility {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--muted);
  padding: 6px 32px;
  border-bottom: 1px solid var(--rule-fine);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  text-transform: uppercase;
}
.utility .ok { color: var(--green); }
.utility .ok::before {
  content: "●";
  margin-right: 4px;
  font-size: 9px;
  vertical-align: 1px;
}

/* ── Header / nav ──────────────────────────────────────────────────── */
/* Visible keyboard-focus indicator (WCAG 2.4.7). :focus-visible (not :focus) so
   mouse clicks don't draw rings; rust on the paper/ink palette has clear
   contrast. */
:focus-visible { outline: 2px solid var(--rust); outline-offset: 2px; }

/* Skip-to-content link: off-screen until keyboard-focused (WCAG 2.4.1). */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
}
.skip-link:focus {
  left: 8px;
  top: 8px;
  background: var(--paper);
  color: var(--ink);
  padding: 8px 12px;
  border: 1px solid var(--ink);
}

.site-nav {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  padding: 16px 32px;
  border-bottom: 1px solid var(--ink);
  gap: 32px;
}
.brand {
  font-family: var(--display);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.015em;
  display: inline-flex;
  align-items: baseline;
  gap: 1px;
  color: var(--ink);
}
.brand .tld {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 14px;
  color: var(--rust);
  letter-spacing: 0;
}
.site-nav ul {
  display: flex;
  gap: 22px;
  justify-content: center;
  font-size: 13.5px;
  font-weight: 500;
}
.site-nav a { color: var(--ink-2); }
.site-nav a.active { color: var(--rust); }
.site-nav a:hover { color: var(--ink); }
.site-nav .search {
  font-family: var(--mono);
  font-size: 11.5px;
  border: 1px solid var(--ink);
  padding: 6px 10px;
  color: var(--muted);
  background: var(--paper);
  width: 220px;
  letter-spacing: 0.02em;
  border-radius: 0;
}

/* ── Type helpers ──────────────────────────────────────────────────── */
h1, h2, h3 { font-family: var(--display); color: var(--ink); }
.eyebrow, .meta-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.lede {
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 60ch;
}
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }

/* Per-permit factual lead paragraph (SEO/GEO: extractable, anti-thin-content) */
.permit-summary {
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--ink-2);
  max-width: 70ch;
  margin: 18px 0 0;
}

/* ── Shell ─────────────────────────────────────────────────────────── */
.shell {
  padding: 0 32px 60px;
  max-width: 1440px;
  margin: 0 auto;
}
.section {
  padding: 40px 0;
  border-top: 1px solid var(--ink);
}
.section:first-of-type { border-top: 0; padding-top: 36px; }
.section-head {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 16px;
  margin-bottom: 24px;
  align-items: baseline;
}
.section-head .num {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-transform: uppercase;
}
.section-head .title {
  font-family: var(--display);
  font-weight: 600;
  font-size: 24px;
  letter-spacing: -0.015em;
  /* These are real <h2> headings; null the UA heading margins so the section
     header keeps its baseline-aligned grid layout (was a <span>). */
  margin: 0;
}
.section-head .sub {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* ── Landing hero ──────────────────────────────────────────────────── */
.hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  padding: 40px 0 32px;
  align-items: start;
  border-top: 0;
}
.hero .label {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 5px 0;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  margin-bottom: 18px;
  text-transform: uppercase;
}
.hero h1 { font-size: 56px; font-weight: 500; letter-spacing: -0.03em; line-height: 1.0; }
.hero .lede { margin-top: 18px; }
.hero figure { margin: 0; }
.hero figure figcaption {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  margin-top: 12px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--muted);
  text-transform: uppercase;
}
.hero figure figcaption .center { text-align: center; }
.hero figure figcaption .right { text-align: right; color: var(--ink-2); }

/* ── Map slot ──────────────────────────────────────────────────────── */
.map-slot {
  position: relative;
  background: #ebe5d4;
  color: #1a1a1a;
  aspect-ratio: 4 / 3;
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--ink);
  display: block;
}
.map-slot.wide { aspect-ratio: 16 / 10; }
.map-slot.tall { aspect-ratio: 3 / 4; }
.map-slot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.map-slot__title {
  position: absolute; left: 16px; top: 16px; right: 16px;
  font-size: 13px; line-height: 1.35; letter-spacing: 0.01em;
}
.map-slot__title strong {
  display: block; font-size: 17px; letter-spacing: -0.005em; margin-bottom: 4px;
}
.map-slot__meta {
  position: absolute; left: 16px; right: 16px; bottom: 16px;
  display: flex; justify-content: space-between; align-items: flex-end;
  font-size: 10.5px; letter-spacing: 0.02em; opacity: 0.65;
}
.map-slot__meta .scale { display: inline-flex; align-items: center; gap: 6px; }
.map-slot__meta .scale::before {
  content: ""; display: inline-block;
  width: 36px; height: 3px; background: currentColor; opacity: 0.6;
}
.map-slot__rose {
  position: absolute; top: 16px; right: 18px;
  font-size: 10px; letter-spacing: 0.08em; text-align: center; opacity: 0.55;
}
.map-slot__rose::before {
  content: "N"; display: block; font-weight: 600; font-size: 11px; margin-bottom: 2px;
}

/* ── KPI strip ─────────────────────────────────────────────────────── */
.kpi {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  border: 1px solid var(--ink);
  background: var(--paper);
}
.kpi .cell { padding: 18px; border-right: 1px solid var(--rule-fine); }
.kpi .cell:last-child { border-right: 0; }
.kpi .cell .l {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-transform: uppercase;
}
.kpi .cell .n {
  margin-top: 8px;
  font-family: var(--display);
  font-weight: 500;
  font-size: 30px;
  letter-spacing: -0.025em;
  line-height: 1;
}
.kpi .cell .n.rust { color: var(--rust); }
/* KPI cells link to their filtered view; the <a> is display:contents so the
   layout is unchanged but cmd/middle-click open a new tab natively. */
.kpi .cell a { display: contents; color: inherit; text-decoration: none; }
.kpi .cell[data-href] { cursor: pointer; transition: background 0.1s; }
.kpi .cell[data-href]:hover { background: rgba(186,66,29,0.04); }
.kpi .cell[data-href]:hover .n { color: var(--rust); }
.kpi .cell .delta {
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--green);
  letter-spacing: 0.02em;
}
.kpi .cell .delta.down { color: var(--rust); }

/* ── Entry table ───────────────────────────────────────────────────── */
.entry-table {
  border: 1px solid var(--ink);
  border-collapse: collapse;
  width: 100%;
  background: var(--paper);
  font-size: 14px;
}
.entry-table tr { border-bottom: 1px solid var(--rule-fine); }
.entry-table tr:last-child { border-bottom: 0; }
.entry-table td { padding: 16px 18px; vertical-align: middle; }
.entry-table td.num {
  font-family: var(--mono);
  font-size: 11px; color: var(--muted);
  letter-spacing: 0.04em; width: 60px;
}
.entry-table td.path {
  font-family: var(--mono);
  font-size: 12px; color: var(--rust);
  letter-spacing: 0.01em; width: 160px;
}
.entry-table td .name {
  font-weight: 600; font-size: 15px; letter-spacing: -0.005em;
}
.entry-table td .desc { color: var(--ink-2); font-size: 13px; margin-top: 2px; }
.entry-table td.count {
  font-family: var(--display);
  font-weight: 500; font-size: 26px;
  letter-spacing: -0.02em; text-align: right; width: 110px;
}
.entry-table tr:hover { background: rgba(186,66,29,0.04); cursor: pointer; }
.entry-table tr:hover td.path { color: var(--rust-deep); }
.entry-table a { display: contents; color: inherit; }

/* ── Steps ─────────────────────────────────────────────────────────── */
.steps {
  display: grid;
  grid-template-columns: 56px 1fr 1fr 1fr;
  gap: 0;
}
.steps .lead {
  font-family: var(--mono);
  font-size: 11px; color: var(--muted);
  letter-spacing: 0.06em; text-transform: uppercase;
  padding-top: 4px;
}
.step {
  padding: 0 24px 0 22px;
  border-left: 1px solid var(--rule-soft);
}
.step .n {
  font-family: var(--mono);
  font-size: 11px; letter-spacing: 0.06em; color: var(--rust);
  text-transform: uppercase;
}
.step h3 { margin: 6px 0 8px; font-size: 17px; font-weight: 600; letter-spacing: -0.005em; }
.step p { color: var(--ink-2); font-size: 14px; }
.step a { color: var(--rust); border-bottom: 1px solid currentColor; }

/* ── Price line ────────────────────────────────────────────────────── */
.price-line {
  display: grid;
  grid-template-columns: 56px 1fr 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 18px 0;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}
.price-line .lead {
  font-family: var(--mono);
  font-size: 11px; color: var(--muted);
  letter-spacing: 0.06em; text-transform: uppercase;
}
.price-line .commercial,
.price-line .ideell { display: flex; align-items: baseline; gap: 10px; }
.price-line .nr {
  font-family: var(--display); font-weight: 500;
  font-size: 26px; letter-spacing: -0.02em;
}
.price-line .ideell .nr { color: var(--green); }
.price-line .l {
  font-family: var(--mono);
  font-size: 11px; color: var(--muted); letter-spacing: 0.02em;
  text-transform: uppercase;
}
.price-line .ref a {
  font-family: var(--mono); font-size: 12px;
  color: var(--rust); border-bottom: 1px solid currentColor;
}

/* ── Crumb ─────────────────────────────────────────────────────────── */
.crumb {
  font-family: var(--mono);
  font-size: 11px; letter-spacing: 0.04em;
  color: var(--muted); text-transform: uppercase;
  padding-top: 24px;
}
.crumb a { color: var(--rust); }
.crumb a:hover { color: var(--rust-deep); }
.crumb .sep { padding: 0 6px; color: var(--muted); }

/* ── Permit head ───────────────────────────────────────────────────── */
.permit-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 32px;
  align-items: end;
  padding: 18px 0 24px;
  border-bottom: 1px solid var(--ink);
}
.permit-head .id {
  font-family: var(--mono);
  font-size: 11px; color: var(--muted);
  letter-spacing: 0.04em; text-transform: uppercase;
}
.permit-head .title {
  font-size: 52px; font-weight: 500;
  letter-spacing: -0.03em; line-height: 0.98;
  margin-top: 8px;
}
.permit-head .sub {
  margin-top: 14px;
  display: flex; gap: 18px; flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 12px; color: var(--ink-2);
  letter-spacing: 0.01em;
}
.permit-head .sub .status {
  color: var(--rust); font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.permit-head .sub .status.dim { color: var(--muted); }
.permit-head .sub .status::before {
  content: "●"; margin-right: 5px; font-size: 10px; vertical-align: 1px;
}
.permit-head aside { text-align: right; }
.permit-head aside .l {
  font-family: var(--mono);
  font-size: 11px; color: var(--muted);
  letter-spacing: 0.04em; text-transform: uppercase;
}
.permit-head aside .v {
  margin-top: 6px;
  font-size: 18px; font-weight: 500; letter-spacing: -0.005em;
}
.permit-head aside .v a { color: var(--ink); border-bottom: 1px solid var(--rule-soft); }

/* ── Permit body ───────────────────────────────────────────────────── */
.permit-body {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 40px;
  margin-top: 32px;
}
.permit-figures { display: flex; flex-direction: column; gap: 24px; }
.permit-figures figure { margin: 0; }
/* The second map (översikt context) renders full-width, equal to the hero.
   When a third+ map is added, reintroduce a max-width shrink on figure.context
   so only the hero stays large. */
.permit-figures .figcap {
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 11px; color: var(--muted);
  letter-spacing: 0.02em; text-transform: uppercase;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

/* Legend (content-filtered teckenförklaring) is a download, not a preview —
   a compact PNG/PDF pair tucked under its tier's map buttons in the dl-card. */
.dl-legend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: center;
}
.dl-legend .dl-legend-label {
  grid-column: 1 / -1;
  font-family: var(--mono);
  font-size: 10.5px; color: var(--muted);
  letter-spacing: 0.04em; text-transform: uppercase;
}
.btn.compact {
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 9px 12px;
  font-size: 13px;
}

.future-strip {
  border: 1px dashed var(--rule-soft);
  padding: 14px 18px;
  font-family: var(--mono);
  font-size: 12px; color: var(--muted);
  letter-spacing: 0.01em; line-height: 1.5;
}
.future-strip strong {
  display: block; font-weight: 500;
  color: var(--ink-2); margin-bottom: 4px;
  text-transform: uppercase; letter-spacing: 0.04em; font-size: 11px;
}

.permit-aside { display: flex; flex-direction: column; gap: 28px; }

/* ── Download card ─────────────────────────────────────────────────── */
.dl-card { border: 1px solid var(--ink); background: var(--paper); }
.dl-card > header {
  padding: 12px 18px;
  background: var(--ink); color: var(--paper);
  font-family: var(--mono);
  font-size: 11px; letter-spacing: 0.08em;
  text-transform: uppercase;
}
.dl-card .body { padding: 18px; }
.dl-card .price-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 18px;
  border: 1px solid var(--rule-soft);
}
.dl-card .price-grid > div { padding: 12px 14px; }
.dl-card .price-grid .commercial { border-right: 1px solid var(--rule-soft); }
.dl-card .price-grid .l {
  font-family: var(--mono);
  font-size: 10.5px; letter-spacing: 0.06em;
  color: var(--muted); text-transform: uppercase;
}
.dl-card .price-grid .nr {
  font-family: var(--display); font-weight: 500;
  font-size: 22px; letter-spacing: -0.02em; margin-top: 4px;
}
.dl-card .price-grid .ideell .nr { color: var(--green); }
.dl-card .price-grid .note {
  font-family: var(--mono);
  font-size: 10.5px; color: var(--muted);
  margin-top: 2px; letter-spacing: 0.01em;
}
.dl-row { display: flex; flex-direction: column; gap: 8px; }
.dl-row + .dl-label { margin-top: 14px; }
.dl-label {
  font-family: var(--mono);
  font-size: 21px; color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase;
  margin-bottom: 8px;
}
.btn {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--display);
  font-weight: 500; font-size: 14px;
  letter-spacing: -0.005em;
  text-align: left;
  border-radius: 0;
}
.btn .fmt {
  font-family: var(--mono);
  font-weight: 400; font-size: 10.5px;
  letter-spacing: 0.05em; color: var(--muted);
  text-transform: uppercase;
}
.btn .arrow { font-family: var(--mono); font-size: 14px; }
.btn:hover { background: var(--ink); color: var(--paper); }
.btn:hover .fmt { color: var(--paper); opacity: 0.7; }
.btn.primary { background: var(--ink); color: var(--paper); }
.btn.primary .fmt { color: var(--paper); opacity: 0.7; }
.btn.primary:hover { background: var(--rust); border-color: var(--rust); }
.btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.dl-foot {
  margin-top: 14px; padding-top: 14px;
  border-top: 1px solid var(--rule-soft);
  font-size: 13px; color: var(--ink-2);
}
.dl-foot a { color: var(--rust); border-bottom: 1px solid currentColor; }
.dl-sources { margin-top: 14px; font-size: 13px; }
.dl-sources a { color: var(--rust); border-bottom: 1px solid currentColor; }
.entry-shortcuts { margin-top: 14px; font-size: 13px; color: var(--ink-2); }
.entry-shortcuts a { color: var(--rust); border-bottom: 1px solid currentColor; }
.entry-shortcuts .sep { color: var(--rule-soft); margin: 0 4px; }

/* ── Facts table ───────────────────────────────────────────────────── */
.facts { width: 100%; border-collapse: collapse; font-size: 13px; }
.facts tr { border-bottom: 1px solid var(--rule-fine); }
.facts tr:first-child { border-top: 1px solid var(--ink); }
.facts tr:last-child { border-bottom: 1px solid var(--ink); }
.facts th, .facts td {
  text-align: left; padding: 9px 12px 9px 0; vertical-align: top;
}
.facts th {
  width: 42%;
  font-family: var(--mono); font-weight: 400;
  font-size: 11px; color: var(--muted);
  letter-spacing: 0.04em; text-transform: uppercase;
}
.facts td { font-family: var(--display); font-weight: 500; }
.facts td.mono { font-family: var(--mono); font-weight: 400; letter-spacing: 0.01em; }
.facts td a { color: var(--rust); border-bottom: 1px solid rgba(186,66,29,0.35); }
.facts td a:hover { border-bottom-color: currentColor; }
.facts .chip {
  display: inline-block;
  padding: 1px 8px;
  margin: 0 3px 3px 0;
  background: var(--paper-2);
  font-family: var(--mono);
  font-size: 11.5px; font-weight: 400;
  letter-spacing: 0.01em;
}
/* Mineral chips on a permit page link to the per-mineral hub; keep the chip
   look (no link underline), rust on hover. */
.facts a.chip { color: inherit; text-decoration: none; }
.facts a.chip:hover { color: var(--rust); }

/* Hub-to-hub link rows (kommun -> län, län -> kommuns). */
.hub-links { margin: 14px 0; font-size: 13px; color: var(--ink-2); line-height: 1.9; }
.hub-links .hub-links-label { margin-right: 4px; }
.hub-links a { color: var(--rust); border-bottom: 1px solid currentColor; }
.hub-links .sep { color: var(--rule-soft); margin: 0 4px; }

/* Per-mineral hub: mining (decisive) section then prospecting (nominal). */
.mineral-section { margin-top: 32px; }
/* Sibling mineral hubs (lateral crawl edges). Same chip look as .facts .chip,
   but those rules are scoped to .facts, so restyle here. */
.mineral-siblings { margin: 12px 0 0; }
.mineral-siblings a.chip {
  display: inline-block;
  padding: 1px 8px;
  margin: 0 3px 3px 0;
  background: var(--paper-2);
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.01em;
  color: inherit;
  text-decoration: none;
}
.mineral-siblings a.chip:hover { color: var(--rust); }
.mineral-nominal-note { font-size: 13px; color: var(--ink-2); margin: 10px 0; max-width: 70ch; }
/* Index card: small "+N" nominal count next to the decisive count. */
.mineral-card .count-nominal { font-size: 12px; color: var(--muted); margin-left: 3px; font-weight: 400; }
/* "nominellt" tag + note on a prospecting permit's mineral row. */
.nominal-tag { font-weight: 400; font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.mineral-nominal-inline { margin-top: 6px; font-size: 12px; color: var(--ink-2); }

.h3 { font-size: 16px; font-weight: 600; letter-spacing: -0.005em; margin-bottom: 10px; }

.sources-list {
  display: flex; flex-direction: column;
  border-top: 1px solid var(--ink);
  font-size: 13px;
}
.sources-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--rule-fine);
}
.sources-list .when {
  font-family: var(--mono); font-size: 11px;
  color: var(--muted); letter-spacing: 0.02em;
  text-transform: uppercase;
}
.sources-list a { color: var(--rust); border-bottom: 1px solid currentColor; }

/* ── Map interlinks (neighbours in översikt + kommun map) ──────────────── */
.map-links { margin-top: 18px; }
.map-links-sub {
  font-family: var(--mono); font-size: 11px;
  color: var(--muted); letter-spacing: 0.02em; text-transform: uppercase;
  margin: -2px 0 10px;
}
.neigh-groups {
  display: flex; flex-direction: column;
  border-top: 1px solid var(--ink);
  font-size: 13px;
}
.neigh-groups li {
  padding: 9px 0;
  border-bottom: 1px solid var(--rule-fine);
}
.neigh-holder {
  display: flex; align-items: baseline; gap: 8px;
  font-weight: 600;
}
.neigh-holder a { color: var(--ink); border-bottom: 1px solid var(--rule-fine); }
.neigh-holder a:hover { border-bottom-color: var(--rust); }
.neigh-count { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.neigh-permits { margin-top: 3px; color: var(--ink-2); line-height: 1.5; }
.neigh-permits a { color: var(--rust); }
.neigh-permits a:hover { border-bottom: 1px solid currentColor; }
.map-links-more { font-size: 13px; margin-top: 10px; color: var(--muted); }
.kommun-map-link { font-size: 13px; margin-top: 10px; color: var(--ink-2); }
.kommun-map-link a { color: var(--rust); border-bottom: 1px solid currentColor; }

/* ── Region/group head ─────────────────────────────────────────────── */
.region-head {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 40px;
  align-items: last baseline;
  padding: 18px 0 24px;
  border-bottom: 1px solid var(--ink);
}
.region-head > div:only-child { grid-column: 1 / -1; }
.region-head .code {
  font-family: var(--mono);
  font-size: 14px; letter-spacing: 0.04em;
  color: var(--muted); text-transform: uppercase;
}
.region-head .title {
  font-family: var(--display);
  font-weight: 500; font-size: 64px;
  letter-spacing: -0.03em; line-height: 0.95;
  margin-top: 8px;
}
.region-head .deck {
  font-size: 15px; color: var(--ink-2);
  margin-top: 12px; max-width: 52ch;
}
.region-shape {
  border: 1px solid var(--ink);
  background: var(--paper-2);
  aspect-ratio: 3 / 4;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  font-family: var(--mono);
  color: var(--muted);
  text-transform: uppercase;
  font-size: 11px; letter-spacing: 0.06em;
}
.region-shape .label {
  position: absolute; bottom: 10px; left: 10px;
  font-size: 10px; letter-spacing: 0.06em;
  color: var(--muted); text-transform: uppercase;
}

/* ── Stat table ────────────────────────────────────────────────────── */
.stat-table {
  width: 100%;
  border-collapse: collapse;
  margin: 28px 0 24px;
  border: 1px solid var(--ink);
  background: var(--paper);
}
.stat-table th, .stat-table td {
  text-align: left; padding: 14px 18px;
  border-right: 1px solid var(--rule-fine);
  vertical-align: bottom;
}
.stat-table th:last-child, .stat-table td:last-child { border-right: 0; }
.stat-table thead th {
  font-family: var(--mono); font-weight: 400;
  font-size: 10.5px; letter-spacing: 0.06em;
  color: var(--muted); text-transform: uppercase;
  border-bottom: 1px solid var(--rule-soft);
}
.stat-table tbody td {
  font-family: var(--display); font-weight: 500;
  font-size: 28px; letter-spacing: -0.025em;
  padding-top: 16px; padding-bottom: 16px;
}
.stat-table tbody td.rust { color: var(--rust); }
.stat-table tbody td.minerals {
  font-family: var(--mono); font-weight: 400;
  font-size: 13px; letter-spacing: 0.005em;
  padding-top: 22px; line-height: 1.5;
}

/* ── Mineral bar ───────────────────────────────────────────────────── */
.mineral-bar {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-bottom: 24px;
}
.mineral-chip {
  font-family: var(--mono);
  font-size: 12px; letter-spacing: 0.01em;
  padding: 4px 9px;
  border: 1px solid var(--rule-soft);
  background: var(--paper);
}
.mineral-chip b {
  font-weight: 500; color: var(--rust); margin-right: 6px;
}

/* ── Area-share stat (andel av ytan) + its source line ─────────────────── */
.stat-table tbody td.area-pct .muted {
  display: block;
  font-family: var(--mono);
  font-size: 12px; font-weight: 400; letter-spacing: 0;
  margin-top: 4px;
}
.stat-src {
  font-family: var(--mono);
  font-size: 11.5px; letter-spacing: 0.01em;
  color: var(--muted);
  margin: -8px 0 44px;
  line-height: 1.5;
}
.stat-src a { color: var(--muted); text-decoration: underline; }
.stat-src a:hover { color: var(--rust); }

/* ── Place facts (befolkning · yta · täthet) under a kommun/län header ──── */
.place-facts {
  display: flex; flex-wrap: wrap; gap: 8px 34px;
  margin: 4px 0 -4px;
  font-family: var(--mono);
  font-size: 9.75px; letter-spacing: 0.01em;
  color: var(--muted);
}
.place-facts b { font-weight: 500; color: var(--ink); }

/* ── List controls ─────────────────────────────────────────────────── */
.list-controls {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.list-controls select {
  background: transparent;
  color: var(--paper);
  border: 1px solid rgba(255,255,255,0.4);
  font-family: var(--mono);
  font-size: 11px; padding: 4px 8px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 0;
}
.list-controls select option {
  color: var(--ink); background: var(--paper);
}
.list-controls a {
  color: var(--paper); border-bottom: 1px solid rgba(255,255,255,0.4);
}

/* ── Permit table ──────────────────────────────────────────────────── */
.permit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.permit-table thead th {
  font-family: var(--mono); font-weight: 400;
  font-size: 10.5px; letter-spacing: 0.06em;
  color: var(--muted); text-transform: uppercase;
  text-align: left;
  padding: 12px 12px 10px 0;
  border-bottom: 1px solid var(--ink);
}
.permit-table thead th.r { text-align: right; }
.permit-table tbody tr { border-bottom: 1px solid var(--rule-fine); }
.permit-table tbody tr:hover { background: rgba(186,66,29,0.04); cursor: pointer; }
.permit-table tbody tr[hidden] { display: none; }
.permit-table tbody td {
  padding: 12px 12px 12px 0; vertical-align: middle;
}
.permit-table tbody td.idx {
  font-family: var(--mono); font-size: 11px;
  color: var(--muted); letter-spacing: 0.02em; width: 40px;
}
.permit-table tbody td.name {
  font-family: var(--display); font-weight: 500;
  font-size: 15px; letter-spacing: -0.005em;
}
.permit-table tbody td.name a { color: var(--ink); }
.permit-table tbody td.name a:hover { color: var(--rust); }
.permit-table tbody td.kommun { color: var(--ink-2); font-size: 13px; }
.permit-table tbody td.status {
  font-family: var(--mono);
  font-size: 11px; letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--rust);
}
.permit-table tbody td.status.dim { color: var(--muted); }
.permit-table tbody td.status::before {
  content: "●"; margin-right: 5px; font-size: 9px; vertical-align: 1px;
}
.permit-table tbody td.metal {
  font-family: var(--mono); font-size: 11.5px;
  color: var(--ink-2); letter-spacing: 0.005em;
}
.permit-table tbody td.diari {
  font-family: var(--mono); font-size: 11px;
  color: var(--muted); letter-spacing: 0.02em;
  text-align: right;
}
.permit-table tbody td.date {
  font-family: var(--mono); font-size: 11.5px;
  color: var(--ink-2); letter-spacing: 0.02em;
  text-align: right; white-space: nowrap;
}
.permit-table tbody td.date .a {
  color: var(--muted); display: block;
  font-size: 10.5px; margin-top: 1px;
}

/* ── Index cards (for /per-region/, etc.) ──────────────────────────── */
.index-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0;
  border: 1px solid var(--ink);
  background: var(--paper);
}
.index-grid .card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 16px;
  padding: 14px 16px;
  border-right: 1px solid var(--rule-fine);
  border-bottom: 1px solid var(--rule-fine);
  color: var(--ink);
}
.index-grid .card .name {
  font-weight: 500; font-size: 14px; letter-spacing: -0.005em;
}
.index-grid .card .count {
  font-family: var(--mono); font-size: 12px;
  color: var(--muted); letter-spacing: 0.02em;
}
.index-grid .card:hover {
  background: rgba(186,66,29,0.04);
}
.index-grid .card:hover .count { color: var(--rust); }
.index-grid .card.muted { color: var(--muted); font-style: italic; }

/* ── Invoice form ──────────────────────────────────────────────────── */
form.invoice { max-width: 640px; }
form.invoice label {
  display: block;
  margin: 18px 0 6px;
  font-family: var(--mono);
  font-size: 11px; letter-spacing: 0.06em;
  color: var(--muted); text-transform: uppercase;
}
form.invoice input,
form.invoice textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--ink);
  font: 14px var(--body);
  background: var(--paper);
  color: var(--ink);
  border-radius: 0;
}
form.invoice textarea { min-height: 6rem; resize: vertical; }
form.invoice button {
  margin-top: 22px;
  padding: 12px 18px;
  background: var(--ink); color: var(--paper);
  border: 1px solid var(--ink);
  font-family: var(--display);
  font-weight: 500; font-size: 14px;
  cursor: pointer; border-radius: 0;
}
form.invoice button:hover { background: var(--rust); border-color: var(--rust); }

/* ── Footer ────────────────────────────────────────────────────────── */
.site-foot {
  margin-top: 60px;
  padding: 22px 32px;
  border-top: 1px solid var(--ink);
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 32px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.02em;
  max-width: 1440px;
  margin-left: auto;
  margin-right: auto;
}
.site-foot strong {
  display: block;
  color: var(--ink);
  font-weight: 500;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.site-foot a { color: var(--ink-2); border-bottom: 1px solid var(--rule-soft); }
.site-foot a:hover { color: var(--ink); }

/* ── Responsive ────────────────────────────────────────────────────── */
@media (max-width: 960px) {
  .shell { padding: 0 20px 40px; }
  .utility { padding: 6px 20px; }
  .site-nav { grid-template-columns: auto 1fr; padding: 14px 20px; gap: 16px; }
  .site-nav .search { grid-column: 1 / -1; width: 100%; }
  .site-nav ul { gap: 16px; overflow-x: auto; justify-content: flex-end; white-space: nowrap; }
  .hero, .permit-body, .region-head { grid-template-columns: 1fr; }
  .region-head { gap: 16px; }
  .region-shape { max-width: 220px; }
  .hero h1 { font-size: 40px; }
  .permit-head { grid-template-columns: 1fr; }
  .permit-head aside { text-align: left; }
  .permit-head .title { font-size: 40px; }
  .region-head .title { font-size: 44px; }
  .kpi { grid-template-columns: repeat(3, 1fr); }
  .kpi .cell:nth-child(3) { border-right: 0; }
  .kpi .cell:nth-child(4), .kpi .cell:nth-child(5), .kpi .cell:nth-child(6) {
    border-top: 1px solid var(--rule-fine);
  }
  .steps { grid-template-columns: 1fr; }
  .steps .lead { display: none; }
  .step { border-left: 0; border-top: 1px solid var(--rule-soft); padding: 16px 0 0; }
  .price-line { grid-template-columns: 1fr; gap: 8px; }
  .site-foot { grid-template-columns: 1fr; gap: 18px; padding: 22px 20px; }
  .permit-table thead th.diari-col,
  .permit-table tbody td.diari { display: none; }
}

/* ── Enrichment overlays (P-3/P-4/P-11/P-12) ───────────────────────────── */
.overlays { margin-top: 22px; }
.overlay-facts { margin-bottom: 8px; }
.overlay-facts td { font-family: var(--display); line-height: 1.45; }
.overlays-note {
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--muted);
  max-width: 60ch;
  margin-top: 8px;
}
.overlays-note a { color: var(--rust); border-bottom: 1px solid currentColor; }

/* ── Company card (P-2 r2 HVD enrichment, /foretag/<orgnr>/) ────────────── */
.company-card {
  margin: 18px 0 28px;
  padding: 18px 20px;
  background: var(--paper-2);
  border: 1px solid var(--rule-soft);
}
.company-card .h3 { margin-bottom: 12px; }
.company-card .verksamhet {
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-2);
  max-width: 72ch;
  margin: 0 0 14px;
}
.company-card .facts { max-width: 640px; }
.company-card-src {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 10px;
}

/* ── Demo ribbon (GRUVKARTOR_DEMO review build) ─────────────────────────── */
.demo-ribbon {
  background: var(--rust);
  color: #fff;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
  padding: 6px 12px;
}
