:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-alt: #fbfaf6;
  --border: #e6e4dd;
  --border-strong: #cdcbc2;
  --text: #1a1d1a;
  --text-muted: #6b6e68;
  --text-faint: #9a9d97;
  --primary: #2d5f4e;
  --primary-hover: #234a3d;
  --accent: #4a9b73;

  --fossil: #8b5a3c;
  --biomass: #8a9a44;
  --renewable: #4a9b73;
  --electricity: #3b7ea1;
  --heat: #9a8fb0;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(26, 29, 26, 0.05);
  --shadow: 0 4px 16px rgba(26, 29, 26, 0.06);
  --shadow-lg: 0 12px 40px rgba(26, 29, 26, 0.08);

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

.container {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

a {
  color: var(--primary);
  text-decoration: none;
}
a:hover { color: var(--primary-hover); text-decoration: underline; }

h1, h2, h3 {
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0;
}

/* Header */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1rem;
  padding-bottom: 1rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--text);
  font-weight: 600;
  font-size: 1rem;
}
.brand:hover { text-decoration: none; color: var(--text); }
.brand-mark {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  display: inline-block;
}
.brand-text {
  font-feature-settings: "ss01" on;
}

.header-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.lang-toggle,
.header-btn {
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  cursor: pointer;
  transition: all 120ms ease;
}
.lang-toggle:hover,
.header-btn:hover {
  color: var(--text);
  border-color: var(--text-muted);
  background: var(--surface);
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 29, 26, 0.45);
  backdrop-filter: blur(2px);
}
.modal-panel {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 640px;
  max-height: calc(100vh - 3rem);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.modal-head h2 {
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.modal-close {
  background: none;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
}
.modal-close:hover { color: var(--text); background: var(--surface-alt); }
.modal-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.modal-body {
  padding: 1.25rem 1.5rem 1.75rem;
  overflow-y: auto;
}
.about-section + .about-section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.about-section h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.about-section p {
  margin: 0 0 0.5rem;
  color: var(--text);
}
.about-section p:last-child { margin-bottom: 0; }
.about-section .sep { color: var(--text-faint); margin: 0 0.4rem; }
body.modal-open { overflow: hidden; }

/* Hero */
.hero {
  padding: 4rem 0 2rem;
  text-align: center;
}
.hero h1 {
  font-size: clamp(1.6rem, 3.5vw, 2.35rem);
  line-height: 1.2;
  max-width: 36ch;
  margin: 0 auto;
}
.lead {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 52ch;
  margin: 1rem auto 2.5rem;
}

.search-wrapper {
  position: relative;
  max-width: 620px;
  margin: 0 auto;
  text-align: left;
}

/* Septima Search theme overrides */
.septima-input .septimasearch {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.septima-input .septimasearch.ssActive {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(74, 155, 115, 0.12), var(--shadow-lg);
  border-radius: var(--radius);
}
.septima-input .septimasearch .ssSearchBackground,
.septima-input .septimasearch .ssSearchBackground .ssFixedText,
.septima-input .septimasearch .ssSearchHeader .ssPromotes,
.septima-input .septimasearch .ssSearchHeader .ssPromotes .ssPromotedIcon,
.septima-input .septimasearch .ssSearchBackground input.ssInput {
  height: 52px;
  line-height: 52px;
}
.septima-input .septimasearch .ssSearchBackground input.ssInput {
  font-family: inherit;
  font-size: 1.05rem;
  color: var(--text);
  padding-left: 18px;
}
.septima-input .septimasearch .ssSearchBackground input.ssInput::placeholder {
  color: var(--text-faint);
  opacity: 1;
}
.septima-input .septimasearch .ssSearchResult {
  border-top: 1px solid var(--border);
  max-height: 380px;
}
li.search-result-hidden,
.search-result-hidden {
  display: none !important;
}
.septima-input .septimasearch ul.better-autocomplete > li.result {
  border-bottom: 1px solid var(--border);
  padding: 10px 14px;
}
.septima-input .septimasearch ul.better-autocomplete > li.result:last-child {
  border-bottom: none;
}
.septima-input .septimasearch ul.better-autocomplete > li.result.highlight,
.septima-input .septimasearch ul.better-autocomplete > li.result.selected {
  background-color: var(--surface-alt);
  border-bottom: 1px solid var(--border);
}
.septima-input .septimasearch li.result .ssResult .ssResultTitle {
  font-size: 0.98rem;
  color: var(--text);
  font-weight: 500;
  padding: 0 10px;
}
.septima-input .septimasearch li.result .ssResult .ssResultDescription {
  color: var(--text-muted);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}
.septima-input .septimasearch .ssTargetbit {
  background-color: var(--primary);
  color: #fff;
}
.septima-input .septimasearch .ssDetailTitle,
.septima-input .septimasearch .ssDetailPanel.ssActive .ssDetailTitle {
  background-color: var(--surface-alt);
}
.septima-input .septimasearch .ssDetailContent .ssDetailsGrid .ssValue.ssLink {
  color: var(--primary);
}
.septima-input .septimasearch .ssDetailContent > .item:nth-child(odd) {
  background-color: var(--surface-alt);
}

/* Detail */
.detail {
  padding: 2rem 0 4rem;
}
.detail-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 3rem 1rem;
}

.detail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.detail-head {
  padding: 2rem 2rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.detail-head h2 {
  font-size: clamp(1.4rem, 2.5vw, 1.75rem);
  margin-bottom: 0.35rem;
  letter-spacing: -0.015em;
}
.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}
.meta-row > span { display: inline-flex; gap: 0.35rem; align-items: baseline; }
.meta-row .meta-label { color: var(--text-faint); }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1px;
  background: var(--border);
  border-bottom: 1px solid var(--border);
}
.stat {
  background: var(--surface);
  padding: 1.5rem 2rem;
}
.stat-label {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
}
.stat-value {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.stat-value .stat-unit {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 0.35rem;
  letter-spacing: 0;
}
.stat--primary .stat-value { color: var(--primary); }

/* Section within card */
.section {
  padding: 2rem;
  border-bottom: 1px solid var(--border);
}
.section:last-child { border-bottom: none; }
.section h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 1rem;
}
.section .section-note {
  color: var(--text-faint);
  font-size: 0.85rem;
  margin: 0.75rem 0 0;
}

/* Emissions table */
.emissions-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
.emissions-table th,
.emissions-table td {
  text-align: left;
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}
.emissions-table td:last-child,
.emissions-table th:last-child {
  text-align: right;
}
.emissions-table tbody tr:last-child td { border-bottom: none; }
.emissions-table th {
  font-weight: 500;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.emissions-table .row-total td {
  font-weight: 600;
  color: var(--text);
  border-top: 1px solid var(--border-strong);
  border-bottom: none;
  padding-top: 0.9rem;
}
.emissions-table td.value.na { color: var(--text-faint); }

/* Factor tables (multi-year columns) */
.factors-table {
  table-layout: auto;
}
.factors-table th.value,
.factors-table td.value {
  text-align: right;
  white-space: nowrap;
}
.factors-table td:last-child,
.factors-table th:last-child { text-align: right; }
.factors-source a { color: var(--primary); }
.factors-unit { font-style: italic; }
.factors-section { overflow-x: auto; }

/* Fuel mix */
.fuel-bar {
  display: flex;
  width: 100%;
  height: 28px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface-alt);
  border: 1px solid var(--border);
}
.fuel-bar-segment {
  height: 100%;
  display: block;
  min-width: 2px;
  transition: opacity 150ms ease;
}
.fuel-bar-segment:hover { opacity: 0.85; }

.fuel-legend {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 0.35rem 1.25rem;
  margin-top: 1rem;
  list-style: none;
  padding: 0;
}
.fuel-legend li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.9rem;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.fuel-legend .swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}
.fuel-legend .name { flex: 1; color: var(--text); }
.fuel-legend .share { color: var(--text-muted); }

.fuel-cat-fossil    { background: var(--fossil); }
.fuel-cat-biomass   { background: var(--biomass); }
.fuel-cat-renewable { background: var(--renewable); }
.fuel-cat-electricity { background: var(--electricity); }
.fuel-cat-heat      { background: var(--heat); }

.cat-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin-top: 0.85rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.cat-summary-item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
.cat-summary-item .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

/* Varmeplan lookup */
.loading-msg {
  color: var(--text-muted);
  font-size: 1rem;
  margin: 0;
}
.varmeplan-link {
  display: inline-block;
  margin-top: 1rem;
  font-size: 0.95rem;
  font-weight: 500;
}

/* Footer */
.site-footer {
  background: var(--surface-alt);
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  color: var(--text-muted);
  font-size: 0.88rem;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  align-items: center;
  justify-content: space-between;
}
.footer-left, .footer-right {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.5rem;
  align-items: center;
}
.footer-right .sep { color: var(--text-faint); }

.copyright { color: var(--text-muted); }
.copyright a { color: var(--text); font-weight: 500; }
.footer-contact-label { color: var(--text-muted); }
.footer-contact-link { color: var(--text); font-weight: 500; }

.partners {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  margin: 0 auto 2.25rem;
}
.partners-label {
  margin: 0;
  color: var(--text-faint);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 500;
}
.partners-logos {
  display: flex;
  align-items: flex-start;
  gap: 2.5rem;
  flex-wrap: wrap;
  justify-content: center;
}
.partner-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  min-width: 210px;
}
.partner {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--text);
  text-decoration: none;
  padding: 0.3rem 0.4rem;
  border-radius: 6px;
  transition: opacity 150ms ease, transform 150ms ease;
}
.partner:hover {
  text-decoration: none;
  color: var(--text);
  opacity: 0.85;
  transform: translateY(-1px);
}
.partner:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.partner-name {
  font-weight: 600;
  letter-spacing: -0.01em;
  font-size: 1.05rem;
}
.partner--septima .partner-mark {
  width: 22px;
  height: 22px;
  color: var(--primary);
  flex-shrink: 0;
}
.partner--redata .partner-mark {
  height: 26px;
  width: auto;
  display: block;
}
.partner--envo .partner-mark {
  height: 26px;
  width: auto;
  display: block;
}

.download-group {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.download-label { color: var(--text-muted); }
.link-btn {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: var(--primary);
  cursor: pointer;
}
.link-btn:hover { color: var(--primary-hover); text-decoration: underline; }
.link-btn:disabled { color: var(--text-faint); cursor: wait; text-decoration: none; }
.link-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Responsive */
@media (max-width: 640px) {
  .hero { padding: 2.5rem 0 1.5rem; }
  .partners-logos { gap: 1.1rem; }
  .partner-group { min-width: 0; width: 100%; }
  .detail-head { padding: 1.5rem 1.25rem 1.25rem; }
  .section { padding: 1.5rem 1.25rem; }
  .stat { padding: 1.25rem; }
  .meta-row { gap: 0.3rem 1rem; font-size: 0.85rem; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}
